Skip to content

Commit 752d98b

Browse files
author
catlog22
committed
feat: Add Shared Discovery Board protocol to parallel-dev-cycle
Embed a real-time shared context mechanism (coordination/discoveries.ndjson) into all 4 agent roles, eliminating redundant codebase exploration. Each agent reads the board on start, skips covered areas, and appends new findings as NDJSON entries for other agents to consume. Key additions per file: - SKILL.md: Design principle #8, discovery type table with dedup keys and required data fields, board lifecycle rules - 02-agent-execution.md: Self-sufficient discovery protocol snippet in each spawn prompt with write method, required fields, and dedup keys - 4 role files: Full Shared Discovery Protocol section with board location, lifecycle, physical write method (Bash echo >>), reads/writes tables with dedup keys and required data schemas, and embedded Read/Write steps in execution process
1 parent 113bee5 commit 752d98b

6 files changed

Lines changed: 438 additions & 17 deletions

File tree

.codex/skills/parallel-dev-cycle/SKILL.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Each agent **maintains one main document** (e.g., requirements.md, plan.json, im
5959
5. **Parallel Coordination**: Four agents launched simultaneously; coordination via shared state and orchestrator
6060
6. **File References**: Use short file paths instead of content passing
6161
7. **Self-Enhancement**: RA agent proactively extends requirements based on context
62+
8. **Shared Discovery Board**: All agents share exploration findings via `discoveries.ndjson` — read on start, write as you discover, eliminating redundant codebase exploration
6263

6364
## Arguments
6465

@@ -141,11 +142,15 @@ Phase 1: Session Initialization
141142
↓ cycleId, state, progressDir (initialized/resumed)
142143
143144
Phase 2: Agent Execution
144-
↓ agentOutputs {ra, ep, cd, vas}
145+
├─ All agents read coordination/discoveries.ndjson on start
146+
├─ Each agent explores → writes new discoveries to board
147+
├─ Later-finishing agents benefit from earlier agents' findings
148+
↓ agentOutputs {ra, ep, cd, vas} + shared discoveries.ndjson
145149
146150
Phase 3: Result Aggregation
147151
↓ parsedResults, hasIssues, iteration count
148152
↓ [Loop back to Phase 2 if issues and iteration < max]
153+
↓ (discoveries.ndjson carries over across iterations)
149154
150155
Phase 4: Completion & Summary
151156
↓ finalState, summaryReport
@@ -179,6 +184,7 @@ Return: cycle_id, iterations, final_state
179184
│ ├── changes.log # NDJSON complete history
180185
│ └── history/
181186
└── coordination/
187+
├── discoveries.ndjson # Shared discovery board (all agents append)
182188
├── timeline.md # Execution timeline
183189
└── decisions.log # Decision log
184190
```
@@ -271,7 +277,45 @@ Append: changes.log ← {"timestamp","version":"1.1.0","action":"update","descr
271277

272278
**Execution Order**: RA → EP → CD → VAS (dependency chain, all spawned in parallel but block on dependencies)
273279

274-
**Agent → Orchestrator**: Each agent outputs `PHASE_RESULT:` block:
280+
### Shared Discovery Board
281+
282+
All agents share a real-time discovery board at `coordination/discoveries.ndjson`. Each agent reads it on start and appends findings during work. This eliminates redundant codebase exploration.
283+
284+
**Lifecycle**:
285+
- Created by the first agent to write a discovery (file may not exist initially)
286+
- Carries over across iterations — never cleared or recreated
287+
- Agents use Bash `echo '...' >> discoveries.ndjson` to append entries
288+
289+
**Format**: NDJSON, each line is a self-contained JSON with required top-level fields `ts`, `agent`, `type`, `data`:
290+
```jsonl
291+
{"ts":"2026-01-22T10:00:00+08:00","agent":"ra","type":"tech_stack","data":{"language":"TypeScript","framework":"Express","test":"Jest","build":"tsup"}}
292+
```
293+
294+
**Discovery Types**:
295+
296+
| type | Dedup Key | Writers | Readers | Required `data` Fields |
297+
|------|-----------|---------|---------|----------------------|
298+
| `tech_stack` | singleton | RA | EP, CD, VAS | `language`, `framework`, `test`, `build` |
299+
| `project_config` | `data.path` | RA | EP, CD | `path`, `key_deps[]`, `scripts{}` |
300+
| `existing_feature` | `data.name` | RA, EP | CD | `name`, `files[]`, `summary` |
301+
| `architecture` | singleton | EP | CD, VAS | `pattern`, `layers[]`, `entry` |
302+
| `code_pattern` | `data.name` | EP, CD | CD, VAS | `name`, `description`, `example_file` |
303+
| `integration_point` | `data.file` | EP | CD | `file`, `description`, `exports[]` |
304+
| `similar_impl` | `data.feature` | EP | CD | `feature`, `files[]`, `relevance` |
305+
| `code_convention` | singleton | CD | VAS | `naming`, `imports`, `formatting` |
306+
| `utility` | `data.name` | CD | VAS | `name`, `file`, `usage` |
307+
| `test_command` | singleton | CD, VAS | VAS, CD | `unit`, `integration`(opt), `coverage`(opt) |
308+
| `test_baseline` | singleton | VAS | CD | `total`, `passing`, `coverage_pct`, `framework`, `config` |
309+
| `test_pattern` | singleton | VAS | CD | `style`, `naming`, `fixtures` |
310+
| `blocker` | `data.issue` | any | all | `issue`, `severity`, `impact` |
311+
312+
**Protocol Rules**:
313+
1. Read board before own exploration → skip covered areas (if file doesn't exist, skip)
314+
2. Write discoveries immediately via Bash `echo >>` → don't batch
315+
3. Deduplicate — check existing entries; skip if same `type` + dedup key value already exists
316+
4. Append-only — never modify or delete existing lines
317+
318+
### Agent → Orchestrator Communication
275319
```
276320
PHASE_RESULT:
277321
- phase: ra | ep | cd | vas
@@ -281,7 +325,9 @@ PHASE_RESULT:
281325
- issues: []
282326
```
283327

284-
**Orchestrator → Agent**: Feedback via `send_input` (file refs + issue summary, never full content):
328+
### Orchestrator → Agent Communication
329+
330+
Feedback via `send_input` (file refs + issue summary, never full content):
285331
```
286332
## FEEDBACK FROM [Source]
287333
[Issue summary with file:line references]

.codex/skills/parallel-dev-cycle/phases/02-agent-execution.md

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,38 @@ Spawn four specialized agents in parallel and wait for all to complete with time
55
## Objective
66

77
- Spawn RA, EP, CD, VAS agents simultaneously using Codex subagent pattern
8-
- Pass cycle context and role references to each agent
8+
- Pass cycle context, role references, and **discovery protocol** to each agent
99
- Wait for all agents with configurable timeout
1010
- Handle timeout with convergence request
1111
- Output: agentOutputs from all 4 agents
1212

13+
## Shared Discovery Board
14+
15+
All agents share a discovery board at `{progressDir}/coordination/discoveries.ndjson`. Each agent reads it on start and writes discoveries during execution. This eliminates redundant codebase exploration across agents.
16+
17+
**Agent reads board → skips covered areas → explores unknowns → writes new findings → other agents benefit**
18+
19+
### Discovery Protocol Snippet (injected into every agent prompt)
20+
21+
```
22+
## SHARED DISCOVERY PROTOCOL
23+
24+
Board: ${progressDir}/coordination/discoveries.ndjson
25+
26+
**On Start**: Read board (if exists; if not, skip — you'll be the first writer).
27+
Skip exploration for areas already covered.
28+
**During Work**: Append discoveries as NDJSON entries via Bash `echo '...' >> discoveries.ndjson`.
29+
**Format**: {"ts":"<ISO8601>","agent":"<role>","type":"<type>","data":{<required fields>}}
30+
**Cross-iteration**: Board persists across iterations. Never clear it.
31+
32+
**You Write** (dedup key in parentheses):
33+
- `<type>` (<dedup key>) → required data: <field1>, <field2>, ...
34+
35+
**You Read**: <comma-separated list of types from other agents>
36+
37+
**Rules**: Read before explore. Write via `echo >>`. Dedup by type+key. Append-only.
38+
```
39+
1340
## Agent Role References
1441

1542
Each agent reads its detailed role definition at execution time:
@@ -64,6 +91,26 @@ Cross-reference the task description against these documents for completeness.
6491
6592
---
6693
94+
## SHARED DISCOVERY PROTOCOL
95+
96+
Board: ${progressDir}/coordination/discoveries.ndjson
97+
98+
**On Start**: Read board (if exists; if not, skip — you'll be the first writer). Skip exploration for areas already covered.
99+
**During Work**: Append discoveries as NDJSON entries via Bash \`echo '...' >> discoveries.ndjson\`.
100+
**Format**: {"ts":"<ISO8601>","agent":"ra","type":"<type>","data":{<see required fields>}}
101+
**Cross-iteration**: Board persists across iterations. Never clear it.
102+
103+
**You Write** (dedup key in parentheses):
104+
- \`tech_stack\` (singleton) → required data: language, framework, test, build
105+
- \`project_config\` (data.path) → required data: path, key_deps[], scripts{}
106+
- \`existing_feature\` (data.name) → required data: name, files[], summary
107+
108+
**You Read**: architecture, similar_impl, test_baseline, blocker
109+
110+
**Rules**: Read before explore. Write via \`echo >> \`. Dedup by type+key. Append-only.
111+
112+
---
113+
67114
${sourceRefsSection}
68115
## CYCLE CONTEXT
69116
@@ -87,6 +134,7 @@ Requirements Analyst - Analyze and refine requirements throughout the cycle.
87134
3. Identify edge cases and implicit requirements
88135
4. Track requirement changes across iterations
89136
5. Maintain requirements.md and changes.log
137+
6. **Share discoveries** to coordination/discoveries.ndjson
90138
${focusDirective}
91139
## DELIVERABLES
92140
@@ -126,6 +174,27 @@ function spawnEPAgent(cycleId, state, progressDir) {
126174
127175
---
128176
177+
## SHARED DISCOVERY PROTOCOL
178+
179+
Board: ${progressDir}/coordination/discoveries.ndjson
180+
181+
**On Start**: Read board (if exists; if not, skip — you'll be the first writer). Skip exploration for areas already covered.
182+
**During Work**: Append discoveries as NDJSON entries via Bash \`echo '...' >> discoveries.ndjson\`.
183+
**Format**: {"ts":"<ISO8601>","agent":"ep","type":"<type>","data":{<see required fields>}}
184+
**Cross-iteration**: Board persists across iterations. Never clear it.
185+
186+
**You Write** (dedup key in parentheses):
187+
- \`architecture\` (singleton) → required data: pattern, layers[], entry
188+
- \`code_pattern\` (data.name) → required data: name, description, example_file
189+
- \`integration_point\` (data.file) → required data: file, description, exports[]
190+
- \`similar_impl\` (data.feature) → required data: feature, files[], relevance
191+
192+
**You Read**: tech_stack, project_config, existing_feature, test_command, test_baseline
193+
194+
**Rules**: Read before explore. Write via \`echo >> \`. Dedup by type+key. Append-only.
195+
196+
---
197+
129198
## CYCLE CONTEXT
130199
131200
- **Cycle ID**: ${cycleId}
@@ -144,6 +213,7 @@ Exploration & Planning Agent - Explore architecture and generate implementation
144213
3. Design implementation approach
145214
4. Generate plan.json with task breakdown
146215
5. Update or iterate on existing plan
216+
6. **Share discoveries** to coordination/discoveries.ndjson
147217
148218
## DELIVERABLES
149219
@@ -182,6 +252,27 @@ function spawnCDAgent(cycleId, state, progressDir) {
182252
183253
---
184254
255+
## SHARED DISCOVERY PROTOCOL
256+
257+
Board: ${progressDir}/coordination/discoveries.ndjson
258+
259+
**On Start**: Read board (if exists; if not, skip — you'll be the first writer). Skip exploration for areas already covered.
260+
**During Work**: Append discoveries as NDJSON entries via Bash \`echo '...' >> discoveries.ndjson\`.
261+
**Format**: {"ts":"<ISO8601>","agent":"cd","type":"<type>","data":{<see required fields>}}
262+
**Cross-iteration**: Board persists across iterations. Never clear it.
263+
264+
**You Write** (dedup key in parentheses):
265+
- \`code_convention\` (singleton) → required data: naming, imports, formatting
266+
- \`utility\` (data.name) → required data: name, file, usage
267+
- \`test_command\` (singleton) → required data: unit, integration(opt), coverage(opt)
268+
- \`blocker\` (data.issue) → required data: issue, severity, impact
269+
270+
**You Read**: tech_stack, architecture, code_pattern, integration_point, similar_impl, test_baseline, test_command
271+
272+
**Rules**: Read before explore. Write via \`echo >> \`. Dedup by type+key. Append-only.
273+
274+
---
275+
185276
## CYCLE CONTEXT
186277
187278
- **Cycle ID**: ${cycleId}
@@ -200,6 +291,7 @@ Code Developer - Implement features based on plan and requirements.
200291
3. Handle integration issues
201292
4. Maintain code quality
202293
5. Report implementation progress and issues
294+
6. **Share discoveries** to coordination/discoveries.ndjson
203295
204296
## DELIVERABLES
205297
@@ -237,6 +329,27 @@ function spawnVASAgent(cycleId, state, progressDir) {
237329

238330
---
239331

332+
## SHARED DISCOVERY PROTOCOL
333+
334+
Board: ${progressDir}/coordination/discoveries.ndjson
335+
336+
**On Start**: Read board (if exists; if not, skip — you'll be the first writer). Skip exploration for areas already covered.
337+
**During Work**: Append discoveries as NDJSON entries via Bash \`echo '...' >> discoveries.ndjson\`.
338+
**Format**: {"ts":"<ISO8601>","agent":"vas","type":"<type>","data":{<see required fields>}}
339+
**Cross-iteration**: Board persists across iterations. Never clear it.
340+
341+
**You Write** (dedup key in parentheses):
342+
- \`test_baseline\` (singleton) → required data: total, passing, coverage_pct, framework, config
343+
- \`test_pattern\` (singleton) → required data: style, naming, fixtures
344+
- \`test_command\` (singleton) → required data: unit, e2e(opt), coverage(opt)
345+
- \`blocker\` (data.issue) → required data: issue, severity, impact
346+
347+
**You Read**: tech_stack, architecture, code_pattern, code_convention, test_command, utility, integration_point
348+
349+
**Rules**: Read before explore. Write via \`echo >> \`. Dedup by type+key. Append-only.
350+
351+
---
352+
240353
## CYCLE CONTEXT
241354
242355
- **Cycle ID**: ${cycleId}
@@ -255,6 +368,7 @@ Validation & Archival Specialist - Validate quality and create documentation.
255368
3. Create archival documentation
256369
4. Summarize cycle results
257370
5. Generate version history
371+
6. **Share discoveries** to coordination/discoveries.ndjson
258372
259373
## DELIVERABLES
260374

.codex/skills/parallel-dev-cycle/roles/code-developer.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,61 @@ The Code Developer is responsible for implementing features according to the pla
5555
- Leave TODO comments without context
5656
- Implement features not in the plan
5757

58+
## Shared Discovery Protocol
59+
60+
CD agent participates in the **Shared Discovery Board** (`coordination/discoveries.ndjson`). This append-only NDJSON file enables all agents to share exploration findings in real-time, eliminating redundant codebase exploration.
61+
62+
### Board Location & Lifecycle
63+
64+
- **Path**: `{progressDir}/coordination/discoveries.ndjson`
65+
- **First access**: If file does not exist, skip reading — you may be the first writer. Create it on first write.
66+
- **Cross-iteration**: Board carries over across iterations. Do NOT clear or recreate it. New iterations append to existing entries.
67+
68+
### Physical Write Method
69+
70+
Append one NDJSON line using Bash:
71+
```bash
72+
echo '{"ts":"2026-01-22T11:00:00+08:00","agent":"cd","type":"code_convention","data":{"naming":"camelCase functions, PascalCase classes","imports":"absolute paths via @/ alias","formatting":"prettier with default config"}}' >> {progressDir}/coordination/discoveries.ndjson
73+
```
74+
75+
### CD Reads (from other agents)
76+
77+
| type | Dedup Key | Use |
78+
|------|-----------|-----|
79+
| `tech_stack` | (singleton) | Know language/framework without detection — skip project scanning |
80+
| `architecture` | (singleton) | Understand system layout (layers, entry point) before coding |
81+
| `code_pattern` | `data.name` | Follow existing conventions (error handling, validation, etc.) immediately |
82+
| `integration_point` | `data.file` | Know exactly which files to modify and what interfaces to match |
83+
| `similar_impl` | `data.feature` | Read reference implementations for consistency |
84+
| `test_baseline` | (singleton) | Know current test count/coverage before making changes |
85+
| `test_command` | (singleton) | Run tests directly without figuring out commands |
86+
87+
### CD Writes (for other agents)
88+
89+
| type | Dedup Key | Required `data` Fields | When |
90+
|------|-----------|----------------------|------|
91+
| `code_convention` | (singleton — only 1 entry) | `naming`, `imports`, `formatting` | After observing naming/import/formatting patterns |
92+
| `utility` | `data.name` | `name`, `file`, `usage` | After finding each reusable helper function |
93+
| `test_command` | (singleton — only 1 entry) | `unit`, `integration`(optional), `coverage`(optional) | After discovering test scripts |
94+
| `blocker` | `data.issue` | `issue`, `severity` (high\|medium\|low), `impact` | When hitting any blocking issue |
95+
96+
### Discovery Entry Format
97+
98+
Each line is a self-contained JSON object with exactly these top-level fields:
99+
100+
```jsonl
101+
{"ts":"<ISO8601>","agent":"cd","type":"<type>","data":{<required fields per type>}}
102+
```
103+
104+
### Protocol Rules
105+
106+
1. **Read board first** — before own exploration, read `discoveries.ndjson` (if exists) and skip already-covered areas
107+
2. **Write as you discover** — append new findings immediately via Bash `echo >>`, don't batch
108+
3. **Deduplicate** — check existing entries before writing; skip if same `type` + dedup key value already exists
109+
4. **Never modify existing lines** — append-only, no edits, no deletions
110+
111+
---
112+
58113
## Execution Process
59114

60115
### Phase 1: Planning & Setup
@@ -64,12 +119,22 @@ The Code Developer is responsible for implementing features according to the pla
64119
- Requirements from requirements-analyst.md
65120
- Project tech stack and guidelines
66121

67-
2. **Understand Project Structure**
122+
2. **Read Discovery Board**
123+
- Read `{progressDir}/coordination/discoveries.ndjson` (if exists)
124+
- Parse entries by type — note what's already discovered
125+
- If `tech_stack` / `architecture` exist → skip project structure exploration
126+
- If `code_pattern` / `code_convention` exist → adopt conventions directly
127+
- If `integration_point` exist → know target files without searching
128+
- If `similar_impl` exist → read reference files for consistency
129+
- If `test_command` exist → use known commands for testing
130+
131+
3. **Understand Project Structure** (skip areas covered by board)
68132
- Review similar existing implementations
69133
- Understand coding conventions
70134
- Check for relevant utilities/libraries
135+
- **Write discoveries**: append `code_convention`, `utility` entries for new findings
71136

72-
3. **Prepare Environment**
137+
4. **Prepare Environment**
73138
- Create feature branch (if using git)
74139
- Set up development environment
75140
- Prepare test environment

0 commit comments

Comments
 (0)