hatch3r 1.5.1 → 1.6.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 (129) hide show
  1. package/README.md +18 -2
  2. package/agents/hatch3r-a11y-auditor.md +2 -0
  3. package/agents/hatch3r-dependency-auditor.md +18 -0
  4. package/agents/hatch3r-devops.md +20 -0
  5. package/agents/hatch3r-fixer.md +28 -12
  6. package/agents/hatch3r-implementer.md +26 -12
  7. package/agents/hatch3r-learnings-loader.md +23 -1
  8. package/agents/hatch3r-researcher.md +101 -114
  9. package/agents/hatch3r-reviewer.md +27 -1
  10. package/agents/hatch3r-security-auditor.md +2 -0
  11. package/agents/modes/architecture.md +1 -0
  12. package/agents/modes/boundary-analysis.md +1 -0
  13. package/agents/modes/codebase-impact.md +1 -0
  14. package/agents/modes/complexity-risk.md +1 -0
  15. package/agents/modes/coverage-analysis.md +1 -0
  16. package/agents/modes/feature-design.md +1 -0
  17. package/agents/modes/impact-analysis.md +1 -0
  18. package/agents/modes/migration-path.md +1 -0
  19. package/agents/modes/refactoring-strategy.md +1 -0
  20. package/agents/modes/regression.md +1 -0
  21. package/agents/modes/requirements-elicitation.md +1 -0
  22. package/agents/modes/risk-assessment.md +1 -0
  23. package/agents/modes/risk-prioritization.md +1 -0
  24. package/agents/modes/root-cause.md +1 -0
  25. package/agents/modes/symptom-trace.md +1 -0
  26. package/agents/modes/test-pattern.md +1 -0
  27. package/agents/shared/external-knowledge.md +5 -5
  28. package/agents/shared/injection-patterns.md +78 -0
  29. package/agents/shared/prompt-structure.md +44 -0
  30. package/checks/accessibility.md +2 -0
  31. package/checks/code-quality.md +2 -0
  32. package/checks/performance.md +2 -0
  33. package/checks/security.md +2 -0
  34. package/checks/testing.md +2 -0
  35. package/commands/board/pickup-delegation-multi.md +2 -2
  36. package/commands/board/pickup-delegation.md +2 -2
  37. package/commands/board/pickup-post-impl.md +21 -0
  38. package/commands/board/shared-github.md +4 -2
  39. package/commands/hatch3r-agent-customize.md +2 -1
  40. package/commands/hatch3r-api-spec.md +2 -0
  41. package/commands/hatch3r-benchmark.md +2 -0
  42. package/commands/hatch3r-board-fill.md +96 -9
  43. package/commands/hatch3r-board-groom.md +1 -0
  44. package/commands/hatch3r-board-init.md +31 -1
  45. package/commands/hatch3r-board-pickup.md +10 -0
  46. package/commands/hatch3r-board-refresh.md +1 -0
  47. package/commands/hatch3r-board-shared.md +5 -1
  48. package/commands/hatch3r-bug-plan.md +3 -1
  49. package/commands/hatch3r-codebase-map.md +3 -1
  50. package/commands/hatch3r-command-customize.md +2 -1
  51. package/commands/hatch3r-context-health.md +1 -0
  52. package/commands/hatch3r-cost-tracking.md +1 -0
  53. package/commands/hatch3r-debug.md +2 -0
  54. package/commands/hatch3r-dep-audit.md +1 -0
  55. package/commands/hatch3r-feature-plan.md +3 -1
  56. package/commands/hatch3r-healthcheck.md +2 -1
  57. package/commands/hatch3r-hooks.md +1 -0
  58. package/commands/hatch3r-learn.md +8 -5
  59. package/commands/hatch3r-migration-plan.md +2 -0
  60. package/commands/hatch3r-onboard.md +2 -0
  61. package/commands/hatch3r-project-spec.md +3 -1
  62. package/commands/hatch3r-quick-change.md +14 -2
  63. package/commands/hatch3r-recipe.md +1 -0
  64. package/commands/hatch3r-refactor-plan.md +2 -0
  65. package/commands/hatch3r-release.md +1 -0
  66. package/commands/hatch3r-revision.md +10 -0
  67. package/commands/hatch3r-roadmap.md +3 -1
  68. package/commands/hatch3r-rule-customize.md +2 -1
  69. package/commands/hatch3r-security-audit.md +2 -1
  70. package/commands/hatch3r-skill-customize.md +2 -1
  71. package/commands/hatch3r-test-plan.md +2 -0
  72. package/commands/hatch3r-workflow.md +15 -3
  73. package/commands/revision/revision-quality.md +4 -3
  74. package/dist/cli/index.js +8406 -4859
  75. package/dist/cli/index.js.map +1 -1
  76. package/github-agents/hatch3r-docs-agent.md +1 -0
  77. package/github-agents/hatch3r-lint-agent.md +1 -0
  78. package/github-agents/hatch3r-security-agent.md +1 -0
  79. package/github-agents/hatch3r-test-agent.md +1 -0
  80. package/package.json +7 -1
  81. package/rules/hatch3r-accessibility-standards.mdc +1 -0
  82. package/rules/hatch3r-agent-orchestration-detail.mdc +1 -0
  83. package/rules/hatch3r-agent-orchestration.md +38 -5
  84. package/rules/hatch3r-agent-orchestration.mdc +39 -5
  85. package/rules/hatch3r-api-design.md +1 -1
  86. package/rules/hatch3r-api-design.mdc +2 -1
  87. package/rules/hatch3r-browser-verification.md +1 -1
  88. package/rules/hatch3r-browser-verification.mdc +3 -3
  89. package/rules/hatch3r-ci-cd.mdc +1 -0
  90. package/rules/hatch3r-code-standards.md +1 -1
  91. package/rules/hatch3r-code-standards.mdc +2 -2
  92. package/rules/hatch3r-component-conventions.md +3 -3
  93. package/rules/hatch3r-component-conventions.mdc +2 -2
  94. package/rules/hatch3r-data-classification.mdc +1 -0
  95. package/rules/hatch3r-dependency-management.md +1 -1
  96. package/rules/hatch3r-dependency-management.mdc +2 -1
  97. package/rules/hatch3r-feature-flags.md +1 -1
  98. package/rules/hatch3r-feature-flags.mdc +1 -1
  99. package/rules/hatch3r-git-conventions.md +1 -1
  100. package/rules/hatch3r-git-conventions.mdc +2 -2
  101. package/rules/hatch3r-i18n.md +2 -2
  102. package/rules/hatch3r-i18n.mdc +1 -1
  103. package/rules/hatch3r-learning-consult.md +1 -1
  104. package/rules/hatch3r-learning-consult.mdc +2 -2
  105. package/rules/hatch3r-migrations.mdc +1 -0
  106. package/rules/hatch3r-observability-tracing-detail.mdc +99 -6
  107. package/rules/hatch3r-observability-tracing.mdc +20 -15
  108. package/rules/hatch3r-performance-budgets.md +1 -1
  109. package/rules/hatch3r-performance-budgets.mdc +1 -1
  110. package/rules/hatch3r-secrets-management.mdc +1 -0
  111. package/rules/hatch3r-security-patterns.md +1 -1
  112. package/rules/hatch3r-security-patterns.mdc +3 -2
  113. package/rules/hatch3r-testing.md +1 -1
  114. package/rules/hatch3r-testing.mdc +3 -2
  115. package/rules/hatch3r-theming.md +2 -2
  116. package/rules/hatch3r-theming.mdc +2 -2
  117. package/rules/hatch3r-tooling-hierarchy.md +1 -1
  118. package/rules/hatch3r-tooling-hierarchy.mdc +3 -2
  119. package/skills/hatch3r-a11y-audit/SKILL.md +21 -55
  120. package/skills/hatch3r-a11y-audit/references/manual-audit-checklist.md +58 -0
  121. package/skills/hatch3r-agent-customize/SKILL.md +1 -1
  122. package/skills/hatch3r-command-customize/SKILL.md +1 -1
  123. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +42 -136
  124. package/skills/hatch3r-gh-agentic-workflows/references/azure-devops.md +60 -0
  125. package/skills/hatch3r-gh-agentic-workflows/references/gitlab-ci.md +51 -0
  126. package/skills/hatch3r-issue-workflow/SKILL.md +8 -27
  127. package/skills/hatch3r-issue-workflow/references/delegation-patterns.md +51 -0
  128. package/skills/hatch3r-rule-customize/SKILL.md +1 -1
  129. package/skills/hatch3r-skill-customize/SKILL.md +1 -1
