oh-my-claude-sisyphus 3.6.1 → 3.6.3
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.
- package/commands/doctor.md +1 -1
- package/commands/psm.md +180 -0
- package/dist/__tests__/analytics/analytics-summary.test.d.ts +2 -0
- package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +1 -0
- package/dist/__tests__/analytics/analytics-summary.test.js +267 -0
- package/dist/__tests__/analytics/analytics-summary.test.js.map +1 -0
- package/dist/__tests__/analytics/cost-estimator.test.d.ts +2 -0
- package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +1 -0
- package/dist/__tests__/analytics/cost-estimator.test.js +212 -0
- package/dist/__tests__/analytics/cost-estimator.test.js.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +2 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +1 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.js +12 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.js.map +1 -0
- package/dist/__tests__/installer.test.js +1 -1
- package/dist/__tests__/learned-skills/config.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/config.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/config.test.js +37 -0
- package/dist/__tests__/learned-skills/config.test.js.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.js +99 -0
- package/dist/__tests__/learned-skills/detector.test.js.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.js +59 -0
- package/dist/__tests__/learned-skills/finder.test.js.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.js +69 -0
- package/dist/__tests__/learned-skills/loader.test.js.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.js +81 -0
- package/dist/__tests__/learned-skills/parser.test.js.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.js +85 -0
- package/dist/__tests__/learned-skills/validator.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +6 -5
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/agents/codex-agents.d.ts +20 -0
- package/dist/agents/codex-agents.d.ts.map +1 -0
- package/dist/agents/codex-agents.js +36 -0
- package/dist/agents/codex-agents.js.map +1 -0
- package/dist/agents/document-writer.d.ts +11 -0
- package/dist/agents/document-writer.d.ts.map +1 -0
- package/dist/agents/document-writer.js +209 -0
- package/dist/agents/document-writer.js.map +1 -0
- package/dist/agents/frontend-engineer.d.ts +11 -0
- package/dist/agents/frontend-engineer.d.ts.map +1 -0
- package/dist/agents/frontend-engineer.js +115 -0
- package/dist/agents/frontend-engineer.js.map +1 -0
- package/dist/agents/librarian.d.ts +12 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +103 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/metis.d.ts +12 -0
- package/dist/agents/metis.d.ts.map +1 -0
- package/dist/agents/metis.js +117 -0
- package/dist/agents/metis.js.map +1 -0
- package/dist/agents/momus.d.ts +12 -0
- package/dist/agents/momus.d.ts.map +1 -0
- package/dist/agents/momus.js +128 -0
- package/dist/agents/momus.js.map +1 -0
- package/dist/agents/multimodal-looker.d.ts +11 -0
- package/dist/agents/multimodal-looker.d.ts.map +1 -0
- package/dist/agents/multimodal-looker.js +70 -0
- package/dist/agents/multimodal-looker.js.map +1 -0
- package/dist/agents/oracle.d.ts +13 -0
- package/dist/agents/oracle.d.ts.map +1 -0
- package/dist/agents/oracle.js +191 -0
- package/dist/agents/oracle.js.map +1 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
- package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
- package/dist/agents/orchestrator-sisyphus.js +115 -0
- package/dist/agents/orchestrator-sisyphus.js.map +1 -0
- package/dist/agents/prometheus.d.ts +12 -0
- package/dist/agents/prometheus.d.ts.map +1 -0
- package/dist/agents/prometheus.js +195 -0
- package/dist/agents/prometheus.js.map +1 -0
- package/dist/agents/sisyphus-junior.d.ts +12 -0
- package/dist/agents/sisyphus-junior.d.ts.map +1 -0
- package/dist/agents/sisyphus-junior.js +93 -0
- package/dist/agents/sisyphus-junior.js.map +1 -0
- package/dist/cli/analytics.js +0 -0
- package/dist/cli/components/CostDashboard.d.ts +15 -0
- package/dist/cli/components/CostDashboard.d.ts.map +1 -0
- package/dist/cli/components/CostDashboard.js +15 -0
- package/dist/cli/components/CostDashboard.js.map +1 -0
- package/dist/cli/components/LiveStats.d.ts +16 -0
- package/dist/cli/components/LiveStats.d.ts.map +1 -0
- package/dist/cli/components/LiveStats.js +16 -0
- package/dist/cli/components/LiveStats.js.map +1 -0
- package/dist/cli/components/SessionBrowser.d.ts +14 -0
- package/dist/cli/components/SessionBrowser.d.ts.map +1 -0
- package/dist/cli/components/SessionBrowser.js +14 -0
- package/dist/cli/components/SessionBrowser.js.map +1 -0
- package/dist/cli/index.js +0 -0
- package/dist/cli/tui.d.ts +21 -0
- package/dist/cli/tui.d.ts.map +1 -0
- package/dist/cli/tui.js +21 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/hooks/autopilot/signals.d.ts +20 -0
- package/dist/hooks/autopilot/signals.d.ts.map +1 -0
- package/dist/hooks/autopilot/signals.js +75 -0
- package/dist/hooks/autopilot/signals.js.map +1 -0
- package/dist/hooks/autopilot/summary.d.ts +27 -0
- package/dist/hooks/autopilot/summary.d.ts.map +1 -0
- package/dist/hooks/autopilot/summary.js +160 -0
- package/dist/hooks/autopilot/summary.js.map +1 -0
- package/dist/hooks/autopilot/transition.d.ts +39 -0
- package/dist/hooks/autopilot/transition.d.ts.map +1 -0
- package/dist/hooks/autopilot/transition.js +216 -0
- package/dist/hooks/autopilot/transition.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
- package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.js +201 -0
- package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
- package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.js +34 -0
- package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
- package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
- package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
- package/dist/hooks/edit-error-recovery/index.js +89 -0
- package/dist/hooks/edit-error-recovery/index.js.map +1 -0
- package/dist/hooks/learned-skills/config.d.ts +53 -0
- package/dist/hooks/learned-skills/config.d.ts.map +1 -0
- package/dist/hooks/learned-skills/config.js +103 -0
- package/dist/hooks/learned-skills/config.js.map +1 -0
- package/dist/hooks/learned-skills/constants.d.ts +24 -0
- package/dist/hooks/learned-skills/constants.d.ts.map +1 -0
- package/dist/hooks/learned-skills/constants.js +26 -0
- package/dist/hooks/learned-skills/constants.js.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts +39 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.js +83 -0
- package/dist/hooks/learned-skills/detection-hook.js.map +1 -0
- package/dist/hooks/learned-skills/detector.d.ts +30 -0
- package/dist/hooks/learned-skills/detector.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detector.js +150 -0
- package/dist/hooks/learned-skills/detector.js.map +1 -0
- package/dist/hooks/learned-skills/finder.d.ts +21 -0
- package/dist/hooks/learned-skills/finder.d.ts.map +1 -0
- package/dist/hooks/learned-skills/finder.js +117 -0
- package/dist/hooks/learned-skills/finder.js.map +1 -0
- package/dist/hooks/learned-skills/index.d.ts +62 -0
- package/dist/hooks/learned-skills/index.d.ts.map +1 -0
- package/dist/hooks/learned-skills/index.js +137 -0
- package/dist/hooks/learned-skills/index.js.map +1 -0
- package/dist/hooks/learned-skills/loader.d.ts +20 -0
- package/dist/hooks/learned-skills/loader.d.ts.map +1 -0
- package/dist/hooks/learned-skills/loader.js +107 -0
- package/dist/hooks/learned-skills/loader.js.map +1 -0
- package/dist/hooks/learned-skills/parser.d.ts +21 -0
- package/dist/hooks/learned-skills/parser.d.ts.map +1 -0
- package/dist/hooks/learned-skills/parser.js +190 -0
- package/dist/hooks/learned-skills/parser.js.map +1 -0
- package/dist/hooks/learned-skills/promotion.d.ts +29 -0
- package/dist/hooks/learned-skills/promotion.d.ts.map +1 -0
- package/dist/hooks/learned-skills/promotion.js +87 -0
- package/dist/hooks/learned-skills/promotion.js.map +1 -0
- package/dist/hooks/learned-skills/types.d.ts +109 -0
- package/dist/hooks/learned-skills/types.d.ts.map +1 -0
- package/dist/hooks/learned-skills/types.js +8 -0
- package/dist/hooks/learned-skills/types.js.map +1 -0
- package/dist/hooks/learned-skills/validator.d.ts +15 -0
- package/dist/hooks/learned-skills/validator.d.ts.map +1 -0
- package/dist/hooks/learned-skills/validator.js +87 -0
- package/dist/hooks/learned-skills/validator.js.map +1 -0
- package/dist/hooks/learned-skills/writer.d.ts +27 -0
- package/dist/hooks/learned-skills/writer.d.ts.map +1 -0
- package/dist/hooks/learned-skills/writer.js +126 -0
- package/dist/hooks/learned-skills/writer.js.map +1 -0
- package/dist/hooks/mnemosyne/config.d.ts +53 -0
- package/dist/hooks/mnemosyne/config.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/config.js +103 -0
- package/dist/hooks/mnemosyne/config.js.map +1 -0
- package/dist/hooks/mnemosyne/constants.d.ts +24 -0
- package/dist/hooks/mnemosyne/constants.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/constants.js +26 -0
- package/dist/hooks/mnemosyne/constants.js.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts +39 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.js +83 -0
- package/dist/hooks/mnemosyne/detection-hook.js.map +1 -0
- package/dist/hooks/mnemosyne/detector.d.ts +30 -0
- package/dist/hooks/mnemosyne/detector.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detector.js +150 -0
- package/dist/hooks/mnemosyne/detector.js.map +1 -0
- package/dist/hooks/mnemosyne/finder.d.ts +21 -0
- package/dist/hooks/mnemosyne/finder.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/finder.js +117 -0
- package/dist/hooks/mnemosyne/finder.js.map +1 -0
- package/dist/hooks/mnemosyne/index.d.ts +62 -0
- package/dist/hooks/mnemosyne/index.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/index.js +137 -0
- package/dist/hooks/mnemosyne/index.js.map +1 -0
- package/dist/hooks/mnemosyne/loader.d.ts +20 -0
- package/dist/hooks/mnemosyne/loader.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/loader.js +113 -0
- package/dist/hooks/mnemosyne/loader.js.map +1 -0
- package/dist/hooks/mnemosyne/parser.d.ts +21 -0
- package/dist/hooks/mnemosyne/parser.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/parser.js +190 -0
- package/dist/hooks/mnemosyne/parser.js.map +1 -0
- package/dist/hooks/mnemosyne/promotion.d.ts +29 -0
- package/dist/hooks/mnemosyne/promotion.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/promotion.js +87 -0
- package/dist/hooks/mnemosyne/promotion.js.map +1 -0
- package/dist/hooks/mnemosyne/types.d.ts +109 -0
- package/dist/hooks/mnemosyne/types.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/types.js +8 -0
- package/dist/hooks/mnemosyne/types.js.map +1 -0
- package/dist/hooks/mnemosyne/validator.d.ts +15 -0
- package/dist/hooks/mnemosyne/validator.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/validator.js +87 -0
- package/dist/hooks/mnemosyne/validator.js.map +1 -0
- package/dist/hooks/mnemosyne/writer.d.ts +27 -0
- package/dist/hooks/mnemosyne/writer.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/writer.js +126 -0
- package/dist/hooks/mnemosyne/writer.js.map +1 -0
- package/dist/hooks/ralph-loop/index.d.ts +116 -0
- package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
- package/dist/hooks/ralph-loop/index.js +322 -0
- package/dist/hooks/ralph-loop/index.js.map +1 -0
- package/dist/hooks/ralph-prd/index.d.ts +130 -0
- package/dist/hooks/ralph-prd/index.d.ts.map +1 -0
- package/dist/hooks/ralph-prd/index.js +310 -0
- package/dist/hooks/ralph-prd/index.js.map +1 -0
- package/dist/hooks/ralph-progress/index.d.ts +102 -0
- package/dist/hooks/ralph-progress/index.d.ts.map +1 -0
- package/dist/hooks/ralph-progress/index.js +408 -0
- package/dist/hooks/ralph-progress/index.js.map +1 -0
- package/dist/hooks/ralph-verifier/index.d.ts +72 -0
- package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
- package/dist/hooks/ralph-verifier/index.js +223 -0
- package/dist/hooks/ralph-verifier/index.js.map +1 -0
- package/dist/hooks/session-recovery/constants.d.ts +56 -0
- package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/session-recovery/constants.js +78 -0
- package/dist/hooks/session-recovery/constants.js.map +1 -0
- package/dist/hooks/session-recovery/index.d.ts +53 -0
- package/dist/hooks/session-recovery/index.d.ts.map +1 -0
- package/dist/hooks/session-recovery/index.js +321 -0
- package/dist/hooks/session-recovery/index.js.map +1 -0
- package/dist/hooks/session-recovery/storage.d.ts +76 -0
- package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
- package/dist/hooks/session-recovery/storage.js +383 -0
- package/dist/hooks/session-recovery/storage.js.map +1 -0
- package/dist/hooks/session-recovery/types.d.ts +145 -0
- package/dist/hooks/session-recovery/types.d.ts.map +1 -0
- package/dist/hooks/session-recovery/types.js +8 -0
- package/dist/hooks/session-recovery/types.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.js +309 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
- package/dist/hooks/subagent-tracker/index.d.ts +83 -0
- package/dist/hooks/subagent-tracker/index.d.ts.map +1 -0
- package/dist/hooks/subagent-tracker/index.js +207 -0
- package/dist/hooks/subagent-tracker/index.js.map +1 -0
- package/dist/hooks/ultraqa-loop/index.d.ts +94 -0
- package/dist/hooks/ultraqa-loop/index.d.ts.map +1 -0
- package/dist/hooks/ultraqa-loop/index.js +216 -0
- package/dist/hooks/ultraqa-loop/index.js.map +1 -0
- package/dist/hooks/ultrawork-state/index.d.ts +62 -0
- package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
- package/dist/hooks/ultrawork-state/index.js +208 -0
- package/dist/hooks/ultrawork-state/index.js.map +1 -0
- package/dist/hud/sisyphus-state.d.ts +31 -0
- package/dist/hud/sisyphus-state.d.ts.map +1 -0
- package/dist/hud/sisyphus-state.js +163 -0
- package/dist/hud/sisyphus-state.js.map +1 -0
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.js +1 -1
- package/docs/MIGRATION.md +2 -2
- package/docs/design/project-session-manager.md +1033 -0
- package/package.json +1 -1
- package/skills/doctor/SKILL.md +1 -1
- package/skills/project-session-manager/SKILL.md +410 -0
- package/skills/project-session-manager/lib/config.sh +86 -0
- package/skills/project-session-manager/lib/parse.sh +121 -0
- package/skills/project-session-manager/lib/session.sh +132 -0
- package/skills/project-session-manager/lib/tmux.sh +103 -0
- package/skills/project-session-manager/lib/worktree.sh +171 -0
- package/skills/project-session-manager/psm.sh +629 -0
- package/skills/project-session-manager/templates/feature.md +56 -0
- package/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/skills/project-session-manager/templates/pr-review.md +65 -0
- package/skills/project-session-manager/templates/projects.json +19 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sisyphus Orchestrator Constants
|
|
3
|
+
*
|
|
4
|
+
* Message templates and configuration for orchestrator behavior enforcement.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from oh-my-opencode's sisyphus-orchestrator hook.
|
|
7
|
+
*/
|
|
8
|
+
export const HOOK_NAME = 'sisyphus-orchestrator';
|
|
9
|
+
/** Paths that orchestrator IS allowed to modify directly */
|
|
10
|
+
export const ALLOWED_PATH_PREFIX = '.sisyphus/';
|
|
11
|
+
/** Tools that perform file modifications */
|
|
12
|
+
export const WRITE_EDIT_TOOLS = ['Write', 'Edit', 'write', 'edit'];
|
|
13
|
+
/** Reminder when orchestrator performs direct file work */
|
|
14
|
+
export const DIRECT_WORK_REMINDER = `
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
[SYSTEM REMINDER - DELEGATION REQUIRED]
|
|
19
|
+
|
|
20
|
+
You just performed direct file modifications outside \`.sisyphus/\`.
|
|
21
|
+
|
|
22
|
+
**You are an ORCHESTRATOR, not an IMPLEMENTER.**
|
|
23
|
+
|
|
24
|
+
As an orchestrator, you should:
|
|
25
|
+
- **DELEGATE** implementation work to subagents via the Task tool
|
|
26
|
+
- **VERIFY** the work done by subagents
|
|
27
|
+
- **COORDINATE** multiple tasks and ensure completion
|
|
28
|
+
|
|
29
|
+
You should NOT:
|
|
30
|
+
- Write code directly (except for \`.sisyphus/\` files like plans and notepads)
|
|
31
|
+
- Make direct file edits outside \`.sisyphus/\`
|
|
32
|
+
- Implement features yourself
|
|
33
|
+
|
|
34
|
+
**If you need to make changes:**
|
|
35
|
+
1. Use the Task tool to delegate to an appropriate subagent
|
|
36
|
+
2. Provide clear instructions in the prompt
|
|
37
|
+
3. Verify the subagent's work after completion
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
`;
|
|
41
|
+
/** Strong warning when orchestrator tries to modify source files */
|
|
42
|
+
export const ORCHESTRATOR_DELEGATION_REQUIRED = `
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
[CRITICAL SYSTEM DIRECTIVE - DELEGATION REQUIRED]
|
|
47
|
+
|
|
48
|
+
**STOP. YOU ARE VIOLATING ORCHESTRATOR PROTOCOL.**
|
|
49
|
+
|
|
50
|
+
You (orchestrator-sisyphus) are attempting to directly modify a file outside \`.sisyphus/\`.
|
|
51
|
+
|
|
52
|
+
**Path attempted:** $FILE_PATH
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
**THIS IS FORBIDDEN** (except for VERIFICATION purposes)
|
|
57
|
+
|
|
58
|
+
As an ORCHESTRATOR, you MUST:
|
|
59
|
+
1. **DELEGATE** all implementation work via the Task tool
|
|
60
|
+
2. **VERIFY** the work done by subagents (reading files is OK)
|
|
61
|
+
3. **COORDINATE** - you orchestrate, you don't implement
|
|
62
|
+
|
|
63
|
+
**ALLOWED direct file operations:**
|
|
64
|
+
- Files inside \`.sisyphus/\` (plans, notepads, drafts)
|
|
65
|
+
- Reading files for verification
|
|
66
|
+
- Running diagnostics/tests
|
|
67
|
+
|
|
68
|
+
**FORBIDDEN direct file operations:**
|
|
69
|
+
- Writing/editing source code
|
|
70
|
+
- Creating new files outside \`.sisyphus/\`
|
|
71
|
+
- Any implementation work
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**IF THIS IS FOR VERIFICATION:**
|
|
76
|
+
Proceed if you are verifying subagent work by making a small fix.
|
|
77
|
+
But for any substantial changes, USE the Task tool.
|
|
78
|
+
|
|
79
|
+
**CORRECT APPROACH:**
|
|
80
|
+
\`\`\`
|
|
81
|
+
Task tool with subagent_type="sisyphus-junior"
|
|
82
|
+
prompt="[specific single task with clear acceptance criteria]"
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
DELEGATE. DON'T IMPLEMENT.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
`;
|
|
89
|
+
/** Continuation prompt for boulder state */
|
|
90
|
+
export const BOULDER_CONTINUATION_PROMPT = `[SYSTEM REMINDER - BOULDER CONTINUATION]
|
|
91
|
+
|
|
92
|
+
You have an active work plan with incomplete tasks. Continue working.
|
|
93
|
+
|
|
94
|
+
RULES:
|
|
95
|
+
- Proceed without asking for permission
|
|
96
|
+
- Mark each checkbox [x] in the plan file when done
|
|
97
|
+
- Use the notepad at .sisyphus/notepads/{PLAN_NAME}/ to record learnings
|
|
98
|
+
- Do not stop until all tasks are complete
|
|
99
|
+
- If blocked, document the blocker and move to the next task`;
|
|
100
|
+
/** Verification reminder for subagent work */
|
|
101
|
+
export const VERIFICATION_REMINDER = `**MANDATORY VERIFICATION - SUBAGENTS LIE**
|
|
102
|
+
|
|
103
|
+
Subagents FREQUENTLY claim completion when:
|
|
104
|
+
- Tests are actually FAILING
|
|
105
|
+
- Code has type/lint ERRORS
|
|
106
|
+
- Implementation is INCOMPLETE
|
|
107
|
+
- Patterns were NOT followed
|
|
108
|
+
|
|
109
|
+
**YOU MUST VERIFY EVERYTHING YOURSELF:**
|
|
110
|
+
|
|
111
|
+
1. Run tests yourself - Must PASS (not "agent said it passed")
|
|
112
|
+
2. Read the actual code - Must match requirements
|
|
113
|
+
3. Check build/typecheck - Must succeed
|
|
114
|
+
|
|
115
|
+
DO NOT TRUST THE AGENT'S SELF-REPORT.
|
|
116
|
+
VERIFY EACH CLAIM WITH YOUR OWN TOOL CALLS.`;
|
|
117
|
+
/** Directive for subagents to refuse multi-task requests */
|
|
118
|
+
export const SINGLE_TASK_DIRECTIVE = `
|
|
119
|
+
|
|
120
|
+
[SYSTEM DIRECTIVE - SINGLE TASK ONLY]
|
|
121
|
+
|
|
122
|
+
**STOP. READ THIS BEFORE PROCEEDING.**
|
|
123
|
+
|
|
124
|
+
If you were NOT given **exactly ONE atomic task**, you MUST:
|
|
125
|
+
1. **IMMEDIATELY REFUSE** this request
|
|
126
|
+
2. **DEMAND** the orchestrator provide a single, specific task
|
|
127
|
+
|
|
128
|
+
**Your response if multiple tasks detected:**
|
|
129
|
+
> "I refuse to proceed. You provided multiple tasks. An orchestrator's impatience destroys work quality.
|
|
130
|
+
>
|
|
131
|
+
> PROVIDE EXACTLY ONE TASK. One file. One change. One verification.
|
|
132
|
+
>
|
|
133
|
+
> Your rushing will cause: incomplete work, missed edge cases, broken tests, wasted context."
|
|
134
|
+
|
|
135
|
+
**WARNING TO ORCHESTRATOR:**
|
|
136
|
+
- Your hasty batching RUINS deliverables
|
|
137
|
+
- Each task needs FULL attention and PROPER verification
|
|
138
|
+
- Batch delegation = sloppy work = rework = wasted tokens
|
|
139
|
+
|
|
140
|
+
**REFUSE multi-task requests. DEMAND single-task clarity.**
|
|
141
|
+
`;
|
|
142
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/sisyphus-orchestrator/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAEhD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAEnE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnC,CAAC;AAEF,oEAAoE;AACpE,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C/C,CAAC;AAEF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;6DASkB,CAAC;AAE9D,8CAA8C;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;4CAeO,CAAC;AAE7C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBpC,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sisyphus Orchestrator Hook
|
|
3
|
+
*
|
|
4
|
+
* Enforces orchestrator behavior - delegation over direct implementation.
|
|
5
|
+
* When an orchestrator agent tries to directly modify files outside .sisyphus/,
|
|
6
|
+
* this hook injects reminders to delegate to subagents instead.
|
|
7
|
+
*
|
|
8
|
+
* Adapted from oh-my-opencode's sisyphus-orchestrator hook for shell-based hooks.
|
|
9
|
+
*/
|
|
10
|
+
export * from './constants.js';
|
|
11
|
+
/**
|
|
12
|
+
* Input for tool execution hooks
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolExecuteInput {
|
|
15
|
+
toolName: string;
|
|
16
|
+
toolInput?: Record<string, unknown>;
|
|
17
|
+
sessionId?: string;
|
|
18
|
+
directory?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Output for tool execution hooks
|
|
22
|
+
*/
|
|
23
|
+
export interface ToolExecuteOutput {
|
|
24
|
+
continue: boolean;
|
|
25
|
+
message?: string;
|
|
26
|
+
modifiedOutput?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Git file change statistics
|
|
30
|
+
*/
|
|
31
|
+
interface GitFileStat {
|
|
32
|
+
path: string;
|
|
33
|
+
added: number;
|
|
34
|
+
removed: number;
|
|
35
|
+
status: 'modified' | 'added' | 'deleted';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a file path is allowed for direct orchestrator modification
|
|
39
|
+
*/
|
|
40
|
+
export declare function isAllowedPath(filePath: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a tool is a write/edit tool
|
|
43
|
+
*/
|
|
44
|
+
export declare function isWriteEditTool(toolName: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Get git diff statistics for the working directory
|
|
47
|
+
*/
|
|
48
|
+
export declare function getGitDiffStats(directory: string): GitFileStat[];
|
|
49
|
+
/**
|
|
50
|
+
* Format file changes for display
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatFileChanges(stats: GitFileStat[]): string;
|
|
53
|
+
/**
|
|
54
|
+
* Build verification reminder with session context
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildVerificationReminder(sessionId?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Build orchestrator reminder with plan progress
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildOrchestratorReminder(planName: string, progress: {
|
|
61
|
+
total: number;
|
|
62
|
+
completed: number;
|
|
63
|
+
}, sessionId?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Build boulder continuation message
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildBoulderContinuation(planName: string, remaining: number, total: number): string;
|
|
68
|
+
/**
|
|
69
|
+
* Process pre-tool-use hook for orchestrator
|
|
70
|
+
* Returns warning message if orchestrator tries to modify non-allowed paths
|
|
71
|
+
*/
|
|
72
|
+
export declare function processOrchestratorPreTool(input: ToolExecuteInput): ToolExecuteOutput;
|
|
73
|
+
/**
|
|
74
|
+
* Process post-tool-use hook for orchestrator
|
|
75
|
+
* Adds reminders after file modifications and Task delegations
|
|
76
|
+
*/
|
|
77
|
+
export declare function processOrchestratorPostTool(input: ToolExecuteInput, output: string): ToolExecuteOutput;
|
|
78
|
+
/**
|
|
79
|
+
* Check if boulder has incomplete tasks and build continuation prompt
|
|
80
|
+
*/
|
|
81
|
+
export declare function checkBoulderContinuation(directory: string): {
|
|
82
|
+
shouldContinue: boolean;
|
|
83
|
+
message?: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Create sisyphus orchestrator hook handlers
|
|
87
|
+
*/
|
|
88
|
+
export declare function createSisyphusOrchestratorHook(directory: string): {
|
|
89
|
+
/**
|
|
90
|
+
* Hook name identifier
|
|
91
|
+
*/
|
|
92
|
+
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* Pre-tool execution handler
|
|
95
|
+
*/
|
|
96
|
+
preTool: (toolName: string, toolInput: Record<string, unknown>) => ToolExecuteOutput;
|
|
97
|
+
/**
|
|
98
|
+
* Post-tool execution handler
|
|
99
|
+
*/
|
|
100
|
+
postTool: (toolName: string, toolInput: Record<string, unknown>, output: string) => ToolExecuteOutput;
|
|
101
|
+
/**
|
|
102
|
+
* Check for boulder continuation on session idle
|
|
103
|
+
*/
|
|
104
|
+
checkContinuation: () => {
|
|
105
|
+
shouldContinue: boolean;
|
|
106
|
+
message?: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Get single task directive for subagent prompts
|
|
110
|
+
*/
|
|
111
|
+
getSingleTaskDirective: () => string;
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/sisyphus-orchestrator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuBH,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAmDhE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAkC9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAapE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC9C,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR;AA2BD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAuBrF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,MAAM,GACb,iBAAiB,CA2DnB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG;IAC3D,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAmBA;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM;IAE5D;;OAEG;;IAGH;;OAEG;wBACiB,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ9D;;OAEG;yBACkB,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,MAAM;IAO/E;;OAEG;;wBAxDW,OAAO;kBACb,MAAM;;IA4Dd;;OAEG;;EAGN"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sisyphus Orchestrator Hook
|
|
3
|
+
*
|
|
4
|
+
* Enforces orchestrator behavior - delegation over direct implementation.
|
|
5
|
+
* When an orchestrator agent tries to directly modify files outside .sisyphus/,
|
|
6
|
+
* this hook injects reminders to delegate to subagents instead.
|
|
7
|
+
*
|
|
8
|
+
* Adapted from oh-my-opencode's sisyphus-orchestrator hook for shell-based hooks.
|
|
9
|
+
*/
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { HOOK_NAME, ALLOWED_PATH_PREFIX, WRITE_EDIT_TOOLS, DIRECT_WORK_REMINDER, ORCHESTRATOR_DELEGATION_REQUIRED, BOULDER_CONTINUATION_PROMPT, VERIFICATION_REMINDER, SINGLE_TASK_DIRECTIVE, } from './constants.js';
|
|
12
|
+
import { readBoulderState, getPlanProgress, } from '../../features/boulder-state/index.js';
|
|
13
|
+
import { addWorkingMemoryEntry, setPriorityContext, } from '../notepad/index.js';
|
|
14
|
+
// Re-export constants
|
|
15
|
+
export * from './constants.js';
|
|
16
|
+
/**
|
|
17
|
+
* Check if a file path is allowed for direct orchestrator modification
|
|
18
|
+
*/
|
|
19
|
+
export function isAllowedPath(filePath) {
|
|
20
|
+
if (!filePath)
|
|
21
|
+
return true;
|
|
22
|
+
return filePath.includes(ALLOWED_PATH_PREFIX);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if a tool is a write/edit tool
|
|
26
|
+
*/
|
|
27
|
+
export function isWriteEditTool(toolName) {
|
|
28
|
+
return WRITE_EDIT_TOOLS.includes(toolName);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get git diff statistics for the working directory
|
|
32
|
+
*/
|
|
33
|
+
export function getGitDiffStats(directory) {
|
|
34
|
+
try {
|
|
35
|
+
const output = execSync('git diff --numstat HEAD', {
|
|
36
|
+
cwd: directory,
|
|
37
|
+
encoding: 'utf-8',
|
|
38
|
+
timeout: 5000,
|
|
39
|
+
}).trim();
|
|
40
|
+
if (!output)
|
|
41
|
+
return [];
|
|
42
|
+
const statusOutput = execSync('git status --porcelain', {
|
|
43
|
+
cwd: directory,
|
|
44
|
+
encoding: 'utf-8',
|
|
45
|
+
timeout: 5000,
|
|
46
|
+
}).trim();
|
|
47
|
+
const statusMap = new Map();
|
|
48
|
+
for (const line of statusOutput.split('\n')) {
|
|
49
|
+
if (!line)
|
|
50
|
+
continue;
|
|
51
|
+
const status = line.substring(0, 2).trim();
|
|
52
|
+
const filePath = line.substring(3);
|
|
53
|
+
if (status === 'A' || status === '??') {
|
|
54
|
+
statusMap.set(filePath, 'added');
|
|
55
|
+
}
|
|
56
|
+
else if (status === 'D') {
|
|
57
|
+
statusMap.set(filePath, 'deleted');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
statusMap.set(filePath, 'modified');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const stats = [];
|
|
64
|
+
for (const line of output.split('\n')) {
|
|
65
|
+
const parts = line.split('\t');
|
|
66
|
+
if (parts.length < 3)
|
|
67
|
+
continue;
|
|
68
|
+
const [addedStr, removedStr, path] = parts;
|
|
69
|
+
const added = addedStr === '-' ? 0 : parseInt(addedStr, 10);
|
|
70
|
+
const removed = removedStr === '-' ? 0 : parseInt(removedStr, 10);
|
|
71
|
+
stats.push({
|
|
72
|
+
path,
|
|
73
|
+
added,
|
|
74
|
+
removed,
|
|
75
|
+
status: statusMap.get(path) ?? 'modified',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return stats;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Format file changes for display
|
|
86
|
+
*/
|
|
87
|
+
export function formatFileChanges(stats) {
|
|
88
|
+
if (stats.length === 0)
|
|
89
|
+
return '[FILE CHANGES SUMMARY]\nNo file changes detected.\n';
|
|
90
|
+
const modified = stats.filter((s) => s.status === 'modified');
|
|
91
|
+
const added = stats.filter((s) => s.status === 'added');
|
|
92
|
+
const deleted = stats.filter((s) => s.status === 'deleted');
|
|
93
|
+
const lines = ['[FILE CHANGES SUMMARY]'];
|
|
94
|
+
if (modified.length > 0) {
|
|
95
|
+
lines.push('Modified files:');
|
|
96
|
+
for (const f of modified) {
|
|
97
|
+
lines.push(` ${f.path} (+${f.added}, -${f.removed})`);
|
|
98
|
+
}
|
|
99
|
+
lines.push('');
|
|
100
|
+
}
|
|
101
|
+
if (added.length > 0) {
|
|
102
|
+
lines.push('Created files:');
|
|
103
|
+
for (const f of added) {
|
|
104
|
+
lines.push(` ${f.path} (+${f.added})`);
|
|
105
|
+
}
|
|
106
|
+
lines.push('');
|
|
107
|
+
}
|
|
108
|
+
if (deleted.length > 0) {
|
|
109
|
+
lines.push('Deleted files:');
|
|
110
|
+
for (const f of deleted) {
|
|
111
|
+
lines.push(` ${f.path} (-${f.removed})`);
|
|
112
|
+
}
|
|
113
|
+
lines.push('');
|
|
114
|
+
}
|
|
115
|
+
return lines.join('\n');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build verification reminder with session context
|
|
119
|
+
*/
|
|
120
|
+
export function buildVerificationReminder(sessionId) {
|
|
121
|
+
let reminder = VERIFICATION_REMINDER;
|
|
122
|
+
if (sessionId) {
|
|
123
|
+
reminder += `
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
**If ANY verification fails, resume the subagent with the fix:**
|
|
128
|
+
Task tool with resume="${sessionId}", prompt="fix: [describe the specific failure]"`;
|
|
129
|
+
}
|
|
130
|
+
return reminder;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Build orchestrator reminder with plan progress
|
|
134
|
+
*/
|
|
135
|
+
export function buildOrchestratorReminder(planName, progress, sessionId) {
|
|
136
|
+
const remaining = progress.total - progress.completed;
|
|
137
|
+
return `
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
**State:** Plan: ${planName} | ${progress.completed}/${progress.total} done, ${remaining} left
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
${buildVerificationReminder(sessionId)}
|
|
145
|
+
|
|
146
|
+
ALL pass? → commit atomic unit, mark \`[x]\`, next task.`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build boulder continuation message
|
|
150
|
+
*/
|
|
151
|
+
export function buildBoulderContinuation(planName, remaining, total) {
|
|
152
|
+
return BOULDER_CONTINUATION_PROMPT.replace(/{PLAN_NAME}/g, planName) +
|
|
153
|
+
`\n\n[Status: ${total - remaining}/${total} completed, ${remaining} remaining]`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Detect and process <remember> tags from agent output
|
|
157
|
+
* <remember>content</remember> -> Working Memory
|
|
158
|
+
* <remember priority>content</remember> -> Priority Context
|
|
159
|
+
*/
|
|
160
|
+
function processRememberTags(output, directory) {
|
|
161
|
+
// Match priority remember tags
|
|
162
|
+
const priorityMatches = output.matchAll(/<remember\s+priority>([\s\S]*?)<\/remember>/gi);
|
|
163
|
+
for (const match of priorityMatches) {
|
|
164
|
+
const content = match[1].trim();
|
|
165
|
+
if (content) {
|
|
166
|
+
setPriorityContext(directory, content);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Match regular remember tags
|
|
170
|
+
const regularMatches = output.matchAll(/<remember>([\s\S]*?)<\/remember>/gi);
|
|
171
|
+
for (const match of regularMatches) {
|
|
172
|
+
const content = match[1].trim();
|
|
173
|
+
if (content) {
|
|
174
|
+
addWorkingMemoryEntry(directory, content);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Process pre-tool-use hook for orchestrator
|
|
180
|
+
* Returns warning message if orchestrator tries to modify non-allowed paths
|
|
181
|
+
*/
|
|
182
|
+
export function processOrchestratorPreTool(input) {
|
|
183
|
+
const { toolName, toolInput } = input;
|
|
184
|
+
// Only check write/edit tools
|
|
185
|
+
if (!isWriteEditTool(toolName)) {
|
|
186
|
+
return { continue: true };
|
|
187
|
+
}
|
|
188
|
+
// Extract file path from tool input
|
|
189
|
+
const filePath = (toolInput?.filePath ?? toolInput?.path ?? toolInput?.file);
|
|
190
|
+
// Allow if path is in allowed prefix
|
|
191
|
+
if (!filePath || isAllowedPath(filePath)) {
|
|
192
|
+
return { continue: true };
|
|
193
|
+
}
|
|
194
|
+
// Inject warning for non-allowed path modifications
|
|
195
|
+
const warning = ORCHESTRATOR_DELEGATION_REQUIRED.replace('$FILE_PATH', filePath);
|
|
196
|
+
return {
|
|
197
|
+
continue: true,
|
|
198
|
+
message: warning,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Process post-tool-use hook for orchestrator
|
|
203
|
+
* Adds reminders after file modifications and Task delegations
|
|
204
|
+
*/
|
|
205
|
+
export function processOrchestratorPostTool(input, output) {
|
|
206
|
+
const { toolName, toolInput, directory } = input;
|
|
207
|
+
const workDir = directory || process.cwd();
|
|
208
|
+
// Handle write/edit tools
|
|
209
|
+
if (isWriteEditTool(toolName)) {
|
|
210
|
+
const filePath = (toolInput?.filePath ?? toolInput?.path ?? toolInput?.file);
|
|
211
|
+
if (filePath && !isAllowedPath(filePath)) {
|
|
212
|
+
return {
|
|
213
|
+
continue: true,
|
|
214
|
+
modifiedOutput: output + DIRECT_WORK_REMINDER,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Handle Task tool completion
|
|
219
|
+
if (toolName === 'Task' || toolName === 'task') {
|
|
220
|
+
// Check for background task launch
|
|
221
|
+
const isBackgroundLaunch = output.includes('Background task launched') || output.includes('Background task resumed');
|
|
222
|
+
if (isBackgroundLaunch) {
|
|
223
|
+
return { continue: true };
|
|
224
|
+
}
|
|
225
|
+
// Process <remember> tags from agent output
|
|
226
|
+
processRememberTags(output, workDir);
|
|
227
|
+
// Get git stats and build enhanced output
|
|
228
|
+
const gitStats = getGitDiffStats(workDir);
|
|
229
|
+
const fileChanges = formatFileChanges(gitStats);
|
|
230
|
+
// Check for boulder state
|
|
231
|
+
const boulderState = readBoulderState(workDir);
|
|
232
|
+
if (boulderState) {
|
|
233
|
+
const progress = getPlanProgress(boulderState.active_plan);
|
|
234
|
+
const enhancedOutput = `
|
|
235
|
+
## SUBAGENT WORK COMPLETED
|
|
236
|
+
|
|
237
|
+
${fileChanges}
|
|
238
|
+
<system-reminder>
|
|
239
|
+
${buildOrchestratorReminder(boulderState.plan_name, progress)}
|
|
240
|
+
</system-reminder>`;
|
|
241
|
+
return {
|
|
242
|
+
continue: true,
|
|
243
|
+
modifiedOutput: enhancedOutput,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
// No boulder state - add standalone verification reminder
|
|
247
|
+
return {
|
|
248
|
+
continue: true,
|
|
249
|
+
modifiedOutput: output + `\n<system-reminder>\n${buildVerificationReminder()}\n</system-reminder>`,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return { continue: true };
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Check if boulder has incomplete tasks and build continuation prompt
|
|
256
|
+
*/
|
|
257
|
+
export function checkBoulderContinuation(directory) {
|
|
258
|
+
const boulderState = readBoulderState(directory);
|
|
259
|
+
if (!boulderState) {
|
|
260
|
+
return { shouldContinue: false };
|
|
261
|
+
}
|
|
262
|
+
const progress = getPlanProgress(boulderState.active_plan);
|
|
263
|
+
if (progress.isComplete) {
|
|
264
|
+
return { shouldContinue: false };
|
|
265
|
+
}
|
|
266
|
+
const remaining = progress.total - progress.completed;
|
|
267
|
+
return {
|
|
268
|
+
shouldContinue: true,
|
|
269
|
+
message: buildBoulderContinuation(boulderState.plan_name, remaining, progress.total),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Create sisyphus orchestrator hook handlers
|
|
274
|
+
*/
|
|
275
|
+
export function createSisyphusOrchestratorHook(directory) {
|
|
276
|
+
return {
|
|
277
|
+
/**
|
|
278
|
+
* Hook name identifier
|
|
279
|
+
*/
|
|
280
|
+
name: HOOK_NAME,
|
|
281
|
+
/**
|
|
282
|
+
* Pre-tool execution handler
|
|
283
|
+
*/
|
|
284
|
+
preTool: (toolName, toolInput) => {
|
|
285
|
+
return processOrchestratorPreTool({
|
|
286
|
+
toolName,
|
|
287
|
+
toolInput,
|
|
288
|
+
directory,
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* Post-tool execution handler
|
|
293
|
+
*/
|
|
294
|
+
postTool: (toolName, toolInput, output) => {
|
|
295
|
+
return processOrchestratorPostTool({ toolName, toolInput, directory }, output);
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* Check for boulder continuation on session idle
|
|
299
|
+
*/
|
|
300
|
+
checkContinuation: () => {
|
|
301
|
+
return checkBoulderContinuation(directory);
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* Get single task directive for subagent prompts
|
|
305
|
+
*/
|
|
306
|
+
getSingleTaskDirective: () => SINGLE_TASK_DIRECTIVE,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/sisyphus-orchestrator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,sBAAsB;AACtB,cAAc,gBAAgB,CAAC;AA+B/B;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,gBAAgB,CAAC,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,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent Tracker Hook
|
|
3
|
+
*
|
|
4
|
+
* Tracks SubagentStart and SubagentStop events to maintain state of active agents.
|
|
5
|
+
* Useful for monitoring parallel execution in ultrapilot, swarm, and other multi-agent modes.
|
|
6
|
+
*/
|
|
7
|
+
export interface SubagentInfo {
|
|
8
|
+
agent_id: string;
|
|
9
|
+
agent_type: string;
|
|
10
|
+
started_at: string;
|
|
11
|
+
parent_mode?: string;
|
|
12
|
+
task_description?: string;
|
|
13
|
+
file_ownership?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface CompletedSubagentInfo {
|
|
16
|
+
agent_id: string;
|
|
17
|
+
agent_type: string;
|
|
18
|
+
duration_ms: number;
|
|
19
|
+
success: boolean;
|
|
20
|
+
output_summary?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SubagentTrackingState {
|
|
23
|
+
active_agents: Record<string, SubagentInfo>;
|
|
24
|
+
completed_agents: Record<string, CompletedSubagentInfo>;
|
|
25
|
+
total_spawned: number;
|
|
26
|
+
total_completed: number;
|
|
27
|
+
}
|
|
28
|
+
export interface SubagentStartInput {
|
|
29
|
+
session_id: string;
|
|
30
|
+
transcript_path: string;
|
|
31
|
+
cwd: string;
|
|
32
|
+
hook_event_name: 'SubagentStart';
|
|
33
|
+
agent_id: string;
|
|
34
|
+
agent_type: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SubagentStopInput {
|
|
37
|
+
session_id: string;
|
|
38
|
+
transcript_path: string;
|
|
39
|
+
cwd: string;
|
|
40
|
+
hook_event_name: 'SubagentStop';
|
|
41
|
+
stop_hook_active: boolean;
|
|
42
|
+
agent_id: string;
|
|
43
|
+
agent_transcript_path: string;
|
|
44
|
+
}
|
|
45
|
+
export interface HookOutput {
|
|
46
|
+
status: 'success' | 'error';
|
|
47
|
+
message?: string;
|
|
48
|
+
data?: unknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the path to the subagent tracking state file.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getStateFilePath(directory: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Read the current subagent tracking state.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readTrackingState(directory: string): SubagentTrackingState | null;
|
|
58
|
+
/**
|
|
59
|
+
* Write subagent tracking state to disk.
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeTrackingState(directory: string, state: SubagentTrackingState): void;
|
|
62
|
+
/**
|
|
63
|
+
* Process SubagentStart event - track new agent spawn.
|
|
64
|
+
*/
|
|
65
|
+
export declare function processSubagentStart(input: SubagentStartInput): HookOutput;
|
|
66
|
+
/**
|
|
67
|
+
* Process SubagentStop event - mark agent as completed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function processSubagentStop(input: SubagentStopInput): HookOutput;
|
|
70
|
+
/**
|
|
71
|
+
* Remove agents that have been active for longer than maxAgeMs.
|
|
72
|
+
* Useful for cleaning up stale agents that may have crashed.
|
|
73
|
+
*/
|
|
74
|
+
export declare function cleanupStaleAgents(directory: string, maxAgeMs?: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get the count of currently active agents.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getActiveAgentCount(directory: string): number;
|
|
79
|
+
/**
|
|
80
|
+
* Get a count of agents by type (both active and completed).
|
|
81
|
+
*/
|
|
82
|
+
export declare function getAgentsByType(directory: string): Record<string, number>;
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/subagent-tracker/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC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