Skip to content

refactor(agent): derive recall guidance from the tool set, drop the flag - #51

Merged
flarexium merged 1 commit into
mainfrom
feat/recall-from-toolset
Jun 15, 2026
Merged

refactor(agent): derive recall guidance from the tool set, drop the flag#51
flarexium merged 1 commit into
mainfrom
feat/recall-from-toolset

Conversation

@flarexium

Copy link
Copy Markdown
Contributor

Problem

The cross-turn recall feature had two switches that had to agree:

  • the prompt's Recall rules block, gated by PromptRenderer.RecallEnabled;
  • the recall tools (recent_entries / get_entry), wired off the agent's RecentEntries buffer.

They were flipped together at each call site (buildBookEngine(..., recall) + the agent's Recent buffer), but nothing enforced agreement — a future change could leave the prompt advertising a recall ability the tool set doesn't back, and the model would call tools that aren't there.

Change

Make the tool set the single source of truth. PromptRenderer.Render derives the recall guidance from whether input.Tools advertises recent_entries — which the harness already populates every turn from the runner's tool registry (loop.go sets cycleInput.Tools). Wiring the recall tools is now the only thing that turns the guidance on.

Removed:

  • PromptRenderer.RecallEnabled field
  • the recall bool parameter on buildBookEngine (and the true/false at the three call sites)

No behavior change

  • TUI wires the recall tools (agent carries a RecentEntries buffer) → guidance on.
  • book-run / bench carry no buffer → no recall tools → guidance off.

TestPromptRenderer_RecallRulesDerivedFromTools now drives the prompt off input.Tools instead of the flag. go build ./..., go vet ./..., go test ./... all pass.

🤖 Generated with Claude Code

The prompt's "Recall rules" block and the recall tools (recent_entries/
get_entry) were two switches that had to be flipped together: the renderer
carried RecallEnabled while the tools were wired off the agent's RecentEntries
buffer. They could drift — a prompt advertising a recall ability the tool set
doesn't back.

Make the tool set the single source of truth: PromptRenderer.Render now derives
the recall guidance from whether input.Tools advertises recent_entries (which
the harness already populates each turn from the runner's tool registry). The
RecallEnabled field and buildBookEngine's recall parameter are gone; wiring the
recall tools is what turns the guidance on.

No behavior change: TUI wires the recall tools (guidance on), book-run/bench
don't (off).
@flarexium
flarexium force-pushed the feat/recall-from-toolset branch from c80ee32 to 04a55b1 Compare June 15, 2026 04:21

@jarvis-flarex jarvis-flarex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flarexium
flarexium merged commit e5cbdd0 into main Jun 15, 2026
1 check passed
@flarexium
flarexium deleted the feat/recall-from-toolset branch June 15, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants