oh-my-opencode 3.2.3 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/agents/atlas/default.d.ts +1 -1
  2. package/dist/agents/atlas/gpt.d.ts +1 -1
  3. package/dist/agents/atlas/index.d.ts +1 -1
  4. package/dist/agents/atlas/utils.d.ts +1 -1
  5. package/dist/agents/dynamic-agent-prompt-builder.d.ts +6 -0
  6. package/dist/agents/prometheus/high-accuracy-mode.d.ts +1 -1
  7. package/dist/agents/prometheus/index.d.ts +1 -1
  8. package/dist/agents/prometheus/interview-mode.d.ts +1 -1
  9. package/dist/agents/prometheus/plan-generation.d.ts +1 -1
  10. package/dist/agents/prometheus/plan-template.d.ts +1 -1
  11. package/dist/cli/doctor/checks/model-resolution.d.ts +2 -0
  12. package/dist/cli/index.js +4718 -5646
  13. package/dist/cli/run/agent-resolver.d.ts +5 -0
  14. package/dist/cli/run/events.d.ts +2 -0
  15. package/dist/cli/run/index.d.ts +6 -1
  16. package/dist/cli/run/json-output.d.ts +12 -0
  17. package/dist/cli/run/on-complete-hook.d.ts +7 -0
  18. package/dist/cli/run/runner.d.ts +2 -4
  19. package/dist/cli/run/server-connection.d.ts +6 -0
  20. package/dist/cli/run/session-resolver.d.ts +5 -0
  21. package/dist/cli/run/types.d.ts +17 -0
  22. package/dist/config/schema.d.ts +236 -57
  23. package/dist/features/background-agent/manager.d.ts +4 -1
  24. package/dist/features/boulder-state/storage.d.ts +1 -1
  25. package/dist/features/boulder-state/types.d.ts +2 -0
  26. package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
  27. package/dist/features/claude-tasks/storage.d.ts +2 -0
  28. package/dist/features/tool-metadata-store/index.d.ts +39 -0
  29. package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
  30. package/dist/hooks/anthropic-context-window-limit-recovery/deduplication-recovery.d.ts +3 -0
  31. package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +2 -13
  32. package/dist/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.d.ts +3 -0
  33. package/dist/hooks/anthropic-context-window-limit-recovery/recovery-hook.d.ts +13 -0
  34. package/dist/hooks/anthropic-effort/index.d.ts +26 -0
  35. package/dist/hooks/atlas/index.d.ts +1 -0
  36. package/dist/hooks/auto-update-checker/constants.d.ts +1 -1
  37. package/dist/hooks/category-skill-reminder/index.d.ts +2 -1
  38. package/dist/hooks/compaction-context-injector/index.d.ts +1 -8
  39. package/dist/hooks/compaction-todo-preserver/index.d.ts +11 -0
  40. package/dist/hooks/index.d.ts +3 -1
  41. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +2 -2
  42. package/dist/hooks/keyword-detector/ultrawork/gpt5.2.d.ts +1 -1
  43. package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
  44. package/dist/hooks/tasks-todowrite-disabler/constants.d.ts +1 -1
  45. package/dist/hooks/unstable-agent-babysitter/index.d.ts +19 -0
  46. package/dist/hooks/write-existing-file-guard/index.d.ts +2 -0
  47. package/dist/index.js +4330 -16726
  48. package/dist/plugin-state.d.ts +0 -1
  49. package/dist/shared/connected-providers-cache.d.ts +8 -1
  50. package/dist/shared/disabled-tools.d.ts +2 -0
  51. package/dist/shared/index.d.ts +3 -0
  52. package/dist/shared/migration/agent-category.d.ts +19 -0
  53. package/dist/shared/migration/agent-names.d.ts +6 -0
  54. package/dist/shared/migration/config-migration.d.ts +1 -0
  55. package/dist/shared/migration/hook-names.d.ts +6 -0
  56. package/dist/shared/migration/model-versions.d.ts +13 -0
  57. package/dist/shared/migration.d.ts +5 -32
  58. package/dist/shared/model-availability.d.ts +2 -1
  59. package/dist/shared/model-requirements.d.ts +1 -0
  60. package/dist/shared/port-utils.d.ts +9 -0
  61. package/dist/shared/safe-create-hook.d.ts +5 -0
  62. package/dist/shared/truncate-description.d.ts +1 -0
  63. package/dist/tools/ast-grep/constants.d.ts +1 -1
  64. package/dist/tools/ast-grep/index.d.ts +1 -4
  65. package/dist/tools/ast-grep/tools.d.ts +2 -2
  66. package/dist/tools/call-omo-agent/constants.d.ts +1 -1
  67. package/dist/tools/delegate-task/constants.d.ts +5 -1
  68. package/dist/tools/delegate-task/types.d.ts +11 -1
  69. package/dist/tools/glob/index.d.ts +1 -2
  70. package/dist/tools/glob/tools.d.ts +2 -1
  71. package/dist/tools/grep/index.d.ts +1 -2
  72. package/dist/tools/grep/tools.d.ts +2 -1
  73. package/dist/tools/index.d.ts +4 -0
  74. package/dist/tools/look-at/types.d.ts +2 -1
  75. package/dist/tools/lsp/client.d.ts +4 -0
  76. package/dist/tools/session-manager/index.d.ts +1 -1
  77. package/dist/tools/session-manager/tools.d.ts +2 -4
  78. package/package.json +8 -8
  79. package/dist/shared/ollama-ndjson-parser.d.ts +0 -108
