opencode-agent-orchestration-kit 1.0.27
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/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +65 -0
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/.github/ISSUE_TEMPLATE/documentation.yml +22 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +25 -0
- package/.github/workflows/check.yml +47 -0
- package/CODE_OF_CONDUCT.md +24 -0
- package/CONTRIBUTING.md +52 -0
- package/LICENSE +201 -0
- package/NOTICE.md +23 -0
- package/README.md +806 -0
- package/SECURITY.md +17 -0
- package/docker/open-design/.env.example +6 -0
- package/docker/open-design/Dockerfile +50 -0
- package/docker/open-design/docker-compose.yml +18 -0
- package/docker/open-design/opencode-od/agents/od-worker.md +22 -0
- package/docker/open-design/opencode-od/opencode.json +24 -0
- package/docs/agents.md +21 -0
- package/docs/commands.md +16 -0
- package/docs/configuration.md +30 -0
- package/docs/docker-open-design.md +42 -0
- package/docs/impeccable.md +18 -0
- package/docs/installation.md +176 -0
- package/docs/models.md +17 -0
- package/docs/open-design.md +25 -0
- package/docs/quickstart.md +74 -0
- package/docs/releases/v1.0.10.md +46 -0
- package/docs/releases/v1.0.14.md +39 -0
- package/docs/releases/v1.0.27.md +66 -0
- package/docs/security.md +8 -0
- package/docs/superpowers/plans/2026-07-20-safe-installation-lifecycle.md +779 -0
- package/docs/superpowers/plans/2026-07-20-version-identity-and-releases.md +590 -0
- package/docs/superpowers/specs/2026-07-20-safe-installation-lifecycle-design.md +1350 -0
- package/docs/superpowers/specs/2026-07-20-version-identity-and-releases-design.md +557 -0
- package/docs/superpowers.md +34 -0
- package/docs/synology.md +30 -0
- package/docs/troubleshooting.md +54 -0
- package/docs/workflows.md +44 -0
- package/doctor.sh +5 -0
- package/env.example +15 -0
- package/install.sh +5 -0
- package/opencode/AGENTS.md +104 -0
- package/opencode/agents/debugger.md +41 -0
- package/opencode/agents/designer.md +93 -0
- package/opencode/agents/developer.md +180 -0
- package/opencode/agents/evaluator.md +35 -0
- package/opencode/agents/evolver.md +31 -0
- package/opencode/agents/lead.md +251 -0
- package/opencode/agents/researcher.md +76 -0
- package/opencode/agents/review_api.md +34 -0
- package/opencode/agents/review_coordinator.md +111 -0
- package/opencode/agents/review_quality.md +35 -0
- package/opencode/agents/review_security.md +35 -0
- package/opencode/agents/review_tests.md +37 -0
- package/opencode/agents/reviewer.md +116 -0
- package/opencode/agents/scoper.md +75 -0
- package/opencode/agents/specifier.md +116 -0
- package/opencode/commands/code-simplify.md +36 -0
- package/opencode/commands/design.md +27 -0
- package/opencode/commands/evolve.md +165 -0
- package/opencode/commands/feature.md +67 -0
- package/opencode/commands/implement.md +11 -0
- package/opencode/commands/init.md +34 -0
- package/opencode/commands/loop.md +145 -0
- package/opencode/commands/mvp-spec.md +20 -0
- package/opencode/commands/plan.md +74 -0
- package/opencode/commands/research.md +12 -0
- package/opencode/commands/review-orchestrated.md +47 -0
- package/opencode/commands/review-preflight.md +26 -0
- package/opencode/commands/review.md +18 -0
- package/opencode/commands/scope.md +36 -0
- package/opencode/commands/spec.md +12 -0
- package/opencode/commands/test.md +40 -0
- package/opencode/docs/ai/evolution/README.md +135 -0
- package/opencode/docs/ai/evolution/benchmarks/manual-scenarios.md +123 -0
- package/opencode/docs/ai/evolution/benchmarks/router-scenarios.jsonl +8 -0
- package/opencode/docs/ai/evolution/evolution_history.md +83 -0
- package/opencode/docs/ai/evolution/mechanisms.jsonl +7 -0
- package/opencode/docs/ai/evolution/rejected_mechanisms.jsonl +2 -0
- package/opencode/docs/ai/evolution/runs/README.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/analysis/overview.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_evaluation.json +108 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_manifest.json +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/evaluation.md +19 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/post_evaluation.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/analysis/overview.md +7 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/evaluation.md +19 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_evaluation.json +66 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_manifest.json +82 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/evaluation.md +20 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/ahe-run-lifecycle-validator.md +40 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/evolve-evaluation-only-contract.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/open-design-tool-contract.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/slash-command-contract-coverage.md +40 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/overview.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/pre_apply_approval.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_evaluation.json +252 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_manifest.json +210 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/evaluation.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_apply_evaluation.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_manifest_evaluation.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/pre_apply_evaluation.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_manifest.json +30 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/evaluation.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_manifest.json +29 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/evaluation.md +18 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_manifest.json +34 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_evaluation.json +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_manifest.json +28 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/analysis/overview.md +9 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/evaluation.md +18 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/analysis/overview.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/analysis/overview.md +10 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_manifest.json +30 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/analysis/overview.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_evaluation.json +28 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/evaluation.md +22 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/analysis/overview.md +27 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_evaluation.json +32 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_manifest.json +49 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/evaluation.md +92 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/detail/token-vs-semantic.md +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/overview.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/evaluation.md +36 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_manifest.json +47 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/evaluation.md +27 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/analysis/overview.md +32 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_manifest.json +35 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/evaluation.md +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-1-feature-sidecar-false-positive.md +51 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-2-checker-time-budget.md +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/overview.md +99 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_evaluation.json +61 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_manifest.json +61 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/evaluation.md +448 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/detail/intake-gray-zone.md +65 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/overview.md +172 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/evaluation.md +226 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/detail/plan-only-gray-zone.md +62 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/overview.md +167 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/evaluation.md +163 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/analysis/overview.md +42 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_evaluation.json +46 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_manifest.json +57 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/evaluation.md +48 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/contract-vs-runtime-gap.md +163 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/evidence-collection-blocker.md +134 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/overview.md +111 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/change_evaluation.json +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/change_manifest.json +50 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/evaluation.md +46 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/manifest-justification.md +48 -0
- package/opencode/docs/ai/evolution/session-sources.md +91 -0
- package/opencode/docs/ai/harness/README.md +32 -0
- package/opencode/docs/ai/harness/agents.md +148 -0
- package/opencode/docs/ai/harness/checks.md +119 -0
- package/opencode/docs/ai/harness/commands.md +391 -0
- package/opencode/docs/ai/harness/evidence.md +85 -0
- package/opencode/docs/ai/harness/init-detection-rules.md +160 -0
- package/opencode/docs/ai/harness/orchestrated-review.md +131 -0
- package/opencode/docs/ai/harness/skill-metadata-schema.md +198 -0
- package/opencode/docs/ai/harness/skill-resolution.md +202 -0
- package/opencode/docs/ai/harness/skill_registry.json +443 -0
- package/opencode/docs/ai/harness/skill_registry.md +43 -0
- package/opencode/docs/ai/project-context-template.md +53 -0
- package/opencode/opencode.json +38 -0
- package/opencode/package-lock.json +1717 -0
- package/opencode/package.json +11 -0
- package/opencode/plugins/token-tree-usage.tsx +206 -0
- package/opencode/references/performance-checklist.md +153 -0
- package/opencode/references/security-checklist.md +134 -0
- package/opencode/references/testing-patterns.md +236 -0
- package/opencode/scripts/check-harness.mjs +1572 -0
- package/opencode/scripts/check-harness.test.mjs +820 -0
- package/opencode/scripts/collect-session-evidence.mjs +612 -0
- package/opencode/scripts/collect-session-evidence.test.mjs +443 -0
- package/opencode/scripts/preflight-audit.mjs +497 -0
- package/opencode/scripts/preflight-audit.test.mjs +363 -0
- package/opencode/scripts/project-capability-snapshot.mjs +407 -0
- package/opencode/scripts/project-capability-snapshot.test.mjs +382 -0
- package/opencode/scripts/review-orchestrated-prepare.mjs +547 -0
- package/opencode/scripts/review-orchestrated-prepare.test.mjs +516 -0
- package/opencode/scripts/skill-resolver.mjs +585 -0
- package/opencode/scripts/skill-resolver.test.mjs +781 -0
- package/opencode/scripts/update-skill-registry.mjs +380 -0
- package/opencode/skills/api-and-interface-design/SKILL.md +315 -0
- package/opencode/skills/autonomous-loops/SKILL.md +312 -0
- package/opencode/skills/code-review-and-quality/SKILL.md +365 -0
- package/opencode/skills/code-simplification/SKILL.md +345 -0
- package/opencode/skills/context-engineering/SKILL.md +252 -0
- package/opencode/skills/debugging-and-error-recovery/SKILL.md +316 -0
- package/opencode/skills/documentation-and-adrs/SKILL.md +298 -0
- package/opencode/skills/doubt-driven-development/SKILL.md +168 -0
- package/opencode/skills/iterative-retrieval/SKILL.md +232 -0
- package/opencode/skills/open-design/SKILL.md +123 -0
- package/opencode/skills/performance-optimization/SKILL.md +365 -0
- package/opencode/skills/security-and-hardening/SKILL.md +369 -0
- package/opencode/skills/source-driven-development/SKILL.md +210 -0
- package/opencode/skills/test-driven-development/SKILL.md +406 -0
- package/opencode/skills/using-agent-skills/SKILL.md +194 -0
- package/opencode/skills/verification-loop/SKILL.md +162 -0
- package/opencode/tools/open_design.ts +361 -0
- package/opencode/tui.json +5 -0
- package/package.json +20 -0
- package/rollback.sh +5 -0
- package/scripts/check.sh +184 -0
- package/scripts/install-smoke.sh +111 -0
- package/scripts/manage-installation.mjs +1498 -0
- package/scripts/manage-installation.test.mjs +1936 -0
- package/scripts/version.mjs +197 -0
- package/scripts/version.test.mjs +195 -0
- package/uninstall.sh +5 -0
- package/upgrade.sh +5 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autonomous-loops
|
|
3
|
+
description: Patterns and architectures for autonomous loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems. Use when setting up autonomous development workflows, choosing the right loop architecture, or building CI/CD-style continuous development pipelines.
|
|
4
|
+
phase: operate
|
|
5
|
+
domains:
|
|
6
|
+
- orchestration
|
|
7
|
+
- evolution
|
|
8
|
+
- release
|
|
9
|
+
stacks:
|
|
10
|
+
- any
|
|
11
|
+
- harness
|
|
12
|
+
allowed_agents:
|
|
13
|
+
- lead
|
|
14
|
+
- evolver
|
|
15
|
+
surfaces:
|
|
16
|
+
- autonomous-orchestration
|
|
17
|
+
- ci-cd-pipelines
|
|
18
|
+
- multi-agent-orchestration
|
|
19
|
+
skill_source: external
|
|
20
|
+
origin: affaan-m/ecc
|
|
21
|
+
status: active
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Autonomous Loops
|
|
25
|
+
|
|
26
|
+
Patterns, architectures, and reference implementations for running autonomous loops. Covers everything from simple sequential pipelines to full RFC-driven multi-agent DAG orchestration.
|
|
27
|
+
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
- Setting up autonomous development workflows that run without human intervention
|
|
31
|
+
- Choosing the right loop architecture for your problem (simple vs complex)
|
|
32
|
+
- Building CI/CD-style continuous development pipelines
|
|
33
|
+
- Running parallel agents with merge coordination
|
|
34
|
+
- Implementing context persistence across loop iterations
|
|
35
|
+
- Adding quality gates and cleanup passes to autonomous workflows
|
|
36
|
+
|
|
37
|
+
## Loop Pattern Spectrum
|
|
38
|
+
|
|
39
|
+
From simplest to most sophisticated:
|
|
40
|
+
|
|
41
|
+
| Pattern | Complexity | Best For |
|
|
42
|
+
|---------|-----------|----------|
|
|
43
|
+
| Sequential Pipeline | Low | Daily dev steps, scripted workflows |
|
|
44
|
+
| Infinite Agentic Loop | Medium | Parallel content generation, spec-driven work |
|
|
45
|
+
| Continuous PR Loop | Medium | Multi-day iterative projects with CI gates |
|
|
46
|
+
| De-Sloppify Pattern | Add-on | Quality cleanup after any implementer step |
|
|
47
|
+
| RFC-Driven DAG | High | Large features, multi-unit parallel work with merge queue |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 1. Sequential Pipeline
|
|
52
|
+
|
|
53
|
+
**The simplest loop.** Break daily development into a sequence of non-interactive calls. Each call is a focused step with a clear prompt.
|
|
54
|
+
|
|
55
|
+
### Core Insight
|
|
56
|
+
|
|
57
|
+
> If you can't figure out a loop like this, it means you can't even drive the LLM to fix your code in interactive mode.
|
|
58
|
+
|
|
59
|
+
Chain calls to build a pipeline:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
#!/bin/bash
|
|
63
|
+
# daily-dev.sh — Sequential pipeline for a feature branch
|
|
64
|
+
|
|
65
|
+
set -e
|
|
66
|
+
|
|
67
|
+
# Step 1: Implement the feature
|
|
68
|
+
opencode run "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD)."
|
|
69
|
+
|
|
70
|
+
# Step 2: De-sloppify (cleanup pass)
|
|
71
|
+
opencode run "Review all files changed by the previous commit. Remove unnecessary type tests, overly defensive checks. Keep real business logic tests."
|
|
72
|
+
|
|
73
|
+
# Step 3: Verify
|
|
74
|
+
opencode run "Run the full build, lint, type check, and test suite. Fix any failures."
|
|
75
|
+
|
|
76
|
+
# Step 4: Commit
|
|
77
|
+
opencode run "Create a conventional commit for all staged changes."
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Key Design Principles
|
|
81
|
+
|
|
82
|
+
1. **Each step is isolated** — A fresh context window per call means no context bleed between steps.
|
|
83
|
+
2. **Order matters** — Steps execute sequentially. Each builds on the filesystem state left by the previous.
|
|
84
|
+
3. **Negative instructions are dangerous** — Don't say "don't test type systems." Instead, add a separate cleanup step.
|
|
85
|
+
4. **Exit codes propagate** — `set -e` stops the pipeline on failure.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 2. Infinite Agentic Loop
|
|
90
|
+
|
|
91
|
+
**A two-prompt system** that orchestrates parallel sub-agents for specification-driven generation.
|
|
92
|
+
|
|
93
|
+
### Architecture: Two-Prompt System
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents)
|
|
97
|
+
┌─────────────────────┐ ┌──────────────────────┐
|
|
98
|
+
│ Parse spec file │ │ Receive full context │
|
|
99
|
+
│ Scan output dir │ deploys │ Read assigned number │
|
|
100
|
+
│ Plan iteration │────────────│ Follow spec exactly │
|
|
101
|
+
│ Assign creative dirs │ N agents │ Generate unique output │
|
|
102
|
+
│ Manage waves │ │ Save to output dir │
|
|
103
|
+
└─────────────────────┘ └──────────────────────┘
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### The Pattern
|
|
107
|
+
|
|
108
|
+
1. **Spec Analysis** — Orchestrator reads a specification file defining what to generate
|
|
109
|
+
2. **Directory Recon** — Scans existing output to find the highest iteration number
|
|
110
|
+
3. **Parallel Deployment** — Launches N sub-agents, each with:
|
|
111
|
+
- The full spec
|
|
112
|
+
- A unique creative direction
|
|
113
|
+
- A specific iteration number (no conflicts)
|
|
114
|
+
- A snapshot of existing iterations (for uniqueness)
|
|
115
|
+
4. **Wave Management** — For infinite mode, deploys waves of 3-5 agents until context is exhausted
|
|
116
|
+
|
|
117
|
+
### Batching Strategy
|
|
118
|
+
|
|
119
|
+
| Count | Strategy |
|
|
120
|
+
|-------|----------|
|
|
121
|
+
| 1-5 | All agents simultaneously |
|
|
122
|
+
| 6-20 | Batches of 5 |
|
|
123
|
+
| infinite | Waves of 3-5, progressive sophistication |
|
|
124
|
+
|
|
125
|
+
### Key Insight: Uniqueness via Assignment
|
|
126
|
+
|
|
127
|
+
Don't rely on agents to self-differentiate. The orchestrator **assigns** each agent a specific creative direction and iteration number.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 3. Continuous PR Loop
|
|
132
|
+
|
|
133
|
+
**A production-grade loop** that runs code in a continuous loop, creating PRs, waiting for CI, and merging automatically.
|
|
134
|
+
|
|
135
|
+
### Core Loop
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
┌─────────────────────────────────────────────────────┐
|
|
139
|
+
│ CONTINUOUS ITERATION │
|
|
140
|
+
│ │
|
|
141
|
+
│ 1. Create branch (continuous/iteration-N) │
|
|
142
|
+
│ 2. Run implementation with enhanced prompt │
|
|
143
|
+
│ 3. (Optional) Reviewer pass │
|
|
144
|
+
│ 4. Commit changes │
|
|
145
|
+
│ 5. Push + create PR (gh pr create) │
|
|
146
|
+
│ 6. Wait for CI checks (poll gh pr checks) │
|
|
147
|
+
│ 7. CI failure? → Auto-fix pass │
|
|
148
|
+
│ 8. Merge PR (squash/merge/rebase) │
|
|
149
|
+
│ 9. Return to main → repeat │
|
|
150
|
+
│ │
|
|
151
|
+
│ Limit by: --max-runs N | --max-cost $X │
|
|
152
|
+
│ --max-duration 2h | completion signal │
|
|
153
|
+
└─────────────────────────────────────────────────────┘
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Cross-Iteration Context: SHARED_TASK_NOTES.md
|
|
157
|
+
|
|
158
|
+
The critical innovation: a `SHARED_TASK_NOTES.md` file persists across iterations:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Progress
|
|
162
|
+
- [x] Added tests for auth module (iteration 1)
|
|
163
|
+
- [x] Fixed edge case in token refresh (iteration 2)
|
|
164
|
+
- [ ] Still need: rate limiting tests, error boundary tests
|
|
165
|
+
|
|
166
|
+
## Next Steps
|
|
167
|
+
- Focus on rate limiting module next
|
|
168
|
+
- The mock setup in tests/helpers.ts can be reused
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Read this file at iteration start and update it at iteration end. This bridges the context gap between independent invocations.
|
|
172
|
+
|
|
173
|
+
### CI Failure Recovery
|
|
174
|
+
|
|
175
|
+
When PR checks fail:
|
|
176
|
+
1. Fetch the failed run ID via `gh run list`
|
|
177
|
+
2. Spawn a new implementation run with CI fix context
|
|
178
|
+
3. Inspect logs via `gh run view`, fix code, commit, push
|
|
179
|
+
4. Re-wait for checks (up to retry max)
|
|
180
|
+
|
|
181
|
+
### Completion Signal
|
|
182
|
+
|
|
183
|
+
Signal "I'm done" by outputting a magic phrase. Three consecutive iterations signaling completion stops the loop.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 4. The De-Sloppify Pattern
|
|
188
|
+
|
|
189
|
+
**An add-on pattern for any loop.** Add a dedicated cleanup/refactor step after each implementer step.
|
|
190
|
+
|
|
191
|
+
### The Problem
|
|
192
|
+
|
|
193
|
+
When you ask an LLM to implement with TDD, it takes "write tests" too literally:
|
|
194
|
+
- Tests that verify TypeScript's type system works
|
|
195
|
+
- Overly defensive runtime checks the type system already guarantees
|
|
196
|
+
- Tests for framework behavior rather than business logic
|
|
197
|
+
- Excessive error handling that obscures the actual code
|
|
198
|
+
|
|
199
|
+
### The Solution: Separate Pass
|
|
200
|
+
|
|
201
|
+
Instead of constraining the implementer, let it be thorough. Then add a focused cleanup agent:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Step 1: Implement (let it be thorough)
|
|
205
|
+
opencode run "Implement the feature with full TDD. Be thorough with tests."
|
|
206
|
+
|
|
207
|
+
# Step 2: De-sloppify (separate context, focused cleanup)
|
|
208
|
+
opencode run "Review all changes in the working tree. Remove:
|
|
209
|
+
- Tests that verify language/framework behavior rather than business logic
|
|
210
|
+
- Redundant type checks that the type system already enforces
|
|
211
|
+
- Over-defensive error handling for impossible states
|
|
212
|
+
- Console.log statements
|
|
213
|
+
- Commented-out code
|
|
214
|
+
|
|
215
|
+
Keep all business logic tests. Run the test suite after cleanup."
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Key Insight
|
|
219
|
+
|
|
220
|
+
> Rather than adding negative instructions which have downstream quality effects, add a separate de-sloppify pass. Two focused agents outperform one constrained agent.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 5. RFC-Driven DAG Orchestration
|
|
225
|
+
|
|
226
|
+
**The most sophisticated pattern.** An RFC-driven, multi-agent pipeline that decomposes a spec into a dependency DAG, runs each unit through a tiered quality pipeline, and lands them via an agent-driven merge queue.
|
|
227
|
+
|
|
228
|
+
### Architecture Overview
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
RFC/PRD Document
|
|
232
|
+
│
|
|
233
|
+
▼
|
|
234
|
+
DECOMPOSITION (AI)
|
|
235
|
+
Break RFC into work units with dependency DAG
|
|
236
|
+
│
|
|
237
|
+
▼
|
|
238
|
+
┌──────────────────────────────────────────────────────┐
|
|
239
|
+
│ QUALITY PIPELINES (parallel per unit) │
|
|
240
|
+
│ Each unit in its own worktree: │
|
|
241
|
+
│ Research → Plan → Implement → Test → Review │
|
|
242
|
+
│ (depth varies by complexity tier) │
|
|
243
|
+
├──────────────────────────────────────────────────────┤
|
|
244
|
+
│ MERGE QUEUE │
|
|
245
|
+
│ Rebase onto main → Run tests → Land or evict │
|
|
246
|
+
│ Evicted units re-enter with conflict context │
|
|
247
|
+
└──────────────────────────────────────────────────────┘
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Complexity Tiers
|
|
251
|
+
|
|
252
|
+
| Tier | Pipeline Stages |
|
|
253
|
+
|------|----------------|
|
|
254
|
+
| **trivial** | implement → test |
|
|
255
|
+
| **small** | implement → test → code-review |
|
|
256
|
+
| **medium** | research → plan → implement → test → review → review-fix |
|
|
257
|
+
| **large** | research → plan → implement → test → review → review-fix → final-review |
|
|
258
|
+
|
|
259
|
+
### Key Design Principles
|
|
260
|
+
|
|
261
|
+
1. **Deterministic execution** — Upfront decomposition locks in parallelism and ordering
|
|
262
|
+
2. **Human review at leverage points** — The work plan is the single highest-leverage intervention point
|
|
263
|
+
3. **Separate concerns** — Each stage in a separate context window with a separate agent
|
|
264
|
+
4. **Conflict recovery with context** — Full eviction context enables intelligent re-runs
|
|
265
|
+
5. **Tier-driven depth** — Trivial changes skip research/review; large changes get maximum scrutiny
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Choosing the Right Pattern
|
|
270
|
+
|
|
271
|
+
### Decision Matrix
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Is the task a single focused change?
|
|
275
|
+
├─ Yes → Sequential Pipeline
|
|
276
|
+
└─ No → Is there a written spec/RFC?
|
|
277
|
+
├─ Yes → Do you need parallel implementation?
|
|
278
|
+
│ ├─ Yes → RFC-Driven DAG
|
|
279
|
+
│ └─ No → Continuous PR Loop
|
|
280
|
+
└─ No → Do you need many variations of the same thing?
|
|
281
|
+
├─ Yes → Infinite Agentic Loop
|
|
282
|
+
└─ No → Sequential Pipeline with de-sloppify
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Combining Patterns
|
|
286
|
+
|
|
287
|
+
These patterns compose well:
|
|
288
|
+
|
|
289
|
+
1. **Sequential Pipeline + De-Sloppify** — The most common combination. Every implement step gets a cleanup pass.
|
|
290
|
+
2. **Continuous Loop + De-Sloppify** — Add a de-sloppify directive to each iteration.
|
|
291
|
+
3. **Any loop + Verification** — Use `verification-loop` skill as a gate before commits.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Anti-Patterns
|
|
296
|
+
|
|
297
|
+
1. **Infinite loops without exit conditions** — Always have a max-runs, max-cost, max-duration, or completion signal.
|
|
298
|
+
2. **No context bridge between iterations** — Each call starts fresh. Use `SHARED_TASK_NOTES.md` or filesystem state to bridge context.
|
|
299
|
+
3. **Retrying the same failure** — If an iteration fails, capture the error context and feed it to the next attempt.
|
|
300
|
+
4. **Negative instructions instead of cleanup passes** — Don't say "don't do X." Add a separate pass that removes X.
|
|
301
|
+
5. **All agents in one context window** — For complex workflows, separate concerns into different agent processes.
|
|
302
|
+
|
|
303
|
+
## Verification
|
|
304
|
+
|
|
305
|
+
After applying autonomous-loops:
|
|
306
|
+
|
|
307
|
+
- [ ] The chosen pattern matches the complexity of the task
|
|
308
|
+
- [ ] Exit conditions are defined (max-runs, max-cost, max-duration, or completion signal)
|
|
309
|
+
- [ ] Context is bridged between iterations (SHARED_TASK_NOTES.md or equivalent)
|
|
310
|
+
- [ ] Failure recovery captures error context for the next attempt
|
|
311
|
+
- [ ] De-sloppify pass is separate from the implementer pass (not negative instructions)
|
|
312
|
+
- [ ] Verification runs before commits
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-and-quality
|
|
3
|
+
description: Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.
|
|
4
|
+
phase: review
|
|
5
|
+
domains:
|
|
6
|
+
- review
|
|
7
|
+
- security
|
|
8
|
+
- testing
|
|
9
|
+
- performance
|
|
10
|
+
stacks:
|
|
11
|
+
- any
|
|
12
|
+
allowed_agents:
|
|
13
|
+
- reviewer
|
|
14
|
+
- lead
|
|
15
|
+
- developer
|
|
16
|
+
surfaces:
|
|
17
|
+
- diff-review
|
|
18
|
+
- quality-gates
|
|
19
|
+
skill_source: built-in
|
|
20
|
+
origin: null
|
|
21
|
+
status: active
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Code Review and Quality
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
|
|
29
|
+
|
|
30
|
+
**The approval standard:** Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows the project's conventions, approve it.
|
|
31
|
+
|
|
32
|
+
## When to Use
|
|
33
|
+
|
|
34
|
+
- Before merging any PR or change
|
|
35
|
+
- After completing a feature implementation
|
|
36
|
+
- When another agent or model produced code you need to evaluate
|
|
37
|
+
- When refactoring existing code
|
|
38
|
+
- After any bug fix (review both the fix and the regression test)
|
|
39
|
+
|
|
40
|
+
## The Five-Axis Review
|
|
41
|
+
|
|
42
|
+
Every review evaluates code across these dimensions:
|
|
43
|
+
|
|
44
|
+
### 1. Correctness
|
|
45
|
+
|
|
46
|
+
Does the code do what it claims to do?
|
|
47
|
+
|
|
48
|
+
- Does it match the spec or task requirements?
|
|
49
|
+
- Are edge cases handled (null, empty, boundary values)?
|
|
50
|
+
- Are error paths handled (not just the happy path)?
|
|
51
|
+
- Does it pass all tests? Are the tests actually testing the right things?
|
|
52
|
+
- Are there off-by-one errors, race conditions, or state inconsistencies?
|
|
53
|
+
|
|
54
|
+
### 2. Readability & Simplicity
|
|
55
|
+
|
|
56
|
+
Can another engineer (or agent) understand this code without the author explaining it?
|
|
57
|
+
|
|
58
|
+
- Are names descriptive and consistent with project conventions? (No `temp`, `data`, `result` without context)
|
|
59
|
+
- Is the control flow straightforward (avoid nested ternaries, deep callbacks)?
|
|
60
|
+
- Is the code organized logically (related code grouped, clear module boundaries)?
|
|
61
|
+
- Are there any "clever" tricks that should be simplified?
|
|
62
|
+
- **Could this be done in fewer lines?** (1000 lines where 100 suffice is a failure)
|
|
63
|
+
- **Are abstractions earning their complexity?** (Don't generalize until the third use case)
|
|
64
|
+
- Would comments help clarify non-obvious intent? (But don't comment obvious code.)
|
|
65
|
+
- Are there dead code artifacts: no-op variables (`_unused`), backwards-compat shims, or `// removed` comments?
|
|
66
|
+
|
|
67
|
+
### 3. Architecture
|
|
68
|
+
|
|
69
|
+
Does the change fit the system's design?
|
|
70
|
+
|
|
71
|
+
- Does it follow existing patterns or introduce a new one? If new, is it justified?
|
|
72
|
+
- Does it maintain clean module boundaries?
|
|
73
|
+
- Is there code duplication that should be shared?
|
|
74
|
+
- Are dependencies flowing in the right direction (no circular dependencies)?
|
|
75
|
+
- Is the abstraction level appropriate (not over-engineered, not too coupled)?
|
|
76
|
+
|
|
77
|
+
### 4. Security
|
|
78
|
+
|
|
79
|
+
For detailed security guidance, see `security-and-hardening`. Does the change introduce vulnerabilities?
|
|
80
|
+
|
|
81
|
+
- Is user input validated and sanitized?
|
|
82
|
+
- Are secrets kept out of code, logs, and version control?
|
|
83
|
+
- Is authentication/authorization checked where needed?
|
|
84
|
+
- Are SQL queries parameterized (no string concatenation)?
|
|
85
|
+
- Are outputs encoded to prevent XSS?
|
|
86
|
+
- Are dependencies from trusted sources with no known vulnerabilities?
|
|
87
|
+
- Is data from external sources (APIs, logs, user content, config files) treated as untrusted?
|
|
88
|
+
- Are external data flows validated at system boundaries before use in logic or rendering?
|
|
89
|
+
|
|
90
|
+
### 5. Performance
|
|
91
|
+
|
|
92
|
+
For detailed profiling and optimization, see `performance-optimization`. Does the change introduce performance problems?
|
|
93
|
+
|
|
94
|
+
- Any N+1 query patterns?
|
|
95
|
+
- Any unbounded loops or unconstrained data fetching?
|
|
96
|
+
- Any synchronous operations that should be async?
|
|
97
|
+
- Any unnecessary re-renders in UI components?
|
|
98
|
+
- Any missing pagination on list endpoints?
|
|
99
|
+
- Any large objects created in hot paths?
|
|
100
|
+
|
|
101
|
+
## Change Sizing
|
|
102
|
+
|
|
103
|
+
Small, focused changes are easier to review, faster to merge, and safer to deploy. Target these sizes:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
~100 lines changed → Good. Reviewable in one sitting.
|
|
107
|
+
~300 lines changed → Acceptable if it's a single logical change.
|
|
108
|
+
~1000 lines changed → Too large. Split it.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**What counts as "one change":** A single self-contained modification that addresses one thing, includes related tests, and keeps the system functional after submission. One part of a feature — not the whole feature.
|
|
112
|
+
|
|
113
|
+
**Splitting strategies when a change is too large:**
|
|
114
|
+
|
|
115
|
+
| Strategy | How | When |
|
|
116
|
+
|----------|-----|------|
|
|
117
|
+
| **Stack** | Submit a small change, start the next one based on it | Sequential dependencies |
|
|
118
|
+
| **By file group** | Separate changes for groups needing different reviewers | Cross-cutting concerns |
|
|
119
|
+
| **Horizontal** | Create shared code/stubs first, then consumers | Layered architecture |
|
|
120
|
+
| **Vertical** | Break into smaller full-stack slices of the feature | Feature work |
|
|
121
|
+
|
|
122
|
+
**When large changes are acceptable:** Complete file deletions and automated refactoring where the reviewer only needs to verify intent, not every line.
|
|
123
|
+
|
|
124
|
+
**Separate refactoring from feature work.** A change that refactors existing code and adds new behavior is two changes — submit them separately. Small cleanups (variable renaming) can be included at reviewer discretion.
|
|
125
|
+
|
|
126
|
+
## Change Descriptions
|
|
127
|
+
|
|
128
|
+
Every change needs a description that stands alone in version control history.
|
|
129
|
+
|
|
130
|
+
**First line:** Short, imperative, standalone. "Delete the FizzBuzz RPC" not "Deleting the FizzBuzz RPC." Must be informative enough that someone searching history can understand the change without reading the diff.
|
|
131
|
+
|
|
132
|
+
**Body:** What is changing and why. Include context, decisions, and reasoning not visible in the code itself. Link to bug numbers, benchmark results, or design docs where relevant. Acknowledge approach shortcomings when they exist.
|
|
133
|
+
|
|
134
|
+
**Anti-patterns:** "Fix bug," "Fix build," "Add patch," "Moving code from A to B," "Phase 1," "Add convenience functions."
|
|
135
|
+
|
|
136
|
+
## Review Process
|
|
137
|
+
|
|
138
|
+
### Step 1: Understand the Context
|
|
139
|
+
|
|
140
|
+
Before looking at code, understand the intent:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
- What is this change trying to accomplish?
|
|
144
|
+
- What spec or task does it implement?
|
|
145
|
+
- What is the expected behavior change?
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Step 2: Review the Tests First
|
|
149
|
+
|
|
150
|
+
Tests reveal intent and coverage:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
- Do tests exist for the change?
|
|
154
|
+
- Do they test behavior (not implementation details)?
|
|
155
|
+
- Are edge cases covered?
|
|
156
|
+
- Do tests have descriptive names?
|
|
157
|
+
- Would the tests catch a regression if the code changed?
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 3: Review the Implementation
|
|
161
|
+
|
|
162
|
+
Walk through the code with the five axes in mind:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
For each file changed:
|
|
166
|
+
1. Correctness: Does this code do what the test says it should?
|
|
167
|
+
2. Readability: Can I understand this without help?
|
|
168
|
+
3. Architecture: Does this fit the system?
|
|
169
|
+
4. Security: Any vulnerabilities?
|
|
170
|
+
5. Performance: Any bottlenecks?
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Step 4: Categorize Findings
|
|
174
|
+
|
|
175
|
+
Label every comment with its severity so the author knows what's required vs optional:
|
|
176
|
+
|
|
177
|
+
| Prefix | Meaning | Author Action |
|
|
178
|
+
|--------|---------|---------------|
|
|
179
|
+
| *(no prefix)* | Required change | Must address before merge |
|
|
180
|
+
| **Critical:** | Blocks merge | Security vulnerability, data loss, broken functionality |
|
|
181
|
+
| **Nit:** | Minor, optional | Author may ignore — formatting, style preferences |
|
|
182
|
+
| **Optional:** / **Consider:** | Suggestion | Worth considering but not required |
|
|
183
|
+
| **FYI** | Informational only | No action needed — context for future reference |
|
|
184
|
+
|
|
185
|
+
This prevents authors from treating all feedback as mandatory and wasting time on optional suggestions.
|
|
186
|
+
|
|
187
|
+
### Step 5: Verify the Verification
|
|
188
|
+
|
|
189
|
+
Check the author's verification story:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
- What tests were run?
|
|
193
|
+
- Did the build pass?
|
|
194
|
+
- Was the change tested manually?
|
|
195
|
+
- Are there screenshots for UI changes?
|
|
196
|
+
- Is there a before/after comparison?
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Multi-Model Review Pattern
|
|
200
|
+
|
|
201
|
+
Use different models for different review perspectives:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Model A writes the code
|
|
205
|
+
│
|
|
206
|
+
▼
|
|
207
|
+
Model B reviews for correctness and architecture
|
|
208
|
+
│
|
|
209
|
+
▼
|
|
210
|
+
Model A addresses the feedback
|
|
211
|
+
│
|
|
212
|
+
▼
|
|
213
|
+
Human makes the final call
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
This catches issues that a single model might miss — different models have different blind spots.
|
|
217
|
+
|
|
218
|
+
**Example prompt for a review agent:**
|
|
219
|
+
```
|
|
220
|
+
Review this code change for correctness, security, and adherence to
|
|
221
|
+
our project conventions. The spec says [X]. The change should [Y].
|
|
222
|
+
Flag any issues as Critical, Important, or Suggestion.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Dead Code Hygiene
|
|
226
|
+
|
|
227
|
+
After any refactoring or implementation change, check for orphaned code:
|
|
228
|
+
|
|
229
|
+
1. Identify code that is now unreachable or unused
|
|
230
|
+
2. List it explicitly
|
|
231
|
+
3. **Ask before deleting:** "Should I remove these now-unused elements: [list]?"
|
|
232
|
+
|
|
233
|
+
Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about. When in doubt, ask.
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
DEAD CODE IDENTIFIED:
|
|
237
|
+
- formatLegacyDate() in src/utils/date.ts — replaced by formatDate()
|
|
238
|
+
- OldTaskCard component in src/components/ — replaced by TaskCard
|
|
239
|
+
- LEGACY_API_URL constant in src/config.ts — no remaining references
|
|
240
|
+
→ Safe to remove these?
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Review Speed
|
|
244
|
+
|
|
245
|
+
Slow reviews block entire teams. The cost of context-switching to review is less than the waiting cost imposed on others.
|
|
246
|
+
|
|
247
|
+
- **Respond within one business day** — this is the maximum, not the target
|
|
248
|
+
- **Ideal cadence:** Respond shortly after a review request arrives, unless deep in focused coding. A typical change should complete multiple review rounds in a single day
|
|
249
|
+
- **Prioritize fast individual responses** over quick final approval. Quick feedback reduces frustration even if multiple rounds are needed
|
|
250
|
+
- **Large changes:** Ask the author to split them rather than reviewing one massive changeset
|
|
251
|
+
|
|
252
|
+
## Handling Disagreements
|
|
253
|
+
|
|
254
|
+
When resolving review disputes, apply this hierarchy:
|
|
255
|
+
|
|
256
|
+
1. **Technical facts and data** override opinions and preferences
|
|
257
|
+
2. **Style guides** are the absolute authority on style matters
|
|
258
|
+
3. **Software design** must be evaluated on engineering principles, not personal preference
|
|
259
|
+
4. **Codebase consistency** is acceptable if it doesn't degrade overall health
|
|
260
|
+
|
|
261
|
+
**Don't accept "I'll clean it up later."** Experience shows deferred cleanup rarely happens. Require cleanup before submission unless it's a genuine emergency. If surrounding issues can't be addressed in this change, require filing a bug with self-assignment.
|
|
262
|
+
|
|
263
|
+
## Honesty in Review
|
|
264
|
+
|
|
265
|
+
When reviewing code — whether written by you, another agent, or a human:
|
|
266
|
+
|
|
267
|
+
- **Don't rubber-stamp.** "LGTM" without evidence of review helps no one.
|
|
268
|
+
- **Don't soften real issues.** "This might be a minor concern" when it's a bug that will hit production is dishonest.
|
|
269
|
+
- **Quantify problems when possible.** "This N+1 query will add ~50ms per item in the list" is better than "this could be slow."
|
|
270
|
+
- **Push back on approaches with clear problems.** Sycophancy is a failure mode in reviews. If the implementation has issues, say so directly and propose alternatives.
|
|
271
|
+
- **Accept override gracefully.** If the author has full context and disagrees, defer to their judgment. Comment on code, not people — reframe personal critiques to focus on the code itself.
|
|
272
|
+
|
|
273
|
+
## Dependency Discipline
|
|
274
|
+
|
|
275
|
+
Part of code review is dependency review:
|
|
276
|
+
|
|
277
|
+
**Before adding any dependency:**
|
|
278
|
+
1. Does the existing stack solve this? (Often it does.)
|
|
279
|
+
2. How large is the dependency? (Check bundle impact.)
|
|
280
|
+
3. Is it actively maintained? (Check last commit, open issues.)
|
|
281
|
+
4. Does it have known vulnerabilities? (`npm audit`)
|
|
282
|
+
5. What's the license? (Must be compatible with the project.)
|
|
283
|
+
|
|
284
|
+
**Rule:** Prefer standard library and existing utilities over new dependencies. Every dependency is a liability.
|
|
285
|
+
|
|
286
|
+
## The Review Checklist
|
|
287
|
+
|
|
288
|
+
```markdown
|
|
289
|
+
## Review: [PR/Change title]
|
|
290
|
+
|
|
291
|
+
### Context
|
|
292
|
+
- [ ] I understand what this change does and why
|
|
293
|
+
|
|
294
|
+
### Correctness
|
|
295
|
+
- [ ] Change matches spec/task requirements
|
|
296
|
+
- [ ] Edge cases handled
|
|
297
|
+
- [ ] Error paths handled
|
|
298
|
+
- [ ] Tests cover the change adequately
|
|
299
|
+
|
|
300
|
+
### Readability
|
|
301
|
+
- [ ] Names are clear and consistent
|
|
302
|
+
- [ ] Logic is straightforward
|
|
303
|
+
- [ ] No unnecessary complexity
|
|
304
|
+
|
|
305
|
+
### Architecture
|
|
306
|
+
- [ ] Follows existing patterns
|
|
307
|
+
- [ ] No unnecessary coupling or dependencies
|
|
308
|
+
- [ ] Appropriate abstraction level
|
|
309
|
+
|
|
310
|
+
### Security
|
|
311
|
+
- [ ] No secrets in code
|
|
312
|
+
- [ ] Input validated at boundaries
|
|
313
|
+
- [ ] No injection vulnerabilities
|
|
314
|
+
- [ ] Auth checks in place
|
|
315
|
+
- [ ] External data sources treated as untrusted
|
|
316
|
+
|
|
317
|
+
### Performance
|
|
318
|
+
- [ ] No N+1 patterns
|
|
319
|
+
- [ ] No unbounded operations
|
|
320
|
+
- [ ] Pagination on list endpoints
|
|
321
|
+
|
|
322
|
+
### Verification
|
|
323
|
+
- [ ] Tests pass
|
|
324
|
+
- [ ] Build succeeds
|
|
325
|
+
- [ ] Manual verification done (if applicable)
|
|
326
|
+
|
|
327
|
+
### Verdict
|
|
328
|
+
- [ ] **Approve** — Ready to merge
|
|
329
|
+
- [ ] **Request changes** — Issues must be addressed
|
|
330
|
+
```
|
|
331
|
+
## See Also
|
|
332
|
+
|
|
333
|
+
- For detailed security review guidance, see `references/security-checklist.md`
|
|
334
|
+
- For performance review checks, see `references/performance-checklist.md`
|
|
335
|
+
|
|
336
|
+
## Common Rationalizations
|
|
337
|
+
|
|
338
|
+
| Rationalization | Reality |
|
|
339
|
+
|---|---|
|
|
340
|
+
| "It works, that's good enough" | Working code that's unreadable, insecure, or architecturally wrong creates debt that compounds. |
|
|
341
|
+
| "I wrote it, so I know it's correct" | Authors are blind to their own assumptions. Every change benefits from another set of eyes. |
|
|
342
|
+
| "We'll clean it up later" | Later never comes. The review is the quality gate — use it. Require cleanup before merge, not after. |
|
|
343
|
+
| "AI-generated code is probably fine" | AI code needs more scrutiny, not less. It's confident and plausible, even when wrong. |
|
|
344
|
+
| "The tests pass, so it's good" | Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability concerns. |
|
|
345
|
+
|
|
346
|
+
## Red Flags
|
|
347
|
+
|
|
348
|
+
- PRs merged without any review
|
|
349
|
+
- Review that only checks if tests pass (ignoring other axes)
|
|
350
|
+
- "LGTM" without evidence of actual review
|
|
351
|
+
- Security-sensitive changes without security-focused review
|
|
352
|
+
- Large PRs that are "too big to review properly" (split them)
|
|
353
|
+
- No regression tests with bug fix PRs
|
|
354
|
+
- Review comments without severity labels — makes it unclear what's required vs optional
|
|
355
|
+
- Accepting "I'll fix it later" — it never happens
|
|
356
|
+
|
|
357
|
+
## Verification
|
|
358
|
+
|
|
359
|
+
After review is complete:
|
|
360
|
+
|
|
361
|
+
- [ ] All Critical issues are resolved
|
|
362
|
+
- [ ] All Important issues are resolved or explicitly deferred with justification
|
|
363
|
+
- [ ] Tests pass
|
|
364
|
+
- [ ] Build succeeds
|
|
365
|
+
- [ ] The verification story is documented (what changed, how it was verified)
|