@harness-engineering/cli 1.24.3 → 1.25.1

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 (116) hide show
  1. package/dist/agents/skills/claude-code/harness-architecture-advisor/SKILL.md +10 -6
  2. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +40 -5
  3. package/dist/agents/skills/claude-code/harness-git-workflow/SKILL.md +32 -11
  4. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +19 -0
  5. package/dist/agents/skills/claude-code/harness-skill-authoring/SKILL.md +42 -7
  6. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +25 -0
  7. package/dist/agents/skills/codex/harness-architecture-advisor/SKILL.md +10 -6
  8. package/dist/agents/skills/codex/harness-code-review/SKILL.md +40 -5
  9. package/dist/agents/skills/codex/harness-git-workflow/SKILL.md +32 -11
  10. package/dist/agents/skills/codex/harness-planning/SKILL.md +19 -0
  11. package/dist/agents/skills/codex/harness-skill-authoring/SKILL.md +42 -7
  12. package/dist/agents/skills/codex/harness-verification/SKILL.md +25 -0
  13. package/dist/agents/skills/cursor/harness-architecture-advisor/SKILL.md +10 -6
  14. package/dist/agents/skills/cursor/harness-code-review/SKILL.md +40 -5
  15. package/dist/agents/skills/cursor/harness-git-workflow/SKILL.md +32 -11
  16. package/dist/agents/skills/cursor/harness-planning/SKILL.md +19 -0
  17. package/dist/agents/skills/cursor/harness-skill-authoring/SKILL.md +42 -7
  18. package/dist/agents/skills/cursor/harness-verification/SKILL.md +25 -0
  19. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +10 -6
  20. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +40 -5
  21. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +32 -11
  22. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +19 -0
  23. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +42 -7
  24. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +25 -0
  25. package/dist/agents-md-MCUM4SIZ.js +10 -0
  26. package/dist/{architecture-FBSLURIB.js → architecture-HNIO6AUX.js} +6 -5
  27. package/dist/{assess-project-74UVWPMB.js → assess-project-6MV5TNY3.js} +2 -1
  28. package/dist/bin/harness-mcp.js +18 -17
  29. package/dist/bin/harness.js +47 -31
  30. package/dist/{check-phase-gate-WY6UICCL.js → check-phase-gate-VCBQHQAC.js} +6 -5
  31. package/dist/{chunk-Q3XYV5UC.js → chunk-47N6R2F4.js} +5 -1
  32. package/dist/{chunk-3XAPHB2Z.js → chunk-4NK7Z3BP.js} +1 -1
  33. package/dist/{chunk-I4QR3HNH.js → chunk-5BQ5BOJL.js} +5 -1
  34. package/dist/{chunk-LM5Z2WCA.js → chunk-6VZQJ5CX.js} +5 -1
  35. package/dist/{chunk-NV4FPO7J.js → chunk-AT74HEQM.js} +1 -1
  36. package/dist/{chunk-TDLOFNNQ.js → chunk-BOQRTARD.js} +1 -1
  37. package/dist/{chunk-ZAMT24QN.js → chunk-CJXVNDZZ.js} +1537 -737
  38. package/dist/{chunk-A737JDL4.js → chunk-CXJTVICF.js} +4 -4
  39. package/dist/{chunk-LOUH2LIC.js → chunk-EHRZMOQ2.js} +5 -1
  40. package/dist/{chunk-L5UONZ53.js → chunk-F23H3U5U.js} +6 -2
  41. package/dist/{chunk-YPKKEP3O.js → chunk-FES2YEQU.js} +9 -9
  42. package/dist/{chunk-SPTKLCKC.js → chunk-FIQL2HND.js} +6 -2
  43. package/dist/{chunk-FP53DDB5.js → chunk-FSNPBT74.js} +5 -1
  44. package/dist/{chunk-TB427QOK.js → chunk-GEEYCQDS.js} +13 -9
  45. package/dist/{chunk-ZOVATVQC.js → chunk-HIK6OEUF.js} +6 -1
  46. package/dist/chunk-K2SON7TI.js +5382 -0
  47. package/dist/chunk-KFQGP6VL.js +33 -0
  48. package/dist/{chunk-V2FGX2KD.js → chunk-M55DGGF3.js} +9 -5
  49. package/dist/{chunk-H4U2QNY2.js → chunk-MI6MA6OP.js} +16888 -13143
  50. package/dist/{chunk-YDRB55Q4.js → chunk-P7PANON5.js} +5 -1
  51. package/dist/chunk-RL4VMEXL.js +53 -0
  52. package/dist/{chunk-XNEMDKV5.js → chunk-RRHUCDRD.js} +1 -1
  53. package/dist/{chunk-O6UF33QH.js → chunk-RX7TUMBR.js} +320 -136
  54. package/dist/{chunk-3VYWO6QN.js → chunk-TYV4EUAD.js} +12 -8
  55. package/dist/{chunk-FJYP32IV.js → chunk-UQZBZINS.js} +6 -6
  56. package/dist/{chunk-UFQQBGC3.js → chunk-UV3BZMGT.js} +64 -3
  57. package/dist/{chunk-5PMRARB5.js → chunk-WIQA4BSH.js} +12 -5
  58. package/dist/{chunk-UQEUYRBP.js → chunk-WWACIIBA.js} +1 -1
  59. package/dist/{chunk-LVYPPKZI.js → chunk-XTITAVUR.js} +5 -1
  60. package/dist/{chunk-WEN5Z7CL.js → chunk-YTP2UDPV.js} +3 -3
  61. package/dist/ci-workflow-RTM7VVTD.js +10 -0
  62. package/dist/{constants-5JGUXPEK.js → constants-P4M3C2T3.js} +1 -0
  63. package/dist/{create-skill-QCXINA5Q.js → create-skill-6QWJHQYS.js} +3 -2
  64. package/dist/{dist-666AAZQ6.js → dist-3EWNRFFQ.js} +6 -1
  65. package/dist/{dist-RRMRZRV7.js → dist-ABTKRYZH.js} +1 -0
  66. package/dist/{dist-QW5G3GX3.js → dist-RADHOOXG.js} +4 -1
  67. package/dist/{dist-7EBSGAHX.js → dist-WCSJHQPK.js} +106 -3
  68. package/dist/{docs-H34GBVRS.js → docs-UBOGGHTY.js} +6 -5
  69. package/dist/engine-MJJAP5CH.js +10 -0
  70. package/dist/{entropy-ZAY73R6A.js → entropy-EMSXF2PX.js} +5 -4
  71. package/dist/{feedback-TMEGYMWU.js → feedback-ZLUX72HD.js} +2 -1
  72. package/dist/{generate-agent-definitions-PQPG6SX5.js → generate-agent-definitions-AWLPJ27C.js} +6 -5
  73. package/dist/{glob-helper-SRXMZPKM.js → glob-helper-VCQXK5XY.js} +2 -0
  74. package/dist/{graph-loader-M6FXJAKK.js → graph-loader-JHQVQRUS.js} +2 -1
  75. package/dist/hooks/adoption-tracker.js +189 -0
  76. package/dist/hooks/block-no-verify.js +50 -0
  77. package/dist/hooks/cost-tracker.js +66 -0
  78. package/dist/hooks/pre-compact-state.js +115 -0
  79. package/dist/hooks/profiles.ts +48 -0
  80. package/dist/hooks/protect-config.js +75 -0
  81. package/dist/hooks/quality-gate.js +131 -0
  82. package/dist/hooks/sentinel-post.js +159 -0
  83. package/dist/hooks/sentinel-pre.js +244 -0
  84. package/dist/hooks/telemetry-reporter.js +248 -0
  85. package/dist/index.d.ts +13 -7
  86. package/dist/index.js +30 -29
  87. package/dist/loader-JVSJZSWZ.js +12 -0
  88. package/dist/mcp-2553PNUC.js +38 -0
  89. package/dist/{performance-N67YJJDG.js → performance-7AGWJUY4.js} +6 -5
  90. package/dist/review-pipeline-ZWVQJTJX.js +13 -0
  91. package/dist/{runner-TY7DJGQV.js → runner-AAEF2TXY.js} +1 -0
  92. package/dist/runtime-D6YUQPP2.js +11 -0
  93. package/dist/{scan-U67OKDRS.js → scan-MPJ6JHUY.js} +2 -1
  94. package/dist/security-JLZUAQYT.js +14 -0
  95. package/dist/skill-executor-MOCUIAYS.js +9 -0
  96. package/dist/templates/base/.agnix.toml +16 -0
  97. package/dist/templates/orchestrator/WORKFLOW.md +55 -7
  98. package/dist/templates/orchestrator/template.json +1 -0
  99. package/dist/tool-tiers-7QGZ3FKY.js +98 -0
  100. package/dist/validate-TIIHRPMA.js +14 -0
  101. package/dist/validate-cross-check-ZOWFA3DB.js +10 -0
  102. package/dist/{version-KFFPOQAX.js → version-CUI434OP.js} +1 -0
  103. package/package.json +4 -4
  104. package/dist/agents-md-PBKKTSQY.js +0 -9
  105. package/dist/chunk-5LMZA5LZ.js +0 -38
  106. package/dist/chunk-OZIHPMA7.js +0 -5171
  107. package/dist/ci-workflow-QZRHAIO2.js +0 -9
  108. package/dist/engine-VUQEAJFZ.js +0 -9
  109. package/dist/loader-Y6A42WBD.js +0 -11
  110. package/dist/mcp-LCHC4NZ5.js +0 -37
  111. package/dist/review-pipeline-YXF5ITL2.js +0 -12
  112. package/dist/runtime-XNJUJCSG.js +0 -10
  113. package/dist/security-L2YN3CTI.js +0 -9
  114. package/dist/skill-executor-GA7BDX3F.js +0 -8
  115. package/dist/validate-MNE25KLZ.js +0 -13
  116. package/dist/validate-cross-check-Y4PDR63C.js +0 -9
@@ -273,6 +273,40 @@ metadata: # Provenance and authorship metadata
273
273
 
274
274
  3. **Test by running the skill:** `harness skill run <name>`. Verify it loads correctly and the process instructions make sense in context.
275
275
 
276
+ ### Phase 5B: TDD FOR SKILLS — Test Before Signing Off
277
+
278
+ Apply test-driven thinking to skill authoring. A skill is not complete until it has been tested against scenarios that exercise its discipline sections.
279
+
280
+ 1. **Write a test scenario.** Before declaring the skill complete, define 2-3 concrete scenarios that should trigger the skill's discipline mechanisms:
281
+ - One scenario that should trigger a Red Flag (if the skill has Red Flags)
282
+ - One scenario that should trigger a Rationalization rejection
283
+ - One scenario that should trigger a Gate (for rigid skills)
284
+
285
+ ```markdown
286
+ ## Skill Test Scenarios
287
+
288
+ ### Scenario 1: Red Flag — [quoted phrase from Red Flags section]
289
+
290
+ Input: [describe the situation]
291
+ Expected: Agent stops, cites the Red Flag, and takes corrective action
292
+
293
+ ### Scenario 2: Rationalization — [quoted phrase from Rationalizations section]
294
+
295
+ Input: [describe the tempting shortcut]
296
+ Expected: Agent rejects the rationalization and follows the prescribed process
297
+
298
+ ### Scenario 3: Gate — [gate condition]
299
+
300
+ Input: [describe a state that violates the gate]
301
+ Expected: Agent halts and does not proceed past the gate
302
+ ```
303
+
304
+ 2. **Mentally execute each scenario.** Walk through the skill's process with the test input. Does the skill's prose clearly direct the agent to the correct behavior? If not, the skill needs revision — not the test.
305
+
306
+ 3. **Check for gaps.** If you cannot construct a scenario that triggers a discipline section, the section may be too abstract. Revise it to include a concrete quoted phrase or condition.
307
+
308
+ 4. **Document test scenarios** in a comment block at the end of SKILL.md or in a companion `tests.md` file. These serve as regression tests for future skill edits.
309
+
276
310
  ### Skill Quality Checklist
277
311
 
278
312
  Evaluate every skill along two dimensions:
@@ -312,13 +346,14 @@ Use this checklist as a final quality gate before declaring a skill complete.
312
346
 
313
347
  ## Rationalizations to Reject
314
348
 
315
- | Rationalization | Reality |
316
- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
317
- | "This skill is too simple to need all required sections" | Every section exists for a reason. A short section is fine; a missing section means the skill was not fully thought through. |
318
- | "The process section covers it — no need for explicit success criteria" | Process describes what to do. Success criteria describe how to know it worked. They serve different purposes. |
319
- | "Rationalizations to Reject is meta — this skill does not need it" | This section is required for all user-facing skills, including this one. No exceptions. |
320
- | "I will add examples later once the skill is proven" | Examples are a required section. A skill without examples forces the agent to guess at correct behavior. Write at least one example now. |
321
- | "The When to Use section is obvious from the name" | Negative conditions (when NOT to use) prevent misapplication. The skill name conveys nothing about boundary conditions. |
349
+ | Rationalization | Reality |
350
+ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
351
+ | "This skill is too simple to need all required sections" | Every section exists for a reason. A short section is fine; a missing section means the skill was not fully thought through. |
352
+ | "The process section covers it — no need for explicit success criteria" | Process describes what to do. Success criteria describe how to know it worked. They serve different purposes. |
353
+ | "Rationalizations to Reject is meta — this skill does not need it" | This section is required for all user-facing skills, including this one. No exceptions. |
354
+ | "I will add examples later once the skill is proven" | Examples are a required section. A skill without examples forces the agent to guess at correct behavior. Write at least one example now. |
355
+ | "The When to Use section is obvious from the name" | Negative conditions (when NOT to use) prevent misapplication. The skill name conveys nothing about boundary conditions. |
356
+ | "The skill works — I tested it by running it once" | A single happy-path run does not test discipline sections. Write scenarios that trigger Red Flags, Gates, and Rationalizations. A skill that passes happy path but fails discipline scenarios is a trap. |
322
357
 
323
358
  ## Examples
324
359
 
@@ -259,6 +259,31 @@ Every verification claim MUST use one of:
259
259
 
260
260
  **Uncited claims:** Any verification assertion without direct evidence is a verification failure. This skill does not use `[UNVERIFIED]` -- if evidence cannot be produced, verdict is FAIL or INCOMPLETE.
261
261
 
262
+ ## Rubric Compression
263
+
264
+ Verification checklists passed to subagents or used internally MUST use compressed single-line format. Each check is one line with pipe-delimited fields:
265
+
266
+ ```
267
+ level|check-name|pass-criterion
268
+ ```
269
+
270
+ **Example (Level 2 SUBSTANTIVE rubric):**
271
+
272
+ ```
273
+ L2|no-stubs|No TODO/FIXME/throw-not-implemented in production code
274
+ L2|no-empty-bodies|No empty function bodies, () => {}, or return null as sole logic
275
+ L2|spec-complete|All behaviors specified in spec have corresponding implementation
276
+ L2|real-logic|Functions contain meaningful logic, not just hardcoded returns
277
+ ```
278
+
279
+ **Why:** Verbose checklist prose inflates verification context without improving accuracy. Dense single-line rubrics give the same signal in fewer tokens, leaving more budget for reading and analyzing actual file content.
280
+
281
+ **Rules:**
282
+
283
+ - Level prefix must be L1 (EXISTS), L2 (SUBSTANTIVE), or L3 (WIRED)
284
+ - Maximum 80 characters per criterion text
285
+ - Rubric entries are guidance — the verification levels define the authoritative checks
286
+
262
287
  ## Non-Determinism Tolerance
263
288
 
264
289
  Mechanical checks (tests, lint, types) are binary pass/fail. No tolerance.
@@ -47,7 +47,9 @@ Store answers in: .harness/architecture/<topic>/discovery.md
47
47
 
48
48
  ---
49
49
 
50
- ### Phase 2: ANALYZE — Research the Codebase
50
+ ### Phase 2: ANALYZE — Research the Codebase (Read-Only)
51
+
52
+ **Read-only research constraint:** This phase is discovery, not solution design. You may read files, search patterns, trace dependencies, and record observations. You may NOT propose solutions, recommend approaches, or evaluate trade-offs. If you catch yourself writing "we could..." or "one option is...", STOP — you have left research mode. Save solutions for Phase 3.
51
53
 
52
54
  Read the codebase to understand the current state. Do not propose solutions yet — gather facts.
53
55
 
@@ -272,6 +274,7 @@ Also link from the project's ADR index if one exists.
272
274
  - **Always 2-3 options.** Never present 1 option (that is a directive, not advice). Never present more than 3 (that causes paralysis).
273
275
  - **No implementation in this skill.** If you write production code, you have broken the advisory boundary. Stop and return to presenting options.
274
276
  - **Trade-offs must be honest.** Every option has downsides. If you cannot articulate the cons of an option, you do not understand it well enough to recommend it.
277
+ - **No solutions in Phase 2.** Phase 2 is read-only research. Observations and facts only. Solutions belong in Phase 3. Mixing discovery with solution design anchors on the first idea found.
275
278
 
276
279
  ## Evidence Requirements
277
280
 
@@ -309,11 +312,12 @@ These apply to ALL skills. If you catch yourself doing any of these, STOP.
309
312
 
310
313
  ## Rationalizations to Reject
311
314
 
312
- | Rationalization | Reality |
313
- | --------------------------------- | --------------------------------------------------------------------------------------------------- |
314
- | "This will be easier to maintain" | Easier for whom, and compared to what? Cite the maintenance burden with evidence from the codebase. |
315
- | "It's the modern approach" | Modernity is not a design criterion. Fitness for purpose is. State the specific benefit. |
316
- | "Other teams do it this way" | Other teams have different constraints. Evaluate the option on this codebase's specific merits. |
315
+ | Rationalization | Reality |
316
+ | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
317
+ | "This will be easier to maintain" | Easier for whom, and compared to what? Cite the maintenance burden with evidence from the codebase. |
318
+ | "It's the modern approach" | Modernity is not a design criterion. Fitness for purpose is. State the specific benefit. |
319
+ | "Other teams do it this way" | Other teams have different constraints. Evaluate the option on this codebase's specific merits. |
320
+ | "I can see the solution already, no need to finish research" | Premature convergence anchors on the first viable option. Complete Phase 2 research before proposing anything in Phase 3. The best option may not be the first one found. |
317
321
 
318
322
  ## Escalation
319
323
 
@@ -24,6 +24,12 @@ When no arguments are provided (standalone invocation), session slug is unknown
24
24
 
25
25
  ## Process
26
26
 
27
+ ### Iron Law
28
+
29
+ **Review identifies issues. Review never fixes them.**
30
+
31
+ A reviewer who applies fixes is no longer reviewing — they are editing with reviewer authority and no review. Suggest the fix in the finding. Do not apply it. If you catch yourself writing production code during review, STOP. You have crossed the boundary.
32
+
27
33
  The review runs as a 7-phase pipeline. Each phase has a clear input, output, and exit condition.
28
34
 
29
35
  ```
@@ -560,6 +566,32 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
560
566
 
561
567
  **Uncited claims:** Findings without evidence discarded in Phase 5. Observations without file:line references prefixed `[UNVERIFIED]` and downgraded to `suggestion`.
562
568
 
569
+ ## Rubric Compression
570
+
571
+ Review rubrics passed to subagents in Phase 4 MUST use compressed single-line format to minimize token consumption. Each rubric entry is one line with pipe-delimited fields:
572
+
573
+ ```
574
+ domain|check-name|severity|one-sentence-criterion
575
+ ```
576
+
577
+ **Example (Compliance Agent rubric):**
578
+
579
+ ```
580
+ compliance|spec-alignment|critical|Implementation matches all behaviors specified in the approved spec
581
+ compliance|api-surface|important|New exports are minimal and well-named; internal symbols stay unexported
582
+ compliance|backward-compat|critical|No breaking changes to existing callers without documented migration path
583
+ compliance|naming|suggestion|Names follow project conventions (check AGENTS.md or .eslintrc)
584
+ ```
585
+
586
+ **Why:** Verbose rubric prose inflates context by 2-5x without improving review accuracy. Dense single-line rubrics give the agent the same signal in fewer tokens, leaving more budget for actual code analysis.
587
+
588
+ **Rules:**
589
+
590
+ - Maximum 80 characters per criterion text
591
+ - Domain must match the subagent's scope (compliance, bug, security, architecture)
592
+ - Severity must be one of: critical, important, suggestion
593
+ - Rubric entries are guidance, not exhaustive — agents may surface findings outside the rubric
594
+
563
595
  ## Harness Integration
564
596
 
565
597
  - **`assess_project`** — Phase 2: run validate/deps/docs in parallel. Failures are Critical and stop pipeline.
@@ -644,6 +676,7 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
644
676
  - **Never implement feedback without verification.** Verify correctness before changing code. Do not blindly comply.
645
677
  - **Never agree performatively.** "Sure, I'll change that" without understanding is forbidden.
646
678
  - **Never skip the YAGNI check.** Every suggestion must serve a current, concrete need. Speculative improvements rejected.
679
+ - **Never apply fixes during review.** Review output is findings, not code changes. Suggest fixes in finding text; never edit production code. Iron Law violation.
647
680
 
648
681
  ## Red Flags
649
682
 
@@ -659,14 +692,16 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
659
692
  - **"Let me fix this issue I found"** -- Stop. Review identifies; it does not fix. Suggest the fix.
660
693
  - **"This is a minor style issue"** -- Stop. Style or readability/maintainability? Classify accurately.
661
694
  - **"The author probably meant to..."** -- Stop. Do not infer intent. Flag ambiguity as a question.
695
+ - **Comment replacing code** -- If a diff removes functional code and adds a comment (e.g., `// removed`, `// TODO: re-add`, `// no longer needed`), flag as Critical. Comments are not fixes. The code was either needed (removal is a bug) or not (remove silently). A comment replacing code is technical debt disguised as a change.
662
696
 
663
697
  ## Rationalizations to Reject
664
698
 
665
- | Rationalization | Reality |
666
- | --------------------------------------------------- | ------------------------------------------------------------------------------------------- |
667
- | "The tests pass, so the logic must be correct" | Tests can be incomplete. Review the logic independently of test results. |
668
- | "This is how it was done elsewhere in the codebase" | Existing patterns can be wrong. Evaluate the pattern on its merits, not just its precedent. |
669
- | "It's just a refactor, low risk" | Refactors change behavior surfaces. Review them with the same rigor as feature changes. |
699
+ | Rationalization | Reality |
700
+ | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
701
+ | "The tests pass, so the logic must be correct" | Tests can be incomplete. Review the logic independently of test results. |
702
+ | "This is how it was done elsewhere in the codebase" | Existing patterns can be wrong. Evaluate the pattern on its merits, not just its precedent. |
703
+ | "It's just a refactor, low risk" | Refactors change behavior surfaces. Review them with the same rigor as feature changes. |
704
+ | "The fix is trivial, I'll just apply it inline" | Trivial fixes still skip review when applied by the reviewer. Suggest the fix; let the author apply and re-review. Iron Law. |
670
705
 
