# skeletorflet/opencode-kit architecture

> Architecture diagram of the GitHub repository skeletorflet/opencode-kit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skeletorflet/opencode-kit
- Repository: https://github.com/skeletorflet/opencode-kit

## Overview

1. **What this repository is**
   - This is not an application runtime; it is a **configuration and orchestration kit for OpenCode**.
   - Its purpose is to shape how the OpenCode TUI behaves: which agents it can invoke, what skills they load, what commands/workflows are available, and how validation/tooling is enforced.

2. **Top-level control plane**
   - The main entry points are `opencode.json`, `AGENTS.md`, `.env.example`, and the `.opencode/` directory.
   - `opencode.json` is the central OpenCode configuration surface, including MCP server setup and related runtime integration.
   - `AGENTS.md` provides global routing rules that influence how requests are classified and delegated.

3. **Agent orchestration layer**
   - `.opencode/agents/` contains 34 specialist agents, each focused on a domain such as backend, frontend, security, review, planning, or language-specific development.
   - The architecture is intentionally **role-based**: a request is first routed to the right agent(s), then those agents operate within their own permissions and scope.
   - The repository also includes a separate **oh-my-opencode** orchestration model (`.opencode/oh-my-opencode.jsonc`) with personas like orchestrator, planner, executor, and architecture advisor.

4. **Knowledge and policy layer**
   - `.opencode/skills/` is the reusable instruction library: 71 domain skills loaded on demand by agents.
   - `.opencode/rules/RULES.md` is the highest-priority behavior layer and governs automatic agent selection, precedence, and execution norms.
   - The architecture uses a clear precedence chain: **global rules → agent instructions → skill instructions**.

5. **Command and workflow layer**
   - `.opencode/commands/` defines 9 slash commands for common high-level actions such as planning, testing, auditing security, reviewing PRs, and fixing types.
   - `.opencode/workflows/` defines multi-step operating sequences like project kickoff, TDD loops, pre-flight audits, and the omo main flow.
   - These are the user-facing orchestration primitives that connect intent to agent execution.

6. **Plugin and tool execution boundary**
   - `.opencode/plugins/` contains TypeScript plugins that run on Bun and modify runtime behavior:
     - environment variable injection into shell executions,
     - protection against direct `.env` reads,
     - idle notifications.
   - `.opencode/tools/` contains callable TypeScript tools used by agents, such as safe environment introspection and script execution.
   - This creates a boundary between **agent reasoning** and **controlled host interactions**.

7. **Validation and quality gate subsystem**
   - `.opencode/scripts/` contains Python validation utilities: linting, test orchestration, security scanning, UX auditing, preview management, and full verification.
   - These scripts act as an enforcement layer for quality and readiness, separate from the agent prompts themselves.
   - The repo’s architecture makes verification an explicit subsystem rather than an ad hoc developer activity.

8. **MCP and external service integration**
   - The configured MCPs in `opencode.json` connect the kit to external capabilities such as documentation lookup, UI components, deployment management, and sandbox environments.
   - From the repository’s perspective, these are **context and execution extensions**: they augment the agent environment without being part of the kit’s own codebase.
   - `DAYTONA_API_KEY` and similar environment variables show that some capabilities are service-backed and require runtime credentials.

9. **Documentation and reference layer**
   - `DOC/` contains a large mirrored documentation set for OpenCode and related ecosystem topics.
   - This appears to serve as a local, structured knowledge base for usage, configuration, and platform references.
   - The architecture therefore includes a **documentation corpus** alongside executable config, which supports agent research and user guidance.

10. **Environment and secret-handling boundary**
   - `.env.example` defines the expected secret and integration variables, while the actual `.env` is intentionally excluded.
   - The `env-protection` plugin prevents agents from directly reading secrets, while `read-env` only exposes variable names, not values.
   - This is a deliberate security boundary: configuration is injectable, but secrets are not freely inspectable by agents.

11. **CI and repo maintenance**
   - `.github/workflows/` contains CI pipelines across multiple ecosystems: .NET, Go, Java, Kotlin, Node.js, PHP, Python, Ruby, Rust, and Swift.
   - Even though the repo itself is primarily config, the workflow matrix suggests it is validated against multiple language/tooling contexts that the OpenCode kit targets.
   - This reinforces the repo’s role as a cross-stack orchestration and standards package rather than a single-language application.

12. **How a request flows through the system**
   - A user request enters OpenCode, is classified by the global rules, and routed to the appropriate agent.
   - That agent may load one or more skills, invoke a slash command or workflow, call a tool, and use MCP-backed context if needed.
   - Plugins intervene around the edges to shape environment access and runtime behavior, while validation scripts and CI provide the quality gates.