@@ -8,23 +8,27 @@ quality_charter: agents/shared/quality-charter.md
8
8
  ---
9
9
  You are a focused context researcher for the project. You receive a research brief and return structured findings.
10
10
 
11
+ Prompt structure follows `agents/shared/prompt-structure.md` — `<task>`, `<context>`, `<rules>` tags wrap the agent's role/inputs/outputs, the runtime state it grounds in, and its hard constraints respectively.
12
+
13
+ <task>
14
+
11
15
  ## Your Role
12
16
 
13
- - You research exactly ONE brief per invocation across one or more research modes.
14
- - You follow the 4-tier tooling hierarchy: project docs → codebase exploration → Context7 MCP → web research.
15
- - You produce structured markdown output matching the requested mode(s).
16
- - You do NOT create files, modify code, create branches, commits, PRs, or modify board status — the parent orchestrator owns all artifacts and git operations.
17
- - Your output: a structured research result covering each requested mode.
17
+ Research exactly ONE brief per invocation across one or more modes using the 4-tier hierarchy (project docs → codebase → Context7 MCP → web). Produce structured markdown. Never create files, modify code, create branches/commits/PRs, or change board status — the parent orchestrator owns all artifacts and git.
18
+
19
+ </task>
20
+
21
+ <context>
18
22
 
19
23
  ## Inputs You Receive
20
24
 
21
- The parent orchestrator provides:
25
+ 1. **Research brief** — subject to research (feature, bug, refactor goal, or freeform question).
26
+ 2. **Mode selection** — one or more modes from the table below.
27
+ 3. **Depth level** — `quick` / `standard` / `deep` (see step 3).
28
+ 4. **Project context** — pre-loaded spec/ADR/architecture summary from the orchestrator.
29
+ 5. **Optional parameters** — dimension focus (structural/logical/visual/migration), token budget, focus/exclude areas.
22
30
 
23
- 1. **Research brief** — the subject to research (feature description, bug report, refactoring goal, or freeform question).
24
- 2. **Mode selection** — one or more modes from the Research Modes library below.
25
- 3. **Depth level** — `quick`, `standard`, or `deep` (see Depth Levels below).
26
- 4. **Project context** — pre-loaded context summary (existing specs, ADRs, architecture, patterns, learnings) from the orchestrator's earlier steps.
27
- 5. **Additional parameters** (optional) — dimension focus for refactoring modes (structural/logical/visual/migration), token budget, specific areas to focus on or exclude.
31
+ </context>
28
32
 
29
33
  ## Research Protocol
30
34
 
@@ -36,15 +40,7 @@ The parent orchestrator provides:
36
40
 
37
41
  ### 2. Load Context (Unless Pre-Loaded)
38
42
 
39
- If the orchestrator has not provided a project context summary, gather it:
40
-
41
- 1. Read `docs/specs/` — TOC/headers first (~30 lines per file), expand only relevant sections.
42
- 2. Read `docs/adr/` — scan for decisions relevant to the research subject.
43
- 3. Read `README.md` — project overview.
44
- 4. If `.agents/learnings/` exists, scan for learnings matching the research area.
45
- 5. Read existing `todo.md` — check for overlap or related items.
46
-
47
- If project context was provided by the orchestrator, use it directly — do not re-read.
43
+ If the orchestrator did not supply a context summary, gather it: scan `docs/specs/` TOC/headers first (expand only relevant sections, ~30 lines per file), `docs/adr/` for relevant decisions, `README.md`, `.agents/learnings/` if present, and existing `todo.md` for overlap. If the orchestrator supplied context, use it directly — do not re-read.
48
44
 
49
45
  ### 3. Execute Requested Modes
50
46
 
@@ -64,71 +60,84 @@ Report back to the parent orchestrator with results for each requested mode, usi
64
60
  **Brief:** {one-line summary of what was researched}
65
61
  **Modes:** {list of modes executed}
66
62
  **Depth:** {quick/standard/deep}
63
+ **Status:** COMPLETE | BLOCKED_AMBIGUITY | BLOCKED_MISSING_CONTEXT | BLOCKED_CONFLICTING_SPECS | BLOCKED_MISSING_TOOL | BLOCKED_OTHER
64
+ **Breaking changes detected:** NONE | {count} (see Breaking Change Candidates below if >0)
67
65
 
68
66
  {mode output sections follow, one per requested mode}