@@ -37,6 +37,7 @@ export declare class BackgroundManager {
37
37
  private queuesByKey;
38
38
  private processingKeys;
39
39
  private completionTimers;
40
+ private idleDeferralTimers;
40
41
  constructor(ctx: PluginInput, config?: BackgroundTaskConfig, options?: {
41
42
  tmuxConfig?: TmuxConfig;
42
43
  onSubagentSessionCreated?: OnSubagentSessionCreated;
@@ -51,7 +52,7 @@ export declare class BackgroundManager {
51
52
  findBySession(sessionID: string): BackgroundTask | undefined;
52
53
  private getConcurrencyKeyFromInput;
53
54
  /**
54
- * Track a task created elsewhere (e.g., from delegate_task) for notification tracking.
55
+ * Track a task created elsewhere (e.g., from task) for notification tracking.
55
56
  * This allows tasks created by other tools to receive the same toast/prompt notifications.
56
57
  */
57
58
  trackTask(input: {
@@ -110,6 +111,8 @@ export declare class BackgroundManager {
110
111
  private tryCompleteTask;
111
112
  private notifyParentSession;
112
113
  private formatDuration;
114
+ private isAbortedSessionError;
115
+ private getErrorText;
113
116
  private hasRunningTasks;
114
117
  private pruneStaleTasksAndNotifications;
115
118
  private checkAndInterruptStaleTasks;
@@ -25,4 +25,4 @@ export declare function getPlanName(planPath: string): string;
25
25
  /**
26
26
  * Create a new boulder state for a plan.
27
27
  */
28
- export declare function createBoulderState(planPath: string, sessionId: string): BoulderState;
28
+ export declare function createBoulderState(planPath: string, sessionId: string, agent?: string): BoulderState;
@@ -13,6 +13,8 @@ export interface BoulderState {
13
13
  session_ids: string[];
14
14
  /** Plan name derived from filename */
15
15
  plan_name: string;
16
+ /** Agent type to use when resuming (e.g., 'atlas') */
17
+ agent?: string;
16
18
  }
17
19
  export interface PlanProgress {
18
20
  /** Total number of checkboxes */
@@ -1 +1 @@
1
- export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait\u2014these run async while main session works.\n\n```\n// Fire all at once, collect results later\ndelegate_task(agent=\"explore\", prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ndelegate_task(agent=\"explore\", prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ndelegate_task(agent=\"explore\", prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ndelegate_task(agent=\"explore\", prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ndelegate_task(agent=\"explore\", prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ndelegate_task(agent=\"explore\", prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ndelegate_task(agent=\"explore\", prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ndelegate_task(agent=\"explore\", prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ndelegate_task(agent=\"explore\", prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n delegate_task(category=\"writing\", load_skills=[], run_in_background=false, prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
1
+ export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait\u2014these run async while main session works.\n\n```\n// Fire all at once, collect results later\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore project structure\", run_in_background=true, prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find entry points\", run_in_background=true, prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find conventions\", run_in_background=true, prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find anti-patterns\", run_in_background=true, prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore build/CI\", run_in_background=true, prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find test patterns\", run_in_background=true, prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ntask(subagent_type=\"explore\", load_skills=[], description=\"Analyze large files\", run_in_background=true, prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore deep modules\", run_in_background=true, prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find shared utilities\", run_in_background=true, prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n<critical>\n**File Writing Rule**: If AGENTS.md already exists at the target path \u2192 use `Edit` tool. If it does NOT exist \u2192 use `Write` tool.\nNEVER use Write to overwrite an existing file. ALWAYS check existence first via `Read` or discovery results.\n</critical>\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n task(category=\"writing\", load_skills=[], run_in_background=false, description=\"Generate AGENTS.md\", prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
@@ -1,6 +1,8 @@
1
1
  import type { z } from "zod";
2
2
  import type { OhMyOpenCodeConfig } from "../../config/schema";
3
3
  export declare function getTaskDir(config?: Partial<OhMyOpenCodeConfig>): string;
4
+ export declare function sanitizePathSegment(value: string): string;
5
+ export declare function resolveTaskListId(config?: Partial<OhMyOpenCodeConfig>): string;
4
6
  export declare function ensureDir(dirPath: string): void;
5
7
  export declare function readJsonSafe<T>(filePath: string, schema: z.ZodType<T>): T | null;
6
8
  export declare function writeJsonAtomic(filePath: string, data: unknown): void;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Pending tool metadata store.
3
+ *
4
+ * OpenCode's `fromPlugin()` wrapper always replaces the metadata returned by
5
+ * plugin tools with `{ truncated, outputPath }`, discarding any sessionId,
6
+ * title, or custom metadata set during `execute()`.
7
+ *
8
+ * This store captures metadata written via `ctx.metadata()` inside execute(),
9
+ * then the `tool.execute.after` hook consumes it and merges it back into the
10
+ * result *before* the processor writes the final part to the session store.
11
+ *
12
+ * Flow:
13
+ * execute() → storeToolMetadata(sessionID, callID, data)
14
+ * fromPlugin() → overwrites metadata with { truncated }
15
+ * tool.execute.after → consumeToolMetadata(sessionID, callID) → merges back
16
+ * processor → Session.updatePart(status:"completed", metadata: result.metadata)
17
+ */
18
+ export interface PendingToolMetadata {
19
+ title?: string;
20
+ metadata?: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Store metadata to be restored after fromPlugin() overwrites it.
24
+ * Called from tool execute() functions alongside ctx.metadata().
25
+ */
26
+ export declare function storeToolMetadata(sessionID: string, callID: string, data: PendingToolMetadata): void;
27
+ /**
28
+ * Consume stored metadata (one-time read, removes from store).
29
+ * Called from tool.execute.after hook.
30
+ */
31
+ export declare function consumeToolMetadata(sessionID: string, callID: string): PendingToolMetadata | undefined;
32
+ /**
33
+ * Get current store size (for testing/debugging).
34
+ */
35
+ export declare function getPendingStoreSize(): number;
36
+ /**
37
+ * Clear all pending metadata (for testing).
38
+ */
39
+ export declare function clearPendingStore(): void;
@@ -2,4 +2,4 @@ export declare const OPENCODE_STORAGE: string;
2
2
  export declare const AGENT_USAGE_REMINDER_STORAGE: string;
3
3
  export declare const TARGET_TOOLS: Set<string>;
4
4
  export declare const AGENT_TOOLS: Set<string>;
5
- export declare const REMINDER_MESSAGE = "\n[Agent Usage Reminder]\n\nYou called a search/fetch tool directly without leveraging specialized agents.\n\nRECOMMENDED: Use delegate_task with explore/librarian agents for better results:\n\n```\n// Parallel exploration - fire multiple agents simultaneously\ndelegate_task(agent=\"explore\", prompt=\"Find all files matching pattern X\")\ndelegate_task(agent=\"explore\", prompt=\"Search for implementation of Y\") \ndelegate_task(agent=\"librarian\", prompt=\"Lookup documentation for Z\")\n\n// Then continue your work while they run in background\n// System will notify you when each completes\n```\n\nWHY:\n- Agents can perform deeper, more thorough searches\n- Background tasks run in parallel, saving time\n- Specialized agents have domain expertise\n- Reduces context window usage in main session\n\nALWAYS prefer: Multiple parallel delegate_task calls > Direct tool calls\n";
5
+ export declare const REMINDER_MESSAGE = "\n[Agent Usage Reminder]\n\nYou called a search/fetch tool directly without leveraging specialized agents.\n\nRECOMMENDED: Use task with explore/librarian agents for better results:\n\n```\n// Parallel exploration - fire multiple agents simultaneously\ntask(agent=\"explore\", prompt=\"Find all files matching pattern X\")\ntask(agent=\"explore\", prompt=\"Search for implementation of Y\") \ntask(agent=\"librarian\", prompt=\"Lookup documentation for Z\")\n\n// Then continue your work while they run in background\n// System will notify you when each completes\n```\n\nWHY:\n- Agents can perform deeper, more thorough searches\n- Background tasks run in parallel, saving time\n- Specialized agents have domain expertise\n- Reduces context window usage in main session\n\nALWAYS prefer: Multiple parallel task calls > Direct tool calls\n";
@@ -0,0 +1,3 @@
1
+ import type { ParsedTokenLimitError } from "./types";
2
+ import type { ExperimentalConfig } from "../../config";
3
+ export declare function attemptDeduplicationRecovery(sessionID: string, parsed: ParsedTokenLimitError, experimental: ExperimentalConfig | undefined): Promise<void>;
@@ -1,16 +1,5 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- import type { ExperimentalConfig } from "../../config";
3
- export interface AnthropicContextWindowLimitRecoveryOptions {
4
- experimental?: ExperimentalConfig;
5
- }
6
- export declare function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput, options?: AnthropicContextWindowLimitRecoveryOptions): {
7
- event: ({ event }: {
8
- event: {
9
- type: string;
10
- properties?: unknown;
11
- };
12
- }) => Promise<void>;
13
- };
1
+ export { createAnthropicContextWindowLimitRecoveryHook } from "./recovery-hook";
2
+ export type { AnthropicContextWindowLimitRecoveryOptions } from "./recovery-hook";
14
3
  export type { AutoCompactState, ParsedTokenLimitError, TruncateState } from "./types";
15
4
  export { parseAnthropicTokenLimitError } from "./parser";
16
5
  export { executeCompact, getLastAssistant } from "./executor";
@@ -0,0 +1,3 @@
1
+ export declare function truncateToolOutputsByCallId(sessionID: string, callIds: Set<string>): {
2
+ truncatedCount: number;
3
+ };
@@ -0,0 +1,13 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { ExperimentalConfig } from "../../config";
3
+ export interface AnthropicContextWindowLimitRecoveryOptions {
4
+ experimental?: ExperimentalConfig;
5
+ }
6
+ export declare function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput, options?: AnthropicContextWindowLimitRecoveryOptions): {
7
+ event: ({ event }: {
8
+ event: {
9
+ type: string;
10
+ properties?: unknown;
11
+ };
12
+ }) => Promise<void>;
13
+ };
@@ -0,0 +1,26 @@
1
+ interface ChatParamsInput {
2
+ sessionID: string;
3
+ agent: {
4
+ name?: string;
5
+ };
6
+ model: {
7
+ providerID: string;
8
+ modelID: string;
9
+ };
10
+ provider: {
11
+ id: string;
12
+ };
13
+ message: {
14
+ variant?: string;
15
+ };
16
+ }
17
+ interface ChatParamsOutput {
18
+ temperature?: number;
19
+ topP?: number;
20
+ topK?: number;
21
+ options: Record<string, unknown>;
22
+ }
23
+ export declare function createAnthropicEffortHook(): {
24
+ "chat.params": (input: ChatParamsInput, output: ChatParamsOutput) => Promise<void>;
25
+ };
26
+ export {};
@@ -14,6 +14,7 @@ interface ToolExecuteAfterOutput {
14
14
  export interface AtlasHookOptions {
15
15
  directory: string;
16
16
  backgroundManager?: BackgroundManager;
17
+ isContinuationStopped?: (sessionID: string) => boolean;
17
18
  }
18
19
  export declare function createAtlasHook(ctx: PluginInput, options?: AtlasHookOptions): {
19
20
  handler: ({ event }: {
@@ -3,8 +3,8 @@ export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/oh
3
3
  export declare const NPM_FETCH_TIMEOUT = 5000;
4
4
  export declare const CACHE_DIR: string;
5
5
  export declare const VERSION_FILE: string;
6
- export declare const INSTALLED_PACKAGE_JSON: string;
7
6
  export declare function getWindowsAppdataDir(): string | null;
8
7
  export declare const USER_CONFIG_DIR: string;
9
8
  export declare const USER_OPENCODE_CONFIG: string;
10
9
  export declare const USER_OPENCODE_CONFIG_JSONC: string;
10
+ export declare const INSTALLED_PACKAGE_JSON: string;
@@ -1,4 +1,5 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { AvailableSkill } from "../../agents/dynamic-agent-prompt-builder";
2
3
  interface ToolExecuteInput {
3
4
  tool: string;
4
5
  sessionID: string;
@@ -10,7 +11,7 @@ interface ToolExecuteOutput {
10
11
  output: string;
11
12
  metadata: unknown;
12
13
  }
13
- export declare function createCategorySkillReminderHook(_ctx: PluginInput): {
14
+ export declare function createCategorySkillReminderHook(_ctx: PluginInput, availableSkills?: AvailableSkill[]): {
14
15
  "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
15
16
  event: ({ event }: {
16
17
  event: {
@@ -1,8 +1 @@
1
- export interface SummarizeContext {
2
- sessionID: string;
3
- providerID: string;
4
- modelID: string;
5
- usageRatio: number;
6
- directory: string;
7
- }
8
- export declare function createCompactionContextInjector(): (ctx: SummarizeContext) => Promise<void>;
1
+ export declare function createCompactionContextInjector(): () => string;
@@ -0,0 +1,11 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export interface CompactionTodoPreserver {
3
+ capture: (sessionID: string) => Promise<void>;
4
+ event: (input: {
5
+ event: {
6
+ type: string;
7
+ properties?: unknown;
8
+ };
9
+ }) => Promise<void>;
10
+ }
11
+ export declare function createCompactionTodoPreserverHook(ctx: PluginInput): CompactionTodoPreserver;
@@ -31,7 +31,9 @@ export { createDelegateTaskRetryHook } from "./delegate-task-retry";
31
31
  export { createQuestionLabelTruncatorHook } from "./question-label-truncator";
32
32
  export { createSubagentQuestionBlockerHook } from "./subagent-question-blocker";
33
33
  export { createStopContinuationGuardHook, type StopContinuationGuard } from "./stop-continuation-guard";
34
- export { createCompactionContextInjector, type SummarizeContext } from "./compaction-context-injector";
34
+ export { createCompactionContextInjector } from "./compaction-context-injector";
35
+ export { createCompactionTodoPreserverHook } from "./compaction-todo-preserver";
35
36
  export { createUnstableAgentBabysitterHook } from "./unstable-agent-babysitter";
36
37
  export { createPreemptiveCompactionHook } from "./preemptive-compaction";
37
38
  export { createTasksTodowriteDisablerHook } from "./tasks-todowrite-disabler";
39
+ export { createWriteExistingFileGuardHook } from "./write-existing-file-guard";
@@ -2,9 +2,9 @@
2
2
  * Default ultrawork message optimized for Claude series models.
3
3
  *
4
4
  * Key characteristics:
5
- * - Natural tool-like usage of explore/librarian agents (background=true)
5
+ * - Natural tool-like usage of explore/librarian agents (run_in_background=true)
6
6
  * - Parallel execution emphasized - fire agents and continue working
7
7
  * - Simple workflow: EXPLORES → GATHER → PLAN → DELEGATE
8
8
  */
9
- export declare const ULTRAWORK_DEFAULT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ndelegate_task(subagent_type=\"explore\", load_skills=[], prompt=\"Find [X] patterns in codebase\", run_in_background=true)\ndelegate_task(subagent_type=\"librarian\", load_skills=[], prompt=\"Find docs/examples for [Y]\", run_in_background=true)\ndelegate_task(subagent_type=\"oracle\", load_skills=[], prompt=\"Review my approach: [describe plan]\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ndelegate_task(subagent_type=\"plan\", prompt=\"<gathered context + user request>\")\n```\n\n**WHY PLAN AGENT IS MANDATORY:**\n- Plan agent analyzes dependencies and parallel execution opportunities\n- Plan agent outputs a **parallel task graph** with waves and dependencies\n- Plan agent provides structured TODO list with category + skills per task\n- YOU are an orchestrator, NOT an implementer\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a session_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `delegate_task(session_id=\"{returned_session_id}\", prompt=\"<your answer>\")` |\n| Need to refine the plan | `delegate_task(session_id=\"{returned_session_id}\", prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `delegate_task(session_id=\"{returned_session_id}\", prompt=\"Add more detail to Task N\")` |\n\n**WHY SESSION_ID IS CRITICAL:**\n- Plan agent retains FULL conversation context\n- No repeated exploration or context gathering\n- Saves 70%+ tokens on follow-ups\n- Maintains interview continuity until plan is finalized\n\n```\n// WRONG: Starting fresh loses all context\ndelegate_task(subagent_type=\"plan\", prompt=\"Here's more info...\")\n\n// CORRECT: Resume preserves everything\ndelegate_task(session_id=\"ses_abc123\", prompt=\"Here's my answer to your question: ...\")\n```\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | delegate_task(subagent_type=\"explore\", run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | delegate_task(subagent_type=\"librarian\", run_in_background=true) | Specialized knowledge |\n| Planning | delegate_task(subagent_type=\"plan\") | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | delegate_task(subagent_type=\"oracle\") | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | delegate_task(category=\"artistry\", load_skills=[...]) | Different approach needed |\n| Implementation | delegate_task(category=\"...\", load_skills=[...]) | Domain-optimized models |\n\n**CATEGORY + SKILL DELEGATION:**\n```\n// Frontend work\ndelegate_task(category=\"visual-engineering\", load_skills=[\"frontend-ui-ux\"])\n\n// Complex logic\ndelegate_task(category=\"ultrabrain\", load_skills=[\"typescript-programmer\"])\n\n// Quick fixes\ndelegate_task(category=\"quick\", load_skills=[\"git-master\"])\n```\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via delegate_task(background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use delegate_task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. Analyze the request and identify required capabilities\n2. Spawn exploration/librarian agents via delegate_task(background=true) in PARALLEL (10+ if needed)\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n### Pre-Implementation: Define Success Criteria\n\nBEFORE writing ANY code, you MUST define:\n\n| Criteria Type | Description | Example |\n|---------------|-------------|---------|\n| **Functional** | What specific behavior must work | \"Button click triggers API call\" |\n| **Observable** | What can be measured/seen | \"Console shows 'success', no errors\" |\n| **Pass/Fail** | Binary, no ambiguity | \"Returns 200 OK\" not \"should work\" |\n\nWrite these criteria explicitly. Share with user if scope is non-trivial.\n\n### Test Plan Template (MANDATORY for non-trivial tasks)\n\n```\n## Test Plan\n### Objective: [What we're verifying]\n### Prerequisites: [Setup needed]\n### Test Cases:\n1. [Test Name]: [Input] \u2192 [Expected Output] \u2192 [How to verify]\n2. ...\n### Success Criteria: ALL test cases pass\n### How to Execute: [Exact commands/steps]\n```\n\n### Execution & Evidence Requirements\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Manual Verify** | Test the actual feature | Demonstrate it works (describe what you observed) |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n### TDD Workflow (when test infrastructure exists)\n\n1. **SPEC**: Define what \"working\" means (success criteria above)\n2. **RED**: Write failing test \u2192 Run it \u2192 Confirm it FAILS\n3. **GREEN**: Write minimal code \u2192 Run test \u2192 Confirm it PASSES\n4. **REFACTOR**: Clean up \u2192 Tests MUST stay green\n5. **VERIFY**: Run full test suite, confirm no regressions\n6. **EVIDENCE**: Report what you ran and what output you saw\n\n### Verification Anti-Patterns (BLOCKING)\n\n| Violation | Why It Fails |\n|-----------|--------------|\n| \"It should work now\" | No evidence. Run it. |\n| \"I added the tests\" | Did they pass? Show output. |\n| \"Fixed the bug\" | How do you know? What did you test? |\n| \"Implementation complete\" | Did you verify against success criteria? |\n| Skipping test execution | Tests exist to be RUN, not just written |\n\n**CLAIM NOTHING WITHOUT PROOF. EXECUTE. VERIFY. SHOW EVIDENCE.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO MockUp Work**: When user asked you to do \"port A\", you must \"port A\", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. EXPLORES + LIBRARIANS\n2. GATHER -> PLAN AGENT SPAWN\n3. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n---\n\n";
9
+ export declare const ULTRAWORK_DEFAULT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"Find [X] patterns in codebase\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"Find docs/examples for [Y]\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"Review my approach: [describe plan]\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", prompt=\"<gathered context + user request>\")\n```\n\n**WHY PLAN AGENT IS MANDATORY:**\n- Plan agent analyzes dependencies and parallel execution opportunities\n- Plan agent outputs a **parallel task graph** with waves and dependencies\n- Plan agent provides structured TODO list with category + skills per task\n- YOU are an orchestrator, NOT an implementer\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a session_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(session_id=\"{returned_session_id}\", prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(session_id=\"{returned_session_id}\", prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(session_id=\"{returned_session_id}\", prompt=\"Add more detail to Task N\")` |\n\n**WHY SESSION_ID IS CRITICAL:**\n- Plan agent retains FULL conversation context\n- No repeated exploration or context gathering\n- Saves 70%+ tokens on follow-ups\n- Maintains interview continuity until plan is finalized\n\n```\n// WRONG: Starting fresh loses all context\ntask(subagent_type=\"plan\", prompt=\"Here's more info...\")\n\n// CORRECT: Resume preserves everything\ntask(session_id=\"ses_abc123\", prompt=\"Here's my answer to your question: ...\")\n```\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\") | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\") | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...]) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...]) | Domain-optimized models |\n\n**CATEGORY + SKILL DELEGATION:**\n```\n// Frontend work\ntask(category=\"visual-engineering\", load_skills=[\"frontend-ui-ux\"])\n\n// Complex logic\ntask(category=\"ultrabrain\", load_skills=[\"typescript-programmer\"])\n\n// Quick fixes\ntask(category=\"quick\", load_skills=[\"git-master\"])\n```\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. Analyze the request and identify required capabilities\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL (10+ if needed)\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n### Pre-Implementation: Define Success Criteria\n\nBEFORE writing ANY code, you MUST define:\n\n| Criteria Type | Description | Example |\n|---------------|-------------|---------|\n| **Functional** | What specific behavior must work | \"Button click triggers API call\" |\n| **Observable** | What can be measured/seen | \"Console shows 'success', no errors\" |\n| **Pass/Fail** | Binary, no ambiguity | \"Returns 200 OK\" not \"should work\" |\n\nWrite these criteria explicitly. Share with user if scope is non-trivial.\n\n### Test Plan Template (MANDATORY for non-trivial tasks)\n\n```\n## Test Plan\n### Objective: [What we're verifying]\n### Prerequisites: [Setup needed]\n### Test Cases:\n1. [Test Name]: [Input] \u2192 [Expected Output] \u2192 [How to verify]\n2. ...\n### Success Criteria: ALL test cases pass\n### How to Execute: [Exact commands/steps]\n```\n\n### Execution & Evidence Requirements\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Manual Verify** | Test the actual feature | Demonstrate it works (describe what you observed) |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n### TDD Workflow (when test infrastructure exists)\n\n1. **SPEC**: Define what \"working\" means (success criteria above)\n2. **RED**: Write failing test \u2192 Run it \u2192 Confirm it FAILS\n3. **GREEN**: Write minimal code \u2192 Run test \u2192 Confirm it PASSES\n4. **REFACTOR**: Clean up \u2192 Tests MUST stay green\n5. **VERIFY**: Run full test suite, confirm no regressions\n6. **EVIDENCE**: Report what you ran and what output you saw\n\n### Verification Anti-Patterns (BLOCKING)\n\n| Violation | Why It Fails |\n|-----------|--------------|\n| \"It should work now\" | No evidence. Run it. |\n| \"I added the tests\" | Did they pass? Show output. |\n| \"Fixed the bug\" | How do you know? What did you test? |\n| \"Implementation complete\" | Did you verify against success criteria? |\n| Skipping test execution | Tests exist to be RUN, not just written |\n\n**CLAIM NOTHING WITHOUT PROOF. EXECUTE. VERIFY. SHOW EVIDENCE.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO MockUp Work**: When user asked you to do \"port A\", you must \"port A\", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. EXPLORES + LIBRARIANS\n2. GATHER -> PLAN AGENT SPAWN\n3. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n---\n\n";
10
10
  export declare function getDefaultUltraworkMessage(): string;
@@ -11,5 +11,5 @@
11
11
  * - Fire background agents, then use direct tools while waiting
12
12
  * - Explicit complexity-based decision criteria
13
13
  */
14
- export declare const ULTRAWORK_GPT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Think deeply before acting.\n\n<output_verbosity_spec>\n- Default: 3-6 sentences or \u22645 bullets for typical answers\n- Simple yes/no questions: \u22642 sentences\n- Complex multi-file tasks: 1 short overview paragraph + \u22645 bullets (What, Where, Risks, Next, Open)\n- Avoid long narrative paragraphs; prefer compact bullets\n- Do not rephrase the user's request unless it changes semantics\n</output_verbosity_spec>\n\n<scope_constraints>\n- Implement EXACTLY and ONLY what the user requests\n- No extra features, no added components, no embellishments\n- If any instruction is ambiguous, choose the simplest valid interpretation\n- Do NOT expand the task beyond what was asked\n</scope_constraints>\n\n## CERTAINTY PROTOCOL\n\n**Before implementation, ensure you have:**\n- Full understanding of the user's actual intent\n- Explored the codebase to understand existing patterns\n- A clear work plan (mental or written)\n- Resolved any ambiguities through exploration (not questions)\n\n<uncertainty_handling>\n- If the question is ambiguous or underspecified:\n - EXPLORE FIRST using tools (grep, file reads, explore agents)\n - If still unclear, state your interpretation and proceed\n - Ask clarifying questions ONLY as last resort\n- Never fabricate exact figures, line numbers, or references when uncertain\n- Prefer \"Based on the provided context...\" over absolute claims when unsure\n</uncertainty_handling>\n\n## DECISION FRAMEWORK: Self vs Delegate\n\n**Evaluate each task against these criteria to decide:**\n\n| Complexity | Criteria | Decision |\n|------------|----------|----------|\n| **Trivial** | <10 lines, single file, obvious pattern | **DO IT YOURSELF** |\n| **Moderate** | Single domain, clear pattern, <100 lines | **DO IT YOURSELF** (faster than delegation overhead) |\n| **Complex** | Multi-file, unfamiliar domain, >100 lines, needs specialized expertise | **DELEGATE** to appropriate category+skills |\n| **Research** | Need broad codebase context or external docs | **DELEGATE** to explore/librarian (background, parallel) |\n\n**Decision Factors:**\n- Delegation overhead \u2248 10-15 seconds. If task takes less, do it yourself.\n- If you already have full context loaded, do it yourself.\n- If task requires specialized expertise (frontend-ui-ux, git operations), delegate.\n- If you need information from multiple sources, fire parallel background agents.\n\n## AVAILABLE RESOURCES\n\nUse these when they provide clear value based on the decision framework above:\n\n| Resource | When to Use | How to Use |\n|----------|-------------|------------|\n| explore agent | Need codebase patterns you don't have | `delegate_task(subagent_type=\"explore\", run_in_background=true, ...)` |\n| librarian agent | External library docs, OSS examples | `delegate_task(subagent_type=\"librarian\", run_in_background=true, ...)` |\n| oracle agent | Stuck on architecture/debugging after 2+ attempts | `delegate_task(subagent_type=\"oracle\", ...)` |\n| plan agent | Complex multi-step with dependencies (5+ steps) | `delegate_task(subagent_type=\"plan\", ...)` |\n| delegate_task category | Specialized work matching a category | `delegate_task(category=\"...\", load_skills=[...])` |\n\n<tool_usage_rules>\n- Prefer tools over internal knowledge for fresh or user-specific data\n- Parallelize independent reads (read_file, grep, explore, librarian) to reduce latency\n- After any write/update, briefly restate: What changed, Where (path), Follow-up needed\n</tool_usage_rules>\n\n## EXECUTION PATTERN\n\n**Context gathering uses TWO parallel tracks:**\n\n| Track | Tools | Speed | Purpose |\n|-------|-------|-------|---------|\n| **Direct** | Grep, Read, LSP, AST-grep | Instant | Quick wins, known locations |\n| **Background** | explore, librarian agents | Async | Deep search, external docs |\n\n**ALWAYS run both tracks in parallel:**\n```\n// Fire background agents for deep exploration\ndelegate_task(subagent_type=\"explore\", load_skills=[], prompt=\"Find X patterns...\", run_in_background=true)\ndelegate_task(subagent_type=\"librarian\", load_skills=[], prompt=\"Find docs for Y...\", run_in_background=true)\n\n// WHILE THEY RUN - use direct tools for immediate context\ngrep(pattern=\"relevant_pattern\", path=\"src/\")\nread_file(filePath=\"known/important/file.ts\")\n\n// Collect background results when ready\ndeep_context = background_output(task_id=...)\n\n// Merge ALL findings for comprehensive understanding\n```\n\n**Plan agent (complex tasks only):**\n- Only if 5+ interdependent steps\n- Invoke AFTER gathering context from both tracks\n\n**Execute:**\n- Surgical, minimal changes matching existing patterns\n- If delegating: provide exhaustive context and success criteria\n\n**Verify:**\n- `lsp_diagnostics` on modified files\n- Run tests if available\n\n## QUALITY STANDARDS\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| Build | Run build command | Exit code 0 |\n| Test | Execute test suite | All tests pass |\n| Lint | Run lsp_diagnostics | Zero new errors |\n\n## COMPLETION CRITERIA\n\nA task is complete when:\n1. Requested functionality is fully implemented (not partial, not simplified)\n2. lsp_diagnostics shows zero errors on modified files\n3. Tests pass (or pre-existing failures documented)\n4. Code matches existing codebase patterns\n\n**Deliver exactly what was asked. No more, no less.**\n\n</ultrawork-mode>\n\n---\n\n";
14
+ export declare const ULTRAWORK_GPT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Think deeply before acting.\n\n<output_verbosity_spec>\n- Default: 3-6 sentences or \u22645 bullets for typical answers\n- Simple yes/no questions: \u22642 sentences\n- Complex multi-file tasks: 1 short overview paragraph + \u22645 bullets (What, Where, Risks, Next, Open)\n- Avoid long narrative paragraphs; prefer compact bullets\n- Do not rephrase the user's request unless it changes semantics\n</output_verbosity_spec>\n\n<scope_constraints>\n- Implement EXACTLY and ONLY what the user requests\n- No extra features, no added components, no embellishments\n- If any instruction is ambiguous, choose the simplest valid interpretation\n- Do NOT expand the task beyond what was asked\n</scope_constraints>\n\n## CERTAINTY PROTOCOL\n\n**Before implementation, ensure you have:**\n- Full understanding of the user's actual intent\n- Explored the codebase to understand existing patterns\n- A clear work plan (mental or written)\n- Resolved any ambiguities through exploration (not questions)\n\n<uncertainty_handling>\n- If the question is ambiguous or underspecified:\n - EXPLORE FIRST using tools (grep, file reads, explore agents)\n - If still unclear, state your interpretation and proceed\n - Ask clarifying questions ONLY as last resort\n- Never fabricate exact figures, line numbers, or references when uncertain\n- Prefer \"Based on the provided context...\" over absolute claims when unsure\n</uncertainty_handling>\n\n## DECISION FRAMEWORK: Self vs Delegate\n\n**Evaluate each task against these criteria to decide:**\n\n| Complexity | Criteria | Decision |\n|------------|----------|----------|\n| **Trivial** | <10 lines, single file, obvious pattern | **DO IT YOURSELF** |\n| **Moderate** | Single domain, clear pattern, <100 lines | **DO IT YOURSELF** (faster than delegation overhead) |\n| **Complex** | Multi-file, unfamiliar domain, >100 lines, needs specialized expertise | **DELEGATE** to appropriate category+skills |\n| **Research** | Need broad codebase context or external docs | **DELEGATE** to explore/librarian (background, parallel) |\n\n**Decision Factors:**\n- Delegation overhead \u2248 10-15 seconds. If task takes less, do it yourself.\n- If you already have full context loaded, do it yourself.\n- If task requires specialized expertise (frontend-ui-ux, git operations), delegate.\n- If you need information from multiple sources, fire parallel background agents.\n\n## AVAILABLE RESOURCES\n\nUse these when they provide clear value based on the decision framework above:\n\n| Resource | When to Use | How to Use |\n|----------|-------------|------------|\n| explore agent | Need codebase patterns you don't have | `task(subagent_type=\"explore\", run_in_background=true, ...)` |\n| librarian agent | External library docs, OSS examples | `task(subagent_type=\"librarian\", run_in_background=true, ...)` |\n| oracle agent | Stuck on architecture/debugging after 2+ attempts | `task(subagent_type=\"oracle\", ...)` |\n| plan agent | Complex multi-step with dependencies (5+ steps) | `task(subagent_type=\"plan\", ...)` |\n| task category | Specialized work matching a category | `task(category=\"...\", load_skills=[...])` |\n\n<tool_usage_rules>\n- Prefer tools over internal knowledge for fresh or user-specific data\n- Parallelize independent reads (read_file, grep, explore, librarian) to reduce latency\n- After any write/update, briefly restate: What changed, Where (path), Follow-up needed\n</tool_usage_rules>\n\n## EXECUTION PATTERN\n\n**Context gathering uses TWO parallel tracks:**\n\n| Track | Tools | Speed | Purpose |\n|-------|-------|-------|---------|\n| **Direct** | Grep, Read, LSP, AST-grep | Instant | Quick wins, known locations |\n| **Background** | explore, librarian agents | Async | Deep search, external docs |\n\n**ALWAYS run both tracks in parallel:**\n```\n// Fire background agents for deep exploration\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"Find X patterns...\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"Find docs for Y...\", run_in_background=true)\n\n// WHILE THEY RUN - use direct tools for immediate context\ngrep(pattern=\"relevant_pattern\", path=\"src/\")\nread_file(filePath=\"known/important/file.ts\")\n\n// Collect background results when ready\ndeep_context = background_output(task_id=...)\n\n// Merge ALL findings for comprehensive understanding\n```\n\n**Plan agent (complex tasks only):**\n- Only if 5+ interdependent steps\n- Invoke AFTER gathering context from both tracks\n\n**Execute:**\n- Surgical, minimal changes matching existing patterns\n- If delegating: provide exhaustive context and success criteria\n\n**Verify:**\n- `lsp_diagnostics` on modified files\n- Run tests if available\n\n## QUALITY STANDARDS\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| Build | Run build command | Exit code 0 |\n| Test | Execute test suite | All tests pass |\n| Lint | Run lsp_diagnostics | Zero new errors |\n\n## COMPLETION CRITERIA\n\nA task is complete when:\n1. Requested functionality is fully implemented (not partial, not simplified)\n2. lsp_diagnostics shows zero errors on modified files\n3. Tests pass (or pre-existing failures documented)\n4. Code matches existing codebase patterns\n\n**Deliver exactly what was asked. No more, no less.**\n\n</ultrawork-mode>\n\n---\n\n";
15
15
  export declare function getGptUltraworkMessage(): string;
@@ -2,5 +2,5 @@
2
2
  * Ultrawork message section for planner agents (Prometheus).
3
3
  * Planner agents should NOT be told to call plan agent - they ARE the planner.
4
4
  */
5
- export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.sisyphus/**/*.md` ONLY | Everything else |\n| Read | All files | - |\n| Bash | Research commands only | Implementation commands |\n| delegate_task | explore, librarian | - |\n\n**IF YOU TRY TO WRITE/EDIT OUTSIDE `.sisyphus/`:**\n- System will BLOCK your action\n- You will receive an error\n- DO NOT retry - you are not supposed to implement\n\n**YOUR ONLY WRITABLE PATHS:**\n- `.sisyphus/plans/*.md` - Final work plans\n- `.sisyphus/drafts/*.md` - Working drafts during interview\n\n**WHEN USER ASKS YOU TO IMPLEMENT:**\nREFUSE. Say: \"I'm a planner. I create work plans, not implementations. Run `/start-work` after I finish planning.\"\n\n---\n\n## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)\n\nYou ARE the planner. Your job: create bulletproof work plans.\n**Before drafting ANY plan, gather context via explore/librarian agents.**\n\n### Research Protocol\n1. **Fire parallel background agents** for comprehensive context:\n ```\n delegate_task(agent=\"explore\", prompt=\"Find existing patterns for [topic] in codebase\", background=true)\n delegate_task(agent=\"explore\", prompt=\"Find test infrastructure and conventions\", background=true)\n delegate_task(agent=\"librarian\", prompt=\"Find official docs and best practices for [technology]\", background=true)\n ```\n2. **Wait for results** before planning - rushed plans fail\n3. **Synthesize findings** into informed requirements\n\n### What to Research\n- Existing codebase patterns and conventions\n- Test infrastructure (TDD possible?)\n- External library APIs and constraints\n- Similar implementations in OSS (via librarian)\n\n**NEVER plan blind. Context first, plan second.**\n\n---\n\n## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST\n\n**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.**\n\nWhen you finalize a plan, you MUST structure it for maximum parallel execution:\n\n### 1. Parallel Execution Waves (REQUIRED)\n\nAnalyze task dependencies and group independent tasks into parallel waves:\n\n```\nWave 1 (Start Immediately - No Dependencies):\n\u251C\u2500\u2500 Task 1: [description] \u2192 category: X, skills: [a, b]\n\u2514\u2500\u2500 Task 4: [description] \u2192 category: Y, skills: [c]\n\nWave 2 (After Wave 1 Completes):\n\u251C\u2500\u2500 Task 2: [depends: 1] \u2192 category: X, skills: [a]\n\u251C\u2500\u2500 Task 3: [depends: 1] \u2192 category: Z, skills: [d]\n\u2514\u2500\u2500 Task 5: [depends: 4] \u2192 category: Y, skills: [c]\n\nWave 3 (After Wave 2 Completes):\n\u2514\u2500\u2500 Task 6: [depends: 2, 3] \u2192 category: X, skills: [a, b]\n\nCritical Path: Task 1 \u2192 Task 2 \u2192 Task 6\nEstimated Parallel Speedup: ~40% faster than sequential\n```\n\n### 2. Dependency Matrix (REQUIRED)\n\n| Task | Depends On | Blocks | Can Parallelize With |\n|------|------------|--------|---------------------|\n| 1 | None | 2, 3 | 4 |\n| 2 | 1 | 6 | 3, 5 |\n| 3 | 1 | 6 | 2, 5 |\n| 4 | None | 5 | 1 |\n| 5 | 4 | None | 2, 3 |\n| 6 | 2, 3 | None | None (final) |\n\n### 3. TODO List Structure (REQUIRED)\n\nEach TODO item MUST include:\n\n```markdown\n- [ ] N. [Task Title]\n\n **What to do**: [Clear steps]\n \n **Dependencies**: [Task numbers this depends on] | None\n **Blocks**: [Task numbers that depend on this]\n **Parallel Group**: Wave N (with Tasks X, Y)\n \n **Recommended Agent Profile**:\n - **Category**: `[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]`\n - **Skills**: [`skill-1`, `skill-2`]\n \n **Acceptance Criteria**: [Verifiable conditions]\n```\n\n### 4. Agent Dispatch Summary (REQUIRED)\n\n| Wave | Tasks | Dispatch Command |\n|------|-------|------------------|\n| 1 | 1, 4 | `delegate_task(category=\"...\", load_skills=[...], run_in_background=false)` \u00D7 2 |\n| 2 | 2, 3, 5 | `delegate_task(...)` \u00D7 3 after Wave 1 completes |\n| 3 | 6 | `delegate_task(...)` final integration |\n\n**WHY PARALLEL TASK GRAPH IS MANDATORY:**\n- Orchestrator (Sisyphus) executes tasks in parallel waves\n- Independent tasks run simultaneously via background agents\n- Proper dependency tracking prevents race conditions\n- Category + skills ensure optimal model routing per task";
5
+ export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.sisyphus/**/*.md` ONLY | Everything else |\n| Read | All files | - |\n| Bash | Research commands only | Implementation commands |\n| task | explore, librarian | - |\n\n**IF YOU TRY TO WRITE/EDIT OUTSIDE `.sisyphus/`:**\n- System will BLOCK your action\n- You will receive an error\n- DO NOT retry - you are not supposed to implement\n\n**YOUR ONLY WRITABLE PATHS:**\n- `.sisyphus/plans/*.md` - Final work plans\n- `.sisyphus/drafts/*.md` - Working drafts during interview\n\n**WHEN USER ASKS YOU TO IMPLEMENT:**\nREFUSE. Say: \"I'm a planner. I create work plans, not implementations. Run `/start-work` after I finish planning.\"\n\n---\n\n## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)\n\nYou ARE the planner. Your job: create bulletproof work plans.\n**Before drafting ANY plan, gather context via explore/librarian agents.**\n\n### Research Protocol\n1. **Fire parallel background agents** for comprehensive context:\n ```\n task(agent=\"explore\", prompt=\"Find existing patterns for [topic] in codebase\", background=true)\n task(agent=\"explore\", prompt=\"Find test infrastructure and conventions\", background=true)\n task(agent=\"librarian\", prompt=\"Find official docs and best practices for [technology]\", background=true)\n ```\n2. **Wait for results** before planning - rushed plans fail\n3. **Synthesize findings** into informed requirements\n\n### What to Research\n- Existing codebase patterns and conventions\n- Test infrastructure (TDD possible?)\n- External library APIs and constraints\n- Similar implementations in OSS (via librarian)\n\n**NEVER plan blind. Context first, plan second.**\n\n---\n\n## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST\n\n**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.**\n\nWhen you finalize a plan, you MUST structure it for maximum parallel execution:\n\n### 1. Parallel Execution Waves (REQUIRED)\n\nAnalyze task dependencies and group independent tasks into parallel waves:\n\n```\nWave 1 (Start Immediately - No Dependencies):\n\u251C\u2500\u2500 Task 1: [description] \u2192 category: X, skills: [a, b]\n\u2514\u2500\u2500 Task 4: [description] \u2192 category: Y, skills: [c]\n\nWave 2 (After Wave 1 Completes):\n\u251C\u2500\u2500 Task 2: [depends: 1] \u2192 category: X, skills: [a]\n\u251C\u2500\u2500 Task 3: [depends: 1] \u2192 category: Z, skills: [d]\n\u2514\u2500\u2500 Task 5: [depends: 4] \u2192 category: Y, skills: [c]\n\nWave 3 (After Wave 2 Completes):\n\u2514\u2500\u2500 Task 6: [depends: 2, 3] \u2192 category: X, skills: [a, b]\n\nCritical Path: Task 1 \u2192 Task 2 \u2192 Task 6\nEstimated Parallel Speedup: ~40% faster than sequential\n```\n\n### 2. Dependency Matrix (REQUIRED)\n\n| Task | Depends On | Blocks | Can Parallelize With |\n|------|------------|--------|---------------------|\n| 1 | None | 2, 3 | 4 |\n| 2 | 1 | 6 | 3, 5 |\n| 3 | 1 | 6 | 2, 5 |\n| 4 | None | 5 | 1 |\n| 5 | 4 | None | 2, 3 |\n| 6 | 2, 3 | None | None (final) |\n\n### 3. TODO List Structure (REQUIRED)\n\nEach TODO item MUST include:\n\n```markdown\n- [ ] N. [Task Title]\n\n **What to do**: [Clear steps]\n \n **Dependencies**: [Task numbers this depends on] | None\n **Blocks**: [Task numbers that depend on this]\n **Parallel Group**: Wave N (with Tasks X, Y)\n \n **Recommended Agent Profile**:\n - **Category**: `[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]`\n - **Skills**: [`skill-1`, `skill-2`]\n \n **Acceptance Criteria**: [Verifiable conditions]\n```\n\n### 4. Agent Dispatch Summary (REQUIRED)\n\n| Wave | Tasks | Dispatch Command |\n|------|-------|------------------|\n| 1 | 1, 4 | `task(category=\"...\", load_skills=[...], run_in_background=false)` \u00D7 2 |\n| 2 | 2, 3, 5 | `task(...)` \u00D7 3 after Wave 1 completes |\n| 3 | 6 | `task(...)` final integration |\n\n**WHY PARALLEL TASK GRAPH IS MANDATORY:**\n- Orchestrator (Sisyphus) executes tasks in parallel waves\n- Independent tasks run simultaneously via background agents\n- Proper dependency tracking prevents race conditions\n- Category + skills ensure optimal model routing per task";
6
6
  export declare function getPlannerUltraworkMessage(): string;
@@ -1,3 +1,3 @@
1
1
  export declare const HOOK_NAME = "tasks-todowrite-disabler";
2
2
  export declare const BLOCKED_TOOLS: string[];
3
- export declare const REPLACEMENT_MESSAGE = "TodoRead/TodoWrite are DISABLED because experimental.task_system is enabled.\n\n**ACTION REQUIRED**: RE-REGISTER what you were about to write as Todo using Task tools NOW. Then ASSIGN yourself and START WORKING immediately.\n\n**Use these tools instead:**\n- TaskCreate: Create new task with auto-generated ID\n- TaskUpdate: Update status, assign owner, add dependencies\n- TaskList: List active tasks with dependency info\n- TaskGet: Get full task details\n\n**Workflow:**\n1. TaskCreate({ subject: \"your task description\" })\n2. TaskUpdate({ id: \"T-xxx\", status: \"in_progress\", owner: \"your-thread-id\" })\n3. DO THE WORK\n4. TaskUpdate({ id: \"T-xxx\", status: \"completed\" })\n\nCRITICAL: 1 task = 1 delegate_task. Fire independent tasks concurrently.\n\n**STOP! DO NOT START WORKING DIRECTLY - NO MATTER HOW SMALL THE TASK!**\nEven if the task seems trivial (1 line fix, simple edit, quick change), you MUST:\n1. FIRST register it with TaskCreate\n2. THEN mark it in_progress\n3. ONLY THEN do the actual work\n4. FINALLY mark it completed\n\n**WHY?** Task tracking = visibility = accountability. Skipping registration = invisible work = chaos.\n\nDO NOT retry TodoWrite. Convert to TaskCreate NOW.";
3
+ export declare const REPLACEMENT_MESSAGE = "TodoRead/TodoWrite are DISABLED because experimental.task_system is enabled.\n\n**ACTION REQUIRED**: RE-REGISTER what you were about to write as Todo using Task tools NOW. Then ASSIGN yourself and START WORKING immediately.\n\n**Use these tools instead:**\n- TaskCreate: Create new task with auto-generated ID\n- TaskUpdate: Update status, assign owner, add dependencies\n- TaskList: List active tasks with dependency info\n- TaskGet: Get full task details\n\n**Workflow:**\n1. TaskCreate({ subject: \"your task description\" })\n2. TaskUpdate({ id: \"T-xxx\", status: \"in_progress\", owner: \"your-thread-id\" })\n3. DO THE WORK\n4. TaskUpdate({ id: \"T-xxx\", status: \"completed\" })\n\nCRITICAL: 1 task = 1 task. Fire independent tasks concurrently.\n\n**STOP! DO NOT START WORKING DIRECTLY - NO MATTER HOW SMALL THE TASK!**\nEven if the task seems trivial (1 line fix, simple edit, quick change), you MUST:\n1. FIRST register it with TaskCreate\n2. THEN mark it in_progress\n3. ONLY THEN do the actual work\n4. FINALLY mark it completed\n\n**WHY?** Task tracking = visibility = accountability. Skipping registration = invisible work = chaos.\n\nDO NOT retry TodoWrite. Convert to TaskCreate NOW.";
@@ -32,6 +32,25 @@ type BabysitterContext = {
32
32
  directory?: string;
33
33
  };
34
34
  }) => Promise<unknown>;
35
+ promptAsync: (args: {
36
+ path: {
37
+ id: string;
38
+ };
39
+ body: {
40
+ parts: Array<{
41
+ type: "text";
42
+ text: string;
43
+ }>;
44
+ agent?: string;
45
+ model?: {
46
+ providerID: string;
47
+ modelID: string;
48
+ };
49
+ };
50
+ query?: {
51
+ directory?: string;
52
+ };
53
+ }) => Promise<unknown>;
35
54
  };
36
55
  };
37
56
  };
@@ -0,0 +1,2 @@
1
+ import type { Hooks, PluginInput } from "@opencode-ai/plugin";
2
+ export declare function createWriteExistingFileGuardHook(ctx: PluginInput): Hooks;