@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,73 @@
1
+ import assert from 'node:assert/strict'
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import test from 'node:test'
6
+ import { browserCandidates, findBrowser, main, parseArgs, RenderError, resolveTarget } from './render-sketch.mjs'
7
+
8
+ const browser = findBrowser()
9
+ const needsBrowser = { skip: browser ? false : 'no Chrome or Edge on this machine' }
10
+
11
+ function workspace() {
12
+ return fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-sketch-')))
13
+ }
14
+
15
+ async function run(argv) {
16
+ let text = ''
17
+ const code = await main(argv, { write(chunk) { text += chunk } })
18
+ return { code, text }
19
+ }
20
+
21
+ function pngSize(file) {
22
+ const bytes = fs.readFileSync(file)
23
+ assert.equal(bytes.subarray(1, 4).toString(), 'PNG')
24
+ return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) }
25
+ }
26
+
27
+ test('arguments need a target and an output folder, and widths must be whole numbers', () => {
28
+ assert.deepEqual(parseArgs(['a.html', '--out', 'x', '--widths', '390,1280']).widths, [390, 1280])
29
+ assert.throws(() => parseArgs(['a.html']), RenderError)
30
+ assert.throws(() => parseArgs(['a.html', '--out', 'x', '--widths', '390,wide']), /positive whole numbers/)
31
+ assert.throws(() => parseArgs(['a.html', '--out', 'x', '--bogus', '1']), /Unknown option/)
32
+ })
33
+
34
+ test('only local files and local addresses are opened', () => {
35
+ assert.equal(resolveTarget('http://localhost:6006/iframe.html'), 'http://localhost:6006/iframe.html')
36
+ assert.throws(() => resolveTarget('https://example.com/'), /Only local addresses/)
37
+ assert.throws(() => resolveTarget(path.join(os.tmpdir(), 'agent-os-no-such-sketch.html')), /No such file/)
38
+ })
39
+
40
+ test('browser candidates follow the platform', () => {
41
+ assert.ok(browserCandidates('win32', { ProgramFiles: 'C:\\PF' }).includes('C:\\PF\\Google\\Chrome\\Application\\chrome.exe'))
42
+ assert.ok(browserCandidates('darwin', {}).some((candidate) => candidate.includes('Microsoft Edge.app')))
43
+ assert.ok(browserCandidates('linux', { PATH: '/usr/bin' }).includes('/usr/bin/chromium'))
44
+ assert.equal(findBrowser([path.join(os.tmpdir(), 'agent-os-no-such-browser')]), null)
45
+ })
46
+
47
+ test('a missing browser cannot render and says so', async () => {
48
+ const dir = workspace()
49
+ fs.writeFileSync(path.join(dir, 'a.html'), '<p>x</p>')
50
+ const { code, text } = await run([path.join(dir, 'a.html'), '--out', dir, '--browser', path.join(dir, 'no-browser.exe')])
51
+ assert.equal(code, 2, text)
52
+ assert.match(text, /CANNOT RENDER/)
53
+ })
54
+
55
+ test('a clean sketch renders the full page at each width', needsBrowser, async () => {
56
+ const dir = workspace()
57
+ fs.writeFileSync(path.join(dir, 'tall.html'), '<!doctype html><body style="margin:0"><div style="height:2000px">x</div>')
58
+ const { code, text } = await run([path.join(dir, 'tall.html'), '--out', path.join(dir, 'out'), '--widths', '390,1280'])
59
+ assert.equal(code, 0, text)
60
+ assert.deepEqual(pngSize(path.join(dir, 'out', 'tall-390.png')), { width: 390, height: 2000 })
61
+ assert.deepEqual(pngSize(path.join(dir, 'out', 'tall-1280.png')), { width: 1280, height: 2000 })
62
+ })
63
+
64
+ test('console errors, uncaught exceptions, and overflow are reported', needsBrowser, async () => {
65
+ const dir = workspace()
66
+ fs.writeFileSync(path.join(dir, 'bad.html'), '<!doctype html><body style="margin:0"><div style="width:800px">x</div><script>console.error("boom"); missingFunction()</script>')
67
+ const { code, text } = await run([path.join(dir, 'bad.html'), '--out', dir, '--widths', '390'])
68
+ assert.equal(code, 1, text)
69
+ assert.match(text, /ERROR 390: boom/)
70
+ assert.match(text, /ERROR 390: ReferenceError: missingFunction is not defined/)
71
+ assert.match(text, /WARN 390: the content is 800 px wide/)
72
+ assert.equal(pngSize(path.join(dir, 'bad-390.png')).width, 800)
73
+ })
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: diagnose-before-fix
3
+ description: Bug, crash, error, regression, or failing test whose cause is unknown. Reproduces the failure and finds the root cause before any code changes. Use when the user says things like figure out why, this broke, it returns a 500, this test is flaky, what is going on with this error, or fix this bug. Not for edits whose cause is already known, new features, code review, or checking that a finished fix works.
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. When the failure can be captured as an automated test,
20
+ write that test first and confirm it fails for the diagnosed reason. In a delivery that commits, commit
21
+ the failing test before the fix, and when agent-os-dev guards are installed run
22
+ `guards.mjs lock-test <path>` from the quality-ratchet skill's `scripts/` so the test cannot be bent
23
+ to fit the fix. Once evidence supports a cause, implement the smallest fix. Re-run the original
24
+ failing path, then `guards.mjs unlock-test <path>`. Changing a locked test needs the developer's
25
+ explicit agreement, because it changes what counts as fixed.
26
+
27
+ If the failure cannot be reproduced or competing explanations cannot be distinguished, report the
28
+ bounded uncertainty and the next discriminating check. Do not turn a plausible hypothesis into a
29
+ confirmed diagnosis.
@@ -11,7 +11,12 @@ choice or dispatch it.
11
11
 
