chore: regenerate AGENTS.md knowledge base
🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) assistance
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# src/features/ — 18 Feature Modules
|
||||
# src/features/ — 19 Feature Modules
|
||||
|
||||
**Generated:** 2026-02-17
|
||||
**Generated:** 2026-02-18
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
@@ -27,6 +27,7 @@ Standalone feature modules wired into plugin/ layer. Each is self-contained with
|
||||
| **claude-code-agent-loader** | 3 | LOW | Load agents from .opencode/agents/ |
|
||||
| **claude-code-command-loader** | 3 | LOW | Load commands from .opencode/commands/ |
|
||||
| **claude-code-session-state** | 2 | LOW | Subagent session state tracking |
|
||||
| **run-continuation-state** | 5 | LOW | Persistent state for `run` command continuation across sessions |
|
||||
| **tool-metadata-store** | 2 | LOW | Tool execution metadata cache |
|
||||
|
||||
## KEY MODULES
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# src/features/background-agent/ — Core Orchestration Engine
|
||||
|
||||
**Generated:** 2026-02-18
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
39 files (~10k LOC). Manages async task lifecycle: launch → queue → run → poll → complete/error. Concurrency limited per model/provider (default 5). Central to multi-agent orchestration.
|
||||
|
||||
## TASK LIFECYCLE
|
||||
|
||||
```
|
||||
LaunchInput → pending → [ConcurrencyManager queue] → running → polling → completed/error/cancelled/interrupt
|
||||
```
|
||||
|
||||
## KEY FILES
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `manager.ts` | `BackgroundManager` — main class: launch, cancel, getTask, listTasks |
|
||||
| `spawner.ts` | Task spawning: create session → inject prompt → start polling |
|
||||
| `concurrency.ts` | `ConcurrencyManager` — FIFO queue per concurrency key, slot acquisition/release |
|
||||
| `task-poller.ts` | 3s interval polling, completion via idle events + stability detection (10s unchanged) |
|
||||
| `result-handler.ts` | Process completed tasks: extract result, notify parent, cleanup |
|
||||
| `state.ts` | In-memory task store (Map-based) |
|
||||
| `types.ts` | `BackgroundTask`, `LaunchInput`, `ResumeInput`, `BackgroundTaskStatus` |
|
||||
|
||||
## SPAWNER SUBDIRECTORY (6 files)
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `spawner-context.ts` | `SpawnerContext` interface composing all spawner deps |
|
||||
| `background-session-creator.ts` | Create OpenCode session for background task |
|
||||
| `concurrency-key-from-launch-input.ts` | Derive concurrency key from model/provider |
|
||||
| `parent-directory-resolver.ts` | Resolve working directory for child session |
|
||||
| `tmux-callback-invoker.ts` | Notify TmuxSessionManager on session creation |
|
||||
|
||||
## COMPLETION DETECTION
|
||||
|
||||
Two signals combined:
|
||||
1. **Session idle event** — OpenCode reports session became idle
|
||||
2. **Stability detection** — message count unchanged for 10s (3+ stable polls at 3s interval)
|
||||
|
||||
Both must agree before marking a task complete. Prevents premature completion on brief pauses.
|
||||
|
||||
## CONCURRENCY MODEL
|
||||
|
||||
- Key format: `{providerID}/{modelID}` (e.g., `anthropic/claude-opus-4-6`)
|
||||
- Default limit: 5 concurrent per key (configurable via `background_task` config)
|
||||
- FIFO queue: tasks wait in order when slots full
|
||||
- Slot released on: completion, error, cancellation
|
||||
|
||||
## NOTIFICATION FLOW
|
||||
|
||||
```
|
||||
task completed → result-handler → parent-session-notifier → inject system message into parent session
|
||||
```
|
||||
@@ -0,0 +1,59 @@
|
||||
# src/features/opencode-skill-loader/ — 4-Scope Skill Discovery
|
||||
|
||||
**Generated:** 2026-02-18
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
28 files (~3.2k LOC). Discovers, parses, merges, and resolves SKILL.md files from 4 scopes with priority deduplication.
|
||||
|
||||
## 4-SCOPE PRIORITY (highest → lowest)
|
||||
|
||||
```
|
||||
1. Project (.opencode/skills/)
|
||||
2. OpenCode config (~/.config/opencode/skills/)
|
||||
3. User (~/.config/opencode/oh-my-opencode/skills/)
|
||||
4. Global (built-in skills)
|
||||
```
|
||||
|
||||
Same-named skill at higher scope overrides lower.
|
||||
|
||||
## KEY FILES
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `loader.ts` | Main `loadSkills()` — orchestrates discovery → parse → merge |
|
||||
| `async-loader.ts` | Async variant for non-blocking skill loading |
|
||||
| `blocking.ts` | Sync variant for initial load |
|
||||
| `merger.ts` | Priority-based deduplication across scopes |
|
||||
| `skill-content.ts` | YAML frontmatter parsing from SKILL.md |
|
||||
| `skill-discovery.ts` | Find SKILL.md files in directory trees |
|
||||
| `skill-directory-loader.ts` | Load all skills from a single directory |
|
||||
| `config-source-discovery.ts` | Discover scope directories from config |
|
||||
| `skill-template-resolver.ts` | Variable substitution in skill templates |
|
||||
| `skill-mcp-config.ts` | Extract MCP configs from skill YAML |
|
||||
| `types.ts` | `LoadedSkill`, `SkillScope`, `SkillDiscoveryResult` |
|
||||
|
||||
## SKILL FORMAT (SKILL.md)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: my-skill
|
||||
description: What this skill does
|
||||
tools: [Bash, Read, Write]
|
||||
mcp:
|
||||
- name: my-mcp
|
||||
type: stdio
|
||||
command: npx
|
||||
args: [-y, my-mcp-server]
|
||||
---
|
||||
|
||||
Skill content (instructions for the agent)...
|
||||
```
|
||||
|
||||
## MERGER SUBDIRECTORY
|
||||
|
||||
Handles complex merge logic when skills from multiple scopes have overlapping names or MCP configs.
|
||||
|
||||
## TEMPLATE RESOLUTION
|
||||
|
||||
Variables like `{{directory}}`, `{{agent}}` in skill content get resolved at load time based on current context.
|
||||
@@ -0,0 +1,52 @@
|
||||
# src/features/tmux-subagent/ — Tmux Pane Management
|
||||
|
||||
**Generated:** 2026-02-18
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
28 files. State-first tmux integration managing panes for background agent sessions. Handles split decisions, grid planning, polling, and lifecycle events.
|
||||
|
||||
## CORE ARCHITECTURE
|
||||
|
||||
```
|
||||
TmuxSessionManager (manager.ts)
|
||||
├─→ DecisionEngine: Should we spawn/close panes?
|
||||
├─→ ActionExecutor: Execute spawn/close/replace actions
|
||||
├─→ PollingManager: Monitor pane health
|
||||
└─→ EventHandlers: React to session create/delete
|
||||
```
|
||||
|
||||
## KEY FILES
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `manager.ts` | `TmuxSessionManager` — main class, session tracking, event routing |
|
||||
| `decision-engine.ts` | Evaluate window state → produce `SpawnDecision` with actions |
|
||||
| `action-executor.ts` | Execute `PaneAction[]` (close, spawn, replace) |
|
||||
| `grid-planning.ts` | Calculate pane layout given window dimensions |
|
||||
| `spawn-action-decider.ts` | Decide spawn vs replace vs skip |
|
||||
| `spawn-target-finder.ts` | Find best pane to split or replace |
|
||||
| `polling-manager.ts` | Health polling for tracked sessions |
|
||||
| `types.ts` | `TrackedSession`, `WindowState`, `PaneAction`, `SpawnDecision` |
|
||||
|
||||
## PANE LIFECYCLE
|
||||
|
||||
```
|
||||
session.created → spawn-action-decider → grid-planning → action-executor → track session
|
||||
session.deleted → cleanup tracked session → close pane if empty
|
||||
```
|
||||
|
||||
## LAYOUT CONSTRAINTS
|
||||
|
||||
- `MIN_PANE_WIDTH`: 52 chars
|
||||
- `MIN_PANE_HEIGHT`: 11 lines
|
||||
- Main pane preserved (never split below minimum)
|
||||
- Agent panes split from remaining space
|
||||
|
||||
## EVENT HANDLERS
|
||||
|
||||
| File | Event |
|
||||
|------|-------|
|
||||
| `session-created-handler.ts` | New background session → spawn pane |
|
||||
| `session-deleted-handler.ts` | Session ended → close pane |
|
||||
| `session-created-event.ts` | Event type definition |
|
||||
Reference in New Issue
Block a user