@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
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: check-work
3
+ description: Reviews a diff, commit, branch, pull request, or completed implementation for supported correctness, scope, risk, and unnecessary-complexity findings, and in explicit fix mode applies supported in-scope fixes with verification and targeted re-review. It skips merely running tests, checking status, initial design, and repository-wide audits.
4
+ ---
5
+
6
+ # Check work
7
+
8
+ Produce a decision-ready code review of the requested candidate. Review findings before proposing
9
+ or applying changes, keep the review independent, and never turn a review into an unrequested
10
+ merge, deploy, publication, approval, comment, or other external effect.
11
+
12
+ ## Select the mode
13
+
14
+ - A bare explicit `check-work` invocation asks, **before reading repository code or the diff**,
15
+ whether the developer wants findings reported only or wants authorized findings fixed. Do not
16
+ run tests or inspect the candidate before that answer.
17
+ - `check-work report` performs a read-only review without asking. It may run relevant checks, but
18
+ it does not edit files or external review state.
19
+ - `check-work fix` reviews first, then fixes only supported findings inside the requested scope,
20
+ runs relevant verification, and gets a targeted independent re-review of every changed area.
21
+ The explicit fix request is the authority; do not ask for a second approval.
22
+ - For an implicit request, infer the mode from authority: “review this” is report-only; “review
23
+ and fix this” is fix mode. Ask before inspection only when the requested authority is genuinely
24
+ ambiguous.
25
+
26
+ ## Review loop
27
+
28
+ 1. Establish the review target, candidate identity, requested scope, non-goals, and ground truth
29
+ from the request, repository policy, working-tree state, and relevant source and tests. A
30
+ missing target or material unresolved product choice is a blocker, not a reason to invent scope.
31
+ 2. Freeze the candidate to be reviewed. Launch a fresh-context, read-only reviewer through a real host reviewer launch tool, using the independent-review semantics in
32
+ [`deliver-work`](../deliver-work/workflow.md#review-gate). A wait tool alone is not a launch
33
+ mechanism. If no reviewer can be launched or the launched reviewer does not return a result,
34
+ report `BLOCKED`; never present self-review as independent review.
35
+ 3. Give the reviewer the outcome, boundaries, ground truth, candidate identity, and available
36
+ verification evidence. Synthesize only findings supported by the code, diff, tests, policy, or
37
+ returned review evidence. Omit speculative and cosmetic findings.
38
+ 4. Apply the relevant existing disciplines only when the question needs them: use
39
+ [`scope-guard`](../scope-guard/SKILL.md) for drift, [`simplifier-review`](../simplifier-review/SKILL.md)
40
+ for unnecessary complexity, [`proportional-testing`](../proportional-testing/SKILL.md) when
41
+ test adequacy is part of the finding, [`diagnose-before-fix`](../diagnose-before-fix/SKILL.md)
42
+ when a finding's cause is not established, and [`verify-before-done`](../verify-before-done/SKILL.md)
43
+ after fixes. These are lenses, not unconditional passes.
44
+ 5. In report mode, leave the candidate unchanged. In fix mode, apply only supported, in-scope
45
+ findings; preserve unrelated work and stop at the local authority boundary. Re-run the relevant
46
+ checks on the final candidate and launch a targeted fresh-context read-only re-review after any
47
+ fix. If that reviewer cannot launch or return, report `BLOCKED`.
48
+
49
+ ## Findings-first result
50
+
51
+ Start with actionable findings, each containing:
52
+
53
+ - **Priority and title**;
54
+ - **Exact location** (file and line, symbol, or other precise anchor);
55
+ - **Evidence and impact**;
56
+ - **Required change**.
57
+
58
+ Then report “No actionable findings” when none are supported. Fix mode additionally reports applied
59
+ fixes, fresh verification, and targeted re-review. State the candidate identity, reviewer identity
60
+ and role, and any material unverified claim. End the response with exactly one status line:
61
+ `APPROVED`, `CHANGES_REQUESTED`, or `BLOCKED`.
@@ -1,12 +1,12 @@
1
- ---
2
- name: deliver-work
3
- description: Delivers one decision-ready change against explicit boundaries and ground truth. User-invoked for implementation, including as a batch worker. Not for exploration or specification-only work.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Deliver work
8
-
9
- Read [workflow.md](workflow.md), then execute its contract. The invocation grants authority to change
10
- repository files inside the requested scope. It does not grant authority to choose unresolved product
11
- behavior or to merge, deploy, perform destructive cleanup, or affect external systems unless the
12
- request or project policy includes those actions.
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,109 +1,119 @@
1
- # Delivery contract
2
-
3
- ## Establish the contract
4
-
5
- Read the request, repository policy, relevant code, and working-tree state. Preserve existing work.
6
- Resolve discoverable facts yourself. Before editing, know:
7
-
8
- - **Outcome:** the observable change requested.
9
- - **Boundaries:** explicit non-goals and the smallest plausible change surface.
10
- - **Ground truth:** tests or observations that can prove the outcome.
11
- - **Delivery target:** local changes, commit, pull request, merge, or deployment as requested.
12
-
13
- An implementation request authorizes in-scope repository edits. Ask one focused question only when
14
- an unresolved product decision has materially different outcomes. Reversible implementation choices
15
- belong to the implementer.
16
-
17
- ## Confirm one delivery unit
18
-
19
- Before editing, verify that the target is one coherent implementation issue or an equivalently
20
- bounded direct request: one observable outcome, one reviewable change boundary, explicit ground
21
- truth, and satisfied dependencies. If the target contains several separately closable outcomes,
22
- different delivery targets, or unresolved product choices, stop before mutation and return it for
23
- shaping into implementation-ready issues. Do not choose `batch-work`; execution strategy belongs to
24
- the developer.
25
-
26
- ## Work loop
27
-
28
- 1. Inspect enough of the affected system to choose a coherent change.
29
- 2. Classify the review gate before editing. If review is required, confirm the current tool list
30
- contains a real reviewer launch tool before mutation. Re-evaluate the gate against the completed
31
- diff.
32
- 3. Make the smallest complete implementation. Use `diagnose-before-fix` when the cause is unknown and
33
- `scope-guard` when discoveries threaten the boundary.
34
- 4. Run fast, relevant checks while working and adapt from their results.
35
- 5. Review the resulting diff for correctness, unnecessary complexity, and scope.
36
- 6. Complete the review gate below.
37
- 7. Apply `verify-before-done` to the final candidate and deliver only to the requested boundary.
38
-
39
- Ground truth governs the loop; no prescribed implementation sequence substitutes for it.
40
-
41
- ## Review gate
42
-
43
- Independent review is required unless the final candidate is a small fix and all of these are true:
44
-
45
- - it corrects one localized defect with a supported cause and adds no capability;
46
- - it changes no public API, schema, protocol, or compatibility boundary;
47
- - it touches no security, authentication, authorization, credentials, secrets, tokens, billing,
48
- external writes, destructive data change, migration, or concurrency behavior;
49
- - direct regression evidence covers the changed behavior.
50
-
51
- A developer or project policy may require review for any change. Only an explicit instruction may
52
- waive required review; do not solicit a waiver. When review is required:
53
-
54
- 1. Before editing, verify that the current session exposes `spawn_agent` or an equivalent reviewer
55
- launch tool. A wait tool alone is not a launch mechanism. If no launch tool exists, stop before
56
- mutation with a review-required handoff.
57
- 2. Freeze the candidate. Identify it by commit when available, otherwise by the current diff and
58
- changed-file set.
59
- 3. Launch at least one read-only reviewer in a context that has not inherited the implementation
60
- conversation. On Codex, the next review tool action after freezing the candidate must be
61
- `spawn_agent`; copy its returned ID, then call `wait_agent` with that ID. If `spawn_agent` is not
62
- callable or returns no ID, stop without calling a wait tool. Never call a wait tool with empty
63
- receiver IDs or construct a `/root/...` reviewer label yourself. Use the host's equivalent launch
64
- receipt elsewhere. Give the reviewer the outcome, boundaries, ground truth, candidate diff, and
65
- verification evidence — not the implementer's reasoning.
66
- 4. Use one general adversarial reviewer by default. Add a focused security or compatibility reviewer
67
- only when a distinct risk needs that lens; do not create a panel by default.
68
- 5. Accept review only when that launched identity returns a result. Record the reviewer identity and
69
- role, candidate identity, reviewed scope, findings, and disposition. This is completion evidence,
70
- not an approval ledger.
71
- 6. Fix supported in-scope findings. If the candidate changes, run targeted re-review before final
72
- verification.
73
-
74
- A reviewer label written by the implementer, a wait call with no launched receiver, a self-review,
75
- or an unreturned reviewer is not independent review. If the host exposes no launch tool, launch
76
- fails, or no launched reviewer returns a result, stop before delivery with a review handoff
77
- containing the frozen candidate, review scope, and required ground truth. Self-review never
78
- substitutes for required independent review.
79
-
80
- ## Resume only when useful
81
-
82
- Ordinary work needs no workflow record. For work expected to span sessions, keep a compact
83
- `.agent-os/work/<slug>.md`:
84
-
85
- ```yaml
86
- ---
87
- agent_os_work: 2
88
- title: <work title>
89
- status: active
90
- next_action: <concrete continuation>
91
- ---
92
- ```
93
-
94
- Record only Outcome, Boundaries, Ground truth, Decisions, and Evidence. Use `blocked`, `verified`, or
95
- `delivered` when those words help the next session resume accurately. The record is working memory,
96
- not an approval ledger.
97
-
98
- ## Batch workers
99
-
100
- A batch task definition supplies the outcome, scope, dependencies, and checks. Work only in the
101
- assigned task workspace, commit there, and return the head SHA, changed files, checks, and remaining
102
- uncertainty to the coordinator. The coordinator owns integration, aggregate review, and aggregate
103
- verification.
104
-
105
- ## Stop conditions
106
-
107
- Stop with the exact decision or external action needed when the request does not cover it. Stop a
108
- completion claim when ground truth fails or cannot be exercised. Otherwise continue until the
109
- requested delivery target is reached.
1
+ # Delivery contract
2
+
3
+ ## Establish the contract
4
+
5
+ Read the request, repository policy, relevant code, and working-tree state. Preserve existing work.
6
+ Resolve discoverable facts yourself. Before editing, know:
7
+
8
+ - **Outcome:** the observable change requested.
9
+ - **Boundaries:** explicit non-goals and the smallest plausible change surface.
10
+ - **Ground truth:** tests or observations that can prove the outcome.
11
+ - **Delivery target:** local changes, commit, pull request, merge, or deployment as requested.
12
+
13
+ An implementation request authorizes in-scope repository edits. Ask one focused question only when
14
+ an unresolved product decision has materially different outcomes. Reversible implementation choices
15
+ belong to the implementer.
16
+
17
+ ## Confirm one delivery unit
18
+
19
+ Before editing, verify that the target is one coherent implementation issue or an equivalently
20
+ bounded direct request: one observable outcome, one reviewable change boundary, explicit ground
21
+ truth, and satisfied dependencies. If the target contains several separately closable outcomes,
22
+ different delivery targets, or unresolved product choices, stop before mutation and return it for
23
+ shaping into implementation-ready issues. Do not choose `batch-work`; execution strategy belongs to
24
+ the developer.
25
+
26
+ ## Work loop
27
+
28
+ 1. Inspect enough of the affected system to choose a coherent change.
29
+ 2. If available, run [`quality-ratchet`](../quality-ratchet/SKILL.md)'s `begin` before the first
30
+ mutation. It captures the exact worktree entry state without stashing or editing user files; an
31
+ unavailable capability is reported rather than turned into a substitute gate.
32
+ 3. Classify the review gate before editing. If review is required, confirm the current tool list
33
+ contains a real reviewer launch tool before mutation. Re-evaluate the gate against the completed
34
+ diff.
35
+ 4. Make the smallest complete implementation. Allow only the quality-ratchet's bounded,
36
+ behavior-preserving improvement on the touched surface. Use `diagnose-before-fix` when the
37
+ cause is unknown and `scope-guard` when discoveries threaten the boundary.
38
+ 5. Apply [`proportional-testing`](../proportional-testing/SKILL.md) when selecting or creating tests.
39
+ Run fast, relevant checks while working and adapt from their results.
40
+ 6. Before [`simplifier-review`](../simplifier-review/SKILL.md), run quality-ratchet's `check` when
41
+ its baseline is active and pass the evidence to the semantic review. Treat file, NLOC, legacy,
42
+ dependency, and analyzer values as signals, never as an aggregate score or threshold gate.
43
+ 7. Review the resulting diff for correctness, unnecessary complexity, and scope. Apply the
44
+ simplifier-review lens and fix supported simplification findings before freezing the candidate.
45
+ 8. Complete the review gate below.
46
+ 9. Apply `verify-before-done` to the final candidate and deliver only to the requested boundary.
47
+
48
+ Ground truth governs the loop; no prescribed implementation sequence substitutes for it.
49
+
50
+ ## Review gate
51
+
52
+ Independent review is required unless the final candidate is a small fix and all of these are true:
53
+
54
+ - it corrects one localized defect with a supported cause and adds no capability;
55
+ - it changes no public API, schema, protocol, or compatibility boundary;
56
+ - it touches no security, authentication, authorization, credentials, secrets, tokens, billing,
57
+ external writes, destructive data change, migration, or concurrency behavior;
58
+ - direct regression evidence covers the changed behavior.
59
+
60
+ A developer or project policy may require review for any change. Only an explicit instruction may
61
+ waive required review; do not solicit a waiver. When review is required:
62
+
63
+ 1. Before editing, verify that the current session exposes `spawn_agent` or an equivalent reviewer
64
+ launch tool. A wait tool alone is not a launch mechanism. If no launch tool exists, stop before
65
+ mutation with a review-required handoff.
66
+ 2. Freeze the candidate. Identify it by commit when available, otherwise by the current diff and
67
+ changed-file set.
68
+ 3. Launch at least one read-only reviewer in a context that has not inherited the implementation
69
+ conversation. On Codex, the next review tool action after freezing the candidate must be
70
+ `spawn_agent`; copy its returned ID, then call `wait_agent` with that ID. If `spawn_agent` is not
71
+ callable or returns no ID, stop without calling a wait tool. Never call a wait tool with empty
72
+ receiver IDs or construct a `/root/...` reviewer label yourself. Use the host's equivalent launch
73
+ receipt elsewhere. Give the reviewer the outcome, boundaries, ground truth, candidate diff, and
74
+ verification evidence — not the implementer's reasoning.
75
+ 4. Use one general adversarial reviewer by default. Add a focused security or compatibility reviewer
76
+ only when a distinct risk needs that lens; do not create a panel by default.
77
+ 5. Accept review only when that launched identity returns a result. Record the reviewer identity and
78
+ role, candidate identity, reviewed scope, findings, and disposition. This is completion evidence,
79
+ not an approval ledger.
80
+ 6. Fix supported in-scope findings. If the candidate changes, run targeted re-review before final
81
+ verification.
82
+
83
+ A reviewer label written by the implementer, a wait call with no launched receiver, a self-review,
84
+ or an unreturned reviewer is not independent review. If the host exposes no launch tool, launch
85
+ fails, or no launched reviewer returns a result, stop before delivery with a review handoff
86
+ containing the frozen candidate, review scope including unnecessary solution complexity, and
87
+ required ground truth. Self-review never
88
+ substitutes for required independent review.
89
+
90
+ ## Resume only when useful
91
+
92
+ Ordinary work needs no workflow record. For work expected to span sessions, keep a compact
93
+ `.agent-os/work/<slug>.md`:
94
+
95
+ ```yaml
96
+ ---
97
+ agent_os_work: 2
98
+ title: <work title>
99
+ status: active
100
+ next_action: <concrete continuation>
101
+ ---
102
+ ```
103
+
104
+ Record only Outcome, Boundaries, Ground truth, Decisions, and Evidence. Use `blocked`, `verified`, or
105
+ `delivered` when those words help the next session resume accurately. The record is working memory,
106
+ not an approval ledger.
107
+
108
+ ## Batch workers
109
+
110
+ A batch task definition supplies the outcome, scope, dependencies, and checks. Work only in the
111
+ assigned task workspace, commit there, and return the head SHA, changed files, checks, and remaining
112
+ uncertainty to the coordinator. The coordinator owns integration, aggregate review, and aggregate
113
+ verification.
114
+
115
+ ## Stop conditions
116
+
117
+ Stop with the exact decision or external action needed when the request does not cover it. Stop a
118
+ completion claim when ground truth fails or cannot be exercised. Otherwise continue until the
119
+ requested delivery target is reached.
@@ -1,24 +1,24 @@
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
+ ---
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 +1,28 @@
1
- ---
2
- name: dispatch-next
3
- description: Reads live project state and selects one decision-ready next action. User-invoked for queue triage or dispatch. Not for an already selected task.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # dispatch-next
8
-
9
- Choose one next action from live state. The wording of the request decides whether to report the
10
- choice or dispatch it.
11
-
12
- ## Loop
13
-
14
- Read project policy, queue conventions, issues, pull requests, and CI. Prioritize work already in
15
- flight when it has an actionable review or failure. Select one target using the repository's
16
- priority rules and explain why it wins.
17
-
18
- Route broad decision work to `chart-work`, a bounded open decision to `shape-work`, and one selected
19
- implementation-ready issue to `deliver-work`. Route to `batch-work` only when the developer
20
- explicitly asks to execute an existing ready issue graph as an integrated batch; issue count alone
21
- does not choose the workflow.
22
-
23
- “What should I do next?” is a read-only selection request. “Dispatch the next task” authorizes the
24
- project-state changes and one launch needed to dispatch the selected target. Do not infer merge,
25
- closure, or unrelated tracker authority from dispatch.
26
-
27
- If nothing is decision-ready, report the closest blocker. One invocation selects at most one target;
28
- the worker or coordinator does the work.
1
+ ---
2
+ name: dispatch-next
3
+ description: Reads live project state and selects one decision-ready next action. User-invoked for queue triage or dispatch. Not for an already selected task.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # dispatch-next
8
+
9
+ Choose one next action from live state. The wording of the request decides whether to report the
10
+ choice or dispatch it.
11
+
12
+ ## Loop
13
+
14
+ Read project policy, queue conventions, issues, pull requests, and CI. Prioritize work already in
15
+ flight when it has an actionable review or failure. Select one target using the repository's
16
+ priority rules and explain why it wins.
17
+
18
+ Route broad decision work to `chart-work`, a bounded open decision to `shape-work`, and one selected
19
+ implementation-ready issue to `deliver-work`. Route to `batch-work` only when the developer
20
+ explicitly asks to execute an existing ready issue graph as an integrated batch; issue count alone
21
+ does not choose the workflow.
22
+
23
+ “What should I do next?” is a read-only selection request. “Dispatch the next task” authorizes the
24
+ project-state changes and one launch needed to dispatch the selected target. Do not infer merge,
25
+ closure, or unrelated tracker authority from dispatch.
26
+
27
+ If nothing is decision-ready, report the closest blocker. One invocation selects at most one target;
28
+ the worker or coordinator does the work.
@@ -1,39 +1,54 @@
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`.
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
17
  3. Run `scripts/policy-block.ps1` to apply the managed blocks and show the resulting diff. This
18
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.
23
-
24
- 1. Read the repo first: existing `CLAUDE.md`/`AGENTS.md`, README, package/build files, CI config. Do not ask about anything the repo already answers.
25
- 2. Ask only about material facts the repository does not answer, with a recommendation:
26
- - **Delivery defaults** — branch, PR, merge, and deploy conventions.
27
- - **Verify commands** — the exact commands that prove the project works (test, build, lint, run).
28
- - **Design system** — where tokens and components live.
29
- - **Planning surface** — tracker or local folders, decision-ticket conventions, and
30
- implementation-issue readiness states or labels.
31
- - **Batch execution** — concurrency, worktree naming, retries, and integration strategy.
32
- - **Conventions and gotchas** worth recording now.
33
- 3. Write the smallest useful policy section to the repo's existing instruction file, or a new
34
- `policy.md` when none exists, and show the resulting diff.
35
-
36
- Block handling remains deterministic: add one missing block, update only well-formed managed content,
37
- and stop on duplicate or malformed markers. Global mode touches no repository files; repo mode
38
- touches one repository. The direct request or recorded delivery defaults govern merge and deploy
39
- actions.
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; planning
38
+ identities, readiness, and dependencies; and maintenance of durable lessons and gotchas. Only
39
+ an unresolved policy ownership/write-target conflict blocks writing; other explicit deferrals
40
+ may be written concisely under **Open setup questions**.
41
+ 4. Activate only conditional modules supported by repository evidence: frontend/design/rendered QA;
42
+ package/release/docs; CI/deploy; auth/security/billing/external writes; database/migration/
43
+ concurrency; batch/monorepo; and native/desktop. Omit inactive modules from the output.
44
+ 5. Ask only unresolved material questions, one at a time, with a recommendation and consequence.
45
+ Explicit deferral is an answer: record it under **Open setup questions** without inventing a
46
+ default. Do not ask feature-specific outcome, acceptance, or UI-product questions.
47
+ 6. Write only durable behavior-changing defaults and relevant sections to the resolved existing
48
+ instruction surface, or a new `policy.md` when none exists. Preserve unrelated instructions,
49
+ show the resulting diff, and do not request a second approval for this setup write.
50
+
51
+ Block handling remains deterministic: add one missing block, update only well-formed managed content,
52
+ and stop on duplicate or malformed markers. Global mode touches no repository files; repo mode
53
+ touches one repository. The direct request or recorded delivery defaults govern merge and deploy
54
+ actions.
@@ -0,0 +1,74 @@
1
+ # Repository initialization contract
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.
6
+
7
+ ## Inspect and choose ownership
8
+
9
+ Read broadly enough to find the current source of truth: every applicable `AGENTS.md`, `CLAUDE.md`,
10
+ and `policy.md` in scope; README and project docs; package/build/test configuration; CI and release
11
+ configuration; and evidence of frontend, deployment, security, data, batch, or native work. Do not
12
+ ask for a fact already established by those sources or by the current conversation.
13
+
14
+ Before writing, inventory every live host-consumed policy surface and give each unambiguous ownership
15
+ and precedence. Shared identical content or a clear canonical cross-reference is sufficient; do not
16
+ mandate duplication. Selecting one file while leaving conflicting applicable rules elsewhere is
17
+ 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.
20
+
21
+ ## Completeness ledger
22
+
23
+ The ledger is internal and transient. For every material field, record one terminal state:
24
+
25
+ - **evidenced/confirmed** — supported by repository evidence or the user's answer;
26
+ - **N/A** — repository evidence makes the field inapplicable;
27
+ - **deferred/open** — the user explicitly defers it, to be listed under `Open setup questions`;
28
+ - **conflicting** — sources or answers disagree and must be resolved before a default is chosen.
29
+
30
+ Never treat silence as confirmation. Do not write `N/A`, interview history, or the full ledger to the
31
+ policy. Before writing, each core field must reach one of the four terminal states above. Only an
32
+ unresolved policy ownership/write-target conflict blocks writing; other explicitly deferred fields
33
+ may be written concisely under `Open setup questions`. A conflict is not permission to guess through
34
+ the conflict; keep an unresolved conflict visible under `Open setup questions` until it is resolved.
35
+
36
+ ## Required core
37
+
38
+ Bring each of these fields to one allowed terminal state before the write, asking only where evidence
39
+ is insufficient:
40
+
41
+ 1. **Ownership:** the canonical instruction surface and how overlapping policy files are governed.
42
+ 2. **Delivery boundary:** the default stopping point, branch/PR/merge/deploy expectations, and
43
+ whether external writes, publication, or other effects require a separate explicit request.
44
+ 3. **Verification:** exact useful commands and the ground truth they establish; record what must be
45
+ inspected manually or otherwise checked when commands are insufficient.
46
+ 4. **Planning:** the planning surface, stable identities, readiness states or labels, and dependency
47
+ conventions for implementation work.
48
+ 5. **Maintenance:** where durable lessons, recurring gotchas, and policy changes are recorded.
49
+
50
+ ## Evidence-gated modules
51
+
52
+ Add a module only when inspection finds the corresponding concern. Resolve its material defaults and
53
+ omit it entirely when inactive:
54
+
55
+ - frontend/design/rendered QA;
56
+ - package, release, or documentation publication;
57
+ - CI or deployment;
58
+ - authentication, security, billing, or external writes;
59
+ - database, migrations, or concurrency;
60
+ - batch execution or a monorepo;
61
+ - native or desktop tooling.
62
+
63
+ When a module is active but a decision is not yet safe to infer, ask one question at a time. Each
64
+ question includes the recommended option and the consequence of choosing differently. Explicitly
65
+ deferred answers are written only as concise `Open setup questions`; they do not become guessed
66
+ defaults. They do not block the write unless the deferral leaves policy ownership or the write target
67
+ unresolved.
68
+
69
+ ## Write contract
70
+
71
+ Write only durable behavior-changing defaults and relevant active sections. Keep the policy sparse:
72
+ do not add a schema, checklist, or interview transcript. Preserve existing unrelated instructions.
73
+ The explicit `init-agent-os` invocation authorizes this setup write, so do not ask for a second
74
+ approval. Show the resulting diff.