This document provides guidelines for AI agents operating in this repository.
oh-my-opencode-slim — An OpenCode plugin that adds specialist-agent orchestration. Built with TypeScript, Bun, and Biome. Not a standalone app; it registers agents, tools, hooks, and MCPs into the OpenCode runtime.
| Command | Description |
|---|---|
bun run build |
Build plugin + CLI bundles to dist/, emit declarations, regenerate config schema |
bun run typecheck |
tsc --noEmit — type check only |
bun test |
Run all tests (root is ./src via bunfig.toml) |
bun run check |
Biome check with auto-fix (lint + format + organize imports) |
bun run check:ci |
Biome check without auto-fix (CI gate) |
bun run dev |
Build then launch OpenCode |
bun run generate-schema |
Regenerate oh-my-opencode-slim.schema.json from Zod schema |
Single test: bun test -t "test-name-pattern"
Single file: bun test src/config/loader.test.ts
The build is a 4-step pipeline (bun run build):
build:plugin — Bun-bundle src/index.ts → dist/index.js (ESM, Node target)build:cli — Bun-bundle src/cli/index.ts → dist/cli/index.jstsc --emitDeclarationOnly — Generate .d.ts files into dist/generate-schema — Produce JSON Schema from the Zod config schemaAdding a new dependency? Check build:plugin/build:cli in package.json — packages listed in --external are not bundled. New packages that should remain external (native modules, host-provided SDKs) must be added there.
prepare script runs build automatically on install.
CI (.github/workflows/ci.yml) runs: lint → typecheck → test → build on every push/PR to main/master. A second job (package-smoke) builds and runs verify:release + verify:host-smoke on both Ubuntu and macOS.
README.md plus relevant files in docs/bun run check:ci — lint + format gatebun run typecheck — type gatebun test — test gatebiome.json) — single quotes, 2-space indent, 80-char line width, trailing commas, LF endingsstrict: true, moduleResolution: "bundler", declarations emitted to dist/any: Linter warning in source, allowed in test files (Biome override)zod v4: Used for runtime validation and config schema. It is a peerDependency (^4.0.0), not a regular dep.src/
├── agents/ # Agent factories (orchestrator, explorer, oracle, designer, fixer, librarian, council, councillor, observer)
├── cli/ # CLI entry point — install, config, presets, skill packaging
├── config/ # Zod config schema, loaders, constants, agent/MCP policy helpers
├── council/ # Council manager (multi-LLM session orchestration and synthesis)
├── hooks/ # OpenCode lifecycle hooks (apply-patch, auto-update, error recovery, todo-continuation, etc.)
├── interview/ # /interview feature — browser-based Q&A flow for spec generation
├── mcp/ # Built-in MCP server definitions (websearch, context7, grep_app)
├── multiplexer/ # Tmux/Zellij pane integration for live session visualization
├── skills/ # Skill payloads shipped at install time (codemap, simplify)
├── tools/ # Tool definitions (ast-grep search/replace, smartfetch, council tool, preset manager)
└── utils/ # Shared utilities (logger, tmux, session helpers, subagent depth tracking)
Key entry points:
src/index.ts — Plugin bootstrap and composition root (840+ lines). Wires every subsystem together.src/cli/index.ts — CLI entry pointsrc/config/schema.ts — Source-of-truth runtime config schemaWhen working with tmux integration, orphaned processes and ghost panes are the primary failure mode.
session.create() → tmux pane spawned → task runs
→ session goes idle → extract results → session.abort()
→ session.deleted event → tmux pane closed
src/multiplexer/tmux/): Always send C-c before kill-pane, with a short delaysrc/council/council-manager.ts): Call session.abort() AFTER extracting task results — content is destroyed on abortsrc/index.ts): multiplexerSessionManager.onSessionDeleted() must stay connected to close panesbun run build
# Configure plugin as file:// in opencode.jsonc
# Launch tasks, then verify no orphans:
ps aux | grep "opencode attach" | grep -v grep
Use /review before pushing — it catches issues (duplicate code, redundant calls, race conditions) that linter and tests miss. It delegates to a specialized subagent with full file access.
codemap.md in the project root contains a full architectural map. Read it before working on unfamiliar subsystems. Each src/ subdirectory also has its own codemap.md.
src/agents/<name>.ts — each agent has its own file, prompt overrides come from .md files resolved by the config loaderconfig.agents.<name> with prompt and orchestratorPrompt fieldssrc/hooks/index.ts and attached during plugin initinterview/ feature runs a local HTTP server for browser-based spec capturesrc/multiplexer/apply-patch hook is a complex pipeline with matching, resolution, and recovery stages — changes there need careful testingbunfig.toml sets test root to ./src — tests must live under src/