This document provides guidelines for AI agents operating in this repository.
oh-my-opencode-slim - A lightweight agent orchestration plugin for OpenCode, a slimmed-down fork of oh-my-opencode. Built with TypeScript, Bun, and Biome.
| Command | Description |
|---|---|
bun run build |
Build TypeScript to dist/ (both index.ts and cli/index.ts) |
bun run typecheck |
Run TypeScript type checking without emitting |
bun test |
Run all tests with Bun |
bun run lint |
Run Biome linter on entire codebase |
bun run format |
Format entire codebase with Biome |
bun run check |
Run Biome check with auto-fix (lint + format + organize imports) |
bun run check:ci |
Run Biome check without auto-fix (CI mode) |
bun run dev |
Build and run with OpenCode |
Running a single test: Use Bun's test filtering with the -t flag:
bun test -t "test-name-pattern"
biome.json)tsconfig.jsonany: Generates a linter warning (disabled for test files)bundler strategy.d.ts files in dist/organizeImports: "on")bun run check:ci before pushingoh-my-opencode-slim/
├── src/
│ ├── agents/ # Agent factories (orchestrator, explorer, oracle, etc.)
│ ├── cli/ # CLI entry point
│ ├── config/ # Constants, schemas, MCP defaults
│ ├── hooks/ # OpenCode lifecycle hooks
│ ├── mcp/ # MCP server definitions
│ ├── multiplexer/ # Tmux/Zellij pane integration for child sessions
│ ├── skills/ # Skill definitions (included in package publish)
│ ├── tools/ # Tool definitions (webfetch, AST-grep, etc.)
│ └── utils/ # Shared utilities (session, task, logger, env, etc.)
├── dist/ # Built JavaScript and declarations
├── docs/ # User-facing documentation
├── biome.json # Biome configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project manifest and scripts
@modelcontextprotocol/sdk - MCP protocol implementation@opencode-ai/sdk - OpenCode AI SDKzod - Runtime validationREADME.md plus relevant files in docs/bun run check:ci to verify linting and formattingbun run typecheck to verify typesbun test to verify tests passFor plugin or Companion releases, follow docs/release.md. It documents the
required diff inspection, companion asset workflow, GitHub release creation,
tagging, verification, and npm publish order.
Provider prompt caches are exact byte-prefix matches over the rendered request (tools → system → messages). Any byte that changes earlier in the payload invalidates the cache for everything after it, so every request in the session re-pays full input cost and latency. Past regressions in this repo all came from hooks rewriting or repositioning earlier conversation content.
Rules when touching anything that feeds the outgoing payload (hooks, agent prompts, config constants):
src/hooks/cache-safe-injection.ts:
deterministic content via appendTaggedSyntheticPart (tail of an existing
message), per-turn volatile content via stripTaggedContent +
appendTrailingVolatileMessage (trailing message, end of payload).Enforcement (all run in bun test / CI):
src/hooks/cache-safety.property.test.ts — prefix-stability and
determinism properties over the real transform pipeline, with a drift
guard pinned to the composition in src/index.ts. New transform steps
must be added to src/hooks/cache-safety-harness.test.ts.src/hooks/cache-payload.snapshot.test.ts — golden snapshots of injected
prompt surfaces; failing means the change busts caches once fleet-wide and
must be updated deliberately via bun test --update-snapshots.src/cache-safety-tripwire.test.ts — bans volatile-input patterns in
prompt-assembly directories outside a justified allowlist.src/hooks/cache-monitor/ — runtime watchdog that logs a warning when a
session that was hitting the provider cache reports zero cached tokens.See docs/cache-verification.md for the full verification story.
Before pushing changes to the repository, when makes sense run a code review to catch issues like:
src/hooks/cache-safe-injection.tsA full codemap is available at codemap.md in the project root.
Before working on any task, read codemap.md to understand:
For deep work on a specific folder, also read that folder's codemap.md.
Log files are written to: macOS/Linux: ~/.local/share/opencode/log/ Windows: Press WIN+R and paste %USERPROFILE%.local\share\opencode\log Log files are named with timestamps (e.g., 2025-01-09T123456.log) and the most recent 10 log files are kept. You can set the log level with the --log-level command-line option to get more detailed debug information. For example, opencode --log-level DEBUG.
~/.local/share/opencode/log/oh-my-opencode-slim..log
Read-only dependency source repositories are available under
.slim/clonedeps/repos/ for inspection. Do not edit these clones.
.slim/clonedeps/repos/opencode-ai__opencode/ - https://github.com/opencode-ai/opencode.git at main@73ee493265acf15fcd8caab2bc8cd3bd375b63cb; inspect packages/plugin and packages/sdk/js for OpenCode plugin and SDK internals..slim/clonedeps/repos/opencode/ - https://github.com/anomalyco/opencode.git at dev@356f6841865d68adf6d0123c37357ad50814497a; inspect packages/opencode for latest TypeScript runtime internals and experimental background subagent support..slim/clonedeps/repos/modelcontextprotocol__typescript-sdk/ - https://github.com/modelcontextprotocol/typescript-sdk.git at v1.29.0@e12cbd7078db388152f6e839abdbe09ba01f3f32; inspect it for MCP protocol and server integration internals..slim/clonedeps/repos/agentclientprotocol__agent-client-protocol/ - https://github.com/agentclientprotocol/agent-client-protocol.git at main@8110fde4e8283b4bef1329d1ef7b074fd14cee1e; inspect it for ACP protocol specification and schema details.Issues and PRs are tracked on GitHub (alvinunreal/oh-my-opencode-slim); external PRs are a triage surface. See docs/agents/issue-tracker.md.
Canonical triage roles map to repo labels via docs/agents/triage-labels.md
(e.g. ready-for-agent → good-to-code; needs-triage = unlabeled). Install
the triage skill (command in docs/maintainers.md). Community preset
submissions use the community-preset label (see docs/maintainers.md).
Single-context repo: CONTEXT.md and docs/adr/ at the root, plus codemap.md. See docs/agents/domain.md.