onpath docs

onpath documentation

Getting started/Quickstart

Introduction

onpath is a local-first safety and progress monitor for AI coding agents. It watches a session as it runs, detects when the agent gets stuck, and tells you exactly what happened — and what to run next.

What is onpath

You run your coding agent through onpath. It records the session locally, runs a set of detectors over the event stream, and generates a report. When a session starts looping — rerunning the same failing test, editing the same file without progress, or burning past a time budget — onpath surfaces a finding with a recovery prompt.

terminalsh
$ onpath run -- codex exec "fix the failing test"

Everything after -- is passed to the child process unchanged. onpath observes and records the run; the selected policy can warn, pause, or block when a finding crosses its threshold.

Who it's for

  • Solo developers using Codex, Claude Code, Cursor Agent, or OpenCode who want to know the moment an agent goes off the rails.
  • Engineering teams running many AI coding sessions who need aggregate visibility into where agents stall — without collecting raw transcripts.
  • Tech leads who want evidence, not vibes, about where AI time is wasted.

How it works

  1. onpath spawns your agent as a child process and watches its event stream.
  2. Commands, exit codes, file edits, and timings are written to a local SQLite database.
  3. Detectors hash failure signatures, track edit churn, and watch the clock against your thresholds.
  4. When a pattern crosses a threshold, onpath writes a finding, a markdown report, and a recovery prompt.

What onpath is not

onpath is not a surveillance tool. It does not rank individual developers, it does not upload your sessions by default, and its IDE and MCP surfaces are strictly read-only. Hosted analytics use explicitly uploaded, redacted summary payloads and never include raw transcripts or individual developer rankings.

Installation

onpath is distributed as a versioned Node.js CLI archive. Install it with the official script installer, then verify the local runtime and agent discovery.

Requirements

  • macOS 13+ or a modern Linux distribution validated
  • Node.js 24 LTS (Node ABI 137)
  • One supported agent on your PATH: codex, claude, cursor-agent, or opencode
  • Disk for the CLI archive plus a local SQLite store that grows with recorded sessions and reports

Windows and WSL are not supported or validated in this release. Use a validated macOS or Linux host.

Install

terminalsh
$ curl -fsSL https://agent.onpath.run/install.sh | sh

Verify your install

Check the version and run the built-in doctor, which confirms onpath can find a supported agent and write to its local store.

terminalsh
$ onpath --version
0.1.0-rc.5

$ onpath doctor --json

Updating

Update by rerunning the script installer after a new archive release is published. Homebrew and npm publication are not the official release path for this RC.

Quickstart

Run a monitored agent, inspect detector findings and reports, then optionally expose the local read-only MCP resources to the same workspace.

  1. 1

    Wrap your agent

    Prefix any agent invocation with onpath run --. onpath records the session locally and arms its detectors. Everything after -- runs unchanged.

    terminalsh
    $ onpath run -- codex exec "fix the failing test"
  2. 2

    Watch for findings

    When a detector fires, human mode writes the finding type, redacted evidence, policy decision, and recovery commands to stderr. Use --json when another process needs the structured finding and policy decision.

    terminalsh
    $ onpath run --json -- codex exec "fix the failing test"
  3. 3

    Read the report

    Run onpath report for the latest session, then inspect or copy the latest stored recovery prompt explicitly.

    terminalsh
    $ onpath report
    $ onpath recovery show --latest
    $ onpath recovery copy --latest
  4. 4

    Give your agent its findings

    Install the read-only MCP server so Codex, Claude, or Cursor can read findings and recovery context directly — without acting on your behalf.

    terminalsh
    $ onpath mcp install codex --workspace .

Tip: add onpath run -- to your agent shell alias so every session is monitored automatically.

Next steps

Detectors

Detectors are deterministic checks over the local session event stream. Project config controls shared thresholds and time budgets; typed policy JSON can enable, disable, or tune individual detectors.

How detection works

onpath normalizes each event — a command, an exit code, a file edit — and feeds it to every armed detector. Detectors are stateful within a session: they count repeats, measure churn, and track elapsed time. When a detector's condition holds past its threshold, it emits a finding with a severity and a recommended action.

Built-in detectors

DetectorFires when…DefaultSeverity
repeated-commandThe same normalized command starts at least the configured threshold in one sessionwarning
repeated-failure-outputThe same failure signature recurs in failed command or terminal evidencewarning
repeated-file-editThe same hashed path changes five times without a successful command between the first and latest edit5 changeswarning
time-budget-exceededElapsed session time exceeds an explicitly configured time budgetbudget requiredwarning
no-progress-sessionThe time budget is exceeded with no successful command and repeated command or edit evidencebudget requiredwarning
permission-waitTerminal or failed-command evidence says that user permission or approval is requiredenabledinfo
rate-limit-waitTerminal or failed-command evidence reports throttling, quota exhaustion, or HTTP 429enabledinfo
context-exhaustionTerminal or failed-command evidence reports a context-window or token-length limitenabledwarning
abandoned-subprocessA failed or crashed session ends after a command start without a matching command resultenabledwarning