12
12
  ## Loop
13
13
 
14
- Read project policy, queue conventions, issues, pull requests, and CI. Prioritize work already in
14
+ Read project policy, queue conventions, the units in `intents/*/plan.md`, issues, pull requests, and
15
+ CI. A unit's status comes from pull requests, never from the plan: a unit with an open pull request
16
+ carrying its `Intent-Unit: <intent-id>/<unit-key>` line is claimed, one whose pull request merged is
17
+ delivered, and one whose dependencies are delivered and whose line carries no `blocked:` note is
18
+ ready. A spec or plan whose `built_on` revision is older than its source is not ready; route it to
19
+ `plan-work` or `shape-work`. Prioritize work already in
15
20
  flight when it has an actionable review or failure. Select one target using the repository's
16
21
  priority rules and explain why it wins.
17
22
 
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: init-agent-os
3
+ description: Sets up agent-os globally on a machine with personal preferences, or initializes and later adjusts a repo's living project policy through an interview. User-invoked only, at machine setup, when onboarding a repo, or when changing how a repo works. 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 agent-os skills are visible on this platform: under the `agent-os` namespace for a
16
+ plugin install, or as top-level skills for a direct install. Report what you find.
17
+ 2. Resolve `scripts/policy-block.mjs` relative to this loaded `SKILL.md` and run it with Node and
18
+ `--check`. Report drift between the policy source and the managed blocks. Without
19
+ `--platform`, it targets `~/.claude/CLAUDE.md` and `~/.codex/AGENTS.md` for the hosts present on
20
+ this machine.
21
+ 3. Run the same script without `--check` to apply the managed blocks and show the resulting diff.
22
+ The npm installer imports this writer, so both share one marker contract. Each block starts with
23
+ an `<!-- agent-os version X -->` line taken from the installed release.
24
+ 4. Settle personal preferences in a `## My working preferences` section outside the managed block
25
+ of each target file. When the section is absent, ask three things with a recommendation each:
26
+ when unsure, ask early or decide and report (recommend decide and report for reversible choices);
27
+ explanations short or walked through (recommend short); and anything the agent should always or
28
+ never do. When it exists, show it and ask what to change; "nothing" writes nothing. These are
29
+ style only: they yield to project policy and never grant merge, deploy, or external-effect
30
+ authority.
31
+
32
+ ## Mode: repo init (default)
33
+
34
+ Invoked in a repo working directory. Read [repository-init.md](references/repository-init.md)
35
+ for the detailed contract.
36
+
37
+ Facts and preferences are collected differently. Facts, such as commands, paths, and CI, come from
38
+ the repository. Preferences, how the developer wants to work here, can only come from the developer:
39
+ evidence may recommend an answer but does not settle one. Repo init never asks or writes the personal
40
+ preferences that belong to global mode.
41
+
42
+ Use the first run when the repository has neither a `## Working agreement` section nor an
43
+ `.agent-os/` directory. Otherwise use the return run.
44
+
45
+ ### Working agreement
46
+
47
+ These are the preferences a repository records, under `## Working agreement` in its policy:
48
+
49
+ - who works here and who approves: solo, or a team and its reviewer;
50
+ - the default stopping point: local change, pull request, merge, or deployment;
51
+ - the default path for a new feature: deliver directly, spec first, or intent, spec, and plan;
52
+ - where delivery units live: `plan.md` or a tracker;
53
+ - the language of commits, docs, and issues;
54
+ - with the frontend module active, whether interfaces are sketched before they are built and, if
55
+ so, in which medium and where the sketches live, recommending a workshop the repository already
56
+ has and `html` otherwise.
57
+
58
+ Ask them in at most two rounds of at most four questions, through the host's structured question
59
+ tool when it has one. Each question leads with its recommended answer and states the consequence of
60
+ choosing differently. "Use your recommendations for the rest" is always an available answer and
61
+ holds for the whole run: an evidence-backed recommendation counts as confirmed, including on later
62
+ fact questions, and a fact with no evidence goes under **Open setup questions** without being asked.
63
+ An answer that settles a core field is written once.
64
+
65
+ ### First run
66
+
67
+ 1. Inspect broadly before asking: instruction and policy surfaces, README and docs, package/build
68
+ files, test and CI configuration, and evidence of conditional areas. Before writing, every live
69
+ host-consumed policy surface must have unambiguous ownership and precedence. Shared identical
70
+ content or a clear canonical cross-reference is sufficient; do not select one file while
71
+ conflicting applicable rules remain elsewhere. If target ownership cannot be resolved, ask one
72
+ ownership question and block the write.
73
+ 2. Maintain a transient completeness ledger while working. Every applicable material field ends as
74
+ repository-evidenced or confirmed, `N/A`, explicitly deferred/open, or conflicting. Do not
75
+ guess through a conflict, and do not write the ledger or interview history to the policy.
76
+ 3. Before writing, each mandatory core field must reach one allowed terminal state: repository-
77
+ evidenced or confirmed, `N/A`, explicitly deferred/open, or conflicting. The core covers policy
78
+ ownership and canonical instruction surface; delivery boundary, stopping point, and external
79
+ effects; verification and ground truth, including when commands are insufficient; coherent
80
+ planning identities, claims, handoffs, readiness, epic ownership, and dependencies; and
81
+ maintenance of durable lessons and gotchas. Only
82
+ an unresolved policy ownership/write-target conflict blocks writing; other explicit deferrals
83
+ may be written concisely under **Open setup questions**.
84
+ 4. Activate only conditional modules supported by repository evidence: frontend/design/rendered QA;
85
+ package/release/docs; CI/deploy; auth/security/billing/external writes; database/migration/
86
+ concurrency; batch/monorepo; and native/desktop. Omit inactive modules from the output.
87
+ 5. Before the first question, say in a few plain lines what you found and what you are about to ask.
88
+ Ask the working agreement. Then ask only unresolved material fact questions, one at a time, with
89
+ a recommendation and consequence. Explicit deferral is an answer: record it under **Open setup
90
+ questions** without inventing a default. Do not ask feature-specific outcome, acceptance, or
91
+ UI-product questions.
92
+ 6. Write only durable behavior-changing defaults and relevant sections to the resolved existing
93
+ instruction surface. When none exists, write a new `policy.md`, plus a `CLAUDE.md` holding
94
+ `@policy.md` and an `AGENTS.md` that says to read it, so the hosts load it. Preserve unrelated
95
+ instructions, show the resulting diff, and do not request a second approval for this setup write.
96
+ 7. Write the Agent OS repository files the reference lists: `.agent-os/guards.json`,
97
+ `.agent-os/quality.json`, `REVIEW.md`, and, for GitHub Actions repositories, the `lint-intents` and `agent-review` workflows. Propose a
98
+ `CODEOWNERS` entry for intents and specs without writing it.
99
+ 8. Close with how you will work here, in at most six plain lines, and one recommended first action.
100
+
101
+ ### Return run
102
+
103
+ A return run adjusts a setup; it never repeats the interview.
104
+
105
+ 1. Inspect as in the first run, and resolve policy ownership the same way.
106
+ 2. Show a short plain-language summary of what is set today: working agreement, delivery,
107
+ verification, and planning. Under it, flag only what needs attention: drift where the policy
108
+ contradicts the repository, such as a command that no longer exists; any core field, working
109
+ agreement item, or active module the policy does not cover; and **Open setup questions**.
110
+ 3. Ask one question: what do you want to change? Offer working agreement, delivery, verification,
111
+ planning, and what the summary flagged, plus "nothing, this was a check".
112
+ 4. Ask only about the chosen areas, under the first run's question rules.
113
+ 5. Write only the chosen areas and show the diff; everything else stays byte for byte. Agent OS
114
+ repository files change only when a chosen area needs it. "Nothing" writes nothing and leaves any
115
+ flagged drift reported.
116
+ 6. Close with what changed, what stays flagged, and one recommended next action when one remains.
117
+
118
+ Block handling remains deterministic: add one missing block, update only well-formed managed content,
119
+ and stop on duplicate or malformed markers. Global mode touches no repository files; repo mode
120
+ touches one repository. The direct request or recorded delivery defaults govern merge and deploy
121
+ actions.
@@ -0,0 +1,88 @@
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 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.
7
+
8
+ ## Core policy
9
+
10
+ Priority order when instructions conflict:
11
+
12
+ 1. Direct user instruction in the current session.
13
+ 2. The repo's project policy and nearest `CLAUDE.md`/`AGENTS.md`.
14
+ 3. The active explicit workflow (an invoked agent-os skill).
15
+ 4. This global policy.
16
+
17
+ Rules:
18
+
19
+ - Authority follows the request: an inspection, planning, or review request is read-only apart from
20
+ the requested artifact; an implementation request authorizes repository changes inside its scope.
21
+ Merging, deploying, destructive cleanup, and effects on external systems or people require the
22
+ direct request or project policy to include them.
23
+ - Evidence before claims: verify before calling anything done, and show how it was verified.
24
+ - Keep scope and diffs narrow; when work drifts beyond the task, flag it instead of building on.
25
+ - Escalate only product decisions that cannot be resolved from context and would materially change
26
+ the outcome. Make reversible implementation choices and report them.
27
+ - Respond in the language used by the user. Code, commits, and technical artifacts are English unless the project says otherwise.
28
+ - Lead with the outcome: the first sentence answers "what happened" or "what did you find". Supporting detail comes after.
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.
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.
39
+ - Explanations belong in prose; tables only for short enumerable facts.
40
+ - Calibrate tone to the topic: playfulness is fine, neutral and factual the moment the subject is serious. When in doubt, it is serious.
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.
47
+ - Always recommend one concrete next action when planning or a delivery unit ends, with the reason
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.
51
+ - Scope has two independent axes: classify discoveries as required, adjacent, or unrelated to the
52
+ mission, then classify the work as covered by the existing mandate or requiring a new decision or
53
+ external action. Risk guides implementation and verification and can reveal a missing decision;
54
+ risk-area membership does not grant permission. Required covered work normally stays in scope,
55
+ while adjacent work is a follow-up and unrelated work gets no invented proposal.
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.
64
+
65
+ ## Preferences (seed defaults; project policy overrides)
66
+
67
+ - UI feedback under ~250 ms; feedback must not block the next interaction.
68
+ - Own design identity; do not imitate the look of well-known apps.
69
+ - Every repo keeps a living project policy (planning surface, design system location, verify
70
+ commands, conventions, gotchas, and delivery defaults). It grows over time; `init-agent-os`
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.
@@ -0,0 +1,39 @@
1
+ # Guards configuration
2
+
3
+ `.agent-os/guards.json` tells the agent-os-dev guard hooks what to protect. The hooks run
4
+ `quality-ratchet/scripts/guards.mjs`. It reads only this file, Git, and the intent files. It never
5
+ runs a command the repository declares, so it needs no trust step. Without the file, the hooks do
6
+ nothing.
7
+
8
+ ```json
9
+ {
10
+ "schema": 1,
11
+ "protectedPaths": ["migrations/**", ".github/workflows/**"],
12
+ "frozen": ["intents/*/intent.md", "intents/*/spec.md"],
13
+ "secretScan": true
14
+ }
15
+ ```
16
+
17
+ - `protectedPaths`: globs relative to the repository root. An agent edit to a matching path is
18
+ blocked with a message asking the agent to get the developer's explicit go-ahead. `*` matches within
19
+ one path segment and `**` across segments.
20
+ - `frozen`: globs for accepted intent and spec files. While a quality-ratchet delivery baseline is
21
+ active in the session, an edit to a matching file whose frontmatter `status` is `accepted` is
22
+ blocked, because delivery never changes the decisions it delivers. Planning sessions, which have no
23
+ delivery baseline, can still change them through a review.
24
+ - `secretScan`: when `true`, a `git commit` run by the agent is blocked if the staged diff adds a
25
+ line that looks like a private key, a cloud or provider access key, or an assignment of a long
26
+ literal to a name such as `password`, `secret`, `token`, or `api_key`. A false positive is resolved
27
+ by the developer, not by rewording the secret.
28
+
29
+ The guards cover the agent's file-edit tools (Edit, Write, MultiEdit, NotebookEdit, and Codex
30
+ `apply_patch`) and `git commit`. They do not inspect other shell commands, so a shell redirect into
31
+ a protected path is not caught; they reduce mistakes and are not a sandbox. Paths compare without
32
+ case on Windows and macOS. A malformed `guards.json` blocks every edit except the one that repairs it.
33
+
34
+ Locked tests are not configured here. `diagnose-before-fix` locks one with
35
+ `node <quality-ratchet>/scripts/guards.mjs lock-test <path>` after committing it and unlocks it with
36
+ `unlock-test <path>` once the fix passes. Locks live in the Git directory and are never committed.
37
+
38
+ The delivery ground truth belongs in `.agent-os/quality.json` as a `required` check, where the
39
+ quality-ratchet Stop hook enforces it after the developer has trusted the repository's controls.
@@ -1,8 +1,9 @@
1
1
  # Repository initialization contract
