🌈 99.9% vibe engineered with Claude Opus 4.6. Don't come for me.
terse is a Rust CLI that intercepts shell commands from Claude Code hooks, runs them through an optimization pipeline, and returns compact output designed to reduce token usage while preserving key signal.
- Installation
- Quick start
- What it does
- Current implemented scope
- Architecture overview
- Hook setup (manual / from-source builds)
- CLI usage
- Smart path setup (Ollama)
- Configuration
- Runtime files
- Development
- Web dashboard details
- Status
Downloads the latest release binary, places it in ~/.terse/bin/, creates a default config, and registers the Claude Code hook — all automatically.
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/benwelker/terse/master/scripts/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/benwelker/terse/master/scripts/install.ps1 | iexBoth scripts will:
- Download the correct binary for your platform/architecture
- Place it in
~/.terse/bin/and add to PATH - Generate a default
~/.terse/config.toml - Check for Ollama availability (optional, for Smart Path)
- Register the PreToolUse hook in
~/.claude/settings.json
To update or uninstall:
terse update # update to latest release
terse uninstall # remove hook, PATH, and all filesUninstall accepts --keep-data to preserve config and logs.
git clone https://github.com/benwelker/terse.git
cd terse
cargo build --releaseBinary path after release build:
- Windows:
target\release\terse.exe - macOS/Linux:
target/release/terse
After building from source, run terse config init to create your config and see PATH setup instructions, then register the hook manually (see Hook setup below).
# Verify installation
terse health
# Preview routing + optimization for a command
terse test git status
# View aggregate token savings after usage
terse statsExample terse test git status output:
terse Optimization Preview
==================================================
Command: git status
Hook decision: rewrite
Path taken: fast
Optimizer: git
Tokens: 120 -> 28 (76.67% savings)
--- Output ---
branch: main...origin/main
modified (2): src/main.rs, README.md
untracked (1): notes.txt
- Rewrites safe
Bashtool commands toterse run "<original command>"via Claude PreToolUse hook protocol - Routes output through:
- Fast path (rule-based optimizers:
git,file,build,docker,generic) - Smart path (local LLM via Ollama, opt-in)
- Passthrough (for unsafe/small/unoptimizable cases)
- Fast path (rule-based optimizers:
- Applies a deterministic preprocessing pipeline before path selection:
- Noise removal (ANSI/progress/spinner/boilerplate cleanup)
- Path filtering (collapses verbose dependency/build paths)
- Deduplication (collapses repeated lines)
- Truncation (head/tail preserve when still oversized)
- Whitespace normalization (trim + blank-line cleanup)
- Logs analytics and events for stats/trends/discovery
Currently implemented fast-path optimizers:
git— Git porcelain/history/diff/worktree compactionfile— file/listing/content command compactionbuild— test/build/lint output summarizationdocker— container/image/log/build output compactiongeneric— fallback whitespace + line-cap compaction
Supported command families include:
- Git:
git status,git log,git diff,git branch,git show,git stash,git worktree, short summaries forgit push|pull|fetch|add|commit - File/system:
ls|dir|Get-ChildItem,find,cat|head|tail|type|Get-Content,wc,tree - Build/test/lint:
cargo|npm|yarn|pnpm|dotnet|go|maven|gradle|make|cmake|msbuild|pipbuild/test/lint families - Docker:
docker ps,docker images,docker logs,docker inspect,docker build,docker pull|push,docker compose ps|build,docker network|volume ls
- Uses Ollama HTTP API (
/api/chat) - Disabled by default; enabled via config or
TERSE_SMART_PATH=1 - Performs validation before accepting LLM output
Never optimized:
- Destructive/editor commands like
rm,mv,vim,code, etc. - Commands with file output redirection (
>,>>) - Heredoc-heavy commands
- Existing
terse run ...calls (infinite-loop guard)
- Claude Code triggers PreToolUse hook (
terse hook) - Hook either:
- returns
{}(passthrough), or - rewrites command to
terse run "..."
- returns
terse runexecutes original command- Router preprocesses output (noise removal, path filtering, dedup, truncation, whitespace normalization) and selects path based on config + output size
- Optimized output is printed to stdout and logged
If you used the install script, the hook is already registered. For manual or from-source installs, add a PreToolUse hook entry to ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "/path/to/terse hook"
}
]
}
]
}
}terse hook
terse run <command>terse stats [--format table|json|csv] [--days N]
terse analyze --days N [--format table|json|csv]
terse discover [--format table|json|csv] [--days N]terse health
terse test <command>terse update # update to latest GitHub release
terse update --force # skip confirmation prompt
terse uninstall # remove hook, PATH, and all files
terse uninstall --keep-data # preserve config and logs
terse uninstall --force # skip confirmation promptterse config show
terse config init [--force]
terse config set <dotted.key> <value>
terse config resetterse web # opens http://127.0.0.1:9746
terse web --addr 0.0.0.0:8080 # custom bind address- Install Ollama
- Pull a model (default expected model is
llama3.2:1b)
ollama pull llama3.2:1b- Enable smart path:
TERSE_SMART_PATH=1or in config:
[smart_path]
enabled = true
model = "llama3.2:1b"
ollama_url = "http://localhost:11434"Config hierarchy used by terse:
- Built-in defaults
- Global config:
~/.terse/config.toml - Project config:
.terse.toml - Environment overrides:
TERSE_*
Generate a starter config:
terse config initUseful env vars:
TERSE_ENABLEDTERSE_MODE(hybrid,fast-only,smart-only,passthrough)TERSE_PROFILE(fast,balanced,quality)TERSE_SAFE_MODETERSE_SMART_PATHTERSE_SMART_PATH_MODELTERSE_SMART_PATH_URLTERSE_SMART_PATH_TIMEOUT_MS
- Config:
~/.terse/config.toml - Legacy smart-path JSON fallback:
~/.terse/config.json - Command analytics log:
~/.terse/command-log.jsonl - Raw hook event log:
~/.terse/events.jsonl - Hook diagnostic log:
~/.terse/hook.log
cargo build
cargo test
cargo clippy
cargo fmt --checkLive LLM integration tests (requires Ollama running):
TERSE_TEST_LLM=1 cargo test llm_liveterse ships with a built-in web dashboard — a single-page app compiled into the binary with zero external dependencies.
terse webOpens http://127.0.0.1:9746 in your default browser and serves:
- Dashboard — total commands, token savings, path distribution bar, top commands table
- Trends — daily bar chart of token savings over the last 30 days
- Discovery — passthrough/smart-path commands that could benefit from new fast-path optimizers
- Configuration — form-based editor for all key settings, saving directly to
~/.terse/config.toml
The server is synchronous (tiny_http), single-threaded, and binds to localhost only by default. Override with --addr.
This repository is an actively evolving implementation. The long-range roadmap and phase plan are tracked in:
.claude/plans/terse-FINAL-Plan.md
Current codebase already includes hook integration, router, preprocessing pipeline, fast-path optimizers (git, file, build, docker, generic), LLM smart path integration, analytics commands, TOML-based configuration management, web dashboard, cross-platform support, and CI/CD workflows.