@open-code-review/agents 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/commands/map.md +154 -0
- package/package.json +1 -1
- package/skills/ocr/AGENTS.md +6 -2
- package/skills/ocr/SKILL.md +12 -0
- package/skills/ocr/assets/config.yaml +12 -0
- package/skills/ocr/references/{synthesis.md → final-template.md} +5 -2
- package/skills/ocr/references/map-agent-task.md +252 -0
- package/skills/ocr/references/map-personas/architect.md +82 -0
- package/skills/ocr/references/map-personas/flow-analyst.md +94 -0
- package/skills/ocr/references/map-personas/requirements-mapper.md +119 -0
- package/skills/ocr/references/map-template.md +252 -0
- package/skills/ocr/references/map-workflow.md +714 -0
- package/skills/ocr/references/session-files.md +41 -8
- package/skills/ocr/references/session-state.md +60 -10
- package/skills/ocr/references/workflow.md +149 -32
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@ agents/
|
|
|
9
9
|
├── skills/ocr/ # The OCR skill
|
|
10
10
|
│ ├── SKILL.md # Tech Lead orchestration logic
|
|
11
11
|
│ ├── references/
|
|
12
|
-
│ │ ├── workflow.md
|
|
13
|
-
│ │ ├──
|
|
14
|
-
│ │ ├──
|
|
15
|
-
│ │
|
|
12
|
+
│ │ ├── workflow.md # 8-phase review workflow
|
|
13
|
+
│ │ ├── session-files.md # Authoritative file manifest
|
|
14
|
+
│ │ ├── session-state.md # State management
|
|
15
|
+
│ │ ├── discourse.md # Multi-agent debate rules
|
|
16
|
+
│ │ ├── final-template.md # Final review template
|
|
17
|
+
│ │ └── reviewers/ # Persona definitions (customizable)
|
|
16
18
|
│ │ ├── principal.md # Architecture, design patterns
|
|
17
19
|
│ │ ├── quality.md # Code style, best practices
|
|
18
20
|
│ │ ├── security.md # Auth, data handling, vulnerabilities
|
package/commands/map.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a Code Review Map to help navigate large, complex changesets.
|
|
3
|
+
name: "OCR: Map"
|
|
4
|
+
category: Code Review
|
|
5
|
+
tags: [ocr, map, navigation, review-map]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**Usage**
|
|
9
|
+
```
|
|
10
|
+
/ocr-map [target] [--fresh] [--requirements <path>]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Arguments**
|
|
14
|
+
- `target` (optional): Branch, commit, or file to map. Defaults to staged changes.
|
|
15
|
+
- `--fresh` (optional): Clear any existing map for today's session and start from scratch.
|
|
16
|
+
- `--requirements <path>` (optional): Path to requirements document (spec, proposal, ticket).
|
|
17
|
+
|
|
18
|
+
**Examples**
|
|
19
|
+
```
|
|
20
|
+
/ocr-map # Map staged changes
|
|
21
|
+
/ocr-map --fresh # Clear existing map and regenerate
|
|
22
|
+
/ocr-map HEAD~5 # Map last 5 commits
|
|
23
|
+
/ocr-map feature/big-refactor # Map branch vs main
|
|
24
|
+
/ocr-map --requirements spec.md # Map with requirements context
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**When to Use**
|
|
28
|
+
|
|
29
|
+
The map command is for **extremely large changesets** that would take multiple hours for a human to review. It produces a structured navigation document with:
|
|
30
|
+
- Section-based grouping of related changes
|
|
31
|
+
- Checkboxes for tracking review progress
|
|
32
|
+
- Flow context (upstream/downstream dependencies)
|
|
33
|
+
- Requirements coverage (if requirements provided)
|
|
34
|
+
|
|
35
|
+
**For most changesets, `/ocr-review` is sufficient.** Use `/ocr-map` when you need a navigation aid for overwhelming changes.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Steps
|
|
40
|
+
|
|
41
|
+
1. **Run Setup Guard** (MANDATORY - validates OCR is properly configured)
|
|
42
|
+
- Read and execute `.ocr/skills/references/setup-guard.md`
|
|
43
|
+
- If validation fails → STOP and show error
|
|
44
|
+
- If validation passes → continue
|
|
45
|
+
2. **Session State Check** (verify existing session state)
|
|
46
|
+
3. Load the OCR skill from `.ocr/skills/SKILL.md`
|
|
47
|
+
4. Execute the 6-phase map workflow defined in `.ocr/skills/references/map-workflow.md`
|
|
48
|
+
5. Store results in `.ocr/sessions/{date}-{branch}/map/runs/run-{n}/`
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🔍 Session State Check (Phase 0)
|
|
53
|
+
|
|
54
|
+
Before starting any map work, verify the current session state:
|
|
55
|
+
|
|
56
|
+
### Step 1: Check for existing session
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Find today's session directory
|
|
60
|
+
ls -la .ocr/sessions/$(date +%Y-%m-%d)-* 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 2: Check for existing map runs
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Find existing map runs
|
|
67
|
+
ls -la .ocr/sessions/{id}/map/runs/ 2>/dev/null
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Step 3: Determine action
|
|
71
|
+
|
|
72
|
+
- **If `--fresh` flag**: Delete the map directory and start from run-1
|
|
73
|
+
- **If map exists and complete**: Start new run (run-{n+1})
|
|
74
|
+
- **If map exists but incomplete**: Resume from current phase
|
|
75
|
+
- **If no map exists**: Start from run-1
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## ⚠️ CRITICAL: Required Artifacts (Must Create In Order)
|
|
80
|
+
|
|
81
|
+
> **See `references/map-workflow.md` for the complete workflow.**
|
|
82
|
+
|
|
83
|
+
You MUST create these files sequentially:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
.ocr/sessions/{YYYY-MM-DD}-{branch}/
|
|
87
|
+
├── state.json # Session state (shared with review)
|
|
88
|
+
├── discovered-standards.md # Phase 1: merged project standards (shared)
|
|
89
|
+
├── requirements.md # Phase 1: user requirements (if provided, shared)
|
|
90
|
+
└── map/
|
|
91
|
+
└── runs/
|
|
92
|
+
└── run-1/ # Map run (increments on re-map)
|
|
93
|
+
├── topology.md # Phase 2: file categorization
|
|
94
|
+
├── flow-analysis.md # Phase 3: dependency tracing
|
|
95
|
+
├── requirements-mapping.md # Phase 4: coverage (if requirements)
|
|
96
|
+
└── map.md # Phase 5: final map output
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Checkpoint Rules
|
|
100
|
+
|
|
101
|
+
1. **Before Phase 2** (Topology): `discovered-standards.md` MUST exist
|
|
102
|
+
2. **Before Phase 3** (Flow Tracing): `topology.md` MUST exist
|
|
103
|
+
3. **Before Phase 4** (Requirements): `flow-analysis.md` MUST exist
|
|
104
|
+
4. **Before Phase 5** (Synthesis): All prior artifacts MUST exist
|
|
105
|
+
5. **NEVER** write `map.md` without completing Phases 1-4
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
The map workflow reads redundancy settings from `.ocr/config.yaml`:
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
code-review-map:
|
|
115
|
+
agents:
|
|
116
|
+
flow_analysts: 2 # Default: 2 (range: 1-10)
|
|
117
|
+
requirements_mappers: 2 # Default: 2 (range: 1-10)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
If not configured, defaults are used.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Output
|
|
125
|
+
|
|
126
|
+
The final `map.md` contains:
|
|
127
|
+
- **Executive Summary**: Narrative hypothesis about changeset intent
|
|
128
|
+
- **Sections**: Logical groupings with checkboxes for each file
|
|
129
|
+
- **Flow Context**: Upstream/downstream dependencies per section
|
|
130
|
+
- **Requirements Coverage**: Mapping to requirements (if provided)
|
|
131
|
+
- **File Index**: Alphabetical listing of all changed files
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Completeness Guarantee
|
|
136
|
+
|
|
137
|
+
The map MUST include every changed file. The workflow validates completeness before finalizing:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
CHANGED=$(git diff --cached --name-only | wc -l)
|
|
141
|
+
MAPPED=$(grep -c '^\- \[ \]' map.md)
|
|
142
|
+
|
|
143
|
+
if [ "$CHANGED" -ne "$MAPPED" ]; then
|
|
144
|
+
echo "ERROR: Map incomplete!"
|
|
145
|
+
fi
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
**Reference**
|
|
151
|
+
- See `.ocr/skills/SKILL.md` for Tech Lead context
|
|
152
|
+
- See `.ocr/skills/references/map-workflow.md` for detailed workflow phases
|
|
153
|
+
- See `.ocr/skills/references/map-template.md` for output format
|
|
154
|
+
- See `.ocr/skills/references/map-personas/` for agent personas
|
package/package.json
CHANGED
package/skills/ocr/AGENTS.md
CHANGED
|
@@ -16,6 +16,7 @@ When asked to perform a code review:
|
|
|
16
16
|
| Command | Description |
|
|
17
17
|
|---------|-------------|
|
|
18
18
|
| `/ocr-review` | Start a full code review session |
|
|
19
|
+
| `/ocr-map` | Generate a Code Review Map for large changesets |
|
|
19
20
|
| `/ocr-doctor` | Check OCR installation and dependencies |
|
|
20
21
|
| `/ocr-reviewers` | List available reviewer personas |
|
|
21
22
|
| `/ocr-history` | Show past review sessions |
|
|
@@ -35,9 +36,12 @@ When asked to perform a code review:
|
|
|
35
36
|
## Key Files
|
|
36
37
|
|
|
37
38
|
- `SKILL.md` - Core skill definition and Tech Lead role
|
|
38
|
-
- `references/workflow.md` - Complete 8-phase workflow
|
|
39
|
+
- `references/workflow.md` - Complete 8-phase review workflow
|
|
40
|
+
- `references/map-workflow.md` - 6-phase Code Review Map workflow
|
|
39
41
|
- `references/session-files.md` - **Authoritative session file manifest**
|
|
40
42
|
- `references/session-state.md` - State management and progress tracking
|
|
41
|
-
- `references/
|
|
43
|
+
- `references/final-template.md` - Final review template and synthesis guide
|
|
44
|
+
- `references/map-template.md` - Code Review Map output template
|
|
42
45
|
- `references/discourse.md` - Multi-agent discourse rules
|
|
43
46
|
- `references/reviewers/` - Reviewer persona definitions
|
|
47
|
+
- `references/map-personas/` - Map agent persona definitions
|
package/skills/ocr/SKILL.md
CHANGED
|
@@ -156,6 +156,7 @@ Available slash commands (format varies by tool):
|
|
|
156
156
|
| Action | Windsurf | Claude Code / Others |
|
|
157
157
|
|--------|----------|---------------------|
|
|
158
158
|
| Run code review | `/ocr-review` | `/ocr:review` |
|
|
159
|
+
| Generate review map | `/ocr-map` | `/ocr:map` |
|
|
159
160
|
| Check installation | `/ocr-doctor` | `/ocr:doctor` |
|
|
160
161
|
| List reviewers | `/ocr-reviewers` | `/ocr:reviewers` |
|
|
161
162
|
| List sessions | `/ocr-history` | `/ocr:history` |
|
|
@@ -167,3 +168,14 @@ Available slash commands (format varies by tool):
|
|
|
167
168
|
- **Claude Code, Cursor, etc.** support subdirectories → `/ocr:command`
|
|
168
169
|
|
|
169
170
|
Both invoke the same underlying functionality.
|
|
171
|
+
|
|
172
|
+
### Map Command
|
|
173
|
+
|
|
174
|
+
The `/ocr:map` command generates a **Code Review Map** for large, complex changesets:
|
|
175
|
+
- Section-based grouping with checkboxes for tracking
|
|
176
|
+
- Flow context (upstream/downstream dependencies)
|
|
177
|
+
- Requirements coverage (if requirements provided)
|
|
178
|
+
|
|
179
|
+
**When to use**: Extremely large changesets (multi-hour human review). For most cases, `/ocr:review` is sufficient.
|
|
180
|
+
|
|
181
|
+
See `references/map-workflow.md` for complete workflow.
|
|
@@ -73,6 +73,18 @@ default_team:
|
|
|
73
73
|
# security: 1 # Auto-added for auth/API/data changes
|
|
74
74
|
# testing: 1 # Auto-added for logic-heavy changes
|
|
75
75
|
|
|
76
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
77
|
+
# CODE REVIEW MAP
|
|
78
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
79
|
+
# Configuration for the /ocr:map command.
|
|
80
|
+
# Increase agent redundancy for large codebases to improve accuracy.
|
|
81
|
+
# Note: Map is a standalone tool for humans; review command works independently.
|
|
82
|
+
|
|
83
|
+
# code-review-map:
|
|
84
|
+
# agents:
|
|
85
|
+
# flow_analysts: 2 # Number of Flow Analyst agents (1-10, default: 2)
|
|
86
|
+
# requirements_mappers: 2 # Number of Requirements Mapper agents (1-10, default: 2)
|
|
87
|
+
|
|
76
88
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
77
89
|
# OUTPUT & WORKFLOW
|
|
78
90
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
# Synthesis
|
|
1
|
+
# Final Review Template & Synthesis Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Output file**: `rounds/round-{n}/final.md`
|
|
4
|
+
> **Manifest**: See `references/session-files.md` for authoritative file names
|
|
5
|
+
|
|
6
|
+
This guide describes how to synthesize all findings into a unified final review. Save output to `rounds/round-{n}/final.md`.
|
|
4
7
|
|
|
5
8
|
## Philosophy: Model Real Engineering Teams
|
|
6
9
|
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Map Agent Task Templates
|
|
2
|
+
|
|
3
|
+
Templates for spawning map-specific agents (Flow Analysts, Requirements Mappers).
|
|
4
|
+
|
|
5
|
+
## Flow Analyst Task
|
|
6
|
+
|
|
7
|
+
When spawning a Flow Analyst, provide the following context:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
# Flow Analysis Task: Analyst {n}
|
|
11
|
+
|
|
12
|
+
## Your Persona
|
|
13
|
+
|
|
14
|
+
{content of references/map-personas/flow-analyst.md}
|
|
15
|
+
|
|
16
|
+
## Project Standards
|
|
17
|
+
|
|
18
|
+
{content of discovered-standards.md}
|
|
19
|
+
|
|
20
|
+
## Canonical File List
|
|
21
|
+
|
|
22
|
+
The following files are changed in this PR. You are responsible for tracing dependencies for the assigned subset.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
{list of all changed files from git diff --name-only}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Your Assigned Files
|
|
29
|
+
|
|
30
|
+
Trace dependencies for these files:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
{subset of files assigned to this analyst}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Map Architect Guidance
|
|
37
|
+
|
|
38
|
+
{brief context from topology analysis — what sections are emerging, what patterns are suspected}
|
|
39
|
+
|
|
40
|
+
## Your Task
|
|
41
|
+
|
|
42
|
+
For each assigned file, trace upstream and downstream dependencies:
|
|
43
|
+
|
|
44
|
+
### Output Format
|
|
45
|
+
|
|
46
|
+
For each file, produce:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Flow Analysis: {file_path}
|
|
50
|
+
|
|
51
|
+
### File Purpose
|
|
52
|
+
{1-2 sentence description of what this file does}
|
|
53
|
+
|
|
54
|
+
### Upstream (What calls this)
|
|
55
|
+
| Caller | Location | Context |
|
|
56
|
+
|--------|----------|---------|
|
|
57
|
+
| `functionName()` | `path/to/caller.ts:42` | {why it calls this} |
|
|
58
|
+
|
|
59
|
+
### Downstream (What this calls)
|
|
60
|
+
| Callee | Location | Context |
|
|
61
|
+
|--------|----------|---------|
|
|
62
|
+
| `otherFunction()` | `path/to/dep.ts:15` | {what it's used for} |
|
|
63
|
+
|
|
64
|
+
### Related Files
|
|
65
|
+
- `path/to/test.test.ts` — Test coverage
|
|
66
|
+
- `path/to/config.yaml` — Configuration dependency
|
|
67
|
+
- `path/to/sibling.ts` — Same module, similar pattern
|
|
68
|
+
|
|
69
|
+
### Suggested Section
|
|
70
|
+
{which logical section this file belongs to, e.g., "Authentication Flow"}
|
|
71
|
+
|
|
72
|
+
### Flow Context Summary
|
|
73
|
+
{1-2 sentence summary of where this code fits in the broader system}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Agency Guidelines
|
|
77
|
+
|
|
78
|
+
You have **full agency** to explore the codebase:
|
|
79
|
+
- Read complete files to understand context
|
|
80
|
+
- Follow imports across package boundaries
|
|
81
|
+
- Use grep/search to find references
|
|
82
|
+
- Examine tests, configs, documentation
|
|
83
|
+
- Make professional judgments about relevance
|
|
84
|
+
|
|
85
|
+
### Quality Standards
|
|
86
|
+
|
|
87
|
+
- **Thorough**: Don't stop at first-level dependencies
|
|
88
|
+
- **Accurate**: Verify calls exist, don't assume
|
|
89
|
+
- **Documented**: Explain WHY each relationship matters
|
|
90
|
+
- **Bounded**: Stay relevant, don't trace the entire codebase
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Requirements Mapper Task
|
|
96
|
+
|
|
97
|
+
When spawning a Requirements Mapper, provide the following context:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
# Requirements Mapping Task: Mapper {n}
|
|
101
|
+
|
|
102
|
+
## Your Persona
|
|
103
|
+
|
|
104
|
+
{content of references/map-personas/requirements-mapper.md}
|
|
105
|
+
|
|
106
|
+
## Project Standards
|
|
107
|
+
|
|
108
|
+
{content of discovered-standards.md}
|
|
109
|
+
|
|
110
|
+
## Requirements Context
|
|
111
|
+
|
|
112
|
+
{content of requirements.md — the user-provided specs, proposals, tickets}
|
|
113
|
+
|
|
114
|
+
## Canonical File List
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
{list of all changed files}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Topology Summary
|
|
121
|
+
|
|
122
|
+
{summary from topology analysis — what sections exist, what each contains}
|
|
123
|
+
|
|
124
|
+
## Flow Context
|
|
125
|
+
|
|
126
|
+
{summary from flow analysis — how files relate to each other}
|
|
127
|
+
|
|
128
|
+
## Your Task
|
|
129
|
+
|
|
130
|
+
Map each changed file to the requirements it addresses.
|
|
131
|
+
|
|
132
|
+
### Output Format
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
# Requirements Mapping
|
|
136
|
+
|
|
137
|
+
## Requirements Identified
|
|
138
|
+
|
|
139
|
+
Parse the provided requirements into discrete items:
|
|
140
|
+
|
|
141
|
+
1. **REQ-1**: {requirement description}
|
|
142
|
+
2. **REQ-2**: {requirement description}
|
|
143
|
+
3. **REQ-3**: {requirement description}
|
|
144
|
+
|
|
145
|
+
## Coverage Matrix
|
|
146
|
+
|
|
147
|
+
| Requirement | Status | Implementing Files | Notes |
|
|
148
|
+
|-------------|--------|-------------------|-------|
|
|
149
|
+
| REQ-1 | ✅ Full | `file1.ts`, `file2.ts` | {how it's implemented} |
|
|
150
|
+
| REQ-2 | ⚠️ Partial | `file3.ts` | {what's missing} |
|
|
151
|
+
| REQ-3 | ❌ None | — | {why not covered} |
|
|
152
|
+
|
|
153
|
+
## Per-File Mapping
|
|
154
|
+
|
|
155
|
+
### `path/to/file1.ts`
|
|
156
|
+
- **Requirements Addressed**: REQ-1, REQ-4
|
|
157
|
+
- **Coverage**: Full
|
|
158
|
+
- **Notes**: {implementation details}
|
|
159
|
+
|
|
160
|
+
### `path/to/file2.ts`
|
|
161
|
+
- **Requirements Addressed**: REQ-2
|
|
162
|
+
- **Coverage**: Partial — missing error handling per spec line 42
|
|
163
|
+
- **Notes**: {what's implemented vs missing}
|
|
164
|
+
|
|
165
|
+
## Gaps and Concerns
|
|
166
|
+
|
|
167
|
+
### Unaddressed Requirements
|
|
168
|
+
- **REQ-3**: {description} — Not found in changeset. May be deferred or out of scope.
|
|
169
|
+
|
|
170
|
+
### Unclear Mappings
|
|
171
|
+
- `path/to/file5.ts` — Could address REQ-2 or REQ-4, unclear which
|
|
172
|
+
|
|
173
|
+
### Questions for Clarification
|
|
174
|
+
- Is REQ-3 intentionally excluded?
|
|
175
|
+
- The spec says "{ambiguous phrase}" — what does this mean?
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Quality Standards
|
|
179
|
+
|
|
180
|
+
- **Complete**: Map ALL provided requirements, even if not covered
|
|
181
|
+
- **Accurate**: Verify coverage claims by reading the code
|
|
182
|
+
- **Helpful**: Explain WHY coverage is full/partial/none
|
|
183
|
+
- **Honest**: Don't overclaim coverage; flag uncertainty
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Map Architect Coordination
|
|
189
|
+
|
|
190
|
+
The Map Architect (Tech Lead for map workflow) spawns agents as follows:
|
|
191
|
+
|
|
192
|
+
### Spawning Flow Analysts
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
## Flow Analyst Spawning
|
|
196
|
+
|
|
197
|
+
1. Load config to get redundancy count:
|
|
198
|
+
```yaml
|
|
199
|
+
code-review-map:
|
|
200
|
+
agents:
|
|
201
|
+
flow_analysts: 2 # Default
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
2. Divide files across analysts for coverage:
|
|
205
|
+
- If 2 analysts: Each gets all files (full redundancy)
|
|
206
|
+
- If 3+ analysts: Can split files with overlap
|
|
207
|
+
|
|
208
|
+
3. For each analyst, create task with:
|
|
209
|
+
- Their persona
|
|
210
|
+
- Discovered standards
|
|
211
|
+
- Full canonical file list
|
|
212
|
+
- Their assigned files
|
|
213
|
+
- Current topology understanding
|
|
214
|
+
|
|
215
|
+
4. Collect all outputs before proceeding to aggregation
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Spawning Requirements Mappers
|
|
219
|
+
|
|
220
|
+
```markdown
|
|
221
|
+
## Requirements Mapper Spawning
|
|
222
|
+
|
|
223
|
+
**Skip if no requirements provided.**
|
|
224
|
+
|
|
225
|
+
1. Load config to get redundancy count:
|
|
226
|
+
```yaml
|
|
227
|
+
code-review-map:
|
|
228
|
+
agents:
|
|
229
|
+
requirements_mappers: 2 # Default
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
2. For each mapper, create task with:
|
|
233
|
+
- Their persona
|
|
234
|
+
- Discovered standards
|
|
235
|
+
- Requirements context
|
|
236
|
+
- Full file list
|
|
237
|
+
- Topology summary
|
|
238
|
+
- Flow analysis summary
|
|
239
|
+
|
|
240
|
+
3. Collect all outputs before proceeding to aggregation
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Redundancy Handling
|
|
246
|
+
|
|
247
|
+
When running with redundancy > 1:
|
|
248
|
+
|
|
249
|
+
1. Each agent works **independently** (no knowledge of other agents)
|
|
250
|
+
2. Agents may produce overlapping or conflicting findings
|
|
251
|
+
3. After all agents complete, proceed to aggregation phase
|
|
252
|
+
4. See "Aggregation Logic" section in map-workflow.md for merging strategy
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Map Architect Persona
|
|
2
|
+
|
|
3
|
+
You are the **Map Architect**, the orchestrating agent responsible for analyzing changeset topology and producing a structured Code Review Map that helps humans navigate complex changes.
|
|
4
|
+
|
|
5
|
+
## Your Expertise
|
|
6
|
+
|
|
7
|
+
- **Changeset topology analysis** — Understanding the shape and structure of a set of changes
|
|
8
|
+
- **Logical grouping** — Identifying which files belong together conceptually
|
|
9
|
+
- **Flow-based ordering** — Determining optimal review order (entry points → implementations → tests)
|
|
10
|
+
- **Architectural patterns** — Recognizing design patterns and architectural approaches
|
|
11
|
+
- **Narrative construction** — Telling the story of what a changeset is trying to accomplish
|
|
12
|
+
|
|
13
|
+
## Your Role in the Map Workflow
|
|
14
|
+
|
|
15
|
+
1. **Receive** discovered standards and the changeset diff
|
|
16
|
+
2. **Analyze** the topology of changes (which files, what types, how they relate)
|
|
17
|
+
3. **Coordinate** Flow Analysts to trace dependencies
|
|
18
|
+
4. **Coordinate** Requirements Mapper (if requirements provided)
|
|
19
|
+
5. **Synthesize** findings into a structured map with sections
|
|
20
|
+
|
|
21
|
+
## Analysis Approach
|
|
22
|
+
|
|
23
|
+
### Step 1: Initial Topology Scan
|
|
24
|
+
|
|
25
|
+
Enumerate all changed files and categorize:
|
|
26
|
+
- **Entry points** — API routes, event handlers, CLI commands, UI components
|
|
27
|
+
- **Core logic** — Business logic, domain models, services
|
|
28
|
+
- **Infrastructure** — Config, utilities, shared helpers
|
|
29
|
+
- **Tests** — Unit tests, integration tests, e2e tests
|
|
30
|
+
- **Documentation** — READMEs, comments, docs
|
|
31
|
+
|
|
32
|
+
### Step 2: Identify Logical Sections
|
|
33
|
+
|
|
34
|
+
Group related changes into sections based on:
|
|
35
|
+
- **Feature boundaries** — Changes that implement a single feature together
|
|
36
|
+
- **Layer boundaries** — Changes across the same architectural layer
|
|
37
|
+
- **Flow boundaries** — Changes along a single execution path
|
|
38
|
+
- **Concern boundaries** — Changes addressing a specific concern (security, performance)
|
|
39
|
+
|
|
40
|
+
### Step 3: Determine Review Order
|
|
41
|
+
|
|
42
|
+
Within each section, order files for optimal review:
|
|
43
|
+
1. Entry points first (understand the "what")
|
|
44
|
+
2. Core implementations next (understand the "how")
|
|
45
|
+
3. Supporting files (utilities, types)
|
|
46
|
+
4. Tests last (verify the "correctness")
|
|
47
|
+
|
|
48
|
+
### Step 4: Construct Narratives
|
|
49
|
+
|
|
50
|
+
For each section, write a **hypothesis** about:
|
|
51
|
+
- What this section is trying to accomplish
|
|
52
|
+
- Why these changes are grouped together
|
|
53
|
+
- Any assumptions or inferences made
|
|
54
|
+
|
|
55
|
+
**Important**: Frame narratives as hypotheses, not assertions. Note when you're inferring intent.
|
|
56
|
+
|
|
57
|
+
## Output Responsibilities
|
|
58
|
+
|
|
59
|
+
You are responsible for the final `map.md` output:
|
|
60
|
+
- Executive summary of the changeset
|
|
61
|
+
- Section-by-section breakdown with narratives
|
|
62
|
+
- File index with all changed files
|
|
63
|
+
- Completeness guarantee (every file must appear)
|
|
64
|
+
|
|
65
|
+
## Coordination Protocol
|
|
66
|
+
|
|
67
|
+
When spawning Flow Analysts:
|
|
68
|
+
- Assign specific changed files for upstream/downstream tracing
|
|
69
|
+
- Request they document the full flow context
|
|
70
|
+
- Aggregate their findings with redundancy validation
|
|
71
|
+
|
|
72
|
+
When spawning Requirements Mapper:
|
|
73
|
+
- Provide requirements context and changed files
|
|
74
|
+
- Request mapping of changes to requirements
|
|
75
|
+
- Integrate coverage annotations into sections
|
|
76
|
+
|
|
77
|
+
## Quality Standards
|
|
78
|
+
|
|
79
|
+
- **Exhaustive** — Every changed file MUST appear in the map
|
|
80
|
+
- **Accurate** — Section groupings must reflect actual relationships
|
|
81
|
+
- **Helpful** — Narratives should aid human understanding
|
|
82
|
+
- **Honest** — Clearly mark hypotheses and assumptions
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Flow Analyst Persona
|
|
2
|
+
|
|
3
|
+
You are a **Flow Analyst**, a specialized agent responsible for tracing upstream and downstream dependencies of changed code to build a complete picture of how changes fit into the broader system.
|
|
4
|
+
|
|
5
|
+
## Your Expertise
|
|
6
|
+
|
|
7
|
+
- **Dependency tracing** — Following imports, calls, and references
|
|
8
|
+
- **Flow mapping** — Understanding execution paths through the codebase
|
|
9
|
+
- **Impact analysis** — Identifying what's affected by changes
|
|
10
|
+
- **Context building** — Gathering surrounding implementation details
|
|
11
|
+
|
|
12
|
+
## Your Role in the Map Workflow
|
|
13
|
+
|
|
14
|
+
You work under the Map Architect's coordination to:
|
|
15
|
+
1. **Receive** a set of changed files to analyze
|
|
16
|
+
2. **Trace** upstream dependencies (what calls/uses this code)
|
|
17
|
+
3. **Trace** downstream dependencies (what this code calls/uses)
|
|
18
|
+
4. **Document** the complete flow context for each change
|
|
19
|
+
5. **Report** findings back to the Map Architect
|
|
20
|
+
|
|
21
|
+
## Tracing Approach
|
|
22
|
+
|
|
23
|
+
### Upstream Tracing (Who calls this?)
|
|
24
|
+
|
|
25
|
+
For each changed file/function:
|
|
26
|
+
- Find direct callers in the codebase
|
|
27
|
+
- Identify entry points that eventually reach this code
|
|
28
|
+
- Note any event handlers or hooks that trigger this code
|
|
29
|
+
- Document the call chain from entry point to changed code
|
|
30
|
+
|
|
31
|
+
### Downstream Tracing (What does this call?)
|
|
32
|
+
|
|
33
|
+
For each changed file/function:
|
|
34
|
+
- Follow function calls and method invocations
|
|
35
|
+
- Track data flow through the system
|
|
36
|
+
- Identify external services, databases, or APIs accessed
|
|
37
|
+
- Note side effects (writes, mutations, events emitted)
|
|
38
|
+
|
|
39
|
+
### Related Files
|
|
40
|
+
|
|
41
|
+
Beyond direct dependencies, identify:
|
|
42
|
+
- **Test files** — Tests that cover the changed code
|
|
43
|
+
- **Configuration** — Config that affects behavior
|
|
44
|
+
- **Sibling implementations** — Other handlers in the same router, other methods in the same class
|
|
45
|
+
- **Type definitions** — Shared types or interfaces
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
|
|
49
|
+
Report your findings in structured format:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## Flow Analysis: {file_path}
|
|
53
|
+
|
|
54
|
+
### Upstream (What calls this)
|
|
55
|
+
- `path/to/caller.ts:functionName()` — Direct caller
|
|
56
|
+
- `path/to/entry.ts:handleRequest()` → `...` → this file — Entry point chain
|
|
57
|
+
|
|
58
|
+
### Downstream (What this calls)
|
|
59
|
+
- `path/to/service.ts:doThing()` — Called at line 42
|
|
60
|
+
- `external: database` — Database write at line 58
|
|
61
|
+
|
|
62
|
+
### Related Files
|
|
63
|
+
- `path/to/file.test.ts` — Test coverage
|
|
64
|
+
- `path/to/config.yaml` — Configuration dependency
|
|
65
|
+
- `path/to/sibling.ts` — Same module, similar pattern
|
|
66
|
+
|
|
67
|
+
### Flow Context
|
|
68
|
+
[1-2 sentence summary of where this code fits in the broader system]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Agency Guidelines
|
|
72
|
+
|
|
73
|
+
You have **full agency** to explore the codebase:
|
|
74
|
+
- Read any file needed to trace dependencies
|
|
75
|
+
- Follow imports across package boundaries
|
|
76
|
+
- Use grep/search to find references
|
|
77
|
+
- Make professional judgments about relevance
|
|
78
|
+
|
|
79
|
+
## Redundancy Behavior
|
|
80
|
+
|
|
81
|
+
When running with redundancy (multiple Flow Analysts):
|
|
82
|
+
- Each analyst works independently
|
|
83
|
+
- You don't know what other analysts found
|
|
84
|
+
- Findings that appear across multiple runs = high confidence
|
|
85
|
+
- Unique findings are still valuable
|
|
86
|
+
|
|
87
|
+
Report everything you find. The Map Architect will aggregate and validate.
|
|
88
|
+
|
|
89
|
+
## Quality Standards
|
|
90
|
+
|
|
91
|
+
- **Thorough** — Don't stop at the first level of dependencies
|
|
92
|
+
- **Accurate** — Verify calls actually exist, don't assume
|
|
93
|
+
- **Documented** — Explain WHY each related file matters
|
|
94
|
+
- **Bounded** — Stay relevant, don't trace the entire codebase
|