Failure signatures

For repeated failure detection, onpath first redacts known secret patterns and strips ANSI control sequences. It then keeps at most the last 12 error-relevant lines, or the last 12 non-empty lines when no error pattern is present, collapses horizontal whitespace, and stores a SHA-256 signature of that normalized output. Equal signatures mean equal normalized evidence; they do not prove a shared semantic root cause.

Failure excerpts remain local. Human warnings and default reports show hashes unless --include-raw-local-data is explicitly selected.

Tuning sensitivity

Project defaults live in onpath.config.json. threshold applies to repeated command and failure evidence, while timeBudget activates elapsed-time checks. Use typed policy JSON for detector-specific thresholds, cooldowns, enablement, and warn, pause, or block actions.

onpath.config.jsonjson
{
  "schemaVersion": 1,
  "threshold": 2,
  "mode": "warn",
  "fileWatch": true,
  "redactPaths": true
}

Configuration & policy

The public config command writes JSON project defaults in onpath.config.json. Policy decides what onpath does when a finding fires — warn, pause for a decision, or block the run.

onpath.config.json

onpath config print reads onpath.config.json in the project root, or the path passed with --path. Project config is merged on top of built-in defaults.

onpath.config.jsonjson
{
  "schemaVersion": 1,
  "threshold": 4,
  "mode": "pause",
  "timeBudget": "20m",
  "fileWatch": true,
  "redactPaths": true
}

Policy: warn / pause / block

ActionBehaviour
warnPrint the finding and keep going. Nothing is interrupted.
pauseHalt and wait for you to continue, skip, or stop — with the recovery prompt shown.
blockEnd the current run immediately. A reason is required only when a matching policy rule selects bypass with requireReason: true.

Every pause and block decision — including bypasses and their reasons — is written to the policy audit log, rendered in local reports and redacted policy decision payloads.

Thresholds

The public config is flat JSON: threshold controls repeated command and repeated failure detection, while timeBudget controls elapsed-session warnings. Detector-specific thresholds and actions belong to typed policy JSON, not TOML sections.

Per-project overrides

Commit onpath.config.json to share project defaults. Hosted policy affects local runs only after onpath dashboard policy pull enrolls .onpath/team-policy.json. Matching policy chooses the most restrictive action; source precedence breaks ties.

Privacy & sync

onpath is local-first by default. Nothing leaves your machine unless you turn sync on — and when you do, you preview the exact, redacted payload first.

Local-first storage

Every session is recorded to a single SQLite file at .onpath/events.sqlite. Reports are written alongside it. You can export, inspect, or delete this data at any time — it is yours.

terminalsh
$ onpath data list
$ onpath data export --session <session-id> --output ./onpath-export.json
$ onpath data delete --session <session-id>

Redacted sync preview

Sync is opt-in, per project. Before anything uploads, onpath sync preview shows the exact payload. Raw command text and terminal output are excluded by default; failure signatures are hashed.

sync previewjson
{
  "schemaVersion": 1,
  "payloadId": "sync_...",
  "payloadClass": "finding-summary",
  "sessionId": "ses_...",
  "createdAt": "2026-07-17T12:00:00.000Z",
  "redactionMode": "strict",
  "destination": "official-cloud",
  "rawIncluded": false,
  "findingId": "finding_...",
  "detectorId": "repeated-failure-output",
  "severity": "warning",
  "confidence": 0.9,
  "evidenceEventCount": 4,
  "evidenceEventIdsHash": "sha256:...",
  "titleHash": "sha256:...",
  "summaryHash": "sha256:..."
}

Retention & deletion

  • The current CLI has no automatic local retention setting. Use onpath data list and explicit session-scoped deletion.
  • onpath data delete --session <session-id> removes one local session.
  • Hosted retention, export, and deletion are managed from the connected workspace's Sync & privacy controls.

Team analytics never include raw transcripts or individual developer rankings. Hosted views are derived from strict summary payloads such as detector, severity, policy, and agent-key metadata.

MCP integration

onpath ships a Model Context Protocol server that exposes findings and recovery context to your agent — strictly read-only. Your agent can see that it's stuck; it can never act through onpath.

Overview