2
2
 
3
- Repository mode is a facts-first onboarding pass, not a fixed questionnaire. Inspect the
4
- repository and conversation, then use an internal transient ledger to make omissions visible while
5
- keeping the written policy small.
3
+ Repository mode inspects before it asks. Facts come from the repository and conversation, and an
4
+ internal transient ledger makes omissions visible while keeping the written policy small. The
5
+ working agreement in `SKILL.md` is the one fixed set of questions, because preferences cannot be
6
+ read from a repository.
6
7
 
7
8
  ## Inspect and choose ownership
8
9
 
@@ -15,8 +16,9 @@ Before writing, inventory every live host-consumed policy surface and give each
15
16
  and precedence. Shared identical content or a clear canonical cross-reference is sufficient; do not
16
17
  mandate duplication. Selecting one file while leaving conflicting applicable rules elsewhere is
17
18
  forbidden. If ownership or the write target cannot be resolved, ask one ownership question and block
18
- the write. A clean repository with no policy surface may receive a new `policy.md`; otherwise update
19
- the resolved canonical surface and preserve unrelated content.
19
+ the write. A clean repository with no policy surface receives a new `policy.md`, with a `CLAUDE.md`
20
+ holding `@policy.md` and an `AGENTS.md` that says to read it, because a host loads only its own file.
21
+ Otherwise update the resolved canonical surface and preserve unrelated content.
20
22
 
