Installation

PRECC installs with a single command. It requires bash or zsh and Claude Code ≥ 1.0.

Install
Click to copy curl -fsSL https://raw.githubusercontent.com/yijunyu/precc-cc/main/scripts/install.sh | bash

Then register the hook with Claude Code:

bash
$ PRECC init
✓ PRECC installed
✓ Hook registered at ~/.claude/hooks/pre-bash.sh
✓ Active for all Claude Code sessions
Note: PRECC requires write access to ~/.claude/hooks/. If the directory doesn't exist, PRECC init creates it automatically.

Quickstart

After installation, PRECC is active immediately. No further config is needed. Start a new Claude Code session and the hook runs on every bash command Claude issues.

1

Install via curl (above) — downloads the binary and verifies the SHA256 checksum.

2

Run PRECC init — registers the hook and validates your Claude Code installation.

3

Start Claude Code as normal — PRECC is transparent. You'll see savings in your API usage dashboard within hours.

Verifying the hook

Run PRECC status to confirm the hook is registered and active:

bash
$ PRECC status
✓ PRECC
✓ Hook: ~/.claude/hooks/pre-bash.sh [registered]
✓ Skills loaded: 6 built-in, 0 community
✓ RTK rules: 32 active
✓ jj detection: enabled
✓ Licence: Community (free)

Config file

PRECC reads ~/.PRECC/config.toml. A default config is created on first run. You rarely need to edit it.

~/.PRECC/config.toml
# PRECC configuration

[core]
timeout_ms = 10 # abort hook after N ms
fail_open = true # always exit 0 on error

[skills]
enabled = ["prepend_cd", "warn_identify", "jj_translate", "rtk", "token_budget"]

[rtk]
auto_update = true

CLI reference

CommandDescription
PRECC initRegister the hook with Claude Code
PRECC statusShow current hook status and config
PRECC updateUpdate PRECC binary and RTK rules
PRECC skills listList all installed skills
PRECC skills install <name>Install a community skill
PRECC skills remove <name>Remove a skill
PRECC logsShow recent hook execution logs
PRECC uninstallRemove hook and clean up

Pipeline stages

Every command passes through up to 6 stages. Stages run in priority order and are skipped if not applicable.

StageSkillWhat it does
S1prepend_cdInjects missing cd /path/to/project && prefix when Claude issues a command from the wrong directory
S2warn_identifyIdentifies commands likely to produce verbose warning output and suppresses noise tokens
S3jj_translateDetects .jj/ repo and rewrites git commands to their Jujutsu equivalents
S4rtk_compressApplies RTK rewrite rules to reduce token-verbose command patterns
S5token_budgetTruncates known noisy output flags when token budget is tight
S6rtk_finalSecond-pass RTK compression on the rewritten command

Custom skills

A skill is a small executable (any language) that reads a command from stdin and writes the rewritten command to stdout. Exit 0 to apply the rewrite; exit 1 to pass the command through unchanged.

my-skill.sh
#!/usr/bin/env bash
# Read the command from stdin
cmd=$(cat)

# Apply your rewrite logic
if [[ "$cmd" == "npm test" ]]; then
echo "npm test --silent 2>&1 | tail -20"
exit 0
fi

# Pass through unchanged
echo "$cmd"; exit 1

Install your skill: PRECC skills install ./my-skill.sh --name my-skill --priority 3

Uninstall

Note: Uninstalling removes the hook entirely. Claude Code will return to its default behaviour with no PRECC processing.
bash
$ PRECC uninstall
✓ Hook removed from ~/.claude/hooks/
✓ Config preserved at ~/.PRECC/ (delete manually if desired)
✓ PRECC uninstalled