hatch3r 1.9.0 → 2.0.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.
- package/README.md +52 -143
- package/dist/cli/index.js +28453 -15831
- package/dist/content/agents/hatch3r-architect.md +39 -9
- package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
- package/dist/content/agents/hatch3r-ci-watcher.md +8 -1
- package/dist/content/agents/hatch3r-context-rules.md +19 -1
- package/dist/content/agents/hatch3r-creator.md +65 -26
- package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
- package/dist/content/agents/hatch3r-devops.md +11 -1
- package/dist/content/agents/hatch3r-docs-writer.md +11 -1
- package/dist/content/agents/hatch3r-edge-case-analyst.md +134 -0
- package/dist/content/agents/hatch3r-enhancability.md +192 -0
- package/dist/content/agents/hatch3r-fixer.md +59 -8
- package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
- package/dist/content/agents/hatch3r-handoff-loader.md +29 -3
- package/dist/content/agents/hatch3r-handoff-preparer.md +10 -1
- package/dist/content/agents/hatch3r-implementer.md +139 -8
- package/dist/content/agents/hatch3r-incident-responder.md +96 -0
- package/dist/content/agents/hatch3r-learnings-loader.md +122 -88
- package/dist/content/agents/hatch3r-lint-fixer.md +15 -3
- package/dist/content/agents/hatch3r-maintainability.md +183 -0
- package/dist/content/agents/hatch3r-pack-installer.md +113 -0
- package/dist/content/agents/hatch3r-performance.md +179 -0
- package/dist/content/agents/hatch3r-reliability.md +193 -0
- package/dist/content/agents/hatch3r-researcher.md +27 -4
- package/dist/content/agents/hatch3r-reviewer.md +153 -103
- package/dist/content/agents/hatch3r-scalability.md +162 -0
- package/dist/content/agents/hatch3r-security.md +197 -0
- package/dist/content/agents/hatch3r-testability.md +204 -0
- package/dist/content/agents/hatch3r-ui.md +175 -0
- package/dist/content/agents/hatch3r-ux.md +160 -0
- package/dist/content/agents/modes/requirements-elicitation.md +1 -1
- package/dist/content/agents/modes/user-flows.md +2 -2
- package/dist/content/agents/shared/clarification-default-block.md +44 -0
- package/dist/content/agents/shared/confidence-gate.md +42 -0
- package/dist/content/agents/shared/cq-specialist-roster.md +26 -0
- package/dist/content/agents/shared/efficiency-patterns.md +32 -1
- package/dist/content/agents/shared/injection-patterns.md +18 -7
- package/dist/content/agents/shared/principles.md +60 -0
- package/dist/content/agents/shared/prompt-structure.md +7 -1
- package/dist/content/agents/shared/quality-charter.md +48 -12
- package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
- package/dist/content/agents/shared/rigor-contract.md +151 -0
- package/dist/content/agents/shared/severity-mapping.md +92 -0
- package/dist/content/agents/shared/triage-vocabulary.md +46 -0
- package/dist/content/agents/shared/user-content-templates.md +34 -8
- package/dist/content/agents/shared/user-question-protocol.md +45 -3
- package/dist/content/checks/README.md +5 -0
- package/dist/content/checks/accessibility.md +14 -7
- package/dist/content/checks/code-quality.md +1 -1
- package/dist/content/checks/performance.md +7 -4
- package/dist/content/checks/security.md +6 -6
- package/dist/content/checks/testing.md +1 -1
- package/dist/content/commands/board/pickup-delegation-multi.md +37 -10
- package/dist/content/commands/board/pickup-delegation.md +7 -5
- package/dist/content/commands/board/pickup-modes.md +1 -0
- package/dist/content/commands/board/pickup-post-impl.md +1 -1
- package/dist/content/commands/hatch3r-api-spec.md +79 -2
- package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
- package/dist/content/commands/hatch3r-benchmark.md +90 -7
- package/dist/content/commands/hatch3r-board-fill.md +97 -11
- package/dist/content/commands/hatch3r-board-pickup.md +93 -9
- package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
- package/dist/content/commands/hatch3r-bug-plan.md +79 -3
- package/dist/content/commands/hatch3r-codebase-map.md +80 -4
- package/dist/content/commands/hatch3r-create.md +105 -7
- package/dist/content/commands/hatch3r-debug.md +102 -14
- package/dist/content/commands/hatch3r-diagnose.md +238 -0
- package/dist/content/commands/hatch3r-feature-plan.md +125 -5
- package/dist/content/commands/hatch3r-handoff.md +83 -3
- package/dist/content/commands/hatch3r-healthcheck.md +105 -5
- package/dist/content/commands/hatch3r-incident-response.md +228 -0
- package/dist/content/commands/hatch3r-migration-plan.md +79 -3
- package/dist/content/commands/hatch3r-onboard.md +94 -3
- package/dist/content/commands/hatch3r-pack-install.md +243 -0
- package/dist/content/commands/hatch3r-pr-resolve.md +106 -23
- package/dist/content/commands/hatch3r-project-spec.md +82 -6
- package/dist/content/commands/hatch3r-quick-change.md +108 -13
- package/dist/content/commands/hatch3r-refactor-plan.md +78 -2
- package/dist/content/commands/hatch3r-release.md +401 -0
- package/dist/content/commands/hatch3r-revision.md +98 -12
- package/dist/content/commands/hatch3r-roadmap.md +92 -10
- package/dist/content/commands/hatch3r-security-audit.md +105 -5
- package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
- package/dist/content/commands/hatch3r-spec.md +216 -0
- package/dist/content/commands/hatch3r-test-plan.md +85 -9
- package/dist/content/commands/hatch3r-workflow.md +165 -41
- package/dist/content/commands/revision/revision-delegation.md +6 -5
- package/dist/content/commands/revision/revision-modes.md +49 -4
- package/dist/content/commands/revision/revision-quality.md +10 -7
- package/dist/content/commands/shared/orchestration-frame.md +119 -0
- package/dist/content/github-agents/hatch3r-docs-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-lint-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-security-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-test-agent.md +21 -1
- package/dist/content/hooks/hatch3r-file-save.md +1 -1
- package/dist/content/hooks/hatch3r-pre-push.md +4 -4
- package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
- package/dist/content/mcp/mcp.json +7 -5
- package/dist/content/rules/hatch3r-accessibility-standards.md +14 -2
- package/dist/content/rules/hatch3r-accessibility-standards.mdc +12 -1
- package/dist/content/rules/hatch3r-agent-orchestration-detail.md +58 -19
- package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +58 -19
- package/dist/content/rules/hatch3r-agent-orchestration.md +87 -213
- package/dist/content/rules/hatch3r-agent-orchestration.mdc +87 -213
- package/dist/content/rules/hatch3r-ai-evals.md +5 -4
- package/dist/content/rules/hatch3r-ai-evals.mdc +3 -3
- package/dist/content/rules/hatch3r-ai-ux-patterns.md +6 -2
- package/dist/content/rules/hatch3r-ai-ux-patterns.mdc +4 -1
- package/dist/content/rules/hatch3r-android-patterns.md +107 -0
- package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
- package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
- package/dist/content/rules/hatch3r-api-design.md +5 -1
- package/dist/content/rules/hatch3r-api-design.mdc +3 -0
- package/dist/content/rules/hatch3r-api-versioning.md +2 -1
- package/dist/content/rules/hatch3r-auth-patterns.md +3 -1
- package/dist/content/rules/hatch3r-auth-patterns.mdc +1 -0
- package/dist/content/rules/hatch3r-browser-verification.md +2 -0
- package/dist/content/rules/hatch3r-browser-verification.mdc +2 -0
- package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
- package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
- package/dist/content/rules/hatch3r-ci-cd.md +8 -1
- package/dist/content/rules/hatch3r-ci-cd.mdc +6 -0
- package/dist/content/rules/hatch3r-clarification-default.md +73 -0
- package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
- package/dist/content/rules/hatch3r-code-standards.md +23 -47
- package/dist/content/rules/hatch3r-code-standards.mdc +22 -46
- package/dist/content/rules/hatch3r-component-conventions.md +3 -0
- package/dist/content/rules/hatch3r-component-conventions.mdc +3 -0
- package/dist/content/rules/hatch3r-container-hardening.md +11 -2
- package/dist/content/rules/hatch3r-container-hardening.mdc +9 -1
- package/dist/content/rules/hatch3r-contract-testing.md +2 -1
- package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
- package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
- package/dist/content/rules/hatch3r-data-classification.md +3 -1
- package/dist/content/rules/hatch3r-data-classification.mdc +2 -1
- package/dist/content/rules/hatch3r-deep-context.md +13 -13
- package/dist/content/rules/hatch3r-deep-context.mdc +13 -13
- package/dist/content/rules/hatch3r-dependency-management.md +16 -3
- package/dist/content/rules/hatch3r-dependency-management.mdc +15 -3
- package/dist/content/rules/hatch3r-design-system-detection.md +2 -1
- package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
- package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
- package/dist/content/rules/hatch3r-enhancability.md +147 -0
- package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
- package/dist/content/rules/hatch3r-event-schema-evolution.md +2 -1
- package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
- package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
- package/dist/content/rules/hatch3r-feature-flags.md +2 -0
- package/dist/content/rules/hatch3r-feature-flags.mdc +2 -0
- package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
- package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
- package/dist/content/rules/hatch3r-git-conventions.md +4 -1
- package/dist/content/rules/hatch3r-git-conventions.mdc +2 -0
- package/dist/content/rules/hatch3r-go-patterns.md +98 -0
- package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
- package/dist/content/rules/hatch3r-handoff-readiness.md +10 -0
- package/dist/content/rules/hatch3r-handoff-readiness.mdc +10 -0
- package/dist/content/rules/hatch3r-i18n.md +2 -0
- package/dist/content/rules/hatch3r-i18n.mdc +2 -0
- package/dist/content/rules/hatch3r-iteration-summary.md +75 -57
- package/dist/content/rules/hatch3r-iteration-summary.mdc +77 -54
- package/dist/content/rules/hatch3r-learning-system.md +202 -0
- package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
- package/dist/content/rules/hatch3r-maintainability.md +157 -0
- package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
- package/dist/content/rules/hatch3r-migrations.md +2 -1
- package/dist/content/rules/hatch3r-observability-logging.md +1 -1
- package/dist/content/rules/hatch3r-observability-metrics.md +1 -1
- package/dist/content/rules/hatch3r-observability-tracing.md +45 -36
- package/dist/content/rules/hatch3r-observability-tracing.mdc +44 -35
- package/dist/content/rules/hatch3r-operability.md +2 -1
- package/dist/content/rules/hatch3r-passkey-server.md +2 -1
- package/dist/content/rules/hatch3r-performance-budgets.md +2 -0
- package/dist/content/rules/hatch3r-performance-budgets.mdc +2 -0
- package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
- package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
- package/dist/content/rules/hatch3r-progressive-delivery.md +5 -1
- package/dist/content/rules/hatch3r-progressive-delivery.mdc +3 -0
- package/dist/content/rules/hatch3r-proof-model.md +131 -0
- package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
- package/dist/content/rules/hatch3r-python-patterns.md +70 -0
- package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
- package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
- package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
- package/dist/content/rules/hatch3r-resilience-patterns.md +2 -1
- package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
- package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
- package/dist/content/rules/hatch3r-right-sizing.md +68 -0
- package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
- package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
- package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-scalability.md +137 -0
- package/dist/content/rules/hatch3r-scalability.mdc +132 -0
- package/dist/content/rules/hatch3r-secrets-management.md +10 -1
- package/dist/content/rules/hatch3r-secrets-management.mdc +8 -0
- package/dist/content/rules/hatch3r-security-patterns.md +36 -34
- package/dist/content/rules/hatch3r-security-patterns.mdc +35 -34
- package/dist/content/rules/hatch3r-security.md +97 -0
- package/dist/content/rules/hatch3r-security.mdc +92 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
- package/dist/content/rules/hatch3r-testability.md +115 -0
- package/dist/content/rules/hatch3r-testability.mdc +110 -0
- package/dist/content/rules/hatch3r-testing.md +4 -1
- package/dist/content/rules/hatch3r-testing.mdc +2 -0
- package/dist/content/rules/hatch3r-theming.md +2 -0
- package/dist/content/rules/hatch3r-theming.mdc +2 -0
- package/dist/content/rules/hatch3r-tool-currency.md +91 -0
- package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
- package/dist/content/rules/hatch3r-tooling-hierarchy.md +29 -31
- package/dist/content/rules/hatch3r-tooling-hierarchy.mdc +27 -30
- package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
- package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
- package/dist/content/rules/hatch3r-ux-states-and-flows.md +11 -4
- package/dist/content/rules/hatch3r-ux-states-and-flows.mdc +9 -3
- package/dist/content/skills/hatch3r-a11y-audit/SKILL.md +10 -8
- package/dist/content/skills/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
- package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
- package/dist/content/skills/hatch3r-ai-feature/SKILL.md +4 -6
- package/dist/content/skills/hatch3r-api-spec/SKILL.md +27 -2
- package/dist/content/skills/hatch3r-architecture-review/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-board-groom/SKILL.md +11 -0
- package/dist/content/skills/hatch3r-board-init/SKILL.md +17 -1
- package/dist/content/skills/hatch3r-board-refresh/SKILL.md +12 -1
- package/dist/content/skills/hatch3r-board-shared/SKILL.md +38 -1
- package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
- package/dist/content/skills/hatch3r-bug-fix/SKILL.md +15 -2
- package/dist/content/skills/hatch3r-ci-pipeline/SKILL.md +17 -7
- package/dist/content/skills/hatch3r-cli-fd/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-fzf/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-gh/SKILL.md +50 -1
- package/dist/content/skills/hatch3r-cli-jq/SKILL.md +40 -6
- package/dist/content/skills/hatch3r-cli-ripgrep/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +130 -23
- package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
- package/dist/content/skills/hatch3r-context-health/SKILL.md +9 -7
- package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +37 -17
- package/dist/content/skills/hatch3r-customize/SKILL.md +5 -8
- package/dist/content/skills/hatch3r-dep-audit/SKILL.md +23 -7
- package/dist/content/skills/hatch3r-design-system-detect/SKILL.md +3 -7
- package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
- package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
- package/dist/content/skills/hatch3r-feature/SKILL.md +53 -3
- package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
- package/dist/content/skills/hatch3r-gh-agentic-workflows/SKILL.md +10 -8
- package/dist/content/skills/hatch3r-handoff-prepare/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-handoff-resume/SKILL.md +4 -7
- package/dist/content/{commands/hatch3r-hooks.md → skills/hatch3r-hooks/SKILL.md} +48 -137
- package/dist/content/skills/hatch3r-incident-response/SKILL.md +66 -7
- package/dist/content/skills/hatch3r-issue-workflow/SKILL.md +11 -0
- package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
- package/dist/content/skills/hatch3r-logical-refactor/SKILL.md +6 -7
- package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
- package/dist/content/skills/hatch3r-migration/SKILL.md +8 -7
- package/dist/content/skills/hatch3r-observability-verify/SKILL.md +17 -12
- package/dist/content/skills/hatch3r-perf-audit/SKILL.md +13 -9
- package/dist/content/skills/hatch3r-pr-creation/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-qa-validation/SKILL.md +6 -5
- package/dist/content/skills/hatch3r-recipe/SKILL.md +63 -60
- package/dist/content/skills/hatch3r-refactor/SKILL.md +6 -7
- package/dist/content/skills/hatch3r-release/SKILL.md +123 -11
- package/dist/content/skills/hatch3r-reliability-verify/SKILL.md +9 -5
- package/dist/content/{commands/hatch3r-report.md → skills/hatch3r-report/SKILL.md} +20 -17
- package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
- package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
- package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
- package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
- package/dist/content/skills/hatch3r-ui-ux-verify/SKILL.md +19 -11
- package/dist/content/skills/hatch3r-visual-refactor/SKILL.md +11 -7
- package/package.json +50 -31
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js.map +0 -1
- package/dist/content/agents/hatch3r-a11y-auditor.md +0 -159
- package/dist/content/agents/hatch3r-dependency-auditor.md +0 -219
- package/dist/content/agents/hatch3r-perf-profiler.md +0 -166
- package/dist/content/agents/hatch3r-security-auditor.md +0 -180
- package/dist/content/agents/hatch3r-test-writer.md +0 -171
- package/dist/content/commands/hatch3r-learn.md +0 -312
- package/dist/content/rules/hatch3r-learning-consult.md +0 -42
- package/dist/content/rules/hatch3r-learning-consult.mdc +0 -38
|
@@ -6,11 +6,11 @@ tags: [shared, ux, p1, p4]
|
|
|
6
6
|
cache_friendly: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
> Last updated: 2026-05-26
|
|
10
|
-
|
|
11
9
|
## Purpose
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
> Last updated: 2026-06-09
|
|
12
|
+
|
|
13
|
+
This protocol defines how hatch3r agents and commands surface clarifying or triage questions to the user across the 3 supported AI coding tools (Claude Code, Cursor, GitHub Copilot per `governance/CONSTITUTION.md` §6 Decision 12). It is the single source of truth for the *how* of asking; the *whether* is governed by [quality-charter §3 "Question Unclear Requirements"](./quality-charter.md) and §8 "Escalate Ambiguity Early". Coverage is a 100% floor, not a fixed file list: every framework-dev workflow that can mutate canonical artifacts routes its ASK through this protocol — the requirements-elicitation mode (`agents/modes/requirements-elicitation.md`), the shared §0 gate block (`agents/shared/clarification-default-block.md`), and every `agents/hatch3r-*.md` agent and `commands/hatch3r-*.md` command that detects ambiguity (counts: `governance/inventory.json` `counts.agents`, `counts.commands`, `counts.skills`). The "3 supported AI coding tools" figure above is drift-guarded against `inventory.json` `counts.adapters` by `scripts/inventory.ts` (`npm run inventory:check-docs`).
|
|
14
14
|
|
|
15
15
|
## When To Ask
|
|
16
16
|
|
|
@@ -19,6 +19,7 @@ This protocol defines how hatch3r agents and commands surface clarifying or tria
|
|
|
19
19
|
- **Branching path** — two or more viable approaches with materially different cost, scope, or risk.
|
|
20
20
|
- **Conflicting constraints** — requirements that cannot all hold (e.g., "no new dependencies" and "use library X").
|
|
21
21
|
- **Missing acceptance criteria** — no testable definition of done for the requested change.
|
|
22
|
+
- **Architectural premise concern** — request is well-specified and single-interpretation, but the chosen approach is architecturally misguided (wrong pattern for the constraint, mis-applied abstraction, foreseeable scaling failure). Surface the concern as a §0.5 Challenge the Premise question per quality-charter §3 — phrase it constructively ("Before I implement this, I want to confirm the approach because [specific concern]"), then offer 2-4 options (proceed as requested / proposed alternative / hybrid). Default-if-no-response: proceed as requested (lowest-blast-radius assumption is that the user has context the agent lacks).
|
|
22
23
|
|
|
23
24
|
## When NOT To Ask
|
|
24
25
|
|
|
@@ -42,6 +43,8 @@ The marker below is replaced at canonical-write time with the enumeration table
|
|
|
42
43
|
|
|
43
44
|
When viewing this file in the source repo (pre-generation), the marker is unsubstituted — refer to the adapter map in `src/pipeline/adapterToolTranslator.ts` for the same mappings.
|
|
44
45
|
|
|
46
|
+
**Sub-agent caveat (Claude Code).** The native `AskUserQuestion` tool is a main-agent / orchestrator affordance only. Claude Code filters it out of every Task-tool sub-agent context (foreground and background) regardless of the agent's `tools` declaration, so a spawned `hatch3r-*` sub-agent cannot call it (upstream-confirmed via `anthropics/claude-code` issues #18721, #12890, #34592; verified 2026-06-06 @ https://code.claude.com/docs/en/sub-agents). A sub-agent that hits an ASK trigger therefore does NOT use the native tool: it RETURNS Status `BLOCKED_AMBIGUITY` (`agents/shared/quality-charter.md` §17) with the question rendered via the Plain-Text Fallback Template below, and the orchestrator owns the live ASK (`agents/shared/clarification-default-block.md` → Protocol). This exclusion is re-verified each audit cycle against the date stamp on `src/pipeline/adapterToolTranslator.ts::ASK_USER_TOOLS` (`claude` entry) — a date drift there is a D09 Medium finding.
|
|
47
|
+
|
|
45
48
|
## Plain-Text Fallback Template
|
|
46
49
|
|
|
47
50
|
Use this exact shape when no native tool is available:
|
|
@@ -63,6 +66,19 @@ Rules for the template:
|
|
|
63
66
|
- The default-if-no-response line is mandatory — it removes the deadlock when the user is away or replies "you decide".
|
|
64
67
|
- The default option is the safest reversible choice, not the most ambitious one.
|
|
65
68
|
|
|
69
|
+
### Optional preview attachment (orchestrator-scoped, platform-conditional)
|
|
70
|
+
|
|
71
|
+
For questions whose options differ along a **visual or layout dimension** — a color/spacing/typography choice, two candidate component arrangements, a copy-tone A/B, a before/after of an async-view state — a rendered preview alongside the numbered options lets the user decide from the artifact instead of from prose. This is most useful for the UI (CQ1) and UX (CQ2) ASK gates, where "which of these reads better" is the decision.
|
|
72
|
+
|
|
73
|
+
Attach a preview only when BOTH hold:
|
|
74
|
+
|
|
75
|
+
- **You are the orchestrator** (main-conversation `commands/hatch3r-*.md`), not a Task-tool sub-agent. Sub-agents cannot call the native question tool at all (see the Sub-agent caveat above); they render the question — and any preview snippet — in the `BLOCKED_AMBIGUITY` structured result, and the orchestrator owns the live ASK.
|
|
76
|
+
- **The runtime's native question tool supports rich/rendered option content.** Capability is per-platform; look up your runtime's row in the adapter map (`src/pipeline/adapterToolTranslator.ts::ASK_USER_TOOLS`) before relying on a preview, exactly as you would for the question tool itself. When the platform's native tool is text-only (or absent), embed the preview as a fenced code block inside the Plain-Text Fallback Template instead — never assume a rendering affordance the platform row does not document.
|
|
77
|
+
|
|
78
|
+
**Concrete affordance (Claude Code orchestrator).** On the `claude` platform, populate the per-option `markdown` field of the `AskUserQuestion` tool: when any option carries a `markdown` value, Claude Code switches to a side-by-side preview layout (numbered options on the left, the rendered markdown on the right), so a diagram, code/diff block, or token-swatch table renders inline with the choice. The field accepts markdown only (no HTML), and long content is truncated to a scrollable panel — keep each option's preview to about one screen of markup. One documented constraint: supplying a `markdown` field suppresses the free-text "Other / Type something" option on that question, so reserve the preview layout for closed-option visual decisions. Other platforms expose no documented preview field (their `ASK_USER_TOOLS` row is `null` — `cursor`, `copilot` as of 2026-06-09); on those, fall back to the fenced-code-block-in-plain-text shape above.
|
|
79
|
+
|
|
80
|
+
The preview is an enrichment, not a replacement: the numbered options and the mandatory `Default if no response:` line are still required. Keep the preview small (one screen of markup or a single mock) so it does not bury the decision.
|
|
81
|
+
|
|
66
82
|
## Examples
|
|
67
83
|
|
|
68
84
|
**Example 1 — Ambiguous requirement.** Request: "Add caching to the user profile endpoint."
|
|
@@ -88,6 +104,23 @@ Default if no response: 2
|
|
|
88
104
|
Default if no response: 2
|
|
89
105
|
```
|
|
90
106
|
|
|
107
|
+
## Operationalising Default-if-no-Response
|
|
108
|
+
|
|
109
|
+
The "Default if no response" line is mandatory in every plain-text fallback question (per the rules above) and is the canonical deadlock-breaker for every ASK gate across the framework. To operationalise the default at runtime rather than leaving it as documented prose:
|
|
110
|
+
|
|
111
|
+
1. **Detect non-response.** If a question goes unanswered within the host runtime's question window (Claude Code: idle session timeout; Cursor: AskUserQuestion timeout; Copilot Workspace: prompt-cycle gap), or if the user replies "you decide" / "default" / empty, treat as non-response.
|
|
112
|
+
2. **Apply the safe default.** Pick the option declared on the `Default if no response: <option number>` line — the lowest-blast-radius reversible choice the question's author named.
|
|
113
|
+
3. **Log the default-taken decision.** Emit in the Iteration Summary §8 (Open Questions / Blockers) a single line: `Default applied: <question summary> → option <N> (<one-line reason>)`. This is the operational counterpart to the prose mandate — every agent / command ASK output that exercises the default MUST log the decision. The §8 line is a required field of the canonical Iteration Summary template (`rules/hatch3r-iteration-summary.md` → The 9 Sections, item 8), and the catching-gate ownership is named in `rules/hatch3r-clarification-default.md` → How to ask — those two files are the enforcing surface for this step.
|
|
114
|
+
4. **Never silent-pick.** If no `Default if no response: <option>` line was emitted with the question (an authoring bug per the rules in this file), return `BLOCKED_AMBIGUITY` in the structured result rather than guessing.
|
|
115
|
+
|
|
116
|
+
The §8 log is the audit-visible evidence that the default-if-no-response contract was honored; absence of the log when a default was applied is a P8 B1 gate failure. Runtime emission of the §8 line is orchestrator-produced interpreted markdown, so no static gate can verify it fired — D05 (prompt-engineering) and D13 (human-AI collaboration) audit-cycle spot checks plus the per-run Iteration Summary validation gate are the enforcement, not a compiled check.
|
|
117
|
+
|
|
118
|
+
The contract has a single named owner so it is not re-declared per command: the always-on, `precedence: high` rule `rules/hatch3r-clarification-default.md` (`scope: always`) binds every `commands/hatch3r-*.md` orchestrator and mutating skill corpus-wide, and that rule's "How to ask" section is the catching gate. An individual command body therefore need not repeat the default-handling vocabulary to be bound by it — the rule + this protocol + the Iteration Summary §8 template are the three-anchor owner set, and a command inherits the contract by being in scope. Treat a command that *does* restate it as a convenience, not the source of truth.
|
|
119
|
+
|
|
120
|
+
## Cross-Phase Aggregation
|
|
121
|
+
|
|
122
|
+
This protocol defines the *shape* of a single question (numbered options, mandatory default). It does not define where pending questions accumulate when several fire across one pipeline run. That cross-phase aggregation layer is the `PipelineContext.pendingUserInputs: PendingUserInput[]` field (`src/pipeline/pipelineContext.ts`, Finding D7-SA7.1-F-10): each phase pushes a `PendingUserInput` — whose `options` + `defaultIfNoResponse` mirror the Plain-Text Fallback Template above — instead of emitting a direct prompt mid-phase. The orchestrator drains the array between phases, paginating when more than three accumulate, so a Tier 3 run's multiple ASK checkpoints are batched rather than each rendered independently. Per-question UX (this file) and cross-phase batching (the field) are complementary: author each request to this template, enqueue it on the field.
|
|
123
|
+
|
|
91
124
|
## Anti-Patterns
|
|
92
125
|
|
|
93
126
|
- **Multi-question barrage** — asking five questions in one turn. Ask the highest-leverage one first; the answer often collapses the rest.
|
|
@@ -95,3 +128,12 @@ Default if no response: 2
|
|
|
95
128
|
- **Silent assumption** — proceeding when ambiguity is real. Apply quality-charter §8: log the ambiguity in structured output even if you decide to proceed under a default.
|
|
96
129
|
- **Echo-as-question** — restating the user's request back as a question ("So you want me to add caching?"). Confirm only when you have a specific decision point with options to offer.
|
|
97
130
|
- **Inflated default** — choosing the most disruptive option as the no-response default. Defaults must be the reversible, lowest-blast-radius choice.
|
|
131
|
+
|
|
132
|
+
## References
|
|
133
|
+
|
|
134
|
+
The `markdown`-field preview affordance documented in "Optional preview attachment" above is corroborated by:
|
|
135
|
+
|
|
136
|
+
- `anthropics/claude-code` issue #27348 — names the `markdown` field on `AskUserQuestion` options as the trigger for the preview layout and the "Other / Type something" suppression constraint (accessed 2026-06-09; trust tier: official-vendor issue tracker). https://github.com/anthropics/claude-code/issues/27348
|
|
137
|
+
- `anthropics/claude-code` issue #33062 — documents the side-by-side preview panel and its scroll/truncation behavior for long content (accessed 2026-06-09; trust tier: official-vendor issue tracker). https://github.com/anthropics/claude-code/issues/33062
|
|
138
|
+
|
|
139
|
+
Per-platform tool names and the `null`-means-no-native-tool convention are sourced in `src/pipeline/adapterToolTranslator.ts::ASK_USER_TOOLS` (each entry carries its own `// verified <date> @ <docs URL>` stamp, refreshed on the D09 per-cycle web-research pass).
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: checks-readme
|
|
3
|
+
type: documentation
|
|
4
|
+
description: Authoring guide and directory contract for the checks/ review-criteria files. Not a check itself — excluded from check enumeration by its documentation type.
|
|
5
|
+
---
|
|
1
6
|
# Checks
|
|
2
7
|
|
|
3
8
|
Review criteria definitions for automated and agent-assisted code review. Each check file defines a set of criteria that agents reference when reviewing code changes.
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: accessibility
|
|
3
3
|
type: check
|
|
4
|
-
description: Accessibility review criteria covering WCAG compliance, semantic HTML, keyboard navigation, screen reader support, and inclusive design patterns
|
|
4
|
+
description: Accessibility review criteria covering WCAG 2.2 AA compliance, semantic HTML, keyboard navigation, screen reader support, and inclusive design patterns
|
|
5
|
+
tags: [accessibility]
|
|
5
6
|
cache_friendly: true
|
|
6
7
|
---
|
|
7
8
|
# Accessibility Check
|
|
8
9
|
|
|
9
|
-
> **Severity vocabulary:** see [
|
|
10
|
+
> **Severity vocabulary:** see [agents/shared/severity-mapping.md](../agents/shared/severity-mapping.md) for canonical 5-column mapping.
|
|
10
11
|
|
|
11
12
|
Review criteria for evaluating accessibility in pull requests.
|
|
12
13
|
|
|
13
14
|
## Semantic HTML and ARIA
|
|
14
15
|
|
|
15
16
|
- `[CRITICAL]` Interactive elements use native HTML controls (`<button>`, `<a>`, `<input>`, `<select>`) rather than styled `<div>` or `<span>` elements with click handlers.
|
|
16
|
-
- `[CRITICAL]` Custom interactive components
|
|
17
|
+
- `[CRITICAL]` Custom interactive components carry ARIA roles, states, and properties that match the WAI-ARIA 1.2 Authoring Practices pattern for the widget type (`role`, `aria-expanded`, `aria-selected`, `aria-disabled`, etc.); axe-core 4.5+ reports 0 `aria-required-attr` / `aria-allowed-role` violations.
|
|
17
18
|
- `[CRITICAL]` Images have meaningful `alt` text, or `alt=""` and `aria-hidden="true"` if purely decorative.
|
|
18
19
|
- `[CRITICAL]` Form inputs have associated `<label>` elements (via `for`/`id` or nesting). No input relies solely on placeholder text for identification.
|
|
19
20
|
- `[RECOMMENDED]` Headings follow a logical hierarchy (`h1` > `h2` > `h3`) without skipping levels.
|
|
@@ -21,22 +22,28 @@ Review criteria for evaluating accessibility in pull requests.
|
|
|
21
22
|
|
|
22
23
|
## Keyboard Navigation
|
|
23
24
|
|
|
24
|
-
- `[CRITICAL]` All interactive elements are reachable and operable via keyboard (Tab, Shift+Tab, Enter, Space
|
|
25
|
+
- `[CRITICAL]` All interactive elements are reachable and operable via keyboard (Tab, Shift+Tab, Enter, Space; Arrow keys for composite widgets per the WAI-ARIA APG keyboard-interaction table for that widget — menu, listbox, tablist, grid).
|
|
25
26
|
- `[CRITICAL]` Focus is not trapped in a component unless it is a modal dialog with an explicit close mechanism.
|
|
26
27
|
- `[CRITICAL]` Custom keyboard shortcuts do not conflict with screen reader or browser shortcuts.
|
|
27
28
|
- `[RECOMMENDED]` Focus order follows the visual reading order (logical DOM order). No use of positive `tabindex` values.
|
|
28
|
-
- `[
|
|
29
|
+
- `[CRITICAL]` WCAG 2.2 SC 2.4.7 Focus Visible (AA): the keyboard focus indicator is visible on every operable element. No `outline: none` without a conforming custom focus style.
|
|
30
|
+
- `[CRITICAL]` WCAG 2.2 SC 2.4.11 Focus Not Obscured (Minimum) (AA): the focused element is not entirely hidden by author-created content (sticky headers, footers, cookie banners, overlays). `[RECOMMENDED]` SC 2.4.13 Focus Appearance (AAA) as the enhanced target: the focus indicator has a contrast ratio of at least 3:1 against adjacent colors and a minimum area equal to a 1px-thick perimeter (or 4px-thick along the shortest side).
|
|
29
31
|
|
|
30
32
|
## Visual Design and Color
|
|
31
33
|
|
|
32
|
-
- `[CRITICAL]` Text meets WCAG 2.
|
|
34
|
+
- `[CRITICAL]` Text meets WCAG 2.2 AA contrast ratios: 4.5:1 for normal text, 3:1 for large text (18px+ or 14px+ bold). Verify with axe-core 4.5+ `color-contrast` rule — 0 violations.
|
|
33
35
|
- `[CRITICAL]` Information is not conveyed by color alone. Status indicators, errors, and required fields use icons, text, or patterns in addition to color.
|
|
34
36
|
- `[CRITICAL]` UI remains functional and readable at 200% browser zoom without horizontal scrolling or content clipping.
|
|
35
|
-
- `[RECOMMENDED]` Touch targets are at least 44x44 CSS pixels for mobile interfaces.
|
|
36
37
|
- `[RECOMMENDED]` Animations respect the `prefers-reduced-motion` media query — reduce or remove motion for users who have requested it.
|
|
37
38
|
|
|
39
|
+
## Touch and Pointer Targets (WCAG 2.2)
|
|
40
|
+
|
|
41
|
+
- `[CRITICAL]` WCAG 2.2 SC 2.5.8 Target Size (Minimum): pointer targets are at least 24x24 CSS px, OR have 24px of spacing to adjacent targets, unless an inline/essential exception applies. Mobile interfaces target 44x44 CSS px (Apple HIG / Material).
|
|
42
|
+
- `[CRITICAL]` WCAG 2.2 SC 2.5.7 Dragging Movements: any drag operation (slider, drag-to-reorder, map pan) provides a single-pointer alternative that does not require dragging (tap, click, or button control).
|
|
43
|
+
|
|
38
44
|
## Screen Reader Support
|
|
39
45
|
|
|
46
|
+
- `[CRITICAL]` WCAG 2.2 SC 4.1.3 Status Messages: status messages (success/error/progress, search-result counts, loading state) are programmatically conveyed via `role="status"`, `role="alert"`, or an `aria-live` region without moving focus, so assistive tech announces them.
|
|
40
47
|
- `[CRITICAL]` Dynamic content updates (toast notifications, live regions, inline validation) use `aria-live` regions (`polite` or `assertive`) to announce changes.
|
|
41
48
|
- `[CRITICAL]` Modal dialogs trap focus, announce their title via `aria-labelledby`, and return focus to the trigger element on close.
|
|
42
49
|
- `[CRITICAL]` Icon-only buttons and links have accessible names via `aria-label`, `aria-labelledby`, or visually hidden text.
|
|
@@ -6,7 +6,7 @@ cache_friendly: true
|
|
|
6
6
|
---
|
|
7
7
|
# Code Quality Check
|
|
8
8
|
|
|
9
|
-
> **Severity vocabulary:** see [
|
|
9
|
+
> **Severity vocabulary:** see [agents/shared/severity-mapping.md](../agents/shared/severity-mapping.md) for canonical 5-column mapping.
|
|
10
10
|
|
|
11
11
|
Review criteria for evaluating code quality in pull requests.
|
|
12
12
|
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
id: performance
|
|
3
3
|
type: check
|
|
4
4
|
description: Performance review criteria covering bundle size, render performance, memory usage, network optimization, database queries, and runtime efficiency
|
|
5
|
+
tags: [performance]
|
|
5
6
|
cache_friendly: true
|
|
6
7
|
---
|
|
7
8
|
# Performance Check
|
|
8
9
|
|
|
9
|
-
> **Severity vocabulary:** see [
|
|
10
|
+
> **Severity vocabulary:** see [agents/shared/severity-mapping.md](../agents/shared/severity-mapping.md) for canonical 5-column mapping.
|
|
11
|
+
|
|
12
|
+
**Applies when:** the project declares performance budgets. Without declared budgets this check is advisory, not gating (per `rules/hatch3r-right-sizing.md`).
|
|
10
13
|
|
|
11
14
|
Review criteria for evaluating performance in pull requests.
|
|
12
15
|
|
|
@@ -14,7 +17,7 @@ Review criteria for evaluating performance in pull requests.
|
|
|
14
17
|
|
|
15
18
|
- `[CRITICAL]` New dependencies do not increase the total bundle size (gzipped) beyond the defined budget. Measure before and after.
|
|
16
19
|
- `[CRITICAL]` No unintentional import of full libraries when a subpath import or tree-shakable alternative exists (e.g., `import _ from "lodash"` vs `import groupBy from "lodash/groupBy"`).
|
|
17
|
-
- `[RECOMMENDED]` Images and static assets are
|
|
20
|
+
- `[RECOMMENDED]` Images and static assets are compressed and served in WebP or AVIF, with intrinsic dimensions no larger than the maximum rendered size at 2x device pixel ratio (no downscaling a >2x-oversized source in the browser).
|
|
18
21
|
- `[RECOMMENDED]` CSS and JavaScript are minified and dead-code-eliminated in production builds.
|
|
19
22
|
|
|
20
23
|
## Render and Paint Performance
|
|
@@ -35,7 +38,7 @@ Review criteria for evaluating performance in pull requests.
|
|
|
35
38
|
|
|
36
39
|
- `[CRITICAL]` No N+1 request patterns — batch or aggregate related requests instead of issuing one per item.
|
|
37
40
|
- `[CRITICAL]` API response payloads return only required fields. No over-fetching of large objects when a subset is needed.
|
|
38
|
-
- `[RECOMMENDED]` Cacheable responses
|
|
41
|
+
- `[RECOMMENDED]` Cacheable responses set `Cache-Control` with an explicit `max-age` (immutable static assets `max-age=31536000, immutable`; mutable API responses `no-cache` or a documented TTL) plus an `ETag` or `Last-Modified` validator. Responses that mutate state or carry per-user data set `Cache-Control: private` or `no-store`.
|
|
39
42
|
- `[RECOMMENDED]` Request waterfalls are minimized — parallelize independent requests and preload critical resources.
|
|
40
43
|
|
|
41
44
|
## Database Query Performance
|
|
@@ -49,7 +52,7 @@ Review criteria for evaluating performance in pull requests.
|
|
|
49
52
|
## Runtime Performance
|
|
50
53
|
|
|
51
54
|
- `[CRITICAL]` No synchronous blocking operations (heavy computation, synchronous I/O) on the main thread or event loop.
|
|
52
|
-
- `[CRITICAL]` Hot-path code (called per-request, per-frame, or per-event) does not
|
|
55
|
+
- `[CRITICAL]` Hot-path code (called per-request, per-frame, or per-event) does not recompute a pure result whose inputs are unchanged since the last call — memoize or cache any such repeated pure computation, and bound the cache with an eviction policy (size cap or TTL).
|
|
53
56
|
- `[RECOMMENDED]` CPU-intensive work is offloaded to workers, background jobs, or streaming pipelines.
|
|
54
57
|
- `[RECOMMENDED]` Object allocation in tight loops is minimized — reuse buffers and avoid creating short-lived objects per iteration.
|
|
55
58
|
|
|
@@ -6,7 +6,7 @@ cache_friendly: true
|
|
|
6
6
|
---
|
|
7
7
|
# Security Check
|
|
8
8
|
|
|
9
|
-
> **Severity vocabulary:** see [
|
|
9
|
+
> **Severity vocabulary:** see [agents/shared/severity-mapping.md](../agents/shared/severity-mapping.md) for canonical 5-column mapping.
|
|
10
10
|
|
|
11
11
|
Review criteria for evaluating security posture in pull requests.
|
|
12
12
|
|
|
@@ -20,10 +20,10 @@ Review criteria for evaluating security posture in pull requests.
|
|
|
20
20
|
|
|
21
21
|
## Authentication and Authorization
|
|
22
22
|
|
|
23
|
-
- `[CRITICAL]` New endpoints
|
|
23
|
+
- `[CRITICAL]` New endpoints enforce authentication and resource-level authorization per an OAuth 2.1 / RBAC rubric — every non-public route rejects unauthenticated requests (401) and out-of-scope authenticated requests (403). No accidental public exposure of protected resources.
|
|
24
24
|
- `[CRITICAL]` Authorization checks verify the authenticated user has access to the specific resource, not just that they're logged in.
|
|
25
25
|
- `[CRITICAL]` Authentication tokens are not logged, included in URLs, or exposed in error messages.
|
|
26
|
-
- `[RECOMMENDED]` Session tokens use secure attributes: `HttpOnly`, `Secure`, `SameSite=Strict`,
|
|
26
|
+
- `[RECOMMENDED]` Session tokens use secure attributes: `HttpOnly`, `Secure`, `SameSite=Strict`, and a `Max-Age` no longer than the session policy (default ≤24h for access tokens, ≤30d for refresh tokens).
|
|
27
27
|
- `[RECOMMENDED]` Rate limiting is applied to authentication endpoints (login, password reset, OTP verification).
|
|
28
28
|
|
|
29
29
|
## Secrets and Credentials
|
|
@@ -38,8 +38,8 @@ Review criteria for evaluating security posture in pull requests.
|
|
|
38
38
|
|
|
39
39
|
- `[CRITICAL]` New dependencies are from trusted sources with active maintenance (recent commits, multiple maintainers).
|
|
40
40
|
- `[CRITICAL]` No known critical or high vulnerabilities in new or updated dependencies (`npm audit`, `pip audit`, etc.).
|
|
41
|
-
- `[RECOMMENDED]`
|
|
42
|
-
- `[RECOMMENDED]` New dependencies
|
|
41
|
+
- `[RECOMMENDED]` Each added runtime dependency is justified in the PR description; a standard-library or already-present-dependency equivalent that covers the same use case is preferred over a new transitive dependency tree.
|
|
42
|
+
- `[RECOMMENDED]` New dependencies carry an OSI-approved license compatible with the project license (no GPL/AGPL copyleft in a permissively-licensed product unless legal-approved).
|
|
43
43
|
|
|
44
44
|
## Data Exposure
|
|
45
45
|
|
|
@@ -58,4 +58,4 @@ Review criteria for evaluating security posture in pull requests.
|
|
|
58
58
|
## Error Handling
|
|
59
59
|
|
|
60
60
|
- `[CRITICAL]` Error responses to clients do not include stack traces, internal paths, or database details.
|
|
61
|
-
- `[RECOMMENDED]` Security-relevant errors (auth failures, permission denials) are logged with
|
|
61
|
+
- `[RECOMMENDED]` Security-relevant errors (auth failures, permission denials) are logged with the five fields an incident responder needs — timestamp, actor/subject identifier, action attempted, resource, and outcome — and never the secret or credential that was rejected.
|
|
@@ -6,7 +6,7 @@ cache_friendly: true
|
|
|
6
6
|
---
|
|
7
7
|
# Testing Check
|
|
8
8
|
|
|
9
|
-
> **Severity vocabulary:** see [
|
|
9
|
+
> **Severity vocabulary:** see [agents/shared/severity-mapping.md](../agents/shared/severity-mapping.md) for canonical 5-column mapping.
|
|
10
10
|
|
|
11
11
|
Review criteria for evaluating test coverage and quality in pull requests.
|
|
12
12
|
|
|
@@ -63,9 +63,11 @@ After the shared epic-level research, score each sub-issue individually and run
|
|
|
63
63
|
|
|
64
64
|
### 6b.3. Execute Level-by-Level With Parallel Sub-Agents
|
|
65
65
|
|
|
66
|
+
Worktree isolation applies here identically to the batch path: when ≥2 implementers run concurrently in a level on a Tier 2/3 run and the platform writes into the orchestrator's tree, isolate each implementer per **Step 6c.3-iso** (`--isolate=auto|on|off`, default `auto`) and integrate via the merge protocol in Step 6b.4. Sub-issues in an epic share file overlap more often than standalone batch issues, so the missed-overlap risk that isolation removes is higher here.
|
|
67
|
+
|
|
66
68
|
For each dependency level, starting at Level 1:
|
|
67
69
|
|
|
68
|
-
1. **Spawn one implementer sub-agent per sub-issue in the current level.** Use the Task tool with `subagent_type: "generalPurpose"`. Launch as many sub-agents concurrently as the platform supports.
|
|
70
|
+
1. **Spawn one implementer sub-agent per sub-issue in the current level.** Use the Task tool with `subagent_type: "generalPurpose"`. Launch as many sub-agents concurrently as the platform supports. When worktree isolation is active (per the note above), create one scratch worktree per implementer first and pin each sub-agent to its `.worktrees/pickup-iso-<sub-issue-number>/` path.
|
|
69
71
|
|
|
70
72
|
2. **Each sub-agent prompt must include:**
|
|
71
73
|
- The sub-issue number, title, full body, and acceptance criteria.
|
|
@@ -82,13 +84,15 @@ For each dependency level, starting at Level 1:
|
|
|
82
84
|
- Relevant learnings from `.hatch3r/learnings/` (from Step 6.pre).
|
|
83
85
|
- Instruction to use GitHub MCP for issue reads, and follow the project's tooling hierarchy for external knowledge augmentation.
|
|
84
86
|
- Explicit instruction: do NOT create branches, commits, or PRs.
|
|
87
|
+
- `correlation_id` (UUID v4 per top-level task per `rules/hatch3r-agent-orchestration.md` → Correlation ID; each epic sub-issue gets its own id).
|
|
85
88
|
- Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
|
|
86
89
|
|
|
87
90
|
3. **Await all sub-agents in the current level.** Collect their structured results (files changed, tests written, issues encountered).
|
|
88
91
|
|
|
89
92
|
4. **Review sub-agent results:**
|
|
90
93
|
- If any sub-agent reports BLOCKED or PARTIAL, **ASK** the user how to proceed (skip, fix manually, retry).
|
|
91
|
-
-
|
|
94
|
+
- **When worktree isolation was active for this level** (Step 6c.3-iso, applied per the 6b.3 note): integrate each scratch worktree's file diff back onto the branch via the Step 6b.4 conflict-resolution step, then run `npx hatch3r worktree-cleanup --yes` before advancing.
|
|
95
|
+
- If sub-agents modified overlapping files (or the isolated integration above surfaced an overlap Step 3 missed), review for conflicts and resolve before proceeding.
|
|
92
96
|
|
|
93
97
|
5. **Advance to the next dependency level.** Repeat steps 1-4 until all levels are complete.
|
|
94
98
|
|
|
@@ -97,7 +101,7 @@ For each dependency level, starting at Level 1:
|
|
|
97
101
|
After all sub-agents complete:
|
|
98
102
|
|
|
99
103
|
1. Run a combined quality check across all changes.
|
|
100
|
-
2. Resolve any cross-sub-issue integration issues.
|
|
104
|
+
2. Resolve any cross-sub-issue integration issues — when isolation ran, this is where each worktree's diff lands on the branch; physically disjoint writes apply cleanly and only Step-3-missed overlaps need manual resolution.
|
|
101
105
|
3. Verify no file conflicts between parallel sub-agent outputs.
|
|
102
106
|
|
|
103
107
|
---
|
|
@@ -131,11 +135,31 @@ Unlike epics (which share a single researcher), standalone issues in a batch are
|
|
|
131
135
|
|
|
132
136
|
3. **Await all researchers.** Collect structured outputs. Each researcher's output feeds exclusively into its corresponding implementer in Step 6c.3. For Tier 2/3 issues, present elicitation questions to the user and await answers before proceeding.
|
|
133
137
|
|
|
138
|
+
### 6c.3-iso. Optional Worktree Isolation (Parallel Implementers, Filesystem Platforms)
|
|
139
|
+
|
|
140
|
+
Step 3 collision detection predicts file overlap and moves overlapping issues to sequential levels. That prediction is fallible: a missed overlap (Step 3.4) puts two implementers into the orchestrator's single working tree, where concurrent writes to the same file silently clobber each other before the Step 6c.4 post-hoc merge can run. Worktree isolation converts the *predicted* disjointness into *physical* disjointness — each implementer writes into its own `git worktree`, so two implementers cannot touch the same on-disk file even when Step 3 missed the overlap. The existing Step 6c.4 merge protocol becomes the integration step plus the residual-conflict handler for whatever Step 3 missed.
|
|
141
|
+
|
|
142
|
+
**Isolation gate — `--isolate=auto|on|off` (default `auto`).** Under `auto`, isolate this level when ALL three hold:
|
|
143
|
+
|
|
144
|
+
1. **Concurrency:** ≥2 implementer sub-agents are dispatched into this level (a single implementer has no peer to collide with — skip isolation).
|
|
145
|
+
2. **Tier:** the run is Tier 2 or Tier 3 batch mode (Step 0 auto-tier or the `--effort` override per `hatch3r-board-pickup` → Effort Override). Tier 1 batches skip isolation — their trivial edits carry low overlap risk and the worktree setup/cleanup cost is not justified.
|
|
146
|
+
3. **Platform writes to the orchestrator's filesystem:** the platform applies sub-agent file edits into the orchestrator's working tree (CLI platforms — e.g. Claude Code Task sub-agents share the orchestrator's tree). Set this condition false for hosted platforms that sandbox each sub-agent in a separate per-agent workspace and merge results outside the orchestrator tree — those platforms already provide disjoint writes, so a second worktree layer adds no isolation.
|
|
147
|
+
|
|
148
|
+
`--isolate=on` forces isolation whenever ≥2 implementers run (overrides the tier/platform conditions); `--isolate=off` keeps the legacy single-tree path (Step 6c.3 dispatches directly into the orchestrator's tree, relying solely on Step 3 prediction + the Step 6c.4 post-hoc merge). Resolution order: explicit `--isolate` flag wins over the `auto` default.
|
|
149
|
+
|
|
150
|
+
**When isolation is active for a level, wrap Step 6c.3 dispatch as follows:**
|
|
151
|
+
|
|
152
|
+
1. **Create one scratch worktree per implementer.** For each issue in the level, run `npx hatch3r worktree-setup pickup-iso-<issue-number> --yes` (the `--yes` flag suppresses the interactive secret-propagation confirmation for the non-interactive orchestrator; review `.worktree-include` first if `.env.*` files are in scope per the command's CWE-552 blast-radius warning). Each worktree lands on a throwaway branch under `.worktrees/pickup-iso-<issue-number>/` and is populated + `hatch3r sync`-ed by the command. These are scratch isolation directories, not per-issue PR branches — the batch keeps its single shared branch (per `hatch3r-board-pickup` Step 5), and changes are integrated back onto it in Step 6c.4.
|
|
153
|
+
2. **Pin each implementer to its worktree.** In the Step 6c.3 per-agent prompt, set the sub-agent's working directory to its `.worktrees/pickup-iso-<issue-number>/` path and instruct it to read, edit, and run tests only within that path. The "do NOT create branches, commits, or PRs" instruction is unchanged — the orchestrator still owns all git operations; the throwaway worktree branch exists only to give `git worktree add` a ref and is never pushed.
|
|
154
|
+
3. **Integrate and clean up after the level returns.** After all implementers in the level return (Step 6c.3 step 3), integrate each worktree's file diff back onto the batch branch in the orchestrator's main tree via the **Step 6c.4 file-conflict resolution protocol** — physically disjoint writes apply cleanly; any genuinely overlapping or semantically conflicting edits Step 3 missed surface there for resolution exactly as in the non-isolated path. Then run `npx hatch3r worktree-cleanup --yes` to remove the scratch worktrees and prune their throwaway branches. On a non-zero `worktree-setup`/`worktree-cleanup` exit, surface the error and **ASK** the user (retry, fall back to `--isolate=off` for the remaining levels, or abort) — never silently drop isolation mid-run.
|
|
155
|
+
|
|
134
156
|
### 6c.3. Execute Level-by-Level With Parallel Implementers
|
|
135
157
|
|
|
136
158
|
For each dependency level, starting at Level 1:
|
|
137
159
|
|
|
138
|
-
|
|
160
|
+
0. **Resolve worktree isolation for this level** per Step 6c.3-iso. When isolation is active, create the per-implementer scratch worktrees (6c.3-iso step 1) before dispatching, and pin each sub-agent to its worktree path (6c.3-iso step 2). When inactive, dispatch directly into the orchestrator's tree as below.
|
|
161
|
+
|
|
162
|
+
1. **Sort the level by priority, then spawn one hatch3r-implementer sub-agent per issue.** Within each level, sort issues by priority (`p0` > `p1` > `p2` > `p3`) before dispatching. When the platform concurrency limit caps the level, fill the in-flight pool with the highest-priority issues first and queue the rest for the next dispatch slot as in-flight sub-agents return. Issues within a level are independent for correctness; this ordering only governs which independent issues land first when concurrency is the binding constraint. Use the Task tool with `subagent_type: "generalPurpose"`. Launch as many sub-agents concurrently as the platform supports.
|
|
139
163
|
|
|
140
164
|
2. **Each sub-agent prompt must include:**
|
|
141
165
|
- The issue number, title, full body, and acceptance criteria.
|
|
@@ -150,13 +174,16 @@ For each dependency level, starting at Level 1:
|
|
|
150
174
|
- All `scope: always` rule directives from `rules/` — subagents do not inherit rules automatically.
|
|
151
175
|
- Relevant learnings from `.hatch3r/learnings/` (from Step 6.pre).
|
|
152
176
|
- Explicit instruction: do NOT create branches, commits, or PRs.
|
|
177
|
+
- **When worktree isolation is active for this level** (Step 6c.3-iso): the sub-agent's working directory set to its `.worktrees/pickup-iso-<issue-number>/` path, with the instruction to read, edit, and run tests only within that path.
|
|
178
|
+
- `correlation_id` (UUID v4 per top-level task per `rules/hatch3r-agent-orchestration.md` → Correlation ID; batch tasks share one id with a per-issue sub-task index).
|
|
153
179
|
- Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
|
|
154
180
|
|
|
155
181
|
3. **Await all sub-agents in the current level.** Collect their structured results (files changed, tests written, issues encountered).
|
|
156
182
|
|
|
157
183
|
4. **Review sub-agent results:**
|
|
158
184
|
- If any sub-agent reports BLOCKED or PARTIAL, **ASK** the user how to proceed (skip, fix manually, retry).
|
|
159
|
-
-
|
|
185
|
+
- **When worktree isolation was active for this level** (Step 6c.3-iso): integrate each scratch worktree's file diff back onto the batch branch via the Step 6c.4 file-conflict resolution protocol, then run `npx hatch3r worktree-cleanup --yes` to remove the worktrees and prune their throwaway branches before advancing (6c.3-iso step 3).
|
|
186
|
+
- If sub-agents modified overlapping files (or the isolated integration above surfaced an overlap Step 3 missed), review for conflicts and resolve before proceeding.
|
|
160
187
|
|
|
161
188
|
5. **Advance to the next dependency level.** Repeat steps 1-4 until all levels are complete.
|
|
162
189
|
|
|
@@ -183,7 +210,7 @@ After all implementations complete, run the two-stage quality pipeline across th
|
|
|
183
210
|
- **Blast radius data** from Step 6c.2 (if available) — so the fixer knows which consumers and contracts must be preserved.
|
|
184
211
|
- **Reference conventions** from Step 6c.2 (if available) — so the fixer maintains established patterns when applying fixes.
|
|
185
212
|
3. Re-spawn **`hatch3r-reviewer`** to verify fixes.
|
|
186
|
-
4. Repeat steps 2-3 for a maximum of **3 iterations** until the confidence-aware gate passes: **0 Critical + 0 Warning AND reviewer confidence != low
|
|
213
|
+
4. Repeat steps 2-3 for a maximum of **3 iterations** until the confidence-aware gate passes. Evaluate the gate per the canonical **Confidence-Aware Review Gate** in `agents/shared/confidence-gate.md`, passing in the resolved `--confidence-floor` (`any` | `medium` | `high`) routed here from `hatch3r-board-pickup` → Confidence Floor. At the default `any` floor: **0 Critical + 0 Warning AND reviewer confidence != low**; if reviewer confidence is low with no Critical/Warning findings, trigger a second reviewer pass before exiting and do not exit until the second pass returns non-low confidence OR the user explicitly accepts the low-confidence PASS. At floor `medium` the pass surface is unchanged; at floor `high` a `medium`-confidence clean verdict also forces a second pass (and any low-confidence finding triggers an ASK) — apply the floor-tier branches from the shared gate, do not collapse them to the `any` row.
|
|
187
214
|
After each reviewer iteration, assess the reviewer's findings confidence: if the reviewer rates any finding as low-confidence, flag it separately in the ASK prompt so the user can prioritize human review of uncertain findings.
|
|
188
215
|
5. If still not clean after 3 iterations, **ASK** the user how to proceed.
|
|
189
216
|
|
|
@@ -192,15 +219,15 @@ After all implementations complete, run the two-stage quality pipeline across th
|
|
|
192
219
|
Launch as many independent sub-agents in parallel as the platform supports.
|
|
193
220
|
|
|
194
221
|
**Always spawn (mandatory for every code change):**
|
|
195
|
-
- **hatch3r-
|
|
196
|
-
- **hatch3r-security
|
|
222
|
+
- **hatch3r-testability** (CQ5) — verify tests for all code changes across the batch meet the mandate map / coverage floor.
|
|
223
|
+
- **hatch3r-security** (CQ3) — security review of all code changes across the batch.
|
|
197
224
|
|
|
198
225
|
**Always evaluate (spawn when applicable):**
|
|
199
226
|
- **hatch3r-docs-writer** — spawn when any changes affect public APIs, architectural patterns, or user-facing behavior.
|
|
200
227
|
|
|
201
228
|
**Conditional specialists (spawn when triggered by any issue in the batch):**
|
|
202
229
|
- **hatch3r-lint-fixer** — spawn when lint errors are present after implementation.
|
|
203
|
-
- **hatch3r-
|
|
204
|
-
- **hatch3r-
|
|
230
|
+
- **hatch3r-ui** (CQ1) — spawn when any issue has `area:ui` or `area:a11y` labels.
|
|
231
|
+
- **hatch3r-performance** (CQ7) — spawn when any issue has `area:performance` label.
|
|
205
232
|
|
|
206
233
|
Await all specialist sub-agents. Apply their feedback before proceeding to Step 7.
|
|
@@ -60,6 +60,7 @@ The implementer sub-agent prompt MUST include:
|
|
|
60
60
|
- All `scope: always` rule directives from `rules/` — subagents do not inherit rules automatically.
|
|
61
61
|
- Relevant learnings from `.hatch3r/learnings/` (from Step 6.pre).
|
|
62
62
|
- Explicit instruction: do NOT create branches, commits, or PRs.
|
|
63
|
+
- `correlation_id` (UUID v4 generated per top-level task per `rules/hatch3r-agent-orchestration.md` → Correlation ID; epic sub-issues get individual ids, batch tasks share one id with a sub-task index).
|
|
63
64
|
- Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
|
|
64
65
|
|
|
65
66
|
Await the implementer sub-agent. Collect its structured result (files changed, tests written, issues encountered).
|
|
@@ -75,7 +76,7 @@ After implementation completes, run the two-stage quality pipeline. Use the Task
|
|
|
75
76
|
- **Blast radius data** from Step 6a.1 (if available) — so the fixer knows which consumers and contracts must be preserved.
|
|
76
77
|
- **Reference conventions** from Step 6a.1 (if available) — so the fixer maintains established patterns when applying fixes.
|
|
77
78
|
3. Re-spawn **`hatch3r-reviewer`** to verify fixes.
|
|
78
|
-
4. Repeat steps 2-3 for a maximum of **3 iterations** until the confidence-aware gate passes: **0 Critical + 0 Warning AND reviewer confidence != low
|
|
79
|
+
4. Repeat steps 2-3 for a maximum of **3 iterations** until the confidence-aware gate passes. Evaluate the gate per the canonical **Confidence-Aware Review Gate** in `agents/shared/confidence-gate.md`, passing in the resolved `--confidence-floor` (`any` | `medium` | `high`) routed here from `hatch3r-board-pickup` → Confidence Floor. At the default `any` floor: **0 Critical + 0 Warning AND reviewer confidence != low**; if reviewer confidence is low with no Critical/Warning findings, trigger a second reviewer pass before exiting and do not exit until the second pass returns non-low confidence OR the user explicitly accepts the low-confidence PASS. At floor `medium` the pass surface is unchanged; at floor `high` a `medium`-confidence clean verdict also forces a second pass (and any low-confidence finding triggers an ASK) — apply the floor-tier branches from the shared gate, do not collapse them to the `any` row.
|
|
79
80
|
After each reviewer iteration, assess the reviewer's findings confidence: if the reviewer rates any finding as low-confidence, flag it separately in the ASK prompt so the user can prioritize human review of uncertain findings.
|
|
80
81
|
5. If still not clean after 3 iterations, **ASK** the user how to proceed.
|
|
81
82
|
|
|
@@ -84,22 +85,23 @@ After implementation completes, run the two-stage quality pipeline. Use the Task
|
|
|
84
85
|
Launch as many independent sub-agents in parallel as the platform supports.
|
|
85
86
|
|
|
86
87
|
**Always spawn (mandatory for every code change):**
|
|
87
|
-
- **hatch3r-
|
|
88
|
-
- **hatch3r-security
|
|
88
|
+
- **hatch3r-testability** (CQ5) — verify tests for all code changes meet the mandate map / coverage floor. Unit tests for new logic, regression tests for bug fixes, integration tests for cross-module changes.
|
|
89
|
+
- **hatch3r-security** (CQ3) — security review of all code changes. Audit data flows, access control, input validation, and secret management.
|
|
89
90
|
|
|
90
91
|
**Always evaluate (spawn when applicable):**
|
|
91
92
|
- **hatch3r-docs-writer** — spawn when changes affect public APIs, architectural patterns, or user-facing behavior. Skip silently if no documentation impact.
|
|
92
93
|
|
|
93
94
|
**Conditional specialists (spawn when triggered):**
|
|
94
95
|
- **hatch3r-lint-fixer** — spawn when lint errors are present after implementation.
|
|
95
|
-
- **hatch3r-
|
|
96
|
-
- **hatch3r-
|
|
96
|
+
- **hatch3r-ui** (CQ1) — spawn when issue has `area:ui` or `area:a11y` labels.
|
|
97
|
+
- **hatch3r-performance** (CQ7) — spawn when issue has `area:performance` label or changes touch hot paths.
|
|
97
98
|
|
|
98
99
|
Each specialist sub-agent prompt MUST include:
|
|
99
100
|
- The agent protocol to follow (e.g., "Follow the hatch3r-reviewer agent protocol").
|
|
100
101
|
- All `scope: always` rule directives from `rules/` (subagents do not inherit rules automatically).
|
|
101
102
|
- The diff or file changes to review.
|
|
102
103
|
- The issue's acceptance criteria.
|
|
104
|
+
- `correlation_id` (UUID v4 per top-level task per `rules/hatch3r-agent-orchestration.md` → Correlation ID).
|
|
103
105
|
- Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
|
|
104
106
|
|
|
105
107
|
Await all specialist sub-agents. Apply their feedback (fixes, additional tests, documentation updates) before proceeding to Step 7.
|
|
@@ -126,6 +126,7 @@ At the end of an auto session, generate a summary:
|
|
|
126
126
|
- **Issue update failure:** warn and continue (labels not blocking).
|
|
127
127
|
- **Quality verification failure:** fix before creating PR/MR.
|
|
128
128
|
- **PR/MR creation failure:** present error and manual instructions.
|
|
129
|
+
- **Context degradation:** per the canonical Context-Degradation Policy (`rules/hatch3r-agent-orchestration-detail.md` -> Context-Degradation Policy) — compress at `>50%` context window, restart at `>75%`; the coarse turn-count fallback (inherited from `hatch3r-workflow`) is ~25 turns, at which point suggest splitting the batch or starting a fresh context with a progress summary of completed and remaining issues.
|
|
129
130
|
|
|
130
131
|
---
|
|
131
132
|
|
|
@@ -142,7 +142,7 @@ After PR creation, capture learnings from this development session.
|
|
|
142
142
|
- Were any pitfalls discovered that should be avoided next time?
|
|
143
143
|
|
|
144
144
|
2. If learnings are identified:
|
|
145
|
-
- Create learning files in `.hatch3r/learnings/` following the learning file format (see `hatch3r-learn`
|
|
145
|
+
- Create learning files in `.hatch3r/learnings/` following the learning file format (see `skills/hatch3r-learn/SKILL.md`).
|
|
146
146
|
- Include the issue number as `source-issue`.
|
|
147
147
|
- Tag with relevant area labels from the issue.
|
|
148
148
|
- **ASK:** "Learnings captured: {list}. Anything else to note? (add more / done)"
|
|
@@ -9,15 +9,17 @@ quality_charter: agents/shared/quality-charter.md
|
|
|
9
9
|
efficiency_patterns: agents/shared/efficiency-patterns.md
|
|
10
10
|
cache_friendly: true
|
|
11
11
|
parallel_tool_default: true
|
|
12
|
+
efficiency_tier: deep
|
|
12
13
|
triage_tiers: [1, 2, 3]
|
|
14
|
+
supports_resume: true
|
|
13
15
|
sub_agents_spawned:
|
|
14
16
|
count: 3
|
|
15
|
-
rationale: Three-stage pipeline per agentPipeline — researcher scans routes, docs-writer assembles the OpenAPI spec, reviewer validates structure; researcher and reviewer fanned out concurrently around the shared docs-writer dependency.
|
|
17
|
+
rationale: Three-stage pipeline per agentPipeline — researcher scans routes, docs-writer assembles the OpenAPI spec, reviewer validates structure; researcher and reviewer fanned out concurrently around the shared docs-writer dependency. Cost-dominance per CONSTITUTION §2 P8 — token cost never serializes independent work.
|
|
16
18
|
---
|
|
17
19
|
|
|
18
20
|
## §0 Detect Ambiguity (P8 B1)
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → §0 Detect Ambiguity (P8 B1). Triggers: contradictory inputs, missing target, unknown convention.
|
|
21
23
|
|
|
22
24
|
## Agent Pipeline
|
|
23
25
|
|
|
@@ -28,6 +30,8 @@ Before any action, scan the user's request and provided context for unresolved q
|
|
|
28
30
|
| 3. Spec Generation | `hatch3r-docs-writer` | No | Yes |
|
|
29
31
|
| 4. Validation | `hatch3r-reviewer` | No | Yes (if validate mode) |
|
|
30
32
|
|
|
33
|
+
**Parallel-safety conditions** (per `rules/hatch3r-agent-orchestration.md` §Parallel Safety): every parallel fan-out above holds all three — read-only or disjoint writes, deterministic aggregation, no shared mutable state.
|
|
34
|
+
|
|
31
35
|
# API Specification Generator — OpenAPI from Code or Code-vs-Spec Drift Detection
|
|
32
36
|
|
|
33
37
|
Take a codebase with HTTP or RPC endpoints and produce a complete OpenAPI 3.1 specification (`docs/api/`), or take an existing spec and compare it against the live codebase to surface undocumented, stale, or drifted endpoints. The researcher sub-agent scans route definitions, decorators, and handlers; the orchestrator extracts TypeScript types and validation schemas inline; the docs-writer assembles the final spec document; and the reviewer validates structural correctness. AI proposes all outputs; user confirms before any files are written.
|
|
@@ -47,6 +51,14 @@ Take a codebase with HTTP or RPC endpoints and produce a complete OpenAPI 3.1 sp
|
|
|
47
51
|
3. **Structured output only.** All sub-agent prompts require structured markdown output — no prose dumps.
|
|
48
52
|
4. **Batch schema extraction.** Group types by source file. Read each file once and extract all referenced types in a single pass.
|
|
49
53
|
|
|
54
|
+
## Confidence Propagation Contract
|
|
55
|
+
|
|
56
|
+
Every sub-agent delegation prompt in this command MUST include the confidence expression requirement below (verbatim). Sub-agents are invoked with the `quality_charter: agents/shared/quality-charter.md` reference in their frontmatter, but the orchestrator repeats the directive to override runtime prompt defaults per the charter §1 rule.
|
|
57
|
+
|
|
58
|
+
> Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
|
|
59
|
+
|
|
60
|
+
Downstream propagation: the Step 2 framework-detection confidence (already high/medium/low), every endpoint-discovery completeness verdict, and each Step 7 drift classification MUST carry a high/medium/low confidence rating sourced from the researcher or reviewer sub-agent. Endpoints with unresolvable types map to low confidence. Dropping the signal between stages is a gate failure.
|
|
61
|
+
|
|
50
62
|
---
|
|
51
63
|
|
|
52
64
|
## Workflow
|
|
@@ -63,6 +75,25 @@ Classify the request before delegating:
|
|
|
63
75
|
|
|
64
76
|
If Tier 1, complete inline and skip the parallel researcher fanout. If Tier 2, run the standard pipeline below. If Tier 3, run the full pipeline with research and confirm scope with the user before writing the spec.
|
|
65
77
|
|
|
78
|
+
### Step 0.5: Emit Pre-Execution Cost Preview
|
|
79
|
+
|
|
80
|
+
Before the first sub-agent dispatch (Step 3 endpoint-discovery researcher), surface the cost preview so a full-codebase spec scan is never started blind. Emit the `cost_estimate` block per `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate, calibrated to the Step 0 triage tier:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
cost_estimate:
|
|
84
|
+
expected_sa_count: <triage tier → Tier 1 inline ~0, Tier 2 ~2 (researcher + docs-writer), Tier 3 up to 3 (+ reviewer)>
|
|
85
|
+
estimated_input_tokens_static_frame: <int>
|
|
86
|
+
estimated_web_research_queries: <int>
|
|
87
|
+
triage_tier: light | standard | deep
|
|
88
|
+
estimated_duration_min: <int>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Post-execution actuals + delta land in the Step 8 output summary's Fan-out + Cost section per `rules/hatch3r-cost-visibility.md` Post-Execution Actuals. Token telemetry sources from `src/pipeline/observability.ts`.
|
|
92
|
+
|
|
93
|
+
### Effort Override (Decision 17)
|
|
94
|
+
|
|
95
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Effort Override (Decision 17). Misclassification example: a single-endpoint doc tweak scored as Deep, or a full-codebase drift scan scored as Light.
|
|
96
|
+
|
|
66
97
|
---
|
|
67
98
|
|
|
68
99
|
### Step 1: Gather API Context
|
|
@@ -301,6 +332,51 @@ Files Created/Updated:
|
|
|
301
332
|
- **Respect the project's tooling hierarchy** for knowledge augmentation: project docs → codebase exploration → Context7 MCP → web research.
|
|
302
333
|
- **Spec must be valid.** Never write a spec that fails structural validation. Fix issues before writing.
|
|
303
334
|
|
|
335
|
+
## Resumability (Decision 27/30)
|
|
336
|
+
|
|
337
|
+
api-spec is long-running — a Tier 3 full-codebase scan runs the hatch3r-researcher (codebase-analysis mode) over route definitions and handlers (Step 1), then orchestrator-inline TypeScript-schema + validation-schema extraction (Step 2), then hatch3r-docs-writer assembling the OpenAPI 3.1 spec under `docs/api/` (Step 3), then hatch3r-reviewer validating structural correctness in validate mode (Step 4). Per hatch3r's workspace-checkpointed resumability contract, checkpoint progress so an interrupted run re-enters at the last completed step rather than re-running the route scan or re-extracting schemas.
|
|
338
|
+
|
|
339
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Checkpoint Contract. Per-command slots: workspace `.api-spec-workspace/`; step range the Step 0 → Step 8 progression; `wave` = researcher-batch index in multi-framework detection; snapshot/rollback paths `docs/api/`. Write points: after Step 1 route-scan researcher returns, after Step 2 schema-extraction completes (so endpoint-to-schema map survives a crash), after Step 3 docs-writer spec assembly is confirmed by ASK, after each Step 4 file write under `docs/api/` (so already-generated spec sections survive a crash), after Step 5 reviewer validation returns in validate mode (the drift-classification verdict persists), and after the Step 6 chain handoff in generate mode.
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Per-Turn Pipeline-State Header (Bypass Protection)
|
|
344
|
+
|
|
345
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Per-Turn Pipeline-State Header. Phase mapping for api-spec: `1` = discovery + route enumeration, `2` = spec generation + schema extraction, `3` = validation + cross-reference verification, `4` = write + iteration-summary. Tier 1 runs are exempt per the Tier 1 exemption.
|
|
346
|
+
|
|
347
|
+
## End-of-Turn Delegation Attestation (Bypass Protection)
|
|
348
|
+
|
|
349
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → End-of-Turn Delegation Attestation. Per-command mutated-file slot: OpenAPI/AsyncAPI spec writes, schema files, documentation.
|
|
350
|
+
|
|
351
|
+
## Iteration Summary (mandatory output)
|
|
352
|
+
|
|
353
|
+
Emit the canonical 9-section iteration summary per `rules/hatch3r-iteration-summary.md` as the final user-facing output. The validation gate at `.claude/rules/capability-lifecycle.md` blocks SUCCESS declarations without this block (CONSTITUTION §6 Decision 23).
|
|
354
|
+
|
|
355
|
+
The 9 sections:
|
|
356
|
+
|
|
357
|
+
1. **Request** — verbatim restatement of the user's ask in one sentence.
|
|
358
|
+
2. **Fan-out + Cost** — `sub_agents_spawned: { count, rationale }` plus the `cost_estimate` / `cost_actuals` / `delta` blocks (see Cost Visibility below).
|
|
359
|
+
3. **Web Research** — every URL fetched with access date + trust tier per `agents/shared/rigor-contract.md` (0 acceptable when no research was needed).
|
|
360
|
+
4. **Files Mutated** — list with diff summary (lines added / removed / files created).
|
|
361
|
+
5. **Gates Passed / Failed** — explicit list per `.claude/rules/capability-lifecycle.md` Gate Checklist.
|
|
362
|
+
6. **Pillar Impact Attribution** — `progress_toward_pillar: <axis>.<pillar_id>+<delta>` per CONSTITUTION §6 Decision 17.
|
|
363
|
+
7. **Verification Commands** — exact commands run with exit codes plus key output lines (≤200 chars).
|
|
364
|
+
8. **Open Questions / Blockers** — explicit `None` if fully closed.
|
|
365
|
+
9. **Learnings Captured** — IDs of any learnings written to `.hatch3r/learnings/` this run per `rules/hatch3r-learning-system.md`.
|
|
366
|
+
|
|
367
|
+
### Cost Visibility (Decision 24)
|
|
368
|
+
|
|
369
|
+
> Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → Cost Estimate for the 5-field `cost_estimate` schema and the post-execution `cost_actuals` + `delta` contract; both land in Section 2 above.
|
|
370
|
+
|
|
371
|
+
## Cost estimate (Decision 24)
|
|
372
|
+
|
|
373
|
+
This command emits cost transparency per `rules/hatch3r-cost-visibility.md` and CONSTITUTION §6 Decision 24/29:
|
|
374
|
+
|
|
375
|
+
- **Pre-execution `cost_estimate`** — emitted in Step 0.5 before the first researcher dispatch (Step 3 endpoint discovery).
|
|
376
|
+
- **Post-execution `cost_actuals` + `delta`** — appended to the Step 8 output summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2.
|
|
377
|
+
|
|
378
|
+
Per-tier `expected_sa_count` calibration (from frontmatter `sub_agents_spawned.count: 3` × tier heuristic in `rules/hatch3r-cost-visibility.md` Pre-Execution Estimate): Tier 1 ≈ 0 (inline single-endpoint edit); Tier 2 ≈ 2 (researcher scans routes + docs-writer assembles); Tier 3 up to 3 (researcher + docs-writer + reviewer validation in validate/drift mode). Deltas beyond 25% absolute value carry `flagged_for_review: true`. Token telemetry sources from `src/pipeline/observability.ts`; estimation primitives from `src/pipeline/costEstimator.ts`.
|
|
379
|
+
|
|
304
380
|
## Output Templates
|
|
305
381
|
|
|
306
382
|
### Spec Header
|
|
@@ -329,6 +405,7 @@ servers:
|
|
|
329
405
|
|
|
330
406
|
## Related
|
|
331
407
|
|
|
408
|
+
- **Skill:** `skills/hatch3r-api-spec/SKILL.md` — the inline single-pass procedure this command's docs-writer (Step 5) and reviewer (Step 6) stages follow; shares `id: hatch3r-api-spec` by the Decision 13 workflow-split (command = multi-agent fan-out, skill = inline procedure). The skill's "Relationship to commands/hatch3r-api-spec.md" section is the canonical handoff record disambiguating the shared id (F16.3-H3).
|
|
332
409
|
- **Rule:** `hatch3r-api-design` — API design conventions the generated spec must follow
|
|
333
410
|
- **Command:** `hatch3r-codebase-map` — structural map that can help scope the API scan
|
|
334
411
|
- **Command:** `hatch3r-project-spec` — project-level specification for API info block context
|