Repository navigation
Description
Epic: M0 Blocked by: — Tier: judgment Doc: docs/internal/graph-2026-09/PLAN.md §4 (opencode seam), §5 I-3, I-8, §7 D7, §9 OQ-8/OQ-9, docs/internal/graph-2026-09/lab-notes-phase0.md §1
Why
#862's stated load-bearing unknown (Risk 1) is whether the model actually
loads .claude/skills/<phase>/SKILL.md when a .opencode/commands/<phase>.md
wrapper asks it to. The 09-03→06 field run proved transport, not skills. The
driver (#862 (node 12)) must be built against an observed contract and a recorded
fixture, not an imagined one.
Scope
- may touch:
docs/investigations/opencode-driver-spike.md,src/lib/workflow/drivers/__fixtures__/opencode-run-*.ndjson(recorded real output, secrets scrubbed), a throwaway scratch worktree of this repo (deleted before the PR) - not in scope: any
src/change; any driver code; the hook shim.
Preconditions
- AC-0: an opencode provider key is present in the environment — Verify:
opencode --version→1.18.27or newer, and the spike doc records the model id used and its$(I-8). Without a key, the node stops and reports; it does not guess.
Acceptance criteria
- AC-1: skill-load observed or refuted — Verify:
grep -cE 'SEQUANT_QA_VERDICT|### Verdict' src/lib/workflow/drivers/__fixtures__/opencode-run-qa.ndjson≥ 1 for a run ofopencode run --command qa <issue> --format json --auto --dir <scratch worktree>with a wrapper.opencode/commands/qa.mdthat instructs loading theqaskill; if the count is 0 after two wrapper phrasings, the doc's verdict line readsKILLand names what the model did instead. - AC-2: NDJSON event inventory — Verify:
jq -r '.type' src/lib/workflow/drivers/__fixtures__/opencode-run-qa.ndjson | sort -uis pasted into the doc and includes at leasttextandstep_finish; every event type seen has a one-line description of its payload. - AC-3: the three field-run traps have a recorded mitigation — Verify: the doc has a table with rows
32K step clamp,/tmp permission kill,process-group kill, each with the exact config or spawn option that mitigated it (OPENCODE_CONFIG_CONTENTpayload; allow rule or scratch relocation;detached+ group kill) and the command that reproduced it — or, where the trap could not be provoked on the pinned opencode version, the controlling command that refuted it and the version it was tried on (amended 2026-09-07 per PLAN §9 OQ-19: the spike disproved the/tmpkill on 1.18.27 and could not provoke the clamp in three controls; a refutation with its command is the deliverable, not a failure). - AC-4: go/no-go posted — Verify:
gh issue view 862 --comments | grep -c 'Spike verdict: GO\|Spike verdict: KILL'≥ 1, and the comment lists which feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 P0 ACs change as a result (e.g. reasoning-budget field inrun.opencode). - AC-5: cost recorded — Verify: the doc's cost table has
$and wall time per run; total under$5.
Done when
#862 has a spike verdict with a committed real NDJSON fixture and a mitigation table, so #862 (node 12) can be specified against observed behavior.
Part of #862. Planned by /graph-plan 2026-09-06; run with /graph-run. Plan: docs/internal/graph-2026-09/PLAN.md, graph: docs/internal/graph-2026-09/issue-graph.md, node file: docs/internal/graph-2026-09/issues/06-*.md.
Activity
admarble commentedon Sep 7, 2026
Runner context (graph-run, 2026-09-06): the plan for this graph is on PR #998 (branch
docs/graph-plan-2026-09), not yet on main. Read it from the branch, not the working tree:PLAN §5 invariants are binding here: I-4 (hook/skill copies byte-identical:
md5 -q a b c | uniq | wc -l→ 1), I-5 (gate tests ship aMutation-verified:record in the PR body), I-6 (stop at PR — nevergh pr merge, never close the issue), I-9 (run the Verify commands verbatim; never reason an AC done). Base is main20e2a867(v2.13.1); no code drift from the plan basec3c1b0a8beyond the version bump. Stay inside the may touch list in the node file.Node file:
issues/06-NEW-opencode-skill-load-spike.md.AC-0 precondition (verified by the runner):
OPENROUTER_API_KEYis present in the harness process environment;opencode auth listshows 0 stored credentials and only the OpenRouter/Perplexity env keys. Use an OpenRouter-routed model id (list them withopencode models) and record the exact id and $ per run (I-8). Hard cost cap: total under $5 (AC-5) — stop and record KILL/partial rather than exceed it. Nosrc/changes; the scratch worktree is deleted before the PR; fixture output has secrets scrubbed.admarble commentedon Sep 7, 2026
Complexity: Standard (5 ACs + 1 precondition, 2 directories)
AC Quality Check
lintAcceptanceCriteria— 5/5 pass, 0 flagged. Every AC carries an executableVerify:command. No vague/unmeasurable/open-ended patterns.Two notes:
Evidence:field, soextractAcceptanceCriteriainfersverificationMethod: manualfor all five. Correct here (this is a spike; evidence is recorded command output, not a test run) — but it means notestgenphase and QA must run theVerify:commands verbatim (I-9).detectBehaviorRule: 0/5 trigger → no Rule Touchpoints section.Scope Assessment
Non-Goals:⚠️ No literal
Non-Goalsheading — the parser missed the- not in scope:line under## Scope, which does bound scope correctly. Parser-literal miss, not a real scope gap.Verdict:⚠️ SCOPE_WARNING — triggered solely by the missing
Non-Goalsheading. All three metrics green.shouldEnableQualityLoop→false.In-flight conflicts: none. 9 live worktrees scanned; zero touch
drivers/ordocs/investigations/. Both deliverables are new files. A worktree for this issue already exists (feature/992-spike-opencode-...) —/specdid not create one and none is needed for planning.Free findings that change the plan (probed this session, $0)
F1 — Skill discovery is already proven; only invocation needs a paid run.
opencode debug skill(local, no model call) returns 25 skills, including:All 20 sequant project skills resolve, plus 5 from
~/.claude/skills/. opencode holds the full body: 173,010 chars vs 174,981 on disk (delta = stripped frontmatter) — ~43K tokens injected per skill load. This splits OQ-8 in two: (a) discovery/resolution = PASS at $0, (b) does the model actually call the skill tool when a wrapper asks — still the paid question. Record (a) as the doc's baseline; spend only on (b).F2 — The global config contaminates every run.
opencode debug configin this repo resolves~/.config/opencode/opencode.jsonc, which already carries the 32K-clamp mitigation (z-ai/glm-5.3-flash→options.reasoning.max_tokens: 20000). If the spike runs that model, AC-3's mitigation will appear to work for a reason the driver cannot ship, and the fixture is not reproducible for anyone else. Build the config explicitly viaOPENCODE_CONFIG_CONTENTand recordopencode debug configbefore/after. (--puredisables plugins, not config.)F3 — AC-1's grep is necessary but not sufficient.
### Verdict:is guessable: the wrapper names the qa phase, and the verdict vocabulary leaks from the issue. A model that never loaded the skill can emit it — which is precisely #862 Risk 1 ("silently laundering a low-fidelity review"). A fixture that passes on the grep alone cannot support #862 AC-4'sskill-not-loadederror. See Derived ACs.F4 — Cost accounting.
opencode statsis cumulative ($0.71 already banked from 9 prior sessions). AC-5 needs per-run figures: take a stats delta around each run, or readstep_finishpayloads. Do not count the banked $0.71 against the $5 cap.F5 — No
timeout/gtimeouton this machine. Bounding the paid run needs aperl -e 'alarm'/node wrapper. Redirect NDJSON to a file, never a pipe (background + pipe yields empty output).Acceptance Criteria
AC-0 (precondition): opencode present and provider key available
Verification: Manual (command output) — already satisfied:
opencode --version→1.18.27(meets floor);opencode auth list→ 0 stored credentials,OPENROUTER_API_KEYpresent in env.Scenario: Given the harness env → When
opencode --versionandopencode auth listrun → Then version ≥ 1.18.27 and a provider key is listed; otherwise stop and report, do not guess.Assumptions: The key remains valid at run time; model id +
$are recorded per I-8.AC-1: skill-load observed or refuted
Verification: Integration Test (recorded real output)
Scenario: Given a scratch worktree with
.opencode/command[s]/qa.mdinstructing aqaskill load → Whenopencode run --command qa <issue> --format json --auto --dir <scratch>runs → Thengrep -cE 'SEQUANT_QA_VERDICT|### Verdict' …/opencode-run-qa.ndjson≥ 1; if 0 after two wrapper phrasings, the doc's verdict line readsKILLand names what the model did instead.Assumptions: The QA target has a real diff to review; the model tier is recorded (see OQ-1); the grep is corroborated per AC-6.
AC-2: NDJSON event inventory
Verification: Integration Test
Scenario: Given the recorded fixture → When
jq -r '.type' … | sort -uruns → Then its output is pasted into the doc, includes at leasttextandstep_finish, and every listed type has a one-line payload description.Assumptions:
--format jsonemits one JSON object per line for the whole session (unproven — a non-NDJSON envelope is a live possibility to record, not assume).AC-3: the three field-run traps have a recorded mitigation
Verification: Manual (doc table) + Integration (repro commands)
Scenario: Given the doc → When read → Then a table has rows
32K step clamp,/tmp permission kill,process-group kill, each with the exact config or spawn option that mitigated it (OPENCODE_CONFIG_CONTENTpayload; allow rule or scratch relocation;detached+ group kill) and the command that reproduced it.Assumptions: Reproducing the clamp requires running without the global mitigation (F2). Traps came from a confidential third-party project — the doc and the #862 comment stay anonymized; record behavior, never the source project.
AC-4: go/no-go posted
Verification: Integration Test
Scenario: Given the spike concluded → When
gh issue view 862 --comments | grep -c 'Spike verdict: GO\|Spike verdict: KILL'runs → Then ≥ 1, and the comment lists which #862 P0 ACs change (e.g. a reasoning-budget field inrun.opencode).Assumptions: Posting to #862 is an outward-facing write on a live issue — intended by the AC, but it lands under the user's account.
AC-5: cost recorded
Verification: Manual (doc table)
Scenario: Given the doc → When the cost table is read → Then it has
$and wall time per run and a total under$5.Assumptions: Per-run cost comes from a stats delta or
step_finish, not rawopencode stats(F4).Implementation Plan
Phase 1 — Free ground truth (no spend)
opencode debug skilland confirmqaresolves to<scratch>/.claude/skills/qa/SKILL.md. Worktrees have a.gitfile, not a directory — feat: add opencode agent driver — first backend that can inherit the full skill methodology #862's "walks up to the git worktree root" claim is untested against exactly that shape. Record the result either way..opencode/commandand.opencode/commands. Probe with a nonexistent command name first (fails before any model call, $0), then confirm which directory the real name loads from.opencode debug config, then author an explicitOPENCODE_CONFIG_CONTENTpayload so no global state leaks into the fixture (F2).git diff origin/main...HEADis non-empty. Small diff = cheap run.Phase 2 — Guardrails before spending
--autoauto-approves everything not explicitly denied, and the qa skill's own template ends by posting a GitHub comment and editing labels. Denygh issue comment,gh issue edit,gh pr *,git push,git commitin the config payload — otherwise a paid run mutates a live issue. This also exercises the permission surface AC-3 needs.perl -e 'alarm'(F5), stats delta captured before/after each run with a hard stop before$5.Phase 3 — The paid runs (≤ $5 total)
qaskill; (iii) a low-salience canary phrase copied from deep insideqa/SKILL.mdand absent from the wrapper.GOorKILLnaming what the model did instead.src/lib/workflow/drivers/__fixtures__/opencode-run-qa.ndjson. Sibling precedent exists:src/lib/workflow/__fixtures__/.Phase 4 — Record and report
docs/investigations/opencode-driver-spike.md: verdict line, F1 discovery baseline, event inventory (AC-2), trap/mitigation table (AC-3), cost table (AC-5), model id and$(AC-0/I-8).Spike verdict: GO|KILLon feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 listing which P0 ACs change (AC-4), anonymized.Design Review
src/— this is an observation node. Its entire output is a doc plus a recorded fixture that feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 (node 12) consumes as its parser input (I-3: real recorded output, never a mock certifying a happy path).sequant runthrough opencode (an order of magnitude more spend for the same one bit).docs/investigations/*.md(5 existing) for the write-up;src/lib/**/__fixtures__/for recorded input. Both established.Feature Quality Planning
--autorun of the qa skill withghon PATH can post a real comment and edit labels on a live issue. Plan step 5 is not optional.Derived ACs
skill-not-loadederrorOPENCODE_CONFIG_CONTENTused and states whether~/.config/opencode/opencode.jsoncwas in effect for each runThese are proposals, not adopted scope — say the word and they go on the issue body.
Open Questions
openrouter/anthropic/claude-sonnet-*) for run A, then one cheap-model run to record degradation if budget allows. Impact if wrong: a cheap-model KILL is unattributable and the spike answers nothing while still spending.src/scope tension. may-touch grantssrc/lib/workflow/drivers/__fixtures__/*.ndjson; not-in-scope says "anysrc/change". — Recommendation: read not-in-scope as "no.ts"; land the fixture as granted (.ndjsonis outside tsconfig's compile surface;src/lib/workflow/__fixtures__/is precedent). Impact if wrong: the fixture moves to__tests__/fixtures/and feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 AC-1's path changes.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: No
testgen— all five ACs aremanual/command-output with no code stubs to generate. Notest— no UI. Quality loop off: aKILLverdict is a legitimate terminal outcome, not a defect to iterate on, and the $5 cap makes re-runs expensive;shouldEnableQualityLoopalso returnsfalse(the SCOPE_WARNING is only the missingNon-Goalsheading). PLAN tiers this node judgment — runexecon the strong-model flip, not thesonnet/mediumdefault in.sequant/settings.json. QA must execute everyVerify:command verbatim (I-9), including re-running the greps against the committed fixture.Label Review
Current:
graph-2026-09Recommended:
graph-2026-09,planned,no-browser-testReason:
plannedmarks phase-1 completion;no-browser-teststates explicitly that a spike producing a doc and an NDJSON fixture has no UI surface. Noenhancement— nothing ships to users from this node.Quality Loop: Won't auto-enable —
shouldEnableQualityLoopisfalsedespite SCOPE_WARNING, since the warning is a missing heading, not scope.→
gh issue edit 992 --add-label planned --add-label no-browser-testadmarble commentedon Sep 7, 2026
Runner context (exec re-dispatch, 2026-09-07): the previous exec session for this issue was killed by the harness at 30 minutes of wall time (a hard no-progress ceiling on the launcher; it is not a credit or rate-limit problem, whatever the state says). The worktree survived with whatever was committed or left in the tree. This session has the same 30-minute ceiling. Work so it survives being cut off:
git log --oneline origin/main..HEADandgit statusin the worktree and continue from the existing work — do not restart or re-derive.git commitas its own Bash call;wip:-style detail in the subject is fine as long as the type prefix is conventional). Uncommitted work is the only thing the cut-off loses.timeoutup to 600000). Do not start the full suite withrun_in_backgroundand then end your turn to wait — ending the turn ends the phase and the notification never arrives.Mutation-verified:record for any gate-test AC (PLAN §5 I-5).admarble commentedon Sep 7, 2026
Runner context — salvage the killed session's evidence before spending again. The previous exec session had already observed the skill loading (its own words: "Verdict: GO. Spent so far: $1.12 of $5") and was reproducing the AC-3 traps when the harness cut it off. Nothing was written to the worktree. Its full transcript is at:
/Users/tony/.claude/projects/-Users-tony-Projects-worktrees-feature-992-spike-opencode-does-opencode-run-command-phase-loa/7d5aac28-f20f-4a50-b1b0-651e1f312ea0.jsonlMine it first (
jq -r 'select(.type=="assistant") | .message.content[]? | select(.type=="text") | .text' <file>for narrative; tool_use inputs/results for the exact commands, NDJSON, andopencode statsdeltas). Recorded NDJSON from those runs, if it was saved to disk, is the AC-1/AC-2 fixture — copy it in and scrub secrets rather than re-running. Two scratch worktrees from that session still exist and are yours to reuse or remove before the PR:/Users/tony/Projects/oc-spike-scratch(branchspike/992-oc-scratch) and/Users/tony/Projects/worktrees/scratch-992-opencode-spike(branchspike992-qa-target). Writedocs/investigations/opencode-driver-spike.mdand the fixture early and commit them, then fill in the trap table. Total cap stays $5 including the $1.12 already spent.docs(#992): correct skill metadata path, retract unverified deny-rule…
docs(#992): record three trap-1 clamp controls, none reproduced; add …
docs(#992): correct cost-table wall-time total to 1,563 s (omitted tr…
admarble commentedon Sep 7, 2026
Runner verification — node 06 (PR #1005, final QA verdict AC_NOT_MET after 3 rounds — stopped for a human decision, not looped further)
Verify commands from
issues/06-NEW-opencode-skill-load-spike.md, run verbatim in the worktree at54df1980(diff = spike doc + recorded NDJSON fixture only; 0 files undersrc/outside__fixtures__):opencode --version→ 1.18.27; model id + $ in the docopenrouter/anthropic/claude-sonnet-5, per-run $)grep -cE 'SEQUANT_QA_VERDICT|### Verdict' …/opencode-run-qa.ndjsonjq -r '.type' … | sort -ustep_finish step_start text tool_use— all four described, incl.textandstep_finish32K step clamp,/tmp permission kill,process-group kill, each with mitigation + commandprocess-group killreproduced./tmp permission killwas refuted on 1.18.27 (reads succeed even under"*":"deny");32K step clampsurvived three controls. This is the sole open item — see below.Spike verdict: GO|KILLcomment on #862Why it stopped: AC-3 as worded demands, for each trap, "the command that reproduced it". The spike's evidence is that one of the three presupposed traps does not exist on the pinned opencode version and another could not be provoked in three controls. No further loop iteration can produce a reproduction of a refuted trap, and trying again would spend money against the $5 cap for nothing — the QA's own round-3 review reached the same conclusion and classified the finding
pause_for_human. Per the run brief (verdicts are claims; an AC that contradicts the evidence is surfaced, not grown) I did not amend the AC or loop again.Decision needed from the owner (recorded as PLAN §9 OQ-19): amend AC-3 to "reproduced or refuted, with the controlling command recorded" and accept PR #1005 as the node's deliverable, or hold it and specify what reproduction you want. Either way node 12 (#862 P0) now builds against a fixture and a mitigation table that say the
/tmpdeny rule is not load-bearing and the clamp budget is a precaution — that changes its AC-8 wording.Run history: exec attempt 1 reached GO at $1.12 but was killed at the launcher's 30-minute ceiling with nothing committed; attempt 2 likewise; attempt 3 salvaged the transcript, committed the fixture and doc, and three QA rounds fixed the metadata path, an unverified deny-rule claim, and the wall-time total. Nothing fixed beyond the agent's work. Merge decision is yours — I will not merge.
admarble commentedon Sep 7, 2026
Runner decision on OQ-19 (A+ pass, 2026-09-07): AC-3 in the body above is amended to accept "reproduced, or refuted with the controlling command and version" — the QA-recommended option — because the owner asked for every wave-1 PR to reach READY_FOR_MERGE, and the only open item on PR #1005 was that wording. The spike's evidence stands unchanged: process-group kill reproduced and mitigated;
/tmppermission kill refuted on 1.18.27 (reads succeed under"*":"deny"); 32K clamp not provoked in three controls. Node 12 (#862) AC-8 should read the deny rule as non-load-bearing and the clamp budget as a precaution. QA will be re-run against the amended AC.docs(#992): opencode skill-load spike — verdict GO, recorded NDJSON f…
docs(plan): 2026-09 backlog graph (16 nodes, /graph-run ready) (#998)