Status: implemented.
Continue support is open, in issue 901. The task-by-task plan for the rest is plans/812-harness-neutral-core.md.
This page records why the pipeline runs on more than one agent harness, how the gate is enforced on each, and which designs were turned down. Several of the rejected designs look like the obvious fix, and each one fails the same test: can the model skip it?
Written for anyone adding a harness, changing a launcher, or wondering why the OpenCode plugin holds no gate logic. It assumes HOOKS.md, whose three-layer rule (checks, adapters, launcher) this extends, and ARCHITECTURE.md's "Grounding is enforced, not requested".
The Python package has always been harness-neutral: nothing under
chitragupta/ calls a language model, and retrieval's embedding models
run locally. Everything above it assumed Claude Code. That shuts out
two kinds of user:
A small local model is the one most likely to fabricate a citekey, so another harness is supported only if the one binding rule is exactly as strong there.
Without per-harness work, three facts make the gate Claude Code-only:
.claude/hooks/citation_gate_hook.py fires on Claude Code's
Write|Edit matcher and reads tool_input.file_path.apply_patch, whose payload carries the patch
text in tool_input.command and no file_path. A hook that reads
only file_path finds no path there and fails open: a gate that
looks like it passed.--format md refused a key missing from the ledger only as a
side effect of building the numbered reference list, while docx, pdf
and tex printed pandoc's citeproc warning and wrote the document
anyway (measured).OpenCode reads none of .claude/settings.json, so without its plugin it
has no check at all.
Every check calls chitragupta/core/draft/citation_gate.py. No gate logic is
copied into a skill, a hook launcher or a plugin.
python -m chitragupta.draft gate on its own draft and fixes what it
reports. Each harness gets its own copy of the skill, naming its own
tools (see "Skills: one copy per harness" below).draft render runs the gate before producing any
format, so no draft with an unknown key becomes a document on any
harness.The mandatory check is the one that needed per-harness work, and it was kept as small as possible:
.claude/hooks/, and Codex and OpenCode launch
the same scripts. A neutral folder would churn about 28 test files for
no change in behaviour.apply_patch patch text.
Codex and OpenCode use the same envelope (OpenAI's V4A grammar), so
one parser, .claude/hooks/patch_paths.py, serves both. Every draft
a patch adds, updates or moves is gated. A patch that mentions
content/drafts/ but whose headers cannot be read is blocked:
the one deliberate exception to "malformed stdin fails open", because
failing open there is the silently inert gate HOOKS.md exists to
prevent.citation_gate_hook.py and then style_check_hook.py, and hands the
verdict and any style notes back. Which writes are drafts, the size
bound, the timeout and the fail-closed rules are the Python hook's,
shared by all three harnesses.draft gate
run by hand warns about a draft no hook has checked since it last
changed. It never changes the gate's exit code.| Harness | Self-check | Mandatory check | Last check |
|---|---|---|---|
| Claude Code | the skill runs draft gate |
PostToolUse hook on Write and Edit, after the write |
draft render |
| Codex | the skill runs draft gate |
PostToolUse hook on apply_patch, after the write, once the project's hooks are trusted and only if the model server passes apply_patch through (llama.cpp does not) |
draft render |
| OpenCode | the skill runs draft gate |
plugin on tool.execute.after, after the write |
draft render |
None of them stops a write through the shell, such as
echo ... >> content/drafts/x.md, because no harness's file-tool hook
sees it. draft render refuses the draft, and the skill's own
draft gate run warns that no hook checked it. A person copying text
straight out of the raw draft file is outside every check.
Each skill's SKILL.md exists once per harness, and each copy names
that harness's own tools. A model then reads a complete instruction at
the step where it acts ("use Edit, never Write" on Claude Code,
"patch with apply_patch" on Codex, "edit, never write" on
OpenCode) instead of a harness-neutral phrase it has to translate.
<project root>
├── AGENTS.md # all harnesses read it
├── .claude/
│ ├── settings.json # Claude Code's hook launchers
│ ├── hooks/ # the hook scripts all three harnesses run
│ ├── agents/ # Claude Code subagents
│ ├── skills/<name>/
│ │ ├── SKILL.md # Claude Code wording
│ │ ├── references/ # this skill's detail, read on demand
│ │ └── assets/ # template files a skill copies from
│ └── skills-common/references/ # detail several skills share
├── .agents/
│ └── skills/<name>/SKILL.md # Codex wording
├── .codex/
│ └── hooks.json # Codex's hook launchers → .claude/hooks/
└── .opencode/
├── opencode.json # denies the unsuffixed skill names
├── plugins/chitragupta-gate.js
├── chitragupta/gate.js
└── skills/<name>-opencode/SKILL.md # OpenCode wording
| Harness | Skills it sees | Why only those |
|---|---|---|
| Claude Code | .claude/skills/* |
the only skills folder it reads |
| Codex | .agents/skills/* |
the only project skills folder it reads (measured) |
| OpenCode | .opencode/skills/*-opencode |
it also scans .claude/skills/ and .agents/skills/, but .opencode/opencode.json denies those names (measured, 3 of 3 runs) |
OpenCode's copies carry a suffix because OpenCode keys skills by name
and loads every folder it scans concurrently, so among same-named copies
the last to load wins, which in practice is random. The suffixed names
cannot collide, and the skill permission in .opencode/opencode.json,
which filters the list the model is shown, denies every unsuffixed name.
That holds per project, with no environment variable. The OpenCode
copies refer to one another by the suffixed names; AGENTS.md says so
in one line.
init writes .claude/, the shared core, .codex/, .agents/ and
.opencode/. .claude/ serves every harness because it holds the hook
scripts Codex and OpenCode launch too; Codex never reads its skills and
OpenCode denies them.
The copies are edited by hand. tests/test_skill_harness_copies.py
normalises each copy through tests/fixtures/skill_harness_phrases.toml,
which lists every phrase meant to differ, and requires the three results
to be identical, naming the first line that moved. It also checks that
no copy names another harness's tools and that the deny list names
exactly the unsuffixed skills; chitragupta doctor reports an OpenCode
project whose deny list is missing or incomplete. To change a skill,
change every copy, with a phrase-map entry for any wording meant to
differ. The step scans
(tests/test_skill_*_step.py) read only .claude/skills/; once the
copies agree, a required step present in one is present in all three.
A skill for working on this repository rather than with the pipeline,
so far demo-recorder (which records the feature demo) and
skill-bench (which measures a skill change on all three harnesses),
carries one extra frontmatter field:
metadata:
audience: developer
It keeps its three copies and its deny rule, so every checkout's
harness offers it, but no distribution carries it: chitragupta init
and scripts/release.py skip any skill folder
chitragupta/core/developer_skills.py finds marked, scripts included.
pyproject.toml names every other skill folder one by one, because
Poetry's exclude cannot take a path back out of an included folder,
so a new user-facing skill needs three include lines, and
tests/core/test_developer_skills.py fails until it has them. The step scans
and the user-facing skill counts skip developer-only skills. The deny
rule still ships: a rule for a name a project lacks has no effect.
SKILL.md is per harnessEverything else a skill uses exists once, under .claude/:
.claude/skills/<name>/references/ for one skill's detail,
.claude/skills/<name>/assets/ for a template it copies from, and
.claude/skills-common/references/ for a passage several skills share.
All three copies of SKILL.md name those files by their path from the
project root. That works because every harness preloads only a skill's
name and description, loads the SKILL.md body when the skill is used,
and leaves every other file for the model to open by path with its
ordinary file tools (the Claude Code skills docs, Codex's
ext/skills/src/catalog_prompt.rs, OpenCode's
packages/opencode/src/tool/skill.ts). Codex resolves a relative path
against the skill's folder first, which is why the paths are written
from the project root and say so. .claude/ is always scaffolded, so
the files are always there.
deep-research's agent definitions in .claude/agents/ work the same
way: Codex does each agent's work itself and OpenCode dispatches a
general subagent, both following the agent's file by path.
The price is one rule: a shared file names no skill and no harness
tool. OpenCode must be sent to <name>-opencode, so a sentence that
routes to another skill stays in SKILL.md, where the phrase map and
the suffix rule apply. tests/test_skill_references.py checks that
every path a SKILL.md names exists, every reference is named by some
SKILL.md, no shared file names a skill or a tool, and the Codex and
OpenCode folders hold SKILL.md and nothing else.
Measured with bench/bench_skill_harnesses.py on freshly scaffolded
projects (Claude Code on sonnet; Codex 0.159.3 and OpenCode 1.18.34 on
Qwen3.6-35B-A3B through llama-server). Tier 1 asks each harness to load
a skill and print the first line of every .claude/ file it names; a
read counts only when that line matches. It now also asks for every
docs/ page named and ignores emoji, which the table predates:
| Harness | Loaded its own copy | .claude/ reads that failed |
Every named file read |
|---|---|---|---|
| Claude Code | 10 of 10 | 0 | 10 of 10 |
| Codex | 10 of 10 | 0 | 7 of 10 |
| OpenCode | 10 of 10 | 0 | 7 of 10 |
Every shortfall was the local model listing fewer paths than the skill names, or a run passing its time cap, never a path that failed to resolve or a read that was refused.
A pointer alone is not enough for a step that must run. With the
critique step reduced to "read critique.md and follow it", a Claude
Code run went straight to the gate. A pointer that also says the step
is not done until the loop the reference describes has run holds:
with the step inline, as such a pointer, and as a handoff to a separate
skill, 12 of 12 Claude Code runs in every arm reached the loop, logged a
critique entry in revisions.md and passed the gate. The local-model
runs logged no critique entry in any arm, so they could not tell the
arms apart. On that evidence the owner decided that the loop's commands
may move to .claude/skills-common/references/critique.md, one genre
writer at a time, each benched. tests/test_skill_pregate_feedback_step.py
lists which steps are pointers and fails if an inline step loses its
commands, or a pointer step loses that sentence, keeps a command, or its
reference loses one. Otherwise, move rationale and detail into a
reference and keep the commands a step requires in SKILL.md.
The render step is the other measured exception. survey-writer's
draft references, draft render and draft evidence steps were cut
to a pointer at
.claude/skills-common/references/render-and-references.md, and the
task prompt no longer asked for a render. Every pointer-only run on all
three harnesses opened the reference and ran the steps, and every final
draft passed the gate; the one partial skip was a Codex run with the
commands inline. That licenses moving this step, which the four genre
writers and deep-research now do, and nothing more.
The bench works around two harness facts, both recorded in the script:
OpenCode takes its project directory from the inherited PWD, and a
timed-out Codex run holds the local server's one slot until its process
group is killed.
An MCP server with gated draft_write / draft_edit tools, as the
enforcement. A pre-write gate enforces only if the model has no other
way to write, and on every harness it has one: its built-in edit tool,
or the shell. On Codex, Claude Code and OpenCode the hook or plugin
already covers the built-in tools, so the server would be a second write
path to maintain and secure for no added guarantee. It belongs to #901,
where Continue has no hooks and the server, with Continue's built-in
write tools excluded, is the enforcement. Its planned security
choices: it writes only content/drafts/, reads only content/, opens
the ledger read-only with no sync tool, speaks stdio only, and is
launched through the installed chitragupta mcp command so a planted
chitragupta/ cannot be imported in its place.
The gate in a script each skill runs, instead of a hook. The model
decides whether to run a skill's script. That is the "asked, not
enforced" posture ARCHITECTURE.md rules out, and the model likeliest to
skip the step is also the likeliest to fabricate. It is kept as the
self-check, never as the only check. No scripts/ folder either: the
self-check is already one CLI call, and a script in each of eleven
skills would be eleven copies of it.
A pre-write check inside the OpenCode plugin. To gate the text an
edit would produce, the plugin would have to reproduce OpenCode's
fuzzy oldString matching: a second implementation of someone else's
edit semantics, inside the one component that must not drift. The
plugin checks the file on disk after the write, as Claude Code's and
Codex's hooks do.
Rely on render alone. It catches a fabricated key only at the end, and loses the model fixing a bad key in the draft, before moving on.
A file watcher that quarantines bad drafts. It acts after the write, races a person editing the same file, is invisible to the model, and needs platform-specific file-change APIs or polling.
A "closest match" suggestion in a refusal. Offering the nearest ledger key invites the model to swap in a real key for a paper it never read. That passes the gate, so it is worse than a fabricated key. Every refusal names the bad key and its line, and nothing else.
A git pre-commit hook. content/drafts/ is gitignored, so a draft
is never committed.
Hand-kept copies of each skill with no check between them. Eleven skills of 1,800-6,300 words, copied three ways, would drift, and a copy that drifts on the gate step is a fabrication path. The copies exist only because the phrase-map test fails on any drift outside the entries meant to differ.
One harness-neutral wording, with a tool glossary in AGENTS.md.
Tried and replaced. "Edit the passage in place" gives up Claude Code's
exact tool names and gives Codex and OpenCode nothing specific, and the
glossary asks the model to connect a phrase to a table in another file
that Claude Code does not even load.
Generating the copies from one templated source. It gives the same protection as the phrase-map test, at the cost of a build step and a source nobody reads. The copies are plain files, each editable where it is read.
Relying on OpenCode's folder order, or OPENCODE_DISABLE_EXTERNAL_SKILLS.
There is no folder order: OpenCode picks among same-named copies at
random. The environment variable restricts it to .opencode/skills/,
but a project cannot set it, and a user who forgets it gets a random
mix. The suffix and the deny list are per project.
Each fact the code depends on is re-checked on a real session before it is relied on.
<repo>/.codex/hooks.json and fire on
PostToolUse for apply_patch, with tool_name: "apply_patch" and
the patch in tool_input.command. The {"decision": "block"} output
shape matches Claude Code's.
(Codex hooks)chitragupta doctor cannot recompute that
hash, so for the terminal policy hook it reports only that a trust
record exists; after chitragupta init rewrites the hook, trust it
again in Codex..agents/skills/
(Codex skills), and
AGENTS.md natively..opencode/skills/, and also from
.claude/skills/ and .agents/skills/ for compatibility
(OpenCode skills).tool.execute.before and
tool.execute.after. Its edit tool takes filePath, oldString,
newString and replaceAll; its apply_patch tool takes
patchText, whose paths are relative to the project root.
(OpenCode plugins,
OpenCode tools)cn 1.5.47, LOCAL-MODELS.md), and can mark a
built-in tool exclude.
(Continue tool permissions)description to 1,024
characters and allows only name, description, license,
compatibility, metadata and allowed-tools in the frontmatter.
Every skill carries a tags: key outside that list, which all three
harnesses load anyway (measured).
(agentskills.io)exec tool is also offered a collaboration
namespace, clock.sleep and asynchronous message tools. The
adapter maps none of them, and its tripwire is left as it is: a
turn that uses one stops, with an error saying which. Commands run
from exec still ask (CX9).ls through a stand-in model on an ephemeral thread and
refuses the session unless Codex asked. A login-shell wrapper is
taken off only when its program is literally the account's login
shell or a root-owned sh, bash or zsh on PATH, in /bin or
in /usr/bin; nothing is unwrapped on Windows.config/read reports must come from the webapp home's
config.toml (its origins), at start and again after the thread
starts; a project's .codex/rules/ refuses the start (CX11).[features] key Codex does not report,
one a newer release dropped or renamed, is a non-fatal warning on
the page and in the server log, and the session runs on (owner,
2026-12-02)..agents/skills/ are unaffected.codex.cmd stays refused. The webapp runs Codex only
as codex.exe on PATH; finding only npm's codex.cmd, it says
so and names the remedy. Codex on Windows is a known gap: not
measured.Status: measured; the webapp's Claude Code, Codex and OpenCode sessions rely on those harnesses' facts. These are the facts that the webapp agent session (issue 1335), its draft grant (issue 1339) and the terminal policy (issue 1332) are designed on. The design they serve is APPROVAL-MODEL.md.
Measured on 2026-12-01 with Claude Code 2.1.323, Codex 0.172.0
(codex app-server and its TUI) and OpenCode 1.19.6 (opencode serve
and its TUI). As in the section below, a scripted stand-in model
issued fixed tool calls, so each harness ran its own permission
machinery. A stub chitragupta that only logged its arguments stood in
for the sign-off and sync commands. The facts the webapp's Claude Code
session and its draft scope rely on were measured on 2026-12-02 with
the same 2.1.323 ("The webapp session's Claude Code process" and "The
draft scope's facts" below), and those its Codex session relies on on
2026-12-02 with Codex 0.173.0 ("The webapp session's Codex
app-server" below), and those its OpenCode session relies on on
2026-12-02 with OpenCode 1.19.6 ("The webapp session's OpenCode serve"
below).
The program driving the harness receives an approval request before the call runs, and answers it:
| Claude Code | Codex | OpenCode | |
|---|---|---|---|
| Request | can_use_tool control request on stdout, with --permission-prompt-tool stdio under --input-format stream-json |
item/commandExecution/requestApproval, item/fileChange/requestApproval (JSON-RPC) |
permission.asked event on GET /event |
| Answer | control_response on stdin: allow with updatedInput, or deny with a message |
accept, acceptForSession, decline, cancel |
POST /permission/{id}/reply with once, always or reject |
| Answered after 200 s | waited; ran at +200 s | waited; ran at +200 s | waited; ran at +200 s |
| Refused | not run; the message reaches the model | not run; the model reads "rejected by user" | not run; the message reaches the model |
| Driver gone while pending | stdin closed: "stream closed before response received", not run | stdin closed: the process exits, not run | server killed after about 150 s pending: not run; after a restart the model reads it as interrupted (1.19.6) |
| Subagent's calls | same channel, with an agent_id |
same connection, with the child thread's threadId (0.173.0) |
same event stream, with the child session's id; the child's ruleset drops the session's *: ask rule (1.19.6) |
Agent) runs asynchronously. The parent's
result arrives before the subagent's request, so a driver that
closes stdin at result aborts the subagent's call.POST /session takes a permission ruleset for that
session. A deny rule removes the tool from the list the model sees.
An allow pattern (date *) let matching commands through while
others still asked.Read, ls,
cat content/...) without a request. Project allow rules are ignored
in an untrusted workspace, with a note on stderr. In a trusted one
they let the call through without a request.approvalPolicy: "untrusted" asks for every
exec_command, ls and cat included, and for every apply_patch.
The model metadata decides whether apply_patch is offered at all
(gpt-5.5 offers it; an unknown model does not). A command rule in
$CODEX_HOME/rules/ that allows a command runs it with no
request, under untrusted too, and spawn_agent starts a
subagent with no request; the subagent's own calls ask (0.173.0).permission block runs reads, bash and
write without asking; only a path outside the project asks. With
"permission": "ask" or {"*": "ask"}, every tool measured asks:
glob, grep, webfetch, todowrite, read, bash, edit. A
configured allow runs the call with no request unless a session
rule placed after it asks, and a task child's session does not get
that rule, so a configured allow reaches the child's calls (1.19.6).
A call that a plugin's tool.execute.before refuses never reaches the
channel: the plugin runs before the request is sent.Claude Code PreToolUse |
Codex preToolUse |
OpenCode tool.execute.before |
|
|---|---|---|---|
| Sees calls that skip the channel, and subagents' calls | yes | exec_command, reported as Bash, and apply_patch |
yes |
| Runs before trust | yes | no: user and project hooks stay untrusted until config.toml holds [hooks.state."<key>"] with trusted_hash = "<hash>" (both from hooks/list) |
yes |
deny |
blocks, and beats a trusted allow rule | blocks both tools | throwing blocks |
deny in bypass mode |
still blocks (--dangerously-skip-permissions) |
still blocks (never, danger-full-access) |
runs whatever the permission config says |
ask |
goes to the channel; beats an allow rule in settings.json and settings.local.json; still asks in bypass mode |
ignored: the call ran under never |
not available |
allow |
skips the channel | ignored: the call still asked | not available |
| Crash or timeout | fails open for a call that would not have asked; otherwise falls back to the channel | fails open under never; still asks under untrusted |
fails closed: an exception blocks the call |
| Can wait for a person | no: the hook timeout | no: the hook timeout | yes: an awaited promise held the call 200 s, then it ran |
OpenCode's permission.ask plugin hook never fired. The first start
with a plugin in .opencode/plugins/ took about 130 seconds while npm
installed its dependencies into .opencode/node_modules/ (about 150 s
on 2026-12-02, and about 1 s offline, where the install fails and the
server starts anyway: OC8 below).
Codex command rules (prefix_rule(pattern=[...], decision="prompt", justification="...") in $CODEX_HOME/rules/default.rules) ask under
on-request, with the justification as the reason. Under never they
refuse the command instead: "approval required by policy, but
AskForApproval is set to Never".
A hook's cost per call. Started 25 times on this host (median):
import chitragupta: 18 ms.import chitragupta.core.config: 31 ms.import chitragupta.draft: 134 ms.In Claude Code, a hook importing chitragupta.core.config raised 20
Bash calls from about 0.9 s to about 1.9 s: about 47 ms a call.
| Prompt | The hook's or rule's reason | An "always" option | |
|---|---|---|---|
Claude Code, hook ask |
"Hook PreToolUse:Bash requires confirmation for this command:", then "Do you want to proceed?" | shown in full | none: Yes or No |
Codex TUI, prompt rule |
"Would you like to run the following command?" | shown, as "Reason: ... requires approval: " | none: Yes or No |
OpenCode TUI, ask pattern |
"Permission required", the command | no reason field | Allow always |
OpenCode's "Allow always" is wider than the command it is offered
on. On chitragupta draft spec sign ... it offers, and records,
chitragupta * "until OpenCode is restarted". After it, a later
chitragupta corpus sync ran without asking. The same held over
serve with the reply always. The grant overrides a configured
"chitragupta corpus sync*": "deny", which on its own refuses the
command. A plugin that throws on corpus sync still blocked it after
the grant.
Facts M1 to M8 of
the #1335 plan,
measured on 2026-12-02 with Claude Code 2.1.323, started as the plan's
section F starts it: claude -p --input-format stream-json --output-format stream-json --verbose --include-partial-messages --permission-prompt-tool stdio --permission-mode default. The stand-in
model streamed fixed replies and tool calls, a stub chitragupta
logged sys.orig_argv and its environment, and a prototype of the
plan's _ask_hook.py ran from --settings. All eight hold. The raw
transcripts, and how they were produced, are in
tests/fixtures/harness_payloads/claude_stream/.
| # | Fact | Result |
|---|---|---|
| M1 | Text deltas stream before the assistant message; the process idles between turns and exits on stdin EOF | holds: five stream_event text deltas 0.6 s apart, then the assistant message, then result; alive after 4 s idle; exit 0 about 60 ms after EOF |
| M2 | system/init carries the session id, and it holds across turns |
holds: the same id on every turn's init and every later message but a control response. init arrives only after the first prompt: none in 5 s after initialize, whose response carries no session id |
| M3 | interrupt ends the turn; the next prompt works |
holds: result with subtype error_during_execution, is_error: true and terminal_reason aborted_streaming (mid-stream) or aborted_tools (mid-approval). A pending can_use_tool gets a control_cancel_request naming its request_id, its tool result reads "The user doesn't want to proceed", and a late allow to it is ignored: nothing ran |
| M4 | --resume <id> keeps context after kill -9 |
holds, same session id, for every turn that ended. A turn killed mid-way is lost: killed with its approval pending, that prompt was not in the resumed request, and its call never ran |
| M5 | A --settings hook runs beside the project's own, still asks when a project hook answers allow, and matcher * covers every tool |
holds, trusted or not: both PreToolUse hooks ran on every call, the project's PostToolUse gate fired on Write and Edit (its reason reached the model, checked in the trusted run), and every call asked, Read and ls included. A project deny beat the ask. The subagent's call reached both hooks with its agent_id |
| M6 | A hook exiting 2 blocks the call, a read included | holds: raising, and the 5-second internal deadline, each blocked Read, ls, touch and Write, with a project hook answering allow. No can_use_tool was sent; the tool result reads "PreToolUse:Read hook error: [the hook's command]: No stderr output" |
| M7 | input.command is the line verbatim, nothing runs before the answer, and an export does not reach the next call |
holds, an environment prefix and quoting included, in both the request and the hook's input; each stub ran after its answer; after export CHITRAGUPTA_WRITE_SCOPE_FILE=... the next call saw the session's value. A line's own CHITRAGUPTA_WRITE_SCOPE_FILE=<other> prefix reaches its child |
| M8 | The variable reaches a Bash child and a subagent's; sys.orig_argv[1:] equals the line's words from -m |
holds for both, shlex-split words with 'a b' and --note="x y" included |
What a driver has to handle, found while measuring:
system/init, an
assistant message and a second result, with nothing written to
stdin.assistant
and user messages carrying parent_tool_use_id and agent_id,
with system messages task_started, task_progress,
task_updated, task_notification and background_tasks_changed
around them.interrupt is answered with a control_response whose
still_queued lists prompts not yet run, before the result.can_use_tool request carries tool_use_id, display_name,
description, and, when a hook asked, decision_reason with its
hook's reason and decision_reason_hook_source (settings). Without
a hook it can carry permission_suggestions and blocked_path.init's list. The model
calls the subagent tool Agent, which init lists as Task; the
approval model uses Agent alone. The
stand-in was offered no Glob, Grep or TodoWrite tool: a call to
Glob or Grep failed with "No such tool available" before any hook
ran, as did a Skill call naming a skill that does not exist. Which
tools are offered may depend on the model.initialize response reports hook_on_failure_supported and
other_hook_ask_outranks_host, both true, and the process's pid.Facts D1 to D3 of
the #1339 plan,
measured on 2026-12-02 with Claude Code 2.1.323, started as above but
with no --settings hook, in a copy of
docs/examples/sample-project scaffolded by chitragupta init, with
its ledger synced, so the project's real gate hook ran. The stand-in
model fixed the calls and the driver allowed each one. The transcripts
are in tests/fixtures/harness_payloads/claude_stream/.
| # | Fact | Result |
|---|---|---|
| D1 | Whether stream-json carries a subagent's tool_result (with parent_tool_use_id), and when |
yes, after the parent's result. The Agent call returns "Async agent launched" at once and the parent's turn ends. The subagent's assistant and user messages follow, each with agent_id and parent_tool_use_id naming the Agent call, and the Edit's tool_result carries the subagent's tool_use_id. Its can_use_tool request carries agent_id, and the project's gate hook ran on its Edit. Then task_notification, and a turn started on its own |
| D2 | Whether Write and Edit refuse a file changed on disk since the last Read, and what the model receives |
Write refuses; Edit does not. Changed between turns, a Write got an error result, "File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.", with no can_use_tool request. Changed while its request waited, the allowed Write got "File content has changed since it was last read. ...": nothing written either way. An Edit applied to the bytes on disk, keeping the change, and its result adds "the file had been modified on disk since you last read it — the edit applied cleanly, but the file contains other changes not in your context" |
| D3 | What the stream shows when the project's gate hook blocks | Nothing, under the command above: the Edit's tool_result reads "has been updated successfully", and the edit stays on disk. The block reaches only the model, as a system message beginning "PostToolUse:Edit hook blocking error from command:". With --include-hook-events, each PostToolUse hook gives system hook_started and hook_response; the gate's hook_response holds its block in output and stdout, with exit_code 0, outcome success, and no tool_use_id |
Facts CX1 to CX8 of
the #1340 plan,
measured on 2026-12-02 with Codex 0.173.0 (the plan was written against
0.172.0), started as the plan's section D starts it: codex app-server
over stdio, CODEX_HOME a throwaway home, every thread started with
approvalPolicy: "untrusted", approvalsReviewer: "user" and
sandbox: "danger-full-access". A stand-in model served the Responses
API from the home's model_providers and logged the tools it was
offered and each tool output it received; a stub chitragupta logged
sys.orig_argv and its environment. Six hold, CX2 holds with one
deviation, and CX6 found two keys of the plan's config that 0.173.0
refuses or ignores. The raw transcripts, and how they were produced,
are in tests/fixtures/harness_payloads/codex_app_server/.
| # | Fact | Result |
|---|---|---|
| CX1 | item/agentMessage/delta streams before item/completed; the process idles between turns |
holds: five deltas 0.6 s apart, then item/completed, then turn/completed; alive after 4 s idle; exit 0 about 30 ms after EOF |
| CX2 | command's wrapper; item/started precedes each request; a fileChange item's paths are absolute; when patchUpdated comes; grantRoot |
holds, but patchUpdated does not come by default. command is <login shell> -lc <line>, the shell from the account (/bin/zsh here, with SHELL=/bin/bash), the line quoted only when it needs it (/bin/zsh -lc ls); cwd is absolute, a relative workdir resolved. item/started with the same item id comes first. Every path and move_path is absolute. grantRoot is null. item/fileChange/patchUpdated is sent only with the under-development [features] apply_patch_streaming_events, while the model streams, before item/started, with the paths as the model wrote them (relative) |
| CX3 | The scope variable reaches the shell's child through the login shell, from the process environment and from the dotted config key each alone; sys.orig_argv[1:] equals the unwrapped line's words |
holds for both, with inherit = "all" and with the default policy, and through sh -c to a grandchild. With both set and different, config's value wins. sys.orig_argv equals the shlex words of the unwrapped line, 'a b' and --note="x y" included |
| CX4 | turn/interrupt mid-stream and mid-approval |
holds: answered {}, then turn/completed with status: "interrupted"; the next prompt works. A started item gets no item/completed. A pending request gets no message of its own: serverRequest/resolved names its id just after turn/completed, a late accept is ignored ("could not find callback" on stderr), and nothing ran |
| CX5 | kill -9, a new process on the same home, thread/resume |
holds: the same thread id; the response carries approvalPolicy: "untrusted", approvalsReviewer: "user" and dangerFullAccess; the earlier prompts reached the model; a command still asked. Unlike Claude Code, a turn killed mid-way is kept: killed with its approval pending, its prompt was in the resumed request and its call reached the model as aborted; the call never ran |
| CX6 | The plan's home config takes effect; web search, image viewing and MCP tools are not offered; a carried hooks.state runs the project's gate; auth.json is written through its link |
Two keys fail. approval_policy = "untrusted" in config.toml (or -c) stops the server from starting: "is no longer supported; remove this setting"; the same value on thread/start is accepted and asks for every call. tools.view_image is unknown and ignored with a configWarning; [features] view_image = false is the key. With those two changed the rest holds: config/read reports them, mcp_servers empty, approval_policy null; the tools offered are exec_command, write_stdin, request_user_input, apply_patch, get_goal, create_goal, update_goal and tool_search, which finds no MCP tool; the gate hook is trusted and its reason reached the model; codex login --with-api-key under the webapp's home wrote through the link and left it a link |
| CX7 | With subagents on: which connection, which threadId, the variable in the subagent's shell |
holds: the subagent's items and requests arrive on the same connection, each with the subagent thread's id, and its shell carries the thread's config value. The parent's turn ends first |
| CX8 | What the model receives for a declined command and patch; a declined patch writes nothing | holds: exec_command failed: CreateProcess { message: "Rejected(\"rejected by user\")" } and patch rejected by user; both items complete with status: "declined"; nothing was written |
| CX9 | Under the webapp's own home and thread parameters, does any command run with no approval request? (measured in S3, after a security review asked whether untrusted auto-runs "known safe" commands) |
No: every command asked. Fifteen commands (cat, ls, grep -n, head -n, sed -n, git status, pwd, echo, rg, wc -l, nl, find, a cat outside the project, a cat of $CODEX_HOME), four exec_command variants (login: false, which wraps with -c; require_escalated; a workdir; tty), and five commands from the code-mode exec tool of a newer model each raised item/commandExecution/requestApproval after item/started, and none ran when declined. No setting was needed. The adapter still trips on a command or patch that outputs or completes without a request |
| CX10 | Is there a setting that pins "every command asks", and does a start-time probe tell the two cases apart? (2026-12-03, after a security review) | No setting; the probe does. codex features list has no feature for Codex's list of safe commands; approvalPolicy takes untrusted, on-request, never or a granular table whose keys (rules, sandbox_approval, mcp_elicitations, request_permissions, skill_approval) do not cover it; a rule can only name a prefix. A thread started with model and modelProvider set to a provider given in thread/start's config (model_providers.<name>, a base_url on 127.0.0.1, no key) sends its turns there and nowhere else, so the adapter probes at every start: an ephemeral thread under the webapp's policy whose stand-in calls exec_command with ls. Under untrusted Codex asked, the decline ran nothing and the turn completed (probe_asked.jsonl, through the adapter itself); under on-request the same ls ran with no request (probe_unasked.jsonl) |
| CX11 | What does a project's .codex/ load under the webapp's home, trusted or not? (2026-12-03, after a security review) |
Everything, once trusted, and Codex trusts it itself. A thread started with danger-full-access (or workspace-write, not read-only) in a project with no trust_level writes [projects."<root>"] trust_level = "trusted" into CODEX_HOME/config.toml (keyed by the repository's root when there is one) and enables the project layer (project_layer_auto_trust.jsonl). Trusted, the project's [mcp_servers] are loaded, its .codex/rules/ run touch with no request, its hooks are listed, and its sandbox_mode and shell_environment_policy.set take effect; its profiles, model_provider, model_providers and notify are ignored ("unsupported project-local config keys") (project_layer_trusted.jsonl, project_layer_keys.jsonl). With trust_level = "untrusted" written, none of it loads, the rule does not apply and the hook is not listed (project_layer_untrusted.jsonl); Codex does not overwrite that decision. Rules load from the root's .codex/rules/ and each folder up to the repository's root, not above it. config/read reports about 110 top-level keys whatever is set, and an origins map naming the layer that set each key; it does not report rules |
What a driver has to handle, found while measuring:
multi_agent, deprecated but on), spawn_agent is not in the
tools first offered: the model finds it through tool_search, in a
namespace multi_agent_v1, and calls it there. The parent's item is
collabAgentToolCall (tool: "spawnAgent"); the subagent's thread id
is in its receiverThreadIds once it completes, and no
thread/started is sent for it. [features] multi_agent = false
removes tool_search as well. With multi_agent_v2 = true (off by
default) the tools come in a collaboration namespace in the first
list, and the parent's item is subAgentActivity (kind
started or completed, agentThreadId) instead.turn/started and later turn/completed arrive with the
child's threadId, and thread/status/changed reports it active
and then idle; the parent's turn/completed can come first
(subagent_v1.jsonl). The webapp counts a child as running from its
spawn or its turn/started until its turn/completed or a status
other than active, and refuses a rollback meanwhile, as it does
while Claude Code's background_tasks_changed lists a task (#1339 G).prefix_rule(pattern=["touch"], decision="allow"), an MCP server and
approvals_reviewer = "auto_review", touch ran with no request
under untrusted, and tool_search found the MCP server's tools.hooks/list
returned no hooks until the home held [projects."<root>"] trust_level = "trusted".untrusted. Hooks
run only in a project the person trusted.availableDecisions (accept,
acceptWithExecpolicyAmendment, cancel) and
proposedExecpolicyAmendment. decline is not listed and is still
accepted.jsonrpc member. Its requests number
from 0 across turns. It sends configWarning (bubblewrap missing)
and remoteControl/status/changed at start, deprecationNotice
("Full-history hydration is deprecated for paginated threads; use
excludeTurns: true") and thread/goal/cleared on thread/resume,
and hook/started and hook/completed around a hook.exec_command, write_stdin, request_user_input, apply_patch
and tool_search, which reveals only the multi_agent_v1 subagent
tools; [features] goals = false removes the goal tools. A newer
slug is offered none of these directly: one exec tool runs
JavaScript that calls exec_command and apply_patch (each still
asks, CX9), beside a collaboration namespace (the subAgentActivity
items the adapter does not map), clock.sleep,
request_user_input_async and send_message_to_user_async. Under
such a model the tripwire would stop a turn that sleeps or spawns a
subagent. An unknown slug is offered exec_command, write_stdin,
request_user_input and the multi_agent_v1 tools directly, with no
apply_patch.config.toml and sessions/, Codex
writes SQLite state and logs, installation_id, shell_snapshots/,
skills/ and .tmp/, and tried to sync remote plugins ("chatgpt
authentication required for remote plugin catalog").codex features list on
0.173.0 reports apps, image_generation, browser_use,
browser_use_external, browser_use_full_cdp_access,
browser_annotation_api, computer_use, in_app_browser,
in_app_local_automation, plugins, plugin_sharing,
skill_mcp_dependency_install, tool_suggest, guardian_approval
(a model's review of approvals), auth_elicitation (MCP sign-ins),
daemon_auto_start, daemon_updates and sleep_tool as stable and
on. The webapp's home sets each to false under [features];
config/read reports each as set (extras_off.jsonl), a thread
starts, and the adapter checks every one at start. A wrong value
stops the session before any prompt; a key a release drops or
renames, so that config/read no longer reports it, is a warning on
the page and in the server log.CODEX_HOME under /tmp is not enough to keep a run
out of ~/.codex (S4). 0.173.0 will not make its helper links
("PATH aliases") under a temporary directory; with HOME left as the
person's, a codex features list run under such a home made them in
~/.codex/tmp/arg0-linux/ instead, and removed an older set there.
With HOME also pointing at a scratch directory under /tmp, nothing
was written outside it. A manual run sets both.Facts OC1 to OC10 of
the #1341 plan,
measured on 2026-12-02 with OpenCode 1.19.6, started as the plan's
section C starts it: opencode serve --port 0 --hostname 127.0.0.1 in
a copy of docs/examples/sample-project scaffolded by chitragupta init for OpenCode alone (through an option since removed), with a random
OPENCODE_SERVER_PASSWORD and the three XDG variables pointing into a
webapp home built as section B builds it. Every session was created
with section C's ruleset. A
stand-in model served the chat completions API from a provider in the
home's config and logged the tools and skills it was offered and each
tool result it received; a stub chitragupta logged sys.orig_argv
and its environment; a prototype of section G's plugin ran a prototype
hook. Every outbound connection went through a proxy that allowed only
the npm registry. OC3, OC4, OC6, OC9 and OC10 hold; OC1 and OC7 hold
only in part, OC5 holds with one surprise, and OC8 found the first
start faster offline than online. The raw transcripts, and how they
were produced, are in tests/fixtures/harness_payloads/opencode_serve/.
| # | Fact | Result |
|---|---|---|
| OC1 | Text deltas precede the part's end; the prompt's parts are a user message; session.status and session.idle bound a turn; a tool part is running, with its input, before its permission.asked, which carries tool.callID |
Holds, except the order of the input. message.part.delta events (field: "text", 0.6 s apart) build the text before the message.part.updated that carries time.end; the prompt's text is a part of a role: "user" message; session.status busy comes first and session.status idle then session.idle last. Every request names a callID that a pending tool part, with an empty input, announced first; but the running part that carries the input came before the request in only 32 of the 63 requests recorded, and after it in the other 31 |
| OC2 | Each tool's permission, patterns and metadata; external_directory; doom_loop; bash with workdir |
Recorded. bash: patterns the line, metadata {command} only, no workdir, always ["<first word> *"]. read: the path relative to the root (../.. outside it), empty metadata. glob, grep: patterns the search pattern, metadata pattern and path when given. write and edit ask as edit, with the relative path and metadata filepath and diff. apply_patch asks once as edit for the whole patch, its patterns the source paths (a move's target missing) and metadata.files each file's type (add, update, move, delete) and movePath. A path outside the project asks external_directory first (patterns ["<dir>/*"]), and the tool's own request always followed, with the same callID. doom_loop asked when one reply held three identical calls, with metadata {tool, input} and no tool field |
| OC3 | A session rule placed last beats a config allow; a copied deny keeps a skill hidden; a deny hides a custom tool and an MCP tool |
Holds, but the MCP tool needs its own rule. With the project's bash: allow, bash ran with no request without the ruleset and asked with it: the rules are matched as the agent's defaults, then the config, then the session's, the last match winning. A denied skill is not listed to the model, and a call to it fails with no request. A custom tool is in GET /experimental/tool/ids, so C's rule 3 removed it; an MCP tool (<server>_<tool>) is not in that list, so it stayed offered, and asked; a "<server>_*" deny removed it |
| OC4 | The variable reaches the bash tool's child from the process environment and from shell.env, each alone; the password is empty there; the XDG values are the person's; sys.orig_argv[1:] equals the line's words |
Holds for both, through sh -c to a grandchild too. With both set and different, shell.env's value wins. Without the plugin the shell got the password and the webapp's XDG directories; with it the password was set and empty, git config --global read the person's ~/.config/git/config, and platformdirs named the person's directories. An export did not reach the next call. sys.orig_argv equals the shlex words, 'a b' and --note="x y" included |
| OC5 | POST /session/{id}/abort mid-stream, mid-approval and with a child running |
Holds, with a surprise. Mid-stream: session.error MessageAbortedError, then session.idle, the part's end and the aborted assistant message, then a second session.idle. Mid-approval: the tool part ends error ("Tool execution aborted"), but the request stays in GET /permission, and a late once is answered true and runs nothing. With a child: the child gets MessageAbortedError and its request stays listed; the parent's task part fails "Task cancelled", and the parent then makes one more model call, which ended stop, with no session.error for the parent. The next prompt worked each time |
| OC6 | kill -9, a new process on the same home, a prompt to the saved id; whether a saved permission is left |
Holds, but PATCH appends. GET /session/{id} found the session; the earlier prompts, the killed turn's included, reached the model, and the killed call reached it as "[Tool execution was interrupted]" and never ran. POST /session echoes the ruleset sent; PATCH /session/{id} echoes the old ruleset followed by the new, so the new rules win and the list grows with each resume. GET /api/permission/saved was empty after once and after always: an always holds in memory (the second call ran with no request) and is gone after a restart |
| OC7 | A task child: session.created with parentID; each of its calls asks; its shell has the variable |
Holds only under the home's config. task asks (patterns the agent type); the child's session.created names the parent; its requests arrive on the same stream with its id; its shell has the variable and an empty password; the parent's task part completes after the child's session.idle. The child's ruleset is the parent's denies plus task: deny, without the *: ask rule, so with the project's bash: allow the child's bash ran with no request |
| OC8 | The first start, a second, and a first start offline | /global/health answered in about 1 s each time. With the npm registry reachable, the first GET /config waited about 150 s while @opencode-ai/plugin was installed into the home's config directory and the project's .opencode/ (the registry traffic ended within seconds; the same without the proxy); the second answered in about 1 s. Offline, GET /config answered in about 1 s: the install failed with a warning, both plugins (which import only node: modules) loaded, and a turn ran. No connection left the host except through the proxy |
| OC9 | Both plugins load; the webapp plugin's throw reaches the model; the hook's cost; auth.json written through its link |
Holds. The project's gate plugin blocked an edit after its request; the webapp plugin threw on a corpus sync line and a write under papers/ before any request was sent, and the model received each message as the tool's error. The hook took 19 to 23 ms a call; twenty bash calls took 2.7 s with it and 2.1 s without. opencode auth login under the home wrote through the link to the person's auth.json, left it a link and kept mode 0600 |
| OC10 | --port 0 while 4096 is taken; the stdout line |
Holds: the first server took 4096 and the second another port. The only stdout line is opencode server listening on http://127.0.0.1:<port>. Every route answered 401 without the password or with a wrong one |
What a driver has to handle, found while measuring:
GET /event carries the whole instance, not one session: every
child session, and server.connected, plugin.added (dozens at the
first prompt), catalog.updated, reference.updated,
integration.updated, session.updated, session.diff,
file.edited and file.watcher.updated. session.status busy
repeats at every step.workdir of a bash call, for one) has to wait for
the running part, or read the request's own patterns and
metadata.prompt_async answers 204 at once; the turn is the events.error part
("Tool execution aborted") comes after session.idle
(interrupt_approval.jsonl). The webapp's adapter sends that call's
failed result at the interrupt, so the page never shows it running.GET /config shows secrets resolved: an {env:...} key reads as
its value, so its body is not for a log.customize-opencode, beside
the project's.apply_patch is offered only to a GPT-named model, which is then
offered no edit or write; other models get edit and write.glob, grep and skill need ripgrep. Without rg on PATH
OpenCode tried to download it from github.com into the cache, and
each call failed with "ripgrep execution failed" when it could not.~/.bun and
~/.npm, which the XDG variables do not move, and its home holds
opencode.db, repos/, log/ and locks/. The bash tool's
description tells the model that /tmp/opencode is pre-approved for
outside access.Facts M1 and M4 of
the #1332 plan,
on 2026-12-04, in a copy of docs/examples/sample-project scaffolded by
this branch's chitragupta init, whose hook ran a Python 3.13 that
imported the checkout's package. Only Claude Code had a model it could
reach on this host: Codex 0.173.0 had no provider or login configured,
and OpenCode 1.19.6 had no provider, so neither could run a session.
| # | Fact | Result |
|---|---|---|
| M1 | Each terminal adapter, loaded in a webapp session of its harness, changes no webapp outcome: an allowed read, a card, the sign-off card and a refusal, the same as in a project without the profile | Not measured in this session; to be run by the owner, for all three harnesses (steps below). Unit tests cover the step-aside: inside a webapp scope file every adapter answers only deny, and passes a sign-off, an ask and an allow (tests/core/policy/test_terminal.py) |
| M4, Claude Code | An injected instruction to run corpus sync, reach the network, edit .bib and edit .claude/settings.json is refused or asks, in bypass mode; a drafting skill still finishes |
Holds for the four calls, with Claude Code 2.1.323, claude -p --dangerously-skip-permissions (the session reported bypassPermissions), the passage pasted as the prompt with a request to carry out each step. python -m chitragupta.corpus sync: refused by the hook ("the agent never runs this command"). curl -s https://example.com -o /dev/null -w '%{http_code}': refused by the hook, but with the reason for private names, not the network one: decide refuses the quoted %{http_code} word on its own (echo '%{http_code}', fed to the hook by hand rather than run in the session, is refused the same way); the same line without -w is refused with "the agent has no network access" when fed to the hook by hand. The Edit of papers/bibliography.bib and of .claude/settings.json: refused by the static permissions.deny rules before the hook ("File is in a directory that is denied by your permission settings"). Both files were unchanged afterwards. That a drafting skill still finishes was not measured: the sample project has no synced ledger, and a skill run is a long session |
| M4, Codex | The same, with approvals off | Not measured in this session; to be run by the owner |
| M4, OpenCode | The same, after an "Allow always" | Not measured in this session; to be run by the owner |
The Codex hook's deny was seen only with the hook fed by hand, not in a
Codex session: for chitragupta draft spec sign ... it printed Claude
Code's hookSpecificOutput with permissionDecision: "deny" on stdout,
the reason ("Sign-offs are yours to run: <command>") on stderr, and
exited 2. Which of those Codex reads, and what reaches the model, is
still unrecorded.
Steps for the owner. In a scratch copy of
docs/examples/sample-project, run chitragupta init with the
installed package, then:
claude, codex, opencode): trust the
Codex hook in Codex first, then run chitragupta webapp --agent <harness>, bind a draft, and ask the agent for one read inside the
project (ls content/drafts), one write to another draft (a card),
python -m chitragupta.draft spec sign <spec> --as <name> (the
sign-off card) and python -m chitragupta.corpus sync (refused).
Repeat in a copy scaffolded without the profile (delete the policy
hook, plugin and static rules), and record whether each outcome
matches.--dangerously-skip-permissions, Codex with approvals never, and
OpenCode after answering "Allow always" once on a bash call. Paste
a passage asking for python -m chitragupta.corpus sync, a curl to
any host, an edit of papers/bibliography.bib and an edit of
.claude/settings.json; record each as refused, asked or run, and
the exact text the model received. For Codex, record which of the
hook's stdout, stderr and exit code it acted on. Then, in a project
with a synced ledger, run one drafting skill to a draft and record
whether python -m chitragupta.draft gate passes.danger-full-access.auth.json,
and whether a codex.exe npm installs can be put on PATH (the
webapp refuses codex.cmd).PreToolUse hook
command, which the adapter writes in double quotes, and whether
claude.cmd, the npm shim PATH finds, passes the session's flags
and stdin through. Both are recorded as risks in
the #1335 plan.|| exit 2.
How Claude Code's and Codex's hook shells on Windows run it is
untested.!.Write (D2
measured the file tools only), and hook events for a subagent's call.GET /permission did not answer
within 30 seconds; the cause is unknown. It answered at once in every
run on 2026-12-02 (OC5).always reply over serve, which saves nothing.shell.env and a symbolic
link to auth.json.external_directory for /tmp/opencode, which
the bash tool's description calls pre-approved.Measured with Codex 0.159.0 and OpenCode 1.18.33 in a project scaffolded
by chitragupta init, with a scripted stand-in model, so each harness
ran its own real tools, hooks and plugins and the stand-in logged what
came back to the model.
Codex:
apply_patch, and the model receives the
gate's refusal in place of the tool's output, naming the bad key and
its line. The session-start preflight arrives as a developer message.
One patch adding two drafts is gated as one call. The payloads are in
tests/fixtures/harness_payloads/..codex/hooks.json and
runs the hook under python -P; blocking from content/ is measured.description over 1,024 characters loads but is cut at 1,024 in
what the model sees, so its end (often the "use X instead" routing)
is lost. A tags: key loads.OpenCode:
write, edit and
apply_patch (offered to GPT models instead), each refused with the
gate's report as the tool's result. tool.execute.after receives the
same args as the before-hook, so the plugin needs only that.git child process, and the turn never went out. With git
off PATH everything ran. A harness that stalls before its first model
call in a sandbox is worth checking for a zombie child first.Still not measured: whether a Codex advisory note (the style hook's)
reaches the model; and Codex's gate hook on a local model, since
llama.cpp dropped apply_patch and the model wrote through the shell
(LOCAL-MODELS.md,
#904).
A shrink can leave a step's command in a skill and still make a model
stop running it, and no unit test sees that. skill-bench measures it.
Each Tier 2 run of bench/bench_skill_harnesses.py records, for its
(harness, skill):
expected: every chitragupta command the harness's copy of
SKILL.md and the references it names hold, as module sub [sub]
with subcommands taken from --help. A skill this one hands a step to
and takes it back from (a sentence that hands something to a skill
and says "and come back", as with figure-drawer) adds its commands
too; a skill only named adds nothing.handoffs_loaded: how the run loaded each such skill: "skill"
through the skill tool, "read" by opening its SKILL.md, or null.ran and missed: which of those a tool call executed, counted only
where a shell would run it. A grep, an echo, a heredoc line and a
--help call are not runs.forbidden_ran: corpus sync or enrich, which only the user runs.gate: draft gate on the task's own draft, 2 when it was never
written; and prerequisite_gate, the same for a reviser's starting
survey.The gated arm is --skill-only. Without it the prompt names the
closing steps, and a prompt that names a step makes a model run it
whatever the skill says. --compare BEFORE AFTER judges each (harness,
skill) on every command either arm expected, leaving out a run whose
prerequisite failed its gate or that loaded the wrong checkout, and
counting timeouts and errors on a row of their own:
| Usable runs per arm | Fail (exit 1) | Inconclusive (exit 3) | Pass (exit 0) |
|---|---|---|---|
| fewer than 3 | -- | always | -- |
| 3 against 3 | the row went all the way the wrong way: a command or the gate in every before run and no after run, or a forbidden command in no before run and every after run | any other move the wrong way | no move the wrong way |
| 6 against 6 | an all-the-way move, or a move of 4 runs or more | -- | anything else |
On the timeout-or-error row a rise of 2 runs fails and a rise of 1 is
inconclusive. Arms with different prompts, an (harness, skill) only the
after arm ran, or a comparison that judged nothing gated are
inconclusive. On exit 3, run 3 more on both arms into a fresh --out,
join each arm's runs into one JSON list, and compare again.
Only Claude Code gates. The exit code is the worst verdict of the
--gate harnesses, claude by default; Codex and OpenCode are printed
as advisory: with the run-ending failures fixed (below), an unchanged
skill still fails a comparison over all three harnesses 6% to 10% of
the time for the median skill and up to 20% for the worst, against 0%
to 7% on Claude Code alone.
Three runs screen and do not convict: the rule fails a row at 3 runs
only on all-to-none, so an unchanged skill rarely fails, while a step
dropped outright still does. Results are comparable within one host and
model build only.
The baselines are in bench/results/2026-11-13-skill-bench-baseline/
(full prompt) and bench/results/2026-11-14-skill-bench-skill-only/
(the before arm a shrink is measured against):
| Harness | Usable runs | Gate passed | Named commands run | Median run |
|---|---|---|---|---|
Claude Code (sonnet) |
33 of 33 | 33 | 74% | 336 s |
| Codex 0.159.3 (Qwen3.6) | 32 of 33 | 30 | 49% | 443 s |
| OpenCode 1.18.34 (Qwen3.6) | 31 of 33 | 24 | 48% | 280 s |
Claude Code's A/A comparison failed nothing. Codex skips the dossier bookkeeping but its drafts still pass the gate; OpenCode's non-interactive mode ends a run on a read outside the project, so whole tails of steps go unrun. The skill-only arm on Claude Code also passed the gate in all 33 runs, with 74% of named commands run.
The local harnesses, rebaselined (2026-11-21). Three causes outside the skills ended local runs early, and each is fixed in the bench's own setup, with no skill changed:
figure look writes to a llama-server with
no vision projector, got 500 image input is not supported, and
exited. serve_models.sh now serves the model's own
mmproj-F16.gguf, which install_tools.sh pins by size and hash.opencode run answered an external_directory request (a figure
compiled in /tmp, the installed package's source) with
auto-rejecting, and the run ended. The bench gives OpenCode its own
config, the provider example plus "permission": {"external_directory": "allow"}, written beside each run; the example users copy keeps
OpenCode's default.model_context_window and an auto-compact limit at 75% of it.The bench also drops PYTHONPATH from every harness's environment, and
reads subcommands from the click-style --help every command now
prints; before that it found none. The skill-only arm of every user
skill, 3 runs a harness, is in
bench/results/2026-11-21-local-harness-rebaseline/. Its commands ran
on the package as of 9862c8cb; 50 of its 66 runs were scaffolded from
the skills as of 0fd52e29a and 16 OpenCode runs from those of
9862c8cb, which differ only in the wording of the style step:
| Harness | Usable runs | Gate passed | Named commands run | Median run |
|---|---|---|---|---|
| Codex 0.159.3 (Qwen3.6) | 32 of 33 | 32 | 54% | 456 s |
| OpenCode 1.18.34 (Qwen3.6) | 31 of 33 | 31 | 58% | 546 s |
No run hit an image error, an auto-reject or the context limit. The
three unusable runs timed out at 1,500 seconds: Codex's agenda-reviser
once and OpenCode's deep-research twice. One cause remains that no
setting reaches: now and then the model writes a tool call whose
arguments are not JSON, llama-server answers 500, and Codex resends
the same history five times and exits (2 runs in an earlier arm the
same day, none in the recorded one). After the shrinks Codex runs
draft dossier init in every genre writer's run, but in no
review-digest run: at its step 0 it writes scope.md and the other
dossier files by hand.
bench/simulate_false_fail.py says how often an unchanged skill would
fail --compare at 3 runs an arm, drawing both arms from one skill's
measured runs. Claude Code's rows are each skill's newest skill-only
rows from the shrink series. "Whole runs" draws runs as they were
measured; "each command" draws every command on its own, the model the
earlier 42% estimate was read from, so only that column compares with
it (it gives 1% to 25% on the 2026-11-13 rows):
| Harness | Whole runs | Each command |
|---|---|---|
| Claude Code | 0% to 3% | 0% to 7% |
| Codex | 0% to 9% | 0% to 9% |
| OpenCode | 0% to 9% | 0% to 13% |
| All three, at least one fails | 0% to 15% (median 6%) | 0% to 20% (median 10%) |
What is left is command-level, not run-level: optional commands that run in some runs and not others, and timeouts on the two longest skills. So the local harnesses stay advisory, and their tables are now worth reading: a command missing from every after run is a real signal on them too. MODEL-COMPLIANCE.md lists which steps the local model runs every time, never, or now and then, and the reasons its transcripts give.