@open-code-review/agents 1.1.1 → 1.2.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 CHANGED
@@ -60,6 +60,28 @@ The `SKILL.md` file defines the **Tech Lead** role—the orchestrator that:
60
60
 
61
61
  Each reviewer in `references/reviewers/` is a specialized persona. You can customize the built-in reviewers or add your own.
62
62
 
63
+ ## Session Structure
64
+
65
+ OCR uses a **round-first architecture** for session storage:
66
+
67
+ ```
68
+ .ocr/sessions/{YYYY-MM-DD}-{branch}/
69
+ ├── state.json # Workflow state (current_round, phase)
70
+ ├── discovered-standards.md # Project context (shared across rounds)
71
+ ├── context.md # Change analysis (shared)
72
+ └── rounds/
73
+ ├── round-1/
74
+ │ ├── reviews/ # Individual reviewer outputs
75
+ │ ├── discourse.md # Cross-reviewer discussion
76
+ │ └── final.md # Synthesized review
77
+ └── round-2/ # Created on re-review
78
+ └── ...
79
+ ```
80
+
81
+ **Multi-round reviews**: Running `/ocr-review` again on an existing session creates a new round (`round-2/`, `round-3/`, etc.) if the previous round is complete. This enables iterative "review → fix → re-review" workflows while preserving history.
82
+
83
+ See `references/session-files.md` for the complete file manifest.
84
+
63
85
  ## Commands
64
86
 
65
87
  | File | Windsurf | Claude Code / Cursor |
package/commands/post.md CHANGED
@@ -21,8 +21,9 @@ tags: [ocr, github, pr]
21
21
 
22
22
  1. Verify `gh` is available and authenticated
23
23
  2. Find the PR for current branch
24
- 3. Read the session's `final.md`
25
- 4. Post as PR comment via `gh pr comment`
24
+ 3. Determine current round from `state.json` → `current_round` (or enumerate `rounds/` directory)
25
+ 4. Read the session's `rounds/round-{current_round}/final.md`
26
+ 5. Post as PR comment via `gh pr comment`
26
27
 
27
28
  **Reference**
28
29
  - Run `/ocr-doctor` to check GitHub CLI status
@@ -45,15 +45,18 @@ ls -la .ocr/sessions/$(date +%Y-%m-%d)-* 2>/dev/null
45
45
 
46
46
  ### Step 2: If session exists, verify state
47
47
 
48
- Read `state.json` AND verify actual files match:
48
+ Read `state.json` AND verify actual files match (see `references/session-files.md` for authoritative names):
49
49
 
50
- | Phase | state.json says | Verify file exists |
51
- |-------|-----------------|-------------------|
52
- | context | `completed_phases` includes "context" | `.ocr/sessions/{id}/context.md` |
53
- | requirements | `completed_phases` includes "requirements" | `.ocr/sessions/{id}/discovered-standards.md` |
54
- | reviews | `completed_phases` includes "reviews" | At least 2 files in `.ocr/sessions/{id}/reviews/` |
55
- | discourse | `completed_phases` includes "discourse" | `.ocr/sessions/{id}/discourse.md` |
56
- | synthesis | `completed_phases` includes "synthesis" | `.ocr/sessions/{id}/final.md` |
50
+ | Phase | Verify file exists |
51
+ |-------|-------------------|
52
+ | context | `.ocr/sessions/{id}/discovered-standards.md` |
53
+ | change-context | `.ocr/sessions/{id}/context.md` |
54
+ | analysis | `.ocr/sessions/{id}/context.md` (with Tech Lead guidance section) |
55
+ | reviews | At least 2 files in `.ocr/sessions/{id}/rounds/round-{n}/reviews/` |
56
+ | discourse | `.ocr/sessions/{id}/rounds/round-{n}/discourse.md` |
57
+ | synthesis | `.ocr/sessions/{id}/rounds/round-{n}/final.md` |
58
+
59
+ > **Note**: Phase completion is derived from filesystem (file existence), not from `state.json`. The `current_phase` field indicates which phase is active.
57
60
 
58
61
  ### Step 3: Determine action
59
62
 
@@ -67,27 +70,34 @@ Read `state.json` AND verify actual files match:
67
70
 
68
71
  ## ⚠️ CRITICAL: Required Artifacts (Must Create In Order)
69
72
 
73
+ > **See `references/session-files.md` for the authoritative file manifest.**
74
+
70
75
  You MUST create these files sequentially. **Do NOT skip to `final.md`.**
71
76
 
72
77
  ```
73
- .ocr/sessions/{id}/
74
- ├── context.md # Phase 2: WRITE FIRST - change summary
78
+ .ocr/sessions/{YYYY-MM-DD}-{branch}/
79
+ ├── state.json # Phase 1: session state (REQUIRED)
75
80
  ├── discovered-standards.md # Phase 1: merged project standards
76
- ├── reviews/
77
- ├── principal-1.md # Phase 4: individual reviewer output
78
- │ ├── principal-2.md # Phase 4: individual reviewer output
79
- │ ├── quality-1.md # Phase 4: individual reviewer output
80
- │ └── {reviewer}-{n}.md # Phase 4: individual reviewer output
81
- ├── discourse.md # Phase 6: reviewer cross-discussion
82
- └── final.md # Phase 7: ONLY after all above exist
81
+ ├── requirements.md # Phase 1: user requirements (if provided)
82
+ ├── context.md # Phase 2+3: change summary + Tech Lead guidance
83
+ └── rounds/
84
+ └── round-1/ # Review round (increments on re-review)
85
+ ├── reviews/
86
+ ├── principal-1.md # Phase 4: reviewer output
87
+ │ ├── principal-2.md # Phase 4: reviewer output
88
+ │ ├── quality-1.md # Phase 4: reviewer output
89
+ │ └── quality-2.md # Phase 4: reviewer output
90
+ ├── discourse.md # Phase 6: reviewer cross-discussion
91
+ └── final.md # Phase 7: ONLY after all above exist
83
92
  ```
