oh-my-codex 0.3.5 → 0.3.7
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 +9 -0
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +14 -14
- package/dist/agents/definitions.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +60 -5
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/index.d.ts +20 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +172 -83
- package/dist/cli/index.js.map +1 -1
- package/dist/hooks/__tests__/agents-overlay.test.js +142 -1
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -1
- package/dist/hooks/agents-overlay.d.ts +10 -0
- package/dist/hooks/agents-overlay.d.ts.map +1 -1
- package/dist/hooks/agents-overlay.js +116 -25
- package/dist/hooks/agents-overlay.js.map +1 -1
- package/dist/hud/__tests__/hud-tmux-injection.test.d.ts +10 -0
- package/dist/hud/__tests__/hud-tmux-injection.test.d.ts.map +1 -0
- package/dist/hud/__tests__/hud-tmux-injection.test.js +143 -0
- package/dist/hud/__tests__/hud-tmux-injection.test.js.map +1 -0
- package/dist/hud/__tests__/state.test.d.ts +2 -0
- package/dist/hud/__tests__/state.test.d.ts.map +1 -0
- package/dist/hud/__tests__/state.test.js +32 -0
- package/dist/hud/__tests__/state.test.js.map +1 -0
- package/dist/hud/index.d.ts +10 -0
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +32 -8
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +6 -1
- package/dist/hud/state.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +29 -2
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +22 -1
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/orchestrator.d.ts.map +1 -1
- package/dist/team/orchestrator.js +2 -1
- package/dist/team/orchestrator.js.map +1 -1
- package/dist/team/runtime.d.ts +2 -0
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +40 -8
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/state.d.ts +1 -1
- package/dist/team/state.d.ts.map +1 -1
- package/dist/team/state.js +2 -2
- package/dist/team/state.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +110 -33
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/package.json +1 -1
- package/prompts/deep-executor.md +11 -102
- package/prompts/executor.md +102 -63
- package/skills/team/SKILL.md +16 -0
- package/skills/worker/SKILL.md +1 -0
- package/templates/AGENTS.md +36 -3
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { mkdir, readFile, rm, stat, writeFile } from 'fs/promises';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
1
3
|
const TEAM_OVERLAY_START = '<!-- OMX:TEAM:WORKER:START -->';
|
|
2
4
|
const TEAM_OVERLAY_END = '<!-- OMX:TEAM:WORKER:END -->';
|
|
5
|
+
const AGENTS_LOCK_PATH = ['.omx', 'state', 'agents-md.lock'];
|
|
6
|
+
const LOCK_OWNER_FILE = 'owner.json';
|
|
7
|
+
const LOCK_TIMEOUT_MS = 5000;
|
|
8
|
+
const LOCK_POLL_INTERVAL_MS = 100;
|
|
9
|
+
const LOCK_STALE_MS = 30_000;
|
|
3
10
|
/**
|
|
4
11
|
* Generate generic AGENTS.md overlay for team workers.
|
|
5
12
|
* This is the SAME for all workers -- no per-worker identity.
|
|
@@ -14,13 +21,15 @@ You are a team worker in team "${teamName}". Your identity and assigned tasks ar
|
|
|
14
21
|
1. Read your inbox file at the path provided in your first instruction
|
|
15
22
|
2. Load the worker skill instructions from skills/worker/SKILL.md in this repository and follow them
|
|
16
23
|
3. Send an ACK to the lead using MCP tool team_send_message (to_worker="leader-fixed") once initialized
|
|
17
|
-
4. Read your task from .omx/state/team/${teamName}/tasks/
|
|
18
|
-
5.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
4. Read your task from .omx/state/team/${teamName}/tasks/task-<id>.json (example: task-1.json)
|
|
25
|
+
5. Task id format:
|
|
26
|
+
- State/MCP APIs use task_id: "<id>" (example: "1"), never "task-1"
|
|
27
|
+
6. Request a claim via the state API (claimTask); do not directly set status to "in_progress" in the task file
|
|
28
|
+
7. Do the work using your tools
|
|
29
|
+
8. On completion: write {"status": "completed", "result": "summary of what was done"} to the task file
|
|
30
|
+
9. Update your status: write {"state": "idle"} to .omx/state/team/${teamName}/workers/{your-name}/status.json
|
|
31
|
+
10. Wait for new instructions (the lead will send them via your terminal)
|
|
32
|
+
11. Check your mailbox for messages at .omx/state/team/${teamName}/mailbox/{your-name}.json
|
|
24
33
|
|
|
25
34
|
## Rules
|
|
26
35
|
- Do NOT edit files outside the paths listed in your task description
|
|
@@ -34,38 +43,39 @@ ${TEAM_OVERLAY_END}`;
|
|
|
34
43
|
* Apply worker overlay to AGENTS.md. Idempotent -- strips existing overlay first.
|
|
35
44
|
*/
|
|
36
45
|
export async function applyWorkerOverlay(agentsMdPath, overlay) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
await withAgentsMdLock(agentsMdPath, async () => {
|
|
47
|
+
// Read existing content, strip any existing overlay, append new overlay
|
|
48
|
+
// Uses the START/END markers to find and replace
|
|
49
|
+
let content = '';
|
|
50
|
+
try {
|
|
51
|
+
content = await readFile(agentsMdPath, 'utf-8');
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// File doesn't exist yet, start empty
|
|
55
|
+
}
|
|
56
|
+
// Strip existing overlay if present
|
|
57
|
+
content = stripOverlayFromContent(content);
|
|
58
|
+
// Append new overlay
|
|
59
|
+
content = content.trimEnd() + '\n\n' + overlay + '\n';
|
|
60
|
+
await writeFile(agentsMdPath, content);
|
|
61
|
+
});
|
|
53
62
|
}
|
|
54
63
|
/**
|
|
55
64
|
* Strip worker overlay from AGENTS.md content. Idempotent.
|
|
56
65
|
*/
|
|
57
66
|
export async function stripWorkerOverlay(agentsMdPath) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
await withAgentsMdLock(agentsMdPath, async () => {
|
|
68
|
+
try {
|
|
69
|
+
const content = await readFile(agentsMdPath, 'utf-8');
|
|
70
|
+
const stripped = stripOverlayFromContent(content);
|
|
71
|
+
if (stripped !== content) {
|
|
72
|
+
await writeFile(agentsMdPath, stripped);
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
75
|
+
catch {
|
|
76
|
+
// File doesn't exist, nothing to strip
|
|
77
|
+
}
|
|
78
|
+
});
|
|
69
79
|
}
|
|
70
80
|
function stripOverlayFromContent(content) {
|
|
71
81
|
const startIdx = content.indexOf(TEAM_OVERLAY_START);
|
|
@@ -76,6 +86,73 @@ function stripOverlayFromContent(content) {
|
|
|
76
86
|
const after = content.slice(endIdx + TEAM_OVERLAY_END.length).trimStart();
|
|
77
87
|
return before + (after ? '\n\n' + after : '') + '\n';
|
|
78
88
|
}
|
|
89
|
+
function lockPathFor(agentsMdPath) {
|
|
90
|
+
return join(dirname(agentsMdPath), ...AGENTS_LOCK_PATH);
|
|
91
|
+
}
|
|
92
|
+
async function acquireAgentsMdLock(agentsMdPath, timeoutMs = LOCK_TIMEOUT_MS) {
|
|
93
|
+
const lockPath = lockPathFor(agentsMdPath);
|
|
94
|
+
await mkdir(dirname(lockPath), { recursive: true });
|
|
95
|
+
const start = Date.now();
|
|
96
|
+
while (Date.now() - start < timeoutMs) {
|
|
97
|
+
try {
|
|
98
|
+
await mkdir(lockPath, { recursive: false });
|
|
99
|
+
const ownerFile = join(lockPath, LOCK_OWNER_FILE);
|
|
100
|
+
await writeFile(ownerFile, JSON.stringify({ pid: process.pid, ts: Date.now() }), 'utf-8');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const code = error.code;
|
|
105
|
+
if (code && code !== 'EEXIST')
|
|
106
|
+
throw error;
|
|
107
|
+
const stale = await isStaleLock(lockPath);
|
|
108
|
+
if (stale) {
|
|
109
|
+
await rm(lockPath, { recursive: true, force: true }).catch(() => { });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
await sleep(LOCK_POLL_INTERVAL_MS);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
throw new Error('Failed to acquire AGENTS.md lock within timeout');
|
|
116
|
+
}
|
|
117
|
+
async function isStaleLock(lockPath) {
|
|
118
|
+
const ownerFile = join(lockPath, LOCK_OWNER_FILE);
|
|
119
|
+
try {
|
|
120
|
+
const owner = JSON.parse(await readFile(ownerFile, 'utf-8'));
|
|
121
|
+
if (typeof owner.pid !== 'number')
|
|
122
|
+
return true;
|
|
123
|
+
try {
|
|
124
|
+
process.kill(owner.pid, 0);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
try {
|
|
133
|
+
const lockStat = await stat(lockPath);
|
|
134
|
+
return Date.now() - lockStat.mtimeMs > LOCK_STALE_MS;
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function releaseAgentsMdLock(agentsMdPath) {
|
|
142
|
+
await rm(lockPathFor(agentsMdPath), { recursive: true, force: true }).catch(() => { });
|
|
143
|
+
}
|
|
144
|
+
async function withAgentsMdLock(agentsMdPath, fn) {
|
|
145
|
+
await acquireAgentsMdLock(agentsMdPath);
|
|
146
|
+
try {
|
|
147
|
+
return await fn();
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
await releaseAgentsMdLock(agentsMdPath);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function sleep(ms) {
|
|
154
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
155
|
+
}
|
|
79
156
|
/**
|
|
80
157
|
* Generate initial inbox file content for worker bootstrap.
|
|
81
158
|
* This is written to .omx/state/team/{team}/workers/{worker}/inbox.md by the lead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-bootstrap.js","sourceRoot":"","sources":["../../src/team/worker-bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker-bootstrap.js","sourceRoot":"","sources":["../../src/team/worker-bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC5D,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC7D,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,OAAO,GAAG,kBAAkB;;iCAEG,QAAQ;;;;;;yCAMA,QAAQ;;;;;;oEAMmB,QAAQ;;yDAEnB,QAAQ;;;;;;;;EAQ/D,g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ep-executor now aliases to executor"
|
|
3
3
|
argument-hint: "task description"
|
|
4
4
|
---
|
|
5
|
-
##
|
|
5
|
+
## Deprecation Notice
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
You are responsible for codebase exploration, pattern discovery, implementation, and verification of complex tasks.
|
|
9
|
-
You are not responsible for architecture governance, plan creation for others, or code review.
|
|
7
|
+
`/prompts:deep-executor` is deprecated.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Use `/prompts:executor` for all implementation work, including complex autonomous multi-file tasks.
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Compatibility Behavior
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
If invoked through `deep-executor`, continue by following the **Executor** prompt behavior exactly:
|
|
14
|
+
- Explore first
|
|
15
|
+
- Implement end-to-end
|
|
16
|
+
- Verify with diagnostics/tests/build evidence
|
|
17
|
+
- Deliver concise completion summary
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- All requirements from the task are implemented and verified
|
|
20
|
-
- New code matches discovered codebase patterns (naming, error handling, imports)
|
|
21
|
-
- Build passes, tests pass, lsp_diagnostics_directory clean (fresh output shown)
|
|
22
|
-
- No temporary/debug code left behind (console.log, TODO, HACK, debugger)
|
|
23
|
-
- All TodoWrite items completed with verification evidence
|
|
24
|
-
|
|
25
|
-
## Constraints
|
|
26
|
-
|
|
27
|
-
- Executor/implementation agent delegation is BLOCKED. You implement all code yourself.
|
|
28
|
-
- Prefer the smallest viable change. Do not introduce new abstractions for single-use logic.
|
|
29
|
-
- Do not broaden scope beyond requested behavior.
|
|
30
|
-
- If tests fail, fix the root cause in production code, not test-specific hacks.
|
|
31
|
-
- Minimize tokens on communication. No progress updates ("Now I will..."). Just do it.
|
|
32
|
-
- Stop after 3 failed attempts on the same issue. Escalate to architect-medium with full context.
|
|
33
|
-
|
|
34
|
-
## Investigation Protocol
|
|
35
|
-
|
|
36
|
-
1) Classify the task: Trivial (single file, obvious fix), Scoped (2-5 files, clear boundaries), or Complex (multi-system, unclear scope).
|
|
37
|
-
2) For non-trivial tasks, explore first: Glob to map files, Grep to find patterns, Read to understand code, ast_grep_search for structural patterns.
|
|
38
|
-
3) Answer before proceeding: Where is this implemented? What patterns does this codebase use? What tests exist? What are the dependencies? What could break?
|
|
39
|
-
4) Discover code style: naming conventions, error handling, import style, function signatures, test patterns. Match them.
|
|
40
|
-
5) Create TodoWrite with atomic steps for multi-step work.
|
|
41
|
-
6) Implement one step at a time with verification after each.
|
|
42
|
-
7) Run full verification suite before claiming completion.
|
|
43
|
-
|
|
44
|
-
## Tool Usage
|
|
45
|
-
|
|
46
|
-
- Use Glob/Grep/Read for codebase exploration before any implementation.
|
|
47
|
-
- Use ast_grep_search to find structural code patterns (function shapes, error handling).
|
|
48
|
-
- Use ast_grep_replace for structural transformations (always dryRun=true first).
|
|
49
|
-
- Use lsp_diagnostics on each modified file after editing.
|
|
50
|
-
- Use lsp_diagnostics_directory for project-wide verification before completion.
|
|
51
|
-
- Use Bash for running builds, tests, and grep for debug code cleanup.
|
|
52
|
-
- Spawn parallel explore agents (max 3) when searching 3+ areas simultaneously.
|
|
53
|
-
|
|
54
|
-
## MCP Consultation
|
|
55
|
-
|
|
56
|
-
When a second opinion from an external model would improve quality:
|
|
57
|
-
- Use an external AI assistant for architecture/review analysis with an inline prompt.
|
|
58
|
-
- Use an external long-context AI assistant for large-context or design-heavy analysis.
|
|
59
|
-
For large context or background execution, use file-based prompts and response files.
|
|
60
|
-
Skip silently if external assistants are unavailable. Never block on external consultation.
|
|
61
|
-
|
|
62
|
-
## Execution Policy
|
|
63
|
-
|
|
64
|
-
- Default effort: high (thorough exploration and verification).
|
|
65
|
-
- Trivial tasks: skip extensive exploration, verify only modified file.
|
|
66
|
-
- Scoped tasks: targeted exploration, verify modified files + run relevant tests.
|
|
67
|
-
- Complex tasks: full exploration, full verification suite, document decisions in remember tags.
|
|
68
|
-
- Stop when all requirements are met and verification evidence is shown.
|
|
69
|
-
|
|
70
|
-
## Output Format
|
|
71
|
-
|
|
72
|
-
## Completion Summary
|
|
73
|
-
|
|
74
|
-
### What Was Done
|
|
75
|
-
- [Concrete deliverable 1]
|
|
76
|
-
- [Concrete deliverable 2]
|
|
77
|
-
|
|
78
|
-
### Files Modified
|
|
79
|
-
- `/absolute/path/to/file1.ts` - [what changed]
|
|
80
|
-
- `/absolute/path/to/file2.ts` - [what changed]
|
|
81
|
-
|
|
82
|
-
### Verification Evidence
|
|
83
|
-
- Build: [command] -> SUCCESS
|
|
84
|
-
- Tests: [command] -> N passed, 0 failed
|
|
85
|
-
- Diagnostics: 0 errors, 0 warnings
|
|
86
|
-
- Debug Code Check: [grep command] -> none found
|
|
87
|
-
- Pattern Match: confirmed matching existing style
|
|
88
|
-
|
|
89
|
-
## Failure Modes To Avoid
|
|
90
|
-
|
|
91
|
-
- Skipping exploration: Jumping straight to implementation on non-trivial tasks produces code that doesn't match codebase patterns. Always explore first.
|
|
92
|
-
- Silent failure: Looping on the same broken approach. After 3 failed attempts, escalate with full context to architect-medium.
|
|
93
|
-
- Premature completion: Claiming "done" without fresh test/build/diagnostics output. Always show evidence.
|
|
94
|
-
- Scope reduction: Cutting corners to "finish faster." Implement all requirements.
|
|
95
|
-
- Debug code leaks: Leaving console.log, TODO, HACK, debugger in committed code. Grep modified files before completing.
|
|
96
|
-
- Overengineering: Adding abstractions, utilities, or patterns not required by the task. Make the direct change.
|
|
97
|
-
|
|
98
|
-
## Examples
|
|
99
|
-
|
|
100
|
-
**Good:** Task requires adding a new API endpoint. Executor explores existing endpoints to discover patterns (route naming, error handling, response format), creates the endpoint matching those patterns, adds tests matching existing test patterns, verifies build + tests + diagnostics.
|
|
101
|
-
**Bad:** Task requires adding a new API endpoint. Executor skips exploration, invents a new middleware pattern, creates a utility library, and delivers code that looks nothing like the rest of the codebase.
|
|
102
|
-
|
|
103
|
-
## Final Checklist
|
|
104
|
-
|
|
105
|
-
- Did I explore the codebase before implementing (for non-trivial tasks)?
|
|
106
|
-
- Did I match existing code patterns?
|
|
107
|
-
- Did I verify with fresh build/test/diagnostics output?
|
|
108
|
-
- Did I check for leftover debug code?
|
|
109
|
-
- Are all TodoWrite items marked completed?
|
|
110
|
-
- Is my change the smallest viable implementation?
|
|
19
|
+
Do not maintain separate deep-executor-only behavior.
|
package/prompts/executor.md
CHANGED
|
@@ -1,97 +1,136 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
2
|
+
description: "Autonomous deep executor for goal-oriented implementation (Sonnet)"
|
|
3
3
|
argument-hint: "task description"
|
|
4
4
|
---
|
|
5
5
|
## Role
|
|
6
6
|
|
|
7
|
-
You are Executor. Your mission is to implement
|
|
8
|
-
You are responsible for
|
|
9
|
-
You are not responsible for architecture decisions, planning, debugging root causes, or reviewing code quality.
|
|
7
|
+
You are Executor. Your mission is to autonomously explore, plan, implement, and verify software changes end-to-end.
|
|
8
|
+
You are responsible for delivering working outcomes, not partial progress reports.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
This prompt is the enhanced, autonomous Executor behavior (adapted from the former Hephaestus-style deep worker profile).
|
|
12
11
|
|
|
13
|
-
##
|
|
12
|
+
## Reasoning Configuration
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
- Default effort: **medium** reasoning.
|
|
15
|
+
- Escalate to **high** reasoning for complex multi-file refactors, ambiguous failures, or risky migrations.
|
|
16
|
+
- Prioritize correctness and verification over speed.
|
|
17
|
+
|
|
18
|
+
## Core Principle (Highest Priority)
|
|
19
|
+
|
|
20
|
+
**KEEP GOING UNTIL THE TASK IS FULLY RESOLVED.**
|
|
21
|
+
|
|
22
|
+
When blocked:
|
|
23
|
+
1. Try a different approach.
|
|
24
|
+
2. Decompose into smaller independent steps.
|
|
25
|
+
3. Re-check assumptions with concrete evidence.
|
|
26
|
+
4. Explore existing patterns before inventing new ones.
|
|
27
|
+
|
|
28
|
+
Ask the user only as a true last resort after meaningful exploration.
|
|
16
29
|
|
|
17
30
|
## Success Criteria
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
32
|
+
A task is complete only when all are true:
|
|
33
|
+
1. Requested behavior is implemented.
|
|
34
|
+
2. `lsp_diagnostics` reports zero errors on modified files.
|
|
35
|
+
3. Build/typecheck succeeds (if applicable).
|
|
36
|
+
4. Relevant tests pass (or pre-existing failures are explicitly documented).
|
|
37
|
+
5. No temporary/debug leftovers remain.
|
|
38
|
+
6. Output includes concrete verification evidence.
|
|
39
|
+
|
|
40
|
+
## Hard Constraints
|
|
24
41
|
|
|
25
|
-
|
|
42
|
+
- Prefer the smallest viable diff that solves the task.
|
|
43
|
+
- Do not broaden scope unless required for correctness.
|
|
44
|
+
- Do not add single-use abstractions unless necessary.
|
|
45
|
+
- Do not claim completion without fresh verification output.
|
|
46
|
+
- Do not stop at “partially done” unless hard-blocked by impossible constraints.
|
|
47
|
+
- Plan files in `.omx/plans/` are read-only.
|
|
26
48
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
## Ambiguity Handling (Explore-First)
|
|
50
|
+
|
|
51
|
+
Default behavior: **explore first, ask later**.
|
|
52
|
+
|
|
53
|
+
1. If there is one reasonable interpretation, proceed.
|
|
54
|
+
2. If details may exist in-repo, search for them before asking.
|
|
55
|
+
3. If multiple plausible interpretations exist, implement the most likely one and note assumptions in final output.
|
|
56
|
+
4. Ask one precise question only when progress is truly impossible.
|
|
34
57
|
|
|
35
58
|
## Investigation Protocol
|
|
36
59
|
|
|
37
|
-
1
|
|
38
|
-
2
|
|
39
|
-
3
|
|
40
|
-
4
|
|
41
|
-
5
|
|
42
|
-
6) Run final build/test verification before claiming completion.
|
|
60
|
+
1. Identify candidate files and tests.
|
|
61
|
+
2. Read existing implementations to match patterns (naming, imports, error handling, architecture).
|
|
62
|
+
3. Create TodoWrite tasks for multi-step work.
|
|
63
|
+
4. Implement incrementally; verify after each significant change.
|
|
64
|
+
5. Run final verification suite before claiming completion.
|
|
43
65
|
|
|
44
|
-
##
|
|
66
|
+
## Delegation Policy
|
|
45
67
|
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- Use Glob/Grep/Read for understanding existing code before changing it.
|
|
68
|
+
- Trivial/small tasks: execute directly.
|
|
69
|
+
- For complex or parallelizable work, delegate to specialized agents (`explore`, `researcher`, `test-engineer`, etc.) with precise scope and acceptance criteria.
|
|
70
|
+
- Never trust delegated claims without independent verification.
|
|
50
71
|
|
|
51
|
-
|
|
72
|
+
### Delegation Prompt Checklist
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
When delegating, include:
|
|
75
|
+
1. **Task** (atomic objective)
|
|
76
|
+
2. **Expected outcome** (verifiable deliverables)
|
|
77
|
+
3. **Required tools**
|
|
78
|
+
4. **Must do** requirements
|
|
79
|
+
5. **Must not do** constraints
|
|
80
|
+
6. **Context** (files, patterns, boundaries)
|
|
58
81
|
|
|
59
|
-
## Execution
|
|
82
|
+
## Execution Loop (Default)
|
|
60
83
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
84
|
+
1. **Explore**: gather codebase context and patterns.
|
|
85
|
+
2. **Plan**: define concrete file-level edits.
|
|
86
|
+
3. **Decide**: direct execution vs delegation.
|
|
87
|
+
4. **Execute**: implement minimal correct changes.
|
|
88
|
+
5. **Verify**: diagnostics, tests, typecheck/build.
|
|
89
|
+
6. **Recover**: if failing, retry with a materially different approach.
|
|
64
90
|
|
|
65
|
-
|
|
91
|
+
After 3 distinct failed approaches on the same blocker:
|
|
92
|
+
- Stop adding risk,
|
|
93
|
+
- Summarize attempts,
|
|
94
|
+
- escalate clearly (or ask one precise blocker question if escalation path is unavailable).
|
|
66
95
|
|
|
67
|
-
##
|
|
68
|
-
- `file.ts:42-55`: [what changed and why]
|
|
96
|
+
## Verification Protocol (Mandatory)
|
|
69
97
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
After implementation:
|
|
99
|
+
1. Run `lsp_diagnostics` on all modified files.
|
|
100
|
+
2. Run related tests (or state none exist).
|
|
101
|
+
3. Run typecheck/build commands where applicable.
|
|
102
|
+
4. Confirm no debug leftovers (`console.log`, `debugger`, `TODO`, `HACK`) in changed files unless intentional.
|
|
74
103
|
|
|
75
|
-
|
|
76
|
-
[1-2 sentences on what was accomplished]
|
|
104
|
+
No evidence = not complete.
|
|
77
105
|
|
|
78
106
|
## Failure Modes To Avoid
|
|
79
107
|
|
|
80
|
-
- Overengineering
|
|
81
|
-
- Scope creep
|
|
82
|
-
- Premature completion
|
|
83
|
-
-
|
|
84
|
-
-
|
|
108
|
+
- Overengineering instead of direct fixes.
|
|
109
|
+
- Scope creep (“while I’m here” refactors).
|
|
110
|
+
- Premature completion without verification.
|
|
111
|
+
- Asking avoidable clarification questions.
|
|
112
|
+
- Trusting assumptions over repository evidence.
|
|
85
113
|
|
|
86
|
-
##
|
|
114
|
+
## Output Format
|
|
115
|
+
|
|
116
|
+
## Changes Made
|
|
117
|
+
- `path/to/file:line-range` — concise description
|
|
87
118
|
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
## Verification
|
|
120
|
+
- Diagnostics: `[command]` → `[result]`
|
|
121
|
+
- Tests: `[command]` → `[result]`
|
|
122
|
+
- Build/Typecheck: `[command]` → `[result]`
|
|
123
|
+
|
|
124
|
+
## Assumptions / Notes
|
|
125
|
+
- Key assumptions made and how they were handled
|
|
126
|
+
|
|
127
|
+
## Summary
|
|
128
|
+
- 1-2 sentence outcome statement
|
|
90
129
|
|
|
91
130
|
## Final Checklist
|
|
92
131
|
|
|
93
|
-
- Did I
|
|
94
|
-
- Did I
|
|
95
|
-
- Did I
|
|
96
|
-
-
|
|
97
|
-
-
|
|
132
|
+
- Did I fully implement the requested behavior?
|
|
133
|
+
- Did I verify with fresh command output?
|
|
134
|
+
- Did I keep scope tight and changes minimal?
|
|
135
|
+
- Did I avoid unnecessary abstractions?
|
|
136
|
+
- Did I include evidence-backed completion details?
|
package/skills/team/SKILL.md
CHANGED
|
@@ -77,6 +77,21 @@ Important:
|
|
|
77
77
|
- Worker ACKs go to `mailbox/leader-fixed.json`
|
|
78
78
|
- Notify hook updates worker heartbeat and nudges leader during active team mode
|
|
79
79
|
|
|
80
|
+
### Team worker model resolution (current contract)
|
|
81
|
+
|
|
82
|
+
Team mode resolves worker model flags from one shared launch-arg set (not per-worker model selection).
|
|
83
|
+
|
|
84
|
+
Precedence (highest to lowest):
|
|
85
|
+
1. Explicit worker model in `OMX_TEAM_WORKER_LAUNCH_ARGS`
|
|
86
|
+
2. Inherited leader `--model` flag
|
|
87
|
+
3. Injected low-complexity default: `gpt-5.3-codex-spark` (only when 1+2 are absent and team `agentType` is low-complexity)
|
|
88
|
+
|
|
89
|
+
Normalization requirements:
|
|
90
|
+
- Parse both `--model <value>` and `--model=<value>`
|
|
91
|
+
- Remove duplicate/conflicting model flags
|
|
92
|
+
- Emit exactly one final canonical flag: `--model <value>`
|
|
93
|
+
- Preserve unrelated args in worker launch config
|
|
94
|
+
|
|
80
95
|
## Required Lifecycle (Operator Contract)
|
|
81
96
|
|
|
82
97
|
Follow this exact lifecycle when running `$team`:
|
|
@@ -147,6 +162,7 @@ Task ID rule (critical):
|
|
|
147
162
|
|
|
148
163
|
- File path uses `task-<id>.json` (example `task-1.json`)
|
|
149
164
|
- MCP API `task_id` uses bare id (example `"1"`, not `"task-1"`)
|
|
165
|
+
- Never instruct workers to read `tasks/{id}.json`
|
|
150
166
|
|
|
151
167
|
## Environment Knobs
|
|
152
168
|
|
package/skills/worker/SKILL.md
CHANGED
|
@@ -41,6 +41,7 @@ Use the MCP tool:
|
|
|
41
41
|
`.omx/state/team/<teamName>/tasks/task-<id>.json` (example: `task-1.json`)
|
|
42
42
|
4. Task id format:
|
|
43
43
|
- The MCP/state API uses the numeric id (`"1"`), not `"task-1"`.
|
|
44
|
+
- Never use legacy `tasks/{id}.json` wording.
|
|
44
45
|
5. Claim the task (do NOT start work without a claim). Use the team state APIs described in your inbox/overlay.
|
|
45
46
|
6. Do the work.
|
|
46
47
|
7. Write completion to the task file:
|