|
1 | 1 | # Black Box Architecture |
2 | 2 |
|
3 | | -> Transform any codebase into modular, maintainable "black boxes" using Eskil Steenberg's architecture principles. |
| 3 | +> Transform any codebase into modular, maintainable "black boxes". |
4 | 4 |
|
5 | 5 | [](https://opensource.org/licenses/MIT) |
6 | 6 | [](docs/CONTRIBUTING.md) |
7 | 7 |
|
8 | | -AI prompts optimized for **Claude Code**, **Claude** that teach your AI assistant to think in terms of replaceable, modular components. |
| 8 | +AI agents for **Claude Code** that enforce replaceable, modular architecture with built-in approval gates, commit discipline, and a self-improvement loop. |
9 | 9 |
|
10 | | -## 📑 Table of Contents |
| 10 | +## What This Is |
11 | 11 |
|
12 | | -- [What This Is](#-what-this-is) |
13 | | -- [Quick Start](#-quick-start) |
14 | | - - [Option 1: Agents (Recommended)](#option-1-agents-recommended) |
15 | | - - [Option 2: Legacy Prompts (Skills/Commands)](#option-2-legacy-prompts-skillscommands) |
16 | | -- [Best Daily Workflow](#-best-daily-workflow) |
17 | | -- [Core Philosophy](#-core-philosophy) |
18 | | -- [What's Included](#-whats-included) |
19 | | -- [Agents](#-agents) |
20 | | -- [Legacy Prompts](#-legacy-prompts) |
21 | | -- [Example Usage](#-example-usage) |
22 | | -- [Documentation](#-documentation) |
23 | | -- [Real-World Examples](#-real-world-examples) |
24 | | -- [Learn More](#-learn-more) |
25 | | -- [How It Works](#-how-it-works) |
26 | | -- [Contributing](#-contributing) |
27 | | -- [Next Steps](#-next-steps) |
28 | | - |
29 | | -## 🎯 What This Is |
30 | | - |
31 | | -Three specialized AI prompts that apply [Eskil Steenberg's](https://www.youtube.com/watch?v=sSpULGNHyoI) battle-tested principles: |
| 12 | +Five coordinated agents that apply [Eskil Steenberg's](https://www.youtube.com/watch?v=sSpULGNHyoI) battle-tested principles: |
32 | 13 |
|
33 | 14 | - **Black box interfaces** - Clean APIs between modules |
34 | 15 | - **Replaceable components** - If you can't understand it, rewrite it |
35 | 16 | - **Constant velocity** - Write 5 lines today vs. edit 1 line later |
36 | 17 | - **Single responsibility** - One module, one person |
37 | 18 |
|
38 | | -## 🚀 Quick Start |
39 | | - |
40 | | -### Option 1: Agents (Recommended) |
| 19 | +## Quick Start |
41 | 20 |
|
42 | 21 | ```bash |
43 | 22 | # Clone the repository |
44 | 23 | git clone https://github.com/gl0bal01/black-box-architecture.git |
45 | 24 |
|
46 | | -# Install agents for this project |
| 25 | +# Install agents + task files for your project |
47 | 26 | mkdir -p .claude/agents |
48 | 27 | cp -r black-box-architecture/agents/* .claude/agents/ |
| 28 | +mkdir -p tasks |
| 29 | +cp -r black-box-architecture/tasks/* tasks/ |
49 | 30 | ``` |
50 | 31 |
|
51 | | -### Option 2: Legacy Prompts (Skills/Commands) |
52 | | - |
53 | | -Legacy prompts are still available but no longer the recommended path. |
54 | | - |
55 | | -```bash |
56 | | -# Skills (legacy) |
57 | | -mkdir -p .claude/skills |
58 | | -cp -r black-box-architecture/docs/legacy/skills .claude/skills/black-box-architecture |
59 | | - |
60 | | -# Commands (legacy) |
61 | | -mkdir -p .claude/commands |
62 | | -cp -r black-box-architecture/docs/legacy/commands/ .claude/commands/ |
63 | | -``` |
64 | | - |
65 | | -## ✅ Best Daily Workflow |
66 | | - |
67 | | -1. Use `arch-orchestrator` for most tasks. |
68 | | -2. Ask for concise output by default. |
69 | | -3. Request a full report only for big changes. |
70 | | -4. Approve any dependency, public API, or schema changes explicitly. |
71 | | - |
72 | | -## 💡 Core Philosophy |
73 | | - |
74 | | -**"It's faster to write 5 lines of code today than to write 1 line today and then have to edit it in the future."** |
75 | | -— Eskil Steenberg |
76 | | - |
77 | | -These prompts optimize for: |
78 | | -- **Human cognitive load** over algorithmic efficiency |
79 | | -- **Long-term maintainability** over short-term cleverness |
80 | | -- **Team scalability** (one person per module) |
81 | | -- **Constant developer velocity** regardless of project size |
82 | | - |
83 | | -## 📦 What's Included |
84 | | - |
85 | | -- **Agents pack** in `agents/` with orchestrator + specialists |
86 | | -- **Shared contract** in `agents/AGENTS_CONTRACT.md` |
87 | | -- **Legacy prompts** in `docs/legacy/skills/` and `docs/legacy/commands/` (deprecated) |
88 | | -- **Examples and docs** in `examples/` and `docs/` |
89 | | - |
90 | | -## 🤖 Agents |
| 32 | +## Agents |
91 | 33 |
|
92 | | -Agents are the primary, recommended path. They enforce: |
93 | | -- scope discipline |
94 | | -- approval gates for risky changes |
95 | | -- evidence-backed findings |
96 | | -- concise, reviewable outputs |
| 34 | +The agent system follows black box principles itself — specialized agents with clear responsibilities: |
97 | 35 |
|
98 | | -## 🧩 Legacy Prompts |
99 | | - |
100 | | -`docs/legacy/skills/` and `docs/legacy/commands/` are legacy prompts kept for compatibility. |
101 | | -They may drift from the contract and are not the best daily path. |
102 | | - |
103 | | -## 🤖 Autonomous Agents (Recommended) |
104 | | - |
105 | | -For daily architectural work, use the specialized agent system: |
106 | | - |
107 | | -### Installation |
108 | | - |
109 | | -```bash |
110 | | -# Copy agents to your project |
111 | | -cp -r agents/* .claude/agents/ |
112 | | - |
113 | | -# The orchestrator coordinates all agents automatically |
114 | | -``` |
115 | | - |
116 | | -### Agent Architecture |
117 | | - |
118 | | -The agent system follows black box principles itself - specialized agents with clear responsibilities: |
119 | | - |
120 | | -| Agent | Role | Autonomous Actions | |
121 | | -|-------|------|-------------------| |
122 | | -| **arch-orchestrator** | Coordination | Analyzes requests, delegates to specialists, assembles results | |
123 | | -| **arch-analyzer** | Analysis | Explores codebases, identifies violations, maps dependencies | |
124 | | -| **arch-planner** | Design | Designs architectures, creates roadmaps, assesses risks | |
125 | | -| **arch-implementer** | Implementation | Refactors code, maintains boundaries, verifies changes | |
126 | | -| **arch-debugger** | Debugging | Isolates bugs to modules, proposes fixes, maintains integrity | |
| 36 | +| Agent | Role | Model | What it does | |
| 37 | +|-------|------|-------|-------------| |
| 38 | +| **arch-orchestrator** | Entry point | Opus | Classifies requests, delegates, enforces approval gates, emits PASS/CONCERNS/FAIL/BLOCKED verdict | |
| 39 | +| **arch-analyzer** | Analysis | Sonnet | Maps module boundaries, coupling, violations. Read-only. Min 3 `file:line` per claim | |
| 40 | +| **arch-planner** | Design | Opus | Designs boundaries, interfaces, phased roadmaps. Simplicity check on non-trivial designs | |
| 41 | +| **arch-implementer** | Implementation | Sonnet | Executes approved plans. Atomic commits per changeset. Only agent that modifies code | |
| 42 | +| **arch-debugger** | Debugging | Sonnet | Isolates bugs to contract boundaries. Autonomous mode — just fix it. Captures lessons | |
127 | 43 |
|
128 | 44 | ### Workflows |
129 | 45 |
|
130 | | -**Analysis Only**: arch-analyzer explores codebase and reports findings |
131 | | - |
132 | | -**Planning Only**: arch-planner designs architecture from requirements |
133 | | - |
134 | | -**Full Refactoring**: arch-analyzer → arch-planner → [USER APPROVAL] → arch-implementer |
135 | | - |
136 | | -**Debug & Fix**: arch-debugger → arch-implementer (if fix needed) |
137 | | - |
138 | | -**Complete Transformation**: All agents work together for major architectural overhaul |
139 | | - |
140 | | -### Why Agents? |
141 | | - |
142 | | -- They follow a shared contract for consistent, reviewable outputs. |
143 | | -- They enforce approval gates for dependencies, APIs, and schemas. |
144 | | -- They scale from quick analysis to full refactors without changing tools. |
| 46 | +| Request | Flow | |
| 47 | +|---------|------| |
| 48 | +| Analysis only | Analyzer → synthesize | |
| 49 | +| Plan only | Planner → request approval | |
| 50 | +| Implement approved plan | Implementer | |
| 51 | +| Debug | Debugger → optionally Analyzer if architecture unclear | |
| 52 | +| Refactor toward black-box | Analyzer → Planner → **APPROVAL** → Implementer | |
| 53 | +| New feature | Planner → **APPROVAL** → Implementer | |
145 | 54 |
|
146 | | -**Learn More:** |
147 | | -- 📖 [Complete Agent Documentation](docs/AGENTS.md) - Detailed guide for each agent |
148 | | -- 🔄 [Agent Workflows](docs/WORKFLOWS.md) - Step-by-step examples |
149 | | -- 🔗 [Integration Examples](docs/INTEGRATION_EXAMPLES.md) - How agents coordinate |
150 | | -- ⚙️ [Agent Specifications](agents/agent.json) - Technical specifications |
| 55 | +## What's New in v2.0 |
151 | 56 |
|
152 | | -## 🎬 Example Usage |
| 57 | +- **Self-improvement loop** — agents review `tasks/lessons.md` at session start, update it after corrections. Mistakes don't repeat across sessions |
| 58 | +- **Task tracking** — persistent progress in `tasks/todo.md`. Resume work after interruptions |
| 59 | +- **Commit discipline** — `git add -u` before and after each changeset. Atomic, bisectable history. Never `git add -A` |
| 60 | +- **Goal-backward verification** — SUCCESS CRITERIA MET WHEN defines what done looks like, separate from HOW TO VERIFY |
| 61 | +- **Quality gate verdicts** — PASS / CONCERNS / FAIL / BLOCKED instead of silent self-assessed checklists |
| 62 | +- **Approval gates** — hard stops for deps, public API, schema, deletions, permission widening |
| 63 | +- **Session start checklists** — every agent loads lessons and context before working |
| 64 | +- **Debugger autonomous mode** — given a bug report, just fix it. Escalate only when genuinely blocked |
153 | 65 |
|
154 | | -### Refactoring Example |
| 66 | +See [CHANGELOG.md](CHANGELOG.md) for full details. |
155 | 67 |
|
156 | | -```bash |
157 | | -# Using the orchestrator |
158 | | -Ask arch-orchestrator: Analyze UserService and propose black-box boundaries |
159 | | -``` |
160 | | - |
161 | | -**What you get:** |
162 | | -- Current architecture analysis with `file:line` references |
163 | | -- Identified primitives and coupling issues |
164 | | -- Proposed black box module design |
165 | | -- Step-by-step refactoring plan |
166 | | -- Risk assessment and mitigation |
167 | | -- Quality validation checklist |
168 | | - |
169 | | -### Planning Example |
170 | | - |
171 | | -```bash |
172 | | -# Using the orchestrator |
173 | | -Ask arch-orchestrator: Design a module map for a real-time chat app |
174 | | -``` |
175 | | - |
176 | | -**What you get:** |
177 | | -- System primitives identification |
178 | | -- Module architecture with clear boundaries |
179 | | -- Interface specifications |
180 | | -- Implementation roadmap (phased) |
181 | | -- Risk assessment |
182 | | -- Team organization recommendations |
183 | | - |
184 | | -## 📚 Documentation |
185 | | - |
186 | | -### Getting Started |
187 | | -- **[Installation Guide](docs/INSTALLATION.md)** - Setup for agents and legacy prompts |
188 | | -- **[Principles Guide](docs/PRINCIPLES.md)** - Eskil Steenberg's methodology explained |
189 | | - |
190 | | -### Using the Tools |
191 | | -- **[Usage Guide](docs/USAGE.md)** - Agent workflow and legacy prompts |
192 | | -- **[Agent System Guide](docs/AGENTS.md)** - Complete agent documentation |
193 | | -- **[Workflows Guide](docs/WORKFLOWS.md)** - Step-by-step examples for each agent |
194 | | -- **[Integration Examples](docs/INTEGRATION_EXAMPLES.md)** - How agents coordinate together |
195 | | - |
196 | | -### Reference & Examples |
197 | | -- **[Code Examples](docs/EXAMPLES.md)** - Before/after transformations in multiple languages |
198 | | -- **[Real-World Examples](examples/)** - Complete refactoring examples |
199 | | - |
200 | | -### Contributing |
201 | | -- **[Contributing Guide](docs/CONTRIBUTING.md)** - How to contribute, report issues, add examples |
202 | | - |
203 | | -## 🔍 Real-World Examples |
| 68 | +## Best Daily Workflow |
204 | 69 |
|
205 | | -See the [`examples/`](examples/) directory for complete before/after refactoring examples in: |
206 | | -- **Python** - Repository pattern, service abstractions |
207 | | -- **TypeScript** - Interface-driven design, dependency injection |
208 | | -- **Go** - Interface composition, struct patterns |
209 | | -- **Rust** - Trait-based black boxes, generic implementations |
210 | | -- **C** - Opaque types, function pointers (Eskil's approach!) |
211 | | -- **PHP** - Service layer, strategy pattern, Laravel integration |
| 70 | +1. Use `arch-orchestrator` for most tasks — it picks the right workflow |
| 71 | +2. Concise output by default (5-12 lines). Full reports only when needed |
| 72 | +3. Approve any dependency, public API, or schema changes explicitly |
| 73 | +4. Check `tasks/lessons.md` periodically — it captures what the agents learned |
212 | 74 |
|
213 | | -## 🎓 Learn More |
| 75 | +## How It Works |
214 | 76 |
|
215 | | -### Core Resources |
| 77 | +- A [shared contract](agents/AGENTS_CONTRACT.md) governs all agent behavior (13 rules) |
| 78 | +- Agents default to concise outputs and switch to full reports when warranted |
| 79 | +- Approval gates prevent risky changes without explicit sign-off |
| 80 | +- Every architectural claim requires min 3 `file:line` evidence points |
| 81 | +- Agents commit before and after each changeset for safe rollback |
| 82 | +- Corrections are captured in `tasks/lessons.md` and reviewed next session |
216 | 83 |
|
217 | | -**Original Source:** |
| 84 | +## Core Philosophy |
218 | 85 |
|
219 | | -Watch Eskil Steenberg's complete lecture: [Architecting LARGE Software Projects](https://www.youtube.com/watch?v=sSpULGNHyoI) |
220 | | - |
221 | | -This legend has built 3D engines, networked games, and complex systems all in C using these exact principles. |
222 | | - |
223 | | -**Complete Documentation:** |
224 | | -- 📖 [Full Documentation Index](#-documentation) |
225 | | -- 🎨 [Skill System Guide](docs/legacy/skills/SKILL.md) |
226 | | -- 🤖 [Agent System Guide](docs/AGENTS.md) |
227 | | -- 📝 [Workflow Examples](docs/WORKFLOWS.md) |
228 | | - |
229 | | -### Core Principles |
| 86 | +**"It's faster to write 5 lines of code today than to write 1 line today and then have to edit it in the future."** |
| 87 | +— Eskil Steenberg |
230 | 88 |
|
231 | 89 | 1. **Primitive-First Design** - Identify core data types that flow through your system |
232 | 90 | 2. **Black Box Boundaries** - Modules communicate only through documented interfaces |
233 | 91 | 3. **Replaceable Components** - Any module can be rewritten using only its interface |
234 | 92 | 4. **Single Responsibility** - One module = one person can own it |
235 | 93 | 5. **Wrap Dependencies** - Never depend directly on code you don't control |
236 | 94 |
|
237 | | -## 🛠️ How It Works |
238 | | - |
239 | | -- A shared contract governs agent behavior and output structure. |
240 | | -- Agents default to concise outputs and switch to full reports when needed. |
241 | | -- Approval gates prevent risky changes without explicit sign-off. |
242 | | -- Evidence and verification are required for non-trivial claims. |
243 | | - |
244 | | -## 🤝 Contributing |
245 | | - |
246 | | -Contributions welcome! See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for: |
247 | | -- How to report issues |
248 | | -- Suggesting improvements |
249 | | -- Sharing successful patterns |
250 | | -- Adding language examples |
251 | | - |
252 | | -## 🔗 Related Resources |
| 95 | +## Documentation |
253 | 96 |
|
254 | | -- [Original ai-architecture-prompts](https://github.com/Alexanderdunlop/ai-architecture-prompts) - Inspiration and foundation |
255 | | -- [Eskil's Video: Architecting LARGE Software Projects](https://www.youtube.com/watch?v=sSpULGNHyoI) |
256 | | -- [Enhanced Versions](enhanced/) - Legacy reference documentation |
| 97 | +- **[Agent System Guide](docs/AGENTS.md)** - Complete agent documentation |
| 98 | +- **[Workflows Guide](docs/WORKFLOWS.md)** - Step-by-step examples for each agent |
| 99 | +- **[Integration Examples](docs/INTEGRATION_EXAMPLES.md)** - How agents coordinate |
| 100 | +- **[Principles Guide](docs/PRINCIPLES.md)** - Eskil Steenberg's methodology explained |
| 101 | +- **[Code Examples](docs/EXAMPLES.md)** - Before/after transformations in multiple languages |
| 102 | +- **[Agent Specifications](agents/agent.json)** - Technical specs and policies |
| 103 | +- **[Contributing Guide](docs/CONTRIBUTING.md)** - How to contribute |
257 | 104 |
|
258 | | -## 📄 License |
| 105 | +## Real-World Examples |
259 | 106 |
|
260 | | -MIT License - see [LICENSE](LICENSE) for details. |
| 107 | +See [`examples/`](examples/) for complete before/after refactoring examples in Python, TypeScript, Go, Rust, C, and PHP. |
261 | 108 |
|
262 | | ---- |
| 109 | +## Legacy Prompts |
263 | 110 |
|
264 | | -## 🌟 Why This Works |
| 111 | +Skills and commands in `docs/legacy/` are kept for compatibility but are no longer the recommended path. Use agents instead. |
265 | 112 |
|
266 | | -Traditional software grows complex over time. Developer velocity slows. Features take longer. Bugs multiply. |
| 113 | +## Related Resources |
267 | 114 |
|
268 | | -**Black box architecture** maintains constant velocity: |
269 | | -- Modules are small enough for one person |
270 | | -- Changes are isolated to single modules |
271 | | -- Components can be completely rewritten |
272 | | -- New developers can contribute immediately |
| 115 | +- [Eskil Steenberg: Architecting LARGE Software Projects](https://www.youtube.com/watch?v=sSpULGNHyoI) - The foundation of everything here |
273 | 116 |
|
274 | | -**These AI prompts** teach your assistant to think this way automatically. |
| 117 | +## Contributing |
275 | 118 |
|
276 | | -## 🚀 Next Steps |
| 119 | +Contributions welcome! See [CONTRIBUTING.md](docs/CONTRIBUTING.md). |
277 | 120 |
|
278 | | -1. Install agents and run a small analysis with `arch-orchestrator`. |
279 | | -2. Use concise output for daily work, request full reports only when needed. |
280 | | -3. Approve dependencies, public API changes, and schemas explicitly. |
281 | | -4. If you must use legacy prompts, keep them aligned with the contract. |
| 121 | +## License |
282 | 122 |
|
283 | | -Watch Eskil Steenberg's [complete lecture](https://www.youtube.com/watch?v=sSpULGNHyoI) - the foundation of everything here. |
| 123 | +MIT License - see [LICENSE](LICENSE) for details. |
284 | 124 |
|
285 | 125 | --- |
286 | | - |
287 | | -**Not affiliated with Anthropic, Eskil Steenberg, or any tools mentioned. Battle-tested principles from real development work.** |
0 commit comments