@sockulags/agent-os 0.9.1 → 0.12.0

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 (42) hide show
  1. package/README.md +112 -67
  2. package/cli/index.mjs +299 -12
  3. package/cli/index.test.mjs +277 -3
  4. package/hooks/hooks.json +17 -0
  5. package/package.json +6 -3
  6. package/policy.md +42 -40
  7. package/skills/batch-work/SKILL.md +43 -43
  8. package/skills/batch-work/agents/openai.yaml +2 -2
  9. package/skills/batch-work/references/manifest.md +100 -100
  10. package/skills/batch-work/scripts/manifest-hash.mjs +263 -263
  11. package/skills/batch-work/scripts/test-manifest-hash.mjs +132 -132
  12. package/skills/chart-work/SKILL.md +37 -37
  13. package/skills/chart-work/references/elicitation.md +25 -25
  14. package/skills/chart-work/references/map.md +84 -84
  15. package/skills/chart-work/references/prototypes.md +21 -21
  16. package/skills/check-work/SKILL.md +61 -0
  17. package/skills/deliver-work/SKILL.md +12 -12
  18. package/skills/deliver-work/workflow.md +119 -109
  19. package/skills/diagnose-before-fix/SKILL.md +24 -24
  20. package/skills/dispatch-next/SKILL.md +28 -28
  21. package/skills/init-agent-os/SKILL.md +52 -37
  22. package/skills/init-agent-os/references/repository-init.md +74 -0
  23. package/skills/list-skills/SKILL.md +43 -0
  24. package/skills/list-skills/agents/openai.yaml +2 -0
  25. package/skills/plain-voice/SKILL.md +39 -0
  26. package/skills/plain-voice/references/tells.md +82 -0
  27. package/skills/proportional-testing/SKILL.md +30 -0
  28. package/skills/proportional-testing/references/strategy.md +75 -0
  29. package/skills/quality-ratchet/SKILL.md +50 -0
  30. package/skills/quality-ratchet/scripts/quality-delta.mjs +752 -0
  31. package/skills/quality-ratchet/scripts/quality-delta.test.mjs +514 -0
  32. package/skills/scope-guard/SKILL.md +21 -21
  33. package/skills/shape-work/SKILL.md +39 -39
  34. package/skills/shape-work/references/implementation-issues.md +69 -69
  35. package/skills/shape-work/references/mockups.md +23 -23
  36. package/skills/simplifier/SKILL.md +34 -0
  37. package/skills/simplifier/agents/openai.yaml +2 -0
  38. package/skills/simplifier-audit/SKILL.md +28 -0
  39. package/skills/simplifier-audit/agents/openai.yaml +2 -0
  40. package/skills/simplifier-review/SKILL.md +36 -0
  41. package/skills/verify-before-done/SKILL.md +29 -29
  42. package/skills/writing-skills/SKILL.md +68 -68
@@ -3,12 +3,16 @@ import fs from 'node:fs'
3
3
  import os from 'node:os'
4
4
  import path from 'node:path'
5
5
  import test, { after } from 'node:test'
