cc-habits (cch) · open source · MIT
cc-habits: the tool-agnostic memory layer for AI coding agents
Every coding agent, writing like you. cc-habits (cch) passively learns your coding habits from the edits you already make and carries them across Claude Code, Cursor, Codex, Gemini, Kimi, Cline, and any Git workflow, so every AI agent you use writes code in your own style, with no rules files to maintain by hand.
Install it in two commands:
npm install -g cc-habits
cch init
What cc-habits is
cc-habits is a local-first developer memory layer. Your habits live in plain Markdown on your own machine. There is no telemetry, no cc-habits server, and no analytics. The only network call is one small habit-extraction request per session to the LLM provider you choose (Anthropic, OpenAI, Groq, or a fully local Ollama model, in which case nothing leaves your machine at all).
Works with your whole toolchain
One memory profile, synced everywhere: Claude Code, Cursor, Codex CLI,
Gemini CLI, Kimi, Cline, Windsurf, GitHub Copilot (via AGENTS.md), and
any Git repository. Run cch sync to write your active habits
into AGENTS.md, .cursor/rules, and
.clinerules.
How cc-habits works
- Capture. A hook fires on every edit and appends a redacted diff to a local log, with no network call.
- Extract. At session end, one small-model call turns your batched edits into structured habit updates.
- Learn. New habits start as "learning" and only graduate to active after they appear in two distinct sessions. Stale habits decay; deleted ones are tombstoned so they are never relearned.
- Inject and sync. Active habits are written to a clean preferences file your tools read, and synced into AGENTS.md and other rule formats.
Key facts
- Private: no telemetry, no server, no analytics. One optional LLM call per session, or $0 and fully offline with Ollama.
- Low overhead: the capture hook does its work in about five milliseconds and never blocks your terminal.
- Safe: two-session graduation gate, confidence decay, permanent tombstones, and a sanitizer hardened against prompt injection.
- Open: MIT licensed, Node.js 20+, install with
npm install -g cc-habits.
Frequently asked questions
Does cc-habits work across all my projects?
Yes. Hooks live in each tool's settings (for example ~/.claude/settings.json or ~/.gemini/settings.json) and your habits live in ~/.cc-habits/, all user-level. Everything is global by default, with no per-project setup.
I already auto-generate a CLAUDE.md. Does cc-habits replace it?
No, it fills the gap. cch init adds a single @import line to your existing ~/.claude/CLAUDE.md and overwrites nothing. Your generated file stays; cc-habits keeps it current with what you actually do.
Will cc-habits slow down or break my coding sessions?
No. The capture and inject hooks run locally with no network call, and the capture work itself takes a few milliseconds. Every hook is wrapped in try/catch and exits 0 on error, so cc-habits can never fail or block a session.
What if cc-habits learns the wrong thing?
A new habit sits in the Learning section, invisible to your agent, until you repeat it in a second distinct session. Delete a rule and a tombstone blocks it forever; unused habits decay and get pruned. Every session ends with a one-line receipt in your terminal showing exactly what was learned.
Do I need a separate API key on top of my coding-tool plan?
They are separate purchases. If you only have a tool subscription, run with Ollama: free and fully local, no key required. Anthropic Haiku (about $0.09/month), OpenAI, and Groq are also supported.
What actually leaves my machine?
Exactly one call per session: the Stop hook sends a redacted batch of signals to your chosen provider, using your own key. Emails, Indian PAN numbers, and Luhn-valid credit-card numbers are stripped before anything leaves. With Ollama, nothing leaves at all.
Does cc-habits phone home?
Never. There is no cc-habits server, no telemetry, no analytics, no error-reporting endpoint. The only outbound call is the extractor call to the provider you pick.
Can I run cc-habits offline, and how do I wipe everything?
Signal capture works offline; if extraction cannot reach the API the Stop hook logs the error and exits 0, with no signals lost. To clear everything, run cch reset --yes (tombstones survive, so deleted rules never return).