analyze-code-quality
Advanced code quality analysis agent for comprehensive code reviews and improvements
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.
> /plugin marketplace add spencermarx/open-code-review > /plugin install ocr@aclarify
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
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.
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.
Sessions are **always** stored in the project's `.ocr/data/ocr.db` database and mirrored to `.ocr/sessions/`, regardless of installation mode:
| Mode | Skills Location | State Store | Sessions Mirror | |------|-----------------|-------------|-----------------| | **CLI** | `.ocr/skills/` | `.ocr/data/ocr.db` | `.ocr/sessions/` | | **Plugin** | Plugin cache | `.ocr/data/ocr.db` | `.ocr/sessions/` |
This means:
The following fields are tracked per session in SQLite:
{
"session_id": "{session-id}",
"workflow_type": "review",
"status": "active",
"current_phase": "reviews",
"phase_number": 4,
"current_round": 1,
"current_map_run": 1,
"started_at": "{ISO-8601-TIMESTAMP}",
"round_started_at": "{ISO-8601-TIMESTAMP}",
"map_started_at": "{ISO-8601-TIMESTAMP}",
"updated_at": "{ISO-8601-TIMESTAMP}"
}**Minimal by design**: Round and map run metadata is derived from the filesystem, not stored in the database.
**Field descriptions**:
**Derived from filesystem** (not stored):
In addition to the session state, SQLite tracks an **orchestration events timeline** in the `orchestration_events` table. Each `ocr state advance` call automatically logs an event, providing a complete history of phase transitions with timestamps. This enables:
Events are stored with the session ID, phase name, phase number, and timestamp.
The `status` field controls session visibility:
| Status | Meaning | Progress CLI | Agent Resume | |--------|---------|--------------|---------------| | `active` | In progress | Shows in auto-detect | Can resume | | `closed` | Complete and dismissed | Skipped | Cannot resume |
**Lifecycle:** 1. Session created via `ocr state begin` → `status: "active"` 2. Review in progress → `status: "active"`, `current_phase` updates via `ocr state advance` 3. Phase 8 complete → `ocr state finish` sets `status: "closed"`, `current_phase: "complete"`
The `ocr progress` command only auto-detects sessions with `status: "active"`. Closed sessions are accessible via `/ocr-history` and `/ocr-show`.
Each journaled process (`ocr session list --json`, the dashboard's `/api/agent-sessions`) carries a typed **`kind`** — branch on it instead of parsing the `command` string to tell what a process is:
| `kind` | Meaning | |--------|---------| | `supervisor` | A workflow-owning process (a dashboard-spawned `review`/`map`). Its death cascade-closes its dependents. | | `instance` | A reviewer instance journaled via `ocr session start-instance`. Never owns a workflow's lifecycle. | | `utility` | A fire-and-forget command with no journaled heartbeat. |
Agents MUST use these CLI commands to manage session state. **Do NOT write state files directly.**
> **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`.
As of v2.0 the CLI exposes a small set of **atomic, invariant-checked** verbs. Prefer these — they make correct state updates the default and make incorrect ones impossible:
| Verb | Use it to | Guarantee | |------|-----------|-----------| | `ocr state begin` | start or resume a workflow | returns `{session_id, round, phase, completeness}` | | `ocr state advance --phase <name>` | mark you've reached a phase | graph-validated; rejects illegal jumps; phase number derived | | `ocr state complete-round --stdin` | finalize a review round | **one transaction**: writes meta + `round_completed` + advances + transitions to `complete`. Refuses unless you've reached `synthesis`. Idempotent. | | `ocr state complete-map --stdin` | finalize a map run | map analogue | | `ocr state finish [--abort]` | close the workflow | **refuses** unless the current round/run is complete; `--abort` records an abandoned session | | `ocr state status --json` | ask "is it done? what's missing?" | machine-readable completeness + `next_action` |
**The CLI now enforces the lifecycle.** `ocr state finish` will *refuse* (exit code 6) to close a workflow whose current round/run has no `round_completed`/`map_completed`. This is by design — it makes the "completed too soon" failure impossible. If you genuinely need to abandon a workflow, use `ocr state finish --abort`.
**Exit codes** (branch on these instead of
AI-powered multi-agent code review. Simulates a customizable team of Engineers performing code review with built-in discourse.
Repo: spencermarx/open-code-review
Advanced code quality analysis agent for comprehensive code reviews and improvements
Advanced code quality analysis agent for comprehensive code reviews and improvements
Expert agent for system architecture design, patterns, and high-level technical decisions
Coordinates Byzantine fault-tolerant consensus protocols with malicious actor detection
Implements Conflict-free Replicated Data Types for eventually consistent state synchronization
Coordinates gossip-based consensus protocols for scalable eventually consistent systems