|
1 | 1 | # Multi-Agent Orchestration System - Design Document |
2 | 2 |
|
3 | | -**Version:** 1.1 |
4 | | -**Date:** 2025-11-29 |
| 3 | +**Version:** 1.3 |
| 4 | +**Date:** 2025-12-03 |
5 | 5 | **Authors:** User + Claude (Orchestrator) |
6 | 6 | **Status:** Implemented (with MCP integration) |
7 | 7 |
|
@@ -111,18 +111,22 @@ Agents are unreliable at: |
111 | 111 | ### 3.1 Component Overview |
112 | 112 |
|
113 | 113 | ``` |
114 | | -agents/ |
115 | | -├── DESIGN.md # This document - architecture rationale |
116 | | -├── CONTEXT.md # Live state (auto-updated by Python) |
117 | | -├── IAC.md # Inter-Agent Communication log (auto-generated) |
118 | | -├── config.yaml # Agent configurations |
119 | | -├── __init__.py # Package exports |
| 114 | +powerspawn/ |
| 115 | +├── mcp_server.py # MCP protocol server (entry point) |
120 | 116 | ├── spawner.py # Main spawning logic + orchestration |
121 | 117 | ├── context_loader.py # Loads and formats project context |
122 | 118 | ├── logger.py # Writes IAC.md, updates CONTEXT.md |
123 | | -├── parser.py # Parses agent responses |
| 119 | +├── parser.py # Parses agent responses (JSON, JSONL) |
| 120 | +├── __init__.py # Package exports |
124 | 121 | ├── schemas/ # Structured output schemas |
125 | | -└── workflows/ # Reusable task patterns |
| 122 | +├── examples/ # Usage examples |
| 123 | +├── DESIGN.md # This document - architecture rationale |
| 124 | +├── MCP_DESIGN.md # MCP protocol implementation details |
| 125 | +└── README.md # User-facing documentation |
| 126 | +
|
| 127 | +Auto-generated (gitignored): |
| 128 | +├── CONTEXT.md # Live state (auto-updated by Python) |
| 129 | +└── IAC.md # Inter-Agent Communication log |
126 | 130 | ``` |
127 | 131 |
|
128 | 132 | ### 3.2 Data Flow |
@@ -201,35 +205,50 @@ The Python orchestrator automatically prepends project context to every prompt: |
201 | 205 |
|
202 | 206 | **Purpose:** Immutable log of all agent spawns and results. |
203 | 207 |
|
204 | | -**Format:** |
| 208 | +**Format (v1.4 - Newest First, 15 Entry Limit):** |
205 | 209 | ```markdown |
206 | 210 | # Inter-Agent Communication Log |
207 | 211 |
|
208 | | -## 2025-11-29 |
209 | | - |
210 | | -### [12:30:45] Spawn #a1b2c3 |
211 | | -- **Agent:** Claude (sonnet) |
212 | | -- **Task:** Analyze root directory files |
213 | | -- **Tools:** Bash, Read, Glob, Grep |
214 | | -- **Prompt:** |
215 | | - ``` |
216 | | - Analyze the files at the root... |
217 | | - ``` |
218 | | -- **Status:** Completed |
219 | | -- **Duration:** 45.2s |
220 | | -- **Cost:** $0.41 |
221 | | -- **Result Summary:** Found 12 files to delete, 2 security risks |
| 212 | +> Auto-generated by PowerSpawn. Newest entries first. Limited to last 15 entries. |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +### 🤖 Claude Agent #a1b2c3 |
| 217 | +**Started:** 2025-12-01 12:30:45 UTC | **Status:** ✅ Completed (45.2s, $0.41) |
| 218 | + |
| 219 | +<details> |
| 220 | +<summary>📋 Prompt</summary> |
| 221 | + |
| 222 | +Analyze the files at the root directory and identify security risks... |
| 223 | + |
| 224 | +</details> |
| 225 | + |
| 226 | +<details> |
| 227 | +<summary>📊 Result</summary> |
| 228 | + |
| 229 | +Found 12 files to delete, 2 security risks: |
| 230 | +1. .env.local exposed in git |
| 231 | +2. API key hardcoded in config.js |
| 232 | + |
| 233 | +</details> |
222 | 234 |
|
223 | 235 | --- |
224 | 236 |
|
225 | | -### [12:31:30] Spawn #d4e5f6 |
| 237 | +### 🤖 Codex Agent #d4e5f6 |
| 238 | +**Started:** 2025-12-01 12:28:00 UTC | **Status:** ✅ Completed (120s, ~$0.01) |
226 | 239 | ... |
227 | 240 | ``` |
228 | 241 |
|
| 242 | +**Key Features:** |
| 243 | +- **Newest first** - Most recent entries at top for quick access |
| 244 | +- **15 entry limit** - Prevents unbounded file growth |
| 245 | +- **Collapsible details** - Prompts and results hidden by default |
| 246 | +- **Status updated in-place** - Entry updated when agent completes (not appended) |
| 247 | + |
229 | 248 | **Rules:** |
230 | | -- Append-only (never edit past entries) |
231 | 249 | - Auto-generated by Python (never by agents) |
232 | 250 | - Provides audit trail for debugging |
| 251 | +- Git-trackable for version control |
233 | 252 |
|
234 | 253 | ### 4.2 CONTEXT.md (Live State) |
235 | 254 |
|
@@ -268,38 +287,34 @@ The Python orchestrator automatically prepends project context to every prompt: |
268 | 287 |
|
269 | 288 | ## 5. Configuration |
270 | 289 |
|
271 | | -### 5.1 Context Files to Load |
| 290 | +PowerSpawn uses sensible defaults with optional environment variable overrides: |
272 | 291 |
|
273 | | -Defined in `config.yaml`: |
| 292 | +### 5.1 Environment Variables |
274 | 293 |
|
275 | | -```yaml |
276 | | -context: |
277 | | - # Files to inject into every prompt |
278 | | - always_include: |
279 | | - - CLAUDE.md # Coding conventions (full) |
| 294 | +| Variable | Description | Default | |
| 295 | +|----------|-------------|---------| |
| 296 | +| `POWERSPAWN_OUTPUT_DIR` | Directory for IAC.md and CONTEXT.md | Project root | |
| 297 | +| `ANTHROPIC_API_KEY` | For Claude agents | (from CLI config) | |
| 298 | +| `OPENAI_API_KEY` | For Codex agents | (from CLI config) | |
280 | 299 |
|
281 | | - # Files to summarize and inject |
282 | | - summarize: |
283 | | - - PRD.md # Product requirements (first 100 lines) |
284 | | - - PLAN.md # Current iteration only |
285 | | - - ARCHITECTURE.md # Overview section only |
| 300 | +### 5.2 Context Injection |
286 | 301 |
|
287 | | - # Files available but not auto-injected |
288 | | - on_demand: |
289 | | - - docs/SRS_DB.md # Database schema |
290 | | - - CONTRIBUTING.md # Contribution guidelines |
291 | | -``` |
| 302 | +The MCP server automatically injects context files when spawning agents: |
292 | 303 |
|
293 | | -### 5.2 Logging Configuration |
| 304 | +- **AGENTS.md** - Universal instructions for all sub-agents (always injected) |
| 305 | +- **CLAUDE.md** - Project-specific coding conventions (if exists) |
| 306 | +- **CONTEXT.md** - Current agent state (if exists) |
294 | 307 |
|
295 | | -```yaml |
296 | | -logging: |
297 | | - iac_file: "IAC.md" |
298 | | - context_file: "CONTEXT.md" |
299 | | - max_recent_runs: 10 |
300 | | - log_prompts: true # Include full prompts in IAC |
301 | | - log_responses: false # Only log summaries (responses can be large) |
302 | | -``` |
| 308 | +Context is loaded by `context_loader.py` and prepended to every prompt. |
| 309 | + |
| 310 | +### 5.3 Logging Defaults |
| 311 | + |
| 312 | +| Setting | Value | |
| 313 | +|---------|-------| |
| 314 | +| Max IAC.md entries | 15 | |
| 315 | +| Entry order | Newest first | |
| 316 | +| Prompts logged | Yes (collapsible) | |
| 317 | +| Results logged | Yes (collapsible) | |
303 | 318 |
|
304 | 319 | --- |
305 | 320 |
|
@@ -462,3 +477,4 @@ When asked to run Playwright tests, Codex agents: |
462 | 477 | | 1.0 | 2025-11-29 | Initial design document | |
463 | 478 | | 1.1 | 2025-11-29 | Added MCP integration (see MCP_DESIGN.md for details) | |
464 | 479 | | 1.2 | 2025-11-30 | Added Codex limitations and agent comparison matrix | |
| 480 | +| 1.3 | 2025-12-03 | Updated for standalone PowerSpawn: new file structure, IAC.md v1.4 format (newest-first, 15 entries), removed config.yaml | |
0 commit comments