@sockulags/agent-os 0.15.0 → 0.16.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 (96) hide show
  1. package/README.md +102 -48
  2. package/cli/doctor.mjs +307 -0
  3. package/cli/index.mjs +328 -151
  4. package/cli/index.test.mjs +406 -9
  5. package/package.json +5 -6
  6. package/plugins/agent-os-core/.claude-plugin/plugin.json +18 -0
  7. package/plugins/agent-os-core/.codex-plugin/plugin.json +24 -0
  8. package/plugins/agent-os-core/skills/capture-intent/SKILL.md +65 -0
  9. package/plugins/agent-os-core/skills/capture-intent/references/intent-template.md +47 -0
  10. package/plugins/agent-os-core/skills/explain-work/SKILL.md +42 -0
  11. package/{skills → plugins/agent-os-core/skills}/list-skills/SKILL.md +13 -6
  12. package/{skills → plugins/agent-os-core/skills}/plain-voice/SKILL.md +7 -4
  13. package/plugins/agent-os-core/skills/plan-work/SKILL.md +133 -0
  14. package/{skills → plugins/agent-os-core/skills}/plan-work/references/elicitation.md +7 -3
  15. package/plugins/agent-os-core/skills/plan-work/references/spec-template.md +64 -0
  16. package/plugins/agent-os-core/skills/record-lesson/SKILL.md +47 -0
  17. package/{skills → plugins/agent-os-core/skills}/scope-guard/SKILL.md +11 -6
  18. package/{skills → plugins/agent-os-core/skills}/verify-before-done/SKILL.md +6 -2
  19. package/plugins/agent-os-dev/.claude-plugin/plugin.json +18 -0
  20. package/plugins/agent-os-dev/.codex-plugin/plugin.json +24 -0
  21. package/plugins/agent-os-dev/hooks/hooks.json +42 -0
  22. package/{skills → plugins/agent-os-dev/skills}/batch-work/SKILL.md +5 -2
  23. package/{skills → plugins/agent-os-dev/skills}/check-work/SKILL.md +31 -14
  24. package/{skills/deliver-work/workflow.md → plugins/agent-os-dev/skills/deliver-work/SKILL.md} +77 -42
  25. package/plugins/agent-os-dev/skills/design-work/SKILL.md +145 -0
  26. package/plugins/agent-os-dev/skills/design-work/scripts/render-sketch.mjs +233 -0
  27. package/plugins/agent-os-dev/skills/design-work/scripts/render-sketch.test.mjs +73 -0
  28. package/plugins/agent-os-dev/skills/diagnose-before-fix/SKILL.md +29 -0
  29. package/{skills → plugins/agent-os-dev/skills}/dispatch-next/SKILL.md +6 -1
  30. package/plugins/agent-os-dev/skills/init-agent-os/SKILL.md +121 -0
  31. package/plugins/agent-os-dev/skills/init-agent-os/policy.md +88 -0
  32. package/plugins/agent-os-dev/skills/init-agent-os/references/guards.md +39 -0
  33. package/{skills → plugins/agent-os-dev/skills}/init-agent-os/references/repository-init.md +41 -10
  34. package/plugins/agent-os-dev/skills/init-agent-os/references/review-template.md +35 -0
  35. package/plugins/agent-os-dev/skills/init-agent-os/scripts/policy-block.mjs +187 -0
  36. package/plugins/agent-os-dev/skills/init-agent-os/templates/agent-review.yml +59 -0
  37. package/plugins/agent-os-dev/skills/init-agent-os/templates/lint-intents.yml +30 -0
  38. package/{skills → plugins/agent-os-dev/skills}/proportional-testing/SKILL.md +1 -1
  39. package/plugins/agent-os-dev/skills/quality-ratchet/SKILL.md +103 -0
  40. package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/references/project-controls.md +31 -3
  41. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/analyzers.mjs +145 -0
  42. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/analyzers.test.mjs +158 -0
  43. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/guards.mjs +372 -0
  44. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/guards.test.mjs +138 -0
  45. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/intent-files.mjs +322 -0
  46. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/intent-files.test.mjs +172 -0
  47. package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/scripts/project-controls.mjs +59 -8
  48. package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/scripts/project-controls.test.mjs +134 -8
  49. package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/scripts/quality-delta.mjs +296 -22
  50. package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/scripts/quality-delta.test.mjs +114 -6
  51. package/plugins/agent-os-dev/skills/shape-work/SKILL.md +124 -0
  52. package/plugins/agent-os-dev/skills/shape-work/references/implementation-issues.md +143 -0
  53. package/{skills/plan-work → plugins/agent-os-dev/skills/shape-work}/references/prototypes.md +9 -10
  54. package/plugins/agent-os-dev/skills/simplify/SKILL.md +91 -0
  55. package/plugins/agent-os-dev/skills/simplify/scripts/audit-evidence.mjs +166 -0
  56. package/plugins/agent-os-dev/skills/simplify/scripts/audit-evidence.test.mjs +49 -0
  57. package/policy.md +48 -24
  58. package/hooks/hooks.json +0 -17
  59. package/skills/deliver-work/SKILL.md +0 -12
  60. package/skills/diagnose-before-fix/SKILL.md +0 -24
  61. package/skills/explain-work/SKILL.md +0 -28
  62. package/skills/init-agent-os/SKILL.md +0 -55
  63. package/skills/init-agent-os/scripts/policy-block.ps1 +0 -87
  64. package/skills/notice-lesson/SKILL.md +0 -20
  65. package/skills/plan-work/SKILL.md +0 -100
  66. package/skills/quality-ratchet/SKILL.md +0 -72
  67. package/skills/record-lesson/SKILL.md +0 -31
  68. package/skills/shape-work/SKILL.md +0 -71
  69. package/skills/shape-work/references/implementation-issues.md +0 -90
  70. package/skills/shape-work/references/mockups.md +0 -23
  71. package/skills/simplifier/SKILL.md +0 -35
  72. package/skills/simplifier-audit/SKILL.md +0 -30
  73. package/skills/simplifier-review/SKILL.md +0 -40
  74. package/skills/understand-work/SKILL.md +0 -32
  75. package/skills/understand-work/agents/openai.yaml +0 -2
  76. package/skills/writing-skills/SKILL.md +0 -68
  77. package/skills/writing-skills/agents/openai.yaml +0 -2
  78. /package/{skills/batch-work → plugins/agent-os-core/skills/capture-intent}/agents/openai.yaml +0 -0
  79. /package/{skills/deliver-work → plugins/agent-os-core/skills/explain-work}/agents/openai.yaml +0 -0
  80. /package/{skills/dispatch-next → plugins/agent-os-core/skills/list-skills}/agents/openai.yaml +0 -0
  81. /package/{skills → plugins/agent-os-core/skills}/plain-voice/references/tells.md +0 -0
  82. /package/{skills/explain-work → plugins/agent-os-core/skills/plan-work}/agents/openai.yaml +0 -0
  83. /package/{skills → plugins/agent-os-core/skills}/plan-work/references/map.md +0 -0
  84. /package/{skills/init-agent-os → plugins/agent-os-dev/skills/batch-work}/agents/openai.yaml +0 -0
  85. /package/{skills → plugins/agent-os-dev/skills}/batch-work/references/manifest.md +0 -0
  86. /package/{skills → plugins/agent-os-dev/skills}/batch-work/scripts/manifest-hash.mjs +0 -0
  87. /package/{skills → plugins/agent-os-dev/skills}/batch-work/scripts/test-manifest-hash.mjs +0 -0
  88. /package/{skills → plugins/agent-os-dev/skills}/check-work/references/findings.md +0 -0
  89. /package/{skills/list-skills → plugins/agent-os-dev/skills/deliver-work}/agents/openai.yaml +0 -0
  90. /package/{skills/plan-work → plugins/agent-os-dev/skills/design-work}/agents/openai.yaml +0 -0
  91. /package/{skills/record-lesson → plugins/agent-os-dev/skills/dispatch-next}/agents/openai.yaml +0 -0
  92. /package/{skills/shape-work → plugins/agent-os-dev/skills/init-agent-os}/agents/openai.yaml +0 -0
  93. /package/{skills → plugins/agent-os-dev/skills}/proportional-testing/references/strategy.md +0 -0
  94. /package/{skills → plugins/agent-os-dev/skills}/quality-ratchet/references/structure.md +0 -0
  95. /package/{skills/simplifier-audit → plugins/agent-os-dev/skills/shape-work}/agents/openai.yaml +0 -0
  96. /package/{skills/simplifier → plugins/agent-os-dev/skills/simplify}/agents/openai.yaml +0 -0
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env node
2
+ // Collects deterministic simplification candidates for a repository-wide audit: the most complex
3
+ // functions (lizard), duplicated blocks (jscpd), and unused code (knip for JavaScript/TypeScript,
4
+ // vulture for Python). Each tool is optional and never installed here; a missing tool is reported
5
+ // as unavailable. The output is a ranked candidate list to verify, not a list of findings.
6
+
7
+ import { spawnSync } from 'node:child_process'
8
+ import fs from 'node:fs'
9
+ import os from 'node:os'
10
+ import path from 'node:path'
11
+ import { pathToFileURL } from 'node:url'
12
+ import { findLizard, lizardFunctions } from '../../quality-ratchet/scripts/analyzers.mjs'
13
+ import { isSourcePath } from '../../quality-ratchet/scripts/quality-delta.mjs'
14
+
15
+ const TIMEOUT_MS = 300000
16
+ const LINE_LIMIT = 40
17
+
18
+ function run(command, args, cwd, spawn) {
19
+ return spawn(command, args, {
20
+ cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: TIMEOUT_MS, maxBuffer: 64 * 1024 * 1024,
21
+ shell: process.platform === 'win32' && /\.(?:cmd|bat)$/i.test(command)
22
+ })
23
+ }
24
+
25
+ function sourceFiles(root, spawn) {
26
+ const result = run('git', ['-C', root, 'ls-files', '-z', '--cached', '--others', '--exclude-standard'], root, spawn)
27
+ if (result.status !== 0) throw new Error(`git ls-files failed: ${result.stderr?.trim()}`)
28
+ return result.stdout.split('\0').filter(Boolean).map((file) => file.replaceAll('\\', '/')).filter(isSourcePath)
29
+ }
30
+
31
+ function localBin(root, name) {
32
+ const base = path.join(root, 'node_modules', '.bin', name)
33
+ return [base + (process.platform === 'win32' ? '.cmd' : ''), base].find((file) => fs.existsSync(file)) || null
34
+ }
35
+
36
+ // Resolves a command to its full path so Windows .cmd shims can be launched.
37
+ function onPath(command, spawn) {
38
+ try {
39
+ const result = run(process.platform === 'win32' ? 'where.exe' : 'which', [command], process.cwd(), spawn)
40
+ if (result.status !== 0) return null
41
+ const hits = result.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
42
+ // where.exe also lists extensionless shell shims that Windows cannot launch.
43
+ return (process.platform === 'win32' ? hits.find((hit) => /\.(?:exe|cmd|bat)$/i.test(hit)) : hits[0]) || null
44
+ } catch {
45
+ return null
46
+ }
47
+ }
48
+
49
+ function firstLines(text, limit = LINE_LIMIT) {
50
+ const lines = text.split(/\r?\n/).filter((line) => line.trim())
51
+ return { lines: lines.slice(0, limit), omitted: Math.max(0, lines.length - limit) }
52
+ }
53
+
54
+ export function complexitySection(root, files, { analyze, limit = 15 } = {}) {
55
+ const functions = analyze(root, files)
56
+ if (functions === null) return { status: 'unavailable', reason: 'lizard is not installed.' }
57
+ const ranked = [...functions].sort((left, right) => right.ccn - left.ccn).slice(0, limit)
58
+ return { status: 'available', functions: ranked, analyzed: functions.length }
59
+ }
60
+
61
+ export function summarizeJscpd(report, limit = 10) {
62
+ const total = report.statistics?.total || {}
63
+ const clones = (report.duplicates || [])
64
+ .map((clone) => ({
65
+ lines: clone.lines,
66
+ first: `${clone.firstFile.name.replaceAll('\\', '/')}:${clone.firstFile.start}-${clone.firstFile.end}`,
67
+ second: `${clone.secondFile.name.replaceAll('\\', '/')}:${clone.secondFile.start}-${clone.secondFile.end}`
68
+ }))
69
+ .sort((left, right) => right.lines - left.lines)
70
+ return { status: 'available', percentage: total.percentage ?? 0, clones: clones.slice(0, limit), total: clones.length }
71
+ }
72
+
73
+ function duplicationSection(root, spawn) {
74
+ const command = localBin(root, 'jscpd') || onPath('jscpd', spawn)
75
+ if (!command) return { status: 'unavailable', reason: 'jscpd is not installed in node_modules/.bin or on PATH.' }
76
+ const output = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-jscpd-'))
77
+ try {
78
+ run(command, ['--silent', '--reporters', 'json', '--output', output, '--gitignore',
79
+ '--ignore', '**/node_modules/**,**/dist/**,**/build/**,**/coverage/**,**/.git/**', '.'], root, spawn)
80
+ const reportPath = path.join(output, 'jscpd-report.json')
81
+ if (!fs.existsSync(reportPath)) return { status: 'unavailable', reason: 'jscpd produced no report.' }
82
+ return summarizeJscpd(JSON.parse(fs.readFileSync(reportPath, 'utf8')))
83
+ } finally {
84
+ fs.rmSync(output, { recursive: true, force: true })
85
+ }
86
+ }
87
+
88
+ function deadCodeSection(root, files, spawn) {
89
+ const sections = []
90
+ const knip = localBin(root, 'knip')
91
+ if (knip) {
92
+ const result = run(knip, ['--reporter', 'compact', '--no-progress'], root, spawn)
93
+ sections.push({ tool: 'knip', status: 'available', ...firstLines(`${result.stdout}`) })
94
+ } else if (files.some((file) => /\.(?:[cm]?[jt]sx?)$/.test(file))) {
95
+ sections.push({ tool: 'knip', status: 'unavailable', reason: 'knip is not installed in node_modules/.bin.' })
96
+ }
97
+ const python = files.filter((file) => file.endsWith('.py'))
98
+ if (python.length) {
99
+ const vulture = onPath('vulture', spawn)
100
+ if (vulture) {
101
+ const result = run(vulture, ['--min-confidence', '80', ...python], root, spawn)
102
+ sections.push({ tool: 'vulture', status: 'available', ...firstLines(`${result.stdout}`) })
103
+ } else {
104
+ sections.push({ tool: 'vulture', status: 'unavailable', reason: 'vulture is not on PATH.' })
105
+ }
106
+ }
107
+ return sections
108
+ }
109
+
110
+ export function collectEvidence(root, { spawn = spawnSync, analyze } = {}) {
111
+ const files = sourceFiles(root, spawn)
112
+ const launcher = analyze ? undefined : findLizard({ spawn })
113
+ const analyzer = analyze || ((cwd, list) => lizardFunctions(cwd, list, { launcher, spawn }))
114
+ const safe = (fn) => {
115
+ try { return fn() } catch (cause) { return { status: 'unavailable', reason: cause.message } }
116
+ }
117
+ return {
118
+ root,
119
+ sourceFiles: files.length,
120
+ complexity: safe(() => complexitySection(root, files, { analyze: analyzer })),
121
+ duplication: safe(() => duplicationSection(root, spawn)),
122
+ deadCode: safe(() => deadCodeSection(root, files, spawn))
123
+ }
124
+ }
125
+
126
+ export function formatEvidence(evidence) {
127
+ const lines = [`Agent OS simplification evidence for ${evidence.root} (${evidence.sourceFiles} source files)`, '']
128
+ const { complexity, duplication, deadCode } = evidence
129
+ lines.push('Most complex functions (lizard, cyclomatic complexity):')
130
+ if (complexity.status === 'available') {
131
+ lines.push(...complexity.functions.map((fn) => ` ${fn.ccn} ${fn.file}:${fn.line} ${fn.function}`))
132
+ } else lines.push(` unavailable: ${complexity.reason}`)
133
+ lines.push('', 'Duplicated blocks (jscpd):')
134
+ if (duplication.status === 'available') {
135
+ lines.push(` ${duplication.percentage}% duplicated lines, ${duplication.total} clones`)
136
+ lines.push(...duplication.clones.map((clone) => ` ${clone.lines} lines ${clone.first} = ${clone.second}`))
137
+ } else lines.push(` unavailable: ${duplication.reason}`)
138
+ lines.push('', 'Unused code:')
139
+ const dead = Array.isArray(deadCode) ? deadCode : [deadCode]
140
+ if (!dead.length) lines.push(' no supported language detected')
141
+ for (const section of dead) {
142
+ if (section.status !== 'available') {
143
+ lines.push(` ${section.tool || 'dead-code'} unavailable: ${section.reason}`)
144
+ continue
145
+ }
146
+ lines.push(` ${section.tool}:`, ...section.lines.map((line) => ` ${line}`))
147
+ if (section.omitted) lines.push(` ... ${section.omitted} more lines`)
148
+ }
149
+ lines.push('', 'These are candidates. Verify usage and intent before reporting any of them as a finding.')
150
+ return lines.join('\n')
151
+ }
152
+
153
+ function main() {
154
+ const args = process.argv.slice(2)
155
+ const json = args.includes('--json')
156
+ const rootArgument = args.find((arg) => !arg.startsWith('--'))
157
+ try {
158
+ const evidence = collectEvidence(path.resolve(rootArgument || process.cwd()))
159
+ console.log(json ? JSON.stringify(evidence, null, 2) : formatEvidence(evidence))
160
+ } catch (cause) {
161
+ console.error(`audit-evidence: ${cause.message}`)
162
+ process.exitCode = 1
163
+ }
164
+ }
165
+
166
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main()
@@ -0,0 +1,49 @@
1
+ import assert from 'node:assert/strict'
2
+ import { execFileSync, spawnSync } from 'node:child_process'
3
+ import fs from 'node:fs'
4
+ import os from 'node:os'
5
+ import path from 'node:path'
6
+ import test from 'node:test'
7
+ import { collectEvidence, formatEvidence, summarizeJscpd } from './audit-evidence.mjs'
8
+
9
+ // Every external tool is reported missing; git still runs.
10
+ function withoutTools(command, args, options) {
11
+ if (['where.exe', 'which'].includes(command)) return { status: 1, stdout: '', stderr: '' }
12
+ return spawnSync(command, args, options)
13
+ }
14
+
15
+ test('ranks complex functions and reports missing tools as unavailable', (t) => {
16
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-audit-'))
17
+ t.after(() => fs.rmSync(root, { recursive: true, force: true }))
18
+ execFileSync('git', ['init', '-q', root])
19
+ fs.writeFileSync(path.join(root, 'a.js'), 'export const a = 1\n')
20
+ fs.writeFileSync(path.join(root, 'b.py'), 'b = 1\n')
21
+ fs.writeFileSync(path.join(root, 'notes.md'), '# not source\n')
22
+ const analyze = (cwd, files) => files.map((file, index) => ({ file, function: `f${index}`, line: 1, ccn: index + 5, nloc: 1 }))
23
+
24
+ const evidence = collectEvidence(root, { spawn: withoutTools, analyze })
25
+ assert.equal(evidence.sourceFiles, 2)
26
+ assert.deepEqual(evidence.complexity.functions.map((fn) => [fn.file, fn.ccn]), [['b.py', 6], ['a.js', 5]])
27
+ assert.equal(evidence.duplication.status, 'unavailable')
28
+ assert.deepEqual(evidence.deadCode.map((section) => [section.tool, section.status]), [
29
+ ['knip', 'unavailable'],
30
+ ['vulture', 'unavailable']
31
+ ])
32
+ const text = formatEvidence(evidence)
33
+ assert.match(text, /6 {2}b\.py:1 f1/)
34
+ assert.match(text, /These are candidates/)
35
+ })
36
+
37
+ test('summarizes jscpd clones largest first with forward-slash paths', () => {
38
+ const clone = (lines, first, second) => ({
39
+ lines,
40
+ firstFile: { name: first, start: 1, end: lines },
41
+ secondFile: { name: second, start: 10, end: 9 + lines }
42
+ })
43
+ const summary = summarizeJscpd({
44
+ statistics: { total: { percentage: 4.2 } },
45
+ duplicates: [clone(5, 'src\\a.js', 'src\\b.js'), clone(30, 'src/c.js', 'src/d.js')]
46
+ })
47
+ assert.equal(summary.percentage, 4.2)
48
+ assert.deepEqual(summary.clones.map((entry) => [entry.lines, entry.first]), [[30, 'src/c.js:1-30'], [5, 'src/a.js:1-5']])
49
+ })
package/policy.md CHANGED
@@ -1,7 +1,9 @@
1
- # Agent OS — global policy
1
+ # Agent OS global policy
2
2
 
3
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.
4
+ `~/.codex/AGENTS.md` by the installer and `init-agent-os global`. Edit here, never inside the
5
+ installed blocks. Everything above `## Development workflows` is the core policy; the installer adds
6
+ that section only when `agent-os-dev` is installed.
5
7
 
6
8
  ## Core policy
7
9
 
@@ -22,43 +24,65 @@ Rules:
22
24
  - Keep scope and diffs narrow; when work drifts beyond the task, flag it instead of building on.
23
25
  - Escalate only product decisions that cannot be resolved from context and would materially change
24
26
  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
27
  - Respond in the language used by the user. Code, commits, and technical artifacts are English unless the project says otherwise.
27
28
  - Lead with the outcome: the first sentence answers "what happened" or "what did you find". Supporting detail comes after.
28
29
  - 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
+ - Plain voice in every reply and every text you write: each sentence carries a fact, an instruction,
31
+ or a number. Cut claims with no source or mechanism, promotional adjectives, filler openers,
32
+ restated questions, stacked hedges, abstract metaphors in place of the concrete noun, structure
33
+ forced onto the content (ideas in threes, "not just X but Y", bold labels that repeat their line),
34
+ and closing offers of help. State a claim that stays unverified after checking once, plainly. No
35
+ dashes in running text. Established technical terms stay in English in any language. Never rewrite
36
+ code, identifiers, structured data, quoted source material, or the user's own prose unless asked.
37
+ The `plain-voice` skill holds the full checklist for documentation, commits, and pull request text.
38
+ - Never force the reader to cross-reference labels or numbering invented earlier in the text; say what you mean in place.
30
39
  - Explanations belong in prose; tables only for short enumerable facts.