84
93
 
85
94
  ### Checkpoint Rules
86
95
 
87
- 1. **Before Phase 4** (Spawn Reviewers): `context.md` MUST exist
88
- 2. **Before Phase 6** (Discourse): At least 2 files in `reviews/` MUST exist
89
- 3. **Before Phase 7** (Synthesis): `discourse.md` MUST exist
90
- 4. **NEVER** write `final.md` without completing Phases 1-6
96
+ 1. **Before Phase 2** (Change Analysis): `discovered-standards.md` MUST exist
97
+ 2. **Before Phase 4** (Spawn Reviewers): `context.md` MUST exist
98
+ 3. **Before Phase 6** (Discourse): At least 2 files in `rounds/round-{n}/reviews/` MUST exist
99
+ 4. **Before Phase 7** (Synthesis): `rounds/round-{n}/discourse.md` MUST exist
100
+ 5. **NEVER** write `rounds/round-{n}/final.md` without completing Phases 1-6
91
101
 
92
102
  ### Why This Matters
93
103
 
package/commands/show.md CHANGED
@@ -16,8 +16,9 @@ tags: [ocr, history, sessions]
16
16
  **Steps**
17
17
 
18
18
  1. If no session specified, find most recent in `.ocr/sessions/`
19
- 2. Read and display `final.md` (synthesized review)
20
- 3. Optionally show individual reviewer files if requested
19
+ 2. Determine current round from `state.json` → `current_round` (or enumerate `rounds/` directory)
20
+ 3. Read and display `rounds/round-{current_round}/final.md` (synthesized review)
21
+ 4. Optionally show individual reviewer files from `rounds/round-{n}/reviews/` if requested
21
22
 
22
23
  **Reference**
23
24
  - Use `/ocr-history` to list all sessions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-code-review/agents",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "AI-native skills, commands, and reviewer personas for Open Code Review",
5
5
  "type": "module",