21
23
  ## Completeness ledger
22
24
 
@@ -43,9 +45,12 @@ is insufficient:
43
45
  whether external writes, publication, or other effects require a separate explicit request.
44
46
  3. **Verification:** exact useful commands and the ground truth they establish; record what must be
45
47
  inspected manually or otherwise checked when commands are insufficient.
46
- 4. **Planning:** the coherent planning surface, stable plan and decision-ticket identities, claims
47
- and handoff conventions, readiness states or labels, epic ownership, and dependency conventions
48
- for implementation work.
48
+ 4. **Planning:** where intents live (`intents/` in this repository by default, or a named product
49
+ repository), whether units live in `plan.md` (`source: files`) or a tracker (`source: issues`),
50
+ the branch naming convention, stable plan and decision-ticket identities, epic ownership, and
51
+ dependency conventions. When a tracker is used, write a `## Tracker mandate` section that names
52
+ what the agent may create, update, and comment on, and state that it never changes priority,
53
+ assignee, or acceptance, and never closes items.
49
54
  5. **Maintenance:** where durable lessons, recurring gotchas, and policy changes are recorded.
50
55
 
51
56
  ## Evidence-gated modules
@@ -53,7 +58,10 @@ is insufficient:
53
58
  Add a module only when inspection finds the corresponding concern. Resolve its material defaults and
