MCP tools don't populate output.output in the tool.execute.after hook — the MCP content flows through OpenCode's internal parts pipeline instead. This caused a crash: undefined is not an object (evaluating 'text.length') in the truncate function.
2.4 KiB
Verification Exercise: build agent smoke test
Setup: Open OpenCode → the default agent is now orchestrator. To test the
build agent directly, either Tab-cycle to it or use
opencode run --agent build "your prompt".
Level 1 — Read-only (verifies tool-call JSON is valid)
Prompt: "Read .agents/hooks/post-tool-use.sh. Report: (1) what file path the counter uses, (2) what line the SELF-CHECK fires on, and (3) the exact modulo condition."
Pass criteria:
- No tool call parse error in the OpenCode UI
- It reads the file in ≤50-line chunks (pagination rule working)
- Reports
/tmp/.opencode-tool-count-<hash>, line ~23,COUNT % 15 == 0 - Session counter file exists:
ls /tmp/.opencode-tool-count-* 2>/dev/null
Level 2 — Small bounded write (verifies end-to-end tool call + edit)
Prompt: "In .agents/hooks/post-tool-use.sh, the REPO_ID derivation line uses md5sum. Add a single-line comment directly above it (# repo-scoped to avoid cross-repo counter contamination) and nothing else."
Pass criteria:
- Makes exactly 2–3 tool calls (read → edit → optionally verify)
- Doesn't read more than 50 lines at once
- The comment appears on the correct line in the file
- No hallucinated paths
Level 3 — Scope escalation (verifies rule 5 in build.md)
Prompt: "Refactor all five hook files to share a common REPO_ROOT derivation function."
Pass criteria:
- It refuses and tells you this exceeds 2–3 files / needs the orchestrator or default agent
- It does NOT start reading all five files and attempting the refactor
If Level 1 and 2 pass cleanly and Level 3 correctly escalates, the build agent is working. If Level 1 shows parse errors, restart OpenCode to reload the renamed agent config.
Level 4 — Orchestrator planning gate (cloud only)
Setup: Switch to the orchestrator agent (or use /orchestrator in
Copilot). Run a vague multi-step request.
Prompt: "Clean up the hook files — reduce repetition and make sure the conventions match what's in .agents/AGENTS.md."
Pass criteria:
- Produces a numbered plan with clear subtasks and acceptance criteria
- Asks "Proceed?" before starting any implementation
- Does NOT immediately start reading or editing files
- After confirming, executes subtasks sequentially with inline tool calls
(cloud) or dispatches to
buildviatask(OpenCode/local)