6
6
  "files": [
@@ -36,6 +36,8 @@ When asked to perform a code review:
36
36
 
37
37
  - `SKILL.md` - Core skill definition and Tech Lead role
38
38
  - `references/workflow.md` - Complete 8-phase workflow
39
+ - `references/session-files.md` - **Authoritative session file manifest**
40
+ - `references/session-state.md` - State management and progress tracking
39
41
  - `references/synthesis.md` - How to synthesize findings
40
42
  - `references/discourse.md` - Multi-agent discourse rules
41
43
  - `references/reviewers/` - Reviewer persona definitions
@@ -135,13 +135,19 @@ For complete workflow details, see `references/workflow.md`.
135
135
 
136
136
  ## Session Storage
137
137
 
138
- All review artifacts are stored in `.ocr/sessions/{date}-{branch}/`:
139
- - `context.md` - Change summary
140
- - `requirements.md` - User-provided requirements/specs (if any)
141
- - `discovered-standards.md` - Merged project context
142
- - `reviews/{reviewer}-{n}.md` - Individual reviews
143
- - `discourse.md` - Discourse results
144
- - `final.md` - Synthesized final review
138
+ > **See `references/session-files.md` for the authoritative file manifest.**
139
+
140
+ All review artifacts are stored in `.ocr/sessions/{YYYY-MM-DD}-{branch}/`:
141
+
142
+ | File | Description |
143
+ |------|-------------|
144
+ | `state.json` | Session state for progress tracking |
145
+ | `discovered-standards.md` | Merged project context (shared) |
146
+ | `requirements.md` | User-provided requirements (shared, if any) |
147
+ | `context.md` | Change summary and Tech Lead guidance (shared) |
148
+ | `rounds/round-{n}/reviews/{type}-{n}.md` | Individual reviewer outputs (per-round) |
149
+ | `rounds/round-{n}/discourse.md` | Cross-reviewer discussion (per-round) |
150
+ | `rounds/round-{n}/final.md` | Synthesized final review (per-round) |
145
151
 
146
152
  ## Commands
147
153
 
@@ -145,10 +145,10 @@ done
145
145
 
146
146
  ## Output Format
147
147
 
148
- Save discovered context to session directory:
148
+ Save discovered context to session directory (see `references/session-files.md` for authoritative file names):
149
149
 
150
150
  ```
151
- .ocr/sessions/{id}/discovered-standards.md
151
+ .ocr/sessions/{YYYY-MM-DD}-{branch}/discovered-standards.md
152
152
  ```
153
153
 
154
154
  ### Example Output
@@ -29,14 +29,14 @@ Reviewers use these fixed response types (not user-configurable):
29
29
 
30
30
  ### Step 1: Compile Individual Reviews
31
31
 
32
- Gather all individual review outputs:
32
+ Gather all individual review outputs from the current round (see `references/session-files.md` for naming convention):
33
33
  ```
34
- reviews/principal-1.md
35
- reviews/principal-2.md
36
- reviews/quality-1.md
37
- reviews/quality-2.md
38
- reviews/security-1.md (if included)
39
- reviews/testing-1.md (if included)
34
+ rounds/round-{n}/reviews/principal-1.md
35
+ rounds/round-{n}/reviews/principal-2.md
36
+ rounds/round-{n}/reviews/quality-1.md
37
+ rounds/round-{n}/reviews/quality-2.md
38
+ rounds/round-{n}/reviews/security-1.md (if assigned)
39
+ rounds/round-{n}/reviews/testing-1.md (if assigned)
40
40
  ```
41
41
 
42
42
  ### Step 2: Present All Findings
@@ -110,7 +110,7 @@ SURFACE
110
110
 
111
111
  ### Step 5: Compile Discourse Results
112
112
 
113
- Save to `discourse.md`:
113
+ Save to `rounds/round-{n}/discourse.md`:
114
114
 
115
115
  ```markdown
116
116
  # Discourse Results
@@ -0,0 +1,215 @@
1
+ # Session File Manifest
2
+
3
+ > **This is the authoritative reference for session file naming.** All other documentation should reference this file for file names and structure.
4
+
5
+ ## Session Directory Structure
6
+
7
+ Every OCR session creates files in `.ocr/sessions/{session-id}/`:
8
+
9
+ ```
10
+ .ocr/sessions/{YYYY-MM-DD}-{branch}/
11
+ ├── state.json # Session state (REQUIRED)
12
+ ├── discovered-standards.md # Merged project context (shared across rounds)
13
+ ├── requirements.md # User-provided requirements (if any, shared)
14
+ ├── context.md # Phase 2+3: Change summary + Tech Lead guidance (shared)
15
+ └── rounds/ # All round-specific artifacts
16
+ ├── round-1/ # First review round
17
+ │ ├── reviews/ # Individual reviewer outputs
18
+ │ │ ├── principal-1.md
19
+ │ │ ├── principal-2.md
20
+ │ │ ├── quality-1.md
21
+ │ │ ├── quality-2.md
22
+ │ │ ├── security-1.md # (if security reviewer assigned)
23
+ │ │ ├── testing-1.md # (if testing reviewer assigned)
24
+ │ │ └── {type}-{n}.md # (additional assigned custom reviewers)
25
+ │ ├── discourse.md # Cross-reviewer discussion for round 1
26
+ │ └── final.md # Synthesized final review for round 1
27
+ └── round-2/ # Subsequent rounds (created on re-review)
28
+ ├── reviews/
29
+ │ └── ... # Same structure as round-1
30
+ ├── discourse.md
31
+ └── final.md
32
+ ```
33
+
34
+ ## Review Rounds
35
+
36
+ OCR uses a **round-first architecture** where all round-specific artifacts live under `rounds/round-{n}/`. This makes multi-round reviews a first-class concept.
37
+
38
+ **Round behavior**:
39
+ - First `/ocr-review` creates `rounds/round-1/` with `reviews/`, `discourse.md`, `final.md`
40
+ - Subsequent `/ocr-review` on same day/branch creates `rounds/round-{n+1}/`
41
+ - Previous rounds are preserved (never overwritten)
42
+ - Each round has its own `discourse.md` and `final.md`
43
+ - `state.json` tracks `current_round`; round metadata derived from filesystem
44
+
45
+ **Shared vs per-round artifacts**:
46
+ | Shared (session root) | Per-round (`rounds/round-{n}/`) |
47
+ |----------------------|--------------------------------|
48
+ | `state.json` | `reviews/*.md` |
49
+ | `discovered-standards.md` | `discourse.md` |
50
+ | `requirements.md` | `final.md` |
51
+ | `context.md` | |
52
+
53
+ **When to use multiple rounds**:
54
+ - Author addresses feedback and requests re-review
55
+ - Scope changes mid-review
56
+ - Different reviewer team composition needed
57
+
58
+ ## File Specifications
59
+
60
+ ### Required Files
61
+
62
+ | File | Phase | Description | Used By |
63
+ |------|-------|-------------|---------|
64
+ | `state.json` | 1 | Session state for progress tracking | CLI, resume logic |
65
+ | `discovered-standards.md` | 1 | Merged project context from config + references | All reviewers |
66
+ | `context.md` | 2 | Change summary, diff analysis, Tech Lead guidance | All reviewers |
67
+ | `rounds/round-{n}/reviews/{type}-{n}.md` | 4 | Individual reviewer outputs | Discourse, Synthesis |
68
+ | `rounds/round-{n}/discourse.md` | 6 | Cross-reviewer discussion results | Synthesis |
69
+ | `rounds/round-{n}/final.md` | 7 | Synthesized final review | Show, Post commands |
70
+
71
+ ### Optional Files
72
+
73
+ | File | When Created | Description |
74
+ |------|--------------|-------------|
75
+ | `requirements.md` | Phase 1 | User-provided requirements, specs, or acceptance criteria |
76
+
77
+ ## Reviewer File Naming
78
+
79
+ **Pattern**: `{type}-{n}.md`
80
+
81
+ - `{type}`: One of `principal`, `quality`, `security`, `testing`, or custom reviewer name
82
+ - `{n}`: Sequential number starting at 1
83
+
84
+ **Examples** (for round 1):
85
+ ```
86
+ rounds/round-1/reviews/principal-1.md
87
+ rounds/round-1/reviews/principal-2.md
88
+ rounds/round-1/reviews/quality-1.md
89
+ rounds/round-1/reviews/quality-2.md
90
+ rounds/round-1/reviews/security-1.md
91
+ rounds/round-1/reviews/testing-1.md
92
+ rounds/round-1/reviews/performance-1.md # Custom reviewer
93
+ ```
94
+
95
+ **Rules**:
96
+ - Always lowercase
97
+ - Use hyphens, not underscores
98
+ - Instance numbers are sequential per reviewer type
99
+ - Custom reviewers follow the same `{type}-{n}.md` pattern
100
+
101
+ ## Phase-to-File Mapping
102
+
103
+ | Phase | Phase Name | Files to Create/Update |
104
+ |-------|------------|------------------------|
105
+ | 1 | Context Discovery | `state.json`, `discovered-standards.md`, `requirements.md` (if provided) |
106
+ | 2 | Change Analysis | `context.md`, update `state.json` |
107
+ | 3 | Tech Lead Analysis | Update `context.md` with guidance, update `state.json` |
108
+ | 4 | Parallel Reviews | `rounds/round-{n}/reviews/{type}-{n}.md` for each reviewer, update `state.json` |
109
+ | 5 | Aggregation | (Inline analysis), update `state.json` |
110
+ | 6 | Discourse | `rounds/round-{n}/discourse.md`, update `state.json` |
111
+ | 7 | Synthesis | `rounds/round-{n}/final.md`, update `state.json` |
112
+ | 8 | Presentation | Set `state.json` status to `"closed"` |
113
+
114
+ ## State Transitions and File Validation
115
+
116
+ When updating `state.json`, verify the corresponding file exists:
117
+
118
+ | Phase | Verify file exists |
119
+ |---------------------------|-------------------|
120
+ | `"context"` | `discovered-standards.md` |
121
+ | `"change-context"` | `context.md` |
122
+ | `"analysis"` | `context.md` (with Tech Lead guidance) |
123
+ | `"reviews"` | At least 2 files in `rounds/round-{current_round}/reviews/` |
124
+ | `"discourse"` | `rounds/round-{current_round}/discourse.md` |
125
+ | `"synthesis"` | `rounds/round-{current_round}/final.md` |
126
+
127
+ ## Session ID Format
128
+
129
+ **Pattern**: `{YYYY-MM-DD}-{branch-name}`
130
+
131
+ > **Shorthand**: In documentation, `{id}` and `{session-id}` are aliases for the full `{YYYY-MM-DD}-{branch-name}` format.
132
+
133
+ - Date in ISO format (YYYY-MM-DD)
134
+ - Branch name with `/` replaced by `-`
135
+
136
+ **Examples**:
137
+ ```
138
+ 2026-01-27-main
139
+ 2026-01-27-feat-add-auth
140
+ 2026-01-27-fix-bug-123
141
+ ```
142
+
143
+ **Generation**:
144
+ ```bash
145
+ SESSION_ID="$(date +%Y-%m-%d)-$(git branch --show-current | tr '/' '-')"
146
+ ```
147
+
148
+ ## File Content Requirements
149
+
150
+ ### state.json (Minimal Schema)
151
+
152
+ ```json
153
+ {
154
+ "session_id": "{session-id}",
155
+ "status": "active",
156
+ "current_phase": "{phase-name}",
157
+ "phase_number": 4,
158
+ "current_round": 1,
159
+ "started_at": "{ISO-8601-timestamp}",
160
+ "round_started_at": "{ISO-8601-timestamp}",
161
+ "updated_at": "{ISO-8601-timestamp}"
162
+ }
163
+ ```
164
+
165
+ > **Note**: `round_started_at` is set when starting a new round (> 1) for accurate per-round timing display.
166
+
167
+ **Derived from filesystem** (not stored in state.json):
168
+ - Round count: enumerate `rounds/round-*/` directories
169
+ - Round completion: check for `final.md` in round directory
170
+ - Reviewers in round: list files in `rounds/round-{n}/reviews/`
171
+ - Discourse complete: check for `discourse.md` in round directory
172
+
173
+ See `references/session-state.md` for complete state management details.
174
+
175
+ ### Reviewer Files
176
+
177
+ Each `rounds/round-{n}/reviews/{type}-{n}.md` must include:
178
+ - Summary section
179
+ - Findings with severity, location, and suggestions
180
+ - What's Working Well section
181
+ - Questions for Other Reviewers section
182
+
183
+ See `references/reviewer-task.md` for complete output format.
184
+
185
+ ### final.md
186
+
187
+ Must include:
188
+ - Verdict (APPROVE / REQUEST CHANGES / NEEDS DISCUSSION)
189
+ - Blockers section (if any)
190
+ - Suggestions section
191
+ - Requirements Assessment (if requirements provided)
192
+ - Clarifying Questions section
193
+ - Individual Reviews table with file references
194
+
195
+ See `references/synthesis.md` for complete template.
196
+
197
+ ## CLI Dependencies
198
+
199
+ The `ocr progress` CLI depends on these exact file names:
200
+
201
+ | CLI Feature | Files Read |
202
+ |-------------|-----------|
203
+ | Session detection | `state.json` |
204
+ | Phase tracking | `state.json` → `current_phase` |
205
+ | Current round | `state.json` → `current_round` (reconciled with filesystem) |
206
+ | Reviewer progress | `rounds/round-{n}/reviews/*.md` file existence |
207
+ | Round completion | `rounds/round-{n}/final.md` existence |
208
+ | Elapsed time | `state.json` → `started_at` |
209
+
210
+ **Filesystem as truth**: The CLI derives round metadata from the filesystem, using `state.json` as a hint. If state.json is missing or inconsistent, the CLI reconstructs state by:
211
+ 1. Enumerating `rounds/round-*/` to count rounds
212
+ 2. Checking `final.md` presence to determine completion
213
+ 3. Listing `reviews/*.md` to identify reviewers
214
+
215
+ **IMPORTANT**: Non-standard file names will break progress tracking.
@@ -18,25 +18,34 @@ This means:
18
18
  - Running `npx @open-code-review/cli progress` from any project picks up the session state
19
19
  - No configuration needed — the CLI always looks in `.ocr/sessions/`
20
20
 
21
- ## State File Format
21
+ ## State File Format (Minimal Schema)
22
22
 
23
23
  ```json
24
24
  {
25
25
  "session_id": "{session-id}",
26
- "branch": "{branch-name}",
27
26
  "status": "active",
28
- "started_at": "{ISO-8601-TIMESTAMP}",
29
27
  "current_phase": "reviews",
30
28
  "phase_number": 4,
31
- "completed_phases": ["context", "requirements", "analysis"],
32
- "reviewers": {
33
- "assigned": ["principal-1", "principal-2", "quality-1", "quality-2"],
34
- "complete": ["principal-1"]
35
- },
29
+ "current_round": 1,
30
+ "started_at": "{ISO-8601-TIMESTAMP}",
31
+ "round_started_at": "{ISO-8601-TIMESTAMP}",
36
32
  "updated_at": "{ISO-8601-TIMESTAMP}"
37
33
  }
38
34
  ```
39
35
 
36
+ **Minimal by design**: Round metadata is derived from the filesystem, not stored in state.json.
37
+
38
+ **Field descriptions**:
39
+ - `started_at`: When the session was created (first `/ocr-review`)
40
+ - `round_started_at`: When the current round began (updated when starting round > 1)
41
+ - `updated_at`: Last modification time (updated at every phase transition)
42
+
43
+ **Derived from filesystem** (not stored):
44
+ - Round count: enumerate `rounds/round-*/` directories
45
+ - Round completion: check for `final.md` in round directory
46
+ - Reviewers in round: list files in `rounds/round-{n}/reviews/`
47
+ - Discourse complete: check for `discourse.md` in round directory
48
+
40
49
  **IMPORTANT**: Timestamps MUST be generated dynamically using the current time in ISO 8601 format (e.g., `new Date().toISOString()` → `"2026-01-27T09:45:00.000Z"`). Do NOT copy example timestamps.
41
50
 
42
51
  ## Session Status
@@ -57,17 +66,19 @@ The `ocr progress` command only auto-detects sessions with `status: "active"`. C
57
66
 
58
67
  ## Phase Transitions
59
68
 
69
+ > **See `references/session-files.md` for the authoritative file manifest.**
70
+
60
71
  The Tech Lead MUST update `state.json` at each phase boundary:
61
72
 
62
- | Phase | When to Update |
63
- |-------|---------------|
64
- | context | After writing `discovered-standards.md` |
65
- | requirements | After writing `requirements.md` (if any) |
66
- | analysis | After writing `context.md` with guidance |
67
- | reviews | After spawning each reviewer (update `reviewers.complete`) |
68
- | discourse | After writing `discourse.md` |
69
- | synthesis | After writing `final.md` |
70
- | complete | After presenting to user, set `status: "closed"` |
73
+ | Phase | When to Update | File Created |
74
+ |-------|---------------|--------------|
75
+ | context | After writing project standards | `discovered-standards.md` |
76
+ | change-context | After writing change summary | `context.md`, `requirements.md` (if provided) |
77
+ | analysis | After adding Tech Lead guidance | Update `context.md` |
78
+ | reviews | After each reviewer completes | `rounds/round-{n}/reviews/{type}-{n}.md` |
79
+ | discourse | After cross-reviewer discussion | `rounds/round-{n}/discourse.md` |
80
+ | synthesis | After final review | `rounds/round-{n}/final.md` |
81
+ | complete | After presenting to user | Set `status: "closed"` |
71
82
 
72
83
  ## Writing State
73
84
 
@@ -95,7 +106,7 @@ When creating a new session (Phase 1 start):
95
106
  "status": "active",
96
107
  "current_phase": "context",
97
108
  "phase_number": 1,
98
- "completed_phases": [],
109
+ "current_round": 1,
99
110
  "started_at": "{CURRENT_ISO_TIMESTAMP}",
100
111
  "updated_at": "{CURRENT_ISO_TIMESTAMP}"
101
112
  }
@@ -109,11 +120,7 @@ When transitioning phases (preserve `started_at`, update `updated_at`):
109
120
  "status": "active",
110
121
  "current_phase": "reviews",
111
122
  "phase_number": 4,
112
- "completed_phases": ["context", "requirements", "analysis"],
113
- "reviewers": {
114
- "assigned": ["principal-1", "principal-2", "quality-1", "quality-2"],
115
- "complete": []
116
- },
123
+ "current_round": 1,
117
124
  "started_at": "{PRESERVE_ORIGINAL}",
118
125
  "updated_at": "{CURRENT_ISO_TIMESTAMP}"
119
126
  }
@@ -127,7 +134,7 @@ When closing a session (Phase 8 complete):
127
134
  "status": "closed",
128
135
  "current_phase": "complete",
129
136
  "phase_number": 8,
130
- "completed_phases": ["context", "requirements", "analysis", "reviews", "aggregation", "discourse", "synthesis"],
137
+ "current_round": 1,
131
138
  "started_at": "{PRESERVE_ORIGINAL}",
132
139
  "updated_at": "{CURRENT_ISO_TIMESTAMP}"
133
140
  }
@@ -143,6 +150,13 @@ When closing a session (Phase 8 complete):
143
150
 
144
151
  ## Important
145
152
 
146
- The `state.json` file is **required** for progress tracking. The CLI does NOT fall back to file existence checks. If `state.json` is missing or invalid, the progress command will show "Waiting for session..."
153
+ The `state.json` file is the **primary** source for workflow progress. However, with the round-first architecture:
154
+
155
+ - **Filesystem is truth for round data**: Round count, completion, and reviewers are derived from `rounds/` directory structure
156
+ - **state.json is truth for workflow state**: `current_phase`, `phase_number`, `status`, timestamps
157
+ - **Reconciliation**: If state.json and filesystem disagree, the CLI reconciles by trusting the filesystem for round data
147
158
 
148
- This ensures a single, dependable source of truth for session state.
159
+ If `state.json` is missing entirely, the CLI will show "Waiting for session..." until the orchestrating agent creates `state.json`. Future versions may implement filesystem reconstruction to derive:
160
+ 1. Round count from `rounds/round-*/` directories
161
+ 2. Round completion from `final.md` presence
162
+ 3. Approximate phase from file existence
@@ -28,11 +28,11 @@ This synthesis process is designed to mirror how high-performing engineering tea
28
28
 
29
29
  ### Step 1: Gather All Feedback
30
30
 
31
- Collect without filtering:
32
- - All individual reviews (`reviews/*.md`)
33
- - Discourse results (`discourse.md`) if available
31
+ Collect without filtering (see `references/session-files.md` for file names):
32
+ - All individual reviews from current round (`rounds/round-{n}/reviews/{type}-{n}.md`)
33
+ - Discourse results (`rounds/round-{n}/discourse.md`) if available
34
34
  - Requirements context (`requirements.md`) if provided
35
- - Tech Lead's original analysis
35
+ - Tech Lead's original analysis from `context.md`
36
36
 
37
37
  **Critical**: Do not discard or "deduplicate away" any reviewer feedback at this stage.
38
38
 
@@ -270,13 +270,13 @@ Full reviews available in session directory:
270
270
 
271
271
  | Reviewer | Blockers | Suggestions | File |
272
272
  |----------|----------|-------------|------|
273
- | @principal-1 | 0 | 3 | `reviews/principal-1.md` |
274
- | @principal-2 | 0 | 2 | `reviews/principal-2.md` |
275
- | @quality-1 | 0 | 4 | `reviews/quality-1.md` |
276
- | @security-1 | 1 | 2 | `reviews/security-1.md` |
273
+ | @principal-1 | 0 | 3 | `rounds/round-{n}/reviews/principal-1.md` |
274
+ | @principal-2 | 0 | 2 | `rounds/round-{n}/reviews/principal-2.md` |
275
+ | @quality-1 | 0 | 4 | `rounds/round-{n}/reviews/quality-1.md` |
276
+ | @security-1 | 1 | 2 | `rounds/round-{n}/reviews/security-1.md` |
277
277
 
278
278
  **Session**: `.ocr/sessions/{session-id}/`
279
- **Discourse**: `discourse.md`
279
+ **Discourse**: `rounds/round-{n}/discourse.md`
280
280
  ```
281
281
 
282
282
  ---
@@ -2,7 +2,7 @@
2
2
 
3
3
  Complete 8-phase process for multi-agent code review.
4
4
 
5
- > ⚠️ **CRITICAL**: You MUST update `state.json` at each phase transition. The `ocr progress` CLI reads this file for accurate tracking.
5
+ > ⚠️ **CRITICAL**: You MUST update `state.json` **BEFORE starting work** on each phase. The `ocr progress` CLI reads this file for real-time tracking. Update the `current_phase` and `phase_number` immediately when transitioning—do not wait until the phase is complete.
6
6
 
7
7
  ---
8
8
 
@@ -27,21 +27,54 @@ ls -la "$SESSION_DIR" 2>/dev/null
27
27
  Delete the existing session and start from scratch:
28
28
  ```bash
29
29
  rm -rf "$SESSION_DIR"
30
- mkdir -p "$SESSION_DIR/reviews"
30
+ mkdir -p "$SESSION_DIR/rounds/round-1/reviews"
31
31
  ```
32
32
  Then proceed to Phase 1.
33
33
 
34
34
  ### Step 3: If session exists, verify state matches files
35
35
 
36
- Read `state.json` and verify actual files exist:
36
+ Read `state.json` and verify actual files exist (see `references/session-files.md` for authoritative names):
37
37
 
38
- | Phase Complete? | state.json check | File check |
39
- |-----------------|------------------|------------|
40
- | context | `"context"` in `completed_phases` | `context.md` exists |
41
- | requirements | `"requirements"` in `completed_phases` | `discovered-standards.md` exists |
42
- | reviews | `"reviews"` in `completed_phases` | ≥2 files in `reviews/` |
43
- | discourse | `"discourse"` in `completed_phases` | `discourse.md` exists |
44
- | synthesis | `"synthesis"` in `completed_phases` | `final.md` exists |
38
+ | Phase Complete? | File check |
39
+ |-----------------|------------|
40
+ | context | `discovered-standards.md` exists |
41
+ | change-context | `context.md` exists |
42
+ | analysis | `context.md` has Tech Lead guidance section |
43
+ | reviews | ≥2 files in `rounds/round-{current_round}/reviews/` |
44
+ | discourse | `rounds/round-{current_round}/discourse.md` exists |
45
+ | synthesis | `rounds/round-{current_round}/final.md` exists |
46
+
47
+ > **Note**: Phase completion is derived from filesystem (file existence). The `current_phase` field in `state.json` indicates which phase is active, not what's complete.
48
+
49
+ ### Step 3b: Round Resolution Algorithm
50
+
51
+ Determine which round to use:
52
+
53
+ ```bash
54
+ ROUNDS_DIR="$SESSION_DIR/rounds"
55
+
56
+ # Count existing rounds
57
+ if [ ! -d "$ROUNDS_DIR" ]; then
58
+ CURRENT_ROUND=1
59
+ mkdir -p "$ROUNDS_DIR/round-1/reviews"
60
+ else
61
+ # Find highest round number
62
+ HIGHEST=$(ls -1 "$ROUNDS_DIR" | grep -E '^round-[0-9]+$' | sed 's/round-//' | sort -n | tail -1)
63
+ HIGHEST=${HIGHEST:-0}
64
+
65
+ # Check if highest round is complete (has final.md)
66
+ if [ -f "$ROUNDS_DIR/round-$HIGHEST/final.md" ]; then
67
+ # Start new round
68
+ CURRENT_ROUND=$((HIGHEST + 1))
69
+ mkdir -p "$ROUNDS_DIR/round-$CURRENT_ROUND/reviews"
70
+ else
71
+ # Resume existing round
72
+ CURRENT_ROUND=$HIGHEST
73
+ fi
74
+ fi
75
+ ```
76
+
77
+ Update `state.json` with `current_round` value. **When starting a new round (CURRENT_ROUND > 1), also set `round_started_at` to the current timestamp** so the CLI progress timer shows elapsed time for the current round, not the entire session.
45
78
 
46
79
  ### Step 4: Determine resume point
47
80
 
@@ -56,7 +89,6 @@ Before proceeding, tell the user:
56
89
  ```
57
90
  📍 Session: {session_id}
58
91
  📊 Current phase: {current_phase} (Phase {phase_number}/8)
59
- ✅ Completed: {completed_phases}
60
92
  🔄 Action: [Starting fresh | Resuming from Phase X]
61
93
  ```
62
94
 
@@ -72,32 +104,37 @@ At **every phase transition**, update `.ocr/sessions/{id}/state.json`:
72
104
  "status": "active",
73
105
  "current_phase": "reviews",
74
106
  "phase_number": 4,
75
- "completed_phases": ["context", "requirements", "analysis"],
107
+ "current_round": 1,
76
108
  "started_at": "{PRESERVE_ORIGINAL}",
109
+ "round_started_at": "{CURRENT_ISO_TIMESTAMP}",
77
110
  "updated_at": "{CURRENT_ISO_TIMESTAMP}"
78
111
  }
79
112
  ```
80
113
 
81
- **CRITICAL**: Generate timestamps dynamically (e.g., `date -u +"%Y-%m-%dT%H:%M:%SZ"` on macOS/Linux). Preserve `started_at` from session creation; always update `updated_at` with current time.
114
+ **Minimal schema** round metadata is derived from filesystem, not stored in state.json.
115
+
116
+ **CRITICAL**: Generate timestamps dynamically (e.g., `date -u +"%Y-%m-%dT%H:%M:%SZ"` on macOS/Linux). Preserve `started_at` from session creation; set `round_started_at` when starting a new round (> 1); always update `updated_at` with current time.
82
117
 
83
118
  **Status values**: `active` (in progress), `closed` (complete and dismissed)
84
119
 
85
- **Phase values**: `context`, `requirements`, `analysis`, `reviews`, `aggregation`, `discourse`, `synthesis`, `complete`
120
+ **Phase values**: `context`, `change-context`, `analysis`, `reviews`, `aggregation`, `discourse`, `synthesis`, `complete`
86
121
 
87
122
  ## Artifact Checklist
88
123
 
124
+ > **See `references/session-files.md` for the authoritative file manifest.**
125
+
89
126
  Before proceeding to each phase, verify the required artifacts exist:
90
127
 
91
128
  | Phase | Required Before Starting | Artifact to Create |
92
129
  |-------|-------------------------|-------------------|
93
- | 1 | Session directory created | `discovered-standards.md`, `state.json` |
94
- | 2 | | `context.md`, update `state.json` |
95
- | 3 | `context.md` exists | Tech Lead guidance (inline), update `state.json` |
96
- | 4 | `context.md` exists | `reviews/{reviewer}-{n}.md`, update `state.json` |
97
- | 5 | ≥2 files in `reviews/` | Aggregated findings (inline), update `state.json` |
98
- | 6 | Reviews complete | `discourse.md`, update `state.json` |
99
- | 7 | `discourse.md` exists | `final.md`, update `state.json` |
100
- | 8 | `final.md` exists | Present to user, set `status: "closed"` and `current_phase: "complete"` |
130
+ | 1 | Session directory created | `state.json`, `discovered-standards.md`, `requirements.md` (if provided) |
131
+ | 2 | `discovered-standards.md` exists | `context.md`, `rounds/round-1/reviews/` directory, update `state.json` |
132
+ | 3 | `context.md` exists | Update `context.md` with Tech Lead guidance, update `state.json` |
133
+ | 4 | `context.md` exists | `rounds/round-{n}/reviews/{type}-{n}.md` for each reviewer, update `state.json` |
134
+ | 5 | ≥2 files in `rounds/round-{n}/reviews/` | Aggregated findings (inline), update `state.json` |
135
+ | 6 | Reviews complete | `rounds/round-{n}/discourse.md`, update `state.json` |
136
+ | 7 | `rounds/round-{n}/discourse.md` exists | `rounds/round-{n}/final.md`, update `state.json` |
137
+ | 8 | `rounds/round-{n}/final.md` exists | Present to user, set `status: "closed"` and `current_phase: "complete"` |
101
138
 
102
139
  **NEVER skip directly to `final.md`** — this breaks progress tracking.
103
140
 
@@ -243,7 +280,7 @@ See `references/context-discovery.md` for detailed algorithm.
243
280
  3. Create session directory:
244
281
  ```bash
245
282
  SESSION_ID="$(date +%Y-%m-%d)-$(git branch --show-current | tr '/' '-')"
246
- mkdir -p .ocr/sessions/$SESSION_ID/reviews
283
+ mkdir -p .ocr/sessions/$SESSION_ID/rounds/round-1/reviews
247
284
  ```
248
285
 
249
286
  4. Save context to `context.md`:
@@ -267,7 +304,7 @@ See `references/context-discovery.md` for detailed algorithm.
267
304
 
268
305
  **STOP and verify before proceeding:**
269
306
  - [ ] Session directory created: `.ocr/sessions/{id}/`
270
- - [ ] `reviews/` subdirectory created
307
+ - [ ] `rounds/round-1/reviews/` subdirectory created
271
308
  - [ ] `context.md` written with change summary
272
309
 
273
310
  ---
@@ -370,16 +407,16 @@ See `references/context-discovery.md` for detailed algorithm.
370
407
  - The diff to review
371
408
  - **Instruction to explore codebase with full agency**
372
409
 
373
- 4. Save each review to `.ocr/sessions/{id}/reviews/{reviewer}-{n}.md`.
410
+ 4. Save each review to `.ocr/sessions/{id}/rounds/round-{current_round}/reviews/{type}-{n}.md`.
374
411
 
375
412
  See `references/reviewer-task.md` for the task template.
376
413
 
377
414
  ### ✅ Phase 4 Checkpoint
378
415
 
379
416
  **STOP and verify before proceeding:**
380
- - [ ] At least 4 review files exist in `reviews/` directory
417
+ - [ ] At least 4 review files exist in `rounds/round-{n}/reviews/` directory
381
418
  - [ ] Each review file contains findings (even if "no issues found")
382
- - [ ] File naming follows `{reviewer}-{n}.md` pattern
419
+ - [ ] File naming follows `{type}-{n}.md` pattern (e.g., `principal-1.md`, `quality-2.md`)
383
420
 
384
421
  ---
385
422
 
@@ -425,14 +462,14 @@ See `references/reviewer-task.md` for the task template.
425
462
  - **CONNECT**: "This relates to my maintainability concern..."
426
463
  - **SURFACE**: "Based on this discussion, I notice..."
427
464
 
428
- 3. Save discourse to `.ocr/sessions/{id}/discourse.md`.
465
+ 3. Save discourse to `.ocr/sessions/{id}/rounds/round-{current_round}/discourse.md`.
429
466
 
430
467
  See `references/discourse.md` for detailed instructions.
431
468
 
432
469
  ### ✅ Phase 6 Checkpoint
433
470
 
434
471
  **STOP and verify before proceeding:**
435
- - [ ] `discourse.md` written to session directory
472
+ - [ ] `rounds/round-{n}/discourse.md` written to round directory
436
473
  - [ ] Contains AGREE/CHALLENGE/CONNECT/SURFACE responses
437
474
  - [ ] (Or if `--quick` flag: skip this phase, proceed to synthesis)
438
475
 
@@ -474,14 +511,14 @@ See `references/discourse.md` for detailed instructions.
474
511
 
475
512
  These go in a prominent "Clarifying Questions" section for stakeholder response.
476
513
 
477
- 7. Save to `.ocr/sessions/{id}/final.md`.
514
+ 7. Save to `.ocr/sessions/{id}/rounds/round-{current_round}/final.md`.
478
515
 
479
516
  See `references/synthesis.md` for template.
480
517
 
481
518
  ### ✅ Phase 7 Checkpoint
482
519
 
483
520
  **STOP and verify before proceeding:**
484
- - [ ] `final.md` written to session directory
521
+ - [ ] `rounds/round-{n}/final.md` written to round directory
485
522
  - [ ] Contains prioritized findings (Must Fix, Should Fix, Consider)
486
523
  - [ ] Contains Clarifying Questions section (if any)
487
524
  - [ ] If requirements provided: Contains Requirements Assessment
@@ -519,7 +556,7 @@ See `references/synthesis.md` for template.
519
556
  "status": "closed",
520
557
  "current_phase": "complete",
521
558
  "phase_number": 8,
522
- "completed_phases": ["context", "requirements", "analysis", "reviews", "aggregation", "discourse", "synthesis"],
559
+ "current_round": 1,
523
560
  "updated_at": "{now}"
524
561
  }
525
562
  ```
@@ -532,7 +569,7 @@ See `references/synthesis.md` for template.
532
569
  4. Confirm session saved:
533
570
  ```
534
571
  ✓ Review complete
535
- → .ocr/sessions/{id}/final.md
572
+ → .ocr/sessions/{id}/rounds/round-{n}/final.md
536
573
  ```
537
574
 
538
575
  ---
@@ -541,11 +578,11 @@ See `references/synthesis.md` for template.
541
578
 
542
579
  | Phase | Command/Action | Output |
543
580
  |-------|---------------|--------|
544
- | 1 | Search for context files | discovered-standards.md |
545
- | 2 | git diff, create session | context.md |
546
- | 3 | Analyze, select reviewers | guidance in context.md |
547
- | 4 | Spawn reviewer tasks | reviews/*.md |
581
+ | 1 | Search for context files | `discovered-standards.md` |
582
+ | 2 | git diff, create session | `context.md`, `rounds/round-1/reviews/` |
583
+ | 3 | Analyze, select reviewers | guidance in `context.md` |
584
+ | 4 | Spawn reviewer tasks | `rounds/round-{n}/reviews/*.md` |
548
585
  | 5 | Compare redundant runs | aggregated findings |
549
- | 6 | Reviewer discourse | discourse.md |
550
- | 7 | Synthesize and prioritize | final.md |
586
+ | 6 | Reviewer discourse | `rounds/round-{n}/discourse.md` |
587
+ | 7 | Synthesize and prioritize | `rounds/round-{n}/final.md` |
551
588
  | 8 | Display/post | Terminal output, GitHub |