Reference/CLI Command Reference

CLI Command Reference

Interacting with ghost and ghost-checkpoint binaries

Ghost ships two binaries: ghost (user-facing audit CLI) and ghost-checkpoint (lightweight hook runner called by agents).

ghost (Audit CLI)

ghost init [--yes | --interactive | --dry-run]

Initializes ghost in the current repo. With --yes, creates configs and binaries automatically. --dry-run previews what would happen. --interactive starts a guided setup.

ghost install [--global]

Installs hooks and session plugins into the current repo. With --global, applies to every repo on the machine.

ghost audit [--all | --range <sha>..<sha> | --json]

Runs the attribution blamer across commit history. Computes AI-authored line percentage and enforces threshold policies. Add --json for machine-readable output. Exit code 1 if AI% exceeds threshold.

ghost blame <file> [--json]

Prints a line-by-line attribution breakdown for a file, color-coded by human or agent source. Overlays ghost note data onto git blame output.

ghost doctor [--fix]

Checks hook integrity, missing ref configurations, and Git sync setup. With --fix, attempts to repair common issues automatically.

ghost config set <key> <value>

Reads and writes ghost.yml settings. Use ghost config to print the current config, ghost config set threshold 70 to change a value.

ghost-checkpoint (Hook Runner)

Called by agent pre/post tool hooks. Must stay fast — it runs on every agent edit.

ghost-checkpoint pre --agent <name>

Snapshot the working tree before agent edits. Saves the current diff to .git/ghost/working.log.

ghost-checkpoint post --agent <name> --model <model>

Compare current state against the pre-hook snapshot. Extracts changed line ranges and writes a session JSON to .git/ghost/sessions/.

ghost-checkpoint reset

Clear working log and session files. Useful after an aborted agent run.

DESIGN RULEThere is no ghost mark-human command. The absence of a ghost note is the complete declaration of human authorship. Adding an explicit override command would create an abuse vector — no such command exists or will be added.