671
706
  ## Escalation
672
707
 
@@ -139,7 +139,14 @@ git branch -d <branch-name>
139
139
  ```bash
140
140
  cd <worktree-path>
141
141
  git push -u origin <branch-name>
142
- gh pr create --title "<title>" --body "<description>"
142
+ gh pr create --title "<title>" --body "$(cat <<'EOF'
143
+ ## Summary
144
+ <PR body with real newlines — never use \n escape sequences>
145
+
146
+ ## Test plan
147
+ <checklist>
148
+ EOF
149
+ )"
143
150
  # Report the PR URL to the user
144
151
  # Leave worktree in place until PR is merged
145
152
  ```
@@ -158,6 +165,14 @@ git worktree remove <worktree-path>
158
165
  git branch -D <branch-name>
159
166
  ```
160
167
 
168
+ #### Step 3.5: Cross-Reference Conventions for Commit Messages and PR Bodies
169
+
170
+ GitHub auto-links any `#N` token in commit messages, PR titles, and PR bodies to the issue or PR with that number. Treat `#N` as a reserved sigil — never use it for non-issue references.
171
+
172
+ - **Do not** use `#N` for proposal success criteria, list ordinals, footnote refs, table rows, or any other in-document numbering. Write "criterion 9", "item 9", "step 3" instead. Using `#9` to mean "criterion 9" will silently cross-reference issue #9 — which is almost certainly an unrelated issue — and add a misleading back-reference to that issue's timeline.
173
+ - **Do** reference the actual roadmap/tracker issue when finishing work tied to one. Use `Refs #<issue>` for context-only links and `Closes #<issue>` / `Fixes #<issue>` only when the merge should auto-close that issue.
174
+ - **Before pushing or opening the PR**, scan the commit messages and PR body for stray `#N` tokens. For each one, confirm it points to the intended issue/PR — or rewrite it as plain text.
175
+
161
176
  #### Step 4: Clean Up
162
177
 
163
178
  1. **Remove the worktree** (unless keeping as-is or waiting for PR merge):
@@ -192,13 +207,14 @@ git branch -D <branch-name>
192
207
 
193
208
  ## Rationalizations to Reject
194
209
 
195
- | Rationalization | Reality |
196
- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
- | "The tests are probably fine on the fresh branch — they were passing on main when I last checked. I'll skip baseline verification and start working." | Baseline verification is the condition that makes branch work trustworthy. A test failure discovered at finish time is ambiguous — it could be pre-existing or introduced by the work. Skipping baseline removes the only clean comparison point. |
198
- | "The user said 'just merge it' — I'll merge without checking if the base branch has advanced since the worktree was created." | The pre-finish check for base branch divergence is mandatory before any finishing strategy. Merging without rebasing first can produce a merge that silently breaks tests that were passing on the branch but conflict with new commits on main. |
199
- | "The worktree directory isn't gitignored, but it's inside a nested folder that's unlikely to be committed accidentally." | The `.gitignore` check is not about likelihood — it is about preventing accidental commits of worktree state that would corrupt the repository. If the worktree directory is not gitignored, add it before creating the worktree. No exceptions. |
200
- | "The user chose to discard — I'll delete the branch and worktree immediately without showing the commits that will be lost." | The discard path requires showing the commit list from `git log main..HEAD --oneline` and receiving explicit confirmation before running `git worktree remove` and `git branch -D`. Work is being permanently deleted; the user must see what they are losing. |
201
- | "There's already a worktree for this branch at a different path — I'll create a second one since the user asked for a fresh setup." | Git does not allow two worktrees checked out to the same branch. Attempting to create a duplicate will fail. Instead, ask the user whether to use the existing worktree or create a new branch. Never assume a second worktree is the right answer. |
210
+ | Rationalization | Reality |
211
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
212
+ | "The tests are probably fine on the fresh branch — they were passing on main when I last checked. I'll skip baseline verification and start working." | Baseline verification is the condition that makes branch work trustworthy. A test failure discovered at finish time is ambiguous — it could be pre-existing or introduced by the work. Skipping baseline removes the only clean comparison point. |
213
+ | "The user said 'just merge it' — I'll merge without checking if the base branch has advanced since the worktree was created." | The pre-finish check for base branch divergence is mandatory before any finishing strategy. Merging without rebasing first can produce a merge that silently breaks tests that were passing on the branch but conflict with new commits on main. |
214
+ | "The worktree directory isn't gitignored, but it's inside a nested folder that's unlikely to be committed accidentally." | The `.gitignore` check is not about likelihood — it is about preventing accidental commits of worktree state that would corrupt the repository. If the worktree directory is not gitignored, add it before creating the worktree. No exceptions. |
215
+ | "The user chose to discard — I'll delete the branch and worktree immediately without showing the commits that will be lost." | The discard path requires showing the commit list from `git log main..HEAD --oneline` and receiving explicit confirmation before running `git worktree remove` and `git branch -D`. Work is being permanently deleted; the user must see what they are losing. |
216
+ | "There's already a worktree for this branch at a different path — I'll create a second one since the user asked for a fresh setup." | Git does not allow two worktrees checked out to the same branch. Attempting to create a duplicate will fail. Instead, ask the user whether to use the existing worktree or create a new branch. Never assume a second worktree is the right answer. |
217
+ | "I'll use `#9` in the commit message to refer to 'success criterion 9' in the proposal — it's obviously an in-document reference." | `#N` is GitHub's reserved syntax for issue/PR links in commits and PR bodies. It will auto-link to issue/PR #9 regardless of intent and post a misleading back-reference on that unrelated issue. Write "criterion 9" (no `#`) and cite the real roadmap issue separately with `Refs #<n>`. |
202
218
 
203
219
  ## Examples
204
220
 
@@ -251,9 +267,14 @@ npm test # still passes after rebase
251
267
 
252
268
  # User chooses: Push and create PR
253
269
  git push -u origin feat/notifications
254
- gh pr create --title "feat(notifications): email and in-app notifications" \
255
- --body "Implements notification service with create, list, and expiry.
256
- 16 new tests. All passing."
270
+ gh pr create --title "feat(notifications): email and in-app notifications" --body "$(cat <<'EOF'
271
+ ## Summary
272
+ Implements notification service with create, list, and expiry.
273
+
274
+ ## Test plan
275
+ - [x] 16 new tests, all passing
276
+ EOF
277
+ )"
257
278
 
258
279
  # Report: "PR created: https://github.com/org/repo/pull/42
259
280
  # Worktree at .worktrees/notifications kept until PR merges."
@@ -61,6 +61,22 @@ Work backward from the goal. Start with "what must be true when we are done?"
61
61
  4. **Identify key links.** How do artifacts connect? What imports what? What calls what?
62
62
  5. **Apply YAGNI.** For every artifact: "Is this required for an observable truth?" If not, cut it.
63
63
 
64
+ 6. **Surface uncertainties.** Before proceeding to Phase 2, explicitly list what you do NOT know. For each uncertainty, classify it:
65
+ - **Blocking:** Cannot decompose tasks without resolving this. Escalate to user.
66
+ - **Assumption:** Can proceed with a stated assumption. Document it. If wrong, specific tasks will need revision.
67
+ - **Deferrable:** Does not affect task decomposition. Note for execution phase.
68
+
69
+ Format:
70
+
71
+ ```
72
+ ## Uncertainties
73
+ - [BLOCKING] How should the API handle partial failures? (Spec does not define.)
74
+ - [ASSUMPTION] Database supports transactions. (If not, Task 3 needs redesign.)
75
+ - [DEFERRABLE] Exact error message wording. (Can be finalized during implementation.)
76
+ ```
77
+
78
+ **Read-only constraint:** Steps 1-5 above are research and analysis. Do not propose task structure, file organization, or implementation approaches during SCOPE. Record what must be true (observable truths) and what you do not know (uncertainties). Solutions belong in DECOMPOSE.
79
+
64
80
  When scope is ambiguous, use `emit_interaction`:
65
81
 
