@sockulags/agent-os 0.17.1 → 0.19.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 (22) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/agent-os-core/.claude-plugin/plugin.json +1 -1
  4. package/plugins/agent-os-core/.codex-plugin/plugin.json +1 -1
  5. package/plugins/agent-os-core/skills/plan-work/references/spec-template.md +3 -1
  6. package/plugins/agent-os-core/skills/record-lesson/SKILL.md +16 -2
  7. package/plugins/agent-os-core/skills/scope-guard/SKILL.md +6 -0
  8. package/plugins/agent-os-core/skills/verify-before-done/SKILL.md +3 -1
  9. package/plugins/agent-os-dev/.claude-plugin/plugin.json +1 -1
  10. package/plugins/agent-os-dev/.codex-plugin/plugin.json +1 -1
  11. package/plugins/agent-os-dev/skills/check-work/references/findings.md +7 -1
  12. package/plugins/agent-os-dev/skills/deliver-work/SKILL.md +6 -4
  13. package/plugins/agent-os-dev/skills/diagnose-before-fix/SKILL.md +8 -6
  14. package/plugins/agent-os-dev/skills/init-agent-os/references/review-template.md +6 -3
  15. package/plugins/agent-os-dev/skills/proportional-testing/SKILL.md +22 -4
  16. package/plugins/agent-os-dev/skills/proportional-testing/references/strategy.md +8 -3
  17. package/plugins/agent-os-dev/skills/quality-ratchet/SKILL.md +60 -19
  18. package/plugins/agent-os-dev/skills/quality-ratchet/references/project-controls.md +9 -6
  19. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/project-controls.mjs +2 -1
  20. package/plugins/agent-os-dev/skills/quality-ratchet/scripts/project-controls.test.mjs +20 -0
  21. package/plugins/agent-os-dev/skills/shape-work/SKILL.md +10 -2
  22. package/plugins/agent-os-dev/skills/shape-work/references/implementation-issues.md +2 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@ truth, and `plan.md` for delivery units. See the
46
46
  | `check-work` | workflow | automatic | Independently review a candidate and report or fix supported findings |
47
47
  | `diagnose-before-fix` | discipline | automatic | Reproduce and root-cause before patching |
48
48
  | `proportional-testing` | discipline | automatic | Minimum meaningful regression coverage |
49
- | `quality-ratchet` | discipline | automatic | Compare exact entry and candidate evidence without score gates |
49
+ | `quality-ratchet` | discipline | automatic | Decide the shape first, then compare entry and candidate evidence without score gates |
50
50
 
51
51
  Manual skills carry `disable-model-invocation: true` (Claude) and `agents/openai.yaml` with
52
52
  `policy.allow_implicit_invocation: false` (Codex). Automatic skills carry neither gate; their
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sockulags/agent-os",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "A lightweight agent operating system for Claude Code and Codex: agent-os-core for intent, planning, and evidence, and agent-os-dev for delivery, review, and guard hooks.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-os-core",
3
3
  "description": "Agent OS core: capture intent, plan decisions, explain plainly, keep scope, and prove claims. Useful for any agent work, not only code.",
