Skip to content

Commit 7ddd920

Browse files
franklywatsonclaude
andcommitted
docs: add compound engineering as L2 Pattern 2.8
Each unit of engineering work should make subsequent units easier, not harder. Compound engineering extends the skill chain with a feedback loop: after brainstorm → plan → work → review, capture learnings back into the system so future sessions start from a higher baseline. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent b6e0dd6 commit 7ddd920

1 file changed

Lines changed: 71 additions & 1 deletion

File tree

docs/L2-behavioral-guardrails.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,79 @@ Treating phase tracking as advisory. If the tracker warns but allows invalid tra
466466

467467
---
468468

469+
## Pattern 2.8 — Compound Engineering
470+
471+
### Problem
472+
473+
Traditional development accumulates complexity. Each feature adds surface area, each bugfix patches over a gap, and each session starts from roughly the same knowledge baseline as the one before. Agents compound this problem: without persistent memory, every session re-derives the same lessons. The first time an agent solves an N+1 query problem, it takes research. The next session facing the same problem starts from zero.
474+
475+
### Solution
476+
477+
**Each unit of engineering work should make subsequent units easier, not harder.** Compound engineering extends the skill chain ([Pattern 2.2](#pattern-22--the-skill-chain)) with a feedback loop: after each cycle of brainstorm → plan → work → review, explicitly capture learnings back into the system so future sessions — by the same agent or different ones — start from a higher knowledge baseline.
478+
479+
The core cycle:
480+
481+
```
482+
brainstorm → plan → work → review → compound → repeat
483+
^ |
484+
└─── knowledge feeds back ────────────┘
485+
```
486+
487+
**The compounding principle:** 80% planning and review, 20% execution. Thorough planning prevents wasted implementation. Review catches issues while context is fresh. Codified learnings prevent re-deriving solutions. Quality is not a separate phase — it is the mechanism that makes future work easier.
488+
489+
**What compounds:**
490+
491+
- **Documented solutions** — When a bug is fixed, document the symptoms, root cause, and prevention strategy. Next time the same symptom appears, the lookup takes minutes instead of research.
492+
- **Refined plans** — Plans that survived review become templates for similar features. Each planning cycle sharpens the next.
493+
- **Captured patterns** — Architecture decisions, trade-off analyses, and failure modes recorded during review become reference material for future design sessions.
494+
- **Constitutional amendments** — When a review catches a novel violation, the constitutional rules ([Pattern 2.4](#pattern-24--constitutional-rules)) expand to cover it.
495+
496+
**What does NOT compound:**
497+
498+
- Undocumented fixes that live only in conversation history
499+
- Plans that are discarded after implementation without extracting lessons
500+
- Reviews that approve or reject without recording *why*
501+
- Errors dismissed as "unrelated" rather than investigated and catalogued
502+
503+
### In Practice
504+
505+
The [compound-engineering](https://github.com/EveryInc/compound-engineering-plugin) plugin implements this pattern with `/ce:compound` — a skill that captures solved problems into structured documentation (`docs/solutions/`) with YAML frontmatter for searchability. Each documented solution reduces the cost of the next occurrence from research to lookup.
506+
507+
The my-claw project's design rinsing lineage ([my-claw case study](../references/reference-my-claw-case-study.md)) demonstrates compounding across sessions: each rinsing phase extracted patterns that the next phase built on, producing more value because it started from a richer foundation.
508+
509+
**Compounding across the pattern pyramid:**
510+
511+
| Level | What Compounds | Mechanism |
512+
|-------|---------------|-----------|
513+
| L0 | Clean structure, current docs | [Pattern 0.8 — Aggressive Cleanup](L0-foundation.md#pattern-08--aggressive-cleanup) removes noise each session |
514+
| L1 | Test coverage, verification infrastructure | Stack tests accumulate; each new test catches regressions permanently |
515+
| L2 | Constitutional rules, skills, learnings | Each review that catches a novel violation strengthens the guardrail system |
516+
| L3 | Codebase index, routing rules | Session caching ([Pattern 3.8](L3-optimization.md#pattern-38--session-lifecycle)) carries detection forward |
517+
| L4 | Metrics, drift corrections | Measurement creates a tightening feedback loop |
518+
519+
### Anti-Pattern
520+
521+
- **Disposable sessions** — Work that produces code but no learnings. The feature ships, the bug is fixed, but nothing is captured for next time.
522+
- **Knowledge silos** — Learnings stored in conversation history, personal notes, or tribal memory instead of discoverable documentation.
523+
- **Review without extraction** — Code reviews that approve or reject without recording the reasoning, missing the opportunity to compound the architectural insight.
524+
- **Premature abstraction** — Compounding knowledge is not the same as building frameworks. Document the *why*, not just the *what*. Let patterns emerge from documented solutions before promoting them into abstractions.
525+
526+
### Cross-References
527+
528+
- [Pattern 2.2 — The Skill Chain](#pattern-22--the-skill-chain) — The workflow pipeline that compound engineering extends
529+
- [Pattern 2.4 — Constitutional Rules](#pattern-24--constitutional-rules) — Rules that grow through compounding
530+
- [Pattern 4.1 — Evidence-Based Claims](L4-standards-measurement.md#pattern-41--evidence-based-claims) — Compounding requires evidence, not assumptions
531+
- [Reference my-claw Case Study](../references/reference-my-claw-case-study.md) — Design rinsing lineage demonstrates compounding across three phases
532+
533+
### Reference Implementation
534+
535+
The [compound-engineering](https://github.com/EveryInc/compound-engineering-plugin) plugin provides the `/ce:compound` skill for capturing solved problems into structured, searchable documentation. The [rig](https://github.com/franklywatson/claude-rig) framework's skill chain implements the brainstorm → plan → work → review portion; compound engineering closes the loop by feeding learnings back.
536+
537+
---
538+
469539
## Summary
470540

471-
L2 behavioral guardrails automate enforcement of the discipline established in L1. Skills extend base capabilities with project-specific rules. Hooks enforce rules through the tool layer. Constitutional rules declare hard constraints. Zero-defect tolerance ensures systematic self-diagnosis.
541+
L2 behavioral guardrails automate enforcement of the discipline established in L1. Skills extend base capabilities with project-specific rules. Hooks enforce rules through the tool layer. Constitutional rules declare hard constraints. Zero-defect tolerance ensures systematic self-diagnosis. Compound engineering closes the loop — each cycle of work feeds learnings back into the system, making subsequent cycles more effective.
472542

473543
Together, these patterns make correct behavior the path of least resistance for agentic development.
474544

0 commit comments

Comments
 (0)