Skip to main content
Monogit indexes your git repository structure into a per-repo SQLite database. Beyond branch and commit tracking, it extracts code symbols and document headings at each commit — enabling temporal code analysis that knows what changed at each point in history.

Quick Start

# Index repository with symbol extraction
monogit index --symbols -n 5000 --all

# Which branches contain this commit?
monogit query abc123f

# Compare two branches
monogit compare main feature/new-ui

# Show database stats
monogit stats

Commands

index

Index git structure and optionally extract symbols at each commit.
monogit index                           # Branches + commits
monogit index --symbols                 # + code symbols + doc headings per commit
monogit index --symbols -n 5000 --all   # Full history, all branches
monogit index --diff                    # + parent→commit diffs
--symbols uses tree-sitter to parse changed files at each commit, extracting function/class/struct definitions at their exact line positions. Markdown files are parsed for heading structure.

query — Core Feature

Query which branches contain a specific commit.
monogit query <commit-hash>
Answers “where did this commit end up?” instantly from cache.

branches

List all indexed branches.
monogit branches

compare

Compare two branches (ahead/behind count).
monogit compare <branch-a> <branch-b>

stats

Show database statistics.
monogit stats

Commit Symbol Tracking

When --symbols is used, monogit stores what each commit touched at the symbol level:
Commit abc1234 changed lib.rs lines 3218-3262
  → Symbol: create_session (function, lines 3218-3262)
  → Ref: create_group_session calls create_session

Commit def5678 changed session.md
  → Entry: "Session Recovery" (h2, lines 45-67)
  → Doc ref: session.md mentions lib.rs
This data powers monoflow’s topic clustering, insights, and temporal analysis.

Supported Languages

LanguageExtraction
Rust, TypeScript, JavaScriptFunctions, methods, structs, classes, interfaces
CSSClasses, IDs, custom properties, @keyframes
HTMLElement IDs
Python, Go, ZigFunctions, classes
Markdown, MDXHeadings (h1-h5), document references

Filters

Build artifacts (dist/, .min.js), lock files, and obfuscated symbols (_0x*) are automatically excluded.

Pre-computed Analysis

At index time, monogit computes and stores analysis results for instant reads:

Temporal Drift

Detects file pairs that used to change together but have diverged.
lib.rs ↔ main.ts — 58x together, 87 days apart
  lib.rs: 89 solo commits since, main.ts: 2 solo

Commit Rhythm

Session count, peak hours/days, temporal distribution chaos score.

Quality Delta (9 signals)

Measures work quality from commit patterns:
SignalWhat it detects
temporalSteady 1-10min gaps = managed rhythm
churnSame file 3+ times in 1hr = struggling
convergenceCode+doc in same commit = aligned
divergenceCode changing but docs not following
commit_typefeat vs fix ratio
topic_focusTopic switching frequency
streakConsecutive fix commits = pain
thinking10-30min deliberate gaps
structuralNew files + refactors
Detects scenarios: Struggle, Exploration, ManagedFlow, Convergence, StructuralImprovement. Weights configurable via monoflow weights (saved to ~/.monolex/config/quality-weights.json).

Per-Repo Database

Each repository gets its own database:
~/.monolex/monogit/{name}-{hash}.db
A .registry file maps project paths to database files for automatic resolution.

Design

┌──────────────────────────────────────────────────────────────────┐
│  MONOGIT DESIGN                                                  │
├──────────────────────────────────────────────────────────────────┤
│                                                                  │
│  AI Code Context Engine — built on Monotology for AI & Human     │
│                                                                  │
│  Layer 1: Git structure                                          │
│    branches, commits, branch_commits (M:N)                       │
│                                                                  │
│  Layer 2: Symbol snapshots                                       │
│    commit_symbols  — code symbols + doc headings per commit      │
│    commit_refs     — call chain per commit                       │
│    commit_doc_refs — document cross-references per commit        │
│                                                                  │
│  "What was the code structure at this commit?"                   │
│                                                                  │
└──────────────────────────────────────────────────────────────────┘