Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

258 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧭 compass

Let your coding agent off the leash β€” not off the rails.

Guardrails, a hard budget cap, and a self-fixing PR loop for your AI coding agent. eval-gated guardrails 100/100 Β· a budget cap that actually halts Β· you always merge

ci release license: MIT Claude Code Codex Gemini status: beta OpenSSF Scorecard

the guided tour β€” live demos, clickable architecture, one-click install

Real Claude Code session with COMPASS_MAX_USD=0.05: 'run ls' executes while session cost climbs $0.09 β†’ $0.35, then 'run git log' is BLOCKED β€” 'Budget ceiling reached: this session has spent ~$0.35, at or over your $0.05 cap. Stopping before it spends more.'

Real session, no edits: the cost climbs to $0.35, then the next action is HALTED at the $0.05 cap β€” before it spends more.

compass is a local-first config layer for Claude Code, Codex & Gemini that stops your agent from doing three things it shouldn't β€” burning your budget, running unsafe commands, and merging unverified code. Set COMPASS_MAX_USD=5 and the session hard-stops at the cap; catastrophic commands are blocked before they run β€” and the guardrail policy is scored 100/100 in CI against a labeled corpus, not asserted. You install it once, and you always merge.

# no curl|sh, fully reversible β€” then just open any repo in your agent
git clone https://github.com/dshakes/compass ~/compass && cd ~/compass && ./quickstart.sh
# or, inside Claude Code:   /plugin marketplace add dshakes/compass

🌐 Site Β Β·Β  Why it's different Β Β·Β  The self-fixing PR loop Β Β·Β  Loops Β Β·Β  Install Β Β·Β  What's in the box Β Β·Β  πŸ“š Docs


⭐ The part people screenshot: it fixes its own PRs.

Real screen recording of the loop on a live PR: the Reviewer posts Blocking findings and labels agent:needs-fix β†’ the Builder pushes 'fix: correct off-by-one' to the PR's own branch β†’ re-review goes clean and agent:reviewed-clean replaces agent:needs-fix. No human touched it; the merge stays yours.

Open a PR and compass reviews it, security-checks it, runs the tests, cross-audits it with two more models β€” three cross-model gates (Claude review Β· Codex audit Β· Gemini audit) β€” then pushes its own fixes until it's green. You merge. ☝ That's a real PR β€” every event above is inspectable.

The idea in one line: the loop is the unit of work. A one-shot agent stops at its first wrong answer. compass loops β€” generate β†’ test β†’ critique β†’ fix β†’ repeat against a gate β€” so quality comes from iteration, not one lucky prompt. β†’ how the loop works Β· the thesis


Why it's different β€” measured, not vibes

Every AI-agent config claims "safe" and "cheap." compass is the one that hands you the number β€” and lets a skeptic reproduce it in 30 seconds. Everyone has the same models; the edge is configuration you can trust. Five claims, five commands:

πŸ›‘ Guardrails with a score. Catastrophic commands and secret writes are blocked before they run β€” and the policy is eval-gated in CI, not asserted.

compass bench     # β†’ guardrail 100% precision/recall (61-case bench corpus; a separate 147-case bypass corpus gates CI), router 96.9%
# then ask the agent to `rm -rf /` or write a .env β†’ denied; `rm -rf ./build` β†’ allowed

πŸ§ͺ Red-team resistance, measured. Prompt-injection (direct/indirect/paste), agent-config poisoning, local safety-override, malware & insecure-code β€” scored against a labeled corpus that gates CI, obfuscation-resistant (--attack), with optional escalation to a managed guardrails backend. A poisoned repo or web page can't quietly turn your agent against you β€” and you can measure how well that holds.

compass redteam            # β†’ injection corpus 100% P/R (99 cases) + 100% obfuscation-robust, then scans THIS repo's config/MCP/settings
compass redteam --external # β†’ score the detectors against a public corpus we DIDN'T write (honest: 90% precision, and we tell you why recall is what it is)

