diff --git a/AGENTS.md b/AGENTS.md index 09d3a19ec..e774f3fb0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ ## OVERVIEW -OpenCode plugin (npm: `oh-my-opencode`) that extends Claude Code (OpenCode fork) with multi-agent orchestration, 45 lifecycle hooks, 26 tools, skill/command/MCP systems, and Claude Code compatibility. 1268 TypeScript files, 160k LOC. +OpenCode plugin (npm: `oh-my-opencode`) that extends Claude Code (OpenCode fork) with multi-agent orchestration, 48 lifecycle hooks, 26 tools, skill/command/MCP systems, and Claude Code compatibility. 1268 TypeScript files, 160k LOC. ## STRUCTURE @@ -14,14 +14,14 @@ oh-my-opencode/ │ ├── index.ts # Plugin entry: loadConfig → createManagers → createTools → createHooks → createPluginInterface │ ├── plugin-config.ts # JSONC multi-level config: user → project → defaults (Zod v4) │ ├── agents/ # 11 agents (Sisyphus, Hephaestus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus, Multimodal-Looker, Sisyphus-Junior) -│ ├── hooks/ # 45 hooks across 44 directories + 11 standalone files +│ ├── hooks/ # 48 lifecycle hooks across dedicated modules and standalone files │ ├── tools/ # 26 tools across 15 directories │ ├── features/ # 19 feature modules (background-agent, skill-loader, tmux, MCP-OAuth, etc.) │ ├── shared/ # 95+ utility files in 13 categories │ ├── config/ # Zod v4 schema system (24 files) │ ├── cli/ # CLI: install, run, doctor, mcp-oauth (Commander.js) │ ├── mcp/ # 3 built-in remote MCPs (websearch, context7, grep_app) -│ ├── plugin/ # 8 OpenCode hook handlers + 45 hook composition +│ ├── plugin/ # 8 OpenCode hook handlers + 48 hook composition │ └── plugin-handlers/ # 6-phase config loading pipeline ├── packages/ # Monorepo: cli-runner, 12 platform binaries └── local-ignore/ # Dev-only test fixtures @@ -34,7 +34,7 @@ OhMyOpenCodePlugin(ctx) ├─→ loadPluginConfig() # JSONC parse → project/user merge → Zod validate → migrate ├─→ createManagers() # TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler ├─→ createTools() # SkillContext + AvailableCategories + ToolRegistry (26 tools) - ├─→ createHooks() # 3-tier: Core(37) + Continuation(6) + Skill(2) = 45 hooks + ├─→ createHooks() # 3-tier: Core(39) + Continuation(7) + Skill(2) = 48 hooks └─→ createPluginInterface() # 8 OpenCode hook handlers → PluginInterface ``` @@ -97,7 +97,7 @@ Fields: agents (14 overridable, 21 fields each), categories (8 built-in + custom - **Test pattern**: Bun test (`bun:test`), co-located `*.test.ts`, given/when/then style (nested describe with `#given`/`#when`/`#then` prefixes) - **CI test split**: mock-heavy tests run in isolation (separate `bun test` processes), rest in batch - **Factory pattern**: `createXXX()` for all tools, hooks, agents -- **Hook tiers**: Session (23) → Tool-Guard (10) → Transform (4) → Continuation (6) → Skill (2) +- **Hook tiers**: Session (23) → Tool-Guard (12) → Transform (4) → Continuation (7) → Skill (2) - **Agent modes**: `primary` (respects UI model) vs `subagent` (own fallback chain) vs `all` - **Model resolution**: 4-step: override → category-default → provider-fallback → system-default - **Config format**: JSONC with comments, Zod v4 validation, snake_case keys diff --git a/src/AGENTS.md b/src/AGENTS.md index ec451bb07..61400acd9 100644 --- a/src/AGENTS.md +++ b/src/AGENTS.md @@ -14,7 +14,7 @@ Entry point `index.ts` orchestrates 5-step initialization: loadConfig → create | `plugin-config.ts` | JSONC parse, multi-level merge, Zod v4 validation | | `create-managers.ts` | TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler | | `create-tools.ts` | SkillContext + AvailableCategories + ToolRegistry (26 tools) | -| `create-hooks.ts` | 3-tier: Core(37) + Continuation(6) + Skill(2) = 45 hooks | +| `create-hooks.ts` | 3-tier: Core(39) + Continuation(7) + Skill(2) = 48 hooks | | `plugin-interface.ts` | 8 OpenCode hook handlers: config, tool, chat.message, chat.params, chat.headers, event, tool.execute.before, tool.execute.after | ## CONFIG LOADING @@ -36,6 +36,6 @@ createHooks() │ ├─ createSessionHooks() # 23: contextWindowMonitor, thinkMode, ralphLoop, modelFallback, runtimeFallback, noSisyphusGpt, noHephaestusNonGpt, anthropicEffort, intentGate... │ ├─ createToolGuardHooks() # 10: commentChecker, rulesInjector, writeExistingFileGuard, jsonErrorRecovery, hashlineReadEnhancer... │ └─ createTransformHooks() # 4: claudeCodeHooks, keywordDetector, contextInjector, thinkingBlockValidator - ├─→ createContinuationHooks() # 6: todoContinuationEnforcer, atlas, stopContinuationGuard, ralphLoopActivator... + ├─→ createContinuationHooks() # 7: todoContinuationEnforcer, atlas, stopContinuationGuard, ralphLoopActivator... └─→ createSkillHooks() # 2: categorySkillReminder, autoSlashCommand ``` diff --git a/src/config/AGENTS.md b/src/config/AGENTS.md index 57f0a83df..0b9e7e219 100644 --- a/src/config/AGENTS.md +++ b/src/config/AGENTS.md @@ -14,7 +14,7 @@ config/schema/ ├── agent-names.ts # BuiltinAgentNameSchema (11), OverridableAgentNameSchema (14) ├── agent-overrides.ts # AgentOverrideConfigSchema (21 fields per agent) ├── categories.ts # 8 built-in + custom categories -├── hooks.ts # HookNameSchema (45 hooks) +├── hooks.ts # HookNameSchema (48 hooks) ├── skills.ts # SkillsConfigSchema (sources, paths, recursive) ├── commands.ts # BuiltinCommandNameSchema ├── experimental.ts # Feature flags (plugin_load_timeout_ms min 1000) diff --git a/src/hooks/AGENTS.md b/src/hooks/AGENTS.md index 433344d89..e7dfc4e2c 100644 --- a/src/hooks/AGENTS.md +++ b/src/hooks/AGENTS.md @@ -1,10 +1,10 @@ -# src/hooks/ — 45 Lifecycle Hooks +# src/hooks/ — 48 Lifecycle Hooks **Generated:** 2026-03-06 ## OVERVIEW -45 hooks across 44 directories + 11 standalone files. Three-tier composition: Core(37) + Continuation(6) + Skill(2). All hooks follow `createXXXHook(deps) → HookFunction` factory pattern. +48 hooks across dedicated modules and standalone files. Three-tier composition: Core(39) + Continuation(7) + Skill(2). All hooks follow `createXXXHook(deps) → HookFunction` factory pattern. ## HOOK TIERS @@ -85,7 +85,7 @@ hooks/ | noHephaestusNonGpt | chat.message | Block Hephaestus from using non-GPT models | | runtimeFallback | event | Auto-switch models on API provider errors | -### Tier 2: Tool Guard Hooks (10) — `create-tool-guard-hooks.ts` +### Tier 2: Tool Guard Hooks (12) — `create-tool-guard-hooks.ts` | Hook | Event | Purpose | |------|-------|---------| @@ -109,7 +109,7 @@ hooks/ | contextInjectorMessagesTransform | messages.transform | Inject AGENTS.md/README.md into context | | thinkingBlockValidator | messages.transform | Validate thinking block structure | -### Tier 4: Continuation Hooks (6) — `create-continuation-hooks.ts` +### Tier 4: Continuation Hooks (7) — `create-continuation-hooks.ts` | Hook | Event | Purpose | |------|-------|---------| diff --git a/src/plugin/AGENTS.md b/src/plugin/AGENTS.md index 8ce81d499..e1a3e69f6 100644 --- a/src/plugin/AGENTS.md +++ b/src/plugin/AGENTS.md @@ -4,7 +4,7 @@ ## OVERVIEW -Core glue layer. 20 source files assembling the 8 OpenCode hook handlers and composing 45 hooks into the PluginInterface. Every handler file corresponds to one OpenCode hook type. +Core glue layer. 20 source files assembling the 8 OpenCode hook handlers and composing 48 hooks into the PluginInterface. Every handler file corresponds to one OpenCode hook type. ## HANDLER FILES @@ -25,7 +25,7 @@ Core glue layer. 20 source files assembling the 8 OpenCode hook handlers and com | File | Tier | Count | |------|------|-------| | `create-session-hooks.ts` | Session | 23 | -| `create-tool-guard-hooks.ts` | Tool Guard | 10 | +| `create-tool-guard-hooks.ts` | Tool Guard | 12 | | `create-skill-hooks.ts` | Skill | 2 | | `create-core-hooks.ts` | Aggregator | Session + Guard + Transform = 37 |