66
82
  ```json
@@ -335,6 +351,8 @@ Only apply when modifying existing documented behavior. When `docs/changes/` exi
335
351
  | "Tests for this task can be added in a follow-up task since the implementation is straightforward" | No skipping TDD in tasks. Every code-producing task must start with writing a test. "Add tests later" is explicitly forbidden. |
336
352
  | "The spec does not cover this edge case, but I can fill in the gap during planning" | When the spec is missing information, do not fill in the gaps yourself. Escalate. Filling gaps silently creates undocumented design decisions that no one reviewed. |
337
353
  | "I discovered we need an additional file during decomposition, but updating the file map is just bookkeeping" | The file map must be complete. Every file that will be created or modified must appear in the file map before task decomposition. |
354
+ | "There are no real uncertainties — the spec is clear enough" | Every plan has unknowns. If you listed zero uncertainties, you skipped the step. Re-read the spec and list what is assumed but not stated. |
355
+ | "I already know how to structure this, no need to finish scoping" | Premature decomposition anchors on the first approach found. Complete SCOPE (observable truths + uncertainties) before proposing any task structure. |
338
356
 
339
357
  ## Examples
340
358
 
@@ -399,6 +417,7 @@ Files: src/types/notification.ts
399
417
  - **No plan without observable truths.** Must start with goal-backward acceptance criteria.
400
418
  - **No implementation during planning.** Write the plan, get approval, then use harness-execution.
401
419
  - **File map must be complete.** Every file to create or modify must appear before task decomposition.
420
+ - **Uncertainties must be surfaced.** Phase 1 must produce an uncertainties list. Zero uncertainties means the step was skipped. Blocking uncertainties must be resolved before Phase 2.
402
421
 
403
422
  ## Escalation
404
423
 
@@ -273,6 +273,40 @@ metadata: # Provenance and authorship metadata
273
273
 
274
274
  3. **Test by running the skill:** `harness skill run <name>`. Verify it loads correctly and the process instructions make sense in context.
275
275
 
276
+ ### Phase 5B: TDD FOR SKILLS — Test Before Signing Off
277
+
278
+ Apply test-driven thinking to skill authoring. A skill is not complete until it has been tested against scenarios that exercise its discipline sections.
279
+
280
+ 1. **Write a test scenario.** Before declaring the skill complete, define 2-3 concrete scenarios that should trigger the skill's discipline mechanisms:
281
+ - One scenario that should trigger a Red Flag (if the skill has Red Flags)
282
+ - One scenario that should trigger a Rationalization rejection
283
+ - One scenario that should trigger a Gate (for rigid skills)
284
+
285
+ ```markdown
286
+ ## Skill Test Scenarios
287
+
288
+ ### Scenario 1: Red Flag — [quoted phrase from Red Flags section]
289
+
290
+ Input: [describe the situation]
291
+ Expected: Agent stops, cites the Red Flag, and takes corrective action
292
+
293
+ ### Scenario 2: Rationalization — [quoted phrase from Rationalizations section]
294
+
295
+ Input: [describe the tempting shortcut]
296
+ Expected: Agent rejects the rationalization and follows the prescribed process
297
+
298
+ ### Scenario 3: Gate — [gate condition]
299
+
300
+ Input: [describe a state that violates the gate]
301
+ Expected: Agent halts and does not proceed past the gate
302
+ ```
303
+
304
+ 2. **Mentally execute each scenario.** Walk through the skill's process with the test input. Does the skill's prose clearly direct the agent to the correct behavior? If not, the skill needs revision — not the test.
305
+
306
+ 3. **Check for gaps.** If you cannot construct a scenario that triggers a discipline section, the section may be too abstract. Revise it to include a concrete quoted phrase or condition.
307
+
308
+ 4. **Document test scenarios** in a comment block at the end of SKILL.md or in a companion `tests.md` file. These serve as regression tests for future skill edits.
309
+
276
310
  ### Skill Quality Checklist
277
311
 
278
312
  Evaluate every skill along two dimensions:
@@ -312,13 +346,14 @@ Use this checklist as a final quality gate before declaring a skill complete.
312
346
 
313
347
  ## Rationalizations to Reject
314
348
 
315
- | Rationalization | Reality |
316
- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
317
- | "This skill is too simple to need all required sections" | Every section exists for a reason. A short section is fine; a missing section means the skill was not fully thought through. |
318
- | "The process section covers it — no need for explicit success criteria" | Process describes what to do. Success criteria describe how to know it worked. They serve different purposes. |
319
- | "Rationalizations to Reject is meta — this skill does not need it" | This section is required for all user-facing skills, including this one. No exceptions. |
320
- | "I will add examples later once the skill is proven" | Examples are a required section. A skill without examples forces the agent to guess at correct behavior. Write at least one example now. |
321
- | "The When to Use section is obvious from the name" | Negative conditions (when NOT to use) prevent misapplication. The skill name conveys nothing about boundary conditions. |
349
+ | Rationalization | Reality |
350
+ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
351
+ | "This skill is too simple to need all required sections" | Every section exists for a reason. A short section is fine; a missing section means the skill was not fully thought through. |
352
+ | "The process section covers it — no need for explicit success criteria" | Process describes what to do. Success criteria describe how to know it worked. They serve different purposes. |
353
+ | "Rationalizations to Reject is meta — this skill does not need it" | This section is required for all user-facing skills, including this one. No exceptions. |
354
+ | "I will add examples later once the skill is proven" | Examples are a required section. A skill without examples forces the agent to guess at correct behavior. Write at least one example now. |
355
+ | "The When to Use section is obvious from the name" | Negative conditions (when NOT to use) prevent misapplication. The skill name conveys nothing about boundary conditions. |
356
+ | "The skill works — I tested it by running it once" | A single happy-path run does not test discipline sections. Write scenarios that trigger Red Flags, Gates, and Rationalizations. A skill that passes happy path but fails discipline scenarios is a trap. |
322
357
 
323
358
  ## Examples
324
359
 
@@ -259,6 +259,31 @@ Every verification claim MUST use one of:
259
259
 
260
260
  **Uncited claims:** Any verification assertion without direct evidence is a verification failure. This skill does not use `[UNVERIFIED]` -- if evidence cannot be produced, verdict is FAIL or INCOMPLETE.
261
261
 
262
+ ## Rubric Compression
263
+
264
+ Verification checklists passed to subagents or used internally MUST use compressed single-line format. Each check is one line with pipe-delimited fields:
265
+
266
+ ```
267
+ level|check-name|pass-criterion
268
+ ```
269
+
270
+ **Example (Level 2 SUBSTANTIVE rubric):**
271
+
272
+ ```
273
+ L2|no-stubs|No TODO/FIXME/throw-not-implemented in production code
274
+ L2|no-empty-bodies|No empty function bodies, () => {}, or return null as sole logic
275
+ L2|spec-complete|All behaviors specified in spec have corresponding implementation
276
+ L2|real-logic|Functions contain meaningful logic, not just hardcoded returns
277
+ ```
278
+
279
+ **Why:** Verbose checklist prose inflates verification context without improving accuracy. Dense single-line rubrics give the same signal in fewer tokens, leaving more budget for reading and analyzing actual file content.
280
+
281
+ **Rules:**
282
+
283
+ - Level prefix must be L1 (EXISTS), L2 (SUBSTANTIVE), or L3 (WIRED)
284
+ - Maximum 80 characters per criterion text
285
+ - Rubric entries are guidance — the verification levels define the authoritative checks
286
+
262
287
  ## Non-Determinism Tolerance
263
288
 
264
289
  Mechanical checks (tests, lint, types) are binary pass/fail. No tolerance.
@@ -47,7 +47,9 @@ Store answers in: .harness/architecture/<topic>/discovery.md
47
47
 
48
48
  ---
49
49
 
50
- ### Phase 2: ANALYZE — Research the Codebase
50
+ ### Phase 2: ANALYZE — Research the Codebase (Read-Only)
51
+
52
+ **Read-only research constraint:** This phase is discovery, not solution design. You may read files, search patterns, trace dependencies, and record observations. You may NOT propose solutions, recommend approaches, or evaluate trade-offs. If you catch yourself writing "we could..." or "one option is...", STOP — you have left research mode. Save solutions for Phase 3.
51
53
 
52
54
  Read the codebase to understand the current state. Do not propose solutions yet — gather facts.
53
55
 
@@ -272,6 +274,7 @@ Also link from the project's ADR index if one exists.
272
274
  - **Always 2-3 options.** Never present 1 option (that is a directive, not advice). Never present more than 3 (that causes paralysis).
273
275
  - **No implementation in this skill.** If you write production code, you have broken the advisory boundary. Stop and return to presenting options.
274
276
  - **Trade-offs must be honest.** Every option has downsides. If you cannot articulate the cons of an option, you do not understand it well enough to recommend it.
277
+ - **No solutions in Phase 2.** Phase 2 is read-only research. Observations and facts only. Solutions belong in Phase 3. Mixing discovery with solution design anchors on the first idea found.
275
278
 
276
279
  ## Evidence Requirements
277
280
 
@@ -309,11 +312,12 @@ These apply to ALL skills. If you catch yourself doing any of these, STOP.
309
312
 
310
313
  ## Rationalizations to Reject
311
314
 
312
- | Rationalization | Reality |
313
- | --------------------------------- | --------------------------------------------------------------------------------------------------- |
314
- | "This will be easier to maintain" | Easier for whom, and compared to what? Cite the maintenance burden with evidence from the codebase. |
315
- | "It's the modern approach" | Modernity is not a design criterion. Fitness for purpose is. State the specific benefit. |
316
- | "Other teams do it this way" | Other teams have different constraints. Evaluate the option on this codebase's specific merits. |
315
+ | Rationalization | Reality |
316
+ | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
317
+ | "This will be easier to maintain" | Easier for whom, and compared to what? Cite the maintenance burden with evidence from the codebase. |
318
+ | "It's the modern approach" | Modernity is not a design criterion. Fitness for purpose is. State the specific benefit. |
319
+ | "Other teams do it this way" | Other teams have different constraints. Evaluate the option on this codebase's specific merits. |
320
+ | "I can see the solution already, no need to finish research" | Premature convergence anchors on the first viable option. Complete Phase 2 research before proposing anything in Phase 3. The best option may not be the first one found. |
317
321
 
318
322
  ## Escalation
319
323
 
@@ -24,6 +24,12 @@ When no arguments are provided (standalone invocation), session slug is unknown
24
24
 
25
25
  ## Process
26
26
 
27
+ ### Iron Law
28
+
29
+ **Review identifies issues. Review never fixes them.**
30
+
31
+ A reviewer who applies fixes is no longer reviewing — they are editing with reviewer authority and no review. Suggest the fix in the finding. Do not apply it. If you catch yourself writing production code during review, STOP. You have crossed the boundary.
32
+
27
33
  The review runs as a 7-phase pipeline. Each phase has a clear input, output, and exit condition.
28
34
 
29
35
  ```
