@open-code-review/agents 1.3.1 → 1.5.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 +35 -1
- package/commands/address.md +117 -0
- package/commands/map.md +170 -0
- package/commands/post.md +14 -3
- package/commands/review.md +25 -10
- package/commands/show.md +1 -1
- package/commands/translate-review-to-single-human.md +116 -0
- package/package.json +1 -1
- package/skills/ocr/AGENTS.md +5 -1
- package/skills/ocr/SKILL.md +12 -1
- package/skills/ocr/assets/config.yaml +12 -0
- 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 +273 -0
- package/skills/ocr/references/map-workflow.md +717 -0
- package/skills/ocr/references/session-files.md +57 -47
- package/skills/ocr/references/session-state.md +145 -75
- package/skills/ocr/references/setup-guard.md +20 -0
- package/skills/ocr/references/workflow.md +155 -121
|
@@ -8,10 +8,18 @@ Every OCR session creates files in `.ocr/sessions/{session-id}/`:
|
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
.ocr/sessions/{YYYY-MM-DD}-{branch}/
|
|
11
|
-
├── state.json # Session state (REQUIRED)
|
|
12
11
|
├── discovered-standards.md # Merged project context (shared across rounds)
|
|
13
12
|
├── requirements.md # User-provided requirements (if any, shared)
|
|
14
13
|
├── context.md # Phase 2+3: Change summary + Tech Lead guidance (shared)
|
|
14
|
+
├── map/ # Code Review Map artifacts (optional)
|
|
15
|
+
│ └── runs/
|
|
16
|
+
│ ├── run-1/ # First map generation
|
|
17
|
+
│ │ ├── topology.md # File categorization and sections
|
|
18
|
+
│ │ ├── flow-analysis.md # Dependency tracing results
|
|
19
|
+
│ │ ├── requirements-mapping.md # Coverage matrix (if requirements)
|
|
20
|
+
│ │ └── map.md # Final map output
|
|
21
|
+
│ └── run-2/ # Subsequent runs (created on re-map)
|
|
22
|
+
│ └── ... # Same structure as run-1
|
|
15
23
|
└── rounds/ # All round-specific artifacts
|
|
16
24
|
├── round-1/ # First review round
|
|
17
25
|
│ ├── reviews/ # Individual reviewer outputs
|
|
@@ -40,28 +48,51 @@ OCR uses a **round-first architecture** where all round-specific artifacts live
|
|
|
40
48
|
- Subsequent `/ocr-review` on same day/branch creates `rounds/round-{n+1}/`
|
|
41
49
|
- Previous rounds are preserved (never overwritten)
|
|
42
50
|
- Each round has its own `discourse.md` and `final.md`
|
|
43
|
-
- `
|
|
51
|
+
- SQLite tracks `current_round` via `ocr state show`; round metadata derived from filesystem
|
|
44
52
|
|
|
45
|
-
**Shared vs per-round artifacts**:
|
|
46
|
-
| Shared (session root) | Per-round (`rounds/round-{n}/`) |
|
|
47
|
-
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
53
|
+
**Shared vs per-round/run artifacts**:
|
|
54
|
+
| Shared (session root) | Per-round (`rounds/round-{n}/`) | Per-run (`map/runs/run-{n}/`) |
|
|
55
|
+
|----------------------|--------------------------------|-------------------------------|
|
|
56
|
+
| `discovered-standards.md` | `reviews/*.md` | `topology.md` |
|
|
57
|
+
| `requirements.md` | `discourse.md` | `flow-analysis.md` |
|
|
58
|
+
| `context.md` | `final.md` | `requirements-mapping.md` |
|
|
59
|
+
| | | `map.md` |
|
|
52
60
|
|
|
53
61
|
**When to use multiple rounds**:
|
|
54
62
|
- Author addresses feedback and requests re-review
|
|
55
63
|
- Scope changes mid-review
|
|
56
64
|
- Different reviewer team composition needed
|
|
57
65
|
|
|
66
|
+
## Map Runs
|
|
67
|
+
|
|
68
|
+
OCR uses a **run-based architecture** for maps, parallel to review rounds.
|
|
69
|
+
|
|
70
|
+
**Run behavior**:
|
|
71
|
+
- First `/ocr-map` creates `map/runs/run-1/` with map artifacts
|
|
72
|
+
- Subsequent `/ocr-map` on same day/branch creates `map/runs/run-{n+1}/`
|
|
73
|
+
- Previous runs are preserved (never overwritten)
|
|
74
|
+
- Each run produces a complete `map.md`
|
|
75
|
+
- SQLite tracks `current_map_run` via `ocr state show`; run metadata derived from filesystem
|
|
76
|
+
|
|
77
|
+
**Map artifacts per run**:
|
|
78
|
+
| File | Phase | Description |
|
|
79
|
+
|------|-------|-------------|
|
|
80
|
+
| `topology.md` | 2 | File categorization and section groupings |
|
|
81
|
+
| `flow-analysis.md` | 3 | Upstream/downstream dependency tracing |
|
|
82
|
+
| `requirements-mapping.md` | 4 | Requirements coverage matrix (if requirements provided) |
|
|
83
|
+
| `map.md` | 5 | Final synthesized Code Review Map |
|
|
84
|
+
|
|
85
|
+
**When to use multiple runs**:
|
|
86
|
+
- Changeset has evolved since last map
|
|
87
|
+
- Different requirements context needed
|
|
88
|
+
- Fresh analysis desired after code updates
|
|
89
|
+
|
|
58
90
|
## File Specifications
|
|
59
91
|
|
|
60
92
|
### Required Files
|
|
61
93
|
|
|
62
94
|
| File | Phase | Description | Used By |
|
|
63
95
|
|------|-------|-------------|---------|
|
|
64
|
-
| `state.json` | 1 | Session state for progress tracking | CLI, resume logic |
|
|
65
96
|
| `discovered-standards.md` | 1 | Merged project context from config + references | All reviewers |
|
|
66
97
|
| `context.md` | 2 | Change summary, diff analysis, Tech Lead guidance | All reviewers |
|
|
67
98
|
| `rounds/round-{n}/reviews/{type}-{n}.md` | 4 | Individual reviewer outputs | Discourse, Synthesis |
|
|
@@ -102,18 +133,18 @@ rounds/round-1/reviews/performance-1.md # Custom reviewer
|
|
|
102
133
|
|
|
103
134
|
| Phase | Phase Name | Files to Create/Update |
|
|
104
135
|
|-------|------------|------------------------|
|
|
105
|
-
| 1 | Context Discovery | `
|
|
106
|
-
| 2 | Change Analysis | `context.md`,
|
|
107
|
-
| 3 | Tech Lead Analysis | Update `context.md` with guidance,
|
|
108
|
-
| 4 | Parallel Reviews | `rounds/round-{n}/reviews/{type}-{n}.md` for each reviewer,
|
|
109
|
-
| 5 | Aggregation | (Inline analysis),
|
|
110
|
-
| 6 | Discourse | `rounds/round-{n}/discourse.md`,
|
|
111
|
-
| 7 | Synthesis | `rounds/round-{n}/final.md`,
|
|
112
|
-
| 8 | Presentation |
|
|
136
|
+
| 1 | Context Discovery | `discovered-standards.md`, `requirements.md` (if provided) |
|
|
137
|
+
| 2 | Change Analysis | `context.md`, call `ocr state transition` |
|
|
138
|
+
| 3 | Tech Lead Analysis | Update `context.md` with guidance, call `ocr state transition` |
|
|
139
|
+
| 4 | Parallel Reviews | `rounds/round-{n}/reviews/{type}-{n}.md` for each reviewer, call `ocr state transition` |
|
|
140
|
+
| 5 | Aggregation | (Inline analysis), call `ocr state transition` |
|
|
141
|
+
| 6 | Discourse | `rounds/round-{n}/discourse.md`, call `ocr state transition` |
|
|
142
|
+
| 7 | Synthesis | `rounds/round-{n}/final.md`, call `ocr state transition` |
|
|
143
|
+
| 8 | Presentation | Call `ocr state close` |
|
|
113
144
|
|
|
114
145
|
## State Transitions and File Validation
|
|
115
146
|
|
|
116
|
-
When
|
|
147
|
+
When calling `ocr state transition`, verify the corresponding file exists:
|
|
117
148
|
|
|
118
149
|
| Phase | Verify file exists |
|
|
119
150
|
|---------------------------|-------------------|
|
|
@@ -147,30 +178,9 @@ SESSION_ID="$(date +%Y-%m-%d)-$(git branch --show-current | tr '/' '-')"
|
|
|
147
178
|
|
|
148
179
|
## File Content Requirements
|
|
149
180
|
|
|
150
|
-
###
|
|
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
|
|
181
|
+
### Session State
|
|
172
182
|
|
|
173
|
-
See `
|
|
183
|
+
Session state is stored in SQLite at `.ocr/data/ocr.db`. Use `ocr state show` to inspect current state. See `session-state.md` for the full data model.
|
|
174
184
|
|
|
175
185
|
### Reviewer Files
|
|
176
186
|
|
|
@@ -200,14 +210,14 @@ The `ocr progress` CLI depends on these exact file names:
|
|
|
200
210
|
|
|
201
211
|
| CLI Feature | Files Read |
|
|
202
212
|
|-------------|-----------|
|
|
203
|
-
| Session detection | `state
|
|
204
|
-
| Phase tracking |
|
|
205
|
-
| Current round |
|
|
213
|
+
| Session detection | `ocr state show` / SQLite |
|
|
214
|
+
| Phase tracking | SQLite → `current_phase` |
|
|
215
|
+
| Current round | SQLite → `current_round` (reconciled with filesystem) |
|
|
206
216
|
| Reviewer progress | `rounds/round-{n}/reviews/*.md` file existence |
|
|
207
217
|
| Round completion | `rounds/round-{n}/final.md` existence |
|
|
208
|
-
| Elapsed time |
|
|
218
|
+
| Elapsed time | SQLite → `started_at` |
|
|
209
219
|
|
|
210
|
-
**Filesystem as truth**: The CLI derives round metadata from the filesystem, using
|
|
220
|
+
**Filesystem as truth**: The CLI derives round metadata from the filesystem, using SQLite as the primary state store. Round-level details are always reconciled against the filesystem by:
|
|
211
221
|
1. Enumerating `rounds/round-*/` to count rounds
|
|
212
222
|
2. Checking `final.md` presence to determine completion
|
|
213
223
|
3. Listing `reviews/*.md` to identify reviewers
|
|
@@ -2,42 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
OCR uses
|
|
5
|
+
OCR uses **SQLite** as the primary state store for reliable progress tracking. The database is located at `.ocr/data/ocr.db` and is managed through the `ocr state` CLI commands. Agents use these CLI commands at each phase transition instead of writing state files directly.
|
|
6
6
|
|
|
7
7
|
## Cross-Mode Compatibility
|
|
8
8
|
|
|
9
|
-
Sessions are **always** stored in the project's `.ocr/sessions
|
|
9
|
+
Sessions are **always** stored in the project's `.ocr/data/ocr.db` database and mirrored to `.ocr/sessions/`, regardless of installation mode:
|
|
10
10
|
|
|
11
|
-
| Mode | Skills Location | Sessions
|
|
12
|
-
|
|
13
|
-
| **CLI** | `.ocr/skills/` | `.ocr/sessions/` |
|
|
14
|
-
| **Plugin** | Plugin cache | `.ocr/sessions/` |
|
|
11
|
+
| Mode | Skills Location | State Store | Sessions Mirror |
|
|
12
|
+
|------|-----------------|-------------|-----------------|
|
|
13
|
+
| **CLI** | `.ocr/skills/` | `.ocr/data/ocr.db` | `.ocr/sessions/` |
|
|
14
|
+
| **Plugin** | Plugin cache | `.ocr/data/ocr.db` | `.ocr/sessions/` |
|
|
15
15
|
|
|
16
16
|
This means:
|
|
17
17
|
- The `ocr progress` CLI works identically in both modes
|
|
18
18
|
- Running `npx @open-code-review/cli progress` from any project picks up the session state
|
|
19
|
-
- No configuration needed — the CLI always
|
|
19
|
+
- No configuration needed — the CLI always reads from `.ocr/data/ocr.db`
|
|
20
20
|
|
|
21
|
-
## State
|
|
21
|
+
## State Data Model
|
|
22
|
+
|
|
23
|
+
The following fields are tracked per session in SQLite:
|
|
22
24
|
|
|
23
25
|
```json
|
|
24
26
|
{
|
|
25
27
|
"session_id": "{session-id}",
|
|
28
|
+
"workflow_type": "review",
|
|
26
29
|
"status": "active",
|
|
27
30
|
"current_phase": "reviews",
|
|
28
31
|
"phase_number": 4,
|
|
29
32
|
"current_round": 1,
|
|
33
|
+
"current_map_run": 1,
|
|
30
34
|
"started_at": "{ISO-8601-TIMESTAMP}",
|
|
31
35
|
"round_started_at": "{ISO-8601-TIMESTAMP}",
|
|
36
|
+
"map_started_at": "{ISO-8601-TIMESTAMP}",
|
|
32
37
|
"updated_at": "{ISO-8601-TIMESTAMP}"
|
|
33
38
|
}
|
|
34
39
|
```
|
|
35
40
|
|
|
36
|
-
**Minimal by design**: Round metadata is derived from the filesystem, not stored in
|
|
41
|
+
**Minimal by design**: Round and map run metadata is derived from the filesystem, not stored in the database.
|
|
37
42
|
|
|
38
43
|
**Field descriptions**:
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
44
|
+
- `workflow_type`: Current workflow type (`"review"` or `"map"`) — enables `ocr progress` to track correct workflow
|
|
45
|
+
- `started_at`: When the session was created (first `/ocr-review` or `/ocr-map`)
|
|
46
|
+
- `round_started_at`: When the current review round began (set when starting round ≥ 1)
|
|
47
|
+
- `map_started_at`: When the current map run began (set when starting a map run)
|
|
48
|
+
- `current_map_run`: Current map run number (only present during map workflow)
|
|
41
49
|
- `updated_at`: Last modification time (updated at every phase transition)
|
|
42
50
|
|
|
43
51
|
**Derived from filesystem** (not stored):
|
|
@@ -45,8 +53,17 @@ This means:
|
|
|
45
53
|
- Round completion: check for `final.md` in round directory
|
|
46
54
|
- Reviewers in round: list files in `rounds/round-{n}/reviews/`
|
|
47
55
|
- Discourse complete: check for `discourse.md` in round directory
|
|
56
|
+
- Map run count: enumerate `map/runs/run-*/` directories
|
|
57
|
+
- Map run completion: check for `map.md` in run directory
|
|
58
|
+
|
|
59
|
+
## Orchestration Events Table
|
|
60
|
+
|
|
61
|
+
In addition to the session state, SQLite tracks an **orchestration events timeline** in the `orchestration_events` table. Each `ocr state transition` call automatically logs an event, providing a complete history of phase transitions with timestamps. This enables:
|
|
62
|
+
- Post-session analytics (time spent per phase)
|
|
63
|
+
- Debugging stalled reviews
|
|
64
|
+
- Progress timeline reconstruction
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
Events are stored with the session ID, phase name, phase number, and timestamp.
|
|
50
67
|
|
|
51
68
|
## Session Status
|
|
52
69
|
|
|
@@ -58,105 +75,158 @@ The `status` field controls session visibility:
|
|
|
58
75
|
| `closed` | Complete and dismissed | Skipped | Cannot resume |
|
|
59
76
|
|
|
60
77
|
**Lifecycle:**
|
|
61
|
-
1. Session created → `status: "active"`
|
|
62
|
-
2. Review in progress → `status: "active"`, `current_phase` updates
|
|
63
|
-
3. Phase 8 complete → `status: "closed"`, `current_phase: "complete"`
|
|
78
|
+
1. Session created via `ocr state init` → `status: "active"`
|
|
79
|
+
2. Review in progress → `status: "active"`, `current_phase` updates via `ocr state transition`
|
|
80
|
+
3. Phase 8 complete → `ocr state close` sets `status: "closed"`, `current_phase: "complete"`
|
|
64
81
|
|
|
65
82
|
The `ocr progress` command only auto-detects sessions with `status: "active"`. Closed sessions are accessible via `/ocr-history` and `/ocr-show`.
|
|
66
83
|
|
|
84
|
+
## CLI Commands for State Management
|
|
85
|
+
|
|
86
|
+
Agents MUST use these CLI commands to manage session state. **Do NOT write state files directly.**
|
|
87
|
+
|
|
88
|
+
> **Note**: These commands require the OCR CLI. Install globally with `npm install -g @open-code-review/cli` or prefix with `npx @open-code-review/cli`.
|
|
89
|
+
|
|
90
|
+
### `ocr state init` — Create a new session
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
ocr state init \
|
|
94
|
+
--session-id "{session-id}" \
|
|
95
|
+
--branch "{branch}" \
|
|
96
|
+
--workflow-type review \
|
|
97
|
+
--session-dir ".ocr/sessions/{session-id}"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Creates the session record in SQLite.
|
|
101
|
+
|
|
102
|
+
### `ocr state transition` — Update phase at each boundary
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
ocr state transition \
|
|
106
|
+
--phase "{phase-name}" \
|
|
107
|
+
--phase-number {N}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For review workflows with multiple rounds:
|
|
111
|
+
```bash
|
|
112
|
+
ocr state transition \
|
|
113
|
+
--phase "{phase-name}" \
|
|
114
|
+
--phase-number {N} \
|
|
115
|
+
--current-round {round-number}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For map workflows:
|
|
119
|
+
```bash
|
|
120
|
+
ocr state transition \
|
|
121
|
+
--phase "{phase-name}" \
|
|
122
|
+
--phase-number {N} \
|
|
123
|
+
--current-map-run {run-number}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Updates the session in SQLite and logs an orchestration event.
|
|
127
|
+
|
|
128
|
+
### `ocr state close` — Close the session
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ocr state close
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Sets `status: "closed"` and `current_phase: "complete"` in SQLite.
|
|
135
|
+
|
|
136
|
+
### `ocr state show` — Read current session state
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ocr state show
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Outputs the current session state from SQLite. Use this to inspect current session state.
|
|
143
|
+
|
|
144
|
+
### `ocr state sync` — Rebuild from filesystem
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
ocr state sync
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Scans filesystem session directories and backfills any missing sessions into SQLite.
|
|
151
|
+
|
|
67
152
|
## Phase Transitions
|
|
68
153
|
|
|
69
154
|
> **See `references/session-files.md` for the authoritative file manifest.**
|
|
70
155
|
|
|
71
|
-
The Tech Lead MUST
|
|
156
|
+
The Tech Lead MUST call `ocr state transition` at each phase boundary:
|
|
72
157
|
|
|
73
|
-
|
|
74
|
-
|
|
158
|
+
### Review Phases
|
|
159
|
+
|
|
160
|
+
| Phase | When to Transition | File Created |
|
|
161
|
+
|-------|-------------------|--------------|
|
|
75
162
|
| context | After writing project standards | `discovered-standards.md` |
|
|
76
163
|
| change-context | After writing change summary | `context.md`, `requirements.md` (if provided) |
|
|
77
164
|
| analysis | After adding Tech Lead guidance | Update `context.md` |
|
|
78
165
|
| reviews | After each reviewer completes | `rounds/round-{n}/reviews/{type}-{n}.md` |
|
|
79
166
|
| discourse | After cross-reviewer discussion | `rounds/round-{n}/discourse.md` |
|
|
80
167
|
| synthesis | After final review | `rounds/round-{n}/final.md` |
|
|
81
|
-
| complete | After presenting to user |
|
|
168
|
+
| complete | After presenting to user | Call `ocr state close` |
|
|
82
169
|
|
|
83
|
-
|
|
170
|
+
### Map Phases
|
|
84
171
|
|
|
85
|
-
|
|
172
|
+
| Phase | When to Transition | File Created |
|
|
173
|
+
|-------|-------------------|--------------|
|
|
174
|
+
| map-context | After writing project standards | `discovered-standards.md` (shared) |
|
|
175
|
+
| topology | After topology analysis | `map/runs/run-{n}/topology.md` |
|
|
176
|
+
| flow-analysis | After flow analysis | `map/runs/run-{n}/flow-analysis.md` |
|
|
177
|
+
| requirements-mapping | After requirements mapping | `map/runs/run-{n}/requirements-mapping.md` |
|
|
178
|
+
| synthesis | After map generation | `map/runs/run-{n}/map.md` |
|
|
179
|
+
| complete | After presenting map | Keep `status: "active"` (session continues) |
|
|
86
180
|
|
|
87
|
-
|
|
181
|
+
## State Transition Examples
|
|
88
182
|
|
|
89
|
-
|
|
90
|
-
# macOS/Linux
|
|
91
|
-
date -u +"%Y-%m-%dT%H:%M:%SZ"
|
|
92
|
-
# Output: 2026-01-27T09:45:00Z
|
|
93
|
-
|
|
94
|
-
# Windows (PowerShell)
|
|
95
|
-
Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ" -AsUTC
|
|
183
|
+
When creating a new session (Phase 1 start):
|
|
96
184
|
|
|
97
|
-
|
|
98
|
-
|
|
185
|
+
```bash
|
|
186
|
+
ocr state init \
|
|
187
|
+
--session-id "{session-id}" \
|
|
188
|
+
--branch "{branch}" \
|
|
189
|
+
--workflow-type review \
|
|
190
|
+
--session-dir ".ocr/sessions/{session-id}"
|
|
99
191
|
```
|
|
100
192
|
|
|
101
|
-
When
|
|
193
|
+
When transitioning phases:
|
|
102
194
|
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
"session_id": "{session-id}",
|
|
106
|
-
"status": "active",
|
|
107
|
-
"current_phase": "context",
|
|
108
|
-
"phase_number": 1,
|
|
109
|
-
"current_round": 1,
|
|
110
|
-
"started_at": "{CURRENT_ISO_TIMESTAMP}",
|
|
111
|
-
"updated_at": "{CURRENT_ISO_TIMESTAMP}"
|
|
112
|
-
}
|
|
195
|
+
```bash
|
|
196
|
+
ocr state transition --phase "reviews" --phase-number 4 --current-round 1
|
|
113
197
|
```
|
|
114
198
|
|
|
115
|
-
When
|
|
199
|
+
When starting a map workflow:
|
|
116
200
|
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"updated_at": "{CURRENT_ISO_TIMESTAMP}"
|
|
126
|
-
}
|
|
201
|
+
```bash
|
|
202
|
+
ocr state init \
|
|
203
|
+
--session-id "{session-id}" \
|
|
204
|
+
--branch "{branch}" \
|
|
205
|
+
--workflow-type map \
|
|
206
|
+
--session-dir ".ocr/sessions/{session-id}"
|
|
207
|
+
|
|
208
|
+
ocr state transition --phase "map-context" --phase-number 1 --current-map-run 1
|
|
127
209
|
```
|
|
128
210
|
|
|
129
211
|
When closing a session (Phase 8 complete):
|
|
130
212
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
"session_id": "{session-id}",
|
|
134
|
-
"status": "closed",
|
|
135
|
-
"current_phase": "complete",
|
|
136
|
-
"phase_number": 8,
|
|
137
|
-
"current_round": 1,
|
|
138
|
-
"started_at": "{PRESERVE_ORIGINAL}",
|
|
139
|
-
"updated_at": "{CURRENT_ISO_TIMESTAMP}"
|
|
140
|
-
}
|
|
213
|
+
```bash
|
|
214
|
+
ocr state close
|
|
141
215
|
```
|
|
142
216
|
|
|
143
217
|
## Benefits
|
|
144
218
|
|
|
145
219
|
1. **Explicit state** — No inference required
|
|
146
|
-
2. **Atomic updates** —
|
|
147
|
-
3. **Rich metadata** — Reviewer assignments, timestamps
|
|
148
|
-
4. **Debuggable** —
|
|
149
|
-
5. **CLI-friendly** —
|
|
220
|
+
2. **Atomic updates** — SQLite transactions ensure consistency
|
|
221
|
+
3. **Rich metadata** — Reviewer assignments, timestamps, orchestration events
|
|
222
|
+
4. **Debuggable** — `ocr state show` for human-readable output
|
|
223
|
+
5. **CLI-friendly** — All state operations via `ocr state` commands
|
|
224
|
+
6. **Timeline tracking** — Orchestration events table records full phase history
|
|
150
225
|
|
|
151
226
|
## Important
|
|
152
227
|
|
|
153
|
-
|
|
228
|
+
SQLite (`.ocr/data/ocr.db`) is the **sole** source for workflow progress. With the round-first architecture:
|
|
154
229
|
|
|
230
|
+
- **SQLite is truth for workflow state**: `current_phase`, `phase_number`, `status`, timestamps
|
|
155
231
|
- **Filesystem is truth for round data**: Round count, completion, and reviewers are derived from `rounds/` directory structure
|
|
156
|
-
- **
|
|
157
|
-
- **Reconciliation**: If state.json and filesystem disagree, the CLI reconciles by trusting the filesystem for round data
|
|
158
|
-
|
|
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
|
|
232
|
+
- **Reconciliation**: If SQLite and filesystem disagree, the CLI reconciles by trusting the filesystem for round data
|
|
@@ -128,6 +128,26 @@ mkdir -p .ocr/sessions
|
|
|
128
128
|
|
|
129
129
|
This is safe to do automatically since it's just an empty directory for storing review sessions.
|
|
130
130
|
|
|
131
|
+
### 5. Verify CLI is Reachable (CLI Mode Only)
|
|
132
|
+
|
|
133
|
+
The review and map workflows require `ocr state` commands at every phase transition. Verify the CLI is available:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
ocr --version 2>/dev/null || npx @open-code-review/cli --version 2>/dev/null
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**If neither works:**
|
|
140
|
+
```
|
|
141
|
+
⚠ OCR CLI not found in PATH.
|
|
142
|
+
|
|
143
|
+
The review workflow requires the CLI for state management (ocr state).
|
|
144
|
+
Install it globally or use npx:
|
|
145
|
+
|
|
146
|
+
npm install -g @open-code-review/cli
|
|
147
|
+
# or prefix commands with: npx @open-code-review/cli
|
|
148
|
+
```
|
|
149
|
+
**Then WARN** (do not stop — the user may have the CLI installed elsewhere).
|
|
150
|
+
|
|
131
151
|
## Success Response
|
|
132
152
|
|
|
133
153
|
If all checks pass, respond briefly and proceed:
|