@open-code-review/agents 1.3.1 → 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.
@@ -12,6 +12,15 @@ Every OCR session creates files in `.ocr/sessions/{session-id}/`:
12
12
  ├── discovered-standards.md # Merged project context (shared across rounds)
13
13
  ├── requirements.md # User-provided requirements (if any, shared)
14
14
  ├── context.md # Phase 2+3: Change summary + Tech Lead guidance (shared)
15
+ ├── map/ # Code Review Map artifacts (optional)
16
+ │ └── runs/
17
+ │ ├── run-1/ # First map generation
18
+ │ │ ├── topology.md # File categorization and sections
19
+ │ │ ├── flow-analysis.md # Dependency tracing results
20
+ │ │ ├── requirements-mapping.md # Coverage matrix (if requirements)
21
+ │ │ └── map.md # Final map output
22
+ │ └── run-2/ # Subsequent runs (created on re-map)
23
+ │ └── ... # Same structure as run-1
15
24
  └── rounds/ # All round-specific artifacts
16
25
  ├── round-1/ # First review round
17
26
  │ ├── reviews/ # Individual reviewer outputs
@@ -42,19 +51,43 @@ OCR uses a **round-first architecture** where all round-specific artifacts live
42
51
  - Each round has its own `discourse.md` and `final.md`
43
52
  - `state.json` tracks `current_round`; round metadata derived from filesystem
