Files
oh-my-opencode/src/shared/AGENTS.md
T
YeonGyu-Kim 330e437f08 docs(agents): regenerate hierarchical AGENTS.md for 2026-05-20
Sync the AGENTS.md hierarchy to current code state:

Drift fixes in 11 existing files
- Root: 2026-05-20 commit 39aadbf9f, ~2167 TS files, 120 barrel index.ts,
  57 src/hooks dirs, 297 (179 non-test) src/shared files, 11 OpenCode hook
  handlers in plugin-interface.ts, packages list adds ast-grep-mcp + rules-core,
  first-prompt-watchdog 206 LOC, parent-wake-notifier 587 LOC
- src/AGENTS.md: file counts, plugin-interface handler count
- src/shared/AGENTS.md: title + counts 278/170 -> 297/179
- src/hooks/AGENTS.md: 57 dirs, note unwired WIP (task-reminder,
  hashline-edit-diff-enhancer)
- src/features/AGENTS.md: module map with NON-TEST counts + sub-AGENTS.md
  column, 7 modules without sub-doc
- src/features/background-agent/AGENTS.md: add 12 newer files (parent-wake-
  notifier 587 LOC, loop-detector, error-classifier, fallback-retry-handler,
  process-cleanup, subagent-spawn-limits, session-status-classifier,
  compaction-aware-message-resolver, etc.)
- src/plugin/AGENTS.md: 11 handlers, add system-transform.ts + command-
  execute-before.ts + build-team-idle-wake-hint-client.ts
- src/config/AGENTS.md: note schema/internal/permission.ts
- src/cli/AGENTS.md: 8 commands including 'version'
- src/plugin-handlers/AGENTS.md, packages/web/AGENTS.md: date bump

New AGENTS.md in 4 directories
- packages/AGENTS.md: index of 15 packages (11 platform binaries + 2 MCP
  packages + rules-core + web), role map, conventions
- docs/AGENTS.md: WHERE TO LOOK table for 19 docs across 6 subdirs
- .opencode/AGENTS.md: 5 skills + 4 slash commands + relationship to .agents/
- .agents/AGENTS.md: superset migration target (9 skills + 4 commands)
2026-05-20 17:18:44 +09:00

2.8 KiB

src/shared/ — 297 Utility Files (179 non-test)

Generated: 2026-05-20

OVERVIEW

Cross-cutting utilities used throughout the plugin. Barrel-exported from index.ts. Logger writes oh-my-opencode.log to the OS temp dir (Node's os.tmpdir()/tmp on Linux, %TEMP% on Windows, etc.); rotated at 50 MB; up to 2 backups at .1 / .2. Includes runtime shims for Bun.file, Bun.write, Bun.hash, Bun.which, Bun.spawn to support non-Bun runtimes (Electron-hosted OpenCode).

CATEGORY MAP

Category Files Key Exports
Model Resolution ~22 resolveModel(), checkModelAvailability(), AGENT_MODEL_REQUIREMENTS
Tmux Integration 11 createTmuxSession(), spawnPane(), closePane(), server health
Configuration & Paths 10 resolveOpenCodeConfigDir(), getDataPath(), parseJSONC()
Session Management 8 SessionCursor, trackInjectedPath(), SessionToolsStore
Git Worktree 7 parseGitStatusPorcelain(), collectGitDiffStats(), formatFileChanges()
Command Execution 7 executeCommand(), executeHookCommand(), embedded command registry
Migration 6 migrateConfigFile(), AGENT_NAME_MAP, HOOK_NAME_MAP, MODEL_VERSION_MAP
String & Tool Utils 6 toSnakeCase(), normalizeToolName(), parseFrontmatter()
Agent Configuration 5 getAgentVariant(), AGENT_DISPLAY_NAMES, AGENT_TOOL_RESTRICTIONS
OpenCode Integration 5 injectServerAuth(), detectExternalPlugins(), client accessors
Type Helpers 4 deepMerge(), DynamicTruncator, matchPattern(), isRecord()
Misc 8 log(), readFile(), extractZip(), downloadBinary(), findAvailablePort()

MODEL RESOLUTION PIPELINE

resolveModel(input)
  1. Override: UI-selected model (primary agents only)
  2. Category default: From category config
  3. Provider fallback: AGENT_MODEL_REQUIREMENTS chains
  4. System default: Ultimate fallback

Key files: model-resolver.ts (entry), model-resolution-pipeline.ts (orchestration), model-requirements.ts (fallback chains), model-availability.ts (fuzzy matching).

MIGRATION SYSTEM

Automatically transforms legacy config on load:

  • agent-names.ts: Old agent names → new (e.g., juniorsisyphus-junior)
  • hook-names.ts: Old hook names → new
  • model-versions.ts: Old model IDs → current
  • agent-category.ts: Legacy agent configs → category system

MOST IMPORTED

Utility Import Count Purpose
logger.ts 62 oh-my-opencode.log in os.tmpdir() (50 MB cap, rotates to .1/.2)
data-path.ts 11 XDG storage resolution
model-requirements.ts 11 Agent fallback chains
system-directive.ts 11 System message filtering
frontmatter.ts 10 YAML metadata extraction