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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-edge-case-discipline
|
|
3
|
+
type: rule
|
|
4
|
+
description: Build-time enumeration of domain/data-correctness edge cases (cardinality, null/empty/boundary, cross-entity consistency, illegal state transitions, concurrency, partial failure) plus language-agnostic error-handling discipline — fires at Plan, Implement, and Review
|
|
5
|
+
tags: [implementation, reliability, testing, floor:content-quality]
|
|
6
|
+
alwaysApply: true
|
|
7
|
+
precedence: high
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
9
|
+
cache_friendly: true
|
|
10
|
+
---
|
|
11
|
+
# Edge-Case & Error-Handling Discipline
|
|
12
|
+
|
|
13
|
+
**Pillars:** P2 (Scientific Quality)
|
|
14
|
+
|
|
15
|
+
This rule fires whenever a feature wires together ≥2 domain entities, or whenever a function consumes external or user-supplied input. Edge-case enumeration becomes a named build-time step, not a runtime afterthought. `rules/hatch3r-resilience-patterns.md` keeps a correct system *available* under failure (breakers, retries, fallbacks); this rule keeps the system *correct* in the first place — the two complement each other and do not overlap.
|
|
16
|
+
|
|
17
|
+
## When This Fires
|
|
18
|
+
|
|
19
|
+
- **Plan:** before writing code, enumerate edge cases from the taxonomy below for every entity and every cross-entity relationship the feature touches. List them as explicit named cases (e.g. `case: two contacts collide on email + linked property`), never the placeholder "handle edge cases".
|
|
20
|
+
- **Implement:** each enumerated case is handled in code OR explicitly recorded out-of-scope with a one-line reason. No silent omission — an unlisted case is a gap, an unhandled-but-listed case needs the recorded reason.
|
|
21
|
+
- **Review:** reject the change if any taxonomy category was not enumerated for an entity-wiring feature, or an enumerated case has neither handling nor a recorded out-of-scope reason. Maps to a Medium-or-higher finding per `agents/shared/quality-charter.md` §14.
|
|
22
|
+
|
|
23
|
+
## Domain Edge-Case Taxonomy
|
|
24
|
+
|
|
25
|
+
Seven categories. For each: the question to ask, then a worked example in the real-estate domain (properties + contacts + reservations + deals).
|
|
26
|
+
|
|
27
|
+
1. **Cardinality & duplicates** — for each relationship, what happens at zero, exactly-one, and N? Can two records collide on a natural key? Worked example: two contacts share the same email AND the same linked property but carry a different status — decide the dedup key and the tie-break rule (latest-updated wins, or merge) before writing the join, or the query returns a nondeterministic row.
|
|
28
|
+
|
|
29
|
+
2. **Null / empty / zero / boundary** — apply boundary-value analysis (Min−1, Min, Max, Max+1) and equivalence partitioning to every numeric, string, and collection input. Worked example: a deal with `amount = 0`, a reservation with an empty date range (`start == end`), a property with zero linked contacts, a name string at the column-length limit and one byte over.
|
|
30
|
+
|
|
31
|
+
3. **Cross-entity consistency & referential integrity** — if A references B, can B be missing, deleted, or in an invalid state when A is read? Worked example: a reservation pointing at an archived property; a deal whose contact was merged into another contact. Define cascade vs restrict vs orphan handling explicitly for each foreign reference; the default of an unhandled dangling reference is a 500 at read time.
|
|
32
|
+
|
|
33
|
+
4. **Illegal state transitions** — model the entity lifecycle as an explicit state set, enumerate the legal transitions, and reject the rest at construction and at transition time. Worked example: a deal moving `closed → pending`; a reservation marked `confirmed` on a `withdrawn` listing. Apply make-illegal-states-unrepresentable / parse-don't-validate: validate once at the boundary, then the constructed type carries the proof so downstream code cannot re-encounter the illegal state.
|
|
34
|
+
|
|
35
|
+
5. **Concurrency & ordering** — two writers modify the same record, or events arrive out of order. Worked example: two agents accept the same reservation slot at the same instant. Name the concurrency-control choice (optimistic version column, row lock, or idempotency key) at design time; "last write wins by accident" is not a choice. Cross-link `rules/hatch3r-scalability.md` and `rules/hatch3r-resilience-patterns.md`.
|
|
36
|
+
|
|
37
|
+
6. **Partial failure across layers** — a single logical write spans cache + DB + queue + external API; what is the state when step 3 of 4 fails? Worked example: a deal is persisted to the DB, the cache is updated, the "deal-won" event is published, and the external CRM sync then times out. Define the consistency boundary (transaction, saga, or transactional outbox) and the compensating action. Cross-link `rules/hatch3r-resilience-patterns.md` failure classification.
|
|
38
|
+
|
|
39
|
+
7. **Idempotency on replay / retry** — if the operation runs twice with the same input, is the second run a no-op? Required for any non-idempotent mutation reachable by a retry. Worked example: a retried "create reservation" call must not create two reservations for one slot. Cross-link `rules/hatch3r-resilience-patterns.md` → idempotency-key.
|
|
40
|
+
|
|
41
|
+
The seven categories are a floor, not a ceiling: enumerate domain-specific invariants alongside them (e.g. "a property has at most one active deal", "a reservation date range never overlaps another confirmed reservation on the same property").
|
|
42
|
+
|
|
43
|
+
## Error-Handling Discipline
|
|
44
|
+
|
|
45
|
+
Language-agnostic principles; complements `rules/hatch3r-code-standards.md` and does not restate its TypeScript mechanics.
|
|
46
|
+
|
|
47
|
+
- **Placement:** catch at architectural boundaries only (route handler, event handler, job processor, UI error boundary); let errors propagate within a module. Defer to `rules/hatch3r-code-standards.md` → Error Boundaries for the full pattern and the TS Result-type mechanics.
|
|
48
|
+
- **Propagation with context:** every re-throw or wrap attaches the failing operation plus the relevant identifiers (entity id, correlation id — no PII, no secrets) and preserves the original cause chain. A wrap that drops the cause is a finding.
|
|
49
|
+
- **Exhaustive matching:** every discriminated union, enum, and explicit state set is matched exhaustively with a compile-time-checked default, so adding a variant breaks the build rather than falling through silently. Cross-link `rules/hatch3r-code-standards.md` → exhaustive `switch` + `never`.
|
|
50
|
+
- **Recovery vs fail-fast triage:** classify each failure as recoverable (fallback or degrade — cross-link `rules/hatch3r-resilience-patterns.md` → Graceful Degradation) or unrecoverable (fail fast with an actionable message — cross-link `agents/shared/quality-charter.md` §6). No catch block treats both alike.
|
|
51
|
+
- **No silent catch (hard rule):** an empty catch, a catch that returns `null` or a default for every error, and swallow-and-continue are all prohibited. Defer to the `rules/hatch3r-code-standards.md` Error Handling Anti-Patterns table for the canonical prohibited list. This ties to `agents/shared/quality-charter.md` §6 (never fail silently) and §8 (a case that cannot be handled at build time is a clarification trigger, not a guess).
|
|
52
|
+
|
|
53
|
+
## Cross-References
|
|
54
|
+
|
|
55
|
+
- `rules/hatch3r-code-standards.md` — Result types, custom error classes, exhaustive `switch` + `never`, error anti-pattern table (the TS mechanics this rule references rather than restates).
|
|
56
|
+
- `rules/hatch3r-resilience-patterns.md` — failure classification, idempotency-on-retry, graceful degradation (run-time resilience; this rule is build-time correctness).
|
|
57
|
+
- `rules/hatch3r-testing.md` — every enumerated edge case maps to a required test class per the Per-Feature Mandate Map and Error Path Coverage.
|
|
58
|
+
- `rules/hatch3r-scalability.md` — idempotency-key adoption on mutations.
|
|
59
|
+
- `rules/hatch3r-migrations.md` — concurrent-modification and referential-integrity handling at the schema layer.
|
|
60
|
+
- `agents/shared/quality-charter.md` — §6 (Fail Gracefully), §8 (Escalate Ambiguity Early), §13 (Adversarial Thinking).
|
|
61
|
+
|
|
62
|
+
## References
|
|
63
|
+
|
|
64
|
+
- ISTQB Certified Tester Foundation Level syllabus — Boundary Value Analysis + Equivalence Partitioning — `https://www.istqb.org/certifications/certified-tester-foundation-level` (accessed 2026-06-02, official-standards-body).
|
|
65
|
+
- Alexis King, "Parse, Don't Validate" — `https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/` (accessed 2026-06-02, named-author primary source).
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-enhancability-rule
|
|
3
|
+
type: rule
|
|
4
|
+
description: CQ9 Enhancability Quality measurement rule — feature-flag adoption on user-visible behavior, config externalization, API versioning + deprecation policy, forward-compat patterns, extension-point definition
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "src/**,**/config/**,**/openapi.yaml,**/openapi.json,**/*.proto,**/schema.graphql,**/asyncapi.yaml,**/flags*,**/plugins/**,**/extensions/**"
|
|
7
|
+
tags: [review, enhancability, code-standards, floor:content-quality]
|
|
8
|
+
precedence: high
|
|
9
|
+
quality_charter: agents/shared/quality-charter.md
|
|
10
|
+
cache_friendly: true
|
|
11
|
+
---
|
|
12
|
+
# Enhancability Quality (CQ9)
|
|
13
|
+
|
|
14
|
+
**Pillars:** P4 (Comprehensive Lean Coverage), CQ9 (Enhancability Quality)
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
This rule binds the CQ9 measurement set across end-user code that hatch3r-generated agents produce. It owns:
|
|
19
|
+
|
|
20
|
+
- The feature-flag adoption floor on user-visible behavior changes.
|
|
21
|
+
- The configuration-externalization floor on environment-dependent values.
|
|
22
|
+
- The API versioning + deprecation policy on stable endpoints.
|
|
23
|
+
- The forward-compatibility pattern gate (additive schema, Deprecation + Sunset headers, contract tests).
|
|
24
|
+
- The extension-point definition gate for cross-cutting concerns.
|
|
25
|
+
- Specialist routing to `agents/hatch3r-enhancability.md`.
|
|
26
|
+
|
|
27
|
+
This complements (does not duplicate) `rules/hatch3r-feature-flags.md` (flag-system implementation pattern), `rules/hatch3r-api-versioning.md` (semver + deprecation timeline), and `rules/hatch3r-progressive-delivery.md` (rollout strategy).
|
|
28
|
+
|
|
29
|
+
## CQ9 Threshold Set
|
|
30
|
+
|
|
31
|
+
Source: pillar CQ9 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle.
|
|
32
|
+
|
|
33
|
+
| Threshold | Target | Measurement source |
|
|
34
|
+
|-----------|--------|--------------------|
|
|
35
|
+
| Feature-flag adoption | 100% on user-visible behavior changes | Diff scan vs flag-key inventory (`flags.yaml` or in-code registry) |
|
|
36
|
+
| Configuration externalization | 100% on environment-dependent values | Grep diff for hardcoded URLs, timeouts, retry counts, batch sizes, toggles, credentials |
|
|
37
|
+
| API versioning compliance | Semver 2.0.0 per release | MAJOR/MINOR/PATCH bump matches diff classification |
|
|
38
|
+
| Forward-compat patterns | 100% on stable endpoints | Additive schema; Deprecation (RFC 9745) + Sunset (RFC 8594) headers; consumer-driven contract tests |
|
|
39
|
+
| Extension-point definition | Per cross-cutting concern | Named interface; plugin registry; documented lifecycle hooks (onInit, onShutdown, onConfigChange); `## Stability` block |
|
|
40
|
+
| Spec-diff CI gate | Exit-zero per release | `oasdiff`, `buf breaking`, `graphql-inspector diff` CI step active |
|
|
41
|
+
|
|
42
|
+
## Feature-Flag Adoption
|
|
43
|
+
|
|
44
|
+
Every user-visible behavior change MUST ship behind an OpenFeature (or vendor-equivalent) flag. The rule:
|
|
45
|
+
|
|
46
|
+
1. **Provider registration** — application code wires a flag provider via `OpenFeature.setProvider()` (vendor SDK: LaunchDarkly, flagd, Unleash, Flagsmith, Split). Provider config lives in env-overridable settings.
|
|
47
|
+
2. **Flag-key inventory** — every flag key is registered in `flags.yaml` (or equivalent) with metadata: owner, description, default-value, kill-switch flag.
|
|
48
|
+
3. **Evaluation context** — flag evaluations carry a documented attribute schema (user-id, account-id, org-id, environment, locale, beta-cohort).
|
|
49
|
+
4. **Kill-switch** — every behavior-changing flag has a documented kill-switch path: setting the flag to OFF reverts to the previous behavior without code rollback.
|
|
50
|
+
5. **Cleanup window** — flags retired ≤90 days after 100% rollout per `rules/hatch3r-feature-flags.md`.
|
|
51
|
+
|
|
52
|
+
Behavior changes shipped without a flag are CRITICAL findings.
|
|
53
|
+
|
|
54
|
+
## Configuration Externalization
|
|
55
|
+
|
|
56
|
+
Every environment-dependent value MUST be externalized — hardcoded values in `src/` paths are FINDINGS minimum. Externalize via:
|
|
57
|
+
|
|
58
|
+
- **Schema-validated env** — Zod (`z.object({...}).parse(process.env)`), Joi (`Joi.object({...}).validate()`), Pydantic (`class Settings(BaseSettings)`), envalid (`cleanEnv()`).
|
|
59
|
+
- **Dotenv-flow** — `.env.development`, `.env.production`; secrets via secret-manager not file.
|
|
60
|
+
- **Startup-time validation** — config schema parsed once at boot; mis-config fails fast with named missing field.
|
|
61
|
+
|
|
62
|
+
Forbidden in `src/` paths:
|
|
63
|
+
|
|
64
|
+
- Hardcoded URLs to external services.
|
|
65
|
+
- Hardcoded timeouts, retry counts, batch sizes.
|
|
66
|
+
- Hardcoded feature toggles (`if (true)` ahead of a feature).
|
|
67
|
+
- Hardcoded credentials, API keys, tokens (see also `rules/hatch3r-secrets-management.md`).
|
|
68
|
+
- Silent fallback on config-validation error (catch + log + continue) — fail fast or document the explicit recovery path.
|
|
69
|
+
|
|
70
|
+
## API Versioning + Deprecation
|
|
71
|
+
|
|
72
|
+
Source: semver 2.0.0 (semver.org) + `rules/hatch3r-api-versioning.md`. The diff classification determines the version bump:
|
|
73
|
+
|
|
74
|
+
| Diff classification | Required bump |
|
|
75
|
+
|---------------------|---------------|
|
|
76
|
+
| Breaking change (removed field, changed type, renamed endpoint, semantics change) | MAJOR |
|
|
77
|
+
| Additive (new field, new endpoint, new method, new enum value) | MINOR |
|
|
78
|
+
| Fix (clarification, doc-only, bug-fix matching documented behavior) | PATCH |
|
|
79
|
+
|
|
80
|
+
The OpenAPI / AsyncAPI / GraphQL SDL `info.version` MUST be aligned to the release tag. Skipping a MAJOR bump on a breaking change is CRITICAL.
|
|
81
|
+
|
|
82
|
+
## Forward-Compatibility Patterns
|
|
83
|
+
|
|
84
|
+
On stable endpoints:
|
|
85
|
+
|
|
86
|
+
- **Additive schema** — new fields are optional; default values are documented; consumers ignore unknown fields. Removing a field is breaking; renaming is breaking.
|
|
87
|
+
- **Deprecation header (RFC 9745)** — emit `Deprecation: @1735689600` (Unix-time) or `Deprecation: Tue, 20 May 2025 00:00:00 GMT` (IMF-fixdate) on retiring endpoints.
|
|
88
|
+
- **Sunset header (RFC 8594)** — emit `Sunset: Tue, 31 Dec 2025 23:59:59 GMT` (IMF-fixdate only) on retiring endpoints. Sunset date MUST be later than Deprecation date.
|
|
89
|
+
- **Migration link** — emit `Link: <https://api.example.com/docs/migration>; rel="deprecation"` + `Link: <…>; rel="sunset"`.
|
|
90
|
+
- **Consumer-driven contract tests** — every public surface has a Pact (or equivalent) contract test from the consumer side; provider verification CI step exits-zero.
|
|
91
|
+
- **Spec-diff CI gate** — `oasdiff breaking --fail-on-diff` (REST), `buf breaking --against` (protobuf), `graphql-inspector diff` (GraphQL); the gate exits non-zero on breaks.
|
|
92
|
+
|
|
93
|
+
## Extension-Point Definition
|
|
94
|
+
|
|
95
|
+
Cross-cutting concerns (logging, auth, persistence, telemetry, error handling) get a named extension point:
|
|
96
|
+
|
|
97
|
+
- **Plugin interface** — exported TypeScript interface (`export interface AuthPlugin { ... }`) or Python protocol (`class AuthPlugin(Protocol)`).
|
|
98
|
+
- **Plugin registry** — central registration via `Plugin.register('auth', new MyAuthPlugin())` or dependency-injection container.
|
|
99
|
+
- **Lifecycle hooks** — `onInit(config)`, `onShutdown()`, `onConfigChange(newConfig)`.
|
|
100
|
+
- **Stability block** — `## Stability: stable | experimental | deprecated` block in the plugin's documentation.
|
|
101
|
+
- **Version-stable contract** — once a plugin interface is `stable`, the contract is bound to the deprecation policy and semver rules.
|
|
102
|
+
|
|
103
|
+
## Specialist Agent Routing
|
|
104
|
+
|
|
105
|
+
| Trigger | Route to |
|
|
106
|
+
|---------|----------|
|
|
107
|
+
| User-visible behavior modified | `agents/hatch3r-enhancability.md` (flag adoption gate) |
|
|
108
|
+
| Public API surface modified (OpenAPI / GraphQL SDL / AsyncAPI / protobuf) | `agents/hatch3r-enhancability.md` (versioning + forward-compat gate) |
|
|
109
|
+
| Config schema or feature-flag definition modified | `agents/hatch3r-enhancability.md` (externalization gate) |
|
|
110
|
+
| Extension-point interface modified | `agents/hatch3r-enhancability.md` (plugin contract gate) |
|
|
111
|
+
| Release-prep audit | `agents/hatch3r-enhancability.md` |
|
|
112
|
+
|
|
113
|
+
## Per-Finding Output Format
|
|
114
|
+
|
|
115
|
+
Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ9. The `proof_trace` excerpt is the file:line citation + spec-diff/grep output for the threshold that produced the finding.
|
|
116
|
+
|
|
117
|
+
## Severity Mapping
|
|
118
|
+
|
|
119
|
+
The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ9 Action per status:
|
|
120
|
+
|
|
121
|
+
- `CRITICAL`: Behavior change shipped without a flag; breaking change on stable endpoint without major-version bump; hardcoded credential or secret; silent fallback on config-validation error; missing CI spec-diff gate.
|
|
122
|
+
- `FINDINGS`: Externalization gap (hardcoded URL/timeout/batch-size); missing Deprecation/Sunset header; semver-policy gap; under-documented extension point.
|
|
123
|
+
- `PASS`: All thresholds met; surface in iteration summary.
|
|
124
|
+
|
|
125
|
+
## Irreversibility Trigger
|
|
126
|
+
|
|
127
|
+
Retiring a feature flag, dropping an API endpoint, or hardcoding a previously-externalized value is irreversible at production traffic. Each MUST go through `agents/shared/user-question-protocol.md` per `rules/hatch3r-clarification-default.md` B1 before action, with its own ask cycle.
|
|
128
|
+
|
|
129
|
+
## When to Invoke
|
|
130
|
+
|
|
131
|
+
- Every PR that modifies user-visible behavior, public API surfaces, config schema, or extension-point interfaces.
|
|
132
|
+
- Implementer pre-write check when authoring a new user-visible behavior — confirms the flag-gating + config-externalization plan before code is written.
|
|
133
|
+
- Verifier pre-merge gate on protected branches that touch the public API or behavior-toggle surface.
|
|
134
|
+
- API change audit during a D14 or forthcoming D22 cycle, or whenever the maturity tier escalates.
|
|
135
|
+
- Plugin / extension-point surface review before declaring an interface stable.
|
|
136
|
+
|
|
137
|
+
## References
|
|
138
|
+
|
|
139
|
+
- Pillar CQ9 (measurement set + specialist owner; see `agents/shared/principles.md`).
|
|
140
|
+
- The extensibility audit domain (enhancability domain).
|
|
141
|
+
- `agents/hatch3r-enhancability.md` (CQ9 reviewer / gate).
|
|
142
|
+
- `rules/hatch3r-feature-flags.md` (flag-system implementation pattern).
|
|
143
|
+
- `rules/hatch3r-api-versioning.md` (semver + deprecation timeline).
|
|
144
|
+
- `rules/hatch3r-progressive-delivery.md` (rollout strategy).
|
|
145
|
+
- `rules/hatch3r-secrets-management.md` (secret hygiene — paired with externalization).
|
|
146
|
+
- RFC 9745 (Deprecation header), RFC 8594 (Sunset header), semver 2.0.0 (semver.org).
|
|
147
|
+
- OpenFeature spec (https://openfeature.dev/specification/) — vendor-neutral flag SDK pattern.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CQ9 Enhancability Quality measurement rule — feature-flag adoption on user-visible behavior, config externalization, API versioning + deprecation policy, forward-compat patterns, extension-point definition
|
|
3
|
+
globs: ["src/**", "**/config/**", "**/openapi.yaml", "**/openapi.json", "**/*.proto", "**/schema.graphql", "**/asyncapi.yaml", "**/flags*", "**/plugins/**", "**/extensions/**"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
precedence: high
|
|
6
|
+
---
|
|
7
|
+
# Enhancability Quality (CQ9)
|
|
8
|
+
|
|
9
|
+
**Pillars:** P4 (Comprehensive Lean Coverage), CQ9 (Enhancability Quality)
|
|
10
|
+
|
|
11
|
+
## Scope
|
|
12
|
+
|
|
13
|
+
This rule binds the CQ9 measurement set across end-user code that hatch3r-generated agents produce. It owns:
|
|
14
|
+
|
|
15
|
+
- The feature-flag adoption floor on user-visible behavior changes.
|
|
16
|
+
- The configuration-externalization floor on environment-dependent values.
|
|
17
|
+
- The API versioning + deprecation policy on stable endpoints.
|
|
18
|
+
- The forward-compatibility pattern gate (additive schema, Deprecation + Sunset headers, contract tests).
|
|
19
|
+
- The extension-point definition gate for cross-cutting concerns.
|
|
20
|
+
- Specialist routing to `agents/hatch3r-enhancability.md`.
|
|
21
|
+
|
|
22
|
+
This complements (does not duplicate) `rules/hatch3r-feature-flags.md` (flag-system implementation pattern), `rules/hatch3r-api-versioning.md` (semver + deprecation timeline), and `rules/hatch3r-progressive-delivery.md` (rollout strategy).
|
|
23
|
+
|
|
24
|
+
## CQ9 Threshold Set
|
|
25
|
+
|
|
26
|
+
Source: pillar CQ9 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle.
|
|
27
|
+
|
|
28
|
+
| Threshold | Target | Measurement source |
|
|
29
|
+
|-----------|--------|--------------------|
|
|
30
|
+
| Feature-flag adoption | 100% on user-visible behavior changes | Diff scan vs flag-key inventory (`flags.yaml` or in-code registry) |
|
|
31
|
+
| Configuration externalization | 100% on environment-dependent values | Grep diff for hardcoded URLs, timeouts, retry counts, batch sizes, toggles, credentials |
|
|
32
|
+
| API versioning compliance | Semver 2.0.0 per release | MAJOR/MINOR/PATCH bump matches diff classification |
|
|
33
|
+
| Forward-compat patterns | 100% on stable endpoints | Additive schema; Deprecation (RFC 9745) + Sunset (RFC 8594) headers; consumer-driven contract tests |
|
|
34
|
+
| Extension-point definition | Per cross-cutting concern | Named interface; plugin registry; documented lifecycle hooks (onInit, onShutdown, onConfigChange); `## Stability` block |
|
|
35
|
+
| Spec-diff CI gate | Exit-zero per release | `oasdiff`, `buf breaking`, `graphql-inspector diff` CI step active |
|
|
36
|
+
|
|
37
|
+
## Feature-Flag Adoption
|
|
38
|
+
|
|
39
|
+
Every user-visible behavior change MUST ship behind an OpenFeature (or vendor-equivalent) flag. The rule:
|
|
40
|
+
|
|
41
|
+
1. **Provider registration** — application code wires a flag provider via `OpenFeature.setProvider()` (vendor SDK: LaunchDarkly, flagd, Unleash, Flagsmith, Split). Provider config lives in env-overridable settings.
|
|
42
|
+
2. **Flag-key inventory** — every flag key is registered in `flags.yaml` (or equivalent) with metadata: owner, description, default-value, kill-switch flag.
|
|
43
|
+
3. **Evaluation context** — flag evaluations carry a documented attribute schema (user-id, account-id, org-id, environment, locale, beta-cohort).
|
|
44
|
+
4. **Kill-switch** — every behavior-changing flag has a documented kill-switch path: setting the flag to OFF reverts to the previous behavior without code rollback.
|
|
45
|
+
5. **Cleanup window** — flags retired ≤90 days after 100% rollout per `rules/hatch3r-feature-flags.md`.
|
|
46
|
+
|
|
47
|
+
Behavior changes shipped without a flag are CRITICAL findings.
|
|
48
|
+
|
|
49
|
+
## Configuration Externalization
|
|
50
|
+
|
|
51
|
+
Every environment-dependent value MUST be externalized — hardcoded values in `src/` paths are FINDINGS minimum. Externalize via:
|
|
52
|
+
|
|
53
|
+
- **Schema-validated env** — Zod (`z.object({...}).parse(process.env)`), Joi (`Joi.object({...}).validate()`), Pydantic (`class Settings(BaseSettings)`), envalid (`cleanEnv()`).
|
|
54
|
+
- **Dotenv-flow** — `.env.development`, `.env.production`; secrets via secret-manager not file.
|
|
55
|
+
- **Startup-time validation** — config schema parsed once at boot; mis-config fails fast with named missing field.
|
|
56
|
+
|
|
57
|
+
Forbidden in `src/` paths:
|
|
58
|
+
|
|
59
|
+
- Hardcoded URLs to external services.
|
|
60
|
+
- Hardcoded timeouts, retry counts, batch sizes.
|
|
61
|
+
- Hardcoded feature toggles (`if (true)` ahead of a feature).
|
|
62
|
+
- Hardcoded credentials, API keys, tokens (see also `rules/hatch3r-secrets-management.md`).
|
|
63
|
+
- Silent fallback on config-validation error (catch + log + continue) — fail fast or document the explicit recovery path.
|
|
64
|
+
|
|
65
|
+
## API Versioning + Deprecation
|
|
66
|
+
|
|
67
|
+
Source: semver 2.0.0 (semver.org) + `rules/hatch3r-api-versioning.md`. The diff classification determines the version bump:
|
|
68
|
+
|
|
69
|
+
| Diff classification | Required bump |
|
|
70
|
+
|---------------------|---------------|
|
|
71
|
+
| Breaking change (removed field, changed type, renamed endpoint, semantics change) | MAJOR |
|
|
72
|
+
| Additive (new field, new endpoint, new method, new enum value) | MINOR |
|
|
73
|
+
| Fix (clarification, doc-only, bug-fix matching documented behavior) | PATCH |
|
|
74
|
+
|
|
75
|
+
The OpenAPI / AsyncAPI / GraphQL SDL `info.version` MUST be aligned to the release tag. Skipping a MAJOR bump on a breaking change is CRITICAL.
|
|
76
|
+
|
|
77
|
+
## Forward-Compatibility Patterns
|
|
78
|
+
|
|
79
|
+
On stable endpoints:
|
|
80
|
+
|
|
81
|
+
- **Additive schema** — new fields are optional; default values are documented; consumers ignore unknown fields. Removing a field is breaking; renaming is breaking.
|
|
82
|
+
- **Deprecation header (RFC 9745)** — emit `Deprecation: @1735689600` (Unix-time) or `Deprecation: Tue, 20 May 2025 00:00:00 GMT` (IMF-fixdate) on retiring endpoints.
|
|
83
|
+
- **Sunset header (RFC 8594)** — emit `Sunset: Tue, 31 Dec 2025 23:59:59 GMT` (IMF-fixdate only) on retiring endpoints. Sunset date MUST be later than Deprecation date.
|
|
84
|
+
- **Migration link** — emit `Link: <https://api.example.com/docs/migration>; rel="deprecation"` + `Link: <…>; rel="sunset"`.
|
|
85
|
+
- **Consumer-driven contract tests** — every public surface has a Pact (or equivalent) contract test from the consumer side; provider verification CI step exits-zero.
|
|
86
|
+
- **Spec-diff CI gate** — `oasdiff breaking --fail-on-diff` (REST), `buf breaking --against` (protobuf), `graphql-inspector diff` (GraphQL); the gate exits non-zero on breaks.
|
|
87
|
+
|
|
88
|
+
## Extension-Point Definition
|
|
89
|
+
|
|
90
|
+
Cross-cutting concerns (logging, auth, persistence, telemetry, error handling) get a named extension point:
|
|
91
|
+
|
|
92
|
+
- **Plugin interface** — exported TypeScript interface (`export interface AuthPlugin { ... }`) or Python protocol (`class AuthPlugin(Protocol)`).
|
|
93
|
+
- **Plugin registry** — central registration via `Plugin.register('auth', new MyAuthPlugin())` or dependency-injection container.
|
|
94
|
+
- **Lifecycle hooks** — `onInit(config)`, `onShutdown()`, `onConfigChange(newConfig)`.
|
|
95
|
+
- **Stability block** — `## Stability: stable | experimental | deprecated` block in the plugin's documentation.
|
|
96
|
+
- **Version-stable contract** — once a plugin interface is `stable`, the contract is bound to the deprecation policy and semver rules.
|
|
97
|
+
|
|
98
|
+
## Specialist Agent Routing
|
|
99
|
+
|
|
100
|
+
| Trigger | Route to |
|
|
101
|
+
|---------|----------|
|
|
102
|
+
| User-visible behavior modified | `agents/hatch3r-enhancability.md` (flag adoption gate) |
|
|
103
|
+
| Public API surface modified (OpenAPI / GraphQL SDL / AsyncAPI / protobuf) | `agents/hatch3r-enhancability.md` (versioning + forward-compat gate) |
|
|
104
|
+
| Config schema or feature-flag definition modified | `agents/hatch3r-enhancability.md` (externalization gate) |
|
|
105
|
+
| Extension-point interface modified | `agents/hatch3r-enhancability.md` (plugin contract gate) |
|
|
106
|
+
| Release-prep audit | `agents/hatch3r-enhancability.md` |
|
|
107
|
+
|
|
108
|
+
## Per-Finding Output Format
|
|
109
|
+
|
|
110
|
+
Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ9. The `proof_trace` excerpt is the file:line citation + spec-diff/grep output for the threshold that produced the finding.
|
|
111
|
+
|
|
112
|
+
## Severity Mapping
|
|
113
|
+
|
|
114
|
+
The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ9 Action per status:
|
|
115
|
+
|
|
116
|
+
- `CRITICAL`: Behavior change shipped without a flag; breaking change on stable endpoint without major-version bump; hardcoded credential or secret; silent fallback on config-validation error; missing CI spec-diff gate.
|
|
117
|
+
- `FINDINGS`: Externalization gap (hardcoded URL/timeout/batch-size); missing Deprecation/Sunset header; semver-policy gap; under-documented extension point.
|
|
118
|
+
- `PASS`: All thresholds met; surface in iteration summary.
|
|
119
|
+
|
|
120
|
+
## Irreversibility Trigger
|
|
121
|
+
|
|
122
|
+
Retiring a feature flag, dropping an API endpoint, or hardcoding a previously-externalized value is irreversible at production traffic. Each MUST go through `agents/shared/user-question-protocol.md` per `rules/hatch3r-clarification-default.md` B1 before action, with its own ask cycle.
|
|
123
|
+
|
|
124
|
+
## When to Invoke
|
|
125
|
+
|
|
126
|
+
- Every PR that modifies user-visible behavior, public API surfaces, config schema, or extension-point interfaces.
|
|
127
|
+
- Implementer pre-write check when authoring a new user-visible behavior — confirms the flag-gating + config-externalization plan before code is written.
|
|
128
|
+
- Verifier pre-merge gate on protected branches that touch the public API or behavior-toggle surface.
|
|
129
|
+
- API change audit during a D14 or forthcoming D22 cycle, or whenever the maturity tier escalates.
|
|
130
|
+
- Plugin / extension-point surface review before declaring an interface stable.
|
|
131
|
+
|
|
132
|
+
## References
|
|
133
|
+
|
|
134
|
+
- Pillar CQ9 (measurement set + specialist owner; see `agents/shared/principles.md`).
|
|
135
|
+
- The extensibility audit domain (enhancability domain).
|
|
136
|
+
- `agents/hatch3r-enhancability.md` (CQ9 reviewer / gate).
|
|
137
|
+
- `rules/hatch3r-feature-flags.md` (flag-system implementation pattern).
|
|
138
|
+
- `rules/hatch3r-api-versioning.md` (semver + deprecation timeline).
|
|
139
|
+
- `rules/hatch3r-progressive-delivery.md` (rollout strategy).
|
|
140
|
+
- `rules/hatch3r-secrets-management.md` (secret hygiene — paired with externalization).
|
|
141
|
+
- RFC 9745 (Deprecation header), RFC 8594 (Sunset header), semver 2.0.0 (semver.org).
|
|
142
|
+
- OpenFeature spec (https://openfeature.dev/specification/) — vendor-neutral flag SDK pattern.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
id: hatch3r-event-schema-evolution
|
|
3
3
|
type: rule
|
|
4
4
|
description: Event and message schema evolution patterns for Kafka / Kinesis / Pub-Sub / event store — backward + forward + full compatibility modes, schema registry, consumer-side defaults
|
|
5
|
-
scope:
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "**/events/**,**/schemas/**,**/*.avsc,**/*.proto,**/messaging/**,**/kafka/**,**/pubsub/**"
|
|
6
7
|
tags: [implementation, devops]
|
|
7
8
|
precedence: high
|
|
8
9
|
quality_charter: agents/shared/quality-charter.md
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-fan-out-discipline
|
|
3
|
+
type: rule
|
|
4
|
+
description: "P8 B2 floor: sub-agent fan-out scales with task size; serialization is valid only on dependency edges; token cost never justifies under-fan-out. Delegating artifacts emit sub-agent count + rationale as a first-class output field."
|
|
5
|
+
tags: [orchestration, floor:protocol]
|
|
6
|
+
scope: always
|
|
7
|
+
precedence: high
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
9
|
+
cache_friendly: true
|
|
10
|
+
---
|
|
11
|
+
# hatch3r Fan-out Discipline
|
|
12
|
+
|
|
13
|
+
**Pillars:** P8 (Clarification & Fan-out Discipline)
|
|
14
|
+
|
|
15
|
+
Canonical reference for the *mechanics* of parallel dispatch: `rules/hatch3r-agent-orchestration.md` → Parallel Safety. This rule is the corpus-wide, always-on floor that every adapter ships to the end-user repo, so the B2 directive binds runtime agents directly and not only by inheritance through the orchestration rule.
|
|
16
|
+
|
|
17
|
+
## B2 directive (verbatim)
|
|
18
|
+
|
|
19
|
+
> Sub-agent fan-out scales with task size; serialization is only valid on dependency edges. Token cost is never a valid reason to serialize independent work. Delegating artifacts emit sub-agent count + rationale as a first-class output field.
|
|
20
|
+
|
|
21
|
+
## Scaling heuristic
|
|
22
|
+
|
|
23
|
+
Sub-agent count tracks task decomposition, not a fixed cap:
|
|
24
|
+
|
|
25
|
+
- N independent modules → N parallel Phase-2 implementers.
|
|
26
|
+
- M specialist gates → M parallel Phase-4 specialists.
|
|
27
|
+
- K independent research questions → K parallel researcher modes.
|
|
28
|
+
|
|
29
|
+
When work is independent under the three parallel-safety conditions below, fan out. Only a true dependency edge — where stage B consumes stage A's output — justifies serialization.
|
|
30
|
+
|
|
31
|
+
The count derived above sets WHETHER to spawn each sub-agent. Past roughly 8 concurrent sub-agents, the count also sets the SHAPE: a single orchestrator that integrates 11–15 concurrent results in one context becomes the reviewability bottleneck. At that width, keep the full task-derived count but split it across a two-level tree (see Hierarchical delegation) rather than collapsing it to a narrower flat fan-out — collapsing the count to ease integration is the P8 violation the cost-dominance clause already forbids.
|
|
32
|
+
|
|
33
|
+
## Hierarchical delegation
|
|
34
|
+
|
|
35
|
+
The flat model — one orchestrator fans out to N workers and integrates all N results itself — is the default and is correct up to roughly 8 concurrent sub-agents (the empirical lead-agent ceiling cited in References, and the `max_phase4_parallel` default in `rules/hatch3r-agent-orchestration.md`). Beyond that width, prefer a two-level tree over a flat 11–15-wide fan-out:
|
|
36
|
+
|
|
37
|
+
- The root orchestrator decomposes the task into ≤8 disjoint groups and spawns one sub-orchestrator per group.
|
|
38
|
+
- Each sub-orchestrator fans out to its group's workers, integrates that group's results, and returns a single group-level summary.
|
|
39
|
+
- The root integrates ≤8 group summaries — not 11–15 raw worker results — so per-context integration load stays inside the reviewability ceiling at every level.
|
|
40
|
+
|
|
41
|
+
This preserves the task-derived total fan-out (no work is serialized): the same N workers still run concurrently, redistributed across sub-orchestrators. The grouping boundary MUST honor the three parallel-safety conditions both within a group and across groups, so a two-level tree carries no extra merge risk over the equivalent flat fan-out. High-fan-out commands are the trigger case — `commands/hatch3r-workflow.md` (`count: 15`) and the batch-mode `commands/hatch3r-board-fill.md` / `commands/hatch3r-board-pickup.md` (`count: 11` × issue count) otherwise concentrate every result on one orchestrator context.
|
|
42
|
+
|
|
43
|
+
Cost-dominance and reviewability govern different axes and never trade against each other: cost-dominance governs WHETHER to spawn a sub-agent (always spawn when work is independent; token cost never serializes it), reviewability governs the SHAPE of the resulting tree (flat ≤8, two-level beyond). Neither axis ever justifies dropping the task-derived count.
|
|
44
|
+
|
|
45
|
+
## Three parallel-safety conditions
|
|
46
|
+
|
|
47
|
+
Fan out only when ALL three hold (per `rules/hatch3r-agent-orchestration.md` → Three Conditions to Parallelize):
|
|
48
|
+
|
|
49
|
+
1. **Read-only or disjoint writes** — no two sub-agents write the same file or region.
|
|
50
|
+
2. **Deterministic aggregation** — outputs merge without orchestrator intervention (tests pass-if-all-pass; findings union).
|
|
51
|
+
3. **No shared mutable state** — agents that mutate shared state serialize; parallel agents only READ.
|
|
52
|
+
|
|
53
|
+
A fan-out that fails any condition is serialized or gated by a merge-conflict check — that is the only valid reason to drop below the task-derived count.
|
|
54
|
+
|
|
55
|
+
## Cost-dominance clause
|
|
56
|
+
|
|
57
|
+
Token cost of sub-agent invocation never justifies under-fan-out. Cost governs HOW MUCH context each sub-agent receives (the P7 static-first prompt frame); it does not govern WHETHER to spawn the sub-agent at all. P8 dominates P7: when an edit would compress fan-out to save tokens, reject it. When in doubt, fan out. Reviewability is a separate, non-cost axis: it governs the SHAPE of the fan-out tree (flat vs two-level per Hierarchical delegation), never WHETHER to spawn — so reviewability never serializes independent work either.
|
|
58
|
+
|
|
59
|
+
## Required output field
|
|
60
|
+
|
|
61
|
+
Delegating artifacts (orchestrator commands, fan-out skills, delegating agents) emit a first-class output field:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
sub_agents_spawned:
|
|
65
|
+
count: <integer>
|
|
66
|
+
rationale: <one-sentence task-decomposition justification>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Omitting the field on a delegating artifact is a P8 B2 violation (D07 fan-out-discipline audit). The `rationale` states the decomposition basis (module count, specialist-gate count, research-question count) so a reviewer can check the count against the task without re-deriving it.
|
|
70
|
+
|
|
71
|
+
## Static intent vs runtime attestation
|
|
72
|
+
|
|
73
|
+
The `sub_agents_spawned` frontmatter field declares fan-out intent at config time; it does not prove the orchestrator delegated at run time. The pair is closed by the End-of-Turn Delegation Attestation (`rules/hatch3r-agent-orchestration.md` → End-of-Turn Delegation Attestation): the per-file `delegation_proof_id` returned by the implementer or fixer sub-agent is forgery-resistant, because an orchestrator that skipped delegation has no token to quote. Static frontmatter declares; the runtime block verifies.
|
|
74
|
+
|
|
75
|
+
## Scope
|
|
76
|
+
|
|
77
|
+
Binds every hatch3r-invoked workflow that delegates via the Task tool in the end-user repo — every `commands/hatch3r-*.md` with `orchestrator: true`, every delegating `agents/hatch3r-*.md`, and every fan-out `skills/hatch3r-*/SKILL.md`. Tier 1 reference-card skills that neither spawn sub-agents nor mutate files carry no fan-out obligation; they state `Tier 1 reference card — no fan-out` instead.
|
|
78
|
+
|
|
79
|
+
How each class emits the field differs because the count is known at a different time:
|
|
80
|
+
|
|
81
|
+
- **Commands** declare it as a static frontmatter key — a command's fan-out is fixed by its `agentPipeline`, so `sub_agents_spawned: {count, rationale}` is a config-time value. `scripts/validate-fanout-emission.ts` enforces the key on every `orchestrator: true` command (CI gate `npm run validate:efficiency`).
|
|
82
|
+
- **Skills** carry the runtime-emission directive in the body — a skill's count is task-derived (Tier 1 inline / Tier 2 per-concern / Tier 3 per-module), so a static integer would misstate it. A skill whose body holds a Tier-2/3 Task-tool delegation contract MUST state `` Emit `sub_agents_spawned: { count, rationale }` in your output. ``; the same validator flags `P8-FANOUT-SKILL-MISS` on a delegating, non-exempt skill that omits it.
|
|
83
|
+
- **Agents** are prose-bound: their delegation is inherited from `rules/hatch3r-agent-orchestration.md` and they carry no `orchestrator` frontmatter marker, so no separate validator trigger applies; the worker agents that mention the Task tool delegate on behalf of a parent orchestrator, not as a fan-out root.
|
|
84
|
+
|
|
85
|
+
## References
|
|
86
|
+
|
|
87
|
+
- Pillar P8 B2 (source directive; see `agents/shared/principles.md`).
|
|
88
|
+
- `rules/hatch3r-agent-orchestration.md` → Parallel Safety, Scaling Heuristic, Cost-Dominance Principle, End-of-Turn Delegation Attestation (mechanics this rule references).
|
|
89
|
+
- The orchestration audit domain audits the B2 contract per cycle.
|
|
90
|
+
- Anthropic, "Multi-agent orchestration" (Managed Agents) — `https://platform.claude.com/docs/en/managed-agents/multi-agent` (accessed 2026-05-26, official-docs): a lead agent decomposes a job and delegates pieces to specialist sub-agents working in parallel over a shared file system, up to ~10 simultaneous — the lead-agent ceiling that anchors the ~8 flat-vs-hierarchical threshold above; beyond it a lead agent itself acts as a sub-orchestrator over its own workers.
|
|
91
|
+
- Augment Code, "Multi-Agent Orchestration Architecture Guide" — `https://www.augmentcode.com/guides/multi-agent-orchestration-architecture-guide` (accessed 2026-05-26, independent-analysis): structured context objects pass only relevant fields per worker; graph-based message passing structures communication along declared dependency edges.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-fan-out-discipline
|
|
3
|
+
type: rule
|
|
4
|
+
description: "P8 B2 floor: sub-agent fan-out scales with task size; serialization is valid only on dependency edges; token cost never justifies under-fan-out. Delegating artifacts emit sub-agent count + rationale as a first-class output field."
|
|
5
|
+
tags: [orchestration, floor:protocol]
|
|
6
|
+
alwaysApply: true
|
|
7
|
+
precedence: high
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
9
|
+
cache_friendly: true
|
|
10
|
+
---
|
|
11
|
+
# hatch3r Fan-out Discipline
|
|
12
|
+
|
|
13
|
+
**Pillars:** P8 (Clarification & Fan-out Discipline)
|
|
14
|
+
|
|
15
|
+
Canonical reference for the *mechanics* of parallel dispatch: `rules/hatch3r-agent-orchestration.md` → Parallel Safety. This rule is the corpus-wide, always-on floor that every adapter ships to the end-user repo, so the B2 directive binds runtime agents directly and not only by inheritance through the orchestration rule.
|
|
16
|
+
|
|
17
|
+
## B2 directive (verbatim)
|
|
18
|
+
|
|
19
|
+
> Sub-agent fan-out scales with task size; serialization is only valid on dependency edges. Token cost is never a valid reason to serialize independent work. Delegating artifacts emit sub-agent count + rationale as a first-class output field.
|
|
20
|
+
|
|
21
|
+
## Scaling heuristic
|
|
22
|
+
|
|
23
|
+
Sub-agent count tracks task decomposition, not a fixed cap:
|
|
24
|
+
|
|
25
|
+
- N independent modules → N parallel Phase-2 implementers.
|
|
26
|
+
- M specialist gates → M parallel Phase-4 specialists.
|
|
27
|
+
- K independent research questions → K parallel researcher modes.
|
|
28
|
+
|
|
29
|
+
When work is independent under the three parallel-safety conditions below, fan out. Only a true dependency edge — where stage B consumes stage A's output — justifies serialization.
|
|
30
|
+
|
|
31
|
+
The count derived above sets WHETHER to spawn each sub-agent. Past roughly 8 concurrent sub-agents, the count also sets the SHAPE: a single orchestrator that integrates 11–15 concurrent results in one context becomes the reviewability bottleneck. At that width, keep the full task-derived count but split it across a two-level tree (see Hierarchical delegation) rather than collapsing it to a narrower flat fan-out — collapsing the count to ease integration is the P8 violation the cost-dominance clause already forbids.
|
|
32
|
+
|
|
33
|
+
## Hierarchical delegation
|
|
34
|
+
|
|
35
|
+
The flat model — one orchestrator fans out to N workers and integrates all N results itself — is the default and is correct up to roughly 8 concurrent sub-agents (the empirical lead-agent ceiling cited in References, and the `max_phase4_parallel` default in `rules/hatch3r-agent-orchestration.md`). Beyond that width, prefer a two-level tree over a flat 11–15-wide fan-out:
|
|
36
|
+
|
|
37
|
+
- The root orchestrator decomposes the task into ≤8 disjoint groups and spawns one sub-orchestrator per group.
|
|
38
|
+
- Each sub-orchestrator fans out to its group's workers, integrates that group's results, and returns a single group-level summary.
|
|
39
|
+
- The root integrates ≤8 group summaries — not 11–15 raw worker results — so per-context integration load stays inside the reviewability ceiling at every level.
|
|
40
|
+
|
|
41
|
+
This preserves the task-derived total fan-out (no work is serialized): the same N workers still run concurrently, redistributed across sub-orchestrators. The grouping boundary MUST honor the three parallel-safety conditions both within a group and across groups, so a two-level tree carries no extra merge risk over the equivalent flat fan-out. High-fan-out commands are the trigger case — `commands/hatch3r-workflow.md` (`count: 15`) and the batch-mode `commands/hatch3r-board-fill.md` / `commands/hatch3r-board-pickup.md` (`count: 11` × issue count) otherwise concentrate every result on one orchestrator context.
|
|
42
|
+
|
|
43
|
+
Cost-dominance and reviewability govern different axes and never trade against each other: cost-dominance governs WHETHER to spawn a sub-agent (always spawn when work is independent; token cost never serializes it), reviewability governs the SHAPE of the resulting tree (flat ≤8, two-level beyond). Neither axis ever justifies dropping the task-derived count.
|
|
44
|
+
|
|
45
|
+
## Three parallel-safety conditions
|
|
46
|
+
|
|
47
|
+
Fan out only when ALL three hold (per `rules/hatch3r-agent-orchestration.md` → Three Conditions to Parallelize):
|
|
48
|
+
|
|
49
|
+
1. **Read-only or disjoint writes** — no two sub-agents write the same file or region.
|
|
50
|
+
2. **Deterministic aggregation** — outputs merge without orchestrator intervention (tests pass-if-all-pass; findings union).
|
|
51
|
+
3. **No shared mutable state** — agents that mutate shared state serialize; parallel agents only READ.
|
|
52
|
+
|
|
53
|
+
A fan-out that fails any condition is serialized or gated by a merge-conflict check — that is the only valid reason to drop below the task-derived count.
|
|
54
|
+
|
|
55
|
+
## Cost-dominance clause
|
|
56
|
+
|
|
57
|
+
Token cost of sub-agent invocation never justifies under-fan-out. Cost governs HOW MUCH context each sub-agent receives (the P7 static-first prompt frame); it does not govern WHETHER to spawn the sub-agent at all. P8 dominates P7: when an edit would compress fan-out to save tokens, reject it. When in doubt, fan out. Reviewability is a separate, non-cost axis: it governs the SHAPE of the fan-out tree (flat vs two-level per Hierarchical delegation), never WHETHER to spawn — so reviewability never serializes independent work either.
|
|
58
|
+
|
|
59
|
+
## Required output field
|
|
60
|
+
|
|
61
|
+
Delegating artifacts (orchestrator commands, fan-out skills, delegating agents) emit a first-class output field:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
sub_agents_spawned:
|
|
65
|
+
count: <integer>
|
|
66
|
+
rationale: <one-sentence task-decomposition justification>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Omitting the field on a delegating artifact is a P8 B2 violation (D07 fan-out-discipline audit). The `rationale` states the decomposition basis (module count, specialist-gate count, research-question count) so a reviewer can check the count against the task without re-deriving it.
|
|
70
|
+
|
|
71
|
+
## Static intent vs runtime attestation
|
|
72
|
+
|
|
73
|
+
The `sub_agents_spawned` frontmatter field declares fan-out intent at config time; it does not prove the orchestrator delegated at run time. The pair is closed by the End-of-Turn Delegation Attestation (`rules/hatch3r-agent-orchestration.md` → End-of-Turn Delegation Attestation): the per-file `delegation_proof_id` returned by the implementer or fixer sub-agent is forgery-resistant, because an orchestrator that skipped delegation has no token to quote. Static frontmatter declares; the runtime block verifies.
|
|
74
|
+
|
|
75
|
+
## Scope
|
|
76
|
+
|
|
77
|
+
Binds every hatch3r-invoked workflow that delegates via the Task tool in the end-user repo — every `commands/hatch3r-*.md` with `orchestrator: true`, every delegating `agents/hatch3r-*.md`, and every fan-out `skills/hatch3r-*/SKILL.md`. Tier 1 reference-card skills that neither spawn sub-agents nor mutate files carry no fan-out obligation; they state `Tier 1 reference card — no fan-out` instead.
|
|
78
|
+
|
|
79
|
+
How each class emits the field differs because the count is known at a different time:
|
|
80
|
+
|
|
81
|
+
- **Commands** declare it as a static frontmatter key — a command's fan-out is fixed by its `agentPipeline`, so `sub_agents_spawned: {count, rationale}` is a config-time value. `scripts/validate-fanout-emission.ts` enforces the key on every `orchestrator: true` command (CI gate `npm run validate:efficiency`).
|
|
82
|
+
- **Skills** carry the runtime-emission directive in the body — a skill's count is task-derived (Tier 1 inline / Tier 2 per-concern / Tier 3 per-module), so a static integer would misstate it. A skill whose body holds a Tier-2/3 Task-tool delegation contract MUST state `` Emit `sub_agents_spawned: { count, rationale }` in your output. ``; the same validator flags `P8-FANOUT-SKILL-MISS` on a delegating, non-exempt skill that omits it.
|
|
83
|
+
- **Agents** are prose-bound: their delegation is inherited from `rules/hatch3r-agent-orchestration.md` and they carry no `orchestrator` frontmatter marker, so no separate validator trigger applies; the worker agents that mention the Task tool delegate on behalf of a parent orchestrator, not as a fan-out root.
|
|
84
|
+
|
|
85
|
+
## References
|
|
86
|
+
|
|
87
|
+
- Pillar P8 B2 (source directive; see `agents/shared/principles.md`).
|
|
88
|
+
- `rules/hatch3r-agent-orchestration.md` → Parallel Safety, Scaling Heuristic, Cost-Dominance Principle, End-of-Turn Delegation Attestation (mechanics this rule references).
|
|
89
|
+
- The orchestration audit domain audits the B2 contract per cycle.
|
|
90
|
+
- Anthropic, "Multi-agent orchestration" (Managed Agents) — `https://platform.claude.com/docs/en/managed-agents/multi-agent` (accessed 2026-05-26, official-docs): a lead agent decomposes a job and delegates pieces to specialist sub-agents working in parallel over a shared file system, up to ~10 simultaneous — the lead-agent ceiling that anchors the ~8 flat-vs-hierarchical threshold above; beyond it a lead agent itself acts as a sub-orchestrator over its own workers.
|
|
91
|
+
- Augment Code, "Multi-Agent Orchestration Architecture Guide" — `https://www.augmentcode.com/guides/multi-agent-orchestration-architecture-guide` (accessed 2026-05-26, independent-analysis): structured context objects pass only relevant fields per worker; graph-based message passing structures communication along declared dependency edges.
|
|
@@ -10,6 +10,8 @@ cache_friendly: true
|
|
|
10
10
|
---
|
|
11
11
|
# Feature Flags
|
|
12
12
|
|
|
13
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ9 (Enhancability Quality)
|
|
14
|
+
|
|
13
15
|
- Use flags for gradual rollout of user-facing changes. Not for A/B experiments without tracking.
|
|
14
16
|
- Naming: `FF_{AREA}_{FEATURE}` (e.g., `FF_PET_NEW_CELEBRATION`).
|
|
15
17
|
- Store flags in remote config or user document in your backend.
|
|
@@ -5,6 +5,8 @@ alwaysApply: false
|
|
|
5
5
|
---
|
|
6
6
|
# Feature Flags
|
|
7
7
|
|
|
8
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ9 (Enhancability Quality)
|
|
9
|
+
|
|
8
10
|
- Use flags for gradual rollout of user-facing changes. Not for A/B experiments without tracking.
|
|
9
11
|
- Naming: `FF_{AREA}_{FEATURE}` (e.g., `FF_PET_NEW_CELEBRATION`).
|
|
10
12
|
- Store flags in remote config or user document in your backend.
|