trs

trs doctor: installation health check

trs doctor runs 10 checks that cover every surface where a trs install can go wrong: the binary, the PATH, dependencies, the config dir, the history file, the hook pipeline, agent integrations, and agent-doc budgets. Use it after a fresh install, when an agent hook suddenly stops firing, or when debugging CI.

Quick reference

trs doctor          # human-readable report
trs doctor --json   # machine-readable; exits non-zero on any Fail

What each check does

Check What it verifies
trs binary Reports version + binary path (never fails, always informational).
trs in PATH which -a trs / where trs. Warns if multiple binaries exist so a shadowed install doesn’t silently win.
git available git --version. Required, several parsers assume git is present.
ripgrep available rg --version. Not required but needed for trs search.
config directory ~/.trs/ exists and is writable. Creates it if missing.
history writable ~/.trs/history.jsonl can be written. Reports current size.
stdin pipeline functional Pipes "doctor probe\n" through trs clean and confirms roundtrip. Catches PATH vs executable-bit issues.
AI tool hooks Count of detected agents with trs hooks installed (see trs init).
output saver Count of agents with the output-saver block installed (see trs output-saver). Warns if zero.
rules blocks the rules sections trs splices into ~/.codex/AGENTS.md and ~/.gemini/GEMINI.md: current, written by an older trs, duplicated, or from before the sentinels
agent docs Scans CLAUDE.md / AGENTS.md / rules files in cwd and reports total token budget. Warns if any single file exceeds ~5k tokens.

Reading the report

TRS Doctor: Installation Health Check

  ✓ trs binary
    version: 0.5.8
    path:    /Users/you/.local/bin/trs
  ✓ trs in PATH
    path: /Users/you/.local/bin/trs
  ✓ git available
    version: git version 2.52.0
  ✓ ripgrep available
    version: ripgrep 15.1.0
  ✓ config directory
    /Users/you/.trs
  ✓ history writable
    size: 586.5K tracked
  ✓ stdin pipeline functional
  ✓ AI tool hooks (9/9 configured)
  ~ output-saver not installed  → `trs output-saver --install` adds the rules block to agent configs
  ✓ 2 files, 1.8k tokens loaded per agent session  → run `trs audit-docs` to review duplicates / dead refs / embedded bloat

  ───────────────────────────────────
  9 passed   0 failed   1 warnings

Markers:

JSON mode

trs doctor --json

Returns a structured report suitable for piping into other tools. Exits with status 1 if any check failed. Useful in provisioning scripts:

if ! trs doctor --json > /dev/null; then
  echo "trs install is broken"
  exit 1
fi

Typical fixes

See also

What rules blocks is for

output saver already answered “is that block current?” for one of the two things trs writes. This is the other half. A rules block installs once and then freezes unless something checks it, and a frozen block is worse than no block: a text fix ships and reaches nobody, and the stale copy can end up contradicting the block beside it in the same file.

Four states, three of them actionable: