Skip to content

Commit dcc62ef

Browse files
George-iamclaude
andcommitted
feat(search): make >100-entry hint directive (MUST + ask user)
Replaces the descriptive "consider search mode" hint with an explicit MUST-style instruction: the agent surfaces the option to the user in its first response, asks whether to run the install command itself or let the user run it, and waits for an explicit decision before continuing the original task. Matches the existing instruction style used elsewhere (TRUNCATED OUTPUT RULE in server.ts, Pending Audits Check in CLAUDE.md). The agent never switches the mode without explicit user confirmation, and it does not nag again in the same session if the user declines. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8a603cd commit dcc62ef

1 file changed

Lines changed: 35 additions & 13 deletions

File tree

src/tools/context.ts

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,24 +188,46 @@ export function getFullContextSections(projectPath: string, workspacePath?: stri
188188
"**IMPORTANT**: if any tool output is truncated or saved to a file, use the Read tool to read the full file content into your context. Do not proceed with partial data.",
189189
].join("\n"));
190190

191-
// Soft hint for users still on full mode whose KB has grown past the
192-
// point where loading every body becomes wasteful. Threshold (100) is a
193-
// recommendation, not a cutoff — full mode keeps working at any size.
191+
// Directive hint for users still on full mode whose KB has grown past
192+
// the point where loading every body becomes wasteful. Threshold (100)
193+
// is a recommendation, not a cutoff — full mode keeps working at any
194+
// size. Worded as a MUST so the agent reliably surfaces the option to
195+
// the user instead of silently absorbing the warning.
194196
if (totalKbSize > 100) {
195197
parts.push([
196-
"## Knowledge base size hint",
198+
"## ⚠️ Knowledge base size — action required",
197199
"",
198-
`Your KB has ${totalKbSize} entries (memories + decisions). For KBs >100 entries,`,
199-
"switching to **search mode** loads only a catalog at session start and fetches",
200-
"full bodies on demand via `axme_get_memory(slug)` / `axme_get_decision(id)` /",
201-
"`axme_search_kb(query)`. Cuts startup tokens by ~10x. To enable:",
200+
`This project has **${totalKbSize} KB entries** (memories + decisions). Loading every body at`,
201+
"session start is wasteful at this size — both in tokens and in your time waiting for the",
202+
"context to load.",
202203
"",
203-
"```bash",
204-
"axme-code config set context.mode search",
205-
"```",
204+
"**MUST** tell the user, in your first response:",
206205
"",
207-
"(One-time install of ~100MB transformers.js + ~30MB MiniLM model. Falls back to",
208-
"full mode if install fails. Run `axme-code config set context.mode full` to revert.)",
206+
`> Your AXME knowledge base has ${totalKbSize} entries. Search mode would cut session-start`,
207+
"> tokens by ~10x — the agent gets a catalog (titles + 1-line summaries) at start and fetches",
208+
"> full bodies on demand via axme_search_kb / axme_get_memory / axme_get_decision.",
209+
"> ",
210+
"> Switching is opt-in. The CLI command is:",
211+
"> ",
212+
"> ```bash",
213+
"> axme-code config set context.mode search",
214+
"> ```",
215+
"> ",
216+
"> It installs ~100 MB of local embedding runtime (transformers.js + MiniLM model — runs on",
217+
"> your CPU, no API calls, no token cost). On install failure the config rolls back to full",
218+
"> automatically. Revert any time with `axme-code config set context.mode full`.",
219+
"> ",
220+
"> Want me to run the command for you now, or will you run it yourself in your terminal?",
221+
"",
222+
"Then **WAIT** for the user's decision before continuing with the original task:",
223+
"",
224+
"- If the user says \"run it\" / \"yes\" / \"go ahead\" → execute the command via Bash and proceed.",
225+
"- If the user says \"I'll do it\" / \"later\" / \"skip\" → do NOT run it; continue the task in full mode.",
226+
"- If the user is silent or asks an unrelated question → continue in full mode; do not nag again",
227+
" this session.",
228+
"",
229+
"Do NOT switch the mode without explicit user confirmation. Do NOT nag again in the same",
230+
"session if the user declines or moves on.",
209231
].join("\n"));
210232
}
211233
}

0 commit comments

Comments
 (0)