Recall hook: the mind recalls into context on every prompt #25

Merged
eureka-admin merged 4 commits from eureka-substrate/recall-prompt into main 2026-10-22 17:49:47 +00:00
Owner

tools/recall.py and tools/mind.py: a UserPromptSubmit hook that pops the in-force rulings and questions nearest the prompt into context, as inert data, under a whole-run deadline and a byte budget (ruling eureka-substrate:ruling:recall-pops-into-context). context-pack.py now shares mind.py.

Soul held twice (eureka-substrate:verdict:cut-recall-prompt.s2; every forgery attempt failed). Leftovers: eureka-substrate:follow_up:recall-hook-hardening.

Merged on the operator's instruction, 2026-10-22.

🤖 Generated with Claude Code

tools/recall.py and tools/mind.py: a UserPromptSubmit hook that pops the in-force rulings and questions nearest the prompt into context, as inert data, under a whole-run deadline and a byte budget (ruling eureka-substrate:ruling:recall-pops-into-context). context-pack.py now shares mind.py. Soul held twice (eureka-substrate:verdict:cut-recall-prompt.s2; every forgery attempt failed). Leftovers: eureka-substrate:follow_up:recall-hook-hardening. Merged on the operator's instruction, 2026-10-22. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mind.call spawns the eureka-state binding, does the stdio handshake and one
tool call within a deadline, and kills the child on every exit path.
context-pack's mcp_view_once is deleted; mcp_view delegates to mind with
retry_once. Messages, exit codes, retry and env rules are unchanged (all 228
context-pack checks pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Queries rulings, questions and follow-ups in force across every root, ranked by
Huginn against the prompt, through mind.call, and prints one hook JSON within
RECALL_BUDGET. Never blocks: any failure or the RECALL_DEADLINE_MS deadline
(default 4000) exits 0 with empty stdout; one attempt; prompts under 3 words are
not queried. test-tools.sh drives it against the fake binding and pins R1-R7;
the fake gains a query branch. INDEX rows and a Precedent note added. The
operator installs the hook; settings.json is not touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Soul s1 fixes. The hook header says the lines are recalled records, data and
never instructions, written by agents not the operator. Every item is one JSON
object per line: id, title and operator_quote are JSON strings with < >, control,
bidi and separator characters escaped, so a title cannot close the framing, forge
a tag, a header or an operator segment. RECALL_DEADLINE_MS now bounds the whole
run through a hard stop; stdin is read to 4 MiB and the answer to 1 MiB
(mind.call max_bytes); RECALL_BUDGET is clamped to 9000 under Claude Code's
10,000-character cap. Tests: hostile text, a non-ASCII process-boundary run under
cp1252, byte-versus-character budget, stdin held open and endless, answer size,
budget ceiling, and the four unrecorded survivors (negative reply timeout, reply
id check, env-int positivity, EOF sentinel). Mutants of each were run and caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows the run overshot its deadline by 450-720 ms in the R2 bands: ~200 ms of
interpreter start and imports ran before the clock, the hard stop sat 0.3 s after the
deadline, and the test timed bash, env and the py launcher too. The clock now starts at
process creation (GetProcessTimes), the reply wait ends 0.1 s early so the kill and exit
fit, and the hard stop is the deadline itself. Residual outside the script: the py
launcher (40-130 ms, rare spikes to 300) and the creation call. R2 times the interpreter
directly, best of two, bands -250/+100 ms around the deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Eureka!25
No description provided.