@sockulags/agent-os 0.9.0 → 0.9.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.
Files changed (40) hide show
  1. package/README.md +23 -16
  2. package/cli/index.mjs +375 -52
  3. package/cli/index.test.mjs +196 -38
  4. package/package.json +2 -2
  5. package/policy.md +6 -6
  6. package/skills/batch-work/SKILL.md +43 -0
  7. package/skills/batch-work/agents/openai.yaml +2 -0
  8. package/skills/batch-work/references/manifest.md +100 -0
  9. package/skills/batch-work/scripts/manifest-hash.mjs +263 -0
  10. package/skills/batch-work/scripts/test-manifest-hash.mjs +132 -0
  11. package/skills/chart-work/SKILL.md +37 -0
  12. package/skills/chart-work/agents/openai.yaml +2 -0
  13. package/skills/chart-work/references/elicitation.md +25 -0
  14. package/skills/chart-work/references/map.md +84 -0
  15. package/skills/chart-work/references/prototypes.md +21 -0
  16. package/skills/deliver-work/SKILL.md +12 -0
  17. package/skills/deliver-work/agents/openai.yaml +2 -0
  18. package/skills/deliver-work/workflow.md +109 -0
  19. package/skills/diagnose-before-fix/SKILL.md +24 -0
  20. package/skills/dispatch-next/SKILL.md +28 -0
  21. package/skills/dispatch-next/agents/openai.yaml +2 -0
  22. package/skills/explain-work/SKILL.md +27 -0
  23. package/skills/explain-work/agents/openai.yaml +2 -0
  24. package/skills/guide-me/SKILL.md +36 -0
  25. package/skills/guide-me/agents/openai.yaml +2 -0
  26. package/skills/init-agent-os/SKILL.md +39 -0
  27. package/skills/init-agent-os/agents/openai.yaml +2 -0
  28. package/skills/notice-lesson/SKILL.md +20 -0
  29. package/skills/record-lesson/SKILL.md +31 -0
  30. package/skills/record-lesson/agents/openai.yaml +2 -0
  31. package/skills/scope-guard/SKILL.md +21 -0
  32. package/skills/shape-work/SKILL.md +39 -0
  33. package/skills/shape-work/agents/openai.yaml +2 -0
  34. package/skills/shape-work/references/implementation-issues.md +69 -0
  35. package/skills/shape-work/references/mockups.md +23 -0
  36. package/skills/understand-work/SKILL.md +31 -0
  37. package/skills/understand-work/agents/openai.yaml +2 -0
  38. package/skills/verify-before-done/SKILL.md +29 -0
  39. package/skills/writing-skills/SKILL.md +68 -0
  40. package/skills/writing-skills/agents/openai.yaml +2 -0
@@ -1,11 +1,42 @@
1
1
  import assert from 'node:assert/strict'
2
- import test from 'node:test'
3
- import { buildPlan, executeInstall, parseArgs, resolveOptions, run } from './index.mjs'
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import test, { after } from 'node:test'
6
+ import {
7
+ buildPlan,
8
+ executeInstall,
9
+ INSTALL_MANIFEST,
10
+ PACKAGE_NAME,
11
+ parseArgs,
12
+ planPolicyUpdate,
13
+ resolveOptions,
14
+ run,
15
+ targetSkillRoot,
16
+ VERSION
17
+ } from './index.mjs'
4
18
 
5
- test('defaults to guided install', () => {
19
+ const temporaryRoots = []
20
+
21
+ function temporaryRoot() {
22
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-cli-'))
23
+ temporaryRoots.push(root)
24
+ return root
25
+ }
26
+
27
+ function silentOutput() {
28
+ return { write() {} }
29
+ }
30
+
31
+ after(() => {
32
+ for (const root of temporaryRoots) fs.rmSync(root, { recursive: true, force: true })
33
+ })
34
+
35
+ test('defaults to guided direct install', () => {
6
36
  assert.deepEqual(parseArgs([]), {
7
37
  command: 'install',
8
38
  platform: null,
39
+ method: null,
9
40
  scope: null,
10
41
  policy: null,
11
42
  yes: false,
@@ -15,10 +46,12 @@ test('defaults to guided install', () => {
15
46
  })
16
47
  })
17
48
 
18
- test('parses non-interactive update flags', () => {
49
+ test('parses non-interactive direct update flags', () => {
19
50
  assert.deepEqual(parseArgs([
20
51
  'update',
21
52
  '--platform=both',
53
+ '--method',
54
+ 'direct',
22
55
  '--scope',
23
56
  'project',
24
57
  '--no-policy',
@@ -26,6 +59,7 @@ test('parses non-interactive update flags', () => {
26
59
  ]), {
27
60
  command: 'update',
28
61
  platform: 'both',
62
+ method: 'direct',
29
63
  scope: 'project',
30
64
  policy: false,
31
65
  yes: true,
@@ -39,6 +73,7 @@ test('supports Claude Code as a platform alias and upgrade as update', () => {
39
73
  assert.deepEqual(parseArgs(['upgrade', '--platform', 'claude-code', '--yes']), {
40
74
  command: 'update',
41
75
  platform: 'claude',
76
+ method: null,
42
77
  scope: null,
43
78
  policy: null,
44
79
  yes: true,
@@ -48,16 +83,23 @@ test('supports Claude Code as a platform alias and upgrade as update', () => {
48
83
  })
49
84
  })
50
85
 
51
- test('prints scoped npm commands while preserving the agent-os binary name', async () => {
86
+ test('prints scoped npm commands and explains the direct default', async () => {
52
87
  const chunks = []
53
88
  await run(['--help'], { output: { write: (chunk) => chunks.push(chunk) } })
54
89
  const help = chunks.join('')
55
90
  assert.match(help, /npx @sockulags\/agent-os install/)
56
- assert.match(help, /npm install --global @sockulags\/agent-os@latest/)
91
+ assert.match(help, /does not require Codex or Claude Code CLI/)
92
+ assert.match(help, /--method <name>\s+direct \(default\) or plugin/)
57
93
  })
58
94
 
59
- test('rejects conflicting policy flags', () => {
95
+ test('rejects conflicting policy flags and direct local scope', async () => {
60
96
  assert.throws(() => parseArgs(['install', '--policy', '--no-policy']), /one of --policy and --no-policy/)
97
+ await assert.rejects(
98
+ resolveOptions(parseArgs([
99
+ 'install', '--platform', 'codex', '--method', 'direct', '--scope', 'local', '--yes'
100
+ ]), { input: { isTTY: false }, output: { isTTY: false } }),
101
+ /Local scope is available only with --method plugin/
102
+ )
61
103
  })
62
104
 
63
105
  test('requires explicit non-interactive choices', async () => {
@@ -70,57 +112,179 @@ test('requires explicit non-interactive choices', async () => {
70
112
  )
71
113
  })
72
114
 
73
- test('builds a Codex install plan without policy mutation', () => {
115
+ test('builds direct filesystem plans without marketplace commands', () => {
116
+ const root = temporaryRoot()
74
117
  const plan = buildPlan({
75
118
  command: 'install',
76
- platform: 'codex',
119
+ platform: 'both',
120
+ method: 'direct',
77
121
  scope: 'user',
78
122
  policy: false
123
+ }, { homeDir: root, cwd: root })
124
+ assert.deepEqual(plan.map((step) => step.kind), ['install-skills', 'install-skills'])
125
+ assert.deepEqual(plan.map((step) => step.command), ['filesystem', 'filesystem'])
126
+ assert.equal(plan[0].args[0], path.join(root, '.claude', 'skills'))
127
+ assert.equal(plan[1].args[0], path.join(root, '.codex', 'skills'))
128
+ })
129
+
130
+ test('maps project and user targets for both hosts', () => {
131
+ const root = temporaryRoot()
132
+ const project = path.join(root, 'project')
133
+ assert.equal(targetSkillRoot('codex', 'user', { homeDir: root, cwd: project }), path.join(root, '.codex', 'skills'))
134
+ assert.equal(targetSkillRoot('claude', 'user', { homeDir: root, cwd: project }), path.join(root, '.claude', 'skills'))
135
+ assert.equal(targetSkillRoot('codex', 'project', { homeDir: root, cwd: project }), path.join(project, '.agents', 'skills'))
136
+ assert.equal(targetSkillRoot('claude', 'project', { homeDir: root, cwd: project }), path.join(project, '.claude', 'skills'))
137
+ })
138
+
139
+ test('installs both hosts and policy without either host CLI', async () => {
140
+ const root = temporaryRoot()
141
+ const homeDir = path.join(root, 'home')
142
+ const cwd = path.join(root, 'project')
143
+ await executeInstall({
144
+ command: 'install',
145
+ platform: 'both',
146
+ method: 'direct',
147
+ scope: 'user',
148
+ policy: true
149
+ }, {
150
+ output: silentOutput(),
151
+ homeDir,
152
+ cwd,
153
+ exists: () => { throw new Error('host CLI lookup must not run') },
154
+ execute: () => { throw new Error('external command must not run') }
79
155
  })
80
- assert.deepEqual(plan.map((step) => step.kind), [
81
- 'ensure-marketplace',
82
- 'add-marketplace-if-missing',
83
- 'install-plugin'
84
- ])
85
- assert.deepEqual(plan.at(-1).args, ['plugin', 'add', 'agent-os@agent-os'])
156
+
157
+ for (const agent of ['.claude', '.codex']) {
158
+ const skillsRoot = path.join(homeDir, agent, 'skills')
159
+ assert.equal(fs.existsSync(path.join(skillsRoot, 'shape-work', 'SKILL.md')), true)
160
+ const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, INSTALL_MANIFEST), 'utf8'))
161
+ assert.equal(manifest.package, PACKAGE_NAME)
162
+ assert.equal(manifest.version, VERSION)
163
+ assert.ok(manifest.skills.includes('shape-work'))
164
+ }
165
+ assert.match(fs.readFileSync(path.join(homeDir, '.claude', 'CLAUDE.md'), 'utf8'), /BEGIN AGENT OS/)
166
+ assert.match(fs.readFileSync(path.join(homeDir, '.codex', 'AGENTS.md'), 'utf8'), /BEGIN AGENT OS/)
167
+ })
168
+
169
+ test('updates only managed skills and preserves unrelated skills', async () => {
170
+ const root = temporaryRoot()
171
+ const homeDir = path.join(root, 'home')
172
+ const options = {
173
+ command: 'install',
174
+ platform: 'codex',
175
+ method: 'direct',
176
+ scope: 'user',
177
+ policy: false
178
+ }
179
+ await executeInstall(options, { output: silentOutput(), homeDir, cwd: root })
180
+
181
+ const skillsRoot = path.join(homeDir, '.codex', 'skills')
182
+ const managedFile = path.join(skillsRoot, 'shape-work', 'SKILL.md')
183
+ const foreignFile = path.join(skillsRoot, 'my-private-skill', 'SKILL.md')
184
+ fs.writeFileSync(managedFile, 'stale managed content\n')
185
+ fs.mkdirSync(path.dirname(foreignFile), { recursive: true })
186
+ fs.writeFileSync(foreignFile, 'private content\n')
187
+
188
+ await executeInstall({ ...options, command: 'update' }, { output: silentOutput(), homeDir, cwd: root })
189
+ assert.notEqual(fs.readFileSync(managedFile, 'utf8'), 'stale managed content\n')
190
+ assert.equal(fs.readFileSync(foreignFile, 'utf8'), 'private content\n')
191
+ })
192
+
193
+ test('refuses to overwrite a same-name skill without an Agent OS manifest', async () => {
194
+ const root = temporaryRoot()
195
+ const homeDir = path.join(root, 'home')
196
+ const collision = path.join(homeDir, '.codex', 'skills', 'shape-work', 'SKILL.md')
197
+ fs.mkdirSync(path.dirname(collision), { recursive: true })
198
+ fs.writeFileSync(collision, 'developer-owned\n')
199
+
200
+ await assert.rejects(
201
+ executeInstall({
202
+ command: 'install',
203
+ platform: 'codex',
204
+ method: 'direct',
205
+ scope: 'user',
206
+ policy: false
207
+ }, { output: silentOutput(), homeDir, cwd: root }),
208
+ /Refusing to overwrite unmanaged skills.*shape-work/
209
+ )
210
+ assert.equal(fs.readFileSync(collision, 'utf8'), 'developer-owned\n')
211
+ assert.equal(fs.existsSync(path.join(homeDir, '.codex', 'skills', INSTALL_MANIFEST)), false)
212
+ })
213
+
214
+ test('policy planning preserves surrounding text and rejects malformed markers', () => {
215
+ const policy = '# Policy\n'
216
+ const original = 'before\n\n<!-- BEGIN AGENT OS -->\nold\n<!-- END AGENT OS -->\nafter\n'
217
+ const updated = planPolicyUpdate(original, policy)
218
+ assert.equal(updated.status, 'UPDATED')
219
+ assert.equal(updated.content, 'before\n\n<!-- BEGIN AGENT OS -->\n# Policy\n<!-- END AGENT OS -->\nafter\n')
220
+ assert.throws(
221
+ () => planPolicyUpdate('<!-- BEGIN AGENT OS -->\nbroken\n', policy),
222
+ /Malformed Agent OS policy markers/
223
+ )
86
224
  })
87
225
 
88
- test('reports a missing host before running installation commands', async () => {
226
+ test('malformed policy markers abort before direct skill installation', async () => {
227
+ const root = temporaryRoot()
228
+ const homeDir = path.join(root, 'home')
229
+ const target = path.join(homeDir, '.codex', 'AGENTS.md')
230
+ fs.mkdirSync(path.dirname(target), { recursive: true })
231
+ fs.writeFileSync(target, '<!-- BEGIN AGENT OS -->\nbroken\n')
232
+
233
+ await assert.rejects(
234
+ executeInstall({
235
+ command: 'install',
236
+ platform: 'codex',
237
+ method: 'direct',
238
+ scope: 'user',
239
+ policy: true
240
+ }, { output: silentOutput(), homeDir, cwd: root }),
241
+ /Malformed Agent OS policy markers/
242
+ )
243
+ assert.equal(fs.existsSync(path.join(homeDir, '.codex', 'skills')), false)
244
+ })
245
+
246
+ test('plugin mode still requires only the selected host CLI', async () => {
89
247
  const calls = []
90
248
  await assert.rejects(
91
249
  executeInstall({
92
250
  command: 'install',
93
251
  platform: 'codex',
252
+ method: 'plugin',
94
253
  scope: 'user',
95
254
  policy: false
96
255
  }, {
97
- output: { write() {} },
256
+ output: silentOutput(),
98
257
  exists: () => false,
99
258
  execute: (...args) => calls.push(args)
100
259
  }),
101
- /Codex CLI was not found on PATH/
260
+ /Native plugin mode requires the selected host CLIs.*Codex/s
102
261
  )
103
262
  assert.deepEqual(calls, [])
104
263
  })
105
264
 
106
- test('updates both platforms and syncs policy through the host CLIs', async () => {
265
+ test('plugin update skips Git refresh for a registered local Codex marketplace', async () => {
107
266
  const calls = []
108
- const output = { write() {} }
109
267
  await executeInstall({
110
268
  command: 'update',
111
- platform: 'both',
269
+ platform: 'codex',
270
+ method: 'plugin',
112
271
  scope: 'user',
113
- policy: true
272
+ policy: false
114
273
  }, {
115
- output,
274
+ output: silentOutput(),
116
275
  exists: () => true,
117
- spawn: () => ({ status: 0 }),
118
- execute: (command, args, options = {}) => {
119
- calls.push({ command, args, options })
120
- if (options.capture) {
276
+ execute: (command, args) => {
277
+ calls.push([command, args])
278
+ if (args.join(' ') === 'plugin marketplace list --json') {
279
+ return { status: 0, stdout: JSON.stringify({ marketplaces: [{ name: 'agent-os' }] }), stderr: '' }
280
+ }
281
+ if (args.join(' ') === 'plugin list --json') {
121
282
  return {
122
283
  status: 0,
123
- stdout: JSON.stringify({ marketplaces: [] }),
284
+ stdout: JSON.stringify({ installed: [{
285
+ marketplaceName: 'agent-os',
286
+ marketplaceSource: { sourceType: 'local' }
287
+ }] }),
124
288
  stderr: ''
125
289
  }
126
290
  }
@@ -128,15 +292,9 @@ test('updates both platforms and syncs policy through the host CLIs', async () =
128
292
  }
129
293
  })
130
294
 
131
- assert.deepEqual(calls.map((call) => [call.command, call.args]), [
132
- ['claude', ['plugin', 'marketplace', 'list', '--json']],
133
- ['claude', ['plugin', 'marketplace', 'add', 'sockulags/agent-os']],
134
- ['claude', ['plugin', 'marketplace', 'update', 'agent-os-marketplace']],
135
- ['claude', ['plugin', 'install', 'agent-os@agent-os-marketplace', '--scope', 'user']],
136
- ['codex', ['plugin', 'marketplace', 'list', '--json']],
137
- ['codex', ['plugin', 'marketplace', 'add', 'sockulags/agent-os']],
138
- ['codex', ['plugin', 'marketplace', 'upgrade', 'agent-os']],
139
- ['codex', ['plugin', 'add', 'agent-os@agent-os']],
140
- ['pwsh', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', calls.at(-1)?.args?.at(-1)]]
295
+ assert.deepEqual(calls.map((call) => call[1]), [
296
+ ['plugin', 'marketplace', 'list', '--json'],
297
+ ['plugin', 'list', '--json'],
298
+ ['plugin', 'add', 'agent-os@agent-os']
141
299
  ])
142
300
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sockulags/agent-os",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A lightweight personal agent operating system with an npx installer for Claude Code and Codex.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "files": [
10
10
  "cli/",
11
11
  "policy.md",
12
- "skills/init-agent-os/scripts/policy-block.ps1"
12
+ "skills/"
13
13
  ],
14
14
  "engines": {
15
15
  "node": ">=18.18"
package/policy.md CHANGED
@@ -29,12 +29,12 @@ Rules:
29
29
  - Never force the reader to cross-reference labels or numbering invented earlier in the text — say what you mean in place.
30
30
  - Explanations belong in prose; tables only for short enumerable facts.
31
31
  - Calibrate tone to the topic: playfulness is fine, neutral and factual the moment the subject is serious. When in doubt, it is serious.
32
- - Orchestration is opt-in: `/agent-os:guide-me`, `/agent-os:chart-work`, `/agent-os:shape-work`,
33
- `/agent-os:batch-work`, `/agent-os:deliver-work`, `/agent-os:dispatch-next`,
34
- `/agent-os:init-agent-os`, `/agent-os:understand-work`, `/agent-os:explain-work`,
35
- `/agent-os:record-lesson` exist for planned work; never self-invoke them. One exception: a
36
- workflow may continue into the workflow its exit contract names once the developer approves that
37
- exit, as `guide-me` does after its approved plain-language gate.
32
+ - Orchestration is opt-in: `guide-me`, `chart-work`, `shape-work`, `batch-work`, `deliver-work`,
33
+ `dispatch-next`, `init-agent-os`, `understand-work`, `explain-work`, and `record-lesson` exist for
34
+ planned work; invoke them through the name exposed by the host (`/guide-me` for direct Claude
35
+ skills, `/agent-os:guide-me` for the Claude plugin, or `$guide-me` for Codex). Never self-invoke
36
+ them. One exception: a workflow may continue into the workflow its exit contract names once the
37
+ developer approves that exit, as `guide-me` does after its approved plain-language gate.
38
38
 
39
39
  ## Preferences (seed defaults — project policy overrides)
40
40
 
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: batch-work
3
+ description: Plans and runs several decision-ready units through isolated workers and aggregate verification. User-invoked for an explicit batch. Not for unresolved decisions, one unit, or a loose backlog.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Batch work
8
+
9
+ Read project policy and [references/manifest.md](references/manifest.md). The request defines whether
10
+ to plan the batch, execute it, or both.
11
+
12
+ Batch-work consumes an existing set of implementation-ready, dependency-mapped issues. It does not
13
+ discover, decompose, or represent a product shape, and the existence of several issues does not
14
+ invoke it. Use this workflow only when the developer explicitly requests an integrated batch.
15
+
16
+ ## Contract
17
+
18
+ - **Outcome:** one integrated candidate whose full behavior passes the aggregate ground truth.
19
+ - **Working surface:** the manifest, coordinator branch, isolated task worktrees, and task branches.
20
+ - **Boundaries:** workers own only their task workspace; the coordinator owns the manifest and
21
+ integration. Merge, deploy, destructive cleanup, and external effects follow the request or
22
+ project policy.
23
+ - **Ground truth:** task checks on each result plus fresh aggregate checks after integration.
24
+
25
+ ## Loop
26
+
27
+ 1. Confirm every source issue has a stable identity, outcome, scope, dependencies, and checks. Route
28
+ unresolved product decisions or missing decomposition to `shape-work` or `chart-work`.
29
+ 2. Create or update `.agent-os/batches/<batch-slug>.md`. Validate its graph and definition hashes.
30
+ A planning-only request stops here; an execution request continues.
31
+ 3. Reconcile the manifest with live Git and worktree state before every dispatch wave.
32
+ 4. Dispatch the open frontier into isolated workspaces within project concurrency. Each worker gets
33
+ one current task definition and returns a commit SHA, changed files, checks, and uncertainty.
34
+ 5. Integrate completed tasks in dependency order. Detect already-contained commits, rerun relevant
35
+ checks on the integrated head, and stop on conflicts rather than guessing.
36
+ 6. After all tasks integrate, run fresh aggregate checks.
37
+ 7. Treat the integrated batch as material. Apply the
38
+ [deliver-work review gate](../deliver-work/workflow.md#review-gate) to the complete candidate,
39
+ resolve supported findings, and rerun affected aggregate checks.
40
+ 8. Deliver the candidate only to the boundary named by the request or project policy.
41
+
42
+ Definition drift while work is active invalidates the affected task result and requires an explicit
43
+ replan or fresh attempt. Individual worker checks never substitute for aggregate verification.
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: false
@@ -0,0 +1,100 @@
1
+ # Batch manifest
2
+
3
+ The coordinator-owned manifest lives at `.agent-os/batches/<batch-slug>.md`. It is resumable working
4
+ state, not an approval ledger.
5
+
6
+ ## Cursor
7
+
8
+ ```yaml
9
+ ---
10
+ agent_os_batch: 2
11
+ batch_id: <stable slug>
12
+ status: planned
13
+ next_action: dispatch-frontier
14
+ manifest_hash: ""
15
+ ---
16
+ ```
17
+
18
+ Statuses are `planned`, `running`, `reconciling`, `verifying`, `ready`, `delivered`, and `blocked`.
19
+ Keep `next_action` concrete except after delivery.
20
+
21
+ ## Definitions
22
+
23
+ ```json batch-plan
24
+ {
25
+ "baseline_sha": "<integration baseline>",
26
+ "integration_branch": "<project convention>",
27
+ "max_workers": 2,
28
+ "retry_limit": 1,
29
+ "integration_strategy": "serial cherry-pick",
30
+ "aggregate_checks": []
31
+ }
32
+ ```
33
+
34
+ ```json batch-task
35
+ {
36
+ "task_key": "<stable within batch_id>",
37
+ "source": "<spec or issue link>",
38
+ "dependencies": [],
39
+ "scope": [],
40
+ "outcome": "",
41
+ "non_goals": [],
42
+ "checks": [],
43
+ "task_hash": ""
44
+ }
45
+ ```
46
+
47
+ Identity is `(batch_id, task_key)`. Run:
48
+
49
+ ```text
50
+ node skills/batch-work/scripts/manifest-hash.mjs <manifest.md>
51
+ node skills/batch-work/scripts/manifest-hash.mjs --check <manifest.md>
52
+ ```
53
+
54
+ The script validates fields, dependencies, cycles, runtime identity, and stable task and manifest
55
+ hashes. Hashes detect definition drift; they do not represent human approval.
56
+
57
+ ## Runtime
58
+
59
+ ```json batch-runtime
60
+ {
61
+ "tasks": [
62
+ {
63
+ "task_key": "<definition task_key>",
64
+ "state": "pending",
65
+ "attempt": 0,
66
+ "branch": "",
67
+ "worktree": "",
68
+ "worker_id": "",
69
+ "head_sha": "",
70
+ "result": ""
71
+ }
72
+ ]
73
+ }
74
+ ```
75
+
76
+ Task states are `pending`, `ready`, `running`, `succeeded`, `integrated`, `failed`, `blocked`, and
77
+ `conflict`. Persist repository-relative or portable worktree keys, not absolute machine paths.
78
+
79
+ Before launch, create the isolated branch and worktree and record a new attempt. A returned worker
80
+ identity moves it to `running`. The worker result is concise: head SHA, changed files, checks, and
81
+ remaining uncertainty. The coordinator verifies the live task hash and attempt before integration.
82
+
83
+ ## Frontier and reconciliation
84
+
85
+ The frontier contains pending tasks whose dependencies are integrated and whose scopes do not
86
+ overlap active work. Dispatch within host and project concurrency.
87
+
88
+ Only the coordinator edits the manifest and integration branch:
89
+
90
+ 1. Re-read live branches, worktrees, and manifest.
91
+ 2. Confirm the worker head belongs to the current task attempt.
92
+ 3. Integrate once in dependency order.
93
+ 4. Run the task checks on the integrated head.
94
+ 5. Recompute the frontier.
95
+
96
+ After all tasks integrate, run the aggregate checks against the complete candidate.
97
+ Worker-local checks are useful context but are not proof of the integrated system.
98
+
99
+ The original request and project policy define whether delivery stops at local changes, a commit, a
100
+ pull request, merge, or deployment. Destructive cleanup requires the request or policy to include it.