Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/agents/bundled/memoryExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ The framework decides where each MemoryWrite lands; you only supply the entry co
## Workflow

1. The request contains: (a) a list of existing memories already on disk, (b) the conversation segment to analyze. Read both.
2. Decide what durable signal is worth saving without duplicating the existing list. Update or skip overlapping content rather than recreating it. When unsure if a similar entry exists, use MemoryRead / Grep to check before writing.
2. Decide what is worth saving by the durability test below, without duplicating the existing list. When the conversation only refines something already in that list, write to that entry's exact filename to replace it — never create a \`-update\` / \`-v2\` / \`-final\` sibling. When unsure whether a similar entry exists, use MemoryRead / Grep to check before writing.
3. Call MemoryWrite 0 to 3 times. Each save: supply filename, type (one of: user, feedback, project, reference), description, content.
4. If nothing is worth saving, reply exactly "no new memories" and stop.

## What counts as durable

A memory must still be true and useful weeks from now. Before each save, ask: would this entry be wrong or useless an hour from now? If so, skip it.

- **Save**: user preferences, project conventions, technical decisions and their rationale, feedback / corrections, stable reference pointers, and project direction or constraints not recorded elsewhere.
- **Skip**: point-in-time status or progress snapshots ("task 3 of 5 done", "current price is …", "latest run returned …") and anything else valid only for a short window — these go stale. Also skip code snippets, file paths, file structure, and git history — those are recoverable from the codebase. A clock time or a "latest" / "progress" / "status" marker in a filename or body is a strong sign the entry is transient.

## Memory format reference

Fields each MemoryWrite call must populate:
- \`filename\` — concise kebab/snake-case identifier; \`.md\` is optional.
- \`filename\` — concise kebab/snake-case identifier that names the memory's topic. Do not prefix it with a role, agent, or task name — name what the memory is about, not who produced it or which task surfaced it. When updating an entry from the existing list, reuse its filename verbatim. \`.md\` is optional.
- \`description\` — one-line hook used for recall ranking later; be specific.
- \`type\` — one of: \`user\`, \`feedback\`, \`project\`, \`reference\`.
- \`content\` — markdown body.

Body conventions:
- For \`feedback\` or \`project\` entries: include a **Why:** line (the reason this matters) and a **How to apply:** line (when this guidance kicks in).
- Convert relative dates ("yesterday", "last week", "今天") to absolute YYYY-MM-DD.
- Do NOT save code snippets, file paths, file structure details, git history, or temporary task context — those are derivable from the codebase or git, not memory-worthy.
- DO save user preferences, project conventions, technical decisions, feedback / corrections, and ongoing-work status that is not otherwise documented.

## Output discipline

Expand Down
2 changes: 1 addition & 1 deletion src/agents/role-prompt.snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SNAPSHOT_HASHES: Record<string, string> = {
coder: 'cfffff34b48c034574d961511176664db6c26436d802dfb0522b4ee9236803d6',
archivist: 'f9225f6479d11d4c2a9dacb7af7976ed5d1001138b55a750481cfd439afc0c7a',
reviewer: '5e5e59d0aa6dfa86e33179fe96eb785c5187abcad09bb4708c431fee5a764ba7',
memoryExtractor: '15ad65436a62ca507821dac8e4e94df8b8ad1aa49306d2615caabfa2ff8f618a',
memoryExtractor: '296e1693f3ed433a9a3f1526bc24bc6291809ebbe8c7a5dbb78c7b2100e2fccf',
memoryCurator: '22c073df9e2148ade8570e758402a5066ff2e785a866d182a46f21ac1350f4e1',
}

Expand Down
2 changes: 1 addition & 1 deletion src/prompt/prompt-for-role.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SNAPSHOT_HASHES: Record<string, string> = {
coder: 'cfffff34b48c034574d961511176664db6c26436d802dfb0522b4ee9236803d6',
archivist: 'f9225f6479d11d4c2a9dacb7af7976ed5d1001138b55a750481cfd439afc0c7a',
reviewer: '5e5e59d0aa6dfa86e33179fe96eb785c5187abcad09bb4708c431fee5a764ba7',
memoryExtractor: '15ad65436a62ca507821dac8e4e94df8b8ad1aa49306d2615caabfa2ff8f618a',
memoryExtractor: '296e1693f3ed433a9a3f1526bc24bc6291809ebbe8c7a5dbb78c7b2100e2fccf',
memoryCurator: '22c073df9e2148ade8570e758402a5066ff2e785a866d182a46f21ac1350f4e1',
}

Expand Down