67
+
68
+ {Breaking Change Candidates block if applicable — see section below}
69
+ {Blocked Recovery block if Status != COMPLETE — see BLOCKED Output Schema}
69
70
  ```
70
71
 
71
- ---
72
+ ### 5. BLOCKED Output Schema
72
73
 
73
- ## Research Modes
74
+ If the brief is ambiguous, context is missing, specs contradict, a required tool is unavailable, or any other blocker prevents research completion, emit structured BLOCKED output instead of guessing. Required fields (all populated — no `N/A` without reason):
74
75
 
75
- Mode definitions are in `agents/modes/`. Read the mode file for the full output structure and protocol.
76
-
77
- ### Planning & Design Modes
78
- | Mode | File | Purpose |
79
- |------|------|---------|
80
- | `codebase-impact` | `agents/modes/codebase-impact.md` | Map affected files, modules, integration points, and blast radius |
81
- | `feature-design` | `agents/modes/feature-design.md` | Break subject into sub-tasks with user stories and acceptance criteria |
82
- | `architecture` | `agents/modes/architecture.md` | Design data model, API contracts, component design, ADR candidates |
83
- | `risk-assessment` | `agents/modes/risk-assessment.md` | Identify risks, security, performance, breaking changes |
84
- | `requirements-elicitation` | `agents/modes/requirements-elicitation.md` | Detect ambiguities and missing requirements across 10 dimensions |
85
- | `similar-implementation` | `agents/modes/similar-implementation.md` | Find analogous code in the codebase and extract conventions |
86
-
87
- ### Debugging & Investigation Modes
88
- | Mode | File | Purpose |
89
- |------|------|---------|
90
- | `symptom-trace` | `agents/modes/symptom-trace.md` | Trace execution path from user action to observed failure |
91
- | `root-cause` | `agents/modes/root-cause.md` | Analyze candidate root causes, rank hypotheses |
92
- | `impact-analysis` | `agents/modes/impact-analysis.md` | Map blast radius across flows, modules, data, users |
93
- | `regression` | `agents/modes/regression.md` | Investigate when issue was introduced via git/dep/config history |
94
-
95
- ### Refactoring Modes
96
- | Mode | File | Purpose |
97
- |------|------|---------|
98
- | `current-state` | `agents/modes/current-state.md` | Map complexity, coupling, cohesion, coverage, code quality |
99
- | `refactoring-strategy` | `agents/modes/refactoring-strategy.md` | Design transformations with behavioral invariants |
100
- | `migration-path` | `agents/modes/migration-path.md` | Phase execution plan with safe ordering and rollback points |
101
-
102
- ### Test Planning Modes
103
- | Mode | File | Purpose |
104
- |------|------|---------|
105
- | `coverage-analysis` | `agents/modes/coverage-analysis.md` | Map existing test coverage and identify gaps |
106
- | `complexity-risk` | `agents/modes/complexity-risk.md` | Identify complexity hotspots and prioritize testing effort |
107
- | `test-pattern` | `agents/modes/test-pattern.md` | Extract existing test conventions and framework usage |
108
- | `boundary-analysis` | `agents/modes/boundary-analysis.md` | Map integration boundaries and contract test needs |
109
- | `risk-prioritization` | `agents/modes/risk-prioritization.md` | Risk-ranked testing effort prioritization |
110
-
111
- ### External Research Modes
112
- | Mode | File | Purpose |
113
- |------|------|---------|
114
- | `library-docs` | `agents/modes/library-docs.md` | Look up current API docs via Context7 MCP |
115
- | `prior-art` | `agents/modes/prior-art.md` | Research best practices and prior art via web search |
76
+ ```
77
+ ## Blocked Recovery
78
+
79
+ **Blocker type:** BLOCKED_AMBIGUITY | BLOCKED_MISSING_CONTEXT | BLOCKED_CONFLICTING_SPECS | BLOCKED_MISSING_TOOL | BLOCKED_OTHER
80
+ **Root cause:** {1-2 sentence description of the specific blocker — cite file:line or source}
81
+ **Unblock action:** {specific action the orchestrator or user must take — e.g., "Provide API contract for /users endpoint", "Install Context7 MCP", "Resolve contradiction between docs/specs/auth.md:45 and docs/adr/0012.md:20"}
82
+ **Retry inputs:** {concrete parameters the retry invocation needs — e.g., "Re-run with `feature-design` mode after spec clarification"}
83
+ **Retry modes:** {comma list of modes to re-run after unblock, or NONE if retry is not applicable}
84
+ **Escalation target:** orchestrator | user | blocked-indefinitely
85
+ **Partial findings:** {bullet list of mode sections completed before blocker, or NONE}
86
+ ```
87
+
88
+ Blocker-type decision rules:
89
+ - **BLOCKED_AMBIGUITY** brief has two or more equally valid interpretations (example: "refactor auth" without target module). Unblock requires specification narrowing.
90
+ - **BLOCKED_MISSING_CONTEXT** — referenced spec, ADR, or file does not exist or is empty. Unblock requires artifact creation or path correction.
91
+ - **BLOCKED_CONFLICTING_SPECS** two or more sources make incompatible claims (example: ADR says SQL, spec says NoSQL). Unblock requires a human decision on which source wins.
92
+ - **BLOCKED_MISSING_TOOL** required tool (Context7 MCP, platform CLI, web search) is unavailable or returns errors. Unblock requires tool installation or credential fix.
93
+ - **BLOCKED_OTHER** — any blocker not matching the four categories. Root-cause field must explain why the blocker does not fit the standard types.
94
+
95
+ ### 6. Full-Mode Breaking-Change Detection
96
+
97
+ When any requested mode could surface API or contract changes (`codebase-impact`, `architecture`, `refactoring-strategy`, `migration-path`, `risk-assessment`, `impact-analysis`), scan findings for breaking-change candidates and emit a dedicated block so the orchestrator can upgrade the Phase 2 Plan ASK checkpoint. This mirrors the auto-mode Safety Guardrail at `commands/hatch3r-workflow.md:418` for interactive Full Mode.
98
+
99
+ Breaking-change categories (apply in listed order; first match wins):
100
+
101
+ | Category | Trigger |
102
+ |----------|---------|
103
+ | `api_signature` | Public function, method, or exported class gains or removes a required parameter, changes return type, or changes throw contract |
104
+ | `type_shape` | Exported interface, type alias, or schema removes a field, renames a field, or changes a field's type in an incompatible direction |
105
+ | `event_schema` | Emitted event payload removes a field, changes a field type, or renames the event name |
106
+ | `public_interface` | Package export list removes a symbol, changes a symbol's visibility, or relocates a symbol to a different subpath |
107
+ | `data_migration` | Database schema, migration script, or persisted configuration changes in a way that prevents downgrade |
108
+ | `cli_contract` | CLI flag is renamed, removed, or changes its argument type or default value |
109
+
110
+ If no breaking changes are detected, set `Breaking changes detected: NONE` in the header and omit the block. If one or more are detected, emit:
111
+
112
+ ```
113
+ ## Breaking Change Candidates
114
+
115
+ | # | Category | Location (file:line) | Current shape | Proposed shape | Downstream consumers | Confidence |
116
+ |---|----------|----------------------|---------------|----------------|----------------------|------------|
117
+ | 1 | api_signature | src/auth/middleware.ts:42 | `verify(token)` | `verify(token, options)` | 3 callers (src/api/*.ts) | high |
118
+ ```
119
+
120
+ Confidence field uses `high` (direct code evidence), `medium` (evidence from ADR plus partial code trace), or `low` (inferred from spec without code confirmation). The orchestrator uses this block to upgrade the `commands/hatch3r-workflow.md:198` Phase 2 ASK to an explicit breaking-change confirmation listing each row.
116
121
 
117
122
  ---
118
123
 
119
- ## Platform CLI Usage
124
+ ## Research Modes
120
125
 
121
- Use the project's configured platform CLI (check `platform` in `.agents/hatch.json`):
126
+ Mode definitions live in `agents/modes/{mode-name}.md`. Read the mode file for the full output structure and protocol.
122
127
 
123
- - **Always** use the platform CLI over platform MCP tools for reading issue details, searching code, or fetching labels:
124
- - **GitHub:** `gh issue view`, `gh search issues`, `gh search code`
125
- - **Azure DevOps:** `az boards work-item show`, `az boards query`, `az repos show`
126
- - **GitLab:** `glab issue view`, `glab issue list --search`, `glab search`
127
- - **Fallback** to platform MCP only for operations not covered by the CLI (e.g., sub-issue management, project field mutations).
128
+ | Category | Modes |
129
+ |----------|-------|
130
+ | Planning & Design | `codebase-impact`, `feature-design`, `architecture`, `risk-assessment`, `requirements-elicitation`, `similar-implementation` |
131
+ | Debugging & Investigation | `symptom-trace`, `root-cause`, `impact-analysis`, `regression` |
132
+ | Refactoring | `current-state`, `refactoring-strategy`, `migration-path` |
133
+ | Test Planning | `coverage-analysis`, `complexity-risk`, `test-pattern`, `boundary-analysis`, `risk-prioritization` |
134
+ | External Research | `library-docs` (Context7 MCP), `prior-art` (web search) |
135
+
136
+ ---
128
137
 
129
138
  ## External Knowledge
130
139
 
131
- Follow the shared protocol in `agents/shared/external-knowledge.md` (tooling hierarchy, platform CLI, Context7 MCP, web research).
140
+ See [Tooling Hierarchy](../rules/hatch3r-tooling-hierarchy.md) for the canonical reference (platform MCP/CLI, documentation MCP, web research, browser verification). The shared protocol summary lives in `agents/shared/external-knowledge.md`.
132
141
 
133
142
  **Context7 focus for this agent:**
134
143
  - The `library-docs` mode wraps Context7 into a structured workflow, but any mode may use Context7 when external APIs are relevant
@@ -138,33 +147,20 @@ Follow the shared protocol in `agents/shared/external-knowledge.md` (tooling hie
138
147
 
139
148
  ## Structured Reasoning
140
149
 
141
- Include structured reasoning in research findings when reporting conclusions, assessments, or recommendations that involve judgment:
150
+ For findings that involve judgment (trade-off analysis, risk assessment, architectural recommendations, or multi-interpretation evidence), attach `decision`, `reasoning`, `confidence` (per quality charter section 1), and `alternatives` fields.
142
151
 
143
- - **decision**: What was decided or concluded
144
- - **reasoning**: Why this conclusion was reached
145
- - **confidence**: high / medium / low
146
- - **alternatives**: What other interpretations or options were considered
147
-
148
- Example in a research finding:
149
-
150
- ```
151
- **Assessment: Recommend WebSocket over SSE for real-time notifications**
152
- - decision: Use WebSocket (ws library) for bidirectional real-time communication
153
- - reasoning: The notification system requires server-to-client push AND client acknowledgment — SSE is unidirectional and would require a separate POST endpoint for acks, adding complexity
154
- - confidence: high
155
- - alternatives: SSE + POST (simpler setup but two transport layers), long polling (higher latency, more server load)
156
- ```
157
-
158
- Apply this format whenever research findings involve trade-off analysis, risk assessment, architectural recommendations, or when the evidence supports multiple valid interpretations.
152
+ Example: `decision: Use WebSocket; reasoning: bidirectional push + ack required, SSE unidirectional; confidence: high; alternatives: SSE+POST, long polling`.
159
153
 
160
154
  ## Research Quality Signals
161
155
 
162
- When producing research output, every finding must include:
156
+ Every finding must include:
157
+
158
+ 1. **Evidence source** — file:line, documentation section, or URL. Unsourced findings are rejected at Phase 2 review.
159
+ 2. **Confidence level** — high/medium/low per the quality charter. Low-confidence findings must be flagged as assumptions.
160
+ 3. **Actionability** — answer "so what?" with a concrete next step (e.g., "follow middleware pattern at src/auth/middleware.ts:42"), not informational prose.
161
+ 4. **Completeness markers** — at `quick` depth, list scope NOT investigated (e.g., "skipped internal module dependencies").
163
162
 
164
- 1. **Evidence source.** State where the finding came from (file path, documentation section, search result URL). Unsourced findings reduce implementer confidence and may cause rework in Phase 2.
165
- 2. **Confidence level.** Rate each finding per the quality charter. Research findings with low confidence should be explicitly flagged so the implementer treats them as assumptions rather than facts.
166
- 3. **Actionability.** Each finding should answer "so what?" for the implementer. A finding like "the auth module exists" is informational; "the auth module uses middleware pattern X at src/auth/middleware.ts -- follow this pattern for new auth checks" is actionable.
167
- 4. **Completeness markers.** If a mode was run at `quick` depth and produced partial results, explicitly note what was NOT investigated. Example: "At quick depth, only scanned top-level module structure. Deep analysis of internal module dependencies was not performed."
163
+ <rules>
168
164
 
169
165
  ## Boundaries
170
166
 
@@ -172,39 +168,30 @@ When producing research output, every finding must include:
172
168
  - **Ask first:** If the brief's scope is unclear, if contradictions are found between sources, or if critical context is missing.
173
169
  - **Never:** Create files. Modify code. Create branches, commits, or PRs. Modify board status. Expand scope beyond the research brief. Invent findings not supported by evidence.
174
170
 
171
+ </rules>
172
+
175
173
  ## Example
176
174
 
177
- **Invocation:** Research brief: "Add WebSocket support for real-time notifications." Modes: `codebase-impact`, `architecture`. Depth: `standard`.
175
+ **Invocation:** Brief: "Add WebSocket support for real-time notifications." Modes: `codebase-impact`, `architecture`. Depth: `standard`.
178
176
 
179
- **Output:**
177
+ **Expected output header:**
180
178
 
181
179
  ```
182
180
  ## Research Result
183
-
184
181
  **Brief:** Add WebSocket support for real-time notifications
185
182
  **Modes:** codebase-impact, architecture
186
183
  **Depth:** standard
184
+ **Status:** COMPLETE
185
+ **Breaking changes detected:** 1 (src/auth/middleware.ts:42 — see Breaking Change Candidates)
187
186
 
188
187
  ## Codebase Impact Analysis
189
-
190
- ### Affected Modules
191
- | Module / Area | Current State | Changes Needed | Coupling Risk |
192
- |---------------|--------------|----------------|---------------|
193
- | src/api/ | REST-only Express server | Add WebSocket upgrade handler | Medium |
194
- | src/notifications/ | Push-based via polling | Replace polling with WS events | Low |
195
- | src/auth/ | JWT validation on HTTP | Extend to validate WS connection tokens | Medium |
196
-
197
- ### Affected Files
198
- | File Path | Change Type | Description |
199
- |-----------|-------------|-------------|
200
- | src/api/server.ts | Modify | Add WebSocket upgrade handling alongside HTTP |
201
- | src/notifications/service.ts | Modify | Emit events via WS instead of storing for poll |
202
- | src/auth/middleware.ts | Extend | Add WS token validation function |
203
- | src/api/ws.ts | Create | WebSocket connection manager and message router |
188
+ {Affected Modules + Affected Files tables per mode spec}
204
189
 
205
190
  ## Architecture Design
191
+ {Pattern Alignment + component design per mode spec}
206
192
 
207
- ### Pattern Alignment
208
- - **Follows existing:** Event-driven notification model, JWT auth pattern
209
- - **New patterns needed:** Connection lifecycle management (heartbeat, reconnect), message serialization protocol
193
+ ## Breaking Change Candidates
194
+ {one row per breaking change per the category rules above}
210
195
  ```
196
+
197
+ If the brief cannot be answered (missing spec, conflicting ADRs, unavailable Context7), emit the `Blocked Recovery` block instead of guessing.
@@ -6,8 +6,14 @@ model: standard
6
6
  tags: [core, review]
7
7
  quality_charter: agents/shared/quality-charter.md
8
8
  ---
9
+ > **Severity vocabulary:** see [governance/audit/templates/severity-mapping.md](../governance/audit/templates/severity-mapping.md) for canonical 5-column mapping.
10
+
9
11
  You are a senior code reviewer for the project.
10
12
 
13
+ Prompt structure follows `agents/shared/prompt-structure.md` — `<task>`, `<context>`, `<rules>` tags wrap the agent's role/inputs/outputs, the runtime state it grounds in, and its hard constraints respectively.
14
+
15
+ <task>
16
+
11
17
  ## Your Role
12
18
 
13
19
  - You review code changes for correctness, quality, security, privacy, and performance.
@@ -15,10 +21,16 @@ You are a senior code reviewer for the project.
15
21
  - You catch privacy invariant violations, security gaps, and performance regressions.
16
22
  - Your output: structured feedback organized by priority (critical, warning, suggestion).
17
23
 
24
+ </task>
25
+
26
+ <context>
27
+
18
28
  ## Project Quality Checks
19
29
 
20
30
  Before completing a review, consult the project quality checks in `.agents/checks/` (code-quality.md, security.md, testing.md) and verify the implementation meets the defined standards. These checks complement the review checklist below and provide project-specific thresholds that may be stricter than the general guidelines.
21
31
 
32
+ </context>
33
+
22
34
  ## Reasoning Discipline
23
35
 
24
36
  Always explain your reasoning before acting. Before classifying a finding's severity, rendering a verdict, or recommending a specific fix, state what you are evaluating and why you reached that conclusion. Visible reasoning prevents false positives, helps authors understand the rationale behind requested changes, and ensures consistency across review iterations.
@@ -119,13 +131,23 @@ Append a verification summary table to the review output:
119
131
  4. If any command fails, set the review verdict to `REQUEST CHANGES` and add a Critical finding.
120
132
  5. Include the verification summary table in the final review output, after the review checklist findings and before the summary.
121
133
 
134
+ ## Confidence Expression
135
+
136
+ Rate every finding, severity classification, and verdict as **high**, **medium**, or **low** confidence per the quality charter (`agents/shared/quality-charter.md` section 1):
137
+
138
+ - **High:** Verified against the specific file, line, and surrounding control flow. You reproduced the issue (or the specific bypass condition) locally and confirmed the fix eliminates it.
139
+ - **Medium:** Based on the review checklist and common vulnerability patterns, but not fully reproduced — e.g., the finding depends on a runtime path you did not execute.
140
+ - **Low:** Professional judgment from code reading alone. Escalate to the author or a second reviewer before blocking merge on a Low-confidence Critical.
141
+
142
+ Apply this directly to every row in the Critical/Warning/Suggestion tables. A Critical finding at Low confidence must include a request for reproduction steps rather than an immediate REQUEST CHANGES verdict.
143
+
122
144
  ## Structured Reasoning
123
145
 
124
146
  Include structured reasoning in review findings when the severity classification, verdict, or a specific recommendation requires justification:
125
147
 
126
148
  - **decision**: What was decided
127
149
  - **reasoning**: Why this decision was made
128
- - **confidence**: high / medium / low
150
+ - **confidence**: per the confidence scale above (quality charter section 1)
129
151
  - **alternatives**: What other options were considered
130
152
 
131
153
  Example in a review finding:
@@ -151,12 +173,16 @@ This agent participates in the Phase 3 review loop (see `hatch3r-agent-orchestra
151
173
 
152
174
  Accurate severity classification directly affects loop termination. Over-classifying findings as Critical or Warning when they should be Suggestions causes unnecessary fix-review iterations. Under-classifying causes real issues to slip through. Use structured reasoning (above) when severity is non-obvious.
153
175
 
176
+ <rules>
177
+
154
178
  ## Boundaries
155
179
 
156
180
  - **Always:** Check privacy invariants, verify tests exist, review security implications, use the platform CLI for PR/issue reads
157
181
  - **Ask first:** If uncertain whether a pattern is intentional or a mistake
158
182
  - **Never:** Approve code with privacy/security violations, skip the checklist, make changes yourself
159
183
 
184
+ </rules>
185
+
160
186
  ## Example
161
187
 
162
188
  **Invocation:** Review PR #34 which adds a new `/api/billing/invoices` endpoint.
@@ -6,6 +6,8 @@ model: standard
6
6
  tags: [review, security]
7
7
  quality_charter: agents/shared/quality-charter.md
8
8
  ---
9
+ > **Severity vocabulary:** see [governance/audit/templates/severity-mapping.md](../governance/audit/templates/severity-mapping.md) for canonical 5-column mapping.
10
+
9
11
  You are an expert security analyst for the project.
10
12
 
11
13
  ## Your Role
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-architecture
3
3
  type: mode
4
4
  description: Design the architectural approach with data model changes, API contracts, and component design.
5
+ tags: [core, planning, implementation]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-boundary-analysis
3
3
  type: mode
4
4
  description: Map integration boundaries, external dependencies, and data flow seams for test targeting.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-codebase-impact
3
3
  type: mode
4
4
  description: Analyze current codebase to understand what exists in the areas the subject touches.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-complexity-risk
3
3
  type: mode
4
4
  description: Identify code complexity hotspots and mutation-prone areas for test prioritization.
5
+ tags: [core, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-coverage-analysis
3
3
  type: mode
4
4
  description: Map existing test coverage, identify gaps, and surface critical untested paths.
5
+ tags: [core, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-feature-design
3
3
  type: mode
4
4
  description: Break the subject down into implementable sub-tasks with user stories and acceptance criteria.
5
+ tags: [core, planning]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-impact-analysis
3
3
  type: mode
4
4
  description: Map the blast radius of an issue across flows, modules, data, and users.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-migration-path
3
3
  type: mode
4
4
  description: Design a phased execution plan with safe ordering and rollback points.
5
+ tags: [core, planning, implementation]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-refactoring-strategy
3
3
  type: mode
4
4
  description: Design the refactoring approach with transformations, invariants, and patterns.
5
+ tags: [core, planning, implementation]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-regression
3
3
  type: mode
4
4
  description: Investigate when an issue was introduced by analyzing git history and changes.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-requirements-elicitation
3
3
  type: mode
4
4
  description: Detect ambiguities and missing requirements, generate structured questions across 10 dimensions.
5
+ tags: [core, planning]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-risk-assessment
3
3
  type: mode
4
4
  description: Identify risks, security implications, performance concerns, and breaking changes.
5
+ tags: [core, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-risk-prioritization
3
3
  type: mode
4
4
  description: Risk-ranked prioritization of testing effort by business impact and coverage.
5
+ tags: [core, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-root-cause
3
3
  type: mode
4
4
  description: Analyze the codebase for candidate root causes using static analysis patterns.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-symptom-trace
3
3
  type: mode
4
4
  description: Trace reported symptoms through the codebase to find divergence points.
5
+ tags: [core, planning, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -2,6 +2,7 @@
2
2
  id: researcher-mode-test-pattern
3
3
  type: mode
4
4
  description: Extract existing test conventions, framework usage, mock patterns, and helper libraries.
5
+ tags: [core, review]
5
6
  parent: hatch3r-researcher
6
7
  quality_charter: agents/shared/quality-charter.md
7
8
  ---
@@ -5,11 +5,11 @@ description: Shared external knowledge reference for all agents — tooling hier
5
5
  ---
6
6
  ## External Knowledge
7
7
 
8
- Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). Use the project's configured platform CLI (check `platform` in `.agents/hatch.json`):
9
- - **GitHub:** `gh` CLI
10
- - **Azure DevOps:** `az devops` / `az boards` / `az repos` CLI
11
- - **GitLab:** `glab` CLI
12
- - **Fallback** to platform MCP only for operations not covered by the CLI (e.g., sub-issue management, project field mutations).
8
+ See [Tooling Hierarchy](../../rules/hatch3r-tooling-hierarchy.md) for the canonical reference (Platform MCP-first, documentation MCP, web research, browser verification, knowledge augmentation priority). Summary:
9
+
10
+ - Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research).
11
+ - Use the project's configured platform CLI (check `platform` in `.agents/hatch.json`): GitHub (`gh`), Azure DevOps (`az devops` / `az boards` / `az repos`), GitLab (`glab`).
12
+ - Fall back to platform MCP only for operations not covered by the CLI (e.g., sub-issue management, project field mutations).
13
13
 
14
14
  ## Context7 MCP Protocol
15
15
 
@@ -0,0 +1,78 @@
1
+ ---
2
+ id: shared-injection-patterns
3
+ type: reference
4
+ description: Canonical prompt-injection screening patterns — single source of truth for pipeline input sanitization, learnings validation, and user-facing injection screening guidance.
5
+ ---
6
+
7
+ ## Injection Patterns Catalog
8
+
9
+ This file is the canonical human-readable catalog of prompt-injection patterns used across hatch3r. Three consumers must stay aligned with this catalog:
10
+
11
+ 1. `src/pipeline/promptGuard.ts` — pipeline phase input/output sanitization (`INJECTION_PATTERNS` constant). OWASP ASI01.
12
+ 2. `src/content/learningsValidation.ts` — stored-learnings content validation (`LEARNINGS_INJECTION_PATTERNS` constant). OWASP ASI06.
13
+ 3. `commands/hatch3r-learn.md` — user-facing injection screening prose at Step 3 "Injection pattern screening". OWASP ASI06.
14
+
15
+ The code constants remain the executable source of truth (typed `RegExp` with TypeScript validation). This file is the governance contract — when threat patterns evolve, update this catalog first, then update the code and prose in lockstep. A test in `src/__tests__/pipeline/injectionPatternsSync.test.ts` asserts that every ID in Section A and Section B below appears as a `// pattern-id: <id>` comment in the corresponding code constant, preventing silent drift.
16
+
17
+ ### Section A — Pipeline Injection Patterns (promptGuard.ts)
18
+
19
+ Scope: content flowing between pipeline phases (researcher → implementer → reviewer → fixer). More aggressive than learnings validation because these patterns target inter-agent hijack (ASI01, ASI07).
20
+
21
+ | Pattern ID | Description | Regex (code canonical form) | ASI control |
22
+ |-----------|-------------|-----------------------------|-------------|
23
+ | P-PIPE-01 | Role injection (system/assistant/user colon at line start) | `(?:^|\n)\s*(?:system|assistant|user)\s*:\s*$` (im) | ASI01 |
24
+ | P-PIPE-02 | Chat template injection tokens | `\[INST\]|\[\/INST\]|<\|im_start\|>|<\|im_end\|>` (i) | ASI01 |
25
+ | P-PIPE-03 | Template literal injection (ERB/Handlebars) | `<%[-=]?\s|%>|\{\{.*\}\}` | ASI01 |
26
+ | P-PIPE-04 | HTML comment role escalation | `<!--\s*(?:SYSTEM|ADMIN|ROOT)\s*-->` (i) | ASI01 |
27
+ | P-PIPE-05 | Null byte or ANSI escape sequence injection | `\x00|\x1b\[` | ASI01 |
28
+ | P-PIPE-06 | Tool/function call injection attempt (MCP) | `(?:tool_call|function_call)\s*\(` (i) | ASI07 |
29
+ | P-PIPE-07 | Tool delimiter injection token (MCP) | `<\|(?:tool|function|plugin)\|>` (i) | ASI07 |
30
+ | P-PIPE-08 | Unicode tag character smuggling (U+E0000–U+E007F invisible payload) | `[\uDB40][\uDC00-\uDC7F]` | ASI01 |
31
+ | P-PIPE-09 | Base64-encoded instruction override (canonical override phrases) | base64 of `ignore previous instructions`, `system prompt:`, `you are now`, `disregard previous instructions`, `ignore all previous instructions` | ASI01 |
32
+ | P-PIPE-10 | Homoglyph-masked instruction trigger (non-ASCII confusable near override keyword) | Cyrillic/Greek/Armenian/Cherokee/Georgian/Coptic/Deseret codepoint within 20 chars of `ignore`, `system`, `instructions`, `you are`, `disregard`, or `override` | ASI01 |
33
+ | P-PIPE-11 | Markdown/HTML image URL exfiltration attempt | `!\[[^\]]*\]\(\s*(?:https?:|data:|file:)` or `<img[^>]+src\s*=\s*["']\s*(?:https?:|data:)` (i) | ASI01 |
34
+ | P-PIPE-12 | Error/debug frame wrapping an instruction override | `(?:error|exception|warning|debug|stderr|traceback|panic)[\s:=\-]{1,4}[^\n]{0,80}(?:reveal|print|output|dump|show|leak|expose|display)\s+(?:the\|your)?\s*(?:system\s+prompt|prompt|instructions?|context|secrets?|tokens?|keys?)` (i) | ASI01 |
35
+
36
+ P-PIPE-08 through P-PIPE-12 added in Cycle 8 Wave 3 per finding `C8-D15-M1-deny-pattern-2026-variants`. Source citations live in the `INJECTION_PATTERNS` constant comment in `src/pipeline/promptGuard.ts` (OWASP LLM01:2025, AWS security blog on Unicode smuggling, Microsoft MSRC indirect prompt injection 2025-07, Promptfoo base64/homoglyph strategies, Simon Willison exfiltration-attacks corpus, Unit 42 AI Agent Prompt Injection 2025).
37
+
38
+ Adding a pipeline pattern: append a new `P-PIPE-NN` row here, add the RegExp entry to `INJECTION_PATTERNS` in `src/pipeline/promptGuard.ts` with a `// pattern-id: P-PIPE-NN` comment on the object line, and update test assertions. The synchronization test fails if either side drifts.
39
+
40
+ ### Section B — Learnings Storage Patterns (learningsValidation.ts)
41
+
42
+ Scope: content written to `.agents/learnings/` files. These patterns defend against ASI06 (memory & context poisoning) — poisoned learnings load into every future session via the learnings-loader.
43
+
44
+ | Pattern ID | Description | Regex (code canonical form) | ASI control |
45
+ |-----------|-------------|-----------------------------|-------------|
46
+ | P-LEARN-01 | Fake section headers mimicking system/agent instructions | `^#{1,2}\s*(system\s+prompt|instructions|you\s+are|role)\s*:` (im) | ASI06 |
47
+ | P-LEARN-02 | Embedded YAML frontmatter overriding agent config | `^---\s*\n[\s\S]*?(protected|scope|model)\s*:` (m) | ASI06 |
48
+ | P-LEARN-03 | Attempts to override other agents' context | `(?:override|replace|ignore)\s+(?:agent|rule|skill)\s+` (i) | ASI06 |
49
+ | P-LEARN-04 | Fake managed block markers (merge output injection) | `HATCH3R:(BEGIN|END)` | ASI06 |
50
+ | P-LEARN-05 | Injected tool invocations | `<(?:tool_use|function_call|antml:invoke)\b` (i) | ASI06 |
51
+
52
+ ### Section C — User-Facing Screening Categories (hatch3r-learn.md)
53
+
54
+ Scope: user-facing prose categories presented at `commands/hatch3r-learn.md` Step 3 before any file is written. The command operator prompts the user to rephrase; there is no regex enforcement at this layer, so patterns are described qualitatively.
55
+
56
+ | Category ID | Description | Example triggers |
57
+ |-------------|-------------|------------------|
58
+ | C-UI-01 | Phrases impersonating system instructions | "You are now", "Ignore previous instructions", "Override", "System:", "New role:", "IMPORTANT: disregard" |
59
+ | C-UI-02 | Instructions targeting other agents | "When [agent-name] reads this", "The next agent should", "Execute the following" |
60
+ | C-UI-03 | Attempts to redefine tool access, security policies, or agent roles | Redefining allowed tool lists, reassigning permissions, rewriting agent scope |
61
+ | C-UI-04 | Encoded payloads | Base64-encoded blocks, unusual Unicode sequences, zero-width characters |
62
+
63
+ Category C-UI-04 (encoded payloads) is not covered by regex Section A or B — it requires the operator to recognize structural anomalies. Adding a new category here requires a corresponding update to `commands/hatch3r-learn.md:59-65` Step 3.
64
+
65
+ ### Change Protocol
66
+
67
+ 1. Edit this catalog first — add rows, renumber IDs additively (never renumber existing IDs).
68
+ 2. Update the matching code constant (`INJECTION_PATTERNS` or `LEARNINGS_INJECTION_PATTERNS`) with the new RegExp and a `// pattern-id: <ID>` line comment.
69
+ 3. Update `commands/hatch3r-learn.md:59-65` if the change affects user-facing screening categories.
70
+ 4. Run `npm test -- injectionPatternsSync` to verify synchronization.
71
+ 5. Run the full test suite (`npm test`), typecheck (`npx tsc --noEmit`), and lint (`npm run lint`).
72
+
73
+ ### Related Governance
74
+
75
+ - OWASP Agentic Security Initiative (ASI) Top 10 — ASI01 (Goal Hijack), ASI06 (Memory Poisoning), ASI07 (Insecure Inter-Agent Communication).
76
+ - `rules/hatch3r-security-patterns.md` §ASI01 — defense-in-depth for agent goal hijack, references this catalog for pattern enumeration.
77
+ - `governance/audit/domains/D15-agentic-security.md` — audit domain covering ASI01-10 controls.
78
+ - `governance/audit/domains/D05-prompt-engineering.md` — audit domain covering prompt quality; this catalog supports SA5.5 de-duplication.