Most tools show you 100% on their own test set. We show that too β€” and the number against someone else's corpus, because a floor you can only hit on your own cases isn't a floor.

πŸ’Έ A budget ceiling that actually stops it. Usage trackers report spend; compass enforces it β€” the session is halted before the next tool call once your dollar cap is reached. An agent can't quietly run up a $40 bill while you're away.

export COMPASS_MAX_USD=5     # this session hard-stops at $5 β€” blocked, not warned
compass spend --max-usd 5    # the same ceiling on the ledger, for scheduled / fleet runs

πŸ“‰ Cost routing that's measured. Cheap work goes to cheap models β€” ~62% cheaper than all-Opus at 96.9% routing accuracy on the 44-case routing evalset, with the pricing table and token assumptions stated in the output. Run the number, don't take it.

compass route "redesign the auth model"    # β†’ opus
compass route "fix a typo"                 # β†’ haiku
compass bench                              # β†’ routed vs all-Opus: ~62% cheaper (assumptions printed)

πŸ” Supply chain you can verify. Releases carry keyless SLSA provenance β€” a tampered or look-alike download is rejected β€” and the repo publishes an OpenSSF Scorecard. And before you trust someone else's plugin, scan it.

compass verify                 # resolves the latest release β†’ βœ“ provenance verified
compass audit-plugin ./their-marketplace   # injection Β· tool-poisoning Β· unpinned MCP Β· fetch-and-execute hooks β€” before you install

compass red-team layer: untrusted input (prompt/paste Β· web/MCP/tool output Β· CLAUDE.md/AGENTS.md Β· .claude/settings.json) β†’ decode & normalize (base64/hex/entity/zero-width/ASCII-smuggling/homoglyph/leet) β†’ detectors (injection Β· authority-spoof Β· MCP tool-poisoning Β· context-poisoning Β· safety-override Β· data/DNS exfil Β· malware Β· insecure-code Β· prompt-leak), eval-gated 100% P/R β†’ warn+audit / block / optional managed backend β†’ human merge gate.

No service, no telemetry, no --dangerously-skip-permissions; git pull to update. The work it can't safely own, it hands back β€” you keep the merge.


See it work

The day-to-day feel β€” guardrails, the cost-aware status line, the loop, and the crew, in ~25 seconds:

Terminal demo: compass blocks 'rm -rf /' (red) while 'rm -rf ./build' is allowed (green), shows the cost-aware status line, then the autonomous PR loop β€” review Β· security Β· tests Β· second-model audit β†’ BLOCKING auto-fixes on the branch and re-reviews β†’ CLEAN β†’ you merge.

How the loop works β€” review Β· security Β· tests Β· cross-audit run in parallel; Blocking findings get auto-fixed and re-reviewed (round-capped) until green, then it stops at you:

Autonomous SDLC loop: push a PR β†’ Reviewer, Auditor (second model), Security, QA run in parallel β†’ BLOCKING labels agent:needs-fix β†’ the Builder fixes on the branch and pushes β†’ re-review (round cap Γ—3) β†’ CLEAN β†’ checks green β†’ human merge gate β†’ you merge.

Run it locally in 30s with ~/compass/sdlc/orchestrate.sh "<task>" (no tokens), or wire the GitHub loop for every PR. β†’ how it works Β· reproduce it

And the everyday status line quietly keeps score, so you watch it earn its keep:

Opus 4.8 Β· myrepo Β· main* Β· 45k ctx Β· $1.23 Β· 🧭 πŸ›‘1 🧹2 πŸ’‘1 πŸ“‰~$1.65

session spend, then today's compass activity: πŸ›‘ footguns blocked Β· 🧹 files formatted Β· πŸ’‘ policy nudges Β· πŸ“‰~$ estimated saved vs all-Opus. Nothing leaves your machine.


Loops all the way up