13. **Architectural summary**
   - The repository is best diagrammed as a **layered agent-operating system for OpenCode**:
     - policy/routing at the top,
     - agents and skills in the middle,
     - commands/workflows as orchestration entry points,
     - plugins/tools as controlled execution hooks,
     - scripts/CI as verification,
     - docs/MCPs as external knowledge and capability extensions.
   - The core design principle is **separation of reasoning, orchestration, execution, and validation**.

Main entry points: [`.opencode/agents`](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/agents) (Specialist agents), [`.opencode/scripts`](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/scripts) (Validation scripts), [`.opencode/workflows`](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/workflows) (Workflows), [`opencode.json`](https://github.com/skeletorflet/opencode-kit/blob/master/opencode.json) (opencode.json)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_control["Control plane"]
  node_node_opencode_json["opencode.json<br/>config root<br/>[opencode.json]"]
  node_node_agents_md["AGENTS.md<br/>routing policy<br/>[AGENTS.md]"]
  node_node_env_example[".env.example<br/>env contract<br/>[.env.example]"]
end

subgraph group_group_orchestration["Orchestration"]
  node_node_rules["RULES.md<br/>precedence rules<br/>[RULES.md]"]
  node_node_agents["Specialist agents<br/>agent catalog<br/>[agents]"]
  node_node_omo["omo model<br/>persona flow"]
  node_node_skills["Skills library<br/>skill catalog<br/>[skills]"]
  node_node_commands["Slash commands<br/>command set<br/>[commands]"]
  node_node_workflows["Workflows<br/>sequence set<br/>[workflows]"]
  node_node_prompts["Prompts<br/>prompt assets<br/>[prompts]"]
end

subgraph group_group_runtime["Runtime boundary"]
  node_node_plugins["Plugins<br/>runtime hooks<br/>[plugins]"]
  node_node_tools["Tools<br/>[tools]"]
end

subgraph group_group_validation["Validation"]
  node_node_scripts["Validation scripts<br/>qa utilities<br/>[scripts]"]
  node_node_ci["CI workflows<br/>multi-stack ci<br/>[workflows]"]
end

subgraph group_group_knowledge["Knowledge base"]
  node_node_docs["DOC corpus<br/>documentation base"]
end

node_node_agents_md -->|"sets precedence"| node_node_rules
node_node_rules -->|"routes to"| node_node_agents
node_node_agents -->|"loads skills"| node_node_skills
node_node_agents -->|"invokes"| node_node_commands
node_node_agents -->|"executes"| node_node_workflows
node_node_workflows -->|"uses prompts"| node_node_prompts
node_node_opencode_json -->|"enables"| node_node_plugins
node_node_opencode_json -->|"exposes"| node_node_tools
node_node_plugins -->|"guards"| node_node_tools
node_node_plugins -->|"protects"| node_node_env_example
node_node_env_example -->|"feeds env"| node_node_tools
node_node_scripts -->|"validates"| node_node_skills
node_node_scripts -->|"supports"| node_node_commands
node_node_scripts -->|"supports"| node_node_workflows
node_node_ci -->|"mirrors checks"| node_node_scripts
node_node_docs -->|"informs"| node_node_agents
node_node_docs -->|"references"| node_node_skills
node_node_omo -->|"alternative routing"| node_node_agents
node_node_omo -->|"drives"| node_node_workflows
node_node_opencode_json -->|"integrates context"| node_node_docs
node_node_agents_md -->|"guides usage"| node_node_commands

click node_node_opencode_json "https://github.com/skeletorflet/opencode-kit/blob/master/opencode.json"
click node_node_agents_md "https://github.com/skeletorflet/opencode-kit/blob/master/AGENTS.md"
click node_node_env_example "https://github.com/skeletorflet/opencode-kit/blob/master/.env.example"
click node_node_rules "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/rules/RULES.md"
click node_node_agents "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/agents"
click node_node_omo "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/oh-my-opencode.jsonc"
click node_node_skills "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/skills"
click node_node_commands "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/commands"
click node_node_workflows "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/workflows"
click node_node_prompts "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/prompts"
click node_node_plugins "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/plugins"
click node_node_tools "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/tools"
click node_node_scripts "https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/scripts"
click node_node_ci "https://github.com/skeletorflet/opencode-kit/blob/master/.github/workflows"
click node_node_docs "https://github.com/skeletorflet/opencode-kit/tree/master/DOC"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_opencode_json,node_node_agents_md,node_node_env_example toneBlue
class node_node_rules,node_node_agents,node_node_omo,node_node_skills,node_node_commands,node_node_workflows,node_node_prompts toneAmber
class node_node_plugins,node_node_tools toneMint
class node_node_scripts,node_node_ci toneRose
class node_node_docs toneIndigo
```

## Components

### Control plane

Repository entrypoints and global routing for OpenCode behavior.

- [opencode.json](https://github.com/skeletorflet/opencode-kit/blob/master/opencode.json): config root · Central OpenCode configuration surface, including MCP integration and runtime wiring. · `opencode.json`
- [AGENTS.md](https://github.com/skeletorflet/opencode-kit/blob/master/AGENTS.md): routing policy · Global agent routing and delegation rules for request classification. · `AGENTS.md`
- [.env.example](https://github.com/skeletorflet/opencode-kit/blob/master/.env.example): env contract · Declared integration and secret variables expected by the kit. · `.env.example`

### Orchestration

Agents, skills, commands, and workflows that drive task execution.

- [RULES.md](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/rules/RULES.md): precedence rules · Highest-priority behavior layer governing selection, precedence, and execution norms. · `.opencode/rules/RULES.md`
- [Specialist agents](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/agents): agent catalog · Role-based specialist agents for backend, frontend, security, review, planning, and languages. · `.opencode/agents`
- [omo model](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/oh-my-opencode.jsonc): persona flow · Alternative orchestration model with orchestrator, planner, executor, and architecture advisor personas. · `.opencode/oh-my-opencode.jsonc`
- [Skills library](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/skills): skill catalog · Reusable instruction library loaded on demand by agents. · `.opencode/skills`
- [Slash commands](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/commands): command set · User-facing entrypoints for planning, testing, security audit, review, and type fixing. · `.opencode/commands`
- [Workflows](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/workflows): sequence set · Multi-step operating flows such as kickoff, TDD, pre-flight audit, and omo main flow. · `.opencode/workflows`
- [Prompts](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/prompts): prompt assets · Shared prompt text used by commands and workflows. · `.opencode/prompts`

### Runtime boundary

Plugins and tools that control host interaction and environment access.

- [Plugins](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/plugins): runtime hooks · Bun plugins that shape environment injection, secret protection, and notifications. · `.opencode/plugins`
- [Tools](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/tools): host tools · Callable utilities for safe environment introspection and script execution. · `.opencode/tools`

### Validation

Scripts and workflows that enforce quality, verification, and safety.

- [Validation scripts](https://github.com/skeletorflet/opencode-kit/blob/master/.opencode/scripts): qa utilities · Python utilities for linting, test orchestration, scanning, auditing, and verification. · `.opencode/scripts`
- [CI workflows](https://github.com/skeletorflet/opencode-kit/blob/master/.github/workflows): multi-stack ci · GitHub Actions matrix covering .NET, Go, Java, Kotlin, Node.js, PHP, Python, Ruby, Rust, and Swift. · `.github/workflows`

### Knowledge base

Documentation and prompt assets used for reference and guidance.

- [DOC corpus](https://github.com/skeletorflet/opencode-kit/tree/master/DOC): documentation base · Mirrored OpenCode documentation and reference materials for local guidance. · `DOC`

## Connections

- AGENTS.md → RULES.md: sets precedence · Global routing feeds into the higher-priority rules layer.
- RULES.md → Specialist agents: routes to · Rules direct requests to specialist agents.
- Specialist agents → Skills library: loads skills · Agents pull reusable skills as needed.
- Specialist agents → Slash commands: invokes · Agents use slash commands for common operations.
- Specialist agents → Workflows: executes · Agents coordinate through multi-step workflows.
- Workflows → Prompts: uses prompts · Workflows rely on shared prompt assets.
- opencode.json → Plugins: enables · Central config wires runtime plugins.
- opencode.json → Tools: exposes · Central config makes tools available to the agent environment.
- Plugins → Tools: guards · Plugins shape or restrict tool execution and host access.
- Plugins → .env.example: protects · Environment-handling plugins enforce secret boundaries declared by the env contract.
- .env.example → Tools: feeds env · Tools rely on injectable environment variables for runtime integration.
- Validation scripts → Skills library: validates · Skill-specific validators enforce quality within the instruction library.
- Validation scripts → Slash commands: supports · Validation scripts back high-level commands like test and audit.
- Validation scripts → Workflows: supports · Scripts are used inside orchestration workflows.
- CI workflows → Validation scripts: mirrors checks · CI workflows run or mirror the repo's verification routines.
- DOC corpus → Specialist agents: informs · Documentation provides reference context for agent execution.
- DOC corpus → Skills library: references · Docs complement the reusable skill library.
- omo model → Specialist agents: alternative routing · The omo model provides a parallel persona-based orchestration path.
- omo model → Workflows: drives · The omo configuration defines a distinct operating flow.
- opencode.json → DOC corpus: integrates context · Repository config is supported by the local documentation corpus.
- AGENTS.md → Slash commands: guides usage · Routing rules shape how commands are interpreted and delegated.