44
53
 
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` | |
54
+ **Shared vs per-round/run artifacts**:
55
+ | Shared (session root) | Per-round (`rounds/round-{n}/`) | Per-run (`map/runs/run-{n}/`) |
56
+ |----------------------|--------------------------------|-------------------------------|
57
+ | `state.json` | `reviews/*.md` | `topology.md` |
58
+ | `discovered-standards.md` | `discourse.md` | `flow-analysis.md` |
59
+ | `requirements.md` | `final.md` | `requirements-mapping.md` |
60
+ | `context.md` | | `map.md` |
52
61
 
53
62
  **When to use multiple rounds**:
54
63
  - Author addresses feedback and requests re-review
55
64
  - Scope changes mid-review
56
65
  - Different reviewer team composition needed
57
66
 
67
+ ## Map Runs
68
+
69
+ OCR uses a **run-based architecture** for maps, parallel to review rounds.
70
+
71
+ **Run behavior**:
72
+ - First `/ocr-map` creates `map/runs/run-1/` with map artifacts
73
+ - Subsequent `/ocr-map` on same day/branch creates `map/runs/run-{n+1}/`
74
+ - Previous runs are preserved (never overwritten)
75
+ - Each run produces a complete `map.md`
76
+ - `state.json` tracks `current_map_run`; run metadata derived from filesystem
77
+
78
+ **Map artifacts per run**:
79
+ | File | Phase | Description |
80
+ |------|-------|-------------|
81
+ | `topology.md` | 2 | File categorization and section groupings |
82
+ | `flow-analysis.md` | 3 | Upstream/downstream dependency tracing |
83
+ | `requirements-mapping.md` | 4 | Requirements coverage matrix (if requirements provided) |
84
+ | `map.md` | 5 | Final synthesized Code Review Map |
85
+
86
+ **When to use multiple runs**:
87
+ - Changeset has evolved since last map
88
+ - Different requirements context needed
89
+ - Fresh analysis desired after code updates
90
+
58
91
  ## File Specifications
59
92
 
60
93
  ### Required Files
@@ -23,28 +23,38 @@ This means:
23
23
  ```json
24
24
  {
25
25
  "session_id": "{session-id}",
26
+ "workflow_type": "review",
26
27
  "status": "active",
27
28
  "current_phase": "reviews",
28
29
  "phase_number": 4,
29
30
  "current_round": 1,
31
+ "current_map_run": 1,
30
32
  "started_at": "{ISO-8601-TIMESTAMP}",
31
33
  "round_started_at": "{ISO-8601-TIMESTAMP}",
34
+ "map_started_at": "{ISO-8601-TIMESTAMP}",
32
35
  "updated_at": "{ISO-8601-TIMESTAMP}"
33
36
  }
34
37
  ```
35
38
 
36
- **Minimal by design**: Round metadata is derived from the filesystem, not stored in state.json.
39
+ **Minimal by design**: Round and map run metadata is derived from the filesystem, not stored in state.json.
37
40
 
38
41
  **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)
42
+ - `workflow_type`: Current workflow type (`"review"` or `"map"`) — enables `ocr progress` to track correct workflow
43
+ - `started_at`: When the session was created (first `/ocr-review` or `/ocr-map`)
44
+ - `round_started_at`: When the current review round began (set when starting round ≥ 1)
45
+ - `map_started_at`: When the current map run began (set when starting a map run)
46
+ - `current_map_run`: Current map run number (only present during map workflow)
41
47
  - `updated_at`: Last modification time (updated at every phase transition)
42
48
 
49
+ **CRITICAL for timing**: When starting a NEW workflow type in an existing session (e.g., starting `/ocr-map` after `/ocr-review`), you MUST set the workflow-specific start time (`map_started_at` or `round_started_at`) to the current timestamp. This ensures `ocr progress` shows accurate elapsed time for each workflow.
50
+
43
51
  **Derived from filesystem** (not stored):
44
52
  - Round count: enumerate `rounds/round-*/` directories
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
48
58
 
49
59
  **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.
50
60
 
@@ -70,6 +80,8 @@ The `ocr progress` command only auto-detects sessions with `status: "active"`. C
70
80
 
71
81
  The Tech Lead MUST update `state.json` at each phase boundary:
72
82
 
83
+ ### Review Phases
84
+
73
85
  | Phase | When to Update | File Created |
74
86
  |-------|---------------|--------------|
75
87
  | context | After writing project standards | `discovered-standards.md` |
@@ -80,24 +92,42 @@ The Tech Lead MUST update `state.json` at each phase boundary:
80
92
  | synthesis | After final review | `rounds/round-{n}/final.md` |
81
93
  | complete | After presenting to user | Set `status: "closed"` |
82
94
 
95
+ ### Map Phases
96
+
97
+ | Phase | When to Update | File Created |
98
+ |-------|---------------|--------------|
99
+ | map-context | After writing project standards | `discovered-standards.md` (shared) |
100
+ | topology | After topology analysis | `map/runs/run-{n}/topology.md` |
101
+ | flow-analysis | After flow analysis | `map/runs/run-{n}/flow-analysis.md` |
102
+ | requirements-mapping | After requirements mapping | `map/runs/run-{n}/requirements-mapping.md` |
103
+ | synthesis | After map generation | `map/runs/run-{n}/map.md` |
104
+ | complete | After presenting map | Keep `status: "active"` (session continues) |
105
+
83
106
  ## Writing State
84
107
 
85
- **CRITICAL**: Always generate timestamps dynamically using the current UTC time in ISO 8601 format.
108
+ **CRITICAL**: Always generate timestamps using a **tool call** never construct them manually.
86
109
 
87
110
  ### Generating Timestamps
88
111
 
112
+ > ⚠️ **NEVER** write timestamps manually (e.g., `"2026-01-29T22:00:00Z"`). Always use a tool call to get the current time. Manual timestamps risk timezone errors, typos, and incorrect elapsed time display.
113
+
114
+ **Required approach**: Use `run_command` tool to execute:
115
+
89
116
  ```bash
90
- # macOS/Linux
117
+ # macOS/Linux — USE THIS
91
118
  date -u +"%Y-%m-%dT%H:%M:%SZ"
92
119
  # Output: 2026-01-27T09:45:00Z
120
+ ```
93
121
 
94
- # Windows (PowerShell)
95
- Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ" -AsUTC
96
-
97
- # Node.js / JavaScript
98
- new Date().toISOString()
122
+ **Example tool call** (do this before writing state.json):
123
+ ```
124
+ run_command: date -u +"%Y-%m-%dT%H:%M:%SZ"
99
125
  ```
100
126
 
127
+ Then use the **exact output** as the timestamp value in state.json.
128
+
129
+ **Why this matters**: The `ocr progress` command calculates elapsed time from these timestamps. If a timestamp is incorrect (wrong timezone, future time, etc.), the progress display will show wrong/counting-down times.
130
+
101
131
  When creating a new session (Phase 1 start):
102
132
 
103
133
  ```json
@@ -117,15 +147,35 @@ When transitioning phases (preserve `started_at`, update `updated_at`):
117
147
  ```json
118
148
  {
119
149
  "session_id": "{session-id}",
150
+ "workflow_type": "review",
120
151
  "status": "active",
121
152
  "current_phase": "reviews",
122
153
  "phase_number": 4,
123
154
  "current_round": 1,
124
155
  "started_at": "{PRESERVE_ORIGINAL}",
156
+ "round_started_at": "{PRESERVE_ORIGINAL}",
157
+ "updated_at": "{CURRENT_ISO_TIMESTAMP}"
158
+ }
159
+ ```
160
+
161
+ When starting a map workflow (new map run or first map in session):
162
+
163
+ ```json
164
+ {
165
+ "session_id": "{session-id}",
166
+ "workflow_type": "map",
167
+ "status": "active",
168
+ "current_phase": "map-context",
169
+ "phase_number": 1,
170
+ "current_map_run": 1,
171
+ "started_at": "{PRESERVE_ORIGINAL_OR_SET_IF_NEW}",
172
+ "map_started_at": "{CURRENT_ISO_TIMESTAMP}",
125
173
  "updated_at": "{CURRENT_ISO_TIMESTAMP}"
126
174
  }
127
175
  ```
128
176
 
177
+ **CRITICAL**: Always set `map_started_at` to `{CURRENT_ISO_TIMESTAMP}` when starting a new map run. This ensures accurate elapsed time tracking even if the session had a prior review workflow.
178
+
129
179
  When closing a session (Phase 8 complete):
130
180
 
131
181
  ```json
@@ -13,8 +13,9 @@ Before starting ANY work, verify the current session state to avoid duplicating
13
13
  ### Step 1: Check for existing session
14
14
 
15
15
  ```bash
16
- # Get current branch
17
- BRANCH=$(git branch --show-current)
16
+ # Get current branch and sanitize for filesystem (replace / with -)
17
+ BRANCH_RAW=$(git branch --show-current)
18
+ BRANCH=$(echo "$BRANCH_RAW" | tr '/' '-')
18
19
  DATE=$(date +%Y-%m-%d)
19
20
  SESSION_DIR=".ocr/sessions/${DATE}-${BRANCH}"
20
21
 
@@ -113,7 +114,13 @@ At **every phase transition**, update `.ocr/sessions/{id}/state.json`:
113
114
 
114
115
  **Minimal schema** — round metadata is derived from filesystem, not stored in state.json.
115
116
 
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.
117
+ > ⚠️ **TIMESTAMP RULE**: Always use `run_command` tool to get timestamps. **Never construct them manually.**
118
+ > ```bash
119
+ > date -u +"%Y-%m-%dT%H:%M:%SZ"
120
+ > ```
121
+ > Use the **exact output** in state.json. Manual timestamps cause incorrect `ocr progress` display.
122
+
123
+ **CRITICAL**: Preserve `started_at` from session creation; set `round_started_at` when starting a new round (> 1); always update `updated_at` with current time.
117
124
 
118
125
  **Status values**: `active` (in progress), `closed` (complete and dismissed)
119
126
 
@@ -315,18 +322,33 @@ See `references/context-discovery.md` for detailed algorithm.
315
322
 
316
323
  ### Steps
317
324
 
318
- 1. Review requirements (if provided):
325
+ 1. **Check for existing map reference** (optional):
326
+
327
+ If user explicitly references an existing map (e.g., "I've already generated a map", "use the map I created", "check the map in this session"):
328
+
329
+ ```bash
330
+ # Check for existing map artifacts
331
+ ls .ocr/sessions/{id}/map/runs/*/map.md 2>/dev/null
332
+ ```
333
+
334
+ - **If found AND user referenced it**: Read the latest `map.md` as supplementary context
335
+ - **If not found**: Inform user no map exists, proceed with standard review
336
+ - **If user did NOT reference a map**: Do NOT automatically use map artifacts
337
+
338
+ > **Note**: Maps are orthogonal tools. Only use if explicitly referenced by user.
339
+
340
+ 2. Review requirements (if provided):
319
341
  - What is the code SUPPOSED to do?
320
342
  - What are the acceptance criteria?
321
343
  - What edge cases are implied?
322
344
 
323
- 2. Analyze the diff to understand:
345
+ 3. Analyze the diff to understand:
324
346
  - What functionality is being added/changed/removed?
325
347
  - Does this align with requirements?
326
348
  - What is the likely intent?
327
349
  - What are the potential risk areas?
328
350
 
329
- 3. Create dynamic guidance for reviewers:
351
+ 4. Create dynamic guidance for reviewers:
330
352
  ```markdown
331
353
  ## Tech Lead Guidance
332
354