31
40
  - 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: `plan-work`, `shape-work`, `batch-work`, `deliver-work`, `dispatch-next`,
33
- `init-agent-os`, `understand-work`, `explain-work`, and `record-lesson` exist for planned work;
34
- invoke them through the name exposed by the host (`/plan-work` for direct Claude skills,
35
- `/agent-os:plan-work` for the Claude plugin, or `$plan-work` for Codex). Never self-invoke them.
36
- Planning depth is chosen internally by plan-work, and its use does not add a general summary
37
- approval gate. Existing authority may continue into the workflow its exit contract names; planning
38
- alone never starts implementation. The automatic `check-work` review workflow is also available
39
- from supported implicit review requests; its report mode is read-only and its fix mode requires
40
- explicit authority.
41
-
41
+ - Orchestration is opt-in: manual agent-os skills such as `capture-intent`, `plan-work`,
42
+ `explain-work`, `record-lesson`, and `list-skills` run only when invoked through the name the host
43
+ exposes (`/plan-work` for direct Claude skills, `/agent-os-core:plan-work` for the Claude plugin,
44
+ or `$plan-work` for Codex). Never self-invoke them or any other manual agent-os skill. Planning
45
+ depth is chosen internally by plan-work, and its use does not add a general summary approval gate.
46
+ Planning alone never starts implementation.
42
47
  - Always recommend one concrete next action when planning or a delivery unit ends, with the reason
43
- it wins and any blocker. Continuing sequentially through already shaped issues is allowed when
44
- the active implementation request covers that bounded set. Planning alone never starts delivery;
45
- parallel batch execution still requires explicit selection. Existing authority persists across
46
- unit boundaries, but never expands to unrelated backlog work. If the goal is complete and no
47
- useful next action remains, say so instead of manufacturing work.
48
+ it wins and any blocker. Existing authority persists across unit boundaries, but never expands to
49
+ unrelated backlog work. If the goal is complete and no useful next action remains, say so instead
50
+ of manufacturing work.
48
51
  - Scope has two independent axes: classify discoveries as required, adjacent, or unrelated to the
49
52
  mission, then classify the work as covered by the existing mandate or requiring a new decision or
50
53
  external action. Risk guides implementation and verification and can reveal a missing decision;
51
54
  risk-area membership does not grant permission. Required covered work normally stays in scope,
52
55
  while adjacent work is a follow-up and unrelated work gets no invented proposal.
53
- - No skill grants external tracker write access automatically. An explicit tracker mandate may
54
- include implementation detail and technical ordering/readiness inside the authorized set, but not
55
- acceptance changes, new owners or deliveries, or closure. Without that mandate, keep corrections
56
- local and preserve an unsynced delta in working memory only when it must survive the session.
56
+ - No skill grants external tracker write access automatically. An explicit tracker mandate in the
57
+ request or the project policy's `## Tracker mandate` section may include implementation detail and
58
+ technical ordering/readiness inside the authorized set, but not acceptance changes, new owners or
59
+ deliveries, or closure. Without that mandate, keep corrections local and report the unsynced delta.
60
+ - Decisions that outlive a session live in versioned files: `intents/<id>/intent.md` for what is
61
+ needed and why, and `spec.md` beside it for behavior, interface, boundaries, decisions, and
62
+ ground truth. They change only through a reviewed change, and a file whose `built_on` revision
63
+ is older than its source is stale until it is reconsidered.
57
64
 
58
- ## Preferences (seed defaults — project policy overrides)
65
+ ## Preferences (seed defaults; project policy overrides)
59
66
 
60
67
  - UI feedback under ~250 ms; feedback must not block the next interaction.
61
68
  - Own design identity; do not imitate the look of well-known apps.
62
69
  - Every repo keeps a living project policy (planning surface, design system location, verify
63
70
  commands, conventions, gotchas, and delivery defaults). It grows over time; `init-agent-os`
64
71
  seeds it and `record-lesson` grows it.
72
+
73
+ ## Development workflows
74
+
75
+ - Use the Git identity configured by the repository or current session. Never add AI attribution or `Co-Authored-By` trailers.
76
+ - The development skills `design-work`, `shape-work`, `deliver-work`, `batch-work`, `dispatch-next`,
77
+ `simplify`, and `init-agent-os` are manual too (`/agent-os-dev:deliver-work` for the Claude
78
+ plugin). Existing authority may continue into the workflow a skill's exit contract names, as
79
+ `plan-work` does into `design-work`. Continuing sequentially
80
+ through already shaped units is allowed when the active implementation request covers that bounded
81
+ set; parallel batch execution still requires explicit selection. The automatic `check-work` review
82
+ workflow is also available from supported implicit review requests; its report mode is read-only
83
+ and its fix mode requires explicit authority.
84
+ - `plan.md` beside a spec lists delivery units and dependencies only. Delivery status is never
85
+ written into it: a unit is claimed by a draft pull request whose body carries
86
+ `Intent-Unit: <intent-id>/<unit-key>`, and status is read from open and merged pull requests.
87
+ - Agent OS hooks read `.agent-os/guards.json`. A hook block is a boundary, not an obstacle: change
88
+ course or ask, and never work around it by another tool or path.
package/hooks/hooks.json DELETED
@@ -1,17 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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.
@@ -1,24 +0,0 @@
1
- ---
2
- name: diagnose-before-fix
3
- description: Finds the root cause of reproducible technical failures before code is changed. It activates when investigating a bug, regression, failing test, crash, or unexpected behavior whose cause is not yet established, before proposing or applying a fix. It skips known-cause mechanical edits, feature implementation, general review, and post-fix verification.
4
- ---
5
-
6
- # Diagnose before fix
7
-
8
- Find the smallest supported explanation that accounts for the failure and predicts a useful check.
9
-
10
- ## Contract
11
-
12
- - **Ground truth:** the narrowest reliable reproduction or observed failure.
13
- - **Working surface:** tests, diagnostics, logs, and instrumentation inside the task scope.
14
- - **Boundary:** do not commit a production fix whose causal story is still guesswork.
15
-
16
- ## Loop
17
-
18
- Reproduce, reduce, trace the nearest seam, and compare plausible causes with high-information checks.
19
- Use temporary instrumentation when it helps. Once evidence supports a cause, implement the smallest
20
- fix and add a regression check when practical. Re-run the original failing path.
21
-
22
- If the failure cannot be reproduced or competing explanations cannot be distinguished, report the
23
- bounded uncertainty and the next discriminating check. Do not turn a plausible hypothesis into a
24
- confirmed diagnosis.
@@ -1,28 +0,0 @@
1
- ---
2
- name: explain-work
3
- description: Explains the current task or plan in plain language with no technical vocabulary, so the developer can judge it beyond the jargon. User-invoked directly when a real decision needs a plain-language summary or as a plan-work aid. Not a substitute for technical review or verification.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Explain work
8
-
9
- Say what the work solves as if the reader knows no technical terms — then let the developer judge
10
- it.
11
-
12
- ## The summary
13
-
14
- Cover, in everyday language: the problem it solves, who feels that problem, what changes in their
15
- day when it works, and what it deliberately will not do. No technical vocabulary at all — if the
16
- summary cannot stand without a technical term, the understanding is not finished; go back and
17
- understand before explaining. Keep it short enough to read in under a minute: a TLDR, not a report.
18
-
19
- ## The gate
20
-
21
- Present the summary when it is needed for an actual decision and let the developer approve or
22
- challenge it. A challenge means the understanding was wrong somewhere: name what was misunderstood
23
- and reopen the questioning or the plan at that point rather than defending the summary. Under
24
- plan-work, the summary may be linked from the canonical planning artifact; it is not a general
25
- workflow gate.
26
-
27
- Standalone, explain-work can run against any plan, diff, or pull request; the deliverable is the
28
- plain-language summary itself and the developer's verdict on it.
@@ -1,55 +0,0 @@
1
- ---
2
- name: init-agent-os
3
- description: Sets up agent-os globally on a machine, or initializes a repo's living project policy through an interview. User-invoked only, at machine setup or when onboarding a repo. Not for ordinary tasks.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # init-agent-os
8
-
9
- The invocation authorizes setup writes for the named target. Use one mode per run.
10
-
11
- ## Mode: `global` (once per machine)
12
-
13
- Invoked as `init-agent-os global`.
14
-
15
- 1. Verify the plugin is visible on this platform (skills listed under the `agent-os` namespace). Report what you find.
16
- 2. Run `scripts/policy-block.ps1 -Check` and report drift between `policy.md` and the managed blocks in `~/.claude/CLAUDE.md` and `~/.codex/AGENTS.md`.
17
- 3. Run `scripts/policy-block.ps1` to apply the managed blocks and show the resulting diff. This
18
- deterministic writer shares its marker contract with the npm installer's policy writer.
19
-
20
- ## Mode: repo init (default)
21
-
22
- Invoked in a repo working directory. Read [repository-init.md](references/repository-init.md)
23
- for the detailed contract.
24
-
25
- 1. Inspect broadly before asking: instruction and policy surfaces, README and docs, package/build
26
- files, test and CI configuration, and evidence of conditional areas. Before writing, every live
27
- host-consumed policy surface must have unambiguous ownership and precedence. Shared identical
28
- content or a clear canonical cross-reference is sufficient; do not select one file while
29
- conflicting applicable rules remain elsewhere. If target ownership cannot be resolved, ask one
30
- ownership question and block the write.
31
- 2. Maintain a transient completeness ledger while working. Every applicable material field ends as
32
- repository-evidenced or confirmed, `N/A`, explicitly deferred/open, or conflicting. Do not
33
- guess through a conflict, and do not write the ledger or interview history to the policy.
34
- 3. Before writing, each mandatory core field must reach one allowed terminal state: repository-
35
- evidenced or confirmed, `N/A`, explicitly deferred/open, or conflicting. The core covers policy
36
- ownership and canonical instruction surface; delivery boundary, stopping point, and external
37
- effects; verification and ground truth, including when commands are insufficient; coherent
38
- planning identities, claims, handoffs, readiness, epic ownership, and dependencies; and
39
- maintenance of durable lessons and gotchas. Only
40
- an unresolved policy ownership/write-target conflict blocks writing; other explicit deferrals
41
- may be written concisely under **Open setup questions**.
42
- 4. Activate only conditional modules supported by repository evidence: frontend/design/rendered QA;
43
- package/release/docs; CI/deploy; auth/security/billing/external writes; database/migration/
44
- concurrency; batch/monorepo; and native/desktop. Omit inactive modules from the output.
45
- 5. Ask only unresolved material questions, one at a time, with a recommendation and consequence.
46
- Explicit deferral is an answer: record it under **Open setup questions** without inventing a
47
- default. Do not ask feature-specific outcome, acceptance, or UI-product questions.
48
- 6. Write only durable behavior-changing defaults and relevant sections to the resolved existing
49
- instruction surface, or a new `policy.md` when none exists. Preserve unrelated instructions,
50
- show the resulting diff, and do not request a second approval for this setup write.
51
-
52
- Block handling remains deterministic: add one missing block, update only well-formed managed content,
53
- and stop on duplicate or malformed markers. Global mode touches no repository files; repo mode
54
- touches one repository. The direct request or recorded delivery defaults govern merge and deploy
55
- actions.
@@ -1,87 +0,0 @@
1
- # Manages the AGENT OS block in global instruction files.
2
- # Source of truth: policy.md at the plugin root (two levels up from this script).
3
- #
4
- # Semantics (locked in the agent-os plan, M3):
5
- # - No block in target -> append exactly one block, preserve everything else.
6
- # - Empty target file -> treated as "no block"; the block becomes the whole file.
7
- # - Exactly one well-formed -> replace only the content between the markers.
8
- # - Duplicated, crossed, or half-open markers -> abort without mutation, exit 2.
9
- # - -Check -> read-only; exit 0 in sync, exit 1 on drift/missing, never writes.
10
- # - Text outside the block is never touched or normalized.
11
-
12
- [CmdletBinding()]
13
- param(
14
- [switch]$Check,
15
- [string[]]$Targets = @(
16
- (Join-Path (Join-Path $HOME '.claude') 'CLAUDE.md'),
17
- (Join-Path (Join-Path $HOME '.codex') 'AGENTS.md')
18
- )
19
- )
20
-
21
- $ErrorActionPreference = 'Stop'
22
- $BeginMarker = '<!-- BEGIN AGENT OS -->'
23
- $EndMarker = '<!-- END AGENT OS -->'
24
-
25
- $policyPath = Join-Path $PSScriptRoot '..\..\..\policy.md' | Resolve-Path
26
- $policy = (Get-Content -Raw -Path $policyPath).TrimEnd()
27
- $block = "$BeginMarker`n$policy`n$EndMarker"
28
-
29
- $exit = 0
30
-
31
- foreach ($target in $Targets) {
32
- $label = $target
33
- if (-not (Test-Path $target)) {
34
- if ($Check) {
35
- Write-Output "DRIFT $label : file missing"
36
- $exit = 1
37
- } else {
38
- $dir = Split-Path $target
39
- if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Force -Path $dir | Out-Null }
40
- Set-Content -NoNewline -Path $target -Value ($block + "`n")
41
- Write-Output "ADDED $label : created file with managed block"
42
- }
43
- continue
44
- }
45
-
46
- # An empty file returns $null from -Raw, which would throw in Matches below.
47
- $content = Get-Content -Raw -Path $target
48
- if ($null -eq $content) { $content = '' }
49
- $beginCount = ([regex]::Matches($content, [regex]::Escape($BeginMarker))).Count
50
- $endCount = ([regex]::Matches($content, [regex]::Escape($EndMarker))).Count
51
-
52
- if ($beginCount -eq 0 -and $endCount -eq 0) {
53
- if ($Check) {
54
- Write-Output "DRIFT $label : managed block missing"
55
- $exit = 1
56
- } else {
57
- $sep = if ($content.Length -eq 0) { '' } elseif ($content.EndsWith("`n")) { "`n" } else { "`n`n" }
58
- Set-Content -NoNewline -Path $target -Value ($content + $sep + $block + "`n")
59
- Write-Output "ADDED $label : appended managed block"
60
- }
61
- continue
62
- }
63
-
64
- $wellFormed = ($beginCount -eq 1 -and $endCount -eq 1 -and
65
- $content.IndexOf($BeginMarker) -lt $content.IndexOf($EndMarker))
66
- if (-not $wellFormed) {
67
- Write-Output "ERROR $label : malformed markers (begin=$beginCount end=$endCount) - no mutation"
68
- exit 2
69
- }
70
-
71
- $start = $content.IndexOf($BeginMarker)
72
- $end = $content.IndexOf($EndMarker) + $EndMarker.Length
73
- $current = $content.Substring($start, $end - $start)
74
-
75
- if ($current -eq $block) {
76
- Write-Output "OK $label : in sync"
77
- } elseif ($Check) {
78
- Write-Output "DRIFT $label : block differs from policy.md"
79
- $exit = 1
80
- } else {
81
- $updated = $content.Substring(0, $start) + $block + $content.Substring($end)
82
- Set-Content -NoNewline -Path $target -Value $updated
83
- Write-Output "UPDATED $label : block replaced from policy.md"
84
- }
85
- }
86
-
87
- exit $exit
@@ -1,20 +0,0 @@
1
- ---
2
- name: notice-lesson
3
- description: Treats a developer interruption, correction, or challenge as a misunderstanding signal worth examining. It activates when the developer stops the agent, contradicts its direction, or questions its output mid-task. It skips ordinary clarifying questions, requested iteration rounds, and disagreements the developer resolves in the same breath.
4
- ---
5
-
6
- # Notice lesson
7
-
8
- An interruption is information: the agent's model of the task and the developer's intent just
9
- diverged.
10
-
11
- When it happens, name the divergence in one sentence — what was assumed, what was actually wanted —
12
- and correct course first. Then judge whether the divergence is durable: would the next session, or
13
- an agent in a repository that has never seen this conversation, make the same mistake?
14
-
15
- - A one-off — missing context, an ambiguous word, a changed mind — needs no record; continue.
16
- - A durable lesson — a convention, a preference, a gotcha that will recur — deserves recording.
17
- Offer `record-lesson` with the candidate lesson already phrased.
18
-
19
- Noticing never argues with the correction and never edits policy itself; recording is the
20
- developer's call through `record-lesson`.