Chronicle
Commit messages say what changed. Chronicle captures what was learned.
Chronicle is a CLI tool that stores the reasoning, constraints, and hard-won lessons behind code changes as structured metadata alongside your commits. It works with any git repository, requires no external services, and turns every commit into a piece of institutional memory that survives context switches, team changes, and the end of an AI agent's session.
$ git chronicle read src/auth/middleware.rs
gotcha: Must validate expiry before signature check — callers sleep on
the return value without validation (short-circuit on expired tokens)
src/auth/middleware.rs (commit a1b2c3d)
dead_end: Tried inline validation but it made unit testing impossible
without spinning up a full HTTP server.
src/auth/middleware.rs (commit a1b2c3d)
insight: Extract token validation into standalone function — simpler,
no mock HTTP server needed.
src/auth/middleware.rs (commit a1b2c3d)
Why
A diff shows what changed. A commit message summarizes the change. Neither captures the reasoning that shaped it — why this approach and not three others that were tried first, what invisible constraint the code depends on, which part of the design is load-bearing and which is provisional.
That reasoning lives in someone's head, or an AI agent's context window, and is gone within hours. The next person to touch the code has to reverse-engineer it from the implementation, often rediscovering the same dead ends.
Chronicle captures this knowledge at commit time and makes it queryable. When you or an agent modify code later, you can check what assumptions it was built on, what depends on its behavior, and what will break if you change it.
Install
This puts the git-chronicle binary on your PATH. Git discovers it
automatically — all commands are available as git chronicle <command>.
Requires Rust 1.70+ and git. The web feature (enabled by default) requires
Node.js 22+ and npm for building the web viewer assets.
Getting started
# One-time machine setup (configures your LLM provider, installs Claude Code skills)
# Initialize Chronicle in a repository
# Make commits normally, then annotate:
Annotation paths
Live path — you or an AI agent provide the annotation as JSON. Zero cost, instant. This is the primary path — agents already know the reasoning behind their changes, so no LLM call is needed.
# Rich annotation with wisdom entries:
# Quick summary for trivial changes (typos, renames, dep bumps):
Batch path — an LLM reads the diff and produces annotations automatically.
Useful for backfilling history. Requires an API key (ANTHROPIC_API_KEY).
What goes in an annotation
The annotation schema (chronicle/v3) is wisdom-first — it captures what
agents and developers learned that no tool can reconstruct from code alone:
| Field | Purpose |
|---|---|
| summary | Why this approach — must add information beyond the diff |
| wisdom | Structured lessons learned, each categorized and optionally file-grounded |
Each wisdom entry has a category and free-form content:
| Category | What it captures |
|---|---|
dead_end |
Approaches tried and abandoned — saves future agents from rediscovering failures |
gotcha |
Non-obvious traps invisible in the code — constraints, hazards, security boundaries |
insight |
Mental models, key relationships, architecture decisions |
unfinished_thread |
Incomplete work, suspected better approaches, tech debt |
Wisdom entries can be grounded to a specific file and lines range, or left
unscoped for commit-wide lessons.
Agents can query the exact schema at runtime: git chronicle schema annotate-input.
Querying annotations
# Read all wisdom for a file
# What gotchas and constraints exist here?
# What was decided and what was rejected?
# Quick orientation for a file
# What depends on this code's behavior?
# How has understanding of this code evolved?
# One-stop context lookup (contracts + decisions + history)
Knowledge store
Beyond per-commit annotations, Chronicle maintains a repo-wide knowledge store for lessons that apply across many commits — coding conventions, module boundaries, and anti-patterns discovered over time.
# List all knowledge entries
# Record a convention
# Record an anti-pattern
# Record a module boundary
# Remove an entry
Correcting annotations
Annotations can be wrong. Chronicle provides a correction mechanism rather than silent overwrites, so the evolution of understanding is preserved.
# Flag an annotation as potentially inaccurate
# Apply a correction
Team workflows
Annotations are stored as git notes
under refs/notes/chronicle and sync like any other git data.
# Enable sync with your remote
# Pull annotations from teammates
# Check sync status
# Export/import for backups or migration
Browsing annotations
# Interactive TUI explorer
# Web viewer
Claude Code integration
Chronicle is designed to work with Claude Code
and other AI coding agents. Running git chronicle setup installs skills
and hooks so agents automatically:
- Read wisdom before modifying code — checking what gotchas, dead ends, and insights previous agents recorded about the code they're about to change
- Annotate after committing — using the live path (zero LLM cost) to capture wisdom entries while reasoning is still in context
- Accumulate knowledge — recording repo-wide conventions and anti-patterns in the knowledge store as they're discovered
Each agent session builds on the last. Gotchas written by one agent prevent the next from making the same mistake. Dead ends save future agents from rediscovering failed approaches. Over time, the repository accumulates a layer of institutional memory that makes every agent (and every human) more effective.
How it works
Annotations are stored as git notes under refs/notes/chronicle, separate
from your commit history. Each commit gets a structured JSON annotation
(chronicle/v3 schema) containing:
- Summary — why this approach, not what changed
- Wisdom — categorized lessons learned (
dead_end,gotcha,insight,unfinished_thread), each optionally grounded to a file and line range - Provenance — how the annotation was produced (live, batch, backfill, squash, amend) and by whom
Older annotations (chronicle/v1, chronicle/v2) are migrated transparently
on read — no bulk rewrite needed.
The knowledge store lives on a separate ref (refs/notes/chronicle-knowledge)
and holds repo-wide conventions, module boundaries, and anti-patterns.
Querying uses git log --follow to find which commits touched the file you're
asking about, then fetches their annotations. No external database, no index
to build — it's just git.
All commands
| Command | Description |
|---|---|
| Setup | |
git chronicle setup |
One-time machine-wide setup (LLM provider, skills, hooks) |
git chronicle init |
Initialize Chronicle in the current repository |
git chronicle reconfigure |
Rerun LLM provider selection |
| Writing | |
git chronicle annotate |
Annotate a commit (--live, --summary, --commit <sha>) |
git chronicle backfill |
Annotate historical commits that lack annotations |
git chronicle note |
Stage a note to include in the next annotation |
git chronicle flag |
Flag an annotation as potentially inaccurate |
git chronicle correct |
Apply a correction to a specific annotation field |
| Reading | |
git chronicle read |
Read annotations for a file (--anchor, --lines) |
git chronicle contracts |
Query contracts and dependencies ("what must I not break?") |
git chronicle decisions |
Query design decisions and rejected alternatives |
git chronicle deps |
Find code that depends on a file/anchor |
git chronicle history |
Annotation timeline across commits |
git chronicle summary |
Condensed annotation overview for a file |
git chronicle lookup |
One-stop context lookup (contracts + decisions + history) |
| Knowledge | |
git chronicle knowledge list |
List repo-wide conventions, boundaries, and anti-patterns |
git chronicle knowledge add |
Add a knowledge entry |
git chronicle knowledge remove |
Remove a knowledge entry by ID |
| Browsing | |
git chronicle show |
Interactive TUI explorer |
git chronicle web |
Launch web viewer |
| Team | |
git chronicle sync |
Manage notes sync (enable, status, pull) |
git chronicle export |
Export annotations as JSONL |
git chronicle import |
Import annotations from JSONL |
git chronicle status |
Show annotation coverage for the repository |
git chronicle doctor |
Run diagnostic checks |
| Developer | |
git chronicle schema |
Print JSON Schema for annotation types |
git chronicle context |
Manage pending context (set, show, clear) |
License
MIT