|
1 | | -# Black Box Architecture |
| 1 | +# Black Box Architecture Agents |
2 | 2 |
|
3 | | -> Transform any codebase into modular, maintainable "black boxes". |
| 3 | +AI agents for maintaining and improving software architecture using black-box design principles — inspired by [Eskil Steenberg's lecture](https://www.youtube.com/watch?v=sSpULGNHyoI) and rooted in information hiding (Parnas, 1972). |
4 | 4 |
|
5 | | -[](https://opensource.org/licenses/MIT) |
6 | | -[](docs/CONTRIBUTING.md) |
| 5 | +Five coordinated specialists — analyze, plan, implement, debug — governed by a shared contract that enforces scope discipline, evidence minimums, approval gates, and a self-improvement loop. |
7 | 6 |
|
8 | | -AI agents for **Claude Code** that enforce replaceable, modular architecture with built-in approval gates, commit discipline, and a self-improvement loop. |
9 | | - |
10 | | -## What This Is |
11 | | - |
12 | | -Five coordinated agents that apply [Eskil Steenberg's](https://www.youtube.com/watch?v=sSpULGNHyoI) battle-tested principles: |
13 | | - |
14 | | -- **Black box interfaces** - Clean APIs between modules |
15 | | -- **Replaceable components** - If you can't understand it, rewrite it |
16 | | -- **Constant velocity** - Write 5 lines today vs. edit 1 line later |
17 | | -- **Single responsibility** - One module, one person |
18 | | - |
19 | | -## Quick Start |
| 7 | +## Quick Install |
20 | 8 |
|
21 | 9 | ```bash |
22 | | -# Clone the repository |
23 | 10 | git clone https://github.com/gl0bal01/black-box-architecture.git |
24 | 11 |
|
25 | | -# Install agents + task files for your project |
| 12 | +# Project-specific |
26 | 13 | mkdir -p .claude/agents |
27 | 14 | cp -r black-box-architecture/agents/* .claude/agents/ |
28 | | -mkdir -p tasks |
29 | | -cp -r black-box-architecture/tasks/* tasks/ |
| 15 | + |
| 16 | +# Or personal (all projects) |
| 17 | +cp -r black-box-architecture/agents/* ~/.claude/agents/ |
30 | 18 | ``` |
31 | 19 |
|
32 | 20 | ## Agents |
33 | 21 |
|
34 | | -The agent system follows black box principles itself — specialized agents with clear responsibilities: |
35 | | - |
36 | | -| Agent | Role | Model | What it does | |
| 22 | +| Agent | Role | Model | Writes Code | |
37 | 23 | |-------|------|-------|-------------| |
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 | |
43 | | - |
44 | | -### Workflows |
45 | | - |
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 | |
54 | | - |
55 | | -## What's New in v2.0 |
56 | | - |
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 |
65 | | - |
66 | | -See [CHANGELOG.md](CHANGELOG.md) for full details. |
67 | | - |
68 | | -## Best Daily Workflow |
69 | | - |
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 |
74 | | - |
75 | | -## How It Works |
76 | | - |
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 |
83 | | - |
84 | | -## Core Philosophy |
85 | | - |
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 |
88 | | - |
89 | | -1. **Primitive-First Design** - Identify core data types that flow through your system |
90 | | -2. **Black Box Boundaries** - Modules communicate only through documented interfaces |
91 | | -3. **Replaceable Components** - Any module can be rewritten using only its interface |
92 | | -4. **Single Responsibility** - One module = one person can own it |
93 | | -5. **Wrap Dependencies** - Never depend directly on code you don't control |
94 | | - |
95 | | -## Documentation |
96 | | - |
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 |
| 24 | +| **arch-orchestrator** | Entry point. Classifies, delegates, synthesizes. | Opus | No | |
| 25 | +| **arch-analyzer** | Maps module boundaries, coupling, violations. | Sonnet | No | |
| 26 | +| **arch-planner** | Designs modules, interfaces, migration roadmaps. | Opus | No | |
| 27 | +| **arch-implementer** | Executes approved plans with commit discipline. | Sonnet | Yes (requires approval) | |
| 28 | +| **arch-debugger** | Isolates bugs to contract boundaries, fixes autonomously. | Sonnet | Yes (approval gates apply) | |
104 | 29 |
|
105 | | -## Real-World Examples |
| 30 | +All agents follow `agents/BLACKBOX_CONTRACT.md` — 13 rules covering scope discipline, evidence requirements, approval gates, commit checkpoints, and self-improvement. |
106 | 31 |
|
107 | | -See [`examples/`](examples/) for complete before/after refactoring examples in Python, TypeScript, Go, Rust, C, and PHP. |
| 32 | +## Usage |
108 | 33 |
|
109 | | -## Legacy Prompts |
110 | | - |
111 | | -Skills and commands in `docs/legacy/` are kept for compatibility but are no longer the recommended path. Use agents instead. |
| 34 | +``` |
| 35 | +"Ask arch-orchestrator to analyze UserService and propose black-box boundaries" |
| 36 | +"Ask arch-analyzer to find coupling issues in src/services/" |
| 37 | +"Ask arch-planner to design a payment processing module" |
| 38 | +"Ask arch-implementer to execute the approved refactoring plan" |
| 39 | +"Ask arch-debugger to isolate and fix the checkout bug" |
| 40 | +``` |
112 | 41 |
|
113 | | -## Related Resources |
| 42 | +## Workflows |
114 | 43 |
|
115 | | -- [Eskil Steenberg: Architecting LARGE Software Projects](https://www.youtube.com/watch?v=sSpULGNHyoI) - The foundation of everything here |
| 44 | +| Workflow | Agents | Approval Gate | |
| 45 | +|----------|--------|---------------| |
| 46 | +| Analysis only | Analyzer | — | |
| 47 | +| Planning only | Planner | — | |
| 48 | +| Full refactoring | Analyzer → Planner → Implementer | After plan, before implementation | |
| 49 | +| Debug & fix | Debugger → (Implementer) | Before non-trivial fixes | |
| 50 | +| Complete transformation | All agents in sequence | After plan + between phases | |
116 | 51 |
|
117 | | -## Contributing |
| 52 | +## Documentation |
118 | 53 |
|
119 | | -Contributions welcome! See [CONTRIBUTING.md](docs/CONTRIBUTING.md). |
| 54 | +- [Agent System Guide](docs/AGENTS.md) — Architecture, agents, workflows, troubleshooting |
| 55 | +- [Black Box Principles](docs/PRINCIPLES.md) — Design philosophy (Steenberg, Parnas) |
| 56 | +- [Code Examples](docs/EXAMPLES.md) — Before/after refactorings in 6 languages |
| 57 | +- [Contributing](docs/CONTRIBUTING.md) — How to contribute |
120 | 58 |
|
121 | 59 | ## License |
122 | 60 |
|
123 | | -MIT License - see [LICENSE](LICENSE) for details. |
124 | | - |
125 | | ---- |
| 61 | +MIT |
0 commit comments