hatch3r 1.2.0 → 1.4.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 (86) hide show
  1. package/README.md +38 -1
  2. package/agents/hatch3r-a11y-auditor.md +7 -14
  3. package/agents/hatch3r-architect.md +7 -14
  4. package/agents/hatch3r-ci-watcher.md +7 -13
  5. package/agents/hatch3r-context-rules.md +5 -10
  6. package/agents/hatch3r-dependency-auditor.md +10 -19
  7. package/agents/hatch3r-devops.md +7 -16
  8. package/agents/hatch3r-docs-writer.md +7 -14
  9. package/agents/hatch3r-fixer.md +2 -8
  10. package/agents/hatch3r-implementer.md +2 -8
  11. package/agents/hatch3r-learnings-loader.md +150 -21
  12. package/agents/hatch3r-lint-fixer.md +7 -12
  13. package/agents/hatch3r-perf-profiler.md +7 -14
  14. package/agents/hatch3r-researcher.md +7 -14
  15. package/agents/hatch3r-reviewer.md +7 -13
  16. package/agents/hatch3r-security-auditor.md +7 -15
  17. package/agents/hatch3r-test-writer.md +7 -14
  18. package/agents/modes/architecture.md +44 -0
  19. package/agents/modes/boundary-analysis.md +45 -0
  20. package/agents/modes/codebase-impact.md +81 -0
  21. package/agents/modes/complexity-risk.md +40 -0
  22. package/agents/modes/coverage-analysis.md +44 -0
  23. package/agents/modes/current-state.md +52 -0
  24. package/agents/modes/feature-design.md +39 -0
  25. package/agents/modes/impact-analysis.md +45 -0
  26. package/agents/modes/library-docs.md +31 -0
  27. package/agents/modes/migration-path.md +55 -0
  28. package/agents/modes/prior-art.md +31 -0
  29. package/agents/modes/refactoring-strategy.md +55 -0
  30. package/agents/modes/regression.md +45 -0
  31. package/agents/modes/requirements-elicitation.md +68 -0
  32. package/agents/modes/risk-assessment.md +41 -0
  33. package/agents/modes/risk-prioritization.md +43 -0
  34. package/agents/modes/root-cause.md +39 -0
  35. package/agents/modes/similar-implementation.md +70 -0
  36. package/agents/modes/symptom-trace.md +39 -0
  37. package/agents/modes/test-pattern.md +61 -0
  38. package/agents/shared/external-knowledge.md +32 -0
  39. package/agents/shared/quality-charter.md +78 -0
  40. package/commands/board/pickup-azure-devops.md +4 -0
  41. package/commands/board/pickup-delegation-multi.md +3 -0
  42. package/commands/board/pickup-delegation.md +3 -0
  43. package/commands/board/pickup-github.md +4 -0
  44. package/commands/board/pickup-gitlab.md +4 -0
  45. package/commands/board/pickup-post-impl.md +8 -1
  46. package/commands/board/shared-azure-devops.md +13 -3
  47. package/commands/board/shared-github.md +1 -0
  48. package/commands/board/shared-gitlab.md +9 -2
  49. package/commands/hatch3r-agent-customize.md +5 -1
  50. package/commands/hatch3r-board-groom.md +55 -2
  51. package/commands/hatch3r-board-init.md +5 -2
  52. package/commands/hatch3r-board-shared.md +62 -2
  53. package/commands/hatch3r-command-customize.md +4 -0
  54. package/commands/hatch3r-context-health.md +22 -2
  55. package/commands/hatch3r-cost-tracking.md +14 -0
  56. package/commands/hatch3r-hooks.md +1 -1
  57. package/commands/hatch3r-learn.md +68 -2
  58. package/commands/hatch3r-quick-change.md +29 -3
  59. package/commands/hatch3r-revision.md +136 -16
  60. package/commands/hatch3r-rule-customize.md +4 -0
  61. package/commands/hatch3r-skill-customize.md +4 -0
  62. package/commands/hatch3r-workflow.md +10 -1
  63. package/dist/cli/index.js +2528 -640
  64. package/dist/cli/index.js.map +1 -1
  65. package/package.json +12 -9
  66. package/rules/hatch3r-agent-orchestration-detail.md +159 -0
  67. package/rules/hatch3r-agent-orchestration-detail.mdc +156 -0
  68. package/rules/hatch3r-agent-orchestration.md +91 -318
  69. package/rules/hatch3r-agent-orchestration.mdc +127 -149
  70. package/rules/hatch3r-code-standards.mdc +10 -2
  71. package/rules/hatch3r-component-conventions.mdc +0 -1
  72. package/rules/hatch3r-deep-context.mdc +30 -8
  73. package/rules/hatch3r-dependency-management.mdc +17 -5
  74. package/rules/hatch3r-i18n.mdc +0 -1
  75. package/rules/hatch3r-migrations.mdc +12 -1
  76. package/rules/hatch3r-observability.mdc +289 -0
  77. package/rules/hatch3r-security-patterns.mdc +11 -0
  78. package/rules/hatch3r-testing.mdc +1 -1
  79. package/rules/hatch3r-theming.mdc +0 -1
  80. package/rules/hatch3r-tooling-hierarchy.mdc +18 -4
  81. package/skills/hatch3r-agent-customize/SKILL.md +4 -72
  82. package/skills/hatch3r-command-customize/SKILL.md +4 -62
  83. package/skills/hatch3r-customize/SKILL.md +117 -0
  84. package/skills/hatch3r-dep-audit/SKILL.md +1 -1
  85. package/skills/hatch3r-rule-customize/SKILL.md +4 -65
  86. package/skills/hatch3r-skill-customize/SKILL.md +4 -62
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: researcher-mode-migration-path
3
+ type: mode
4
+ description: Design a phased execution plan with safe ordering and rollback points.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `migration-path`
8
+
9
+ Design a phased execution plan with safe ordering. Each phase must leave the codebase in a working state. Identify parallel lanes, rollback points, and map phases to execution skills.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Migration Path
15
+
16
+ ### Phase Overview
17
+ | Phase | Title | Scope | Depends On | Skill | Effort | Rollback Point? |
18
+ |-------|-------|-------|-----------|-------|--------|----------------|
19
+ | 0 | {test scaffolding} | {add missing tests before refactoring} | — | hatch3r-qa-validation | S/M | Yes |
20
+ | 1 | {first transformation} | {what changes} | Phase 0 | hatch3r-refactor | S/M/L | Yes |
21
+
22
+ ### Phase Details
23
+
24
+ #### Phase {N}: {Title}
25
+ - **Goal:** {what this phase achieves}
26
+ - **Transformations:** {list of specific changes}
27
+ - **Files:** {list with change descriptions}
28
+ - **Behavioral invariants:** {what must still hold after this phase}
29
+ - **Verification:** {how to confirm the phase is successful}
30
+ - **Rollback:** {how to revert this phase without affecting others}
31
+
32
+ ### Parallel Lanes
33
+ | Lane | Phases | Why Independent |
34
+ |------|--------|----------------|
35
+ | A | {phase numbers} | {no shared files or interfaces} |
36
+ | B | {phase numbers} | {no shared files or interfaces} |
37
+
38
+ ### Critical Path
39
+ {phase X} → {phase Y} → {phase Z} (total: {effort estimate})
40
+
41
+ ### Completion Criteria
42
+ - [ ] All phases completed and verified
43
+ - [ ] All behavioral invariants confirmed via tests
44
+ - [ ] No regression in existing test suite
45
+ - [ ] Dead code from old patterns removed
46
+ - [ ] Documentation updated (specs, ADRs)
47
+
48
+ ### Skill Mapping
49
+ | Phase | Execution Skill | Why |
50
+ |-------|----------------|-----|
51
+ | {phase} | hatch3r-refactor | Structural code quality improvement |
52
+ | {phase} | hatch3r-logical-refactor | Behavior or logic flow change |
53
+ | {phase} | hatch3r-visual-refactor | UI/UX component change |
54
+ | {phase} | hatch3r-qa-validation | Test scaffolding before refactoring |
55
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ id: researcher-mode-prior-art
3
+ type: mode
4
+ description: Research best practices, known issues, and ecosystem trends via web search.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `prior-art`
8
+
9
+ Research best practices, known issues, ecosystem trends, and prior art via web search. Use for novel problems, security advisories, or approaches not covered by local docs or Context7.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Prior Art Research
15
+
16
+ ### Best Practices
17
+ | # | Practice | Source | Applicability |
18
+ |---|---------|--------|--------------|
19
+ | 1 | {practice} | {source — blog, docs, RFC} | {how it applies to the subject} |
20
+
21
+ ### Known Issues / CVEs
22
+ | # | Issue | Severity | Affected Versions | Mitigation |
23
+ |---|-------|----------|-------------------|------------|
24
+ | 1 | {issue or CVE} | {severity} | {versions} | {fix or workaround} |
25
+
26
+ ### Ecosystem Trends
27
+ - {trend}: {relevance to the subject}
28
+
29
+ ### Reference Implementations
30
+ - {project/example}: {what it demonstrates and how it's relevant}
31
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: researcher-mode-refactoring-strategy
3
+ type: mode
4
+ description: Design the refactoring approach with transformations, invariants, and patterns.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `refactoring-strategy`
8
+
9
+ Design the refactoring approach. Propose specific transformations (extract, inline, rename, restructure, migrate). Define behavioral invariants that must hold throughout. Identify patterns to follow from the existing codebase or from best practices.
10
+
11
+ **Dimension-specific focus** (when provided):
12
+ - **Structural:** Extract module, split file, reduce coupling, enforce boundaries
13
+ - **Logical:** Behavior migration, data model evolution, API versioning, state machine redesign
14
+ - **Visual:** Component refactoring, design token standardization, accessibility remediation, layout restructuring
15
+ - **Migration:** Framework swap, adapter pattern, compatibility shim, incremental migration
16
+
17
+ **Output structure:**
18
+
19
+ ```markdown
20
+ ## Refactoring Strategy
21
+
22
+ ### Target Architecture
23
+ {Description of the desired end state — how the code should look after refactoring}
24
+
25
+ ### Transformation Plan
26
+ | # | Transformation | Type | From → To | Invariants |
27
+ |---|---------------|------|-----------|-----------|
28
+ | 1 | {what to do} | Extract/Inline/Restructure/Migrate/Replace | {current} → {target} | {what must not change} |
29
+
30
+ ### Behavioral Invariants
31
+ | # | Invariant | How to Verify | Current Test Coverage |
32
+ |---|-----------|--------------|---------------------|
33
+ | 1 | {behavior that must be preserved} | {test or assertion strategy} | Covered/Needs test |
34
+
35
+ ### New Patterns Introduced
36
+ | Pattern | Where | Justification | Precedent in Codebase? |
37
+ |---------|-------|--------------|----------------------|
38
+ | {pattern} | {where it applies} | {why this pattern over alternatives} | Yes — {where} / No — {why new} |
39
+
40
+ ### Patterns Removed
41
+ | Pattern | Where | Replacement | Migration Strategy |
42
+ |---------|-------|-------------|-------------------|
43
+ | {pattern being replaced} | {current locations} | {what replaces it} | {how to migrate} |
44
+
45
+ ### Interface Contracts
46
+ | Interface / API | Current Contract | New Contract | Breaking? | Migration |
47
+ |----------------|-----------------|-------------|-----------|-----------|
48
+ | {interface} | {current shape} | {new shape or "unchanged"} | Yes/No | {strategy} |
49
+
50
+ ### Effort Estimate
51
+ | Phase | Effort | Parallelizable? |
52
+ |-------|--------|----------------|
53
+ | {phase} | S/M/L/XL | Yes/No |
54
+ | **Total** | {aggregate} | {parallel lanes} |
55
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: researcher-mode-regression
3
+ type: mode
4
+ description: Investigate when an issue was introduced by analyzing git history and changes.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `regression`
8
+
9
+ Investigate when the issue was likely introduced and what changed. Analyze git history, recent dependency updates, configuration changes, and deployment events in the affected area.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Regression Analysis
15
+
16
+ ### Timeline
17
+ | Date / Period | Change | Author | Files | Potential Link |
18
+ |--------------|--------|--------|-------|---------------|
19
+ | {date or range} | {commit message or change description} | {who} | {files changed} | High/Med/Low — {reasoning} |
20
+
21
+ ### Recent Changes in Affected Area
22
+ | File | Last Modified | Change Summary | Suspicious? |
23
+ |------|-------------|----------------|-------------|
24
+ | {file path} | {date} | {what changed} | Yes/No — {why} |
25
+
26
+ ### Dependency Changes
27
+ | Dependency | Previous Version | Current Version | Changelog Relevant? |
28
+ |-----------|-----------------|----------------|---------------------|
29
+ | {package} | {old} | {new} | Yes — {breaking change or bug fix} / No |
30
+
31
+ ### Configuration Changes
32
+ | Config | Change | When | Impact |
33
+ |--------|--------|------|--------|
34
+ | {config file or env var} | {what changed} | {when} | {how it could cause the issue} |
35
+
36
+ ### Most Likely Introduction Window
37
+ - **When:** {date range or commit range}
38
+ - **What changed:** {description}
39
+ - **Confidence:** High/Med/Low
40
+ - **Bisect strategy:** {how to narrow down further if needed}
41
+
42
+ ### Previously Working State
43
+ - **Last known good:** {version, commit, or date when this worked}
44
+ - **Evidence:** {test results, user reports, or deploy logs}
45
+ ```
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: researcher-mode-requirements-elicitation
3
+ type: mode
4
+ description: Detect ambiguities and missing requirements, generate structured questions across 10 dimensions.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `requirements-elicitation`
8
+
9
+ Analyze the task description against the codebase to detect ambiguities, unstated assumptions, and missing requirements. Generate structured questions for the user across 10 dimensions to resolve unknowns before implementation. Triggered by the `hatch3r-deep-context` rule based on complexity tier.
10
+
11
+ **Protocol:**
12
+
13
+ 1. Parse the task description for vague language ("improve", "better", "proper", "handle", "support", "clean up", "fix", "update") and flag each instance.
14
+ 2. Identify unstated assumptions by comparing the task against the codebase structure — what does the task imply but not state explicitly?
15
+ 3. For each of the 10 dimensions below, determine if the task description addresses it. If not, generate a targeted question.
16
+ 4. Scan the codebase for modules that will be affected by the task. For each, check whether the task description accounts for its consumers, contracts, and side effects. Generate dependency-derived questions from gaps.
17
+ 5. Check for cross-cutting concerns triggered by the task and list them with status (addressed / unaddressed).
18
+
19
+ **10 Dimensions:**
20
+
21
+ 1. **Data** — schema shape, data source, expected volume, validation rules, migration needs
22
+ 2. **Behavior** — success flow, error/failure flow, edge cases, concurrent access, idempotency
23
+ 3. **UI/UX** — loading states, empty states, error states, responsive behavior, accessibility, animations
24
+ 4. **Security** — auth/authz model, data sensitivity classification, input validation, rate limiting, CSRF/XSS
25
+ 5. **Performance** — expected data volume, caching strategy, pagination, lazy loading, bundle impact
26
+ 6. **Integration** — existing features this interacts with, shared state, event chains, API consumers
27
+ 7. **Migration** — existing data or behavior that changes, backward compatibility, rollback strategy
28
+ 8. **Observability** — logging requirements, metrics, error tracking, audit trail for the new behavior
29
+ 9. **Testing** — what constitutes "working", acceptance test scenarios, edge case coverage expectations
30
+ 10. **Rollout** — feature flags, phased rollout, A/B testing, rollback trigger conditions
31
+
32
+ **Output structure:**
33
+
34
+ ```markdown
35
+ ## Requirements Elicitation
36
+
37
+ ### Ambiguity Detection
38
+ | # | Term / Phrase | Context | Why It's Ambiguous | Suggested Clarification |
39
+ |---|--------------|---------|-------------------|------------------------|
40
+ | 1 | {vague term} | {where it appears} | {what's unclear} | {specific question} |
41
+
42
+ ### Dimension Probe Questions
43
+ | # | Dimension | Question | Why This Matters | Default If Unanswered |
44
+ |---|-----------|----------|-----------------|----------------------|
45
+ | 1 | {dimension} | {specific question} | {what could go wrong without an answer} | {safe default the implementer would assume} |
46
+
47
+ ### Dependency-Derived Questions
48
+ | # | Module / Interface | Consumers | Question |
49
+ |---|-------------------|-----------|----------|
50
+ | 1 | {module being changed} | {list of consumers} | {question about contract impact} |
51
+
52
+ ### Cross-Cutting Concern Checklist
53
+ | Concern | Triggered? | Addressed in Task? | Action Needed |
54
+ |---------|-----------|-------------------|--------------|
55
+ | Authentication / Authorization | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
56
+ | Internationalization (i18n) | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
57
+ | Accessibility (a11y) | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
58
+ | Error Handling | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
59
+ | Data Validation | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
60
+ | Observability / Logging | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
61
+ | Backward Compatibility | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
62
+ | Feature Flags / Rollout | Yes/No | Yes/No/Partial | {what to clarify or confirm} |
63
+
64
+ ### Requirements Summary
65
+ - **Resolved:** {N} dimensions fully addressed
66
+ - **Needs clarification:** {N} questions requiring user input before implementation
67
+ - **Safe defaults available:** {N} questions where a reasonable default exists if the user defers
68
+ ```
@@ -0,0 +1,41 @@
1
+ ---
2
+ id: researcher-mode-risk-assessment
3
+ type: mode
4
+ description: Identify risks, security implications, performance concerns, and breaking changes.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `risk-assessment`
8
+
9
+ Identify risks, security implications, performance concerns, breaking changes, migration needs, and common mistakes.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Risk Assessment
15
+
16
+ ### Technical Risks
17
+ | # | Risk | Likelihood | Impact | Mitigation |
18
+ |---|------|-----------|--------|------------|
19
+ | 1 | {risk} | High/Med/Low | High/Med/Low | {strategy} |
20
+
21
+ ### Security Implications
22
+ | # | Concern | Severity | Mitigation |
23
+ |---|---------|----------|------------|
24
+ | 1 | {concern} | Critical/High/Med/Low | {strategy} |
25
+
26
+ ### Performance Concerns
27
+ | # | Concern | When It Matters | Mitigation |
28
+ |---|---------|----------------|------------|
29
+ | 1 | {concern} | {threshold or condition} | {strategy} |
30
+
31
+ ### Breaking Changes
32
+ | # | What Breaks | Who Is Affected | Migration Path |
33
+ |---|------------|----------------|----------------|
34
+ | 1 | {change} | {consumers/users} | {migration strategy} |
35
+
36
+ ### Common Mistakes
37
+ - **{mistake}**: {why it's tempting} → {what to do instead}
38
+
39
+ ### Recommended Safeguards
40
+ - {safeguard}: {rationale}
41
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ id: researcher-mode-risk-prioritization
3
+ type: mode
4
+ description: Risk-ranked prioritization of testing effort by business impact and coverage.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `risk-prioritization`
8
+
9
+ Produce a risk-ranked prioritization of testing effort considering business impact, security exposure, change frequency, and current coverage. Used by `hatch3r-test-plan` to order test implementation for maximum risk reduction.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Risk-Based Test Prioritization
15
+
16
+ ### Risk Matrix
17
+ | # | Module / Area | Business Impact | Security Exposure | Change Frequency | Current Coverage | Risk Score | Test Priority |
18
+ |---|-------------|----------------|------------------|-----------------|-----------------|-----------|--------------|
19
+ | 1 | {module} | Critical/High/Med/Low | Critical/High/Med/Low | High/Med/Low | High/Med/Low/None | {weighted score} | P0/P1/P2/P3 |
20
+
21
+ ### Recommended Test Investment Order
22
+ | Priority | Module / Area | Recommended Tests | Effort | Risk Reduction |
23
+ |----------|-------------|------------------|--------|---------------|
24
+ | P0 | {module} | {test types and count} | S/M/L | {what risk this eliminates} |
25
+ | P1 | {module} | {test types and count} | S/M/L | {what risk this reduces} |
26
+ | P2 | {module} | {test types and count} | S/M/L | {what risk this reduces} |
27
+ | P3 | {module} | {test types and count} | S/M/L | {incremental improvement} |
28
+
29
+ ### Quick Wins
30
+ | # | Test to Add | Module | Effort | Risk Reduction | Why It's a Quick Win |
31
+ |---|-----------|--------|--------|---------------|---------------------|
32
+ | 1 | {specific test description} | {module} | XS/S | {impact} | {already has test infra / simple boundary / high-value assertion} |
33
+
34
+ ### Technical Debt Tests
35
+ | # | Debt Item | Module | Current Risk | Recommended Test | Blocks |
36
+ |---|----------|--------|-------------|-----------------|--------|
37
+ | 1 | {tech debt — e.g., untested legacy module, missing error handling tests} | {module} | {what could go wrong} | {test type and scope} | {what this blocks — e.g., safe refactoring, migration} |
38
+ ```
39
+
40
+ **Depth scaling:**
41
+ - **quick**: Risk matrix (top 5 modules) + quick wins only.
42
+ - **standard**: Full risk matrix, investment order (P0-P2), quick wins, and top 3 technical debt items.
43
+ - **deep**: All sections exhaustively. Full risk matrix with weighted scoring, complete investment order (P0-P3), all quick wins, and comprehensive technical debt test inventory.
@@ -0,0 +1,39 @@
1
+ ---
2
+ id: researcher-mode-root-cause
3
+ type: mode
4
+ description: Analyze the codebase for candidate root causes using static analysis patterns.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `root-cause`
8
+
9
+ Analyze the codebase for candidate root causes. Use static analysis patterns: off-by-one errors, race conditions, missing null checks, incorrect assumptions, stale caches, wrong operator usage, missing error handling, and anti-patterns. Rank hypotheses by likelihood.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Root Cause Analysis
15
+
16
+ ### Hypotheses (Ranked by Likelihood)
17
+ | Rank | Hypothesis | Likelihood | Evidence | Files Involved | Verification Strategy |
18
+ |------|-----------|-----------|----------|----------------|----------------------|
19
+ | 1 | {what might be wrong} | High/Med/Low | {code evidence supporting this} | {file paths} | {how to confirm or rule out} |
20
+ | 2 | {alternative cause} | High/Med/Low | {evidence} | {files} | {verification} |
21
+
22
+ ### Code Smells in Affected Area
23
+ | # | Smell | Location | Relevance to Bug |
24
+ |---|-------|----------|-----------------|
25
+ | 1 | {pattern — e.g., missing error handling, implicit type coercion} | {file:line} | {how it could cause or mask the bug} |
26
+
27
+ ### Dependency Analysis
28
+ | Dependency | Version | Known Issues | Relevance |
29
+ |-----------|---------|-------------|-----------|
30
+ | {library/module} | {version} | {any known bugs or CVEs} | {how it relates to the symptoms} |
31
+
32
+ ### Recommended Investigation Order
33
+ 1. {hypothesis to test first — highest likelihood + easiest to verify}
34
+ 2. {next hypothesis}
35
+ 3. {etc.}
36
+
37
+ ### Ruling-Out Notes
38
+ - {hypotheses already considered unlikely and why}
39
+ ```
@@ -0,0 +1,70 @@
1
+ ---
2
+ id: researcher-mode-similar-implementation
3
+ type: mode
4
+ description: Search the codebase for analogous features and extract implementation conventions.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `similar-implementation`
8
+
9
+ Search the codebase for analogous features, components, or modules and extract their implementation conventions as a reference for the implementer. The goal is to ensure new code follows established patterns rather than inventing new approaches.
10
+
11
+ **Protocol:**
12
+
13
+ 1. Parse the task to extract the core *type* of work — CRUD resource, dashboard widget, API endpoint, auth flow, data pipeline, form, modal, notification, list/table view, search feature, file upload, webhook handler, background job, etc.
14
+ 2. Search the codebase for modules and components that perform the same *type* of work. Use file name patterns, directory structure, import analysis, and semantic code search.
15
+ 3. Rank matches by structural similarity: file organization, patterns used, complexity level, recency.
16
+ 4. For the top 2-3 matches, extract:
17
+ - File structure and naming conventions (file names, directory placement, barrel exports)
18
+ - State management pattern (local state, context, store, server state, URL state)
19
+ - Error handling approach (try/catch style, error boundaries, toast notifications, inline errors)
20
+ - Data fetching / API pattern (hooks, services, direct fetch, query library)
21
+ - Test structure and coverage approach (co-located vs separate, naming, mock strategy)
22
+ - Component composition pattern (container/presenter, compound components, render props — if UI)
23
+ 5. Identify where the proposed feature MUST differ from references and why (different data shape, different auth model, different performance requirements).
24
+ 6. Present reference implementations with a recommendation for which to follow.
25
+
26
+ **Output structure:**
27
+
28
+ ```markdown
29
+ ## Similar Implementation Analysis
30
+
31
+ ### Work Type Classification
32
+ - **Detected type:** {type of work — e.g., "CRUD resource with list view and detail page"}
33
+ - **Search strategy:** {how references were found — file patterns, directory scan, semantic search}
34
+
35
+ ### Reference Implementations
36
+ | # | Module / Feature | Location | Similarity | Why It's a Good Reference |
37
+ |---|-----------------|----------|-----------|--------------------------|
38
+ | 1 | {name} | {directory/file path} | High/Med | {what makes it analogous} |
39
+ | 2 | {name} | {directory/file path} | High/Med | {what makes it analogous} |
40
+
41
+ ### Convention Extraction
42
+
43
+ #### Reference 1: {name}
44
+ | Aspect | Convention | Files |
45
+ |--------|-----------|-------|
46
+ | File structure | {pattern — e.g., "feature directory with index barrel, component, hook, types, test files"} | {example files} |
47
+ | State management | {pattern — e.g., "React Query for server state + local useState for UI state"} | {example files} |
48
+ | Error handling | {pattern — e.g., "ErrorBoundary wrapper + toast for mutations + inline for forms"} | {example files} |
49
+ | Data fetching | {pattern — e.g., "custom hook wrapping useQuery, service layer for API calls"} | {example files} |
50
+ | Test structure | {pattern — e.g., "co-located .test.tsx, RTL for components, msw for API mocks"} | {example files} |
51
+ | Component composition | {pattern — e.g., "container fetches data, presenter renders, shared via compound"} | {example files} |
52
+
53
+ ### Recommendation
54
+ - **Primary reference:** {name} — follow this for {rationale}
55
+ - **Secondary reference:** {name} — consult for {specific aspect}
56
+
57
+ ### Divergence Warnings
58
+ | # | Aspect | Reference Pattern | Required Divergence | Reason |
59
+ |---|--------|------------------|-------------------|--------|
60
+ | 1 | {aspect} | {what the reference does} | {what the new feature must do differently} | {why} |
61
+
62
+ ### Pattern-Match Checklist for Implementer
63
+ - [ ] File structure follows {reference} convention
64
+ - [ ] State management uses {pattern} as established in {reference}
65
+ - [ ] Error handling follows {pattern} from {reference}
66
+ - [ ] Data fetching uses {pattern} from {reference}
67
+ - [ ] Test structure matches {pattern} from {reference}
68
+ - [ ] Component composition follows {pattern} from {reference}
69
+ - [ ] Documented divergences with justification for each
70
+ ```
@@ -0,0 +1,39 @@
1
+ ---
2
+ id: researcher-mode-symptom-trace
3
+ type: mode
4
+ description: Trace reported symptoms through the codebase to find divergence points.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `symptom-trace`
8
+
9
+ Trace reported symptoms through the codebase. Map the execution path from user action to observed failure. Identify where expected behavior diverges from actual behavior.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Symptom Trace
15
+
16
+ ### Execution Path
17
+ | # | Step | File / Function | Expected Behavior | Observed / Likely Behavior |
18
+ |---|------|----------------|-------------------|---------------------------|
19
+ | 1 | {user action or trigger} | {entry point} | {what should happen} | {what likely happens} |
20
+ | 2 | {next step in flow} | {file:function} | {expected} | {observed or inferred} |
21
+
22
+ ### Divergence Point
23
+ - **Where:** {file:function or module where behavior diverges}
24
+ - **What:** {description of the divergence}
25
+ - **Evidence:** {code patterns, conditions, or state that suggest this is the divergence point}
26
+
27
+ ### Error Propagation
28
+ | From | To | How | Observable? |
29
+ |------|----|-----|-------------|
30
+ | {origin} | {downstream} | {mechanism — exception, bad state, silent failure} | Yes/No |
31
+
32
+ ### Affected Code Paths
33
+ | Path | Entry Point | Risk of Symptom | Notes |
34
+ |------|-------------|----------------|-------|
35
+ | {flow name} | {file:function} | High/Med/Low | {why this path is affected} |
36
+
37
+ ### Data Flow Concerns
38
+ - {any data integrity, state management, or concurrency concerns identified during tracing}
39
+ ```
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: researcher-mode-test-pattern
3
+ type: mode
4
+ description: Extract existing test conventions, framework usage, mock patterns, and helper libraries.
5
+ parent: hatch3r-researcher
6
+ ---
7
+ ### Mode: `test-pattern`
8
+
9
+ Extract existing test conventions, framework usage, mock patterns, and helper libraries to ensure new tests follow established patterns. Used by `hatch3r-test-plan` to align the test strategy with the project's existing test infrastructure.
10
+
11
+ **Output structure:**
12
+
13
+ ```markdown
14
+ ## Test Pattern Analysis
15
+
16
+ ### Framework & Tooling Inventory
17
+ | Tool | Version | Config File | Purpose |
18
+ |------|---------|------------|---------|
19
+ | {vitest/jest/playwright/stryker/etc.} | {version} | {config path} | {unit/integration/E2E/mutation} |
20
+
21
+ ### Directory Conventions
22
+ | Test Type | Directory | Naming Pattern | Co-located? |
23
+ |-----------|-----------|---------------|-------------|
24
+ | Unit | {path} | {pattern — e.g., *.test.ts} | Yes/No |
25
+ | Integration | {path} | {pattern} | Yes/No |
26
+ | E2E | {path} | {pattern} | Yes/No |
27
+ | Fixtures | {path} | {pattern} | — |
28
+ | Quarantine | {path or "none"} | {pattern} | — |
29
+
30
+ ### Mock & Fixture Patterns
31
+ | Pattern | Where Used | Convention | Compliance with hatch3r-testing |
32
+ |---------|-----------|-----------|-------------------------------|
33
+ | {fakes / stubs / mocks / MSW / nock / etc.} | {example files} | {how the project uses this pattern} | {aligned — fakes > stubs > mocks / divergent — explain} |
34
+
35
+ ### Test Helper Library
36
+ | Helper | Location | Purpose | Used By |
37
+ |--------|----------|---------|---------|
38
+ | {factory function / builder / custom matcher / setup utility} | {file path} | {what it does} | {which test files use it} |
39
+
40
+ ### Property-Based Testing Usage
41
+ | Status | Library | Where Used | Coverage |
42
+ |--------|---------|-----------|---------|
43
+ | {Active / Not used / Minimal} | {fast-check / etc. or "none"} | {file paths or "N/A"} | {which function types are covered} |
44
+
45
+ ### Convention Compliance
46
+ | Convention (hatch3r-testing rule) | Current State | Compliance |
47
+ |----------------------------------|--------------|-----------|
48
+ | Deterministic (no wall clock) | {compliant / violations found} | {details} |
49
+ | Isolated (own setup/teardown) | {compliant / violations found} | {details} |
50
+ | Fast (unit < 50ms, integration < 2s) | {compliant / unknown / violations} | {details} |
51
+ | Named clearly (behavior descriptions) | {compliant / mixed / non-compliant} | {details} |
52
+ | No network in unit tests | {compliant / violations found} | {details} |
53
+ | No type escape hatches | {compliant / violations found} | {details} |
54
+ | Fakes > stubs > mocks hierarchy | {followed / partially / not followed} | {details} |
55
+ | Factory over fixtures | {followed / partially / not followed} | {details} |
56
+ ```
57
+
58
+ **Depth scaling:**
59
+ - **quick**: Framework inventory + directory conventions only.
60
+ - **standard**: Full inventory, directory conventions, mock patterns, and convention compliance summary.
61
+ - **deep**: All sections exhaustively. Include test helper library analysis, property-based testing status, and detailed convention compliance with file-level violations.
@@ -0,0 +1,32 @@
1
+ ---
2
+ id: shared-external-knowledge
3
+ type: reference
4
+ description: Shared external knowledge reference for all agents — tooling hierarchy, platform CLI, Context7 MCP, and web research guidance.
5
+ ---
6
+ ## External Knowledge
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).
13
+
14
+ ## Context7 MCP Protocol
15
+
16
+ Use `resolve-library-id` to find the library, then `query-docs` to retrieve current documentation. Apply this for any framework, library, or tool whose API surface may have changed since training data.
17
+
18
+ - Prefer Context7 over guessing API signatures, configuration options, or behavioral details from potentially outdated training data.
19
+ - Always verify: method names, parameter signatures, return types, and configuration keys before using them in code.
20
+ - If Context7 returns no results, fall back to web research (below).
21
+
22
+ ## Web Research Protocol
23
+
24
+ Use web search when Context7 does not cover the topic, or for information that changes frequently:
25
+
26
+ - **Security:** Current CVE details (NVD), security advisories, supply chain attack patterns.
27
+ - **Standards:** Current best practice guidance, specification updates, compliance requirements.
28
+ - **Ecosystem:** Package maintenance status, alternative evaluations, community adoption signals.
29
+ - **Platform-specific advisories** by platform:
30
+ - **GitHub:** GitHub Security Advisories, Dependabot alerts
31
+ - **Azure DevOps:** Microsoft Defender for DevOps, WhiteSource/Mend
32
+ - **GitLab:** GitLab Dependency Scanning, Advisory Database