54
59
  omit it entirely when inactive:
55
60
 
56
- - frontend/design/rendered QA;
61
+ - frontend/design/rendered QA, which records where the design system lives and a `## Design`
62
+ section for `design-work`: `Sketch with` (`html`, a component workshop and the command that starts
63
+ it, `image`, or anything else the project describes), `Sketches live` (a path and naming, or
64
+ `not in the repository`), and `Widths`;
57
65
  - package, release, or documentation publication;
58
66
  - CI or deployment;
59
67
  - authentication, security, billing, or external writes;
@@ -67,9 +75,32 @@ deferred answers are written only as concise `Open setup questions`; they do not
67
75
  defaults. They do not block the write unless the deferral leaves policy ownership or the write target
68
76
  unresolved.
69
77
 
78
+ ## Agent OS repository files
79
+
80
+ Besides the policy, repository mode writes these files when they are absent, from the templates in
81
+ this skill's `references/` and `templates/` directories, and shows each in the diff. An existing
82
+ file is updated only where it lacks a field the policy now depends on, and on a return run only when
83
+ an area the developer chose needs it.
84
+
85
+ - **`.agent-os/guards.json`** from [guards.md](guards.md): protected paths found by inspection
86
+ (migrations, CI workflows, generated or vendored code), the default frozen intent and spec globs,
87
+ and `secretScan: true`.
88
+ - **`.agent-os/quality.json`** with the verification field's main test command as a `required`
89
+ check, following quality-ratchet's project-controls reference. Tell the developer to run its
90
+ `trust` command once in a terminal; never run it yourself.
91
+ - **`REVIEW.md`** from [review-template.md](review-template.md), filled with the repository's real
92
+ focus areas and any severity rules already stated in its contributing guide.
93
+ - **`.github/workflows/lint-intents.yml`** and **`.github/workflows/agent-review.yml`** from
94
+ `templates/`, only when the repository uses GitHub Actions. The review workflow needs an API key
95
+ secret that a person must add; list it under `Open setup questions` until it exists.
96
+
97
+ Propose, but do not write, a `CODEOWNERS` entry that names who approves `intents/**/intent.md` and
98
+ `intents/**/spec.md`: it changes who must review other people's work, so it is the team's decision.
99
+
70
100
  ## Write contract