@@ -560,6 +566,32 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
560
566
 
561
567
  **Uncited claims:** Findings without evidence discarded in Phase 5. Observations without file:line references prefixed `[UNVERIFIED]` and downgraded to `suggestion`.
562
568
 
569
+ ## Rubric Compression
570
+
571
+ Review rubrics passed to subagents in Phase 4 MUST use compressed single-line format to minimize token consumption. Each rubric entry is one line with pipe-delimited fields:
572
+
573
+ ```
574
+ domain|check-name|severity|one-sentence-criterion
575
+ ```
576
+
577
+ **Example (Compliance Agent rubric):**
578
+
579
+ ```
580
+ compliance|spec-alignment|critical|Implementation matches all behaviors specified in the approved spec
581
+ compliance|api-surface|important|New exports are minimal and well-named; internal symbols stay unexported
582
+ compliance|backward-compat|critical|No breaking changes to existing callers without documented migration path
583
+ compliance|naming|suggestion|Names follow project conventions (check AGENTS.md or .eslintrc)
584
+ ```
585
+
586
+ **Why:** Verbose rubric prose inflates context by 2-5x without improving review accuracy. Dense single-line rubrics give the agent the same signal in fewer tokens, leaving more budget for actual code analysis.
587
+
588
+ **Rules:**
589
+
590
+ - Maximum 80 characters per criterion text
591
+ - Domain must match the subagent's scope (compliance, bug, security, architecture)
592
+ - Severity must be one of: critical, important, suggestion
593
+ - Rubric entries are guidance, not exhaustive — agents may surface findings outside the rubric
594
+
563
595
  ## Harness Integration
564
596
 
565
597
  - **`assess_project`** — Phase 2: run validate/deps/docs in parallel. Failures are Critical and stop pipeline.
@@ -644,6 +676,7 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
644
676
  - **Never implement feedback without verification.** Verify correctness before changing code. Do not blindly comply.
645
677
  - **Never agree performatively.** "Sure, I'll change that" without understanding is forbidden.
646
678
  - **Never skip the YAGNI check.** Every suggestion must serve a current, concrete need. Speculative improvements rejected.
679
+ - **Never apply fixes during review.** Review output is findings, not code changes. Suggest fixes in finding text; never edit production code. Iron Law violation.
647
680
 
648
681
  ## Red Flags
649
682
 
@@ -659,14 +692,16 @@ Every `ReviewFinding.evidence` array MUST include citations using one of:
659
692
  - **"Let me fix this issue I found"** -- Stop. Review identifies; it does not fix. Suggest the fix.
660
693
  - **"This is a minor style issue"** -- Stop. Style or readability/maintainability? Classify accurately.
661
694
  - **"The author probably meant to..."** -- Stop. Do not infer intent. Flag ambiguity as a question.
695
+ - **Comment replacing code** -- If a diff removes functional code and adds a comment (e.g., `// removed`, `// TODO: re-add`, `// no longer needed`), flag as Critical. Comments are not fixes. The code was either needed (removal is a bug) or not (remove silently). A comment replacing code is technical debt disguised as a change.
662
696
 
663
697
  ## Rationalizations to Reject
664
698
 
665
- | Rationalization | Reality |
666
- | --------------------------------------------------- | ------------------------------------------------------------------------------------------- |
667
- | "The tests pass, so the logic must be correct" | Tests can be incomplete. Review the logic independently of test results. |
668
- | "This is how it was done elsewhere in the codebase" | Existing patterns can be wrong. Evaluate the pattern on its merits, not just its precedent. |
669
- | "It's just a refactor, low risk" | Refactors change behavior surfaces. Review them with the same rigor as feature changes. |
699
+ | Rationalization | Reality |
700
+ | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
701
+ | "The tests pass, so the logic must be correct" | Tests can be incomplete. Review the logic independently of test results. |
702
+ | "This is how it was done elsewhere in the codebase" | Existing patterns can be wrong. Evaluate the pattern on its merits, not just its precedent. |
703
+ | "It's just a refactor, low risk" | Refactors change behavior surfaces. Review them with the same rigor as feature changes. |
704
+ | "The fix is trivial, I'll just apply it inline" | Trivial fixes still skip review when applied by the reviewer. Suggest the fix; let the author apply and re-review. Iron Law. |
670
705
 
671
706
  ## Escalation
672
707