CRH performs a single, upfront network burst to fetch everything the agent will need — PR metadata, CI status, diff rounds, inline comments, and agent instruction files cloned from git — then writes the complete workspace tree to a temporary directory before the agent session starts. This design keeps the review session fully reproducible: every piece of data is already on disk, so the agent never makes ad-hoc network fetches mid-session and re-runs on identical input produce a byte-identical workspace tree.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/goulinkh/code-review-harness/llms.txt
Use this file to discover all available pages before exploring further.
Directory layout
prepareWorkspace fetches metadata, CI, and the diff round list in parallel, then writes each round’s diff and comments concurrently. Agent instruction files are read directly from the git object store (via isomorphic-git) so no full checkout is needed.
The numbered.diff format
raw.diff is the standard unified diff. numbered.diff is a transformed version where every line is prefixed with a monotonically increasing integer:
line: 7, the sink (e.g. Launchpad) maps that number back to the exact diff position for posting an inline comment.
The
diff_numbered tool exposes numbered.diff with pagination (start/end params) and reports totalLines so an agent can detect when the response was truncated and request the next window.The lineMap in file meta.json
Each per-file meta.json contains a lineMap object that maps a numbered-diff line number to its location in the actual file:
side value | Meaning |
|---|---|
"before" | Line existed in the base revision (deleted or context on the left) |
"after" | Line exists in the head revision (added or context on the right) |
"context" | Unchanged context line present in both revisions |
diff_map_line tool uses this map to resolve a numbered-diff line to { path, side, fileLine } without requiring the agent to parse the diff itself.
Agent file materialization
CRH looks for agent instruction files in the git repository at the head ref and copies them intoworkspace/agent/:
AGENTS.md,CLAUDE.md, or.cursorrules→agent/AGENTS.md(first match wins).cursor/rules/*.md→agent/rules/.clinerules/*→agent/rules/.crh/skills/*.md→agent/skills/
These files are optional. If none exist the
agent/ subdirectories are created but remain empty. The agent checks which files are present via agent_files_list and skips missing ones — a missing AGENTS.md is never reported as a finding.Read-only agent surface
The agent session does not expose mutating built-in tools (bash, edit, write). The agent can only access:
- Read-only built-ins:
read,grep,find,ls— scoped to the workspace directory only - CRH PR tools:
mp_metadata,preview_diffs_list,diff_list_files,diff_get_file,diff_numbered,diff_map_line,comments_general,comments_inline,agent_files_list,mark_file_reviewed - CRH repo tools:
repo_read,repo_ls,repo_grep,repo_stat— read from the git object store - Session tools:
delegate_review,submit_review
Determinism guarantee
prepareWorkspace uses stableJson (sorted key serialization) when writing all JSON files. Combined with sorted diff rounds and sorted file entries, re-runs against the same provider inputs produce a byte-identical workspace tree. This makes workspace snapshots suitable for reproducible test fixtures.