Repository navigation
Add output projection: result shapes and recall(n) (0.6.0) - #11
Merged
Merged
Conversation
After each run, the footer shows one line for each MCP call: its number, its size and its shape. The plugin keeps the newest results of the session, so a later program can read one again with await recall(n), with no new MCP call. The footer also names a call that repeats an earlier call, an empty result after calls that returned data, and the number of a cut result. - projection is on by default; projection: false gives the old footer. - The shape hides keys that are data (emails, ids, maps), so the data stays out of the context. - Results stay in one session only. Without a session id, they stay only for the run. - At most 50 results and 8 million characters for each session. - The metrics option (off) writes sizes and counts for each run; scripts/projection-report.mjs compares on and off. - bench/ runs six tasks with traps against a fake MCP server, in headless Claude Code, with projection off and on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion-design-48f330 # Conflicts: # .claude-plugin/plugin.json # tests/code-mode.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A
run_codeprogram is the filter: the model writes it for the task, so it keeps exact values. But the model writes the filter before it sees the data. When the filter misses (a wrong field, a missed page, a cut result), the model cannot see what it removed, and it calls the MCP tool again to fix the filter.What this PR does
await recall(n)in the sandbox returns a stored result. It makes no MCP call and no permission check.recallnumber of a cut result.projectionis on by default. Withprojection: false, the footer is the old one.metrics(off by default) writes sizes and counts for each run.scripts/projection-report.mjscompares runs with projection on and off.bench/contains a fake MCP server, its data with traps, and a runner that runs six tasks in headless Claude Code with projection off and on.Safety
recallreturns only data that an approved call already got in the same session. Deny rules still apply to every new call.recallnever runs a tool again, so it cannot repeat a write.{N keys}.Evidence: the bench
The bench ran 6 tasks, 5 times each, in each arm, against the fake server. The runs had no user settings, no other plugins and no other MCP servers, and direct MCP calls were blocked. In total: 120 runs, $7.07.
recallWhat the bench shows:
recalland calls the tools again.blockDirectMcp: true) in both arms, so every call went throughrun_code. In a normal session, the model can call an MCP tool directly, and projection does not apply to that call.blockDirectMcpoff. Without the line, 8% of the MCP calls went direct with Opus and 89% with Haiku. With the line, 0% went direct with Opus and 2% with Haiku. So with 0.6.1, projection applies to nearly all calls in the bench. Interactive sessions were not measured.Checks
claude plugin test .: 116 pass, 0 fail. This includes a test for each safety rule and for the default.node tests/runner.integration.mjs: all pass, with therecallbridge and arecall.constructorescape case.node tests/docs.check.mjs,tests/version.check.mjs(0.5.4 → 0.6.0),tscandclaude plugin validate .: pass.projectionoption (Opus 5.5) showed the new footer,recalled: #1 (3 s old), 1 server call and the correct answer.🤖 Generated with Claude Code