MCPcopy Create free account
hub / github.com/codeaashu/claude-code / buildExtractAutoOnlyPrompt

Function buildExtractAutoOnlyPrompt

src/services/extractMemories/prompts.ts:50–94  ·  view source on GitHub ↗
(
  newMessageCount: number,
  existingMemories: string,
  skipIndex = false,
)

Source from the content-addressed store, hash-verified

48 * Four-type taxonomy, no scope guidance (single directory).
49 */
50export function buildExtractAutoOnlyPrompt(
51 newMessageCount: number,
52 existingMemories: string,
53 skipIndex = false,
54): string {
55 const howToSave = skipIndex
56 ? [
57 '## How to save memories',
58 '',
59 'Write each memory to its own file (e.g., `user_role.md`, `feedback_testing.md`) using this frontmatter format:',
60 '',
61 ...MEMORY_FRONTMATTER_EXAMPLE,
62 '',
63 '- Organize memory semantically by topic, not chronologically',
64 '- Update or remove memories that turn out to be wrong or outdated',
65 '- Do not write duplicate memories. First check if there is an existing memory you can update before writing a new one.',
66 ]
67 : [
68 '## How to save memories',
69 '',
70 'Saving a memory is a two-step process:',
71 '',
72 '**Step 1** — write the memory to its own file (e.g., `user_role.md`, `feedback_testing.md`) using this frontmatter format:',
73 '',
74 ...MEMORY_FRONTMATTER_EXAMPLE,
75 '',
76 '**Step 2** — add a pointer to that file in `MEMORY.md`. `MEMORY.md` is an index, not a memory — each entry should be one line, under ~150 characters: `- [Title](file.md) — one-line hook`. It has no frontmatter. Never write memory content directly into `MEMORY.md`.',
77 '',
78 '- `MEMORY.md` is always loaded into your system prompt — lines after 200 will be truncated, so keep the index concise',
79 '- Organize memory semantically by topic, not chronologically',
80 '- Update or remove memories that turn out to be wrong or outdated',
81 '- Do not write duplicate memories. First check if there is an existing memory you can update before writing a new one.',
82 ]
83
84 return [
85 opener(newMessageCount, existingMemories),
86 '',
87 'If the user explicitly asks you to remember something, save it immediately as whichever type fits best. If they ask you to forget something, find and remove the relevant entry.',
88 '',
89 ...TYPES_SECTION_INDIVIDUAL,
90 ...WHAT_NOT_TO_SAVE_SECTION,
91 '',
92 ...howToSave,
93 ].join('\n')
94}
95
96/**
97 * Build the extraction prompt for combined auto + team memory.

Callers 2

runExtractionFunction · 0.85

Calls 1

openerFunction · 0.85

Tested by

no test coverage detected