Guidance for agents working in this repository.
An OpenCode V2 plugin (workflows.ts) that runs deterministic multi-agent
workflows. It registers a workflow command and ships the deep-research
workflow. No build step, no dependencies, MIT.
bun test
cp workflows.ts ~/.config/opencode/plugins/workflows.ts
touch ~/.config/opencode/plugins/workflows.tsCheck the server log when something is off:
grep workflows ~/.local/share/opencode/log/opencode.log | tail- Do not import
@opencode/plugin. Export a plain{ id, setup }object. - Keep the plugin dependency-free. Use Bun globals for file access.
- Plugin
consoleoutput is not visible to users. A command surfaces messages only by throwing. - Never post a synthetic message for a notice; it starts a model turn.
- Child sessions:
ctx.session.create({ title }),ctx.session.switchAgent,ctx.session.prompt({ sessionID, text }),ctx.session.wait({ sessionID }), andctx.session.context({ sessionID })to read the reply. - Artifacts live under the data dir, keyed by run id.
WORKFLOW_ROOToverrides the parent and tests rely on it. WORKFLOW_RETRIESandWORKFLOW_CONCURRENCYbound a run.
listWorkflows,findWorkflow- the registry, exported for tests.runPhase,runWorkflow- the runner, exported for tests.replyText- reads the last assistant text from a child session.setupon the plugin object - registers theworkflowcommand.- A run writes
00-task.txtplus one artifact per phase, so a resume can skip completed phases and recover a missing task. workflows.test.ts- tests with a fake session API.
- Semantic commit messages. Changes through a feature branch and a PR.
- Keep
NOTICEaccurate.