@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
@@ -1,6 +1,6 @@
1
1
  ---
2
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.
3
+ description: Code review of changes, a diff, a commit, a branch, or a pull request, in a session or headless in CI. Reviews them for bugs, scope, risk, and needless complexity against the spec and the repository's REVIEW.md, reports findings first, and fixes only when the user asks for fixes. Use when the user says things like review my changes, take a look before I push, sanity-check the last commit, review this PR, or review and fix what is broken. Not for only running tests, checking git status, designing a feature before code exists, or auditing the whole repository.
4
4
  ---
5
5
 
6
6
  # Check work
@@ -19,34 +19,50 @@ merge, deploy, publication, approval, comment, or other external effect.
19
19
  - `check-work fix` reviews first, then fixes only supported findings inside the requested scope,
20
20
  runs relevant verification, and gets a targeted independent re-review of every changed area.
21
21
  The explicit fix request is the authority; do not ask for a second approval.
22
+ - `check-work ci` is report mode for a non-interactive run on a pull request, such as the
23
+ `agent-review` workflow. It never asks, never edits, and writes the findings as its final output
24
+ for the workflow to post.
22
25
  - For an implicit request, infer the mode from authority: “review this” is report-only; “review
23
26
  and fix this” is fix mode. Ask before inspection only when the requested authority is genuinely
24
27
  ambiguous.
25
28
 
29
+ ## Review policy and contract
30
+
31
+ Read `REVIEW.md` at the repository root when it exists. It is the repository's review policy: focus
32
+ areas, severity tiers, what counts as a blocking finding, and limits such as a cap on minor
33
+ findings. It narrows and ranks findings; it never turns a speculative concern into a supported one.
34
+
35
+ When the candidate carries `Intent-Unit: <intent-id>/<unit-key>`, read that unit in
36
+ `intents/<intent-id>/plan.md` and the spec beside it. The spec's behavior, boundaries, and ground
37
+ truth are the review contract: report a candidate that misses an acceptance example, crosses a
38
+ non-goal, or edits an accepted intent or spec.
39
+
26
40
  ## Review loop
27
41
 
28
42
  1. Establish the review target, candidate identity, requested scope, non-goals, and ground truth
29
43
  from the request, repository policy, working-tree state, and relevant source and tests. A
30
44
  missing target or material unresolved product choice is a blocker, not a reason to invent scope.
31
45
  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
