Skip to content

feat(opencode): transcript ingest via the opencode-events parser#156

Merged
slowdini merged 2 commits into
devfrom
opencode-transcript-ingest
Jul 18, 2026
Merged

feat(opencode): transcript ingest via the opencode-events parser#156
slowdini merged 2 commits into
devfrom
opencode-transcript-ingest

Conversation

@slowdini

Copy link
Copy Markdown
Owner

What this does

Two scoped commits advancing OpenCode from staging-only toward full enhancement parity (model in #113):

  1. fix(opencode)closes Opencode skill name #65. OpenCode's skill tool lists frontmatter names, and staging rewrites the staged skill's name: to the sanitized slug — so the <available_skills> block in dispatch prompts now advertises the slug (as Codex already does) instead of the natural name that no longer resolves.
  2. feat(opencode) — transcript ingest. Wires the opencode-events parser capability: opencode run --format json envelopes are self-contained, but tool args nest at part.state.input and timestamps are epoch-ms numbers — beyond the extract tier's five primitives, exactly the case the docs reserve for a code capability. The parser normalizes tool_use parts (name at part.tool, args = state.input, result = state.output/state.error), sums step_finish.part.tokens (cache reads excluded, matching codex accounting), recovers the final message from the last text part, and measures duration from envelope timestamps.

With this, OpenCode flips Transcript ingest to ✅ in the README support table. Remaining columns are filed: dispatch recipes + model flag (#153), shadow preflight (#154), write guard (#155) — each scoped with verified CLI/source evidence.

Details

  • harnesses/opencode.toml declares [transcript] + the verified [tools] vocabulary (bash is the shell tool id; edit/write take filePath; apply_patch takes patchText — ids and arg shapes checked against packages/opencode/src/tool/ in the opencode repo).
  • The __skill_invoked meta-check generalizes from hardcoded Skill/skill to descriptor-declared skill_tool/skill_arg (defaults keep claude-code.toml untouched; OpenCode declares skill/name — its native skill tool is a deterministic invocation event, so surfaces_skill_invocation = true and the meta-check grades from the transcript instead of the LLM-judge fallback).
  • Shared write-boundary policy reads OpenCode's camelCase spellings (filePath in path_arg, patchText in apply_patch_paths) — additive, no effect on claude/codex classification.
  • The transcript-less preflight-warning unit tests move to the byoh integration tests (all built-ins are now transcript-wired); opencode next-steps/runbook goldens re-blessed for the ingest-wired handoff text.

Schema change: harness-descriptor.schema.json gains opencode-events in the parser enum and optional skill_tool/skill_arg strings on [transcript]. No CLI change.

Before / after (generated next-steps)

- Next: ... dispatch each task with `opencode run`. OpenCode transcript ingest is not yet wired, so
  assemble each task's run.json/timing.json manually ...
+ Next: ... dispatch each task with `opencode run --format json`, saving stdout as the task's
  outputs/opencode-events.jsonl ... Then run `ingest ... --harness opencode`.

Verification

  • cargo test — 657 passed, 0 failed (478 lib / 99 cli / 80 run), including a new end-to-end test: staged run → simulated opencode-events.jsonlingest yields parsed invocations, 125-token / 5s backfill, transcript final-message fallback, and a code-graded __skill_invoked (passed: true, grader: transcript_check).
  • cargo clippy --all-targets -- -D warnings — clean. cargo fmt --check — clean.
  • Both commits individually green (commit 1 verified at its own tree state).
  • Docs updated: README support table + intro, docs/opencode-notes.md (code map / what's wired / next enhancements), docs/byoh.md, docs/progressive-enhancements.md, harnesses/template.toml, harness-descriptor PR template.

Event shapes verified against the opencode SDK types (ToolPart/StepFinishPart) and run.ts in anomalyco/opencode v1.18.3, per the don't-guess guardrail; a live opencode run capture is part of #153's acceptance (dispatch recipes) and will re-confirm the fixtures then.

Max Haarhaus added 2 commits July 18, 2026 13:28
OpenCode's skill tool lists frontmatter names, and staging rewrites the
staged skill-under-test's frontmatter name: to the sanitized slug — so the
<available_skills> block in dispatch prompts should advertise the slug (as
Codex already does), not the natural name that no longer resolves.

Closes #65
Wire the third transcript-ingest capability: opencode run --format json
emits self-contained envelopes, but tool args nest at part.state.input and
timestamps are epoch-ms numbers — beyond the extract tier's primitives, so
a named parser normalizes tool_use parts (name, state.input args,
output/error result), sums step_finish tokens (cache excluded, matching
codex), recovers the final message from the last text part, and measures
duration from the envelope timestamps.

- opencode.toml declares [transcript] + the verified [tools] vocabulary
  (bash/edit/write/apply_patch/read/glob/grep); schema, template.toml,
  byoh.md, and the PR template list the new capability.
- The __skill_invoked meta-check generalizes to descriptor-declared
  skill_tool/skill_arg (defaults Skill/skill keep claude unchanged;
  opencode declares skill/name — the native skill tool is a deterministic
  invocation event, so surfaces_skill_invocation = true).
- The shared write-boundary policy reads OpenCode's camelCase spellings
  (filePath in path_arg, patchText in apply_patch_paths).
- Transcript-less preflight-warning coverage moves to the byoh integration
  tests (every built-in is now transcript-wired); next-steps/runbook
  goldens re-blessed for the ingest-wired handoff.
- End-to-end: a staged run ingesting simulated opencode-events.jsonl
  yields parsed invocations, token/duration backfill, the transcript
  final-message fallback, and a code-graded skill-invocation meta-check.

Remaining enhancement columns are tracked: dispatch recipes + model flag
(#153), shadow preflight (#154), write guard (#155).
@slowdini
slowdini merged commit 6538220 into dev Jul 18, 2026
6 checks passed
@slowdini
slowdini deleted the opencode-transcript-ingest branch July 18, 2026 18:22
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.

Opencode skill name

1 participant