The MCP server reads from your local session store and serves a small, structured view of the current session: active findings, failure signatures, and the generated recovery prompt. Install it once per agent, scoped to a workspace.

Install for your agent

terminalsh
$ onpath mcp install codex --workspace .
terminalsh
$ onpath mcp install claude --workspace .
terminalsh
$ onpath mcp install cursor --workspace .

Preview the exact configuration change without writing it, or remove an installed entry:

terminalsh
$ onpath mcp install codex --workspace . --print --json
$ onpath mcp uninstall codex --workspace .

What's exposed

ResourceDescription
onpath://projectsDiscovered local onpath projects.
onpath://sessionsRecent local sessions.
onpath://sessions/{id}/findingsStored findings for one session.
onpath://sessions/{id}/reportThe stored report for one session.

Read-only by design

The MCP server exposes no write tools. It cannot run commands, edit files, or change policy. It only answers questions about the session onpath is already recording.

Trusted work

A Work Record binds approved intent, agent attempts, recovery lineage, evidence, independent verification, and the offline Trust Gate without turning onpath into issue management.

Local trusted-work flow

Create a draft from an intent contract, authorize its current revision, checkpoint the repository, and attach each monitored run to the Work Record.

terminalsh
$ onpath work create --id GH-482 --file intent.json --json
$ onpath work authorize wrk_... --reason "approved scope"
$ onpath work checkpoint wrk_...
$ onpath run --work wrk_... --role generator -- codex exec "implement the approved change"

Work state, Guard decisions, checkpoints, and evidence stay local unless you explicitly upload a redacted projection. The daemon does not contact hosted services automatically.

Guard and bounded recovery

Guard evaluates approved paths, commands, dependency and schema changes, budgets, and adapter enforcement fidelity. Native prevention is reported separately from wrapper-level or observe-only evidence.

When an attempt fails, create a Recovery Capsule from selected findings and an existing checkpoint, then start a recovery-role run with that capsule.

terminalsh
$ onpath work recover wrk_... --attempt attempt_... --checkpoint chk_... --finding finding_... --next-action "inspect the failing boundary"
$ onpath run --work wrk_... --role recovery --recovery-capsule rcv_... -- claude

Evidence, verification, and gate

Build a deterministic Evidence Pack from the append-only Work journal. Verification runs contract-declared checks against the frozen changeset and may add an independent Codex or Claude review. The Trust Gate evaluates current evidence offline and fails closed when required evidence is missing, stale, contradictory, or invalid.

terminalsh
$ onpath evidence build wrk_... --json
$ onpath evidence verify-pack <evidence-pack-directory> --json
$ onpath verify wrk_... --agent claude --json
$ onpath work approve wrk_... --subject reviewer@example.com --role reviewer
$ onpath gate wrk_... --output gate.json --json

Stable exit codes

ExitMeaning
0Command or gate completed successfully.
2Invalid input or configuration.
3Unsupported adapter or insufficient enforcement fidelity.
4Runtime policy blocked an action or session.
5User stopped a paused session.
6Verification failed.
7Trust Gate blocked the work.
8Local evidence or storage integrity failed.

CLI reference

Core public commands and their most important flags. Run onpath <command> --help for the complete version-matched reference in your terminal.

onpath run

onpath run -- <agent> [args…]core

Wrap and monitor an agent command. Everything after -- is executed unchanged as a child process.

--time-budget <duration>
Warn after an elapsed budget such as 15m.
--mode <warn|pause|block>
Select intervention behavior for this run.
--daemon <auto|require|off>
Choose daemon-backed monitoring or the inline runtime.
--quiet
Suppress wrapped command output; findings and records are still produced.
--json
Emit machine-readable findings.

onpath report

onpath report [session]core

Print the report for a session. Use onpath recovery copy --latest when you want the recovery prompt on the clipboard.

--output <path>
Write the Markdown report to a file.
--include-raw-local-data
Include local command text, failure excerpts, and recovery prompts.
--json
Emit a machine-readable result.

onpath mcp

onpath mcp <install|uninstall> <tool>read-only

Install or remove the read-only MCP server for codex, claude, or cursor.

--workspace <path>
Choose the project or parent directory to discover.
--print
Preview the configuration action without changing files.
--json
Emit a machine-readable result.

onpath config & data

onpath config | data | doctorutility
config init
Create onpath.config.json with local defaults.
config print
Print merged defaults, user config, project config, and provenance.
data list
List local sessions.
data export --session <id>
Export one session with strict redaction defaults.
data delete --session <id>
Delete one local session.
doctor
Inspect runtime, database, daemon, tool discovery, and local-first checks.
esc
navigate open esc close