Skip to content

merge(api): instructions and hooks as cell values (M6.5) - #83

Merged
LittleCoinCoin merged 79 commits into
mainfrom
feat/m6.5-agent-config
Nov 25, 2026
Merged

LittleCoinCoin merged 79 commits into
mainfrom
feat/m6.5-agent-config

Conversation

@LittleCoinCoin

Copy link
Copy Markdown
Member

Why

An experiment could not give an arm its own CLAUDE.md/AGENTS.md or its own hooks. The only way in was the experiment-wide inputs, which:

  • reaches every arm;
  • needs a different file name per harness;
  • lands a root file where it is collected and graded as the agent's work, and lets the agent edit it;
  • cannot reach .claude/settings.json.

M6.5 makes instruction texts and hooks cell values, written inline like mcp.servers. Candler guarantees the installation and the harness judges the content: the harness's own check runs at job start, before any agent, and an error or a warning refuses the cell. The trace shows what each run started with, so the installation is proved from the run's own record.

Changes

  • Declaration. instructions.global.<harness>, instructions.workspace and hooks.<harness> are read by one reader (candler_harness::agent_config). They are covered by the cell digest, shown by inspect, and refused with typed codes: cell_value_missing, cell_value_invalid, rel_path_invalid, the new experiment.instructions_collide, and the new experiment.harness_rejected_input.
  • Claude Code.
    • The global text goes to ~/.claude/CLAUDE.md in the run's home, with user added to the setting sources.
    • The workspace text is a read-only root CLAUDE.md.
    • The consumer's hooks are merged under the hooks key of .claude/settings.json, with their files under .claude/hooks/.
    • Candler's observers stay in a separate --settings file and now also log InstructionsLoaded.
  • OpenCode.
    • The global text goes to $XDG_CONFIG_HOME/opencode/AGENTS.md.
    • The workspace text is a read-only root AGENTS.md.
    • Plugins are local files under $XDG_CONFIG_HOME/opencode/plugins/.
  • Harness check at job start.
    • claude doctor runs on Claude Code. On OpenCode, a --standalone start runs with no model and refuses level=WARN lines.
    • Cells are grouped by everything the check reads, home and workspace files and declared inputs included, and the check runs once per group, without network.
    • A check that cannot run is jobs.config_check_failed.
  • Census. Each run lists the instruction files that loaded, with their scope. The user file's path is absolute, the workspace file's path is relative to the workspace.
  • Trace. There is a new event, context_start {system, first_message}, recorded by the gateway from the run's first request that offers tools. It is the root session's first event, read through the existing gateway-log reader. This is an additive minor change to the trace schema.
  • Guards.
    • guard_agent_config_e2e runs a real candler run on both harnesses against the fake model and reads the stored trace and census, as a consumer would.
    • guard_harness_check_refuses runs the real images.
    • The workspace suite passes in full, 767 of 767.

Hard parts

  • Where each text lands differs by harness, and was measured, not assumed.

    • Claude Code puts both instruction texts in the first message and the session-start marker in the system text.
    • OpenCode puts all three in the system text.

    The gates accept either field. A live run on a real model (RiVault Reasoning-Small, both harnesses, two arms) confirms this from the stored traces: __reports__/agent_config/06-findings_live_confirmation_v0.md.

  • The check had to move. A resolve step cannot reach a cell's plan, so the check runs beside the start check of the declared MCP servers, and the collision check moved to planning. Both still run before any agent.

  • Check rules come from recorded output. OpenCode prints environment errors at ERROR level (watcher backend not supported, Failed to fetch models.dev). Refusing them refused valid cells, so the reader refuses WARN only, which is where every consumer failure that was probed lands. That includes a plugin that throws in setup().

  • The check must see what the run sees. The end-to-end guard found that declared inputs were not mounted in the check, so an OpenCode MCP server taken from inputs was refused at job start. The inputs are now mounted and keyed.

Not covered

  • Instructions given as file references, scopes beyond global and workspace, npm plugins, and other settings keys.
  • Evaluator access to the installed texts is deferred.
  • The context of requests after the first is not recorded.
  • The run-context branch (M6d) is not on main yet. Whichever lands second regenerates the trace schema and page, and adds the needs.trace sentence about context_start.

Observations

These are filed under __reports__/agent_config/ (rounds 05 and 06), with the closing review in round 07. The two that matter most:

  • A refusal at job start loses its code. job.ended carries failed only, so a consumer cannot tell experiment.harness_rejected_input from any other failure (O11). It is the main gap left.
  • A silent guard. An ignored OpenCode guard has been broken on main since 8d88cb5 (O1).

🤖 Generated with Claude Code

LittleCoinCoin and others added 30 commits November 25, 2026 12:15
An arm cannot carry its own CLAUDE.md, AGENTS.md or hooks today: the
experiment-wide inputs reach every arm, need a file name per harness and
cannot touch the settings the driver owns. The architecture report plans
instruction text and hooks as cell values, passed like mcp.servers,
installed where each harness looks, and checked by the harness's own
validator before the agents run; any error or warning refuses the cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new root, independent of M7 and M8: level 1 probes the harness checks
and declares the settings with honest Refused answers; level 2 installs
per harness and adds the preflight check; level 3 proves it end to end
on real harnesses against the fake model; level 4 reviews and closes.
Estimate $55, cap $75, measured from transcripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HTN eval lane named four requirements an instruction-file arm would
need. The plan meets the digest, placement and record requirements;
placement is deliberately not the workspace root, which is collected as
outputs. Evaluator blinding is not covered: any comparable value a
metadata need names is served, so the notice puts the choice to Eliott.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan's v1 applies the two rulings on the HTN lane's notice.
Instructions come as a global file per harness, set for the whole
experiment, and a workspace file per arm. The workspace file is mounted
read-only at the workspace root as CLAUDE.md or AGENTS.md through the
existing input mount, so it is neither collected nor editable, and an
input at the same path is refused. Evaluator access to these values is
deferred until a consumer needs it. The notice is revised to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The leaves now set instructions.global and instructions.workspace in
place of instructions.text. The probe also settles where Claude Code's
global file loads and whether a read-only root mount is read. The core
leaf gains the workspace mount and the collision refusal, which is the
new gate G10. Every leaf points at the v1 report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The proof reads the trace, as a consumer does: a context_start event
from the gateway's first request shows both instruction texts and a
session-start hook marker, against the fake model and live on RiVault.
Gates G11-G13; cap $85.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the L1 leaf trace_context, probe question (g), the live step of
e2e_guard, gates G1-G13, renumbered reports and the $85 cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root's gates name trace_context among the leaves that must be done,
and the spend cap of $85 that plan v2 set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The probe answers (a)-(g) by measurement: Claude Code's global file goes
in the run's home with `user`, both harnesses read a read-only root file,
each has a session-start hook that reaches the model, and the checks are
`claude doctor` and a standalone OpenCode start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Eliott ruled that the proof reads the starting context, system text or
first message, from the first request that offers tools, and that
consumers write hooks and global instructions in the harness's own
shape. The leaves now word G1, G4, G8, G11 and G12 accordingly; the
end-to-end half of G1 moves to the e2e guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every session's normalised trace now begins with context_start, the
system text and first message of the run's first request that offers
tools, recorded by the gateway and read by the census's one reader. The
gateway sidecar is tagged by its sources, and both harnesses share one
stream name for its record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A bad key of a factor level is refused at the level's pointer again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An empty table inside a level is refused at the level's pointer again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
LittleCoinCoin and others added 28 commits November 25, 2026 18:01
The check stages each distinct cell once and groups by the staged files (home
and workspace lists kept apart), the command's environment and working
directory and the container environment. Both start checks share one loop that
runs each group over its scratch and removes it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plan_runs meets the collision, so every caller of it does, not only candler
run. Paths are compared without a leading ./ and case-folded; the workspace
holds no Unicode normalisation crate, so they are not NFC-normalised. A
guard drives candler run itself with the input at CLAUDE.md and claude.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The global text goes to AGENTS.md and the plugins to plugins/ in OpenCode's config directory, the
workspace text is the plan's read-only AGENTS.md, and a bad value is refused at resolve. The
census names the Instructions from: blocks of the first request that offers tools, which the
core now reads from the gateway stream. The config check starts opencode on a model that does
not exist and rejects on a WARN line, or on output that never reached the model.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The guard took the last three words of the command for the MCP flags; the
observers settings file now follows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Before a job's first run the core now runs each harness's own check on
what Candler installed, once for each distinct staging, beside the start
check of the declared servers. A finding refuses the job with
experiment.harness_rejected_input, quoting the harness; a check that
cannot run is jobs.config_check_failed; a clean verdict is recorded in the
run's provenance. The workspace instruction file is mounted read-only
through the inputs' one mount list, and an input at its path is refused
in planning, case-folded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
OpenCode installs a cell's global AGENTS.md and local plugins under its
config home, mounts the workspace AGENTS.md read-only, reads the census
from the gateway's starting context, and checks the configuration with a
standalone start whose WARN and ERROR lines refuse the cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The job start now runs the harness check in a control container before
any agent. The fake Docker answered it with something that is not a
report, so every job was refused before its first run.

The shell fake of the CLI tests prints the claude-code doctor fixture for
the control run of `claude doctor`. The core fake answers the control run
that carries `--print-logs` (the OpenCode check; its export run does not)
from run-check.out, which the wiring support fills from the OpenCode
check fixture.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The guard asserted that Claude Code refuses instructions.workspace by
name, which held at level 1. Level 2 installs the text on both harnesses,
so no driver refuses it: the guard now runs a cell that sets it and reads
the text back through inspect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fake Docker of the CLI and core tests answers the job-start harness
check with a clean report for its harness, and the inspect guard reads a
workspace instruction text back instead of expecting its refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OpenCode config check refused on every level=ERROR line, but OpenCode
prints environment errors at that level (a watcher that cannot start, a
models.dev fetch that fails offline) intermittently, so a valid job could be
refused as experiment.harness_rejected_input. Consumer-caused findings are
recorded at WARN, so only WARN lines are findings; the drain line is still
required.

The OpenCode census recorded the workspace instruction file as /work/AGENTS.md;
LoadedFile::path is relative to the workspace for a workspace file, as Claude
Code records CLAUDE.md. A project file under the workdir is now recorded
relative to it.

The job-start check pointed at /fixed/instructions, a key no experiment file
has; it now points at /fixed/instructions.workspace or .global, the spelling
the declaration's own refusals and the collision refusal use.

candler-harness now holds AGENT_HOME and AGENT_WORKDIR; the core layout
constants, the Claude Code session and the OpenCode driver read them there, and
each driver returns its prepare constant as the workspace instruction file
instead of repeating the literal.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The OpenCode check refuses only WARN lines, since OpenCode prints
environment errors at ERROR that would refuse valid cells; its census
records the workspace file relative to the workspace, as Claude Code
does; the instructions pointer names a key of the file; the agent home
and workdir are named once; the architecture describes the job-start
check and the hooks as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The seam fix records OpenCode's workspace instruction file relative to
the workspace, as LoadedFile documents and Claude Code already does.
The core census guard still pinned the absolute /work/AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 05: ten observations from the level 2 leaves and the seam review,
and three process lessons (whole-suite gates, check rules from recorded
output, build slots shared between worktrees). The README gains the
round and the level 2 status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two Docker guards run the real candler on real Claude Code and OpenCode
against the scripted fake model. guard_agent_config_e2e reads, per run,
the inspect record, the stored context_start, the census and the sealed
outputs for instructions and hooks (blocking and session-start).
guard_harness_check_refuses starts jobs on real images and reads the
refusal of an invalid payload and the pass of a valid one.

The fake model gains the script h1 (one shell call). The parity e2e's
fake-model start and job run are shared instead of copied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An OpenCode cell whose MCP server script comes from the experiment's
inputs was refused at job start: the check container did not mount the
declared inputs, so OpenCode logged a WARN for the missing script and the
reader refused it. The check must see what the run sees.

The check now stages its container with the cell's declared inputs, as
the server check does, and the group key covers them (each input's
workspace path and content digest), so two cells that differ only in
inputs are checked apart. The architecture and the harness-capabilities
page say so.

The G11 guard now asserts the session-start marker is in the
context_start system or first_message. It is in system on both harnesses
under Candler (Claude Code 2.1.311 writes a `SessionStart:startup hook
success:` line there; the probe's bare `--print` run had it in the first
message).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Lands the M6.5 level 3 guard leaf. guard_agent_config_e2e reads the
stored trace and census of a real `candler run` on Claude Code and
OpenCode against the fake model (G4, G5, G7, G9, G11, G1 end to end);
guard_harness_check_refuses runs the real harness checks (G6).

The leaf found that the job-start harness check did not mount the
cell's declared inputs, so an OpenCode MCP server taken from inputs
was refused at job start; the check now mounts and keys them, as the
run and the server check do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
G13 on RiVault Reasoning-Small, Claude Code and OpenCode, two arms each:
every stored context_start holds the global text, its own arm text and
the session-start marker, and never the other arm text. Blocking hooks
were left out of the live run. Round 06 entry added to the README.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The guard leaf is done: its gates are ticked, G6 with the note that
the refusal's code is not recorded where a consumer reads it. Round
06 gains the level 3 observations (O11-O15) and keeps the live run's
two experiment files beside its findings. M6d has not landed on
origin/main, so meet_run_context records its gates as owed by M6d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All 13 gates hold on the tip; none fails.
Three small in-scope defects, four debt items, four notes.
No test or build was run for the review.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The closing review finds G1-G13 holding on the tip. Its findings are
disposed in the knowledge transfer: F2 (a plugin that fails in setup
might log only at ERROR) is refuted by a run of OpenCode 2.2.7, which
logs it at WARN; F5 and F6 are fixed here (a gate named wrong in the
live report, experiment files naming a deleted treatment, stale design
and status prose); F1 and F7 were already covered; F3 is a notice.
Every node of the campaign is done; spend is $109.69 of $125.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The public docs of check_config linked the private verdict_bytes,
which rustdoc refuses under -D warnings. They now say in prose that a
check that did not run is a ConfigCheckError, and name the declared
inputs among what groups the cells.

The workspace-file guard wrote to the mounted AGENTS.md as the image's
own user. On Linux the file mode refuses that write first ("Permission
denied"), before the mount's read-only flag, so the guard's
"Read-only file system" assertion failed although the write was
refused. The probe now runs as root, which no file mode refuses, so
only the read-only mount can refuse it, on Linux and macOS alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LittleCoinCoin
LittleCoinCoin merged commit 769ebd4 into main Nov 25, 2026
7 checks passed
@LittleCoinCoin
LittleCoinCoin deleted the feat/m6.5-agent-config branch November 25, 2026 16:20
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.

1 participant