Implementation:2akouwu Reverify Harness install
| Knowledge Sources | |
|---|---|
| Domains | Context_Engineering, CLI_Integration |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Concrete tool for installing rollover guard hooks and disabling native compaction across four AI coding CLIs (Claude Code, Codex, Gemini CLI, OpenCode), provided by the Reverify library.
Description
The Harness.install method (one per CLI adapter) wires the guard hook into the CLI's settings, turns off native compaction, and creates config backups. Each harness edits its CLI's config files: Claude (~/.claude/settings.json), Codex (~/.codex/hooks.json + config.toml), Gemini (~/.gemini/settings.json), OpenCode (plugin + opencode.json). The run_install dispatcher selects harnesses by name. Install creates backups before modifying any file.
Usage
Use this function when you need to:
- Install the rollover guard for one or more AI coding CLIs.
- Disable native (lossy) context compaction.
- Wire the Stop/SessionStart hooks that trigger the guard.
Code Reference
Source Location
- Repository: Reverify
- File: reverify/rollover_harness.py
- Lines:
run_installat L1698-1707;ClaudeHarness.installat L1086-1093;CodexHarness.installat L1184-1202;GeminiHarness.installat L1296-1308;OpenCodeHarness.installat L1398-1418
Signature
class Harness:
def install(self, threshold: Optional[str], step: Optional[str],
disable_autocompact: bool) -> List[str]:
"""Wire hooks, turn off compaction, create backups. Returns status messages."""
def run_install(argv: List[str]) -> int:
"""CLI dispatcher: select harness(es) by name, call install."""
Import
from reverify.rollover_harness import run_install, get_harness
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| threshold | str | No | Token threshold (e.g. "200k") |
| step | str | No | Re-arm step |
| disable_autocompact | bool | No | Turn off native compaction (default True) |
Outputs
| Name | Type | Description |
|---|---|---|
| return | List[str] | Status messages (hooks wired, config paths, backups) |
Usage Examples
CLI Usage
# Install for Claude Code
reverify rollover install --harness claude --threshold 200k
# Install for all four CLIs
reverify rollover install --harness claude,codex,gemini,opencode
# Keep native compaction (use rollover alongside it)
reverify rollover install --harness claude --keep-autocompact