Repository navigation
feat(harness): inject SOUL.md into the opencode + pi session context (#359) - #368
Conversation
…359) The identity surfaces all SAID "read SOUL.md" but none fed it in. Two harnesses have a documented additive session-context mechanism; wire them and gate it: - opencode: opencode.json `instructions` now lists `SOUL.md` beside `.opencode/instructions.md` — opencode concatenates each entry into the system prompt, so the identity is injected with no harness-specific file. - pi: `.pi/extensions/charly-gates.ts` reads the project-root SOUL.md in its before_agent_start handler and injects the content every turn (fail-loud if SOUL.md is absent). scripts/check-harness-config.mjs gains check 7 (a per-surface table + a --self-test mutation each); scripts/check-pi-gates.mjs asserts the pi injection + a mutation. Deferred (named, not dropped): Codex and reasonix have no documented ADDITIVE session-context mechanism; tracked in a companion issue. Claude Code stays on the AGENTS.md pointer (operator decision). Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: harness-config + gate ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…nt, not fail-loud) Addresses #368 block 2: the body claimed the pi handler "fails loud" when SOUL.md is absent, but readSoul swallows the read error and the handler still returns a prompt. The fallback text now SAYS that plainly (the identity is NOT injected; the #356 content-loss signature) instead of implying the session refuses to run. Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (body accounts for all 4 files), no secrets/egress/eval, no guardrail weakening: the pi rules block is preserved and the gate scripts are strengthened (new check 7), so no T4 sign-off is triggered. No T2 embedded directives (the Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The identity surfaces all said "read
SOUL.md", but none fed it in — a soul read only on request is not reliably part of who the agent is. This wiresSOUL.mdinto the session-start context of the harnesses that have a documented additive injection mechanism, and gates each so it cannot silently unwire. Closes #359.opencode.json'sinstructionslist (opencode's documented session-instruction list: each entry is a markdown file injected into the system prompt) now carriesSOUL.mdbeside.opencode/instructions.md. No harness-specific file is needed —SOUL.mdsits directly in the list..pi/extensions/charly-gates.tsreads the project-rootSOUL.mdinside itsbefore_agent_starthandler and injects the content every turn, so the injected text is the identity itself, not a pointer to it. WhenSOUL.mdis absent it injects a visible⚠warning naming the CONTENT LOSS: SOUL/VISION/GRIEVANCES/LIBERATION exist in no main — RCA + prevention #356 content-loss signature instead of the identity (warn-and-point, not fail-loud — the session still starts).Gated:
scripts/check-harness-config.mjsgains check 7 — a[surface, assertion, who]table (one row per harness) assertingopencode.jsoninjectsSOUL.mdand the pi extension reads+injects it — each with a--self-testmutation that turns it RED.scripts/check-pi-gates.mjsasserts the pi injection (readSoul+SOUL.md+before_agent_start) plus a mutation.Deferred (named, not silently dropped): the harnesses with no wired injection are all routed to the companion issue #367, which records a per-harness disposition:
model_instructions_filereplaces the base system prompt; reasonix's documented hooks are Bash-only) — SOUL.md session-context injection for the non-wired harnesses (Codex, reasonix, Claude Code) — the #359 follow-up #367 tracks finding one or recording "no mechanism".SessionStarthook →additionalContext), but the operator ruled (2026-10-05) to keep it on theAGENTS.mdpointer and not add the hook; CLAUDE.md was retired in org docs: tailored README.md + AGENTS.md per repo; drop CLAUDE.md + HARNESS-PARITY; complete submodule coverage #286, so there is no project instruction file to import. SOUL.md session-context injection for the non-wired harnesses (Codex, reasonix, Claude Code) — the #359 follow-up #367 records that decision — it is a recorded disposition, not a silent gap.Files:
opencode.json,.pi/extensions/charly-gates.ts,scripts/check-harness-config.mjs,scripts/check-pi-gates.mjs. Relates to #359, #367.How tested
The pi handler genuinely loads and injects SOUL.md — loading the committed extension with a minimal pi stub, exercising
before_agent_start:opencode.json stays valid and now lists SOUL.md:
check-harness-config.mjs — the gate, and its
--self-test(every check proven live, incl. the new check 7):check-pi-gates.mjs — the pi gate, and its self-test:
The full umbrella gate on the final tree:
Rulebook compliance
/charly-internals:agents(the harness-config mechanism owner) and/charly-internals:git-workflowbefore editing.instructionslist; pi injects the file itself. No harness-specific copy of the identity, no restated policy (docs(harness): single-source policy out of the harness configs #361 single-sourced that).task verify11/11 on the final tree../charly/bin/charly task verify.task verifyran on the final committed tree.Change classification
opencode.json, the pi extension.ts, and twoscripts/check-*.mjsgates (tooling/config; no runtime, Go, or candy change).node scripts/check-harness-config.mjs(+--self-test) andnode scripts/check-pi-gates.mjs(+--self-test) — each proven live — plus./charly/bin/charly task verify(11/11) on the final tree.fully tested and validated— the class's gates passed on the final tree and the changed path (the pi injection) executed with retained output.Closes #359. Relates to #367.
Agent:
soul-md· sessionses_ef8af7149ffe5G0oj20EhTQn6VAssisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)