Autonomy here isn't one big magic button β€” it's the same closed loop applied at five scales. Each runs until a gate says "done," then stops at a human. That's the whole trick: iteration under a gate beats a single confident guess.

Loop What it drives Where it stops
πŸ” The task loop generate β†’ test β†’ critique β†’ fix β†’ repeat β€” one change driven to green when tests + review pass
πŸ”Ž The review loop review β†’ auto-fix the Blocking findings β†’ re-review, round-capped (Γ—3) hands off to a human if still red
🩺 The CI-fix loop any check suite goes red β†’ failure log + auto-fix on the PR; main goes red β†’ one free rerun, then a ci-fix/* PR round cap β†’ a human; never merges
πŸ›°οΈ The fleet loop the whole pipeline, scheduled across every repo you own, overnight, test-gated a PR per repo, approve from your phone
πŸ‘₯ The workflow loops parallel agents that fan out, fact-check each other, and converge one synthesized answer

The newest turn of the crank β€” pr-shepherd: every open PR taken end-to-end β€” diagnose the red check from its log, classify it, fix + verify the mechanical ones, and stop at a merge gate that's enforced server-side (required checks + ruleset, not the agent's honor). Run it on demand (/pr-shepherd), on an interval (/loop 15m /pr-shepherd), or unattended: compass schedule add pr-shepherd --twice-daily.

The PR shepherd loop: 1 enumerate every open PR (skip drafts, forks stay read-only) β†’ 2 diagnose by reading the failing log, never guessing β†’ 3 classify environmental / mechanical / real defect β†’ 4 fix mechanical failures and pass the gate locally first β†’ 5 push to the PR's own branch (three-strikes cap) β†’ all checks green? β†’ squash-merge (green + session authority; gate enforced server-side by required checks + ruleset) or inbox where a human decides (real defects are never auto-fixed silently β€” the diagnosis is already written on the PR). State persists in state/shepherd.md and the loop fires twice daily, or on an interval via /loop.

A loop that runs while you sleep is five moves β€” discovery β†’ handoff β†’ verification β†’ persistence β†’ scheduling β€” and compass ships a primitive for each. It also guards the four costs a loop runs up silently (verification debt, comprehension rot, cognitive surrender, token blowout): an independent evaluator that assumes broken and runs it, compass digest to keep you understanding what merged, the permanent human gate, and per-day + live budget caps. β†’ the five moves & four guards Β· the thesis

Every loop ends the same way β€” you merge. That gate never moves.


Install

Pick the door that fits β€” all reversible, version-pinnable, no curl | sh. You need an AI assistant (Claude Code; Codex/Gemini optional) + git. No API keys for the manual, guardrails, crew, and CLI; the autonomous PR loop and fleet need model auth when you opt in.

🍺 Homebrew β€” managed & versioned

brew install dshakes/tap/compass         # latest release Β· --HEAD to track main
compass quickstart                       # previews, asks, then wires it into ~/.claude

πŸ“¦ Git clone β€” own & edit your config (recommended)

git clone https://github.com/dshakes/compass ~/compass && cd ~/compass
git checkout "$(git describe --tags --abbrev=0)"   # optional: pin to the latest release
./quickstart.sh          # previews every change, asks first, fully reversible

🧩 Claude Code plugin β€” no terminal (ideal for a team)

/plugin marketplace add dshakes/compass
/plugin install compass@compass

πŸ› οΈ By hand: make dry-run (preview) β†’ make install β†’ make doctor. β†’ Team rollout

πŸš€ Put your other repos on it β€” one command each (or a list):

compass enable --schedule owner/repo ~/code/another-repo   # config + PR gates + secrets-from-env
                                                           # + required-checks ruleset + auto-merge
                                                           # + twice-daily pr-shepherd (--dry-run to preview)

What install actually does: replaces your global ~/.claude config (settings, CLAUDE.md, agents, skills, hooks…) with symlinks into the repo β€” so git pull/brew upgrade updates everything. Anything it replaces is backed up first to ~/.claude/backups/; --copy copies instead of linking; make uninstall removes only what it added. Personal overrides (your model, plugins, UI prefs) live in claude/settings.local.json β€” gitignored, deep-merged at install, so your prefs never fight the shipped defaults.

One config, every agent

Agent Native install (no terminal) or own the files
Claude Code /plugin marketplace add dshakes/compass β†’ /plugin install compass@compass make install
Codex codex plugin marketplace add dshakes/compass β†’ /plugin install make install (~/.codex/AGENTS.md + config.toml)
Gemini CLI gemini extensions install https://github.com/dshakes/compass ./install.sh --gemini (~/.gemini/GEMINI.md)
Cursor Β· Copilot Β· OpenCode Β· Windsurf read the repo's AGENTS.md (AGENTS.md standard) clone + make install

CLAUDE.md Β· AGENTS.md Β· GEMINI.md are one file (symlinks), and the plugin/extension manifests are generated from one source and CI-checked (scripts/check-vendor.sh) β€” a git pull updates every agent at once and a manifest can't drift. The manifests are structure-validated in CI; the live gemini extensions install / codex plugin marketplace add paths are verified manually (those CLIs aren't in the runner).

Enforcement, not just the manual. Claude Code gets the full hook layer (guardrails, budget gate, scans). For everything else β€” Codex, Gemini, Cursor, any SDK β€” the budget cap travels via compass gate, a localhost proxy you point ANTHROPIC_BASE_URL/OPENAI_BASE_URL at, so the hard dollar ceiling holds for any agent, not only the one with hooks. β†’ 02-cost

βœ… Verify β†’ your first run

compass doctor      # validate the install β€” expect "0 error"
compass status      # is compass active here, and what's loaded?

Then open your agent as usual. Feel it in a minute: ask for a dangerous command (blocked), run /review on your diff, or compass route "<task>" to see the tier it picks. No tokens, no signup.


What's in the box

Everything below is on after one install or a single opt-in β€” the autonomous loops sit on top. Each row links to the detail.

Capability One line Deep dive
πŸ” Autonomous SDLC the review β†’ security β†’ tests β†’ cross-audit β†’ auto-fix β†’ re-review loop; you merge 09-sdlc
🩺 CI auto-fix no CI failure goes unhandled: red PR checks feed the fix loop; red main gets one free rerun, then a ci-fix/* PR 09-sdlc
πŸ”„ Loop engineering the five moves wired up: morning-triage discovery Β· pr-shepherd takes every open PR to the merge gate (on demand, /loop 15m /pr-shepherd, or compass schedule add pr-shepherd --twice-daily unattended) Β· an acting/skeptic evaluator Β· compass digest Β· per-day budget cap 20-loops
πŸ›°οΈ The fleet the loop, scheduled across all your repos through a test gate; approve from your phone 14-fleet
πŸ‘₯ The crew + workflows cost-tiered expert subagents Β· slash-commands Β· dynamic workflows that fact-check each other agents roster Β· 12 Β· 13
πŸ›‘ Guardrails & scanning a hook layer that blocks disasters, catches secrets (write-hook + compass scan), auto-formats, keeps a JSONL audit log 16-hardening
πŸ§ͺ Red-team hardening eval-gated defense vs prompt-injection, config poisoning, safety-override, malware & insecure code 17-red-team
🧭 Cost-tier router a standalone, reusable module β€” keyword heuristic β†’ optional classifier β†’ judge cascade; eval-gated router/
🧰 The compass CLI onboard · impact · drift · scan · redteam · audit-plugin · gate · sandbox · verify · audit-log · spend · dashboard 11-using
🚦 Cross-agent enforcement compass gate β€” a localhost proxy that hard-caps spend for Codex/Gemini/any SDK, not just Claude Code 02-cost
πŸ” Plugin-security scanner compass audit-plugin β€” vet a third-party plugin/marketplace (injection Β· tool-poisoning Β· unpinned MCP Β· fetch-exec) before you install it 17-red-team
πŸ”Œ MCP + LSP curated, version-pinned MCP servers + opt-in language-server intelligence 04 Β· 06
πŸͺͺ Every agent, one source Claude Code Β· Codex Β· Gemini β€” plus Cursor/Windsurf/Copilot via the AGENTS.md standard 12-every-agent
πŸ’Έ Live budget ceiling a hard cap that halts the session before the next tool call (COMPASS_MAX_USD), plus a per-day cap for unattended loops 02-cost

Safety, honesty & status

Built to be trusted before it's run β€” and honest about its limits.

  • You own the irreversible. Agents prepare; humans push, merge, deploy. Required checks + code-owner approval enforce it.
  • Readable & reversible. No curl | sh; the installer backs up what it replaces and make uninstall removes only what it added. Pin a tag, not main.
  • Guardrails reduce footguns; they are not a security boundary. Keep least-privilege credentials and review your diffs. For untrusted code, compass sandbox is a real boundary. Red-team hardening is defense-in-depth, not immunity β€” the cardinal rule (external content is data, not instructions) and the human gate are what actually hold.
  • What talks to the network. compass phones home to nothing. The pinned MCP servers reach the endpoints you'd expect (library docs, URLs you request); hooks are short, commented shell scripts in claude/hooks/ β€” disable any in your settings.

Status: beta. The core β€” manual, hooks, subagents, commands, MCP, plugin β€” is stable, dogfooded daily, and eval-gated in CI (guardrails + red-team scored on labeled corpora; run compass bench yourself). The SDLC pipeline is newer: statically validated in CI, exercised via a smoke-test you run on your own repo. Managed-guardrail adapters are contract-tested, with live cloud-backend calls unverified in CI (need your creds). Dynamic workflows are a research preview. The human merge/deploy gate is permanent, by design. β†’ full details


Docs

Start here β†’ Using compass β€” install, the pieces in plain language, the daily workflow. The thesis β†’ Loop engineering β€” why iteration-under-a-gate beats a one-shot guess. In practice β†’ The five moves β€” each move of a self-running loop, mapped to the primitive that builds it. Fundamentals β†’ The layers β€” prompt/context/harness/loop/graph, dated and evidence-graded, with a rubric for the next one. Fundamentals β†’ Context β€” the context window as a budget you spend, not a container you fill. Fundamentals β†’ Harness β€” everything around the model that isn't the model, and the evidence it moves outcomes more than the model does. Fundamentals β†’ The gate β€” a loop without a gate is just an agent talking to itself; generator vs. evaluator, and what makes a gate real vs. asserted. Fundamentals β†’ Verification β€” the ladder of what counts as proof, from "the model said so" to a human watching it run. Fundamentals β†’ Orchestration β€” when fan-out earns its cost, the Cognition/Anthropic disagreement, and graph engineering graded honestly. Fundamentals β†’ Ablation β€” make every config rule defend itself with a number, or admit your corpus never tested it. Fundamentals β†’ Glossary β€” every term from this series, alphabetized and graded, so you can look one up mid-sentence.

Philosophy Β· Architecture Β· Cost & models Β· Customize Β· MCP Β· Plugin & team rollout Β· LSP Β· Practices Β· Defaults Β· SDLC Β· Roadmap Β· Every agent Β· Workflows Β· Fleet Β· Competitive audit Β· Hardening Β· Red-team Β· Benchmark Β· Provenance Β· Loops Β· Run any framework Β· The layers Β· Context Β· Harness Β· The gate Β· Verification Β· Orchestration Β· Ablation Β· Glossary Β· Agents roster Β· Router module Β· ADRs


MIT Β· built to be shared Β· contributions welcome

About

🧭 Let your coding agent off the leash β€” not off the rails. Guardrails, a hard budget cap & a self-fixing PR loop for Claude Code / Codex / Gemini. Eval-gated 100/100, you always merge.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages