oh-my-codex 0.1.1
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/README.md +269 -0
- package/bin/omx.js +25 -0
- package/dist/agents/definitions.d.ts +22 -0
- package/dist/agents/definitions.d.ts.map +1 -0
- package/dist/agents/definitions.js +235 -0
- package/dist/agents/definitions.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +157 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +266 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/setup.d.ts +12 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +175 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +17 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/config/generator.d.ts +14 -0
- package/dist/config/generator.d.ts.map +1 -0
- package/dist/config/generator.js +106 -0
- package/dist/config/generator.js.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts +8 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.js +148 -0
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -0
- package/dist/hooks/agents-overlay.d.ts +34 -0
- package/dist/hooks/agents-overlay.d.ts.map +1 -0
- package/dist/hooks/agents-overlay.js +265 -0
- package/dist/hooks/agents-overlay.js.map +1 -0
- package/dist/hooks/emulator.d.ts +44 -0
- package/dist/hooks/emulator.d.ts.map +1 -0
- package/dist/hooks/emulator.js +108 -0
- package/dist/hooks/emulator.js.map +1 -0
- package/dist/hooks/keyword-detector.d.ts +27 -0
- package/dist/hooks/keyword-detector.d.ts.map +1 -0
- package/dist/hooks/keyword-detector.js +63 -0
- package/dist/hooks/keyword-detector.js.map +1 -0
- package/dist/hooks/session.d.ts +38 -0
- package/dist/hooks/session.d.ts.map +1 -0
- package/dist/hooks/session.js +135 -0
- package/dist/hooks/session.js.map +1 -0
- package/dist/hud/colors.d.ts +26 -0
- package/dist/hud/colors.d.ts.map +1 -0
- package/dist/hud/colors.js +71 -0
- package/dist/hud/colors.js.map +1 -0
- package/dist/hud/index.d.ts +12 -0
- package/dist/hud/index.d.ts.map +1 -0
- package/dist/hud/index.js +107 -0
- package/dist/hud/index.js.map +1 -0
- package/dist/hud/render.d.ts +9 -0
- package/dist/hud/render.d.ts.map +1 -0
- package/dist/hud/render.js +192 -0
- package/dist/hud/render.js.map +1 -0
- package/dist/hud/state.d.ts +21 -0
- package/dist/hud/state.d.ts.map +1 -0
- package/dist/hud/state.js +101 -0
- package/dist/hud/state.js.map +1 -0
- package/dist/hud/types.d.ts +87 -0
- package/dist/hud/types.d.ts.map +1 -0
- package/dist/hud/types.js +8 -0
- package/dist/hud/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/code-intel-server.d.ts +7 -0
- package/dist/mcp/code-intel-server.d.ts.map +1 -0
- package/dist/mcp/code-intel-server.js +567 -0
- package/dist/mcp/code-intel-server.js.map +1 -0
- package/dist/mcp/memory-server.d.ts +7 -0
- package/dist/mcp/memory-server.d.ts.map +1 -0
- package/dist/mcp/memory-server.js +359 -0
- package/dist/mcp/memory-server.js.map +1 -0
- package/dist/mcp/state-server.d.ts +7 -0
- package/dist/mcp/state-server.d.ts.map +1 -0
- package/dist/mcp/state-server.js +181 -0
- package/dist/mcp/state-server.js.map +1 -0
- package/dist/mcp/trace-server.d.ts +7 -0
- package/dist/mcp/trace-server.d.ts.map +1 -0
- package/dist/mcp/trace-server.js +205 -0
- package/dist/mcp/trace-server.js.map +1 -0
- package/dist/modes/base.d.ts +50 -0
- package/dist/modes/base.d.ts.map +1 -0
- package/dist/modes/base.js +140 -0
- package/dist/modes/base.js.map +1 -0
- package/dist/notifications/notifier.d.ts +30 -0
- package/dist/notifications/notifier.d.ts.map +1 -0
- package/dist/notifications/notifier.js +124 -0
- package/dist/notifications/notifier.js.map +1 -0
- package/dist/team/orchestrator.d.ts +54 -0
- package/dist/team/orchestrator.d.ts.map +1 -0
- package/dist/team/orchestrator.js +106 -0
- package/dist/team/orchestrator.js.map +1 -0
- package/dist/utils/package.d.ts +9 -0
- package/dist/utils/package.d.ts.map +1 -0
- package/dist/utils/package.js +31 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/paths.d.ts +27 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +60 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/verification/verifier.d.ts +32 -0
- package/dist/verification/verifier.d.ts.map +1 -0
- package/dist/verification/verifier.js +81 -0
- package/dist/verification/verifier.js.map +1 -0
- package/package.json +54 -0
- package/prompts/analyst.md +110 -0
- package/prompts/api-reviewer.md +98 -0
- package/prompts/architect.md +109 -0
- package/prompts/build-fixer.md +89 -0
- package/prompts/code-reviewer.md +105 -0
- package/prompts/critic.md +87 -0
- package/prompts/debugger.md +93 -0
- package/prompts/deep-executor.md +112 -0
- package/prompts/dependency-expert.md +99 -0
- package/prompts/designer.md +103 -0
- package/prompts/executor.md +99 -0
- package/prompts/explore.md +112 -0
- package/prompts/git-master.md +92 -0
- package/prompts/information-architect.md +267 -0
- package/prompts/performance-reviewer.md +94 -0
- package/prompts/planner.md +116 -0
- package/prompts/product-analyst.md +299 -0
- package/prompts/product-manager.md +255 -0
- package/prompts/qa-tester.md +98 -0
- package/prompts/quality-reviewer.md +105 -0
- package/prompts/quality-strategist.md +227 -0
- package/prompts/researcher.md +96 -0
- package/prompts/scientist.md +92 -0
- package/prompts/security-reviewer.md +125 -0
- package/prompts/style-reviewer.md +87 -0
- package/prompts/test-engineer.md +103 -0
- package/prompts/ux-researcher.md +282 -0
- package/prompts/verifier.md +95 -0
- package/prompts/vision.md +75 -0
- package/prompts/writer.md +86 -0
- package/scripts/notify-hook.js +237 -0
- package/skills/analyze/SKILL.md +93 -0
- package/skills/autopilot/SKILL.md +175 -0
- package/skills/build-fix/SKILL.md +123 -0
- package/skills/cancel/SKILL.md +387 -0
- package/skills/code-review/SKILL.md +208 -0
- package/skills/configure-discord/SKILL.md +256 -0
- package/skills/configure-telegram/SKILL.md +232 -0
- package/skills/deepinit/SKILL.md +320 -0
- package/skills/deepsearch/SKILL.md +38 -0
- package/skills/doctor/SKILL.md +193 -0
- package/skills/ecomode/SKILL.md +114 -0
- package/skills/frontend-ui-ux/SKILL.md +34 -0
- package/skills/git-master/SKILL.md +29 -0
- package/skills/help/SKILL.md +192 -0
- package/skills/hud/SKILL.md +97 -0
- package/skills/learn-about-omx/SKILL.md +37 -0
- package/skills/learner/SKILL.md +135 -0
- package/skills/note/SKILL.md +62 -0
- package/skills/omx-setup/SKILL.md +1147 -0
- package/skills/pipeline/SKILL.md +407 -0
- package/skills/plan/SKILL.md +223 -0
- package/skills/project-session-manager/SKILL.md +560 -0
- package/skills/psm/SKILL.md +20 -0
- package/skills/ralph/SKILL.md +197 -0
- package/skills/ralph-init/SKILL.md +38 -0
- package/skills/ralplan/SKILL.md +34 -0
- package/skills/release/SKILL.md +83 -0
- package/skills/research/SKILL.md +510 -0
- package/skills/review/SKILL.md +30 -0
- package/skills/security-review/SKILL.md +284 -0
- package/skills/skill/SKILL.md +837 -0
- package/skills/swarm/SKILL.md +25 -0
- package/skills/tdd/SKILL.md +106 -0
- package/skills/team/SKILL.md +860 -0
- package/skills/trace/SKILL.md +33 -0
- package/skills/ultrapilot/SKILL.md +632 -0
- package/skills/ultraqa/SKILL.md +130 -0
- package/skills/ultrawork/SKILL.md +143 -0
- package/skills/writer-memory/SKILL.md +443 -0
- package/templates/AGENTS.md +326 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-fix
|
|
3
|
+
description: Fix build and TypeScript errors with minimal changes
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build Fix Skill
|
|
7
|
+
|
|
8
|
+
Fix build and compilation errors quickly with minimal code changes. Get the build green without refactoring.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
This skill activates when:
|
|
13
|
+
- User says "fix the build", "build is broken"
|
|
14
|
+
- TypeScript compilation fails
|
|
15
|
+
- the build command or type checker reports errors
|
|
16
|
+
- User requests "minimal fixes" for errors
|
|
17
|
+
|
|
18
|
+
## What It Does
|
|
19
|
+
|
|
20
|
+
Delegates to the `build-fixer` agent (Sonnet model) to:
|
|
21
|
+
|
|
22
|
+
1. **Collect Errors**
|
|
23
|
+
- Run the project's type check command (e.g., `tsc --noEmit`, `mypy`, `cargo check`, `go vet`)
|
|
24
|
+
- Or run the project's build command to get build failures
|
|
25
|
+
- Categorize errors by type and severity
|
|
26
|
+
|
|
27
|
+
2. **Fix Strategically**
|
|
28
|
+
- Add type annotations where missing
|
|
29
|
+
- Add null checks where needed
|
|
30
|
+
- Fix import/export statements
|
|
31
|
+
- Resolve module resolution issues
|
|
32
|
+
- Fix linter errors blocking build
|
|
33
|
+
|
|
34
|
+
3. **Minimal Diff Strategy**
|
|
35
|
+
- NO refactoring of unrelated code
|
|
36
|
+
- NO architectural changes
|
|
37
|
+
- NO performance optimizations
|
|
38
|
+
- ONLY what's needed to make build pass
|
|
39
|
+
|
|
40
|
+
4. **Verify**
|
|
41
|
+
- Run the project's type check command after each fix
|
|
42
|
+
- Ensure no new errors introduced
|
|
43
|
+
- Stop when build passes
|
|
44
|
+
|
|
45
|
+
## Agent Delegation
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
spawn_sub_agent(
|
|
49
|
+
subagent_type="oh-my-codex:build-fixer",
|
|
50
|
+
model="sonnet",
|
|
51
|
+
prompt="BUILD FIX TASK
|
|
52
|
+
|
|
53
|
+
Fix all build and TypeScript errors with minimal changes.
|
|
54
|
+
|
|
55
|
+
Requirements:
|
|
56
|
+
- Run tsc/build to collect errors
|
|
57
|
+
- Fix errors one at a time
|
|
58
|
+
- Verify each fix doesn't introduce new errors
|
|
59
|
+
- NO refactoring, NO architectural changes
|
|
60
|
+
- Stop when build passes
|
|
61
|
+
|
|
62
|
+
Output: Build error resolution report with:
|
|
63
|
+
- List of errors fixed
|
|
64
|
+
- Lines changed per fix
|
|
65
|
+
- Final build status"
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Stop Conditions
|
|
70
|
+
|
|
71
|
+
The build-fixer agent stops when:
|
|
72
|
+
- Type check command exits with code 0
|
|
73
|
+
- Build command completes successfully
|
|
74
|
+
- No new errors introduced
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
BUILD FIX REPORT
|
|
80
|
+
================
|
|
81
|
+
|
|
82
|
+
Errors Fixed: 12
|
|
83
|
+
Files Modified: 8
|
|
84
|
+
Lines Changed: 47
|
|
85
|
+
|
|
86
|
+
Fixes Applied:
|
|
87
|
+
1. src/utils/validation.ts:15 - Added return type annotation
|
|
88
|
+
2. src/components/Header.tsx:42 - Added null check for props.user
|
|
89
|
+
3. src/api/client.ts:89 - Fixed import path for axios
|
|
90
|
+
...
|
|
91
|
+
|
|
92
|
+
Final Build Status: ✓ PASSING
|
|
93
|
+
Verification: [type check command] (exit code 0)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Best Practices
|
|
97
|
+
|
|
98
|
+
- **One fix at a time** - Easier to verify and debug
|
|
99
|
+
- **Minimal changes** - Don't refactor while fixing
|
|
100
|
+
- **Document why** - Comment non-obvious fixes
|
|
101
|
+
- **Test after** - Ensure tests still pass
|
|
102
|
+
|
|
103
|
+
## Use with Other Skills
|
|
104
|
+
|
|
105
|
+
Combine with other skills for comprehensive fixing:
|
|
106
|
+
|
|
107
|
+
**With Ultrawork:**
|
|
108
|
+
```
|
|
109
|
+
/ultrawork fix all build errors
|
|
110
|
+
```
|
|
111
|
+
Spawns multiple build-fixer agents in parallel for different files.
|
|
112
|
+
|
|
113
|
+
**With Ralph:**
|
|
114
|
+
```
|
|
115
|
+
/ralph fix the build
|
|
116
|
+
```
|
|
117
|
+
Keeps trying until build passes, even if it takes multiple iterations.
|
|
118
|
+
|
|
119
|
+
**With Pipeline:**
|
|
120
|
+
```
|
|
121
|
+
/pipeline debug "build is failing"
|
|
122
|
+
```
|
|
123
|
+
Uses: explore → architect → build-fixer workflow.
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cancel
|
|
3
|
+
description: Cancel any active OMX mode (autopilot, ralph, ultrawork, ecomode, ultraqa, swarm, ultrapilot, pipeline, team)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cancel Skill
|
|
7
|
+
|
|
8
|
+
Intelligent cancellation that detects and cancels the active OMX mode.
|
|
9
|
+
|
|
10
|
+
**The cancel skill is the standard way to complete and exit any OMX mode.**
|
|
11
|
+
When the stop hook detects work is complete, it instructs the LLM to invoke
|
|
12
|
+
this skill for proper state cleanup. If cancel fails or is interrupted,
|
|
13
|
+
retry with `--force` flag, or wait for the 2-hour staleness timeout as
|
|
14
|
+
a last resort.
|
|
15
|
+
|
|
16
|
+
## What It Does
|
|
17
|
+
|
|
18
|
+
Automatically detects which mode is active and cancels it:
|
|
19
|
+
- **Autopilot**: Stops workflow, preserves progress for resume
|
|
20
|
+
- **Ralph**: Stops persistence loop, clears linked ultrawork if applicable
|
|
21
|
+
- **Ultrawork**: Stops parallel execution (standalone or linked)
|
|
22
|
+
- **Ecomode**: Stops token-efficient parallel execution (standalone or linked to ralph)
|
|
23
|
+
- **UltraQA**: Stops QA cycling workflow
|
|
24
|
+
- **Swarm**: Stops coordinated agent swarm, releases claimed tasks
|
|
25
|
+
- **Ultrapilot**: Stops parallel autopilot workers
|
|
26
|
+
- **Pipeline**: Stops sequential agent pipeline
|
|
27
|
+
- **Team**: Sends shutdown_request to all teammates, waits for responses, calls TeamDelete, clears linked ralph if present
|
|
28
|
+
- **Team+Ralph (linked)**: Cancels team first (graceful shutdown), then clears ralph state. Cancelling ralph when linked also cancels team first.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
/cancel
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or say: "cancelomc", "stopomc"
|
|
37
|
+
|
|
38
|
+
## Auto-Detection
|
|
39
|
+
|
|
40
|
+
`/cancel` follows the session-aware state contract:
|
|
41
|
+
- By default the command inspects the current session via `state_list_active` and `state_get_status`, navigating `.omx/state/sessions/{sessionId}/…` to discover which mode is active.
|
|
42
|
+
- When a session id is provided or already known, that session-scoped path is authoritative. Legacy files in `.omx/state/*.json` are consulted only as a compatibility fallback if the session id is missing or empty.
|
|
43
|
+
- Swarm is a shared SQLite/marker mode (`.omx/state/swarm.db` / `.omx/state/swarm-active.marker`) and is not session-scoped.
|
|
44
|
+
- The default cleanup flow calls `state_clear` with the session id to remove only the matching session files; modes stay bound to their originating session.
|
|
45
|
+
|
|
46
|
+
Active modes are still cancelled in dependency order:
|
|
47
|
+
1. Autopilot (includes linked ralph/ultraqa/ecomode cleanup)
|
|
48
|
+
2. Ralph (cleans its linked ultrawork or ecomode)
|
|
49
|
+
3. Ultrawork (standalone)
|
|
50
|
+
4. Ecomode (standalone)
|
|
51
|
+
5. UltraQA (standalone)
|
|
52
|
+
6. Swarm (standalone)
|
|
53
|
+
7. Ultrapilot (standalone)
|
|
54
|
+
8. Pipeline (standalone)
|
|
55
|
+
9. Team (Codex CLI native)
|
|
56
|
+
10. Plan Consensus (standalone)
|
|
57
|
+
|
|
58
|
+
## Force Clear All
|
|
59
|
+
|
|
60
|
+
Use `--force` or `--all` when you need to erase every session plus legacy artifacts, e.g., to reset the workspace entirely.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
/cancel --force
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
/cancel --all
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Steps under the hood:
|
|
71
|
+
1. `state_list_active` enumerates `.omx/state/sessions/{sessionId}/…` to find every known session.
|
|
72
|
+
2. `state_clear` runs once per session to drop that session’s files.
|
|
73
|
+
3. A global `state_clear` without `session_id` removes legacy files under `.omx/state/*.json`, `.omx/state/swarm*.db`, and compatibility artifacts (see list).
|
|
74
|
+
4. Team artifacts (`~/.claude/teams/*/`, `~/.claude/tasks/*/`, `.omx/state/team-state.json`) are best-effort cleared as part of the legacy fallback.
|
|
75
|
+
|
|
76
|
+
Every `state_clear` command honors the `session_id` argument, so even force mode still uses the session-aware paths first before deleting legacy files.
|
|
77
|
+
|
|
78
|
+
Legacy compatibility list (removed only under `--force`/`--all`):
|
|
79
|
+
- `.omx/state/autopilot-state.json`
|
|
80
|
+
- `.omx/state/ralph-state.json`
|
|
81
|
+
- `.omx/state/ralph-plan-state.json`
|
|
82
|
+
- `.omx/state/ralph-verification.json`
|
|
83
|
+
- `.omx/state/ultrawork-state.json`
|
|
84
|
+
- `.omx/state/ecomode-state.json`
|
|
85
|
+
- `.omx/state/ultraqa-state.json`
|
|
86
|
+
- `.omx/state/swarm.db`
|
|
87
|
+
- `.omx/state/swarm.db-wal`
|
|
88
|
+
- `.omx/state/swarm.db-shm`
|
|
89
|
+
- `.omx/state/swarm-active.marker`
|
|
90
|
+
- `.omx/state/swarm-tasks.db`
|
|
91
|
+
- `.omx/state/ultrapilot-state.json`
|
|
92
|
+
- `.omx/state/ultrapilot-ownership.json`
|
|
93
|
+
- `.omx/state/pipeline-state.json`
|
|
94
|
+
- `.omx/state/plan-consensus.json`
|
|
95
|
+
- `.omx/state/ralplan-state.json`
|
|
96
|
+
- `.omx/state/boulder.json`
|
|
97
|
+
- `.omx/state/hud-state.json`
|
|
98
|
+
- `.omx/state/subagent-tracking.json`
|
|
99
|
+
- `.omx/state/subagent-tracker.lock`
|
|
100
|
+
- `.omx/state/rate-limit-daemon.pid`
|
|
101
|
+
- `.omx/state/rate-limit-daemon.log`
|
|
102
|
+
- `.omx/state/checkpoints/` (directory)
|
|
103
|
+
- `.omx/state/sessions/` (empty directory cleanup after clearing sessions)
|
|
104
|
+
|
|
105
|
+
## Implementation Steps
|
|
106
|
+
|
|
107
|
+
When you invoke this skill:
|
|
108
|
+
|
|
109
|
+
### 1. Parse Arguments
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Check for --force or --all flags
|
|
113
|
+
FORCE_MODE=false
|
|
114
|
+
if [[ "$*" == *"--force"* ]] || [[ "$*" == *"--all"* ]]; then
|
|
115
|
+
FORCE_MODE=true
|
|
116
|
+
fi
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 2. Detect Active Modes
|
|
120
|
+
|
|
121
|
+
The skill now relies on the session-aware state contract rather than hard-coded file paths:
|
|
122
|
+
1. Call `state_list_active` to enumerate `.omx/state/sessions/{sessionId}/…` and discover every active session.
|
|
123
|
+
2. For each session id, call `state_get_status` to learn which mode is running (`autopilot`, `ralph`, `ultrawork`, etc.) and whether dependent modes exist.
|
|
124
|
+
3. If a `session_id` was supplied to `/cancel`, skip legacy fallback entirely and operate solely within that session path; otherwise, consult legacy files in `.omx/state/*.json` only if the state tools report no active session. Swarm remains a shared SQLite/marker mode outside session scoping.
|
|
125
|
+
4. Any cancellation logic in this doc mirrors the dependency order discovered via state tools (autopilot → ralph → …).
|
|
126
|
+
|
|
127
|
+
### 3A. Force Mode (if --force or --all)
|
|
128
|
+
|
|
129
|
+
Use force mode to clear every session plus legacy artifacts via `state_clear`. Direct file removal is reserved for legacy cleanup when the state tools report no active sessions.
|
|
130
|
+
|
|
131
|
+
### 3B. Smart Cancellation (default)
|
|
132
|
+
|
|
133
|
+
#### If Team Active (Codex CLI native)
|
|
134
|
+
|
|
135
|
+
Teams are detected by checking for config files in `~/.claude/teams/`:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Check for active teams
|
|
139
|
+
TEAM_CONFIGS=$(find ~/.claude/teams -name config.json -maxdepth 2 2>/dev/null)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Two-pass cancellation protocol:**
|
|
143
|
+
|
|
144
|
+
**Pass 1: Graceful Shutdown**
|
|
145
|
+
```
|
|
146
|
+
For each team found in ~/.claude/teams/:
|
|
147
|
+
1. Read config.json to get team_name and members list
|
|
148
|
+
2. For each non-lead member:
|
|
149
|
+
a. Send shutdown_request via SendMessage
|
|
150
|
+
b. Wait up to 15 seconds for shutdown_response
|
|
151
|
+
c. If response received: member terminates and is auto-removed
|
|
152
|
+
d. If timeout: mark member as unresponsive, continue to next
|
|
153
|
+
3. Log: "Graceful pass: X/Y members responded"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Pass 2: Reconciliation**
|
|
157
|
+
```
|
|
158
|
+
After graceful pass:
|
|
159
|
+
1. Re-read config.json to check remaining members
|
|
160
|
+
2. If only lead remains (or config is empty): proceed to TeamDelete
|
|
161
|
+
3. If unresponsive members remain:
|
|
162
|
+
a. Wait 5 more seconds (they may still be processing)
|
|
163
|
+
b. Re-read config.json again
|
|
164
|
+
c. If still stuck: attempt TeamDelete anyway
|
|
165
|
+
d. If TeamDelete fails: report manual cleanup path
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**TeamDelete + Cleanup:**
|
|
169
|
+
```
|
|
170
|
+
1. Call TeamDelete() — removes ~/.claude/teams/{name}/ and ~/.claude/tasks/{name}/
|
|
171
|
+
2. Clear team state: state_clear(mode="team")
|
|
172
|
+
3. Check for linked ralph: state_read(mode="ralph") — if linked_team is true:
|
|
173
|
+
a. Clear ralph state: state_clear(mode="ralph")
|
|
174
|
+
b. Clear linked ultrawork if present: state_clear(mode="ultrawork")
|
|
175
|
+
4. Emit structured cancel report
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Structured Cancel Report:**
|
|
179
|
+
```
|
|
180
|
+
Team "{team_name}" cancelled:
|
|
181
|
+
- Members signaled: N
|
|
182
|
+
- Responses received: M
|
|
183
|
+
- Unresponsive: K (list names if any)
|
|
184
|
+
- TeamDelete: success/failed
|
|
185
|
+
- Manual cleanup needed: yes/no
|
|
186
|
+
Path: ~/.claude/teams/{name}/ and ~/.claude/tasks/{name}/
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Implementation note:** The cancel skill is executed by the LLM, not as a bash script. When you detect an active team:
|
|
190
|
+
1. Read `~/.claude/teams/*/config.json` to find active teams
|
|
191
|
+
2. If multiple teams exist, cancel oldest first (by `createdAt`)
|
|
192
|
+
3. For each non-lead member, call `SendMessage(type: "shutdown_request", recipient: member-name, content: "Cancelling")`
|
|
193
|
+
4. Wait briefly for shutdown responses (15s per member timeout)
|
|
194
|
+
5. Re-read config.json to check for remaining members (reconciliation pass)
|
|
195
|
+
6. Call `TeamDelete()` to clean up
|
|
196
|
+
7. Remove any local state: `rm -f .omx/state/team-state.json`
|
|
197
|
+
8. Report structured summary to user
|
|
198
|
+
|
|
199
|
+
#### If Autopilot Active
|
|
200
|
+
|
|
201
|
+
Call `cancelAutopilot()` from `src/hooks/autopilot/cancel.ts:27-78`:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Autopilot handles its own cleanup + ralph + ultraqa
|
|
205
|
+
# Just mark autopilot as inactive (preserves state for resume)
|
|
206
|
+
if [[ -f .omx/state/autopilot-state.json ]]; then
|
|
207
|
+
# Clean up ralph if active
|
|
208
|
+
if [[ -f .omx/state/ralph-state.json ]]; then
|
|
209
|
+
RALPH_STATE=$(cat .omx/state/ralph-state.json)
|
|
210
|
+
LINKED_UW=$(echo "$RALPH_STATE" | jq -r '.linked_ultrawork // false')
|
|
211
|
+
|
|
212
|
+
# Clean linked ultrawork first
|
|
213
|
+
if [[ "$LINKED_UW" == "true" ]] && [[ -f .omx/state/ultrawork-state.json ]]; then
|
|
214
|
+
rm -f .omx/state/ultrawork-state.json
|
|
215
|
+
echo "Cleaned up: ultrawork (linked to ralph)"
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
# Clean ralph
|
|
219
|
+
rm -f .omx/state/ralph-state.json
|
|
220
|
+
rm -f .omx/state/ralph-verification.json
|
|
221
|
+
echo "Cleaned up: ralph"
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
# Clean up ultraqa if active
|
|
225
|
+
if [[ -f .omx/state/ultraqa-state.json ]]; then
|
|
226
|
+
rm -f .omx/state/ultraqa-state.json
|
|
227
|
+
echo "Cleaned up: ultraqa"
|
|
228
|
+
fi
|
|
229
|
+
|
|
230
|
+
# Mark autopilot inactive but preserve state
|
|
231
|
+
CURRENT_STATE=$(cat .omx/state/autopilot-state.json)
|
|
232
|
+
CURRENT_PHASE=$(echo "$CURRENT_STATE" | jq -r '.phase // "unknown"')
|
|
233
|
+
echo "$CURRENT_STATE" | jq '.active = false' > .omx/state/autopilot-state.json
|
|
234
|
+
|
|
235
|
+
echo "Autopilot cancelled at phase: $CURRENT_PHASE. Progress preserved for resume."
|
|
236
|
+
echo "Run /autopilot to resume."
|
|
237
|
+
fi
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### If Ralph Active (but not Autopilot)
|
|
241
|
+
|
|
242
|
+
Call `clearRalphState()` + `clearLinkedUltraworkState()` from `src/hooks/ralph-loop/index.ts:147-182`:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
if [[ -f .omx/state/ralph-state.json ]]; then
|
|
246
|
+
# Check if ultrawork is linked
|
|
247
|
+
RALPH_STATE=$(cat .omx/state/ralph-state.json)
|
|
248
|
+
LINKED_UW=$(echo "$RALPH_STATE" | jq -r '.linked_ultrawork // false')
|
|
249
|
+
|
|
250
|
+
# Clean linked ultrawork first
|
|
251
|
+
if [[ "$LINKED_UW" == "true" ]] && [[ -f .omx/state/ultrawork-state.json ]]; then
|
|
252
|
+
UW_STATE=$(cat .omx/state/ultrawork-state.json)
|
|
253
|
+
UW_LINKED=$(echo "$UW_STATE" | jq -r '.linked_to_ralph // false')
|
|
254
|
+
|
|
255
|
+
# Only clear if it was linked to ralph
|
|
256
|
+
if [[ "$UW_LINKED" == "true" ]]; then
|
|
257
|
+
rm -f .omx/state/ultrawork-state.json
|
|
258
|
+
echo "Cleaned up: ultrawork (linked to ralph)"
|
|
259
|
+
fi
|
|
260
|
+
fi
|
|
261
|
+
|
|
262
|
+
# Clean ralph state
|
|
263
|
+
rm -f .omx/state/ralph-state.json
|
|
264
|
+
rm -f .omx/state/ralph-plan-state.json
|
|
265
|
+
rm -f .omx/state/ralph-verification.json
|
|
266
|
+
|
|
267
|
+
echo "Ralph cancelled. Persistent mode deactivated."
|
|
268
|
+
fi
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### If Ultrawork Active (standalone, not linked)
|
|
272
|
+
|
|
273
|
+
Call `deactivateUltrawork()` from `src/hooks/ultrawork/index.ts:150-173`:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
if [[ -f .omx/state/ultrawork-state.json ]]; then
|
|
277
|
+
# Check if linked to ralph
|
|
278
|
+
UW_STATE=$(cat .omx/state/ultrawork-state.json)
|
|
279
|
+
LINKED=$(echo "$UW_STATE" | jq -r '.linked_to_ralph // false')
|
|
280
|
+
|
|
281
|
+
if [[ "$LINKED" == "true" ]]; then
|
|
282
|
+
echo "Ultrawork is linked to Ralph. Use /cancel to cancel both."
|
|
283
|
+
exit 1
|
|
284
|
+
fi
|
|
285
|
+
|
|
286
|
+
# Remove local state
|
|
287
|
+
rm -f .omx/state/ultrawork-state.json
|
|
288
|
+
|
|
289
|
+
echo "Ultrawork cancelled. Parallel execution mode deactivated."
|
|
290
|
+
fi
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
#### If UltraQA Active (standalone)
|
|
294
|
+
|
|
295
|
+
Call `clearUltraQAState()` from `src/hooks/ultraqa/index.ts:107-120`:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
if [[ -f .omx/state/ultraqa-state.json ]]; then
|
|
299
|
+
rm -f .omx/state/ultraqa-state.json
|
|
300
|
+
echo "UltraQA cancelled. QA cycling workflow stopped."
|
|
301
|
+
fi
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### No Active Modes
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
echo "No active OMX modes detected."
|
|
308
|
+
echo ""
|
|
309
|
+
echo "Checked for:"
|
|
310
|
+
echo " - Autopilot (.omx/state/autopilot-state.json)"
|
|
311
|
+
echo " - Ralph (.omx/state/ralph-state.json)"
|
|
312
|
+
echo " - Ultrawork (.omx/state/ultrawork-state.json)"
|
|
313
|
+
echo " - UltraQA (.omx/state/ultraqa-state.json)"
|
|
314
|
+
echo ""
|
|
315
|
+
echo "Use --force to clear all state files anyway."
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Implementation Notes
|
|
319
|
+
|
|
320
|
+
The cancel skill runs as follows:
|
|
321
|
+
1. Parse the `--force` / `--all` flags, tracking whether cleanup should span every session or stay scoped to the current session id.
|
|
322
|
+
2. Use `state_list_active` to enumerate known session ids and `state_get_status` to learn the active mode (`autopilot`, `ralph`, `ultrawork`, etc.) for each session.
|
|
323
|
+
3. When operating in default mode, call `state_clear` with that session_id to remove only the session’s files, then run mode-specific cleanup (autopilot → ralph → …) based on the state tool signals.
|
|
324
|
+
4. In force mode, iterate every active session, call `state_clear` per session, then run a global `state_clear` without `session_id` to drop legacy files (`.omx/state/*.json`, compatibility artifacts) and report success. Swarm remains a shared SQLite/marker mode outside session scoping.
|
|
325
|
+
5. Team artifacts (`~/.claude/teams/*/`, `~/.claude/tasks/*/`, `.omx/state/team-state.json`) remain best-effort cleanup items invoked during the legacy/global pass.
|
|
326
|
+
|
|
327
|
+
State tools always honor the `session_id` argument, so even force mode still clears the session-scoped paths before deleting compatibility-only legacy state.
|
|
328
|
+
|
|
329
|
+
Mode-specific subsections below describe what extra cleanup each handler performs after the state-wide operations finish.
|
|
330
|
+
## Messages Reference
|
|
331
|
+
|
|
332
|
+
| Mode | Success Message |
|
|
333
|
+
|------|-----------------|
|
|
334
|
+
| Autopilot | "Autopilot cancelled at phase: {phase}. Progress preserved for resume." |
|
|
335
|
+
| Ralph | "Ralph cancelled. Persistent mode deactivated." |
|
|
336
|
+
| Ultrawork | "Ultrawork cancelled. Parallel execution mode deactivated." |
|
|
337
|
+
| Ecomode | "Ecomode cancelled. Token-efficient execution mode deactivated." |
|
|
338
|
+
| UltraQA | "UltraQA cancelled. QA cycling workflow stopped." |
|
|
339
|
+
| Swarm | "Swarm cancelled. Coordinated agents stopped." |
|
|
340
|
+
| Ultrapilot | "Ultrapilot cancelled. Parallel autopilot workers stopped." |
|
|
341
|
+
| Pipeline | "Pipeline cancelled. Sequential agent chain stopped." |
|
|
342
|
+
| Team | "Team cancelled. Teammates shut down and cleaned up." |
|
|
343
|
+
| Plan Consensus | "Plan Consensus cancelled. Planning session ended." |
|
|
344
|
+
| Force | "All OMX modes cleared. You are free to start fresh." |
|
|
345
|
+
| None | "No active OMX modes detected." |
|
|
346
|
+
|
|
347
|
+
## What Gets Preserved
|
|
348
|
+
|
|
349
|
+
| Mode | State Preserved | Resume Command |
|
|
350
|
+
|------|-----------------|----------------|
|
|
351
|
+
| Autopilot | Yes (phase, files, spec, plan, verdicts) | `/autopilot` |
|
|
352
|
+
| Ralph | No | N/A |
|
|
353
|
+
| Ultrawork | No | N/A |
|
|
354
|
+
| UltraQA | No | N/A |
|
|
355
|
+
| Swarm | No | N/A |
|
|
356
|
+
| Ultrapilot | No | N/A |
|
|
357
|
+
| Pipeline | No | N/A |
|
|
358
|
+
| Plan Consensus | Yes (plan file path preserved) | N/A |
|
|
359
|
+
|
|
360
|
+
## Notes
|
|
361
|
+
|
|
362
|
+
- **Dependency-aware**: Autopilot cancellation cleans up Ralph and UltraQA
|
|
363
|
+
- **Link-aware**: Ralph cancellation cleans up linked Ultrawork or Ecomode
|
|
364
|
+
- **Safe**: Only clears linked Ultrawork, preserves standalone Ultrawork
|
|
365
|
+
- **Local-only**: Clears state files in `.omx/state/` directory
|
|
366
|
+
- **Resume-friendly**: Autopilot state is preserved for seamless resume
|
|
367
|
+
- **Team-aware**: Detects native Codex CLI teams and performs graceful shutdown
|
|
368
|
+
|
|
369
|
+
## MCP Worker Cleanup
|
|
370
|
+
|
|
371
|
+
When cancelling modes that may have spawned MCP workers (team bridge daemons), the cancel skill should also:
|
|
372
|
+
|
|
373
|
+
1. **Check for active MCP workers**: Look for heartbeat files at `.omx/state/team-bridge/{team}/*.heartbeat.json`
|
|
374
|
+
2. **Send shutdown signals**: Write shutdown signal files for each active worker
|
|
375
|
+
3. **Kill tmux sessions**: Run `tmux kill-session -t omc-team-{team}-{worker}` for each worker
|
|
376
|
+
4. **Clean up heartbeat files**: Remove all heartbeat files for the team
|
|
377
|
+
5. **Clean up shadow registry**: Remove `.omx/state/team-mcp-workers.json`
|
|
378
|
+
|
|
379
|
+
### Force Clear Addition
|
|
380
|
+
|
|
381
|
+
When `--force` is used, also clean up:
|
|
382
|
+
```bash
|
|
383
|
+
rm -rf .omx/state/team-bridge/ # Heartbeat files
|
|
384
|
+
rm -f .omx/state/team-mcp-workers.json # Shadow registry
|
|
385
|
+
# Kill all omc-team-* tmux sessions
|
|
386
|
+
tmux list-sessions -F '#{session_name}' 2>/dev/null | grep '^omc-team-' | while read s; do tmux kill-session -t "$s" 2>/dev/null; done
|
|
387
|
+
```
|