@zigrivers/scaffold 2.1.2 → 2.38.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 +505 -119
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +94 -14
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/build.test.js +30 -5
- package/dist/cli/commands/build.test.js.map +1 -1
- package/dist/cli/commands/check.d.ts +12 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +311 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/check.test.d.ts +2 -0
- package/dist/cli/commands/check.test.d.ts.map +1 -0
- package/dist/cli/commands/check.test.js +412 -0
- package/dist/cli/commands/check.test.js.map +1 -0
- package/dist/cli/commands/complete.d.ts +12 -0
- package/dist/cli/commands/complete.d.ts.map +1 -0
- package/dist/cli/commands/complete.js +101 -0
- package/dist/cli/commands/complete.js.map +1 -0
- package/dist/cli/commands/complete.test.d.ts +2 -0
- package/dist/cli/commands/complete.test.d.ts.map +1 -0
- package/dist/cli/commands/complete.test.js +133 -0
- package/dist/cli/commands/complete.test.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -1
- package/dist/cli/commands/dashboard.js +12 -8
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +4 -0
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +6 -2
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/knowledge.test.js +16 -11
- package/dist/cli/commands/knowledge.test.js.map +1 -1
- package/dist/cli/commands/next.d.ts.map +1 -1
- package/dist/cli/commands/next.js +41 -13
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/commands/next.test.js +3 -0
- package/dist/cli/commands/next.test.js.map +1 -1
- package/dist/cli/commands/reset.d.ts +1 -0
- package/dist/cli/commands/reset.d.ts.map +1 -1
- package/dist/cli/commands/reset.js +179 -67
- package/dist/cli/commands/reset.js.map +1 -1
- package/dist/cli/commands/reset.test.js +360 -0
- package/dist/cli/commands/reset.test.js.map +1 -1
- package/dist/cli/commands/rework.d.ts +20 -0
- package/dist/cli/commands/rework.d.ts.map +1 -0
- package/dist/cli/commands/rework.js +332 -0
- package/dist/cli/commands/rework.js.map +1 -0
- package/dist/cli/commands/rework.test.d.ts +2 -0
- package/dist/cli/commands/rework.test.d.ts.map +1 -0
- package/dist/cli/commands/rework.test.js +297 -0
- package/dist/cli/commands/rework.test.js.map +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +59 -31
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/run.test.js +288 -6
- package/dist/cli/commands/run.test.js.map +1 -1
- package/dist/cli/commands/skill.d.ts +12 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +123 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/skill.test.d.ts +2 -0
- package/dist/cli/commands/skill.test.d.ts.map +1 -0
- package/dist/cli/commands/skill.test.js +297 -0
- package/dist/cli/commands/skill.test.js.map +1 -0
- package/dist/cli/commands/skip.d.ts +1 -1
- package/dist/cli/commands/skip.d.ts.map +1 -1
- package/dist/cli/commands/skip.js +123 -57
- package/dist/cli/commands/skip.js.map +1 -1
- package/dist/cli/commands/skip.test.js +91 -0
- package/dist/cli/commands/skip.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +57 -10
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +81 -0
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/update.test.js +252 -0
- package/dist/cli/commands/update.test.js.map +1 -1
- package/dist/cli/commands/version.test.js +171 -1
- package/dist/cli/commands/version.test.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapters/adapter.d.ts +14 -0
- package/dist/core/adapters/adapter.d.ts.map +1 -1
- package/dist/core/adapters/adapter.js.map +1 -1
- package/dist/core/adapters/adapter.test.js +10 -0
- package/dist/core/adapters/adapter.test.js.map +1 -1
- package/dist/core/adapters/claude-code.d.ts.map +1 -1
- package/dist/core/adapters/claude-code.js +47 -10
- package/dist/core/adapters/claude-code.js.map +1 -1
- package/dist/core/adapters/claude-code.test.js +41 -20
- package/dist/core/adapters/claude-code.test.js.map +1 -1
- package/dist/core/adapters/codex.d.ts.map +1 -1
- package/dist/core/adapters/codex.js +5 -1
- package/dist/core/adapters/codex.js.map +1 -1
- package/dist/core/adapters/codex.test.js +5 -0
- package/dist/core/adapters/codex.test.js.map +1 -1
- package/dist/core/adapters/universal.d.ts.map +1 -1
- package/dist/core/adapters/universal.js +0 -1
- package/dist/core/adapters/universal.js.map +1 -1
- package/dist/core/adapters/universal.test.js +5 -0
- package/dist/core/adapters/universal.test.js.map +1 -1
- package/dist/core/assembly/context-gatherer.d.ts.map +1 -1
- package/dist/core/assembly/context-gatherer.js +5 -2
- package/dist/core/assembly/context-gatherer.js.map +1 -1
- package/dist/core/assembly/engine.d.ts.map +1 -1
- package/dist/core/assembly/engine.js +10 -2
- package/dist/core/assembly/engine.js.map +1 -1
- package/dist/core/assembly/engine.test.js +19 -0
- package/dist/core/assembly/engine.test.js.map +1 -1
- package/dist/core/assembly/knowledge-loader.d.ts +25 -0
- package/dist/core/assembly/knowledge-loader.d.ts.map +1 -1
- package/dist/core/assembly/knowledge-loader.js +75 -2
- package/dist/core/assembly/knowledge-loader.js.map +1 -1
- package/dist/core/assembly/knowledge-loader.test.js +388 -1
- package/dist/core/assembly/knowledge-loader.test.js.map +1 -1
- package/dist/core/assembly/meta-prompt-loader.d.ts +6 -0
- package/dist/core/assembly/meta-prompt-loader.d.ts.map +1 -1
- package/dist/core/assembly/meta-prompt-loader.js +41 -25
- package/dist/core/assembly/meta-prompt-loader.js.map +1 -1
- package/dist/core/assembly/preset-loader.d.ts +10 -0
- package/dist/core/assembly/preset-loader.d.ts.map +1 -1
- package/dist/core/assembly/preset-loader.js +26 -1
- package/dist/core/assembly/preset-loader.js.map +1 -1
- package/dist/core/assembly/preset-loader.test.js +65 -1
- package/dist/core/assembly/preset-loader.test.js.map +1 -1
- package/dist/core/assembly/update-mode.d.ts.map +1 -1
- package/dist/core/assembly/update-mode.js +10 -4
- package/dist/core/assembly/update-mode.js.map +1 -1
- package/dist/core/assembly/update-mode.test.js +47 -0
- package/dist/core/assembly/update-mode.test.js.map +1 -1
- package/dist/core/dependency/dependency.d.ts.map +1 -1
- package/dist/core/dependency/dependency.js +3 -2
- package/dist/core/dependency/dependency.js.map +1 -1
- package/dist/core/dependency/dependency.test.js +2 -0
- package/dist/core/dependency/dependency.test.js.map +1 -1
- package/dist/core/dependency/eligibility.js +3 -3
- package/dist/core/dependency/eligibility.js.map +1 -1
- package/dist/core/dependency/eligibility.test.js +2 -0
- package/dist/core/dependency/eligibility.test.js.map +1 -1
- package/dist/core/dependency/graph.d.ts.map +1 -1
- package/dist/core/dependency/graph.js +4 -0
- package/dist/core/dependency/graph.js.map +1 -1
- package/dist/core/dependency/graph.test.d.ts +2 -0
- package/dist/core/dependency/graph.test.d.ts.map +1 -0
- package/dist/core/dependency/graph.test.js +262 -0
- package/dist/core/dependency/graph.test.js.map +1 -0
- package/dist/core/rework/phase-selector.d.ts +24 -0
- package/dist/core/rework/phase-selector.d.ts.map +1 -0
- package/dist/core/rework/phase-selector.js +98 -0
- package/dist/core/rework/phase-selector.js.map +1 -0
- package/dist/core/rework/phase-selector.test.d.ts +2 -0
- package/dist/core/rework/phase-selector.test.d.ts.map +1 -0
- package/dist/core/rework/phase-selector.test.js +138 -0
- package/dist/core/rework/phase-selector.test.js.map +1 -0
- package/dist/dashboard/generator.d.ts +48 -17
- package/dist/dashboard/generator.d.ts.map +1 -1
- package/dist/dashboard/generator.js +75 -5
- package/dist/dashboard/generator.js.map +1 -1
- package/dist/dashboard/generator.test.js +213 -5
- package/dist/dashboard/generator.test.js.map +1 -1
- package/dist/dashboard/template.d.ts +1 -1
- package/dist/dashboard/template.d.ts.map +1 -1
- package/dist/dashboard/template.js +755 -114
- package/dist/dashboard/template.js.map +1 -1
- package/dist/e2e/knowledge.test.js +4 -3
- package/dist/e2e/knowledge.test.js.map +1 -1
- package/dist/e2e/pipeline.test.js +2 -0
- package/dist/e2e/pipeline.test.js.map +1 -1
- package/dist/e2e/rework.test.d.ts +6 -0
- package/dist/e2e/rework.test.d.ts.map +1 -0
- package/dist/e2e/rework.test.js +226 -0
- package/dist/e2e/rework.test.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/project/adopt.test.js +2 -0
- package/dist/project/adopt.test.js.map +1 -1
- package/dist/project/claude-md.js +2 -2
- package/dist/project/claude-md.js.map +1 -1
- package/dist/project/claude-md.test.js +4 -4
- package/dist/project/claude-md.test.js.map +1 -1
- package/dist/project/detector.d.ts.map +1 -1
- package/dist/project/detector.js +4 -1
- package/dist/project/detector.js.map +1 -1
- package/dist/project/frontmatter.d.ts.map +1 -1
- package/dist/project/frontmatter.js +54 -15
- package/dist/project/frontmatter.js.map +1 -1
- package/dist/project/frontmatter.test.js +2 -2
- package/dist/project/frontmatter.test.js.map +1 -1
- package/dist/state/rework-manager.d.ts +16 -0
- package/dist/state/rework-manager.d.ts.map +1 -0
- package/dist/state/rework-manager.js +126 -0
- package/dist/state/rework-manager.js.map +1 -0
- package/dist/state/rework-manager.test.d.ts +2 -0
- package/dist/state/rework-manager.test.d.ts.map +1 -0
- package/dist/state/rework-manager.test.js +191 -0
- package/dist/state/rework-manager.test.js.map +1 -0
- package/dist/state/state-manager.d.ts +13 -0
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +39 -2
- package/dist/state/state-manager.js.map +1 -1
- package/dist/state/state-manager.test.js +74 -1
- package/dist/state/state-manager.test.js.map +1 -1
- package/dist/state/state-migration.d.ts +23 -0
- package/dist/state/state-migration.d.ts.map +1 -0
- package/dist/state/state-migration.js +144 -0
- package/dist/state/state-migration.js.map +1 -0
- package/dist/state/state-migration.test.d.ts +2 -0
- package/dist/state/state-migration.test.d.ts.map +1 -0
- package/dist/state/state-migration.test.js +451 -0
- package/dist/state/state-migration.test.js.map +1 -0
- package/dist/types/assembly.d.ts +2 -0
- package/dist/types/assembly.d.ts.map +1 -1
- package/dist/types/dependency.d.ts +2 -2
- package/dist/types/dependency.d.ts.map +1 -1
- package/dist/types/frontmatter.d.ts +100 -7
- package/dist/types/frontmatter.d.ts.map +1 -1
- package/dist/types/frontmatter.js +89 -1
- package/dist/types/frontmatter.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/lock.d.ts +1 -1
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/rework.d.ts +36 -0
- package/dist/types/rework.d.ts.map +1 -0
- package/dist/types/rework.js +2 -0
- package/dist/types/rework.js.map +1 -0
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +8 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/fs.d.ts +6 -0
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +13 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/validation/config-validator.test.d.ts +2 -0
- package/dist/validation/config-validator.test.d.ts.map +1 -0
- package/dist/validation/config-validator.test.js +210 -0
- package/dist/validation/config-validator.test.js.map +1 -0
- package/dist/validation/dependency-validator.test.d.ts +2 -0
- package/dist/validation/dependency-validator.test.d.ts.map +1 -0
- package/dist/validation/dependency-validator.test.js +215 -0
- package/dist/validation/dependency-validator.test.js.map +1 -0
- package/dist/validation/frontmatter-validator.test.d.ts +2 -0
- package/dist/validation/frontmatter-validator.test.d.ts.map +1 -0
- package/dist/validation/frontmatter-validator.test.js +371 -0
- package/dist/validation/frontmatter-validator.test.js.map +1 -0
- package/dist/validation/state-validator.test.d.ts +2 -0
- package/dist/validation/state-validator.test.d.ts.map +1 -0
- package/dist/validation/state-validator.test.js +325 -0
- package/dist/validation/state-validator.test.js.map +1 -0
- package/dist/wizard/suggestion.test.d.ts +2 -0
- package/dist/wizard/suggestion.test.d.ts.map +1 -0
- package/dist/wizard/suggestion.test.js +115 -0
- package/dist/wizard/suggestion.test.js.map +1 -0
- package/dist/wizard/wizard.d.ts.map +1 -1
- package/dist/wizard/wizard.js +34 -1
- package/dist/wizard/wizard.js.map +1 -1
- package/knowledge/core/adr-craft.md +57 -0
- package/knowledge/core/ai-memory-management.md +246 -0
- package/knowledge/core/api-design.md +8 -0
- package/knowledge/core/automated-review-tooling.md +203 -0
- package/knowledge/core/claude-md-patterns.md +254 -0
- package/knowledge/core/coding-conventions.md +246 -0
- package/knowledge/core/database-design.md +8 -0
- package/knowledge/core/design-system-tokens.md +469 -0
- package/knowledge/core/dev-environment.md +223 -0
- package/knowledge/core/domain-modeling.md +8 -0
- package/knowledge/core/eval-craft.md +1008 -0
- package/knowledge/core/git-workflow-patterns.md +200 -0
- package/knowledge/core/multi-model-review-dispatch.md +250 -0
- package/knowledge/core/operations-runbook.md +40 -225
- package/knowledge/core/project-structure-patterns.md +231 -0
- package/knowledge/core/review-step-template.md +247 -0
- package/knowledge/core/{security-review.md → security-best-practices.md} +9 -1
- package/knowledge/core/system-architecture.md +5 -1
- package/knowledge/core/task-decomposition.md +174 -36
- package/knowledge/core/task-tracking.md +225 -0
- package/knowledge/core/tech-stack-selection.md +214 -0
- package/knowledge/core/testing-strategy.md +63 -70
- package/knowledge/core/user-stories.md +69 -60
- package/knowledge/core/user-story-innovation.md +70 -0
- package/knowledge/core/ux-specification.md +18 -148
- package/knowledge/execution/enhancement-workflow.md +201 -0
- package/knowledge/execution/task-claiming-strategy.md +130 -0
- package/knowledge/execution/tdd-execution-loop.md +172 -0
- package/knowledge/execution/worktree-management.md +205 -0
- package/knowledge/finalization/apply-fixes-and-freeze.md +177 -14
- package/knowledge/finalization/developer-onboarding.md +4 -0
- package/knowledge/finalization/implementation-playbook.md +83 -5
- package/knowledge/product/gap-analysis.md +5 -1
- package/knowledge/product/prd-craft.md +55 -34
- package/knowledge/product/prd-innovation.md +12 -0
- package/knowledge/product/vision-craft.md +213 -0
- package/knowledge/review/review-adr.md +44 -0
- package/knowledge/review/{review-api-contracts.md → review-api-design.md} +47 -1
- package/knowledge/review/{review-database-schema.md → review-database-design.md} +40 -1
- package/knowledge/review/review-domain-modeling.md +38 -1
- package/knowledge/review/review-implementation-tasks.md +108 -1
- package/knowledge/review/review-methodology.md +11 -0
- package/knowledge/review/review-operations.md +67 -0
- package/knowledge/review/review-prd.md +46 -0
- package/knowledge/review/review-security.md +65 -0
- package/knowledge/review/review-system-architecture.md +32 -2
- package/knowledge/review/review-testing-strategy.md +62 -0
- package/knowledge/review/review-user-stories.md +65 -0
- package/knowledge/review/{review-ux-spec.md → review-ux-specification.md} +50 -2
- package/knowledge/review/review-vision.md +255 -0
- package/knowledge/tools/release-management.md +222 -0
- package/knowledge/tools/session-analysis.md +215 -0
- package/knowledge/tools/version-strategy.md +200 -0
- package/knowledge/validation/critical-path-analysis.md +1 -1
- package/knowledge/validation/cross-phase-consistency.md +12 -0
- package/knowledge/validation/decision-completeness.md +13 -1
- package/knowledge/validation/dependency-validation.md +12 -0
- package/knowledge/validation/scope-management.md +12 -0
- package/knowledge/validation/traceability.md +12 -0
- package/methodology/README.md +37 -0
- package/methodology/custom-defaults.yml +44 -4
- package/methodology/deep.yml +43 -3
- package/methodology/mvp.yml +43 -3
- package/package.json +4 -3
- package/pipeline/architecture/review-architecture.md +36 -13
- package/pipeline/architecture/system-architecture.md +24 -9
- package/pipeline/build/multi-agent-resume.md +245 -0
- package/pipeline/build/multi-agent-start.md +236 -0
- package/pipeline/build/new-enhancement.md +456 -0
- package/pipeline/build/quick-task.md +381 -0
- package/pipeline/build/single-agent-resume.md +210 -0
- package/pipeline/build/single-agent-start.md +207 -0
- package/pipeline/consolidation/claude-md-optimization.md +76 -0
- package/pipeline/consolidation/workflow-audit.md +77 -0
- package/pipeline/decisions/adrs.md +21 -7
- package/pipeline/decisions/review-adrs.md +32 -11
- package/pipeline/environment/ai-memory-setup.md +76 -0
- package/pipeline/environment/automated-pr-review.md +76 -0
- package/pipeline/environment/design-system.md +75 -0
- package/pipeline/environment/dev-env-setup.md +68 -0
- package/pipeline/environment/git-workflow.md +73 -0
- package/pipeline/finalization/apply-fixes-and-freeze.md +17 -6
- package/pipeline/finalization/developer-onboarding-guide.md +23 -9
- package/pipeline/finalization/implementation-playbook.md +43 -14
- package/pipeline/foundation/beads.md +71 -0
- package/pipeline/foundation/coding-standards.md +71 -0
- package/pipeline/foundation/project-structure.md +73 -0
- package/pipeline/foundation/tdd.md +64 -0
- package/pipeline/foundation/tech-stack.md +74 -0
- package/pipeline/integration/add-e2e-testing.md +80 -0
- package/pipeline/modeling/domain-modeling.md +23 -8
- package/pipeline/modeling/review-domain-modeling.md +35 -11
- package/pipeline/parity/platform-parity-review.md +90 -0
- package/pipeline/planning/implementation-plan-review.md +67 -0
- package/pipeline/planning/implementation-plan.md +110 -0
- package/pipeline/pre/create-prd.md +34 -10
- package/pipeline/pre/innovate-prd.md +46 -15
- package/pipeline/pre/innovate-user-stories.md +47 -14
- package/pipeline/pre/review-prd.md +29 -8
- package/pipeline/pre/review-user-stories.md +34 -8
- package/pipeline/pre/user-stories.md +23 -8
- package/pipeline/quality/create-evals.md +106 -0
- package/pipeline/quality/operations.md +46 -17
- package/pipeline/quality/review-operations.md +32 -11
- package/pipeline/quality/review-security.md +34 -12
- package/pipeline/quality/review-testing.md +37 -14
- package/pipeline/quality/security.md +36 -10
- package/pipeline/quality/story-tests.md +75 -0
- package/pipeline/specification/api-contracts.md +28 -8
- package/pipeline/specification/database-schema.md +29 -8
- package/pipeline/specification/review-api.md +32 -11
- package/pipeline/specification/review-database.md +32 -11
- package/pipeline/specification/review-ux.md +34 -12
- package/pipeline/specification/ux-spec.md +35 -13
- package/pipeline/validation/critical-path-walkthrough.md +45 -11
- package/pipeline/validation/cross-phase-consistency.md +45 -11
- package/pipeline/validation/decision-completeness.md +45 -11
- package/pipeline/validation/dependency-graph-validation.md +46 -11
- package/pipeline/validation/implementability-dry-run.md +46 -11
- package/pipeline/validation/scope-creep-check.md +46 -11
- package/pipeline/validation/traceability-matrix.md +51 -11
- package/pipeline/vision/create-vision.md +267 -0
- package/pipeline/vision/innovate-vision.md +157 -0
- package/pipeline/vision/review-vision.md +149 -0
- package/skills/multi-model-dispatch/SKILL.md +326 -0
- package/skills/scaffold-pipeline/SKILL.md +210 -0
- package/skills/scaffold-runner/SKILL.md +619 -0
- package/pipeline/planning/implementation-tasks.md +0 -57
- package/pipeline/planning/review-tasks.md +0 -38
- package/pipeline/quality/testing-strategy.md +0 -42
|
@@ -4,6 +4,8 @@ description: Writing effective architecture decision records including technolog
|
|
|
4
4
|
topics: [adr, architecture-decisions, tech-stack, decision-documentation, technology-selection]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
7
9
|
## What Warrants an ADR
|
|
8
10
|
|
|
9
11
|
An Architecture Decision Record captures a decision that is architecturally significant — one that affects the system's structure, non-functional characteristics, dependencies, interfaces, or construction techniques. Not every decision needs an ADR. The litmus test: would a new team member need to know why this choice was made to work effectively?
|
|
@@ -61,6 +63,8 @@ Each technology choice should compare the top 2-3 realistic options, state the s
|
|
|
61
63
|
- Temporary decisions (experiment with X for a spike) — not architectural
|
|
62
64
|
- Decisions that have no realistic alternatives — if there's only one viable option, just use it
|
|
63
65
|
|
|
66
|
+
## Deep Guidance
|
|
67
|
+
|
|
64
68
|
## ADR Structure
|
|
65
69
|
|
|
66
70
|
### Title
|
|
@@ -251,6 +255,55 @@ Technology decisions often cluster. Rather than 20 individual ADRs for each pack
|
|
|
251
255
|
|
|
252
256
|
Each group ADR can cover multiple decisions if they are tightly coupled and were evaluated together.
|
|
253
257
|
|
|
258
|
+
## Example ADR
|
|
259
|
+
|
|
260
|
+
The following shows a complete ADR following the structure and quality guidelines above:
|
|
261
|
+
|
|
262
|
+
```markdown
|
|
263
|
+
# ADR-003: Use PostgreSQL for Persistent Storage
|
|
264
|
+
|
|
265
|
+
## Status
|
|
266
|
+
Accepted
|
|
267
|
+
|
|
268
|
+
## Context
|
|
269
|
+
The application (per PRD Section 2) manages financial transaction data with strict
|
|
270
|
+
consistency requirements, flexible metadata per transaction type, and projected volume
|
|
271
|
+
of 500K transactions/month within the first year. The team has strong SQL experience
|
|
272
|
+
and the project is AI-built, favoring well-documented technologies.
|
|
273
|
+
|
|
274
|
+
## Decision
|
|
275
|
+
We will use PostgreSQL 16 for all persistent storage in this application.
|
|
276
|
+
|
|
277
|
+
## Alternatives Considered
|
|
278
|
+
|
|
279
|
+
### SQLite
|
|
280
|
+
- **Why considered:** Zero operational overhead, embedded, excellent for small-to-medium
|
|
281
|
+
read-heavy workloads.
|
|
282
|
+
- **Why rejected:** Single-writer limitation is incompatible with concurrent transaction
|
|
283
|
+
processing. No built-in network access for multi-instance deployment.
|
|
284
|
+
|
|
285
|
+
### MongoDB
|
|
286
|
+
- **Why considered:** Flexible schema matches variable transaction metadata. Strong
|
|
287
|
+
horizontal scaling story.
|
|
288
|
+
- **Why rejected:** Weaker ACID guarantees for multi-document transactions. Team has
|
|
289
|
+
limited MongoDB experience. Less well-represented in AI training data than PostgreSQL,
|
|
290
|
+
increasing hallucination risk for query patterns.
|
|
291
|
+
|
|
292
|
+
## Consequences
|
|
293
|
+
|
|
294
|
+
### Benefits
|
|
295
|
+
- JSONB columns provide flexible metadata storage without sacrificing relational integrity
|
|
296
|
+
- Strong ACID compliance for financial transaction consistency
|
|
297
|
+
- Most widely adopted open-source RDBMS — extensive AI training data coverage
|
|
298
|
+
- Rich ecosystem: pg_stat_statements for monitoring, pg_dump for backups, mature ORMs
|
|
299
|
+
|
|
300
|
+
### Costs and Risks
|
|
301
|
+
- Operational overhead: requires backup configuration, connection pooling, and monitoring
|
|
302
|
+
- JSONB queries are less performant than MongoDB's native document queries for deeply
|
|
303
|
+
nested structures
|
|
304
|
+
- Schema migrations require planning for zero-downtime deployments
|
|
305
|
+
```
|
|
306
|
+
|
|
254
307
|
## Common Pitfalls
|
|
255
308
|
|
|
256
309
|
**Recording decisions without alternatives.** An ADR that says "We'll use React" without mentioning Vue or Svelte provides no insight into the decision process. When a new team member asks "why not Vue?", there's no answer. Fix: always document at least one alternative and why it was rejected.
|
|
@@ -279,3 +332,7 @@ An ADR set is likely complete when:
|
|
|
279
332
|
- **The ADR set covers all layers.** Backend, frontend (if applicable), database, infrastructure, developer tooling, deployment, testing, and security all have decisions recorded.
|
|
280
333
|
- **Status is current.** No accepted ADRs that actually describe how things used to work. Superseded and deprecated ADRs are marked.
|
|
281
334
|
- **Cross-references are complete.** Related ADRs link to each other. ADRs link to the requirements they address.
|
|
335
|
+
|
|
336
|
+
## See Also
|
|
337
|
+
|
|
338
|
+
- [tech-stack-selection](../core/tech-stack-selection.md) — Technology selection as ADRs
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-memory-management
|
|
3
|
+
description: AI memory and context management patterns for Claude Code projects including modular rules, MCP memory servers, lifecycle hooks, decision logging, and external context integration
|
|
4
|
+
topics: [ai-memory, claude-code, claude-rules, mcp-servers, lifecycle-hooks, context-management, session-handoff, decision-logging, mcp-knowledge-graph, context7]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI Memory Management
|
|
8
|
+
|
|
9
|
+
AI coding agents forget everything between sessions. Memory management is the practice of making that forgetting graceful — ensuring the right context is available at the right time without drowning the agent in irrelevant information. This knowledge covers the full spectrum from lightweight rule files to persistent memory servers.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
### The Memory Hierarchy
|
|
14
|
+
|
|
15
|
+
AI memory operates in layers, each with different persistence and token cost:
|
|
16
|
+
|
|
17
|
+
| Layer | Persistence | Token Cost | Examples |
|
|
18
|
+
|-------|------------|------------|----------|
|
|
19
|
+
| **Context window** | Current session only | High (1:1) | Files read, conversation history |
|
|
20
|
+
| **CLAUDE.md / rules** | Permanent (git-tracked) | Medium (loaded at start) | Conventions, commands, workflow |
|
|
21
|
+
| **Auto-memory** | Cross-session (local) | Low (loaded on demand) | User preferences, project patterns |
|
|
22
|
+
| **MCP memory server** | Cross-session (structured) | Low (queried on demand) | Decisions, lessons, error patterns |
|
|
23
|
+
| **External docs** | Always current | Zero until queried | Library APIs, framework docs |
|
|
24
|
+
|
|
25
|
+
### Core Principle: Signal Over Volume
|
|
26
|
+
|
|
27
|
+
ETH Zurich research (2026) found that dumping context into AI sessions hurts more than it helps — 3% performance decrease with 20% cost increase for LLM-generated context files. The key insight: **only store what cannot be derived from the code itself.** Custom build commands, project-specific conventions, decision rationale, and team agreements are high-signal. Code patterns, file structure, and API shapes are low-signal (the agent can read the code).
|
|
28
|
+
|
|
29
|
+
### The Three-Tier Memory Stack
|
|
30
|
+
|
|
31
|
+
**Tier 1 — Modular Rules** (`.claude/rules/`): Path-scoped convention files loaded automatically based on what files the agent is working with. Zero manual effort after setup. Keeps CLAUDE.md lean.
|
|
32
|
+
|
|
33
|
+
**Tier 2 — Persistent Memory** (MCP server + hooks): Structured cross-session memory that captures decisions, lessons, and error patterns automatically via lifecycle hooks. Survives session boundaries.
|
|
34
|
+
|
|
35
|
+
**Tier 3 — External Context** (library doc servers): Version-specific documentation for project dependencies, queried on demand. Prevents API hallucination.
|
|
36
|
+
|
|
37
|
+
## Deep Guidance
|
|
38
|
+
|
|
39
|
+
### Tier 1: Modular Rules
|
|
40
|
+
|
|
41
|
+
#### `.claude/rules/` Architecture
|
|
42
|
+
|
|
43
|
+
Claude Code loads rule files from `.claude/rules/` based on path-scoping defined in YAML frontmatter. This replaces the pattern of stuffing everything into CLAUDE.md.
|
|
44
|
+
|
|
45
|
+
**File structure:**
|
|
46
|
+
```
|
|
47
|
+
.claude/
|
|
48
|
+
rules/
|
|
49
|
+
code-style.md # Always active — naming, formatting, imports
|
|
50
|
+
testing.md # Active when working in test files
|
|
51
|
+
api-endpoints.md # Active when working in API route files
|
|
52
|
+
database.md # Active when working with schema/migration files
|
|
53
|
+
frontend.md # Active when working in UI component files
|
|
54
|
+
memory-hygiene.md # Always active — what to save/not save in memory
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Rule file format:**
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
description: TypeScript naming and import conventions
|
|
61
|
+
globs: ["src/**/*.ts", "src/**/*.tsx"]
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
- Use camelCase for variables/functions, PascalCase for types/classes
|
|
65
|
+
- Import order: external packages, then internal modules, then relative imports
|
|
66
|
+
- Prefer named exports over default exports
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Key principles:**
|
|
70
|
+
- Each rule file targets a specific concern and file pattern
|
|
71
|
+
- Rules activate only when the agent works on matching files — no wasted tokens
|
|
72
|
+
- Total rule content across all files should stay under 500 lines
|
|
73
|
+
- Rules state what to do differently from defaults — don't restate obvious conventions
|
|
74
|
+
- Extract rules from existing docs (coding-standards.md, tech-stack.md, git-workflow.md) rather than writing from scratch
|
|
75
|
+
|
|
76
|
+
#### CLAUDE.md Optimization
|
|
77
|
+
|
|
78
|
+
After creating rules, CLAUDE.md should use the pointer pattern:
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## Coding Conventions
|
|
82
|
+
See `docs/coding-standards.md` for full reference. Key rules in `.claude/rules/code-style.md`.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This replaces inline convention blocks, keeping CLAUDE.md under 200 lines (the empirically-validated adherence threshold).
|
|
86
|
+
|
|
87
|
+
### Tier 2: Persistent Memory
|
|
88
|
+
|
|
89
|
+
#### MCP Memory Servers
|
|
90
|
+
|
|
91
|
+
**Recommended: MCP Knowledge Graph** (`@modelcontextprotocol/server-memory`)
|
|
92
|
+
- Official MCP server from the Model Context Protocol project
|
|
93
|
+
- Stores entities, relations, and observations in a local JSON file
|
|
94
|
+
- Zero setup: `npx -y @modelcontextprotocol/server-memory`
|
|
95
|
+
- Entities persist across sessions — decisions, patterns, project facts
|
|
96
|
+
- Best for: All projects (stable, official, zero dependencies beyond Node)
|
|
97
|
+
|
|
98
|
+
**Alternative: Custom MCP server**
|
|
99
|
+
- If the user has a preferred MCP memory server already installed, use it
|
|
100
|
+
- The key requirement is that it exposes MCP tools for storing and retrieving structured memory
|
|
101
|
+
- Examples from the ecosystem: Engram (if installed), hmem (if installed), ContextVault
|
|
102
|
+
|
|
103
|
+
**Configuration pattern** (`.claude/settings.json`):
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"memory": {
|
|
108
|
+
"command": "npx",
|
|
109
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
110
|
+
"env": {
|
|
111
|
+
"MEMORY_FILE_PATH": ".claude/memory-graph.json"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Lifecycle Hooks
|
|
119
|
+
|
|
120
|
+
Hooks automate memory capture at key session events:
|
|
121
|
+
|
|
122
|
+
**PreCompact** (highest value) — Triggers before context compression. Logs when compaction occurs for debugging context loss.
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"hooks": {
|
|
127
|
+
"PreCompact": [{
|
|
128
|
+
"type": "command",
|
|
129
|
+
"command": "echo \"$(date '+%Y-%m-%d %H:%M:%S') — Context compacting\" >> .claude/compaction-log.txt",
|
|
130
|
+
"timeout": 5000
|
|
131
|
+
}]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
File-logging for compaction events:
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"hooks": {
|
|
140
|
+
"PreCompact": [{
|
|
141
|
+
"type": "command",
|
|
142
|
+
"command": "date '+%Y-%m-%d %H:%M' >> .claude/compaction-log.txt && echo 'Context compacted' >> .claude/compaction-log.txt",
|
|
143
|
+
"timeout": 5000
|
|
144
|
+
}]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Stop** — Triggers when a session ends. Good for capturing session-level summaries.
|
|
150
|
+
|
|
151
|
+
**PreToolUse** — Triggers before tool calls. Can log decisions about file modifications. Use sparingly — high frequency means high overhead.
|
|
152
|
+
|
|
153
|
+
**Hook selection guidance:**
|
|
154
|
+
- Start with PreCompact only — it captures the most value with least noise
|
|
155
|
+
- Hook commands must produce a side effect (write to MCP server, append to file) — echoing to `/dev/null` provides zero value
|
|
156
|
+
- Add Stop if sessions frequently end with unrecorded decisions
|
|
157
|
+
- Avoid PreToolUse unless you have a specific logging need — it fires constantly
|
|
158
|
+
|
|
159
|
+
#### Decision Logging
|
|
160
|
+
|
|
161
|
+
Decisions are the highest-value memory type because they cannot be derived from code. A decision log captures what was chosen, what was rejected, and why.
|
|
162
|
+
|
|
163
|
+
**Structure:**
|
|
164
|
+
```
|
|
165
|
+
docs/decisions/
|
|
166
|
+
DECISIONS.md # Index of all decisions
|
|
167
|
+
001-auth-strategy.md # Individual decision records
|
|
168
|
+
002-database-choice.md
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Decision entry format:**
|
|
172
|
+
```markdown
|
|
173
|
+
## DEC-001: JWT over session cookies for auth
|
|
174
|
+
|
|
175
|
+
**Date:** 2026-03-27
|
|
176
|
+
**Context:** Need stateless auth for API-first architecture
|
|
177
|
+
**Decision:** Use JWT with short-lived access tokens + refresh tokens
|
|
178
|
+
**Rejected:** Session cookies (requires sticky sessions), OAuth-only (too complex for MVP)
|
|
179
|
+
**Consequences:** Need token refresh logic in frontend, need secure token storage
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This complements ADRs (which cover architecture-level decisions) by capturing day-to-day implementation decisions that would otherwise be lost between sessions.
|
|
183
|
+
|
|
184
|
+
#### Session Handoff Patterns
|
|
185
|
+
|
|
186
|
+
When context hits limits, structured handoff preserves continuity:
|
|
187
|
+
|
|
188
|
+
1. **Before compaction**: Save current task state, open questions, and recent decisions
|
|
189
|
+
2. **After compaction**: Claude Code auto-reloads CLAUDE.md and auto-memory, but loses working context
|
|
190
|
+
3. **Recovery**: Agent reads decision log and memory server to reconstruct working state
|
|
191
|
+
|
|
192
|
+
The `/compact` command is the natural handoff point. A PreCompact hook that saves session state ensures nothing critical is lost.
|
|
193
|
+
|
|
194
|
+
### Tier 3: External Context
|
|
195
|
+
|
|
196
|
+
#### Library Documentation Servers
|
|
197
|
+
|
|
198
|
+
AI agents hallucinate APIs — they generate plausible but incorrect function signatures, especially for rapidly-evolving libraries. External doc servers solve this by providing current, version-specific documentation on demand.
|
|
199
|
+
|
|
200
|
+
**Context7** (by Upstash) — Most popular, fetches current library docs via MCP
|
|
201
|
+
- Covers major frameworks (React, Next.js, Vue, Angular, etc.)
|
|
202
|
+
- Free tier: 1,000 requests/month
|
|
203
|
+
- Caution: had a security vulnerability (patched) — review before enabling
|
|
204
|
+
|
|
205
|
+
**Nia** (by Nozomio) — Indexes codebases + 3,000+ pre-indexed packages
|
|
206
|
+
- Cross-session context persistence
|
|
207
|
+
- Deep research agent for complex questions
|
|
208
|
+
- Y Combinator backed, more comprehensive than Context7
|
|
209
|
+
|
|
210
|
+
**Docfork** — 9,000+ libraries, MIT license
|
|
211
|
+
- "Cabinets" for project-specific documentation isolation
|
|
212
|
+
- Self-hostable
|
|
213
|
+
|
|
214
|
+
**Configuration pattern:**
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"mcpServers": {
|
|
218
|
+
"context7": {
|
|
219
|
+
"command": "npx",
|
|
220
|
+
"args": ["-y", "@upstash/context7-mcp@latest"]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**When to enable:** Projects with 3+ external dependencies, especially rapidly-evolving frameworks (React, Next.js, Svelte). Skip for standard library-only projects or well-established stable APIs.
|
|
227
|
+
|
|
228
|
+
### Anti-Patterns
|
|
229
|
+
|
|
230
|
+
| Anti-Pattern | Why It Fails | Instead |
|
|
231
|
+
|-------------|-------------|---------|
|
|
232
|
+
| Dumping entire codebase into context | Drowns signal in noise, costs tokens | Let the agent read files on demand |
|
|
233
|
+
| Storing code patterns in memory | Duplicates what's in the code; goes stale | Store decisions and rationale only |
|
|
234
|
+
| Huge CLAUDE.md (500+ lines) | Adherence drops sharply above 200 lines | Use .claude/rules/ for specifics |
|
|
235
|
+
| Memory without structure | Unstructured notes become unsearchable noise | Use categories (decision, lesson, error) |
|
|
236
|
+
| Capturing everything | Token cost with diminishing returns | Capture what can't be derived from code |
|
|
237
|
+
| Multiple overlapping memory tools | Conflicting context, duplicated entries | Pick one MCP server, use it consistently |
|
|
238
|
+
|
|
239
|
+
### Integration with Beads
|
|
240
|
+
|
|
241
|
+
When Beads is configured, memory complements task tracking:
|
|
242
|
+
- **Beads** tracks what work to do (tasks, dependencies, status)
|
|
243
|
+
- **Memory** tracks how to do work better (patterns, decisions, lessons)
|
|
244
|
+
- Decision log entries can reference Beads task IDs for traceability
|
|
245
|
+
- `tasks/lessons.md` remains the cross-session learning file; MCP memory adds structured queryability
|
|
246
|
+
- Don't duplicate: if a pattern is in `tasks/lessons.md`, don't also store it in the MCP server
|
|
@@ -4,6 +4,8 @@ description: API design principles for REST, GraphQL, and inter-service communic
|
|
|
4
4
|
topics: [api, rest, graphql, endpoints, contracts, versioning, error-handling, authentication]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
7
9
|
## API-First Development
|
|
8
10
|
|
|
9
11
|
Design the API contract before writing implementation code. The contract defines what the API does; the implementation fulfills that contract. This order matters because:
|
|
@@ -81,6 +83,8 @@ POST /api/v1/order-submissions # Create an "order submission" resource
|
|
|
81
83
|
POST /api/v1/password-resets # Create a "password reset" resource
|
|
82
84
|
```
|
|
83
85
|
|
|
86
|
+
## Deep Guidance
|
|
87
|
+
|
|
84
88
|
### HTTP Methods
|
|
85
89
|
|
|
86
90
|
| Method | Semantics | Idempotent | Safe |
|
|
@@ -499,3 +503,7 @@ Design APIs so that transient failures can be safely retried:
|
|
|
499
503
|
**Missing rate limiting.** No protection against abusive or buggy clients sending excessive requests. Fix: implement rate limiting on all public endpoints. Return 429 with `Retry-After` header.
|
|
500
504
|
|
|
501
505
|
**Ignoring CORS.** Frontend can't call the API because CORS headers are missing. Fix: configure CORS at API design time. Be specific about allowed origins — don't use `*` in production.
|
|
506
|
+
|
|
507
|
+
## See Also
|
|
508
|
+
|
|
509
|
+
- [testing-strategy](../core/testing-strategy.md) — Contract testing and API test patterns
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: automated-review-tooling
|
|
3
|
+
description: Patterns for setting up automated PR code review using AI models (Codex, Gemini) via local CLI, including dual-model review, reconciliation, and CI integration
|
|
4
|
+
topics: [code-review, automation, codex, gemini, pull-requests, ci-cd, review-tooling]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Automated Review Tooling
|
|
8
|
+
|
|
9
|
+
Automated PR review leverages AI models to provide consistent, thorough code review without manual reviewer bottlenecks. This knowledge covers the local CLI approach (no GitHub Actions), dual-model review patterns, and integration with the PR workflow.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
### Architecture: Local CLI Review
|
|
14
|
+
|
|
15
|
+
The scaffold approach uses local CLI review rather than GitHub Actions:
|
|
16
|
+
- **No CI secrets required** — models run locally via CLI tools
|
|
17
|
+
- **Dual-model review** — run Codex and Gemini (when available) for independent perspectives
|
|
18
|
+
- **Agent-managed loop** — Claude orchestrates the review-fix cycle locally
|
|
19
|
+
|
|
20
|
+
Components:
|
|
21
|
+
- `AGENTS.md` — reviewer instructions with project-specific rules
|
|
22
|
+
- `docs/review-standards.md` — severity definitions (P0-P3) and criteria
|
|
23
|
+
- `scripts/cli-pr-review.sh` — dual-model review script
|
|
24
|
+
- `scripts/await-pr-review.sh` — polling script for external bot mode
|
|
25
|
+
|
|
26
|
+
### Review Severity Levels
|
|
27
|
+
|
|
28
|
+
Consistent with the pipeline's review step severity:
|
|
29
|
+
- **P0 (blocking)** — must fix before merge (security, data loss, broken functionality)
|
|
30
|
+
- **P1 (important)** — should fix before merge (bugs, missing tests, performance)
|
|
31
|
+
- **P2 (suggestion)** — consider fixing (style, naming, documentation)
|
|
32
|
+
- **P3 (nit)** — optional (personal preference, minor optimization)
|
|
33
|
+
|
|
34
|
+
### Dual-Model Review Pattern
|
|
35
|
+
|
|
36
|
+
When both Codex CLI and Gemini CLI are available:
|
|
37
|
+
1. Run both reviewers independently on the PR diff
|
|
38
|
+
2. Collect findings from each
|
|
39
|
+
3. Reconcile: consensus findings get higher confidence
|
|
40
|
+
4. Disagreements are flagged for the implementing agent to resolve
|
|
41
|
+
|
|
42
|
+
### Integration with PR Workflow
|
|
43
|
+
|
|
44
|
+
The review step integrates into the standard PR flow:
|
|
45
|
+
1. Agent creates PR
|
|
46
|
+
2. Agent runs `scripts/cli-pr-review.sh` (or review runs automatically)
|
|
47
|
+
3. Review findings are posted as PR comments or written to a local file
|
|
48
|
+
4. Agent addresses P0/P1 findings, pushes fixes
|
|
49
|
+
5. Re-review until no P0/P1 findings remain
|
|
50
|
+
6. PR is ready for merge
|
|
51
|
+
|
|
52
|
+
## Deep Guidance
|
|
53
|
+
|
|
54
|
+
### AGENTS.md Structure
|
|
55
|
+
|
|
56
|
+
The `AGENTS.md` file provides reviewer instructions:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
# Code Review Instructions
|
|
60
|
+
|
|
61
|
+
## Project Context
|
|
62
|
+
[Brief description of what this project does]
|
|
63
|
+
|
|
64
|
+
## Review Focus Areas
|
|
65
|
+
- Security: [project-specific security concerns]
|
|
66
|
+
- Performance: [known hot paths or constraints]
|
|
67
|
+
- Testing: [coverage requirements, test patterns]
|
|
68
|
+
|
|
69
|
+
## Coding Standards Reference
|
|
70
|
+
See docs/coding-standards.md for:
|
|
71
|
+
- Naming conventions
|
|
72
|
+
- Error handling patterns
|
|
73
|
+
- Logging standards
|
|
74
|
+
|
|
75
|
+
## Known Patterns
|
|
76
|
+
[Project-specific patterns reviewers should enforce]
|
|
77
|
+
|
|
78
|
+
## Out of Scope
|
|
79
|
+
[Things reviewers should NOT flag]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### CLI Review Script Pattern
|
|
83
|
+
|
|
84
|
+
The `cli-pr-review.sh` script follows this structure:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
#!/usr/bin/env bash
|
|
88
|
+
set -euo pipefail
|
|
89
|
+
|
|
90
|
+
# 1. Get the PR diff
|
|
91
|
+
diff=$(gh pr diff "$PR_NUMBER")
|
|
92
|
+
|
|
93
|
+
# 2. Run Codex review (if available)
|
|
94
|
+
if command -v codex &>/dev/null; then
|
|
95
|
+
codex_findings=$(echo "$diff" | codex review --context AGENTS.md)
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# 3. Run Gemini review (if available)
|
|
99
|
+
if command -v gemini &>/dev/null; then
|
|
100
|
+
gemini_findings=$(echo "$diff" | gemini review --context AGENTS.md)
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# 4. Reconcile findings
|
|
104
|
+
# - Findings from both models: HIGH confidence
|
|
105
|
+
# - Findings from one model: MEDIUM confidence
|
|
106
|
+
# - Contradictions: flagged for human review
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Review Standards Document
|
|
110
|
+
|
|
111
|
+
`docs/review-standards.md` should define:
|
|
112
|
+
- Severity levels with concrete examples per project
|
|
113
|
+
- What constitutes a blocking review (P0/P1 threshold)
|
|
114
|
+
- Auto-approve criteria (when review can be skipped)
|
|
115
|
+
- Review SLA (how long before auto-approve kicks in)
|
|
116
|
+
|
|
117
|
+
### Fallback When Models Unavailable
|
|
118
|
+
|
|
119
|
+
If neither Codex nor Gemini CLI is available:
|
|
120
|
+
1. Claude performs an enhanced self-review of the diff
|
|
121
|
+
2. Focus on the AGENTS.md review criteria
|
|
122
|
+
3. Apply the same severity classification
|
|
123
|
+
4. Document that the review was single-model
|
|
124
|
+
|
|
125
|
+
### Updating Review Standards Over Time
|
|
126
|
+
|
|
127
|
+
As the project evolves:
|
|
128
|
+
- Add new review focus areas when new patterns emerge
|
|
129
|
+
- Remove rules that linters now enforce automatically
|
|
130
|
+
- Update AGENTS.md when architecture changes
|
|
131
|
+
- Track false-positive rates and adjust thresholds
|
|
132
|
+
|
|
133
|
+
### Review Finding Reconciliation
|
|
134
|
+
|
|
135
|
+
When running dual-model review, reconcile findings systematically:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Finding Classification:
|
|
139
|
+
┌─────────────────┬──────────┬──────────┬───────────────────┐
|
|
140
|
+
│ │ Codex │ Gemini │ Action │
|
|
141
|
+
├─────────────────┼──────────┼──────────┼───────────────────┤
|
|
142
|
+
│ Same issue │ Found │ Found │ HIGH confidence │
|
|
143
|
+
│ Unique finding │ Found │ - │ MEDIUM confidence │
|
|
144
|
+
│ Unique finding │ - │ Found │ MEDIUM confidence │
|
|
145
|
+
│ Contradiction │ Fix X │ Keep X │ Flag for agent │
|
|
146
|
+
└─────────────────┴──────────┴──────────┴───────────────────┘
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
HIGH confidence findings are always addressed. MEDIUM confidence findings are addressed if P0/P1. Contradictions require the implementing agent to make a judgment call and document the reasoning.
|
|
150
|
+
|
|
151
|
+
### Security-Focused Review Checklist
|
|
152
|
+
|
|
153
|
+
Every automated review should check:
|
|
154
|
+
- No secrets or credentials in the diff (API keys, passwords, tokens)
|
|
155
|
+
- No `eval()` or equivalent unsafe operations introduced
|
|
156
|
+
- SQL queries use parameterized queries (no string concatenation)
|
|
157
|
+
- User input is validated before use
|
|
158
|
+
- Authentication/authorization checks are present on new endpoints
|
|
159
|
+
- Dependencies added are from trusted sources with known versions
|
|
160
|
+
|
|
161
|
+
### Performance Review Patterns
|
|
162
|
+
|
|
163
|
+
Look for these performance anti-patterns:
|
|
164
|
+
- N+1 queries (loop with individual DB calls)
|
|
165
|
+
- Missing pagination on list endpoints
|
|
166
|
+
- Synchronous operations that should be async
|
|
167
|
+
- Large objects passed by value instead of reference
|
|
168
|
+
- Missing caching for expensive computations
|
|
169
|
+
- Unbounded growth in arrays or maps
|
|
170
|
+
|
|
171
|
+
### Integration with CLAUDE.md
|
|
172
|
+
|
|
173
|
+
The workflow-audit step should add review commands to CLAUDE.md:
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
## Code Review
|
|
177
|
+
| Command | Purpose |
|
|
178
|
+
|---------|---------|
|
|
179
|
+
| `scripts/cli-pr-review.sh <PR#>` | Run dual-model review |
|
|
180
|
+
| `scripts/await-pr-review.sh <PR#>` | Poll for external review |
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This ensures agents always know how to trigger reviews without consulting separate docs.
|
|
184
|
+
|
|
185
|
+
### Common False Positives
|
|
186
|
+
|
|
187
|
+
Track and suppress recurring false positives:
|
|
188
|
+
- Test files flagged for "hardcoded values" (test fixtures are intentional)
|
|
189
|
+
- Migration files flagged for "raw SQL" (migrations must use raw SQL)
|
|
190
|
+
- Generated files flagged for style issues (generated code has its own conventions)
|
|
191
|
+
|
|
192
|
+
Add suppressions to AGENTS.md under "Out of Scope" to prevent repeated false findings.
|
|
193
|
+
|
|
194
|
+
### Review Metrics and Continuous Improvement
|
|
195
|
+
|
|
196
|
+
Track these metrics over time to improve review quality:
|
|
197
|
+
- **False positive rate** — findings that are dismissed without action
|
|
198
|
+
- **Escape rate** — bugs that reach production despite review
|
|
199
|
+
- **Time to resolve** — average time between finding and fix
|
|
200
|
+
- **Coverage** — percentage of PRs that receive automated review
|
|
201
|
+
- **Model agreement rate** — how often Codex and Gemini agree
|
|
202
|
+
|
|
203
|
+
Use these metrics to calibrate severity thresholds and update AGENTS.md focus areas.
|