6
+ import { fileURLToPath } from 'node:url'
6
7
  import {
8
+ buildManagedHookCommand,
7
9
  buildPlan,
8
10
  executeInstall,
11
+ hookConfigPath,
9
12
  INSTALL_MANIFEST,
10
13
  PACKAGE_NAME,
11
14
  parseArgs,
15
+ planManagedHookConfig,
12
16
  planPolicyUpdate,
13
17
  resolveOptions,
14
18
  run,
@@ -28,6 +32,10 @@ function silentOutput() {
28
32
  return { write() {} }
29
33
  }
30
34
 
35
+ function packageRootForTest() {
36
+ return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
37
+ }
38
+
31
39
  after(() => {
32
40
  for (const root of temporaryRoots) fs.rmSync(root, { recursive: true, force: true })
33
41
  })
@@ -121,10 +129,12 @@ test('builds direct filesystem plans without marketplace commands', () => {
121
129
  scope: 'user',
122
130
  policy: false
123
131
  }, { 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'])
132
+ assert.deepEqual(plan.map((step) => step.kind), ['install-skills', 'install-hooks', 'install-skills', 'install-hooks'])
133
+ assert.deepEqual(plan.map((step) => step.command), ['filesystem', 'filesystem', 'filesystem', 'filesystem'])
126
134
  assert.equal(plan[0].args[0], path.join(root, '.claude', 'skills'))
127
- assert.equal(plan[1].args[0], path.join(root, '.codex', 'skills'))
135
+ assert.equal(plan[1].args[0], path.join(root, '.claude', 'settings.json'))
136
+ assert.equal(plan[2].args[0], path.join(root, '.codex', 'skills'))
137
+ assert.equal(plan[3].args[0], path.join(root, '.codex', 'hooks.json'))
128
138
  })
129
139
 
130
140
  test('maps project and user targets for both hosts', () => {
@@ -160,12 +170,276 @@ test('installs both hosts and policy without either host CLI', async () => {
160
170
  const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, INSTALL_MANIFEST), 'utf8'))
161
171
  assert.equal(manifest.package, PACKAGE_NAME)
162
172
  assert.equal(manifest.version, VERSION)
173
+ assert.equal(manifest.schemaVersion, 2)
163
174
  assert.ok(manifest.skills.includes('shape-work'))
175
+ assert.equal(manifest.integrations.hooks.event, 'Stop')
176
+ const hookFile = path.join(homeDir, agent, agent === '.claude' ? 'settings.json' : 'hooks.json')
177
+ assert.equal(fs.existsSync(hookFile), true)
178
+ const hookConfig = JSON.parse(fs.readFileSync(hookFile, 'utf8'))
179
+ const command = hookConfig.hooks.Stop.find((group) =>
180
+ JSON.stringify(group).includes('--agent-os-hook=quality-ratchet')).hooks[0].command
181
+ assert.equal(command.includes(path.join(skillsRoot, 'quality-ratchet', 'scripts', 'quality-delta.mjs')), true)
182
+ assert.equal(command.includes(packageRootForTest()), false)
164
183
  }
165
184
  assert.match(fs.readFileSync(path.join(homeDir, '.claude', 'CLAUDE.md'), 'utf8'), /BEGIN AGENT OS/)
166
185
  assert.match(fs.readFileSync(path.join(homeDir, '.codex', 'AGENTS.md'), 'utf8'), /BEGIN AGENT OS/)
167
186
  })
168
187
 
