feat: recall relevant knowledge automatically at turn start #24

Closed
opened 2026-11-05 03:49:36 +00:00 by david · 0 comments
Owner

The AGENTS.md rule asks the model to search knox before working. That depends on the model remembering — and this session produced several examples of it not remembering.

Recall should be a property of the harness: before a turn starts, search knox with the user's prompt and put the best hits in front of the model.

Constraints learned from the freshness work

  • The index is now current at turn start (knox ingest sessions, ~46 ms), so the search is not looking at stale data.
  • Latency is not the risk; volume is. Every past surprise here was volume, never a single call's cost.

Design

  • context hook, acting only when the last assembled message is a user prompt (the hook fires for tool continuations too).
  • knox query --json --limit 3, prompt over stdin.
  • Summary clipped to 140 chars; three hits maximum.
  • Prompt gates: ≥16 chars, not a slash/bang command, contains a word.
  • Injected text labelled as retrieval, explicitly subordinate to the repo and the user.
  • A firing counter in plugin storage so we can tell whether it earns its tokens.
The AGENTS.md rule asks the model to search knox before working. That depends on the model remembering — and this session produced several examples of it not remembering. Recall should be a property of the harness: before a turn starts, search knox with the user's prompt and put the best hits in front of the model. ## Constraints learned from the freshness work - The index is now current at turn start (`knox ingest sessions`, ~46 ms), so the search is not looking at stale data. - Latency is not the risk; **volume** is. Every past surprise here was volume, never a single call's cost. ## Design - `context` hook, acting only when the last assembled message is a user prompt (the hook fires for tool continuations too). - `knox query --json --limit 3`, prompt over stdin. - Summary clipped to 140 chars; three hits maximum. - Prompt gates: ≥16 chars, not a slash/bang command, contains a word. - Injected text labelled as retrieval, explicitly subordinate to the repo and the user. - A firing counter in plugin storage so we can tell whether it earns its tokens.
david closed this issue 2026-11-05 03:49:58 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#24