Skip to content

Commit 077d747

Browse files
abrookinsclaude
andcommitted
Fix docstring examples and API limit in AI tutor
- Replace specific names (Alice, John, Sarah) with "User" in LLM-facing docstrings for better memory performance - Fix AI tutor example to use API limit of 100 instead of 200 - Fix linting issues with variable names and imports 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 222e6cf commit 077d747

File tree

3 files changed

+485
-131
lines changed

3 files changed

+485
-131
lines changed

agent_memory_server/extraction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ async def handle_extraction(text: str) -> tuple[list[str], list[str]]:
233233
When extracting memories, you must resolve all contextual references to their concrete referents:
234234
235235
1. PRONOUNS: Replace ALL pronouns (he/she/they/him/her/them/his/hers/theirs) with the actual person's name, EXCEPT for the application user, who must always be referred to as "User".
236-
- "He loves coffee" → "John loves coffee" (if "he" refers to John)
237-
- "I told her about it" → "User told Sarah about it" (if "her" refers to Sarah)
238-
- "Her experience is valuable" → "Sarah's experience is valuable" (if "her" refers to Sarah)
236+
- "He loves coffee" → "User loves coffee" (if "he" refers to the user)
237+
- "I told her about it" → "User told colleague about it" (if "her" refers to a colleague)
238+
- "Her experience is valuable" → "User's experience is valuable" (if "her" refers to the user)
239239
- "My name is Alice and I prefer tea" → "User prefers tea" (do NOT store the application user's given name in text)
240240
- NEVER leave pronouns unresolved - always replace with the specific person's name
241241
@@ -286,7 +286,7 @@ async def handle_extraction(text: str) -> tuple[list[str], list[str]]:
286286
3. You are a large language model - do not extract facts that you already know.
287287
4. CRITICAL: ALWAYS ground ALL contextual references - never leave ANY pronouns, relative times, or vague place references unresolved. For the application user, always use "User" instead of their given name to avoid stale naming if they change their profile name later.
288288
5. MANDATORY: Replace every instance of "he/she/they/him/her/them/his/hers/theirs" with the actual person's name.
289-
6. MANDATORY: Replace possessive pronouns like "her experience" with "Sarah's experience" (if "her" refers to Sarah).
289+
6. MANDATORY: Replace possessive pronouns like "her experience" with "User's experience" (if "her" refers to the user).
290290
7. If you cannot determine what a contextual reference refers to, either omit that memory or use generic terms like "someone" instead of ungrounded pronouns.
291291
292292
Message:

agent_memory_server/mcp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async def get_current_datetime() -> dict[str, str | int]:
220220
1. User: "I was promoted today"
221221
- Call get_current_datetime → use `iso_utc` to set `event_date`
222222
- Update text to include a grounded, human-readable date
223-
(e.g., "Alice was promoted to Principal Engineer on August 14, 2025.")
223+
(e.g., "User was promoted to Principal Engineer on August 14, 2025.")
224224
"""
225225
now = datetime.utcnow()
226226
# Produce a Z-suffixed ISO 8601 string
@@ -241,8 +241,8 @@ async def create_long_term_memories(
241241
When creating memories, you MUST resolve all contextual references to their concrete referents:
242242
243243
1. PRONOUNS: Replace ALL pronouns (he/she/they/him/her/them/his/hers/theirs) with actual person names
244-
- "He prefers Python" → "John prefers Python" (if "he" refers to John)
245-
- "Her expertise is valuable" → "Sarah's expertise is valuable" (if "her" refers to Sarah)
244+
- "He prefers Python" → "User prefers Python" (if "he" refers to the user)
245+
- "Her expertise is valuable" → "User's expertise is valuable" (if "her" refers to the user)
246246
247247
2. TEMPORAL REFERENCES: Convert relative time expressions to absolute dates/times
248248
- "yesterday" → "2024-03-15" (if today is March 16, 2024)

0 commit comments

Comments
 (0)