Skip to content

Leave the Skill-body door out of the Claude Code module's session.append doors - #5816

Merged
max-sixty merged 5 commits into
mainfrom
session-append-skill-door
Nov 18, 2026
Merged

max-sixty merged 5 commits into
mainfrom
session-append-skill-door

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

The Claude Code module's session.append handler no longer registers on the tool-message door. On a machine with managed settings, Claude Code seats cc-plugin-sec-default outermost, and that plugin sends the body a Skill call loads, a tool-message row, past a person's plugins. Claude Code then told the user, at each session's first Skill call: its session.append hook was skipped. "cc-plugin-sec-default" runs first and sent the event on past it.

The rest of the door list stays as #5961 left it: prompt, command, response, tool-result, delivery and note.

Behavior change: a fork's diagnostic row no longer advances on tool-message rows, the messages a tool adds beside its result; it stays on that result until the model next answers. row feeds only a fork's diagnostics.

Verification:

  • Claude Code 2.1.327's cc-plugin-sec-default, read from the binary, sends past a person's plugins every attachment, hook-context and compaction row, a tool-message row from the Skill tool, and a note an organization's plugin appends.
  • In a Linux container with /etc/claude-code/managed-settings.json, where Claude Code 2.1.327 logged cc-plugin-sec-default@builtin seated outermost: this machine has managed settings, a headless session against a scripted Messages API called Skill once. With main's hooks module loaded by --plugin-dir, the debug log had one leaf: session.append bypassed by cc-plugin-sec-default and the session showed the notice; with this branch's, neither. The container had no organization plugin, so it doesn't exercise the note case; this wasn't run on the managed machine where the notice was reported.
  • tests/process/test_interact_claude_code_module.py passes (21 tests). Its fixture now appends a tool-message row that must not move the cut, and putting the door back fails 3 of them.

This was written by Claude Code on behalf of max-sixty

…son's plugin

The Claude Code module's session.append handler records the newest main-thread
row for a fork's diagnostics. #5788 registered it on `model`, `prompt`,
`tool-message`, `queue` and `note`, to keep it out from under
cc-plugin-sec-default: on a machine with managed settings that plugin sends
some rows past a person's plugins, and Claude Code then tells the user the hook
was skipped.

Measured at 2.1.318 on such a machine, that list had two faults. The security
plugin also sends a Skill call's body, a `tool-message` row, past the handler,
so the notice moved from session start to the session's first Skill call. And
`model` is a row's origin kind, not a door: replies arrive by `response` and
tool results by `tool-result`, so the handler ran on 4 of the 14 rows a probe
registered on the other doors was handed, and a fork's `row` stopped at the
last prompt.

The handler now registers on every door except the four the security plugin
sends rows past: `attachment`, `hook-context`, `compaction` and `tool-message`.
A fork's `row` advances on replies, tool results, commands, deliveries and
notices again, and no longer on `tool-message` rows. With this tree loaded by
--plugin-dir in a headless session that calls Skill and Bash, the handler ran
on 11 rows and no notice came.

The test's row fixture names the `response` door. The driver raises every event
into every handler, so the door it named decided nothing.
leaf-agent
leaf-agent previously approved these changes Nov 10, 2026
max-sixty added a commit that referenced this pull request Nov 14, 2026
#5816 settles the same list with evidence from a machine with managed settings, where the security plugin sends Skill bodies on `tool-message` past a person's handlers, so this branch keeps main's list.
max-sixty added a commit that referenced this pull request Nov 14, 2026
…rom the main thread's usage (#5947)

Claude Code refuses to load a hooks module whose `$.env.get` takes
anything but a literal name, and #5907 read the route variables in a
loop. Since #5907 landed, Leaf's Claude Code module hasn't loaded in any
session: no band, no turn-end check, no thread-reply fork. `claude
plugin validate` refuses main's module at 2.1.322, 2.1.323 and 2.1.325.
`readRoute` now spells each name out. The claude-code journey passes
with this branch, where it failed at setup on main (`hooks module did
not load`). #5952 adds that validation to CI and should merge after
this.

The PR also tightens the effort learning from #5892/#5907, which keeps
turn-end checks from rewriting the prompt cache on Vertex:

- **Rewrite test.** A check at a changed effort now counts as a rewrite
when it reads less from the cache than the main thread's last request
left there (read + creation from the `turn.step` result, recorded as
`request.cached` in each fork's diagnostics). Before, the test was
"wrote more than it read", which misses a rewrite of a conversation
shorter than the system prompt and tools the fork still reads (28k
tokens on Vertex in #5904's repro). In 103 real checks where the cache
held, plus 12 in the journey, every fork read at least `cached`. Only
answered checks count: a refused fork reports zero reads.
- **Lapse.** A stored answer was asked again only in a conversation of
at most 20 messages. In practice that never happened: of 902 real
checks, none came before message 46. So a stored answer never lapsed.
Now the first check after the 7-day lapse asks at low whatever the size.
Where the backend still lacks per-message effort, that costs one
conversation rewrite per backend per week, about $1.50–3 at 300k tokens.
That number is a call to weigh.

The module's stale `session.append` door names, which 2.1.325's `claude
plugin validate` reports, are left to #5816.

Max asked whether the Vertex caching issue could be fixed. Codex
reviewed the change; its two findings, the refused fork and a step
racing the fork, are fixed here.
`tests/process/test_interact_claude_code_module.py` passes (18); the new
cases fail on main.

> _This was written by Claude Code on behalf of max-sixty_
Main's #5961 already registers session.append on response and tool-result
and leaves out queue and notice. What this branch still changes is
dropping tool-message, whose Skill bodies cc-plugin-sec-default sends past
a person's plugins on a machine with managed settings. The test's fixture
now appends a tool-message row, which must not move the cut.
@max-sixty max-sixty changed the title Hear session.append on every door the security plugin leaves to a person's plugin Leave the Skill-body door out of the Claude Code module's session.append doors Nov 18, 2026
@max-sixty
max-sixty merged commit 3794e5d into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the session-append-skill-door branch November 18, 2026 07:36
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