opencode-tool-output
Skill0 starsChanged 41 days agoMITView on GitHub
Read opencode debug output reliably by parsing JSON instead of regexing pretty-printed stdout. Use when running `opencode debug skill`, `opencode debug config`, or `opencode debug agent`; when checking which source a skill, agent, or command was actually loaded from; when output is very large, or paths and quotes are backslash-escaped; or when confirming a plugin registered its skills. Ships `scripts/inspect-skill.mjs` for name and location lookup, and handles the Windows `opencode.cmd` and GUI-binary spawn traps.
In this repository19 other files it gives its agents.
- api-doc-recallSkill
- assistant-runtime-architectureSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- git-safetySkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- powershell-windowsSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- subagent-delegationSkill
- task-closureSkill
- test-first-fixSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Never round-trip this output through Out-File / Set-Content on a cp866 console.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
opencode tool output
opencode debug * emits machine-readable JSON that is easy to consume wrongly.
This skill is about parsing it as data and not as text.
When to use this
- You are about to run
opencode debug skill,debug config,debug agent, ordebug paths. - You need to know which file a skill, agent, or command was actually loaded from.
- You are writing a script that consumes opencode's output.
- Output is large, or contains backslash-escaped paths and quotes.
Rules
- Parse the JSON. Never regex the pretty-printed output. A single skill
expands to tens of lines with escaped
\nand\\insidecontent; any line-based approach silently truncates or mis-joins it. - Do not dump raw output into the conversation. A full
debug skillrun is several hundred KB. Filter to the fields you need first. - Trust
location, not the order of the output.debug skillkeeps one entry per name and drops any later file claiming a name already taken, so a shadowed skill is invisible. The survivinglocationis the only authority. - On Windows, do not spawn
opencodeblindly. See the trap below. - Do not assume
descriptionis short. Some run past 700 characters, so a narrow window truncates mid-sentence and looks like the real text.
Windows: the two traps
Both produce exit code 0 with two bytes of output instead of JSON, which looks like a hang or a silent success rather than a failure.
Trap 1 — the PATH shim. opencode.cmd is a shim; when node spawns it via
cmd.exe it returns nothing useful, and node cannot exec a .cmd directly at
all (spawnSync ... EINVAL). Spawn the packaged executable instead.
Trap 2 — the GUI binary comes first. where.exe opencode lists the desktop
build, e.g. ...\Programs\@opencode-aidesktop\OpenCode.exe, before the CLI
entry. That is a windowed app that writes nothing to stdout, so taking the
first match silently yields 2 bytes. Pick the match that has
node_modules/opencode-ai/bin/opencode.exe beside it.
Both traps are handled by scripts/inspect-skill.mjs; override it with
--cmd <path> or the OPENCODE_BIN environment variable.
Using the script
node scripts/inspect-skill.mjs # every skill: name + location
node scripts/inspect-skill.mjs code-discipline # one skill, and which file won
node scripts/inspect-skill.mjs --source .agents # only skills from one root
node scripts/inspect-skill.mjs code-discipline --content
node scripts/inspect-skill.mjs --json # for further machine readingExit codes: 0 found, 1 no match, 2 could not read opencode.
PowerShell notes
opencode debug skill 2>&1 | Out-Stringmerges both streams and is the reliable way to see the JSON. A bare>redirect truncates or mangles it.- Never round-trip this output through
Out-File/Set-Contenton a cp866 console; it corrupts non-ASCII paths. Keep it in memory or hand it to a script that reads UTF-8.
Checklist
- The command was parsed as JSON, not matched with a regex.
- Only the fields needed were brought into the conversation.
- The
locationof each result was read to confirm the intended file won. - On Windows, the resolved command was the CLI, not the GUI build or shim.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