188
+ test('maps direct hook configuration paths for user and project scopes', () => {
189
+ const root = temporaryRoot()
190
+ const project = path.join(root, 'project')
191
+ assert.equal(hookConfigPath('claude', 'user', { homeDir: root, cwd: project }), path.join(root, '.claude', 'settings.json'))
192
+ assert.equal(hookConfigPath('codex', 'user', { homeDir: root, cwd: project }), path.join(root, '.codex', 'hooks.json'))
193
+ assert.equal(hookConfigPath('claude', 'project', { homeDir: root, cwd: project }), path.join(project, '.claude', 'settings.json'))
194
+ assert.equal(hookConfigPath('codex', 'project', { homeDir: root, cwd: project }), path.join(project, '.codex', 'hooks.json'))
195
+ })
196
+
197
+ test('direct project install configures both hosts without replacing unrelated hooks', async () => {
198
+ const root = temporaryRoot()
199
+ const project = path.join(root, 'project')
200
+ const claudeConfig = path.join(project, '.claude', 'settings.json')
201
+ const codexConfig = path.join(project, '.codex', 'hooks.json')
202
+ fs.mkdirSync(path.dirname(claudeConfig), { recursive: true })
203
+ fs.mkdirSync(path.dirname(codexConfig), { recursive: true })
204
+ const unrelated = {
205
+ permissions: { allow: ['Read'] },
206
+ hooks: {
207
+ PreToolUse: [{ hooks: [{ type: 'command', command: 'developer-preflight' }] }],
208
+ Stop: [{ hooks: [{ type: 'command', command: 'developer-stop' }] }]
209
+ }
210
+ }
211
+ fs.writeFileSync(claudeConfig, JSON.stringify(unrelated, null, 2) + '\n')
212
+ fs.writeFileSync(codexConfig, JSON.stringify(unrelated, null, 2) + '\n')
213
+ await executeInstall({
214
+ command: 'install', platform: 'both', method: 'direct', scope: 'project', policy: false
215
+ }, { output: silentOutput(), homeDir: root, cwd: project })
216
+
217
+ for (const [file, skillsRoot] of [
218
+ [claudeConfig, path.join(project, '.claude', 'skills')],
219
+ [codexConfig, path.join(project, '.agents', 'skills')]
220
+ ]) {
221
+ const config = JSON.parse(fs.readFileSync(file, 'utf8'))
222
+ assert.deepEqual(config.permissions, unrelated.permissions)
223
+ assert.deepEqual(config.hooks.PreToolUse, unrelated.hooks.PreToolUse)
224
+ assert.deepEqual(config.hooks.Stop[0], unrelated.hooks.Stop[0])
225
+ assert.equal(config.hooks.Stop.filter((group) => JSON.stringify(group).includes('--agent-os-hook=quality-ratchet')).length, 1)
226
+ const command = config.hooks.Stop.find((group) =>
227
+ JSON.stringify(group).includes('--agent-os-hook=quality-ratchet')).hooks[0].command
228
+ assert.equal(command.includes(path.join(skillsRoot, 'quality-ratchet', 'scripts', 'quality-delta.mjs')), true)
229
+ assert.equal(command.includes(packageRootForTest()), false)
230
+ }
231
+ })
232
+
233
+ test('managed hook updates replace only the exact Agent OS entry', () => {
234
+ const durableScript = path.join(temporaryRoot(), '.codex', 'skills', 'quality-ratchet', 'scripts', 'quality-delta.mjs')
235
+ const managedCommand = buildManagedHookCommand(durableScript)
236
+ const oldCommand = '"old-node" "old-quality-delta.mjs" hook --agent-os-hook=quality-ratchet'
237
+ const original = JSON.stringify({
238
+ unrelated: true,
239
+ hooks: {
240
+ Stop: [
241
+ { hooks: [{ type: 'command', command: 'keep-me' }] },
242
+ { hooks: [{ type: 'command', command: oldCommand, timeout: 1 }] }
243
+ ]
244
+ }
245
+ }, null, 2) + '\n'
246
+ const planned = planManagedHookConfig(original, managedCommand, 'test hooks.json')
247
+ assert.equal(planned.status, 'UPDATED')
248
+ const config = JSON.parse(planned.content)
249
+ assert.equal(config.unrelated, true)
250
+ assert.equal(config.hooks.Stop[0].hooks[0].command, 'keep-me')
251
+ assert.equal(config.hooks.Stop[1].hooks[0].command, managedCommand)
252
+ assert.equal(config.hooks.Stop[1].hooks[0].timeout, 10)
253
+ assert.equal(config.hooks.Stop[1].hooks[0].command.includes(durableScript), true)
254
+ })
255
+
256
+ test('malformed or ambiguous managed hook config aborts before direct skill mutation', async () => {
257
+ const root = temporaryRoot()
258
+ const homeDir = path.join(root, 'home')
259
+ const hookFile = path.join(homeDir, '.codex', 'hooks.json')
260
+ fs.mkdirSync(path.dirname(hookFile), { recursive: true })
261
+ fs.writeFileSync(hookFile, '{ malformed')
262
+ await assert.rejects(
263
+ executeInstall({ command: 'install', platform: 'codex', method: 'direct', scope: 'user', policy: false }, {
264
+ output: silentOutput(), homeDir, cwd: root
265
+ }),
266
+ /Cannot read.*hooks.json.*no files were changed/
267
+ )
268
+ assert.equal(fs.existsSync(path.join(homeDir, '.codex', 'skills')), false)
269
+
270
+ fs.writeFileSync(hookFile, JSON.stringify({ hooks: { Stop: [
271
+ { hooks: [{ type: 'command', command: 'one --agent-os-hook=quality-ratchet' }] },
272
+ { hooks: [{ type: 'command', command: 'two --agent-os-hook=quality-ratchet' }] }
273
+ ] } }))
274
+ await assert.rejects(
275
+ executeInstall({ command: 'install', platform: 'codex', method: 'direct', scope: 'user', policy: false }, {
276
+ output: silentOutput(), homeDir, cwd: root
277
+ }),
278
+ /multiple Agent OS hook entries.*no files were changed/
279
+ )
280
+ assert.equal(fs.existsSync(path.join(homeDir, '.codex', 'skills')), false)
281
+ })
282
+
283
+ test('hook write failure restores both direct skill installs and preserves host configs byte-for-byte', async () => {
284
+ const root = temporaryRoot()
285
+ const homeDir = path.join(root, 'home')
286
+ const claudeConfig = path.join(homeDir, '.claude', 'settings.json')
287
+ const codexConfig = path.join(homeDir, '.codex', 'hooks.json')
288
+ const claudeText = '{\n "theme": "dark",\n "hooks": { "Stop": [] }\n}\n'
289
+ const codexText = '{\n "custom": true,\n "hooks": { "Stop": [] }\n}\n'
290
+ for (const [file, content] of [[claudeConfig, claudeText], [codexConfig, codexText]]) {
291
+ fs.mkdirSync(path.dirname(file), { recursive: true })
292
+ fs.writeFileSync(file, content)
293
+ }
294
+
295
+ const skillRoots = [
296
+ path.join(homeDir, '.claude', 'skills'),
297
+ path.join(homeDir, '.codex', 'skills')
298
+ ]
299
+ for (const skillsRoot of skillRoots) {
300
+ const privateFile = path.join(skillsRoot, 'private-skill', 'SKILL.md')
301
+ fs.mkdirSync(path.dirname(privateFile), { recursive: true })
302
+ fs.writeFileSync(privateFile, 'developer-owned\n')
303
+ }
304
+
305
+ const failingFs = Object.create(fs)
306
+ let injected = false
307
+ failingFs.writeFileSync = (target, ...args) => {
308
+ const isCodexHookTemporary = path.dirname(target) === path.dirname(codexConfig) &&
309
+ path.basename(target).startsWith('.hooks.json.agent-os-')
310
+ if (!injected && isCodexHookTemporary) {
311
+ injected = true
312
+ throw new Error('injected hook write failure')
313
+ }
314
+ return fs.writeFileSync(target, ...args)
315
+ }
316
+
317
+ await assert.rejects(
318
+ executeInstall({ command: 'install', platform: 'both', method: 'direct', scope: 'user', policy: false }, {
319
+ output: silentOutput(), homeDir, cwd: root, fsImpl: failingFs
320
+ }),
321
+ /injected hook write failure/
322
+ )
323
+
324
+ assert.equal(injected, true)
325
+ assert.equal(fs.readFileSync(claudeConfig, 'utf8'), claudeText)
326
+ assert.equal(fs.readFileSync(codexConfig, 'utf8'), codexText)
327
+ for (const skillsRoot of skillRoots) {
328
+ assert.equal(fs.readFileSync(path.join(skillsRoot, 'private-skill', 'SKILL.md'), 'utf8'), 'developer-owned\n')
329
+ assert.equal(fs.existsSync(path.join(skillsRoot, INSTALL_MANIFEST)), false)
330
+ assert.equal(fs.existsSync(path.join(skillsRoot, 'shape-work')), false)
331
+ assert.equal(fs.existsSync(path.join(skillsRoot, 'quality-ratchet')), false)
332
+ assert.deepEqual(fs.readdirSync(skillsRoot).filter((name) => name.startsWith('.agent-os-transaction-')), [])
333
+ }
334
+ for (const file of [claudeConfig, codexConfig]) {
335
+ assert.deepEqual(fs.readdirSync(path.dirname(file)).filter((name) => name.endsWith('.tmp')), [])
336
+ }
337
+ })
338
+
339
+ test('post-commit backup cleanup failure never rolls back installed skills or hooks', async () => {
340
+ const root = temporaryRoot()
341
+ const homeDir = path.join(root, 'home')
342
+ const options = {
343
+ command: 'install', platform: 'both', method: 'direct', scope: 'user', policy: false
344
+ }
345
+ await executeInstall(options, { output: silentOutput(), homeDir, cwd: root })
346
+
347
+ const skillRoots = [
348
+ path.join(homeDir, '.claude', 'skills'),
349
+ path.join(homeDir, '.codex', 'skills')
350
+ ]
351
+ const failingFs = Object.create(fs)
352
+ let firstBackupRemoved = false
353
+ let injected = false
354
+ let rollbackAttempted = false
355
+ failingFs.rmSync = (target, rmOptions) => {
356
+ const isTransactionBackup = path.basename(target).startsWith('.agent-os-transaction-')
357
+ if (isTransactionBackup && path.dirname(target) === skillRoots[0]) {
358
+ firstBackupRemoved = true
359
+ } else if (!injected && firstBackupRemoved && isTransactionBackup &&
360
+ path.dirname(target) === skillRoots[1]) {
361
+ injected = true
362
+ throw new Error('injected post-commit cleanup failure')
363
+ } else if (injected && skillRoots.some((skillsRoot) => path.dirname(target) === skillsRoot)) {
364
+ rollbackAttempted = true
365
+ }
366
+ return fs.rmSync(target, rmOptions)
367
+ }
368
+
369
+ await assert.rejects(
370
+ executeInstall({ ...options, command: 'update' }, {
371
+ output: silentOutput(), homeDir, cwd: root, fsImpl: failingFs
372
+ }),
373
+ /direct install committed, but failed to clean transaction backups: injected post-commit cleanup failure.*not rolled back/
374
+ )
375
+
376
+ assert.equal(firstBackupRemoved, true)
377
+ assert.equal(injected, true)
378
+ assert.equal(rollbackAttempted, false)
379
+ for (const [index, skillsRoot] of skillRoots.entries()) {
380
+ const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, INSTALL_MANIFEST), 'utf8'))
381
+ assert.equal(manifest.schemaVersion, 2)
382
+ assert.equal(manifest.skills.includes('quality-ratchet'), true)
383
+ for (const name of manifest.skills) assert.equal(fs.existsSync(path.join(skillsRoot, name)), true)
384
+
385
+ const hookFile = index === 0
386
+ ? path.join(homeDir, '.claude', 'settings.json')
387
+ : path.join(homeDir, '.codex', 'hooks.json')
388
+ const hookConfig = JSON.parse(fs.readFileSync(hookFile, 'utf8'))
389
+ const managedHooks = hookConfig.hooks.Stop.filter((group) =>
390
+ JSON.stringify(group).includes('--agent-os-hook=quality-ratchet'))
391
+ assert.equal(managedHooks.length, 1)
392
+ assert.equal(managedHooks[0].hooks[0].command.includes(
393
+ path.join(skillsRoot, 'quality-ratchet', 'scripts', 'quality-delta.mjs')), true)
394
+ }
395
+ assert.deepEqual(fs.readdirSync(skillRoots[0]).filter((name) =>
396
+ name.startsWith('.agent-os-transaction-')), [])
397
+ assert.equal(fs.readdirSync(skillRoots[1]).filter((name) =>
398
+ name.startsWith('.agent-os-transaction-')).length, 1)
399
+ })
400
+
401
+ test('upgrades a schema 1 direct manifest while retaining managed integration state', async () => {
402
+ const root = temporaryRoot()
403
+ const homeDir = path.join(root, 'home')
404
+ const options = { command: 'install', platform: 'codex', method: 'direct', scope: 'user', policy: false }
405
+ await executeInstall(options, { output: silentOutput(), homeDir, cwd: root })
406
+ const skillsRoot = path.join(homeDir, '.codex', 'skills')
407
+ const manifestPath = path.join(skillsRoot, INSTALL_MANIFEST)
408
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
409
+ delete manifest.integrations
410
+ manifest.schemaVersion = 1
411
+ fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n')
412
+ await executeInstall({ ...options, command: 'update' }, { output: silentOutput(), homeDir, cwd: root })
413
+ const upgraded = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
414
+ assert.equal(upgraded.schemaVersion, 2)
415
+ assert.equal(upgraded.integrations.hooks.marker, '--agent-os-hook=quality-ratchet')
416
+ })
417
+
418
+ test('packaged hook asset and direct command use the stable runner marker', () => {
419
+ const packageJson = JSON.parse(fs.readFileSync(path.join(packageRootForTest(), 'package.json'), 'utf8'))
420
+ const hooks = JSON.parse(fs.readFileSync(path.join(packageRootForTest(), 'hooks', 'hooks.json'), 'utf8'))
421
+ const durableScript = path.join(temporaryRoot(), '.claude', 'skills', 'quality-ratchet', 'scripts', 'quality-delta.mjs')
422
+ const command = buildManagedHookCommand(durableScript)
423
+ const nativeHook = hooks.hooks.Stop[0].hooks[0]
424
+ assert.ok(packageJson.files.includes('hooks/'))
425
+ assert.equal(hooks.description.includes('quality-ratchet'), true)
426
+ assert.match(nativeHook.command, /\$\{CLAUDE_PLUGIN_ROOT\}/)
427
+ assert.equal(typeof nativeHook.commandWindows, 'string')
428
+ assert.equal(nativeHook.commandWindows.includes('"'), false)
429
+ const windowsMatch =
430
+ /^powershell\.exe -NoProfile -NonInteractive -EncodedCommand ([A-Za-z0-9+/]+={0,2})$/.exec(
431
+ nativeHook.commandWindows
432
+ )
433
+ assert.ok(windowsMatch)
434
+ const decodedWindowsCommand = Buffer.from(windowsMatch[1], 'base64').toString('utf16le')
435
+ assert.equal(decodedWindowsCommand,
436
+ "$runner = Join-Path $env:PLUGIN_ROOT 'skills\\quality-ratchet\\scripts\\quality-delta.mjs'; " +
437
+ 'node $runner hook --agent-os-hook=quality-ratchet')
438
+ assert.equal(command.startsWith('"' + process.execPath + '"'), true)
439
+ assert.equal(path.isAbsolute(durableScript), true)
440
+ assert.match(command, /--agent-os-hook=quality-ratchet/)
441
+ })
442
+
169
443
  test('updates only managed skills and preserves unrelated skills', async () => {
170
444
  const root = temporaryRoot()
171
445
  const homeDir = path.join(root, 'home')
@@ -0,0 +1,17 @@
1
+ {
2
+ "description": "Agent OS quality-ratchet lifecycle hook.",
3
+ "hooks": {
4
+ "Stop": [
5
+ {
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/skills/quality-ratchet/scripts/quality-delta.mjs\" hook --agent-os-hook=quality-ratchet",
10
+ "commandWindows": "powershell.exe -NoProfile -NonInteractive -EncodedCommand JAByAHUAbgBuAGUAcgAgAD0AIABKAG8AaQBuAC0AUABhAHQAaAAgACQAZQBuAHYAOgBQAEwAVQBHAEkATgBfAFIATwBPAFQAIAAnAHMAawBpAGwAbABzAFwAcQB1AGEAbABpAHQAeQAtAHIAYQB0AGMAaABlAHQAXABzAGMAcgBpAHAAdABzAFwAcQB1AGEAbABpAHQAeQAtAGQAZQBsAHQAYQAuAG0AagBzACcAOwAgAG4AbwBkAGUAIAAkAHIAdQBuAG4AZQByACAAaABvAG8AawAgAC0ALQBhAGcAZQBuAHQALQBvAHMALQBoAG8AbwBrAD0AcQB1AGEAbABpAHQAeQAtAHIAYQB0AGMAaABlAHQA",
11
+ "timeout": 10
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sockulags/agent-os",
3
- "version": "0.9.1",
3
+ "version": "0.12.0",
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": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "cli/",
11
+ "hooks/",
11
12
  "policy.md",
12
13
  "skills/"
13
14
  ],
@@ -15,8 +16,10 @@
15
16
  "node": ">=18.18"
16
17
  },
17
18
  "scripts": {
18
- "test": "node --test cli/*.test.mjs",
19
- "validate": "node scripts/validate-agent-os.mjs"
19
+ "test": "node --test cli/index.test.mjs skills/quality-ratchet/scripts/quality-delta.test.mjs",
20
+ "test:evals": "node scripts/test-eval-agent-behavior.mjs",
21
+ "validate": "node scripts/validate-agent-os.mjs",
22
+ "verify:release": "node scripts/verify-release.mjs"
20
23
  },
21
24
  "keywords": [
22
25
  "agent",
package/policy.md CHANGED
@@ -1,45 +1,47 @@
1
- # Agent OS — global policy
2
-
3
- Source of truth for the managed policy block installed into `~/.claude/CLAUDE.md` and
4
- `~/.codex/AGENTS.md` by `init-agent-os global`. Edit here, never inside the installed blocks.
5
-
6
- ## Core policy
7
-
8
- Priority order when instructions conflict:
9
-
10
- 1. Direct user instruction in the current session.
11
- 2. The repo's project policy and nearest `CLAUDE.md`/`AGENTS.md`.
12
- 3. The active explicit workflow (an invoked agent-os skill).
13
- 4. This global policy.
14
-
15
- Rules:
16
-
17
- - Authority follows the request: an inspection, planning, or review request is read-only apart from
18
- the requested artifact; an implementation request authorizes repository changes inside its scope.
19
- Merging, deploying, destructive cleanup, and effects on external systems or people require the
20
- direct request or project policy to include them.
21
- - Evidence before claims: verify before calling anything done, and show how it was verified.
22
- - Keep scope and diffs narrow; when work drifts beyond the task, flag it instead of building on.
23
- - Escalate only product decisions that cannot be resolved from context and would materially change
24
- the outcome. Make reversible implementation choices and report them.
25
- - Use the Git identity configured by the repository or current session. Never add AI attribution or `Co-Authored-By` trailers.
26
- - Respond in the language used by the user. Code, commits, and technical artifacts are English unless the project says otherwise.
27
- - Lead with the outcome: the first sentence answers "what happened" or "what did you find". Supporting detail comes after.
28
- - Readable beats brief: shorten by leaving out what does not change the reader's next step, not by compressing language. Full sentences; no arrow chains, fragment style, or invented shorthand the reader must decode.
29
- - Never force the reader to cross-reference labels or numbering invented earlier in the text — say what you mean in place.
30
- - Explanations belong in prose; tables only for short enumerable facts.
31
- - Calibrate tone to the topic: playfulness is fine, neutral and factual the moment the subject is serious. When in doubt, it is serious.
1
+ # Agent OS — global policy
2
+
3
+ Source of truth for the managed policy block installed into `~/.claude/CLAUDE.md` and
4
+ `~/.codex/AGENTS.md` by `init-agent-os global`. Edit here, never inside the installed blocks.
5
+
6
+ ## Core policy
7
+
8
+ Priority order when instructions conflict:
9
+
10
+ 1. Direct user instruction in the current session.
11
+ 2. The repo's project policy and nearest `CLAUDE.md`/`AGENTS.md`.
12
+ 3. The active explicit workflow (an invoked agent-os skill).
13
+ 4. This global policy.
14
+
15
+ Rules:
16
+
17
+ - Authority follows the request: an inspection, planning, or review request is read-only apart from
18
+ the requested artifact; an implementation request authorizes repository changes inside its scope.
19
+ Merging, deploying, destructive cleanup, and effects on external systems or people require the
20
+ direct request or project policy to include them.
21
+ - Evidence before claims: verify before calling anything done, and show how it was verified.
22
+ - Keep scope and diffs narrow; when work drifts beyond the task, flag it instead of building on.
23
+ - Escalate only product decisions that cannot be resolved from context and would materially change
24
+ the outcome. Make reversible implementation choices and report them.
25
+ - Use the Git identity configured by the repository or current session. Never add AI attribution or `Co-Authored-By` trailers.
26
+ - Respond in the language used by the user. Code, commits, and technical artifacts are English unless the project says otherwise.
27
+ - Lead with the outcome: the first sentence answers "what happened" or "what did you find". Supporting detail comes after.
28
+ - Readable beats brief: shorten by leaving out what does not change the reader's next step, not by compressing language. Full sentences; no arrow chains, fragment style, or invented shorthand the reader must decode.
29
+ - Never force the reader to cross-reference labels or numbering invented earlier in the text — say what you mean in place.
30
+ - Explanations belong in prose; tables only for short enumerable facts.
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
32
  - Orchestration is opt-in: `guide-me`, `chart-work`, `shape-work`, `batch-work`, `deliver-work`,
33
33
  `dispatch-next`, `init-agent-os`, `understand-work`, `explain-work`, and `record-lesson` exist for
34
34
  planned work; invoke them through the name exposed by the host (`/guide-me` for direct Claude
35
35
  skills, `/agent-os:guide-me` for the Claude plugin, or `$guide-me` for Codex). Never self-invoke
36
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
-
39
- ## Preferences (seed defaults — project policy overrides)
40
-
41
- - UI feedback under ~250 ms; feedback must not block the next interaction.
42
- - Own design identity; do not imitate the look of well-known apps.
43
- - Every repo keeps a living project policy (planning surface, design system location, verify
44
- commands, conventions, gotchas, and delivery defaults). It grows over time; `init-agent-os`
45
- seeds it and `record-lesson` grows it.
37
+ developer approves that exit, as `guide-me` does after its approved plain-language gate. The
38
+ automatic `check-work` review workflow is also available from supported implicit review requests;
39
+ its report mode is read-only and its fix mode requires explicit authority.
40
+
41
+ ## Preferences (seed defaults — project policy overrides)
42
+
43
+ - UI feedback under ~250 ms; feedback must not block the next interaction.
44
+ - Own design identity; do not imitate the look of well-known apps.
45
+ - Every repo keeps a living project policy (planning surface, design system location, verify
46
+ commands, conventions, gotchas, and delivery defaults). It grows over time; `init-agent-os`
47
+ seeds it and `record-lesson` grows it.
@@ -1,43 +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.
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.
@@ -1,2 +1,2 @@
1
- policy:
2
- allow_implicit_invocation: false
1
+ policy:
2
+ allow_implicit_invocation: false