46
+ [`deliver-work`](../deliver-work/SKILL.md#review-gate). A wait tool alone is not a launch
33
47
  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.
48
+ report `BLOCKED`; never present self-review as independent review. In `ci` mode the run itself is
49
+ the independent reviewer: it started in a fresh context with no part in the implementation, so
50
+ review directly without launching another.
35
51
  3. Give the reviewer the outcome, boundaries, ground truth, candidate identity, and available
36
52
  verification evidence. Synthesize only findings supported by the code, diff, tests, policy, or
37
53
  returned review evidence. Omit speculative and cosmetic findings.
38
54
  Apply [references/findings.md](references/findings.md) when reporting and resolving findings;
39
55
  include that contract in the independent review brief.
40
- 4. Apply the relevant existing disciplines only when the question needs them: use
41
- [`scope-guard`](../scope-guard/SKILL.md) for drift, [`simplifier-review`](../simplifier-review/SKILL.md)
42
- for unnecessary complexity, [`proportional-testing`](../proportional-testing/SKILL.md) when
43
- test adequacy is part of the finding, [`diagnose-before-fix`](../diagnose-before-fix/SKILL.md)
44
- when a finding's cause is not established, and [`verify-before-done`](../verify-before-done/SKILL.md)
45
- after fixes. These are lenses, not unconditional passes.
46
- 5. In report mode, leave the candidate unchanged. In fix mode, apply only supported, in-scope
47
- findings; preserve unrelated work and stop at the local authority boundary. Re-run the relevant
48
- checks on the final candidate and launch a targeted fresh-context read-only re-review after any
49
- fix. If that reviewer cannot launch or return, report `BLOCKED`.
56
+ 4. Apply the relevant existing disciplines only when the question needs them: use the `scope-guard`
57
+ skill for drift, [`simplify`](../simplify/SKILL.md) review mode for unnecessary complexity,
58
+ [`proportional-testing`](../proportional-testing/SKILL.md) when test adequacy is part of the
59
+ finding, [`diagnose-before-fix`](../diagnose-before-fix/SKILL.md) when a finding's cause is not
60
+ established, and the `verify-before-done` skill after fixes. These are lenses, not unconditional
61
+ passes.
62
+ 5. In report and ci modes, leave the candidate unchanged. In fix mode, apply only supported,
63
+ in-scope findings; preserve unrelated work and stop at the local authority boundary. Re-run the
64
+ relevant checks on the final candidate and launch a targeted fresh-context read-only re-review
65
+ after any fix. If that reviewer cannot launch or return, report `BLOCKED`.
50
66
 
51
67
  ## Findings-first result
52
68
 
@@ -60,4 +76,5 @@ Start with actionable findings, each containing:
60
76
  Then report “No actionable findings” when none are supported. Fix mode additionally reports applied
61
77
  fixes, fresh verification, and targeted re-review. State the candidate identity, reviewer identity
62
78
  and role, and any material unverified claim. End the response with exactly one status line:
63
- `APPROVED`, `CHANGES_REQUESTED`, or `BLOCKED`.
79
+ `APPROVED`, `CHANGES_REQUESTED`, or `BLOCKED`. In `ci` mode, `APPROVED` means no blocking finding;
80
+ it never replaces the human approval that branch protection requires.
@@ -1,9 +1,29 @@
1
- # Delivery contract
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
+ The invocation grants authority to change repository files inside the requested scope. It does not
10
+ grant authority to choose unresolved product behavior or to merge, deploy, perform destructive
11
+ cleanup, or affect external systems unless the request or project policy includes those actions.
12
+ This file is the complete delivery contract; it stays in context after compaction.
13
+
14
+ ## Stop conditions
15
+
16
+ Stop with the exact decision or external action needed when the request does not cover it. Stop a
17
+ completion claim when ground truth fails or cannot be exercised. Otherwise continue until the
18
+ requested delivery target is reached.
2
19
 
3
20
  ## Establish the contract
4
21
 
5
22
  Read the request, repository policy, relevant code, and working-tree state. Preserve existing work.
6
- Resolve discoverable facts yourself. Before editing, know:
23
+ Resolve discoverable facts yourself. When the unit comes from `intents/<id>/plan.md`, or from a
24
+ tracker issue whose `Origin` names an intent, read its plan entry or issue, spec, and intent: the
25
+ unit's contract, the spec's boundaries, its `## Interface` entries with their sketches, and its
26
+ ground truth are the contract below. Before editing, know:
7
27
 
8
28
  - **Outcome:** the observable change requested.
9
29
  - **Boundaries:** explicit non-goals and the smallest plausible change surface.
@@ -14,6 +34,17 @@ An implementation request authorizes in-scope repository edits. Ask one focused
14
34
  an unresolved product decision has materially different outcomes. Reversible implementation choices
15
35
  belong to the implementer.
16
36
 
37
+ A stale source is an unresolved product decision. When the spec's `built_on` revision is older than
38
+ its intent, or the plan's is older than its spec, stop before mutation and return the unit to
39
+ `plan-work` or `shape-work` with the revisions that differ. A unit that contradicts the spec it
40
+ cites goes back the same way, because the spec wins. Delivery never edits an accepted intent,
41
+ spec, or plan entry; a needed change goes back through those workflows.
42
+
43
+ An open or deferred interface surface is also an unresolved product decision. When the unit builds
44
+ a screen whose `## Interface` entry is not decided, stop before mutating that screen and return it
45
+ to `design-work`. Build decided screens to match their sketch, using production components rather
46
+ than the sketch's code.
47
+
17
48
  ## Confirm one delivery unit
18
49
 
19
50
  Before editing each unit, verify that it is one coherent implementation issue or an equivalently
@@ -23,7 +54,8 @@ different delivery targets, or unresolved product choices, stop before mutation
23
54
  shaping into implementation-ready issues. Do not choose `batch-work`; execution strategy belongs to
24
55
  the developer.
25
56
 
26
- When the request explicitly covers a bounded set of already shaped issues, deliver one ready unit
57
+ Skip a unit that already has an open pull request carrying its `Intent-Unit` line: someone else has
58
+ claimed it. When the request explicitly covers a bounded set of already shaped issues, deliver one ready unit
27
59
  at a time and continue sequentially within that authority. Re-read dependencies and project state
28
60
  after each unit; stop for a material unresolved decision or an exhausted ready frontier. This repeats
29
61
  the active delivery contract, not `dispatch-next` or an implicit batch. An undecomposed epic still
@@ -40,7 +72,7 @@ the parent or grants authority over its siblings.
40
72
 
41
73
  1. Inspect enough of the affected system to choose a coherent change. Apply quality-ratchet's
42
74
  reuse and responsibility guidance before writing. If a solution-changing uncertainty remains,
43
- use the [experiment decision](../plan-work/references/prototypes.md); clear tasks need no prototype.
75
+ use the [experiment decision](../shape-work/references/prototypes.md); clear tasks need no prototype.
44
76
  2. If available, run [`quality-ratchet`](../quality-ratchet/SKILL.md)'s `begin` before the first
45
77
  mutation. It captures the exact worktree entry state without stashing or editing user files; an
46
78
  unavailable capability is reported rather than turned into a substitute gate.
@@ -52,43 +84,24 @@ the parent or grants authority over its siblings.
52
84
  cause is unknown and `scope-guard` when discoveries threaten the boundary.
53
85
  5. Apply [`proportional-testing`](../proportional-testing/SKILL.md) when selecting or creating tests.
54
86
  Run fast, relevant checks while working and adapt from their results.
55
- 6. Before [`simplifier-review`](../simplifier-review/SKILL.md), run quality-ratchet's `check` when
87
+ 6. Before [`simplify`](../simplify/SKILL.md)'s review mode, run quality-ratchet's `check` when
56
88
  its baseline is active and pass the evidence to the semantic review. Treat file, NLOC, legacy,
57
89
  dependency, and analyzer values as signals, never as an aggregate score or threshold gate.
58
90
  7. Review the resulting diff for correctness, unnecessary complexity, and scope. Apply the
59
- simplifier-review lens and resolve findings using the
91
+ `simplify` review lens and resolve findings using the
60
92
  [finding contract](../check-work/references/findings.md) before freezing the candidate.
61
93
  8. Complete the review gate below.
62
- 9. Apply `verify-before-done` to the final candidate and deliver only to the requested boundary.
94
+ 9. Apply `verify-before-done` to the final candidate, run quality-ratchet's `finish` when its
95
+ baseline is active, and deliver only to the requested boundary.
63
96
 
64
- Ground truth governs the loop; no prescribed implementation sequence substitutes for it.
65
-
66
- ## Handle discoveries without fragmenting the mission
97
+ When the delivery target includes a pull request, claim the unit early: work on a branch named by
98
+ the project policy, or `<intent-id>-<unit-key>` by default, and open a draft pull request with the
99
+ first commit. Its body carries `Intent-Unit: <intent-id>/<unit-key>`, the outcome, the ground truth,
100
+ and, as delivery proceeds, the evidence and review record. Mark it ready for review only after the
101
+ final verification. In the pull request that delivers the last open unit of a plan, also set the
102
+ intent's and plan's `status: done`. Never write delivery progress into `plan.md`.
67
103
 
68
- During delivery, update the current work when the discovery is necessary and within the existing
69
- contract:
70
-
71
- - a necessary technical detail is solved and delivery continues;
72
- - a missed technical prerequisite is added to the work plan and delivery continues within mandate;
73
- - an incorrect order is corrected when acceptance, ownership, and delivery boundaries remain the
74
- same;
75
- - a unit is split, combined, or has responsibility moved only through targeted `shape-work`;
76
- - a product contract or explicit boundary is changed only by reopening that decision through
77
- `plan-work`;
78
- - an adjacent improvement stays out without separate authority.
79
-
80
- Diagnose technical blockers before forwarding them. Do not create a blocking side issue merely
81
- because a necessary detail was discovered late. Continue independent authorized work during a
82
- partial block. A context or session limit calls for a compact continuation record, not a new
83
- product issue. Changing workflow names is not itself a new approval step.
84
-
85
- No workflow grants tracker write access automatically. Tracker maintenance is allowed only when the
86
- request or project policy grants it, and then only for implementation detail and technical
87
- ordering/readiness inside the authorized set. It does not include changing acceptance, owners,
88
- delivery scope, adding unrequested work, or closing an issue. A ready issue is not authorization.
89
- Without tracker mandate, keep corrections local and report the delta. If it must survive a session,
90
- use the work record's existing sections and add `Pending tracker updates` only when needed; record
91
- the unsynced delta, never a copied plan.
104
+ Ground truth governs the loop; no prescribed implementation sequence substitutes for it.
92
105
 
93
106
  ## Review gate
94
107
 
@@ -116,7 +129,7 @@ waive required review; do not solicit a waiver. When review is required:
116
129
  callable or returns no ID, stop without calling a wait tool. Never call a wait tool with empty
117
130
  receiver IDs or construct a `/root/...` reviewer label yourself. Use the host's equivalent launch
118
131
  receipt elsewhere. Give the reviewer the outcome, boundaries, ground truth, candidate diff, and
119
- verification evidence — not the implementer's reasoning.
132
+ verification evidence, not the implementer's reasoning.
120
133
  4. Use one general evidence-based reviewer by default, briefed with the finding contract above.
121
134
  Add a focused security or compatibility reviewer
122
135
  only when a distinct risk needs that lens; do not create a panel by default.
@@ -135,9 +148,37 @@ containing the frozen candidate, review scope including unnecessary solution com
135
148
  required ground truth. Self-review never
136
149
  substitutes for required independent review.
137
150
 
151
+ ## Handle discoveries without fragmenting the mission
152
+
153
+ During delivery, update the current work when the discovery is necessary and within the existing
154
+ contract:
155
+
156
+ - a necessary technical detail is solved and delivery continues;
157
+ - a missed technical prerequisite is added to the work plan and delivery continues within mandate;
158
+ - an incorrect order is corrected when acceptance, ownership, and delivery boundaries remain the
159
+ same;
160
+ - a unit is split, combined, or has responsibility moved only through targeted `shape-work`;
161
+ - a product contract or explicit boundary is changed only by reopening that decision through
162
+ `plan-work`;
163
+ - an adjacent improvement stays out without separate authority.
164
+
165
+ Diagnose technical blockers before forwarding them. Do not create a blocking side issue merely
166
+ because a necessary detail was discovered late. Continue independent authorized work during a
167
+ partial block. A context or session limit calls for a compact continuation record, not a new
168
+ product issue. Changing workflow names is not itself a new approval step.
169
+
170
+ No workflow grants tracker write access automatically. Tracker maintenance is allowed only when the
171
+ request or project policy grants it, and then only for implementation detail and technical
172
+ ordering/readiness inside the authorized set. It does not include changing acceptance, owners,
173
+ delivery scope, adding unrequested work, or closing an issue. A ready issue is not authorization.
174
+ Without tracker mandate, keep corrections local and report the delta. If it must survive a session,
175
+ use the work record's existing sections and add `Pending tracker updates` only when needed; record
176
+ the unsynced delta, never a copied plan.
177
+
138
178
  ## Resume only when useful
139
179
 
140
- Ordinary work needs no workflow record. For work expected to span sessions, keep a compact
180
+ Ordinary work needs no workflow record, and a draft pull request is the record for claimed units.
181
+ For work expected to span sessions without a pull request, keep a compact
141
182
  `.agent-os/work/<slug>.md`:
142
183
 
143
184
  ```yaml
@@ -160,9 +201,3 @@ A batch task definition supplies the outcome, scope, dependencies, and checks. W
160
201
  assigned task workspace, commit there, and return the head SHA, changed files, checks, and remaining
161
202
  uncertainty to the coordinator. The coordinator owns integration, aggregate review, and aggregate
162
203
  verification.
163
-
164
- ## Stop conditions
165
-
166
- Stop with the exact decision or external action needed when the request does not cover it. Stop a
167
- completion claim when ground truth fails or cannot be exercised. Otherwise continue until the
168
- requested delivery target is reached.
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: design-work
3
+ description: Sketches the user-facing interface of planned work in the medium the project has chosen, such as standalone HTML, a component workshop, or images, inside the real layout with the project's own look, and records the decisions in the spec's Interface section. User-invoked, or continued into from plan-work when a spec changes what a person sees or does. Not for production UI implementation, polish of shipped screens, or work with no user-facing change.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Design work
8
+
9
+ Settle what people will see and do before delivery starts. The result is a set of sketches in the
10
+ medium the project chose, and a spec whose `## Interface` section says, for every new or changed
11
+ screen and state, what was decided and why. A product owner or account manager should be able to
12
+ judge the sketches without a design tool or a checkout; when the person deciding has no checkout,
13
+ give them images.
14
+
15
+ ## Inputs
16
+
17
+ Read the project policy, the intent and spec when they exist, and the request. The policy's
18
+ `## Design` section names how sketches are made (`Sketch with`), where they live (`Sketches live`),
19
+ and the widths that matter. Then inspect the tokens, the shared components, and the nearest existing
20
+ views. Resolve these facts yourself; ask the person only about what the product should be.
21
+
22
+ ## Medium
23
+
24
+ `Sketch with` is the project's choice, and this skill is not tied to any tool:
25
+
26
+ - `html`: standalone files that need no install and no project dependency, styled from the project's
27
+ real tokens and layout.
28
+ - A component workshop such as Storybook, named with the command that starts it: stories built from
29
+ the project's own components.
30
+ - `image`: pictures only, for a project with nothing to sketch in.
31
+ - Anything else the policy describes, followed as described.
32
+
33
+ When the policy sets no medium, ask once: recommend the workshop when the repository has one, and
34
+ `html` otherwise. Ask where sketches live in the same question, recommending
35
+ `intents/<id>/sketches/`. Offer to save the answer as a `## Design` section in the file that holds
36
+ the project policy, and write it only on a yes; with no such file, `init-agent-os` records it. Do not add Storybook or another dependency on your own. When the named tool is unavailable, or a
37
+ workshop's configuration does not pick up the sketch location, tell the person what is missing and
38
+ offer `html` for this run instead of changing the configuration.
39
+
40
+ `Sketches live` is a path in the repository, or `not in the repository`. Images are always available
41
+ as the way a sketch reaches people when its files cannot be committed: keep the working files
42
+ outside the checkout, render the sketch to PNG, and put the images on the pull request or at the
43
+ place the policy or the person names. With neither, ask where they should go.
44
+
45
+ Render with `scripts/render-sketch.mjs`, resolved relative to this `SKILL.md`:
46
+ `node <script> <file or local URL> --out <folder> --widths 390,1280`. It uses a Chrome or Edge already
47
+ on the machine, writes one PNG per width, and lists page errors and overflow. Exit 0 is clean, 1 means
48
+ it rendered with page errors, and 2 means it could not render. Never install a browser for it. When
49
+ you cannot render an image, say so and ask where the files should go.
50
+
51
+ ## Working surface
52
+
53
+ The invocation authorizes sketch files, the made-up data they need, the spec's `## Interface`
54
+ section, plus its `rev` and `## Decision log` when the spec is already accepted, and a policy
55
+ `## Design` section the person agreed to save. It does not
56
+ authorize production components, routes, state, API, or dependency changes. When a sketch needs
57
+ something the design system lacks, build it inside the sketch area and label it as a new proposal;
58
+ never change a shared component to make a sketch work.
59
+
60
+ A spec is open for edits until its review merges. After that, every edit to `## Interface` is a
61
+ reconsideration, including settling an open or deferred decision or adding a missing section: raise
62
+ `rev` and add a `## Decision log` line, as `plan-work` describes. A plan built on the earlier spec
63
+ revision is then stale and is reshaped by `shape-work`.
64
+
65
+ ## Sketch
66
+
67
+ Start from the spec's `## Interface` section: the surfaces it lists per role and the decisions it
68
+ marks open. A surface that is already decided is sketched only when the decision is about to
69
+ change. When the section says `None`, report that there is nothing to sketch and write no files.
70
+ When the section is missing or empty, derive the surfaces from the spec's behavior examples and
71
+ confirm the list with the person before sketching.
72
+
73
+ - **Real context.** Render each screen inside the layout the person will actually see, such as the
74
+ application shell, navigation, and page frame, not as a lone component on a blank canvas.
75
+ - **The project's own look.** In a workshop, use the project's components and tokens. In any other
76
+ medium, reproduce the look from the real tokens and layout, and state on the sketch that it is an
77
+ approximation. Reuse established patterns, and mark anything new as new so nobody mistakes it for
78
+ existing behavior.
79
+ - **Every state that matters.** Show the states the behavior examples imply, such as empty,
80
+ loading, error, success, no permission, and long content, for each role that sees the screen.
81
+ When layout depends on width, show the widths the policy names, or else common mobile, tablet,
82
+ and desktop widths together with the breakpoints the application itself defines. Show keyboard or
83
+ focus behavior when it is in scope.
84
+ - **Realistic made-up data.** Use plausible data in the product's own language. Never use real
85
+ personal or customer data.
86
+ - **Invented wording.** Text the spec does not give, such as an error message, is a proposal. Mark
87
+ it so in the sketch, list it in `## Interface`, and have the person confirm it with the decision
88
+ it belongs to.
89
+ - **Alternatives for real choices.** When a design question has materially different answers, build
90
+ two or three comparable alternatives with the same data side by side, recommend one, and let the
91
+ person decide. Do not decide a product preference for them.
92
+
93
+ Keep fidelity at what the open decision needs. A structure question needs a rough layout; a
94
+ question about hierarchy or interaction needs the real components and states.
95
+
96
+ ## Show it
97
+
98
+ Make each sketch openable for the person: start the workshop or check that it is running, give the
99
+ path of each HTML file, or show the images. Give the direct address of each sketch. Present each
100
+ open decision in plain language: what the person is looking at, the options, your recommendation,
101
+ and what changes if they choose otherwise. Ask one question at a time.
102
+
103
+ Iterate in the sketches until every listed decision is made or the person explicitly defers it.
104
+ When the person cannot answer now, commit the spec on a branch, with the sketches when they can be
105
+ committed, open a draft pull request that lists each open decision with the address or image of its
106
+ sketch, and wait. Never record your own recommendation as their decision.
107
+
108
+ ## Record
109
+
110
+ Write the outcome into the spec's `## Interface` section, one bullet per surface: the role and the
111
+ screen or state, then `Decided:` with the decision, its reason, the alternatives rejected, and the
112
+ sketch's location; `Deferred to <who> by <when>:` with what is undecided; or `Open:` with the question
113
+ while it waits on the person. The text must stand on its own: a reader who can no longer open the
114
+ sketch still knows what was decided.
115
+
116
+ A sketch's location must be reachable by everyone who reads the spec: a repository path, a pull
117
+ request image, or a URL, never a path that exists only on this machine. Until one exists, write that
118
+ the sketch is not yet published, and add the location when it is.
119
+
120
+ The sketches belong with the spec when they can be committed: commit them in the same change as the
121
+ spec when the request or the project's delivery defaults include committing, or when waiting on the
122
+ person as above. `deliver-work` reads the Interface section and its sketches;
123
+ a sketch is never promoted to production code.
124
+
125
+ ## Ground truth
126
+
127
+ The work is done when:
128
+
129
+ - every sketch opens and renders without errors in its medium, with no render or console errors
130
+ where those exist, and every image is legible;
131
+ - every behavior example with a visible result on a sketched surface appears in at least one
132
+ sketch, or the Interface section says why it is not visual;
133
+ - the sketches were inspected visually at the widths and states that matter, by you and by the
134
+ person; and
135
+ - every surface in `## Interface` has a decision or an explicit deferral with an owner.
136
+
137
+ Check these with the tools available, such as `scripts/render-sketch.mjs`, a browser on the sketch
138
+ or the workshop, the workshop's static build, or its test runner. Report a check you could not run instead of claiming it.
139
+
140
+ ## Exit
141
+
142
+ Report which surfaces are settled, which are deferred, and where the sketches are. When this run
143
+ continued from `plan-work`, return to it so the plan can be marked ready. When it started from a
144
+ `shape-work` hand-back, shaping continues from the current spec revision. Planning or sketching
145
+ never starts product implementation.
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env node
2
+ // Renders a sketch to one PNG per width with a Chrome or Edge already on the machine, and reports the
3
+ // page's errors. It speaks the DevTools protocol over --remote-debugging-pipe, so it has no dependency.
4
+
5
+ import { spawn } from 'node:child_process'
6
+ import fs from 'node:fs'
7
+ import os from 'node:os'
8
+ import path from 'node:path'
9
+ import { fileURLToPath, pathToFileURL } from 'node:url'
10
+
11
+ const DEFAULT_WIDTHS = [390, 768, 1280]
12
+ const VIEWPORT_HEIGHT = 900
13
+ const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]'])
14
+ const USAGE = 'Usage: render-sketch <file or local URL> --out <dir> [--widths 390,768,1280] [--name <name>] [--browser <path>]'
15
+
16
+ export class RenderError extends Error {}
17
+
18
+ export function parseArgs(argv) {
19
+ const options = { widths: DEFAULT_WIDTHS }
20
+ const positional = []
21
+ for (let index = 0; index < argv.length; index += 1) {
22
+ const argument = argv[index]
23
+ if (!argument.startsWith('--')) {
24
+ positional.push(argument)
25
+ continue
26
+ }
27
+ const key = argument.slice(2)
28
+ if (!['out', 'widths', 'name', 'browser'].includes(key)) throw new RenderError(`Unknown option ${argument}. ${USAGE}`)
29
+ const value = argv[index + 1]
30
+ if (!value || value.startsWith('--')) throw new RenderError(`${argument} needs a value. ${USAGE}`)
31
+ index += 1
32
+ options[key] = key === 'widths' ? value.split(',').map(Number) : value
33
+ }
34
+ if (positional.length !== 1 || !options.out) throw new RenderError(USAGE)
35
+ if (!options.widths.length || !options.widths.every((width) => Number.isInteger(width) && width > 0)) {
36
+ throw new RenderError('--widths must be positive whole numbers separated by commas.')
37
+ }
38
+ return { ...options, target: positional[0] }
39
+ }
40
+
41
+ // A sketch is a local file or a local workshop. Anything else is not this script's to open.
42
+ export function resolveTarget(target) {
43
+ if (/^https?:\/\//i.test(target)) {
44
+ if (!LOCAL_HOSTS.has(new URL(target).hostname)) throw new RenderError(`Only local addresses are rendered, not ${target}.`)
45
+ return target
46
+ }
47
+ const file = path.resolve(target)
48
+ if (!fs.existsSync(file)) throw new RenderError(`No such file: ${file}`)
49
+ return pathToFileURL(file).href
50
+ }
51
+
52
+ export function browserCandidates(platform = process.platform, env = process.env) {
53
+ if (platform === 'win32') {
54
+ const roots = [env.ProgramFiles, env['ProgramFiles(x86)'], env.LOCALAPPDATA].filter(Boolean)
55
+ return roots.flatMap((root) => [
56
+ path.win32.join(root, 'Google', 'Chrome', 'Application', 'chrome.exe'),
57
+ path.win32.join(root, 'Microsoft', 'Edge', 'Application', 'msedge.exe')
58
+ ])
59
+ }
60
+ if (platform === 'darwin') {
61
+ return ['Google Chrome', 'Microsoft Edge', 'Chromium'].map((app) => `/Applications/${app}.app/Contents/MacOS/${app}`)
62
+ }
63
+ const names = ['google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser', 'microsoft-edge']
64
+ return (env.PATH ?? '').split(':').filter(Boolean).flatMap((dir) => names.map((name) => path.posix.join(dir, name)))
65
+ }
66
+
67
+ export function findBrowser(candidates = browserCandidates()) {
68
+ return candidates.find((candidate) => fs.existsSync(candidate)) ?? null
69
+ }
70
+
71
+ function withTimeout(promise, ms, message) {
72
+ let timer
73
+ const timeout = new Promise((_, reject) => {
74
+ timer = setTimeout(() => reject(new RenderError(message)), ms)
75
+ })
76
+ return Promise.race([promise, timeout]).finally(() => clearTimeout(timer))
77
+ }
78
+
79
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
80
+
81
+ function connect(child) {
82
+ const [input, output] = [child.stdio[3], child.stdio[4]]
83
+ const pending = new Map()
84
+ const listeners = new Set()
85
+ let buffer = Buffer.alloc(0)
86
+ let nextId = 1
87
+
88
+ const failAll = (message) => {
89
+ for (const { reject } of pending.values()) reject(new RenderError(message))
90
+ pending.clear()
91
+ }
92
+ input.on('error', () => failAll('The browser closed its connection.'))
93
+ child.on('error', (error) => failAll(`The browser could not start: ${error.message}`))
94
+ child.on('exit', () => failAll('The browser exited before rendering finished.'))
95
+ output.on('data', (chunk) => {
96
+ buffer = Buffer.concat([buffer, chunk])
97
+ for (let end = buffer.indexOf(0); end >= 0; end = buffer.indexOf(0)) {
98
+ const message = JSON.parse(buffer.subarray(0, end).toString('utf8'))
99
+ buffer = buffer.subarray(end + 1)
100
+ const call = pending.get(message.id)
101
+ if (!call) {
102
+ for (const listener of listeners) listener(message)
103
+ } else {
104
+ pending.delete(message.id)
105
+ if (message.error) call.reject(new RenderError(`${call.method}: ${message.error.message}`))
106
+ else call.resolve(message.result)
107
+ }
108
+ }
109
+ })
110
+
111
+ return {
112
+ listeners,
113
+ send(method, params = {}, sessionId) {
114
+ return new Promise((resolve, reject) => {
115
+ const id = nextId
116
+ nextId += 1
117
+ pending.set(id, { resolve, reject, method })
118
+ input.write(`${JSON.stringify({ id, method, params, sessionId })}\0`)
119
+ })
120
+ }
121
+ }
122
+ }
123
+
124
+ function pageError({ method, params }) {
125
+ if (method === 'Runtime.exceptionThrown') {
126
+ const details = params.exceptionDetails
127
+ return details.exception?.description ?? details.text
128
+ }
129
+ if (method === 'Runtime.consoleAPICalled' && ['error', 'assert'].includes(params.type)) {
130
+ return params.args.map((arg) => arg.value ?? arg.description ?? '').join(' ')
131
+ }
132
+ if (method === 'Log.entryAdded' && params.entry.level === 'error' && !params.entry.url?.endsWith('/favicon.ico')) {
133
+ return params.entry.url ? `${params.entry.text} (${params.entry.url})` : params.entry.text
134
+ }
135
+ return null
136
+ }
137
+
138
+ async function renderWidth(pipe, sessionId, url, width, file, timeoutMs) {
139
+ const send = (method, params) => pipe.send(method, params, sessionId)
140
+ const errors = []
141
+ let loaded
142
+ const load = new Promise((resolve) => {
143
+ loaded = resolve
144
+ })
145
+ const listener = (message) => {
146
+ if (message.sessionId !== sessionId) return
147
+ if (message.method === 'Page.loadEventFired') loaded()
148
+ const error = pageError(message)
149
+ if (error) errors.push(error)
150
+ }
151
+ pipe.listeners.add(listener)
152
+ try {
153
+ await send('Emulation.setDeviceMetricsOverride', { width, height: VIEWPORT_HEIGHT, deviceScaleFactor: 1, mobile: false })
154
+ const navigation = await send('Page.navigate', { url })
155
+ if (navigation.errorText) throw new RenderError(`Could not open ${url}: ${navigation.errorText}`)
156
+ await withTimeout(load, timeoutMs, `${url} did not finish loading within ${timeoutMs} ms.`)
157
+ await send('Runtime.evaluate', { expression: 'document.fonts.ready.then(() => true)', awaitPromise: true })
158
+ await delay(150)
159
+ const { cssContentSize: size } = await send('Page.getLayoutMetrics')
160
+ const height = Math.max(1, Math.ceil(size.height))
161
+ // Side-by-side alternatives can be wider than the width under test, and must not be cut off.
162
+ const contentWidth = Math.max(width, Math.ceil(size.width))
163
+ const { data } = await send('Page.captureScreenshot', {
164
+ format: 'png',
165
+ captureBeyondViewport: true,
166
+ clip: { x: 0, y: 0, width: contentWidth, height, scale: 1 }
167
+ })
168
+ fs.writeFileSync(file, Buffer.from(data, 'base64'))
169
+ return { width, height, file, errors, contentWidth }
170
+ } finally {
171
+ pipe.listeners.delete(listener)
172
+ }
173
+ }
174
+
175
+ export async function renderSketch({ target, out, widths = DEFAULT_WIDTHS, name, browser, timeoutMs = 30000 }) {
176
+ const url = resolveTarget(target)
177
+ const executable = browser ?? findBrowser()
178
+ if (!executable) throw new RenderError('No Chrome or Edge was found. Pass one with --browser <path>.')
179
+ const stem = name ?? (url.startsWith('file:') ? path.parse(target).name : 'sketch')
180
+ fs.mkdirSync(out, { recursive: true })
181
+ const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-os-render-'))
182
+ const flags = [
183
+ '--headless=new', '--remote-debugging-pipe', `--user-data-dir=${profile}`, '--no-first-run',
184
+ '--no-default-browser-check', '--disable-extensions', '--disable-gpu', '--hide-scrollbars', '--mute-audio',
185
+ // Chrome refuses to start as root with its sandbox on, which is how many CI containers run.
186
+ ...(process.getuid?.() === 0 ? ['--no-sandbox'] : [])
187
+ ]
188
+ const child = spawn(executable, [...flags, 'about:blank'], { stdio: ['ignore', 'ignore', 'ignore', 'pipe', 'pipe'] })
189
+ const exited = new Promise((resolve) => {
190
+ child.once('exit', resolve)
191
+ child.once('error', resolve)
192
+ })
193
+ const pipe = connect(child)
194
+ try {
195
+ const { targetId } = await withTimeout(pipe.send('Target.createTarget', { url: 'about:blank' }), timeoutMs, 'The browser did not respond.')
196
+ const { sessionId } = await pipe.send('Target.attachToTarget', { targetId, flatten: true })
197
+ for (const domain of ['Page', 'Runtime', 'Log']) await pipe.send(`${domain}.enable`, {}, sessionId)
198
+ const results = []
199
+ for (const width of widths) {
200
+ results.push(await renderWidth(pipe, sessionId, url, width, path.join(out, `${stem}-${width}.png`), timeoutMs))
201
+ }
202
+ return results
203
+ } finally {
204
+ await withTimeout(pipe.send('Browser.close'), 3000, 'close').catch(() => {})
205
+ await withTimeout(exited, 3000, 'exit').catch(() => child.kill())
206
+ try {
207
+ fs.rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 })
208
+ } catch {
209
+ // A leftover profile in the temp directory does not affect the result.
210
+ }
211
+ }
212
+ }
213
+
214
+ // Exit 0: rendered with no page errors. Exit 1: rendered, with page errors. Exit 2: could not render.
215
+ export async function main(argv, output = process.stdout) {
216
+ try {
217
+ const results = await renderSketch(parseArgs(argv))
218
+ for (const { width, height, file, errors, contentWidth } of results) {
219
+ output.write(`RENDERED ${width}x${height} ${file}\n`)
220
+ if (contentWidth > width) output.write(`WARN ${width}: the content is ${contentWidth} px wide and overflows this width\n`)
221
+ for (const error of errors) output.write(`ERROR ${width}: ${error}\n`)
222
+ }
223
+ return results.some((result) => result.errors.length > 0) ? 1 : 0
224
+ } catch (error) {
225
+ if (!(error instanceof RenderError)) throw error
226
+ output.write(`CANNOT RENDER: ${error.message}\n`)
227
+ return 2
228
+ }
229
+ }
230
+
231
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
232
+ process.exitCode = await main(process.argv.slice(2))
233
+ }