4
- "version": "0.17.1",
4
+ "version": "0.19.0",
5
5
  "author": {
6
6
  "name": "Lucas Skog"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-os-core",
3
3
  "description": "Agent OS core: capture intent, plan decisions, explain plainly, keep scope, and prove claims. Useful for any agent work, not only code.",
4
- "version": "0.17.1",
4
+ "version": "0.19.0",
5
5
  "homepage": "https://sockulags.github.io/agent-os/",
6
6
  "repository": "https://github.com/sockulags/agent-os",
7
7
  "keywords": [
@@ -53,7 +53,9 @@ Write `None` when nothing a person sees or does changes. Never delete.>
53
53
 
54
54
  ## Ground truth
55
55
 
56
- <The commands or observations that prove the outcome, such as `npm test -- export` or a named manual check.>
56
+ <The commands or observations that prove the outcome, such as `npm test -- export` or a named manual check.
57
+ Acceptance examples define the behavior, not the number of tests: name where they are proven, such as
58
+ one table-driven test, an end-to-end step, or an observation.>
57
59
 
58
60
  ## Open risks
59
61
 
@@ -43,5 +43,19 @@ State the smallest rule the next agent can act on, with the observed failure or
43
43
  motivates it. Search the target for an existing line with the same meaning: update it rather than
44
44
  duplicating, and delete a line the lesson proves wrong. Show the resulting diff.
45
45
 
46
- A machine-checkable lesson belongs in a test, script, hook, or validator rather than in prose; route
47
- it there and record at most a pointer in policy prose.
46
+ ## Choose the enforcement
47
+
48
+ Nothing fails when an agent skips a sentence, and an agent copies the nearest example before it
49
+ reads policy. Offer the lesson at the highest of these levels that works:
50
+
51
+ 1. a change that makes the mistake impossible: one owner for the state, one supported way to do the
52
+ task, and the old way deleted so that nothing is left to copy;
53
+ 2. a type, lint rule, hook, or validator whose error names what to use instead;
54
+ 3. a test that fails when the behavior breaks;
55
+ 4. policy prose, for judgment that nothing can check.
56
+
57
+ Levels 1 to 3 change the repository, so they need the person's agreement like any recorded lesson
58
+ and follow the project's delivery rules. When that change is larger than the current task, offer it
59
+ as a follow-up and record the prose rule until it lands. A machine-checkable lesson leaves at most a
60
+ pointer in policy prose. End the policy line with what enforces it, or `prose only`. When a
61
+ correction repeats a rule recorded as `prose only`, move it up a level instead of rewording it.
@@ -38,6 +38,12 @@ through `shape-work`.
38
38
  Behavior-preserving extraction within the touched surface is allowed when it clarifies responsibility
39
39
  or reuses an existing contract. Do not classify every new helper as an architecture change.
40
40
 
41
+ A unit's `Target shape` is part of the boundary: the reshape and the removals it names are required
42
+ work. For work without a unit, the same holds for the shape the implementation needs in the code it
43
+ touches and the callers that must move with it, as agent-os-dev's quality-ratchet decides it. Either
44
+ one needs a new decision only when it changes a public interface, adds a dependency, or reaches
45
+ beyond those callers.
46
+
41
47
  For an actionable adjacent item, search for an existing issue first. If the request or project
42
48
  policy authorizes follow-up issue creation, and no explicit read-only instruction forbids it, create
43
49
  or update one concrete follow-up with its problem, impact, and acceptance condition. Otherwise
@@ -24,7 +24,9 @@ Use the strongest practical layer:
24
24
  4. Static inspection only when execution is impossible and the limitation is explicit.
25
25
 
26
26
  Passing a weaker layer does not prove a stronger claim. Stale or second-hand results are context, not
27
- verification.
27
+ verification. When the strongest layer is unavailable, report that gap instead of compensating with
28
+ more unit tests at a weaker layer. A check that proves a claim does not have to become a committed
29
+ test; with agent-os-dev installed, proportional-testing decides what stays.
28
30
 
29
31
  When agent-os-dev is installed, a quality-ratchet Stop block saying the check is stale or a required
30
32
  check failed is this discipline enforced: rerun the check, or name the claim as unverified.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-os-dev",
3
3
  "description": "Agent OS development: shape plans, deliver against ground truth, review independently, and guard delivery with hooks. Requires agent-os-core.",
4
- "version": "0.17.1",
4
+ "version": "0.19.0",
5
5
  "author": {
6
6
  "name": "Lucas Skog"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-os-dev",
3
3
  "description": "Agent OS development: shape plans, deliver against ground truth, review independently, and guard delivery with hooks. Requires agent-os-core.",
4
- "version": "0.17.1",
4
+ "version": "0.19.0",
5
5
  "homepage": "https://sockulags.github.io/agent-os/",
6
6
  "repository": "https://github.com/sockulags/agent-os",
7
7
  "keywords": [
@@ -4,7 +4,13 @@ A blocking finding needs a location, triggering condition, concrete consequence,
4
4
  the candidate fails a requirement or imposes a material maintenance cost. Security and data-loss
5
5
  risks need a credible path, not a production incident. Duplicated rules that can diverge or mixed
6
6
  responsibilities that make the requested behavior unsafe to change can justify simplification;
7
- line count, personal style, and an equally valid design alternative cannot.
7
+ line count, personal style, and an equally valid design alternative cannot. Tests are code to
8
+ maintain: changed behavior that nothing protects and a new test that `proportional-testing` would
9
+ not keep, such as one duplicating an existing case or asserting internal calls, are both findings.
10
+ So is structure the candidate leaves behind: an old path kept beside its replacement, a unit's
11
+ target shape not reached with no reason stated, and a comment in the code the candidate touches that `quality-ratchet`
12
+ would not keep. The required change for such a comment is to delete it and fix what it points at,
13
+ not to reword it.
8
14
 
9
15
  Separate required corrections from useful nonblocking follow-ups. Omit cosmetic preferences and
10
16
  speculative hardening. No findings is a valid result. Do not manufacture work to justify review.
@@ -103,8 +103,9 @@ through the work loop and the review gate.
103
103
 
104
104
  ## Work loop
105
105
 
106
- 1. Inspect enough of the affected system to choose a coherent change. Apply quality-ratchet's
107
- reuse and responsibility guidance before writing. If a solution-changing uncertainty remains,
106
+ 1. Inspect enough of the affected system to choose a coherent change. Settle the shape before
107
+ writing: the unit's `Target shape` when it has one, otherwise quality-ratchet's shape decision.
108
+ If a solution-changing uncertainty remains,
108
109
  use the [experiment decision](../shape-work/references/prototypes.md); clear tasks need no prototype.
109
110
  2. If available, run [`quality-ratchet`](../quality-ratchet/SKILL.md)'s `begin` before the first
110
111
  mutation. It captures the exact worktree entry state without stashing or editing user files; an
@@ -112,8 +113,9 @@ through the work loop and the review gate.
112
113
  3. Classify the review gate before editing. If review is required, confirm the current tool list
113
114
  contains a real reviewer launch tool before mutation. Re-evaluate the gate against the completed
114
115
  diff.
115
- 4. Make the smallest complete implementation. Allow only the quality-ratchet's bounded,
116
- behavior-preserving improvement on the touched surface. Use `diagnose-before-fix` when the
116
+ 4. Make the smallest complete implementation of that shape, removing what it replaces before
117
+ adding to it. Beyond the shape, allow only the quality-ratchet's bounded improvement on the
118
+ touched surface. Use `diagnose-before-fix` when the
117
119
  cause is unknown and `scope-guard` when discoveries threaten the boundary.
118
120
  5. Apply [`proportional-testing`](../proportional-testing/SKILL.md) when selecting or creating tests.
119
121
  Run fast, relevant checks while working and adapt from their results.
@@ -17,12 +17,14 @@ Find the smallest supported explanation that accounts for the failure and predic
17
17
 
18
18
  Reproduce, reduce, trace the nearest seam, and compare plausible causes with high-information checks.
19
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.
20
+ write that test first, as a case in the existing test for the same rule when one exists and in the
21
+ shape [proportional-testing](../proportional-testing/SKILL.md) keeps, and confirm it fails for the
22
+ diagnosed reason. In a delivery that commits, commit the failing test before the fix, and when
23
+ agent-os-dev guards are installed run `guards.mjs lock-test <path>` from the quality-ratchet skill's
24
+ `scripts/` so the test cannot be bent to fit the fix. Once evidence supports a cause, implement the
25
+ smallest fix. Re-run the original failing path, then `guards.mjs unlock-test <path>`. The lock
26
+ covers the whole file, so tidy other cases in it after unlocking. Changing a locked test needs the
27
+ developer's explicit agreement, because it changes what counts as fixed.
26
28
 
27
29
  If the failure cannot be reproduced or competing explanations cannot be distinguished, report the
28
30
  bounded uncertainty and the next discriminating check. Do not turn a plausible hypothesis into a
@@ -21,9 +21,12 @@ or public API compatibility, each with one sentence on why.>
21
21
 
22
22
  - **Blocking:** incorrect behavior, a missed acceptance example from the spec, a security or data
23
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.
24
+ - **Should fix:** a defect with limited impact; changed behavior that no existing test, type, or lint
25
+ rule protects; a new test that duplicates an existing one, asserts internal calls or module
26
+ structure instead of behavior, or copies setup a shared fixture already covers; an old path left
27
+ beside its replacement; a comment in the touched code that explains the project's own code,
28
+ narrates it, or suppresses a correctness rule; or complexity the change does not need.
29
+ - **Minor:** naming or local readability. Report at most <three> minor findings per review.
27
30
 
28
31
  ## Out of scope for review
29
32
 
@@ -15,16 +15,34 @@ Before adding a test:
15
15
 
16
16
  1. Identify the observable behavior changed and its plausible blast radius.
17
17
  2. Search existing tests for that behavior and affected contracts.
18
- 3. Name the realistic regression the proposed test would catch that existing coverage would not.
18
+ 3. Name the realistic regression the proposed test would catch that existing tests, types, and lint
19
+ rules would not.
19
20
  4. If that regression is unclear, do not add the test.
20
21
  5. Otherwise extend existing or table-driven coverage when practical, using the cheapest test level
21
22
  that proves the behavior.
22
23
 
24
+ Decide whether a test is evidence for this change or a lasting guard. Commit it only when it protects
25
+ externally observable behavior and survives a behavior-preserving refactor: it mocks none of the
26
+ project's own modules, and it asserts call order or arguments only where that call is the contract at
27
+ a system boundary. Otherwise run it as evidence and do not commit it, or fold it into the existing
28
+ case for the same rule.
29
+
30
+ Leave a touched test file no worse than you found it. When you add a case, merge cases that test the
31
+ same rule into one table-driven test, name tests by the rule they protect rather than the issue that
32
+ added them, and remove assertions the new case makes redundant.
33
+
34
+ Judge the existing cases in a test file you touch, and the tests of code you reshape, by two
35
+ imagined edits. Break the behavior: the test must fail. Change only the internals: the test must
36
+ still pass. Rewrite a case that fails either edit so it drives the public behavior, or delete it
37
+ when another case already protects that behavior or the behavior is gone. This needs no separate
38
+ approval; name each deleted test and its reason in the report. A large suite is no reason to delete,
39
+ and a test locked by `lock-test` stays as it is.
40
+
23
41
  For a confirmed bug, establish one reproducing regression check when practical, prove it fails for
24
42
  the expected reason, fix it, then run that check and relevant affected tests. Expand execution only
25
43
  when the blast radius is uncertain, shared infrastructure changed, or project policy requires a
26
44
  broader gate.
27
45
 
28
- Do not create a test for every function, branch, file, or generated code path. Prefer observable
29
- contracts over call sequences and private structure. This discipline controls test creation and
30
- development-time selection; it never removes required repository or CI checks at delivery.
46
+ Do not create a test for every function, branch, file, or generated code path. This discipline
47
+ controls test creation and development-time selection; it never removes required repository or CI
48
+ checks at delivery.
@@ -22,12 +22,17 @@ Existing coverage may already be sufficient.
22
22
  Test externally observable behavior and contracts. A behavior-preserving refactor should not force
23
23
  large test rewrites. Avoid tests whose main value is asserting internal calls, exact call sequences
24
24
  when ordering is not contractual, trivial delegation, getters, constructors, framework boilerplate,
25
- private structure, or mocks that reproduce the implementation.
25
+ private structure, mocks of the project's own modules, or mocks that reproduce the implementation.
26
26
 
27
27
  Before adding coverage, search for an existing behavioral test. Prefer extending it, adding a case
28
28
  to a table-driven test, and reusing its fixtures. One strong regression test is better than several
29
29
  tests with equivalent setup and assertions.
30
30
 
31
+ Existing tests are held to the same standard when you touch their file or reshape the code they
32
+ cover. Imagine breaking the behavior: the test must fail. Imagine changing only the internals: it
33
+ must still pass. Rewrite a test that fails either edit so it drives the public behavior, or delete
34
+ it when another test already protects that behavior or the behavior is gone.
35
+
31
36
  ## Choose the cheapest sufficient level
32
37
 
33
38
  Use a focused unit or component test when it can prove the contract. Use integration or end-to-end
@@ -83,5 +88,5 @@ Coverage is adequate when the intended behavior is verified, plausible affected
83
88
  important justified edge cases have been considered, relevant existing tests pass, and the chosen
84
89
  test level is proportional to the risk.
85
90
 
86
- Before adding another test, ask: **What realistic regression would this catch that existing tests
87
- would not?** If there is no clear answer, do not add it.
91
+ Before adding another test, ask: **What realistic regression would this catch that existing tests,
92
+ types, and lint rules would not?** If there is no clear answer, do not add it.
@@ -1,17 +1,52 @@
1
1
  ---
2
2
  name: quality-ratchet
3
- description: Quality ratchet for code you are implementing or about to deliver, so the touched code ends up no worse than it was. Records the entry state before the first edit, compares the candidate with it, and keeps cleanup bounded to the code the change touches. Use when adding a feature or changing existing code, when reviewing your own implementation or candidate before delivery, and when the user says things like don't make it worse, keep it at least as clean as it is now, no quality regressions compared with main, tidy it up while you're there but only what you touch, check the candidate, or this has too many layers. Not for repository-wide tech-debt hunts, reviewing someone else's pull request, or cutting line counts.
3
+ description: Quality ratchet for code you are implementing or about to deliver, so the touched code ends up in the shape the change needs and no worse than it was. Decides that shape before the first edit instead of repeating the existing pattern, records the entry state, compares the candidate with it, and keeps cleanup bounded to the code the change touches. Use when adding a feature or changing existing code, when reviewing your own implementation or candidate before delivery, and when the user says things like don't make it worse, keep it at least as clean as it is now, no quality regressions compared with main, tidy it up while you're there but only what you touch, check the candidate, or this has too many layers. Not for repository-wide tech-debt hunts, reviewing someone else's pull request, or cutting line counts.
4
4
  ---
5
5
 
6
6
  # Quality ratchet
7
7
 
8
- Keep the smallest set of concepts and machinery needed for the current change. The ratchet is an
9
- evidence layer, not a score or replacement for semantic review. Explicit project rules may gate delivery.
8
+ Decide the shape the touched code should have, then keep the smallest set of concepts and machinery
9
+ that shape needs. The runner is an evidence layer, not a score or replacement for semantic review.
10
+ Explicit project rules may gate delivery.
10
11
 
11
- Before choosing the implementation, find the nearest existing behavior, contract, and tests. Reuse
12
- or extend their owner before adding a parallel implementation. For TypeScript, React, or Java
13
- changes, read [references/structure.md](references/structure.md) for contract ownership and cohesive
14
- boundaries. Make this a code decision, not a mandatory planning artifact.
12
+ ## Decide the shape first
13
+
14
+ Before the first edit, find the nearest existing behavior, contract, and tests, and decide the shape
15
+ the touched code should have with this change in it. An existing pattern shows what fit when it was
16
+ written; it is not a rule to repeat. Ask what you would build if this requirement had been there
17
+ from the start:
18
+
19
+ - When the existing design still fits, extend its owner instead of adding a parallel implementation.
20
+ - When it does not, reshape the touched code to the design that fits and move its callers in the
21
+ same change. Do not bolt the new case onto the old design or leave the old path beside the new one.
22
+
23
+ Remove before you add: delete what the change makes dead, such as the old path, its unused helpers
24
+ and options, and tests that protect only the replaced implementation, then build on what is left.
25
+ A unit's `Target shape` is this decision already made. Follow it. When the code shows a better shape
26
+ inside the same outcome and boundaries, build that one and state the difference and the reason in
27
+ the report. Return the unit to `shape-work` only when the shape changes its outcome or boundaries.
28
+
29
+ The decision covers the code the change touches and the callers it must move. A reshape that needs
30
+ more than that is the one adjacent opportunity to report, not part of the patch. For TypeScript,
31
+ React, or Java changes, read [references/structure.md](references/structure.md) for contract
32
+ ownership and cohesive boundaries. Make this a code decision, not a mandatory planning artifact.
33
+
34
+ ## Comments
35
+
36
+ A comment that explains the project's own code is a defect in that code. That covers a comment that
37
+ says why the code is odd, what it works around, or that it must not be changed, narration of what
38
+ the next lines do, commented-out code, and a lint or type suppression whose rule guards correctness
39
+ or safety. Add none. In the code the change touches, delete every such comment and fix what it
40
+ points at in the same change: reshape or rename until the behavior is obvious, fix the suppressed
41
+ error, or encode a `do not change` constraint as a type, test, or lint rule. When that fix reaches
42
+ beyond the touched code, still delete the comment, make the smallest fix that fits, and report the
43
+ symbol and what remains as an open item. When unsure whether a comment may stay, it goes.
44
+
45
+ Only these stay: license headers, documentation of a public contract, a link to an issue or
46
+ specification for a constraint the code cannot express, a suppression of a rule that is only
47
+ stylistic, and a note on behavior that an external dependency, platform, or protocol forces.
48
+
49
+ ## Baseline and check
15
50
 
16
51
  Resolve `scripts/quality-delta.mjs` relative to this loaded `SKILL.md`; do not assume the current
17
52
  worktree contains an Agent OS checkout. Before the first mutation in a Git worktree, run that
@@ -22,10 +57,14 @@ delivery, run `finish`: it records a fresh check and closes the baseline only wh
22
57
  Use its `clear` command only when abandoning the attempt. The normal correctness, security, scope,
23
58
  independent-review, and verification steps still decide delivery.
24
59
 
60
+ ## Zones
61
+
25
62
  Use three zones:
26
63
 
27
- 1. A bounded, behavior-preserving improvement on the implementation surface already being
28
- touched is allowed when it makes the requested change clearer or safer.
64
+ 1. The shape decision, and a bounded improvement on the implementation surface already being
65
+ touched that makes the requested change clearer or safer, belong in the patch. Behavior the
66
+ request does not change stays the same. A touched test file is
67
+ part of that surface; `proportional-testing` says what it keeps.
29
68
  2. Report at most one concrete adjacent structural opportunity when it materially constrains the
30
69
  requested change, but leave it out of the patch unless the boundary expands.
31
70
  3. Ignore unrelated debt. `scope-guard` owns drift; do not turn a ratchet signal into a cleanup
@@ -35,15 +74,17 @@ Extract a named responsibility when it makes the touched code easier to understa
35
74
  invariant, even with one caller. This is allowed local improvement, not automatic scope expansion.
36
75
  Do not force inheritance, shared utils, or extra layers merely to reduce file size.
37
76
 
38
- The check reports added, changed, and deleted source files, touched-source NLOC before/after, the
39
- before/after status of source paths that were already present at entry, package dependency deltas,
40
- and optional analyzer capability. When lizard is installed, it also reports cyclomatic complexity
41
- before and after for touched functions, ranked by increase. That value counts paths through a
42
- function, not readability; it is best effort, can miss functions in unusual formatting, and has
43
- before values only for files that were clean at entry. Raw file, function, line, or complexity
44
- counts are signals only. There is no aggregate score and no threshold gate unless the project sets
45
- one. Missing lizard is reported as unavailable rather than clean; jscpd is detected but not
46
- integrated into the delta. The core Node evidence remains usable without either.
77
+ ## Evidence
78
+
79
+ The check reports added, changed, and deleted source files, test files included, touched-source NLOC
80
+ before/after, the before/after status of source paths that were already present at entry, package
81
+ dependency deltas, and optional analyzer capability. When lizard is installed, it also reports
82
+ cyclomatic complexity before and after for touched functions, ranked by increase. That value counts
83
+ paths through a function, not readability; it is best effort, can miss functions in unusual
84
+ formatting, and has before values only for files that were clean at entry. Raw file, function, line,
85
+ or complexity counts are signals only. There is no aggregate score and no threshold gate unless the
86
+ project sets one. Missing lizard is reported as unavailable rather than clean; jscpd is detected but
87
+ not integrated into the delta. The core Node evidence remains usable without either.
47
88
 
48
89
  Use existing project checks for enforceable rules and report structural signals as advisory.
49
90
  When configuring external checks, read [references/project-controls.md](references/project-controls.md).
@@ -98,7 +139,7 @@ check.
98
139
  `unlock-test <path>` once the fix passes. A block is a boundary: change course or ask, and never
99
140
  reach the same edit through another tool or path.
100
141
 
101
- Exit with the smallest complete implementation, the quality evidence, semantic review findings,
142
+ Exit with the smallest complete implementation of the decided shape, the quality evidence, semantic review findings,
102
143
  and fresh verification. Do not remove a legitimate abstraction merely because it increases a raw
103
144
  count: multiple providers, runtime selection, compatibility, or a real trust boundary can justify
104
145
  the machinery and belongs to semantic judgment.
@@ -77,12 +77,15 @@ Agent OS does not suppress pre-existing analyzer failures or equate tool success
77
77
 
78
78
  ## New exceptions and policy changes
79
79
 
80
- The runner reports new source lines matching `type-escape` (common `: any`/`as any` annotations and casts, TypeScript suppression comments),
81
- `lint-disable` (ESLint suppression and Java `@SuppressWarnings`), and `test-skip` (common test skips,
82
- focused tests, and Java `@Disabled`). It subtracts existing occurrences per file, ignoring simple
83
- line movement. These lexical signals can match comments or strings and can reappear on rename;
84
- they do not establish a semantic defect. Review them or delegate exact rules to the project's linter.
85
- Only rules explicitly listed in `blockSignals` block delivery. Raw LOC and structural counts never do.
80
+ The runner reports new source lines matching `type-escape` (common `: any`/`as any` annotations and
81
+ casts, TypeScript suppression comments), `lint-disable` (ESLint suppression and Java
82
+ `@SuppressWarnings`), `test-skip` (common test skips, focused tests, and Java `@Disabled`), and
83
+ `project-mock` (`vi.mock` or `jest.mock` of a relative path or an `@/`, `~/`, or `#/` alias, which
84
+ couples a test to the project's own module structure). It subtracts existing occurrences per file,
85
+ ignoring simple line movement. These lexical signals can match comments or strings and can reappear
86
+ on rename; they do not establish a semantic defect. Review them or delegate exact rules to the
87
+ project's linter. Only rules explicitly listed in `blockSignals` block delivery. Raw LOC and
88
+ structural counts never do.
86
89
 
87
90
  ## Complexity threshold
88
91
 
@@ -9,7 +9,8 @@ export const DEFAULT_TRUST_STORE = path.join(os.homedir(), '.agent-os', 'trusted
9
9
  const SIGNALS = {
10
10
  'type-escape': /@ts-(?:ignore|nocheck|expect-error)\b|:\s*any\b|\bas\s+any\b/,
11
11
  'lint-disable': /eslint-disable|@SuppressWarnings\b/,
12
- 'test-skip': /\b(?:it|test|describe)\s*\.\s*(?:skip|todo|only)\s*\(|\b[fx](?:it|describe)\s*\(|@Disabled\b/
12
+ 'test-skip': /\b(?:it|test|describe)\s*\.\s*(?:skip|todo|only)\s*\(|\b[fx](?:it|describe)\s*\(|@Disabled\b/,
13
+ 'project-mock': /\b(?:vi|jest)\s*\.\s*(?:mock|doMock)\s*\(\s*['"`](?:\.{1,2}\/|[@~#]\/)/
13
14
  }
14
15
  const hash = value => createHash('sha256').update(value).digest('hex')
15
16
  const identity = value => hash(JSON.stringify(value))
@@ -80,6 +80,26 @@ test('advisory failures and new exception signals do not gate delivery', t => {
80
80
  assert.deepEqual(hook(f.root), {})
81
81
  })
82
82
 
83
+ test('new mocks of project modules are advisory signals; package mocks are not', t => {
84
+ const f = fixture(t)
85
+ f.write('source.test.ts', "vi.mock('@/lib/db')\n")
86
+ begin(f.root, options)
87
+ f.write('source.test.ts', [
88
+ "vi.mock('@/lib/db')",
89
+ "vi.mock('@/lib/mail')",
90
+ "jest.mock('../store', () => ({}))",
91
+ 'vi.doMock("./clock")',
92
+ "vi.mock('@scope/package')",
93
+ "vi.mock('node:fs')"
94
+ ].join('\n'))
95
+ const result = check(f.root, options)
96
+ assert.equal(result.status, 'ok')
97
+ assert.deepEqual(result.sourceFiles.changed, ['source.test.ts'])
98
+ assert.deepEqual(result.controls.signals.map(s => [s.rule, s.line]),
99
+ [['project-mock', 2], ['project-mock', 3], ['project-mock', 4]])
100
+ assert.deepEqual(hook(f.root), {})
101
+ })
102
+
83
103
  test('an explicit project exception rule blocks only additions since entry', t => {
84
104
  const f = fixture(t, [], { blockSignals: ['test-skip'] })
85
105
  f.write('source.ts', "test.skip('old', () => {})")
@@ -32,13 +32,21 @@ where that is the true answer:
32
32
  sentence or two.
33
33
  - **Boundaries:** the non-goals a worker would plausibly cross, and what neighboring units own
34
34
  instead.
35
- - **Change surface:** the modules, interfaces, and existing code to extend, found by reading the
36
- repository, in a few lines. It names seams and does not list steps or every file.
35
+ - **Change surface:** the modules, interfaces, and existing code the unit changes, found by reading
36
+ the repository, in a few lines. It names seams and does not list steps or every file.
37
+ - **Target shape:** how that code should be organized once the unit is delivered, decided as if this
38
+ requirement had been there from the start, and what the unit removes on the way: the old path and
39
+ its callers, tests that protect only the replaced implementation, and comments that explain a
40
+ workaround. An existing pattern shows what fit when it was written; it does not decide this. One
41
+ to three lines that name structure, not steps. Write `extend as is` with the reason when the
42
+ existing design already fits.
37
43
  - **Acceptance:** the checks that decide done, written out in the unit as given, when, then or as
38
44
  assertions, one line each, each citing its spec example. Cover the behaviors this unit owns, not
39
45
  every variation. A spec example shared between units states exactly this unit's part. A bare
40
46
  pointer such as "behaviors 1 to 3" is not acceptance.
41
47
  - **Ground truth:** the commands to run and the named cases or observations they must show.
48
+ Acceptance lines define the behavior, not the number of tests: several can be proven by one
49
+ table-driven test, an end-to-end step, or an observation.
42
50
  - **Dependencies:** for each dependency, what this unit consumes from it, in a line.
43
51
  - **Evidence and settled decisions:** only the decisions a worker could otherwise get wrong, one
44
52
  line each with its link. Do not retell the spec's decisions.
@@ -66,6 +66,7 @@ source: files
66
66
  Outcome:
67
67
  Boundaries:
68
68
  Change surface:
69
+ Target shape:
69
70
  Acceptance:
70
71
  Ground truth:
71
72
  Dependencies:
@@ -110,6 +111,7 @@ Status: ready | blocked
110
111
  ## Outcome
111
112
  ## Boundaries
112
113
  ## Change surface
114
+ ## Target shape
113
115
  ## Acceptance
114
116
  ## Ground truth
115
117
  ## Dependencies