4 -expose a `forget` tool that removes selected transcript spans from the **active
4 +let the model manage stale active context in long mixed-task sessions with one
27 - list active branch entries with id, role/type, rough token estimate, and no
28 - content preview by default.
29 - Preview is opt-in only because inspect output itself becomes newer context
30 - and can otherwise re-leak text the next `before` compaction is meant to
33 - append a compaction entry that replaces all active context before `entry_id`
34 - with a short tombstone summary.
25 + `forget(target?, reason?)`
26 + - `target="current_user"`:
27 + keep the latest user request onward; drop older active context.
28 + - `target="previous_user"`:
29 + keep the immediately previous user request onward; drop older active
31 + - omitted `target` defaults to `current_user`.
35 32 - Per-prompt system reminder:
36 - short turn-local line tells the agent to consider Forget when the user starts
37 - a new task/objective and skip same-task follow-ups.
33 + short turn-local line tells the agent to consider Forget in long mixed-task
34 + sessions and skip when prior context may still be needed.
39 - - target must exist on active branch.
40 - - target must be the latest user message, marked `current_user=yes` by
42 - - target must not be a `toolResult` or stale earlier user message.
43 - - dry-run preview available with `dry_run:
36 + - no entry IDs exposed to the model.
37 + - no inspect/debug/status tool.
38 + - no ranges or holes.
39 + - target must resolve to a user message on the active branch.
45 40 - no physical deletion claim; JSONL keeps recoverable history.
46 41 - not a secret-redaction guarantee; newer/current messages and model thinking
47 42 can still contain sensitive strings.
44 +##
Real-provider learnings 46 +- Long-session probes showed `previous_user` is useful for preserving immediate
47 + setup while dropping older task context.
48 +- Kimi and OpenAI used the API best in long mixed-task sessions.
49 +- Z.ai used it aggressively but still gained context cleanup.
50 +- MiniMax often ignored the tool; that is acceptable for weak-tool models.
51 +- `inspect`, raw entry IDs, `status`, and `user:<offset>` added complexity
52 + without reliable model gains.
52 - branch formatting, target validation, forget summary/details.
57 + target normalization, user-boundary resolution, terse errors, tombstone
54 - extension loads, tool registers, injects short per-prompt reminder, `inspect`
55 - output works, `before` creates compaction with expected `firstKeptEntryId`,
56 - context drops old text, `range` refuses.
60 + extension loads, tool registers, reminder injects, `current_user` and
61 + `previous_user` create compactions with expected `firstKeptEntryId`, context
62 + drops old text, invalid targets fail tersely.
58 64 optional `FORGET_REAL=1`; runs isolated SDK session with only Forget loaded,
59 - calls real model, applies forget, verifies compaction is active.
60 -- Real task-switch probes:
61 - baseline prompt had 0 compactions; stronger `MUST` + `current_user=yes` prompt
62 - caused MiniMax to forget at task switches while still answering simple tasks.
65 + calls the tool directly, verifies compaction is active.
67 70 cd extensions/forget
69 72 FORGET_REAL=1 bun run test:real
70 -pi -e ./index.ts --model minimax:MiniMax-M2.7-highspeed
73 +pi -e ./index.ts --model kimi-coding/kimi-for-coding