Your coding agent already left training data on your laptop. Turn it into a small model that runs free, offline.
Every time you use Claude Code (or Codex, or any agent), it writes a detailed log
of how you work — your edits, your conventions, your commit voice. That log is
sitting in ~/.claude/projects right now, and it cost you nothing to produce.
tracekit reads those logs, keeps only the parts that actually shipped, and fine-tunes a small model on them. The result is a personal model that handles routine work — commit messages, small edits, routing — in your style, running 100% on your own machine for free. It falls through to a big API only when it should.
Honest scope. This is imitation SFT on your own traces — not distillation of any frontier model. A 0.5–3B model learns your habits and conventions; it does not learn frontier-level reasoning. It won't replace Claude. It will quietly take ~a third of your routine calls off your bill. Why that's different from distillation →
curl -fsSL https://raw.githubusercontent.com/haard18/tracekit/main/install.sh | bashOr pick your own tool:
pipx install "git+https://github.com/haard18/tracekit.git" # recommended (isolated)
uv tool install "git+https://github.com/haard18/tracekit.git" # if you use uv
pip install "git+https://github.com/haard18/tracekit.git" # plain pip
# to also train models (pulls torch), add the ML extra:
pipx install "tracekit[ml] @ git+https://github.com/haard18/tracekit.git"The core install is torch-free — just the CLI, log adapters, trace store, and
curation. You only need the [ml] extra to train. See docs/install.md
for GPU notes, ollama, and llama.cpp.
tracekit doctor # check your environment
tracekit scan # see what's on your machine — instant, read-only
tracekit go # the whole journey: scan → ingest → curate → build → train → eval → exporttracekit go runs the entire pipeline end-to-end and stops once to confirm before
the (long) training step. When it finishes you have a local model deployed to
ollama:
ollama run tracekit-nano # your model, running offlineNot ready to train? Everything before it is instant and useful on its own:
tracekit scan && tracekit ingest && tracekit statsRun on a real machine (48 projects of Claude Code history):
| stat | value |
|---|---|
| words of your history mined | 8.5M |
| edits that survived to a commit | 60% |
| trainable samples | 1,093 |
| model trained | Qwen2.5-Coder-0.5B, QLoRA, ~95 min on an M-series Mac |
| training loss | 2.90 → 0.93 (token accuracy 69% → 87%) |
| routable locally | ~31% of edit calls |
| deployed | tracekit-nano, q4_k_m, ~67 tok/s on Metal |
A live commit message from the trained model, written in the user's own voice
(including their real Co-Authored-By trailer — learned, not templated):
Fix the long wait in the WebSocket client: backoff on transient errors The connection held indefinitely until a good connection was established; add a backoff after each transient error so it doesn't spin.
Each stage is a command; tracekit go chains them. Every stage is local and
re-runnable.
scan detect coding-agent logs on this machine (instant, read-only)
ingest parse → local SQLite trace store (incremental)
curate scrub secrets · keep edits that shipped · score (git-survival signal)
build render curated traces into a training dataset (+ reproducibility manifest)
train QLoRA fine-tune a personal model (nano/small/standard/agent)
eval score on held-out sessions → report card (report.md + report.png)
export merge → GGUF → quantize → ollama model (runnable + shareable)
serve local OpenAI-compatible endpoint (student-first, API fallback)
- Trace distillation, stated honestly. tracekit does imitation SFT on your own session traces. It never queries or clones a frontier model. It learns your routing, conventions, and commit voice — the parts of "how you code" that live in your logs. Because the teacher is you, it needs no frontier access, no synthetic data pipeline, and no one else's model — the opposite of classic distillation, which keeps you downstream of whoever owns the biggest model.
- The acceptance signal is the moat. tracekit trains preferentially on edits that
survived to a git commit (via
git log -S, bounded to a recent window). That signal only exists in the combination of your local logs and your local git — it can't be bought or scraped. Bad edits you reverted don't teach the model. - The autonomy dial.
tracekit serveexposes an OpenAI-compatible endpoint with four trust levels you set withtracekit mode:shadow(API answers, model watches silently) →assist(model handles safe tasks) →hybrid(model-first for what it's good at, API fallback) →solo(fully offline).
- 100% local. Zero network calls in the core product. No telemetry, no phone-home.
- Inspectable. Everything lands in one SQLite file at
~/.tracekit/store.db. Open it yourself and see exactly what was extracted. - Secrets are scrubbed at the store boundary (pattern bank + entropy + sensitive filenames), and file reads store a digest, never contents.
- Full detail:
docs/privacy.md.
| source | status |
|---|---|
Claude Code (~/.claude/projects) |
✅ supported |
| Codex | 🛣️ roadmap |
| Aider | 🛣️ roadmap |
| Cursor | 🛣️ roadmap |
Adapters are small and self-contained (tracekit/adapters/) — contributions welcome.
- Python 3.11+ for the core CLI.
- Training (
[ml]extra): a GPU helps a lot. Works on Apple Silicon (MPS), NVIDIA (CUDA, with the[cuda]extra for 4-bit), or slowly on CPU via the mock backend for testing. - Fast local serving (optional): ollama. GGUF export uses
llama.cpp (auto-detected; set
TRACEKIT_LLAMA_CPPto point at a clone).
git clone https://github.com/haard18/tracekit.git && cd tracekit
python -m venv .venv && source .venv/bin/activate
pip install -e ".[ml,dev]"
pytest # 80 tests