@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.
- package/README.md +23 -16
- package/cli/index.mjs +375 -52
- package/cli/index.test.mjs +196 -38
- package/package.json +2 -2
- package/policy.md +6 -6
- package/skills/batch-work/SKILL.md +43 -0
- package/skills/batch-work/agents/openai.yaml +2 -0
- package/skills/batch-work/references/manifest.md +100 -0
- package/skills/batch-work/scripts/manifest-hash.mjs +263 -0
- package/skills/batch-work/scripts/test-manifest-hash.mjs +132 -0
- package/skills/chart-work/SKILL.md +37 -0
- package/skills/chart-work/agents/openai.yaml +2 -0
- package/skills/chart-work/references/elicitation.md +25 -0
- package/skills/chart-work/references/map.md +84 -0
- package/skills/chart-work/references/prototypes.md +21 -0
- package/skills/deliver-work/SKILL.md +12 -0
- package/skills/deliver-work/agents/openai.yaml +2 -0
- package/skills/deliver-work/workflow.md +109 -0
- package/skills/diagnose-before-fix/SKILL.md +24 -0
- package/skills/dispatch-next/SKILL.md +28 -0
- package/skills/dispatch-next/agents/openai.yaml +2 -0
- package/skills/explain-work/SKILL.md +27 -0
- package/skills/explain-work/agents/openai.yaml +2 -0
- package/skills/guide-me/SKILL.md +36 -0
- package/skills/guide-me/agents/openai.yaml +2 -0
- package/skills/init-agent-os/SKILL.md +39 -0
- package/skills/init-agent-os/agents/openai.yaml +2 -0
- package/skills/notice-lesson/SKILL.md +20 -0
- package/skills/record-lesson/SKILL.md +31 -0
- package/skills/record-lesson/agents/openai.yaml +2 -0
- package/skills/scope-guard/SKILL.md +21 -0
- package/skills/shape-work/SKILL.md +39 -0
- package/skills/shape-work/agents/openai.yaml +2 -0
- package/skills/shape-work/references/implementation-issues.md +69 -0
- package/skills/shape-work/references/mockups.md +23 -0
- package/skills/understand-work/SKILL.md +31 -0
- package/skills/understand-work/agents/openai.yaml +2 -0
- package/skills/verify-before-done/SKILL.md +29 -0
- package/skills/writing-skills/SKILL.md +68 -0
- package/skills/writing-skills/agents/openai.yaml +2 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import crypto from 'node:crypto'
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import process from 'node:process'
|
|
7
|
+
import { pathToFileURL } from 'node:url'
|
|
8
|
+
|
|
9
|
+
export const planFields = [
|
|
10
|
+
'baseline_sha',
|
|
11
|
+
'integration_branch',
|
|
12
|
+
'max_workers',
|
|
13
|
+
'retry_limit',
|
|
14
|
+
'integration_strategy',
|
|
15
|
+
'aggregate_checks'
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
export const taskFields = [
|
|
19
|
+
'task_key',
|
|
20
|
+
'source',
|
|
21
|
+
'dependencies',
|
|
22
|
+
'scope',
|
|
23
|
+
'outcome',
|
|
24
|
+
'non_goals',
|
|
25
|
+
'checks',
|
|
26
|
+
'task_hash'
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
export const runtimeFields = [
|
|
30
|
+
'task_key',
|
|
31
|
+
'state',
|
|
32
|
+
'attempt',
|
|
33
|
+
'branch',
|
|
34
|
+
'worktree',
|
|
35
|
+
'worker_id',
|
|
36
|
+
'head_sha',
|
|
37
|
+
'result'
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
const cursorFields = ['agent_os_batch', 'batch_id', 'status', 'next_action', 'manifest_hash']
|
|
41
|
+
const batchStates = ['planned', 'running', 'reconciling', 'verifying', 'ready', 'delivered', 'blocked']
|
|
42
|
+
const taskStates = ['pending', 'ready', 'running', 'succeeded', 'integrated', 'failed', 'blocked', 'conflict']
|
|
43
|
+
|
|
44
|
+
function stable(value) {
|
|
45
|
+
if (Array.isArray(value)) return value.map(stable)
|
|
46
|
+
if (value && typeof value === 'object') {
|
|
47
|
+
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, stable(value[key])]))
|
|
48
|
+
}
|
|
49
|
+
return typeof value === 'string' ? value.replace(/\r\n/g, '\n') : value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function digest(value) {
|
|
53
|
+
return crypto.createHash('sha256').update(JSON.stringify(stable(value))).digest('hex')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function exactFields(value, expected, label) {
|
|
57
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} must be an object`)
|
|
58
|
+
const actual = Object.keys(value).sort()
|
|
59
|
+
const wanted = [...expected].sort()
|
|
60
|
+
if (JSON.stringify(actual) !== JSON.stringify(wanted)) {
|
|
61
|
+
throw new Error(`${label} fields must be exactly: ${expected.join(', ')}`)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function string(value, label, { empty = false } = {}) {
|
|
66
|
+
if (typeof value !== 'string' || (!empty && !value.trim())) throw new Error(`${label} must be a ${empty ? '' : 'non-empty '}string`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function strings(value, label) {
|
|
70
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string' || !item.trim())) {
|
|
71
|
+
throw new Error(`${label} must be an array of non-empty strings`)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function unquote(value) {
|
|
76
|
+
const trimmed = value.trim()
|
|
77
|
+
if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
78
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'"))) return trimmed.slice(1, -1)
|
|
79
|
+
return trimmed
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function parseCursor(content) {
|
|
83
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/)
|
|
84
|
+
if (!match) throw new Error('manifest must start with YAML frontmatter')
|
|
85
|
+
const cursor = {}
|
|
86
|
+
for (const line of match[1].split(/\r?\n/)) {
|
|
87
|
+
const separator = line.indexOf(':')
|
|
88
|
+
if (separator < 1) throw new Error(`invalid cursor line: ${line}`)
|
|
89
|
+
const key = line.slice(0, separator).trim()
|
|
90
|
+
if (key in cursor) throw new Error(`duplicate cursor field: ${key}`)
|
|
91
|
+
cursor[key] = unquote(line.slice(separator + 1))
|
|
92
|
+
}
|
|
93
|
+
exactFields(cursor, cursorFields, 'cursor')
|
|
94
|
+
if (cursor.agent_os_batch !== '2') throw new Error('agent_os_batch must be 2')
|
|
95
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(cursor.batch_id)) throw new Error('batch_id must be kebab-case')
|
|
96
|
+
if (!batchStates.includes(cursor.status)) throw new Error(`invalid batch status: ${cursor.status}`)
|
|
97
|
+
if (cursor.status !== 'delivered') string(cursor.next_action, 'next_action')
|
|
98
|
+
string(cursor.manifest_hash, 'manifest_hash', { empty: true })
|
|
99
|
+
return cursor
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function blocks(content) {
|
|
103
|
+
const found = { plan: [], task: [], runtime: [] }
|
|
104
|
+
for (const match of content.matchAll(/```json batch-(plan|task|runtime)\r?\n([\s\S]*?)\r?\n```/g)) {
|
|
105
|
+
try {
|
|
106
|
+
found[match[1]].push(JSON.parse(match[2]))
|
|
107
|
+
} catch (error) {
|
|
108
|
+
throw new Error(`invalid batch-${match[1]} JSON: ${error.message}`)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return found
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function parsePlan(value) {
|
|
115
|
+
exactFields(value, planFields, 'batch plan')
|
|
116
|
+
string(value.baseline_sha, 'baseline_sha')
|
|
117
|
+
string(value.integration_branch, 'integration_branch')
|
|
118
|
+
if (!Number.isInteger(value.max_workers) || value.max_workers < 1) throw new Error('max_workers must be a positive integer')
|
|
119
|
+
if (!Number.isInteger(value.retry_limit) || value.retry_limit < 0) throw new Error('retry_limit must be a non-negative integer')
|
|
120
|
+
string(value.integration_strategy, 'integration_strategy')
|
|
121
|
+
strings(value.aggregate_checks, 'aggregate_checks')
|
|
122
|
+
return value
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function parseTask(value) {
|
|
126
|
+
exactFields(value, taskFields, `task ${value?.task_key ?? '<unknown>'}`)
|
|
127
|
+
string(value.task_key, 'task_key')
|
|
128
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value.task_key)) throw new Error(`${value.task_key}: task_key must be kebab-case`)
|
|
129
|
+
string(value.source, `${value.task_key}: source`)
|
|
130
|
+
strings(value.dependencies, `${value.task_key}: dependencies`)
|
|
131
|
+
strings(value.scope, `${value.task_key}: scope`)
|
|
132
|
+
string(value.outcome, `${value.task_key}: outcome`)
|
|
133
|
+
strings(value.non_goals, `${value.task_key}: non_goals`)
|
|
134
|
+
strings(value.checks, `${value.task_key}: checks`)
|
|
135
|
+
string(value.task_hash, `${value.task_key}: task_hash`, { empty: true })
|
|
136
|
+
return value
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function validateGraph(tasks) {
|
|
140
|
+
const keys = new Set()
|
|
141
|
+
for (const task of tasks) {
|
|
142
|
+
if (keys.has(task.task_key)) throw new Error(`duplicate task_key: ${task.task_key}`)
|
|
143
|
+
keys.add(task.task_key)
|
|
144
|
+
}
|
|
145
|
+
for (const task of tasks) {
|
|
146
|
+
for (const dependency of task.dependencies) {
|
|
147
|
+
if (!keys.has(dependency)) throw new Error(`${task.task_key}: unknown dependency ${dependency}`)
|
|
148
|
+
if (dependency === task.task_key) throw new Error(`${task.task_key}: self dependency`)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const visiting = new Set()
|
|
152
|
+
const visited = new Set()
|
|
153
|
+
const byKey = new Map(tasks.map((task) => [task.task_key, task]))
|
|
154
|
+
function visit(key) {
|
|
155
|
+
if (visiting.has(key)) throw new Error(`dependency cycle at ${key}`)
|
|
156
|
+
if (visited.has(key)) return
|
|
157
|
+
visiting.add(key)
|
|
158
|
+
for (const dependency of byKey.get(key).dependencies) visit(dependency)
|
|
159
|
+
visiting.delete(key)
|
|
160
|
+
visited.add(key)
|
|
161
|
+
}
|
|
162
|
+
for (const key of keys) visit(key)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function portable(value) {
|
|
166
|
+
return !path.isAbsolute(value) && !/^[A-Za-z]:[\\/]/.test(value) && !value.startsWith('\\\\')
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function parseRuntime(value, tasks) {
|
|
170
|
+
exactFields(value, ['tasks'], 'batch runtime')
|
|
171
|
+
if (!Array.isArray(value.tasks)) throw new Error('batch runtime tasks must be an array')
|
|
172
|
+
const definitions = new Map(tasks.map((task) => [task.task_key, task]))
|
|
173
|
+
const seen = new Set()
|
|
174
|
+
const states = new Map()
|
|
175
|
+
for (const item of value.tasks) {
|
|
176
|
+
exactFields(item, runtimeFields, `runtime ${item?.task_key ?? '<unknown>'}`)
|
|
177
|
+
if (!definitions.has(item.task_key)) throw new Error(`runtime has unknown task ${item.task_key}`)
|
|
178
|
+
if (seen.has(item.task_key)) throw new Error(`runtime duplicates task ${item.task_key}`)
|
|
179
|
+
seen.add(item.task_key)
|
|
180
|
+
if (!taskStates.includes(item.state)) throw new Error(`${item.task_key}: invalid runtime state ${item.state}`)
|
|
181
|
+
if (!Number.isInteger(item.attempt) || item.attempt < 0) throw new Error(`${item.task_key}: attempt must be a non-negative integer`)
|
|
182
|
+
for (const field of ['branch', 'worktree', 'worker_id', 'head_sha', 'result']) string(item[field], `${item.task_key}: ${field}`, { empty: true })
|
|
183
|
+
if (item.worktree && !portable(item.worktree)) throw new Error(`${item.task_key}: worktree must be portable`)
|
|
184
|
+
if (['ready', 'running'].includes(item.state) && (!item.attempt || !item.branch || !item.worktree)) {
|
|
185
|
+
throw new Error(`${item.task_key}: active task requires attempt, branch, and worktree`)
|
|
186
|
+
}
|
|
187
|
+
if (item.state === 'running' && !item.worker_id) throw new Error(`${item.task_key}: running task requires worker_id`)
|
|
188
|
+
if (['succeeded', 'integrated'].includes(item.state) && !item.head_sha) throw new Error(`${item.task_key}: completed task requires head_sha`)
|
|
189
|
+
states.set(item.task_key, item.state)
|
|
190
|
+
}
|
|
191
|
+
if (seen.size !== tasks.length) throw new Error('runtime must contain exactly one entry per task')
|
|
192
|
+
for (const item of value.tasks) {
|
|
193
|
+
if (['ready', 'running', 'succeeded', 'integrated'].includes(item.state)) {
|
|
194
|
+
for (const dependency of definitions.get(item.task_key).dependencies) {
|
|
195
|
+
if (states.get(dependency) !== 'integrated') throw new Error(`${item.task_key}: dependency ${dependency} is not integrated`)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return value
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function parseManifest(content) {
|
|
203
|
+
const cursor = parseCursor(content)
|
|
204
|
+
const found = blocks(content)
|
|
205
|
+
if (found.plan.length !== 1) throw new Error('manifest requires exactly one batch-plan block')
|
|
206
|
+
if (!found.task.length) throw new Error('manifest requires at least one batch-task block')
|
|
207
|
+
if (found.runtime.length !== 1) throw new Error('manifest requires exactly one batch-runtime block')
|
|
208
|
+
const plan = parsePlan(found.plan[0])
|
|
209
|
+
const tasks = found.task.map(parseTask)
|
|
210
|
+
validateGraph(tasks)
|
|
211
|
+
const runtime = parseRuntime(found.runtime[0], tasks)
|
|
212
|
+
return { cursor, plan, tasks, runtime }
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function hashTask(task) {
|
|
216
|
+
const definition = Object.fromEntries(taskFields.filter((field) => field !== 'task_hash').map((field) => [field, task[field]]))
|
|
217
|
+
return digest(definition)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function hashManifest(batchId, plan, tasks) {
|
|
221
|
+
return digest({
|
|
222
|
+
batch_id: batchId,
|
|
223
|
+
plan,
|
|
224
|
+
tasks: tasks.map((task) => [task.task_key, hashTask(task)]).sort(([left], [right]) => left.localeCompare(right))
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function checkManifest(content) {
|
|
229
|
+
const parsed = parseManifest(content)
|
|
230
|
+
const taskHashes = Object.fromEntries(parsed.tasks.map((task) => [task.task_key, hashTask(task)]))
|
|
231
|
+
const manifestHash = hashManifest(parsed.cursor.batch_id, parsed.plan, parsed.tasks)
|
|
232
|
+
const mismatches = []
|
|
233
|
+
for (const task of parsed.tasks) {
|
|
234
|
+
if (task.task_hash !== taskHashes[task.task_key]) mismatches.push(`${task.task_key}: task_hash mismatch`)
|
|
235
|
+
}
|
|
236
|
+
if (parsed.cursor.manifest_hash !== manifestHash) mismatches.push('manifest_hash mismatch')
|
|
237
|
+
return { ...parsed, calculated: { task_hashes: taskHashes, manifest_hash: manifestHash }, mismatches }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function main() {
|
|
241
|
+
const args = process.argv.slice(2)
|
|
242
|
+
const check = args[0] === '--check'
|
|
243
|
+
const file = check ? args[1] : args[0]
|
|
244
|
+
if (!file || args.length !== (check ? 2 : 1)) {
|
|
245
|
+
console.error('Usage: manifest-hash.mjs [--check] <manifest.md>')
|
|
246
|
+
process.exitCode = 2
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
const result = checkManifest(fs.readFileSync(file, 'utf8'))
|
|
251
|
+
if (check && result.mismatches.length) {
|
|
252
|
+
for (const mismatch of result.mismatches) console.error(mismatch)
|
|
253
|
+
process.exitCode = 1
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
console.log(JSON.stringify(result.calculated, null, 2))
|
|
257
|
+
} catch (error) {
|
|
258
|
+
console.error(error.message)
|
|
259
|
+
process.exitCode = 2
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (import.meta.url === pathToFileURL(process.argv[1]).href) main()
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import assert from 'node:assert/strict'
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import os from 'node:os'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
import { spawnSync } from 'node:child_process'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
import { checkManifest, hashManifest, hashTask, parseCursor, parseManifest } from './manifest-hash.mjs'
|
|
10
|
+
|
|
11
|
+
function task(key, dependencies = []) {
|
|
12
|
+
return {
|
|
13
|
+
task_key: key,
|
|
14
|
+
source: 'spec.md',
|
|
15
|
+
dependencies,
|
|
16
|
+
scope: [`src/${key}/`],
|
|
17
|
+
outcome: `Implement ${key}`,
|
|
18
|
+
non_goals: ['Unrelated cleanup'],
|
|
19
|
+
checks: [`test ${key}`],
|
|
20
|
+
task_hash: ''
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function plan() {
|
|
25
|
+
return {
|
|
26
|
+
baseline_sha: 'abc123',
|
|
27
|
+
integration_branch: 'batch/demo',
|
|
28
|
+
max_workers: 2,
|
|
29
|
+
retry_limit: 1,
|
|
30
|
+
integration_strategy: 'serial cherry-pick',
|
|
31
|
+
aggregate_checks: ['npm test']
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function manifest(tasks, status = 'planned', cursorExtras = {}) {
|
|
36
|
+
const batchPlan = plan()
|
|
37
|
+
const taskHashes = Object.fromEntries(tasks.map((value) => [value.task_key, hashTask(value)]))
|
|
38
|
+
const complete = tasks.map((value) => ({ ...value, task_hash: taskHashes[value.task_key] }))
|
|
39
|
+
const manifestHash = hashManifest('demo-batch', batchPlan, complete)
|
|
40
|
+
const runtime = {
|
|
41
|
+
tasks: complete.map((value) => ({
|
|
42
|
+
task_key: value.task_key,
|
|
43
|
+
state: 'pending',
|
|
44
|
+
attempt: 0,
|
|
45
|
+
branch: '',
|
|
46
|
+
worktree: '',
|
|
47
|
+
worker_id: '',
|
|
48
|
+
head_sha: '',
|
|
49
|
+
result: ''
|
|
50
|
+
}))
|
|
51
|
+
}
|
|
52
|
+
const cursor = {
|
|
53
|
+
agent_os_batch: '2',
|
|
54
|
+
batch_id: 'demo-batch',
|
|
55
|
+
status,
|
|
56
|
+
next_action: status === 'delivered' ? '' : 'dispatch-frontier',
|
|
57
|
+
manifest_hash: manifestHash,
|
|
58
|
+
...cursorExtras
|
|
59
|
+
}
|
|
60
|
+
const frontmatter = Object.entries(cursor).map(([key, value]) => `${key}: "${value}"`).join('\n')
|
|
61
|
+
const taskBlocks = complete.map((value) => `\`\`\`json batch-task\n${JSON.stringify(value, null, 2)}\n\`\`\``).join('\n\n')
|
|
62
|
+
return `---\n${frontmatter}\n---\n\n\`\`\`json batch-plan\n${JSON.stringify(batchPlan, null, 2)}\n\`\`\`\n\n${taskBlocks}\n\n\`\`\`json batch-runtime\n${JSON.stringify(runtime, null, 2)}\n\`\`\`\n`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function rewriteRuntime(content, update) {
|
|
66
|
+
return content.replace(/```json batch-runtime\n([\s\S]*?)\n```/, (_match, json) => {
|
|
67
|
+
const runtime = JSON.parse(json)
|
|
68
|
+
update(runtime)
|
|
69
|
+
return `\`\`\`json batch-runtime\n${JSON.stringify(runtime, null, 2)}\n\`\`\``
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const alpha = task('alpha')
|
|
74
|
+
const beta = task('beta', ['alpha'])
|
|
75
|
+
const valid = manifest([alpha, beta])
|
|
76
|
+
assert.deepEqual(checkManifest(valid).mismatches, [])
|
|
77
|
+
assert.equal(parseManifest(valid).tasks.length, 2)
|
|
78
|
+
assert.equal(parseCursor(valid).status, 'planned')
|
|
79
|
+
|
|
80
|
+
assert.equal(hashTask(alpha), hashTask({ ...alpha, task_hash: 'ignored' }))
|
|
81
|
+
assert.notEqual(hashTask(alpha), hashTask({ ...alpha, outcome: 'Changed outcome' }))
|
|
82
|
+
assert.equal(
|
|
83
|
+
hashManifest('demo-batch', plan(), [alpha, beta]),
|
|
84
|
+
hashManifest('demo-batch', plan(), [beta, alpha]),
|
|
85
|
+
'task order must not affect aggregate hash'
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
assert.throws(() => parseCursor(valid.replace('status: "planned"', 'status: "planned"\nstatus: "running"')), /duplicate cursor/)
|
|
89
|
+
assert.throws(() => parseManifest(valid.replace('"dependencies": []', '"dependencies": ["missing"]')), /unknown dependency/)
|
|
90
|
+
assert.throws(() => parseManifest(manifest([task('alpha', ['beta']), task('beta', ['alpha'])])), /dependency cycle/)
|
|
91
|
+
|
|
92
|
+
const activeWithoutWorkspace = rewriteRuntime(valid, (runtime) => {
|
|
93
|
+
runtime.tasks[0].state = 'running'
|
|
94
|
+
runtime.tasks[0].attempt = 1
|
|
95
|
+
})
|
|
96
|
+
assert.throws(() => parseManifest(activeWithoutWorkspace), /requires attempt, branch, and worktree/)
|
|
97
|
+
|
|
98
|
+
const absoluteWorktree = rewriteRuntime(valid, (runtime) => {
|
|
99
|
+
Object.assign(runtime.tasks[0], {
|
|
100
|
+
state: 'ready',
|
|
101
|
+
attempt: 1,
|
|
102
|
+
branch: 'task/alpha',
|
|
103
|
+
worktree: 'C:\\temp\\alpha'
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
assert.throws(() => parseManifest(absoluteWorktree), /worktree must be portable/)
|
|
107
|
+
|
|
108
|
+
const blockedDependency = rewriteRuntime(valid, (runtime) => {
|
|
109
|
+
Object.assign(runtime.tasks[1], {
|
|
110
|
+
state: 'ready',
|
|
111
|
+
attempt: 1,
|
|
112
|
+
branch: 'task/beta',
|
|
113
|
+
worktree: 'worktrees/beta'
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
assert.throws(() => parseManifest(blockedDependency), /dependency alpha is not integrated/)
|
|
117
|
+
|
|
118
|
+
const staleHash = valid.replace(/task_hash": "[a-f0-9]+"/, 'task_hash": "stale"')
|
|
119
|
+
assert(checkManifest(staleHash).mismatches.includes('alpha: task_hash mismatch'))
|
|
120
|
+
|
|
121
|
+
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-batch-'))
|
|
122
|
+
try {
|
|
123
|
+
const file = path.join(temporary, 'manifest.md')
|
|
124
|
+
fs.writeFileSync(file, valid)
|
|
125
|
+
const script = path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'manifest-hash.mjs')
|
|
126
|
+
const result = spawnSync(process.execPath, [script, '--check', file], { encoding: 'utf8' })
|
|
127
|
+
assert.equal(result.status, 0, result.stderr)
|
|
128
|
+
} finally {
|
|
129
|
+
fs.rmSync(temporary, { recursive: true, force: true })
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('batch manifest tests passed.')
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chart-work
|
|
3
|
+
description: Charts broad work as a parallel graph of evidence-backed decision tickets. User-invoked when an effort spans several decision threads or sessions. Not for one bounded choice or decision-ready implementation.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Chart work
|
|
8
|
+
|
|
9
|
+
Turn fog into decision tickets that can move independently. The ticket is canonical; the map is an
|
|
10
|
+
index that can be repaired from its children.
|
|
11
|
+
|
|
12
|
+
Read project policy and [references/map.md](references/map.md). Use
|
|
13
|
+
[references/elicitation.md](references/elicitation.md) for developer decisions and
|
|
14
|
+
[references/prototypes.md](references/prototypes.md) when a prototype supplies evidence.
|
|
15
|
+
|
|
16
|
+
## Chart
|
|
17
|
+
|
|
18
|
+
Name the destination and boundaries. Create tickets for precise questions, leave immature unknowns
|
|
19
|
+
in Fog, connect dependencies, and expose the open unblocked frontier. The invocation authorizes
|
|
20
|
+
writes to the configured planning surface. Report the resulting parallel starts.
|
|
21
|
+
|
|
22
|
+
## Resolve
|
|
23
|
+
|
|
24
|
+
Read and claim one open frontier ticket by default; explicit parallel execution may claim several
|
|
25
|
+
independent tickets in separate contexts. Produce evidence, record the decision and consequence,
|
|
26
|
+
then update the map without overwriting concurrent work. Human preference evidence must come from
|
|
27
|
+
the developer; the agent may recommend and challenge but cannot invent the answer.
|
|
28
|
+
|
|
29
|
+
When a branch becomes bounded enough for one `shape-work` session, create or reuse one linked
|
|
30
|
+
handoff containing settled decisions and remaining questions. This moves the branch to shaping; it
|
|
31
|
+
does not make the branch delivery-ready. Shape-work later creates the implementation issues and
|
|
32
|
+
reconciles their links and frontier into the map. A selected branch in shaping keeps the map open.
|
|
33
|
+
Close the decision map only when every selected path is delivery-ready, parked, or ruled out and no
|
|
34
|
+
Fog remains.
|
|
35
|
+
|
|
36
|
+
Planning writes do not imply product implementation. Side discoveries become child decisions,
|
|
37
|
+
ordinary backlog items, shaping handoffs, or parked paths rather than hidden scope expansion.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Elicitation and evidence
|
|
2
|
+
|
|
3
|
+
Ask for the smallest evidence that can settle the active ticket.
|
|
4
|
+
|
|
5
|
+
## Developer choice
|
|
6
|
+
|
|
7
|
+
Follow the questioning loop in [understand-work](../../understand-work/SKILL.md). When words are
|
|
8
|
+
insufficient, use a prototype.
|
|
9
|
+
|
|
10
|
+
## Research
|
|
11
|
+
|
|
12
|
+
Use repository evidence, primary sources, or direct measurements. Cite the decisive source or
|
|
13
|
+
observation and state uncertainty that could change the decision.
|
|
14
|
+
|
|
15
|
+
## Prototype
|
|
16
|
+
|
|
17
|
+
Follow [prototypes.md](prototypes.md). Separate observed behavior from the developer's judgment.
|
|
18
|
+
|
|
19
|
+
## Prerequisite task
|
|
20
|
+
|
|
21
|
+
Do only the prerequisite needed to make the decision stateable. Record the result and the question
|
|
22
|
+
it unlocked.
|
|
23
|
+
|
|
24
|
+
Do not treat silence, momentum, or approval of a larger bundle as an answer to a specific product
|
|
25
|
+
choice.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Decision map
|
|
2
|
+
|
|
3
|
+
The configured planning surface owns the map and its tickets. With no project convention, use:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
planning/<map-slug>/map.md
|
|
7
|
+
planning/<map-slug>/decisions/<ticket-slug>.md
|
|
8
|
+
planning/<map-slug>/shape-work/<branch-key>.md
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Map
|
|
12
|
+
|
|
13
|
+
Keep the map low-resolution and rebuildable from its tickets:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
## TLDR
|
|
17
|
+
## Destination
|
|
18
|
+
## Boundaries
|
|
19
|
+
## Decisions
|
|
20
|
+
- <ticket> → <decision gist> (<link>)
|
|
21
|
+
## Fog
|
|
22
|
+
## Shaping handoffs
|
|
23
|
+
- <branch> → <shape-work handoff> (<link>)
|
|
24
|
+
## Delivery-ready branches
|
|
25
|
+
- <branch> → <implementation issues and frontier> (<links>)
|
|
26
|
+
## Spawned work
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The map orients. It does not duplicate ticket evidence. `## TLDR` holds the approved plain-language
|
|
30
|
+
summary when the map originates from `guide-me`; omit the section otherwise.
|
|
31
|
+
|
|
32
|
+
## Decision tickets
|
|
33
|
+
|
|
34
|
+
Every ticket states one question, why it matters, the evidence needed, and its dependencies. Choose
|
|
35
|
+
the evidence path that fits:
|
|
36
|
+
|
|
37
|
+
- `research`: repository evidence, primary sources, or measurements;
|
|
38
|
+
- `prototype`: a comparison that makes the contested behavior observable;
|
|
39
|
+
- `grilling`: a product trade-off the developer must decide;
|
|
40
|
+
- `task`: a prerequisite needed before the decision can be stated.
|
|
41
|
+
|
|
42
|
+
An open, unblocked, unclaimed ticket is on the frontier. Claim before working and re-read live state
|
|
43
|
+
before writing. Independent frontier tickets may run in parallel; each worker writes its own ticket.
|
|
44
|
+
|
|
45
|
+
Resolve a ticket with:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
## Decision
|
|
49
|
+
## Evidence
|
|
50
|
+
## Rejected alternatives
|
|
51
|
+
## Consequence
|
|
52
|
+
## New work
|
|
53
|
+
## Open risks
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Evidence must support the decision. Route new findings as child decisions, ordinary backlog work,
|
|
57
|
+
shaping handoffs, or parked paths.
|
|
58
|
+
|
|
59
|
+
## Shape-work handoff
|
|
60
|
+
|
|
61
|
+
When a branch's remaining product choices fit one bounded session, create or reuse a handoff.
|
|
62
|
+
Identity is `(origin map, branch key)`:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
## Shape-work handoff
|
|
66
|
+
Origin map: <link or id>
|
|
67
|
+
Branch key: <stable key>
|
|
68
|
+
|
|
69
|
+
## Outcome
|
|
70
|
+
## Boundaries
|
|
71
|
+
## Settled decisions
|
|
72
|
+
## Evidence and prototypes
|
|
73
|
+
## Questions left
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Search before creating so retries reuse the same handoff. Link it from the map and relevant source
|
|
77
|
+
tickets. Update links idempotently and preserve concurrent entries. The handoff moves the branch to
|
|
78
|
+
shaping, not to `delivery-ready`. After shaping, `shape-work` creates or reuses the implementation
|
|
79
|
+
issues, records the ready or blocked frontier, and moves the branch to Delivery-ready branches. A
|
|
80
|
+
planning handoff or implementation issue does not authorize product implementation; a later
|
|
81
|
+
implementation request does.
|
|
82
|
+
|
|
83
|
+
A selected branch in shaping keeps the map open. Close it only when selected paths are
|
|
84
|
+
delivery-ready, parked, or ruled out and no Fog remains.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Prototype evidence
|
|
2
|
+
|
|
3
|
+
A prototype exists to settle a decision, not to become an accidental product implementation.
|
|
4
|
+
|
|
5
|
+
Build the smallest comparison that makes the contested behavior observable. Keep alternatives easy
|
|
6
|
+
to compare and ask the developer to perform the shortest meaningful task.
|
|
7
|
+
|
|
8
|
+
Record:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
## Prototype evidence
|
|
12
|
+
- Question:
|
|
13
|
+
- Artifact: <stable link or repository-relative path>
|
|
14
|
+
- How it was exercised:
|
|
15
|
+
- Observation:
|
|
16
|
+
- Developer decision and rationale:
|
|
17
|
+
- Open uncertainty:
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Keep the artifact inspectable while the decision depends on it. Frontend prototypes also follow the
|
|
21
|
+
shared [mockup guidance](../../shape-work/references/mockups.md).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deliver-work
|
|
3
|
+
description: Delivers one decision-ready change against explicit boundaries and ground truth. User-invoked for implementation, including as a batch worker. Not for exploration or specification-only work.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Deliver work
|
|
8
|
+
|
|
9
|
+
Read [workflow.md](workflow.md), then execute its contract. The invocation grants authority to change
|
|
10
|
+
repository files inside the requested scope. It does not grant authority to choose unresolved product
|
|
11
|
+
behavior or to merge, deploy, perform destructive cleanup, or affect external systems unless the
|
|
12
|
+
request or project policy includes those actions.
|