71
101
 
72
- Write only durable behavior-changing defaults and relevant active sections. Keep the policy sparse:
102
+ Write only durable behavior-changing defaults, a one-line-per-item `## Working agreement`, and
103
+ relevant active sections. Keep the policy sparse:
73
104
  do not add a schema, checklist, or interview transcript. Preserve existing unrelated instructions.
74
105
  The explicit `init-agent-os` invocation authorizes this setup write, so do not ask for a second
75
106
  approval. Show the resulting diff.
@@ -0,0 +1,35 @@
1
+ # REVIEW.md template
2
+
3
+ `check-work` reads `REVIEW.md` at the repository root in every mode, including `check-work ci` in
4
+ the `agent-review` workflow. Copy everything below the rule into `REVIEW.md` and replace the
5
+ placeholders with what is true for this repository. Delete a section that would only repeat a
6
+ default.
7
+
8
+ ---
9
+
10
+ ```markdown
11
+ # Review policy
12
+
13
+ Agent and human reviewers read this before reviewing a pull request.
14
+
15
+ ## Focus
16
+
17
+ <The areas where a mistake costs the most here, such as authorization checks, migrations, money,
18
+ or public API compatibility, each with one sentence on why.>
19
+
20
+ ## Severity
21
+
22
+ - **Blocking:** incorrect behavior, a missed acceptance example from the spec, a security or data
23
+ loss risk, a broken public contract, or an edit to an accepted intent or spec.
24
+ - **Should fix:** a defect with limited impact, a missing regression test for changed behavior, or
25
+ complexity the change does not need.
26
+ - **Minor:** naming, comments, or local readability. Report at most <three> minor findings per review.
27
+
28
+ ## Out of scope for review
29
+
30
+ <What reviewers should not comment on, such as formatting enforced by tooling or generated files.>
31
+
32
+ ## Approval
33
+
34
+ An agent review never replaces the human approval that branch protection requires.
35
+ ```