Skip to content

thuongh2/git-mimir

Repository files navigation

Mimir — Code Intelligence for AI Agents

Mimir is a Go-based code intelligence engine that indexes your repository into a knowledge graph and exposes it to AI agents via MCP, HTTP API, and an interactive web UI.


What is Mimir?

Mimir builds a searchable knowledge graph of your codebase that helps AI agents (and humans) understand it faster.

Use Case How Mimir Helps
AI Agents (MCP) 7 tools for semantic search, impact analysis, and blast radius queries
Humans (Web UI) Interactive force-directed graph to explore code structure visually
Teams (Refactors) Impact analysis before editing — see what breaking changes affect

Why Mimir?

Metric GitNexus (Node.js) Mimir (Go)
Cold index (1,000 files) ~45s < 8s
Incremental re-index ~45s (full) < 2s
Hybrid search latency ~300ms < 80ms
Binary size 350 MB < 20 MB
RAM during index ~800 MB < 120 MB

Key improvements: Pure Go (zero CGO), 8-language support (TS, JS, Go, Python, Rust, Java, C, C++), incremental indexing via git-diff, Louvain community detection, embedded web UI.


Quick Start

Step 1: Install

# One-line (Linux/macOS)
curl -fsSL https://raw.githubusercontent.com/thuongh2/git-mimir/main/install.sh | sh

# Or via Go
go install github.com/thuongh2/git-mimir/cmd/mimir@latest

# Or download binary from GitHub Releases

Step 2: Index Your Code

# Full index with embeddings (requires ollama or OpenAI)
mimir analyze /path/to/your-project

# Faster — graph + BM25 only (no embeddings)
mimir analyze --skip-embeddings /path/to/your-project

# Skip auto-setup for manual control
mimir analyze --skip-daemon --skip-hooks --skip-skills /path/to/your-project

Step 3: Use It

Option A: Web UI (Humans)

mimir serve
# Open http://localhost:7842

Option B: MCP (AI Agents)

mimir daemon start    # Start background MCP server
mimir setup           # Auto-configure Claude Code, VS Code, Cursor, etc.

Installation

Method Command
One-line (Linux/macOS) `curl -fsSL https://raw.githubusercontent.com/thuongh2/git-mimir/main/install.sh
Go Install go install github.com/thuongh2/git-mimir/cmd/mimir@latest
Download Binary GitHub Releases
From Source git clone && cd git-mimir && make build

For detailed installation guide, see docs/installation.md.


CLI Reference

Command Description
mimir analyze <path> Index repository with auto-setup
mimir serve Start HTTP server + Web UI (default: port 7842)
mimir mcp Start MCP stdio server
mimir daemon start/stop/status Manage background MCP daemon
mimir daemon logs [lines] View daemon logs (default: 30 lines)
mimir list List indexed repositories
mimir status [name] Show index status
mimir clean <name> Remove index for a repository
mimir setup Configure MCP in all supported editors
mimir wiki [name] Generate wiki from knowledge graph

Analyze Flags

mimir analyze --skip-embeddings <path>   # Skip embeddings (faster)
mimir analyze --skip-daemon <path>       # Don't start MCP daemon
mimir analyze --skip-hooks <path>        # Don't install Claude Code hooks
mimir analyze --skip-skills <path>       # Don't install agent skills
mimir analyze --force <path>             # Force full re-index
mimir analyze --incremental <path>       # Force incremental mode
mimir analyze --hint <file> <path>       # Hint for faster patch planning

MCP Tools

AI agents get access to 7 tools via MCP:

Tool Description Example
query Hybrid search (BM25 + vector) "Find all auth-related processes"
context 360-degree symbol view "Show handleRequest definition and callers"
impact Blast radius analysis "What breaks if I change UserService?"
detect_changes Analyze uncommitted git changes "What processes did my commit affect?"
rename Plan coordinated multi-file rename "Rename AuthController to SessionController"
cypher Raw graph queries "Find unused exported functions"
list_repos List indexed repositories

Recommended Workflow

  1. Discovery: Use query() for semantic search
  2. Deep Dive: Use context() to understand a symbol
  3. Before Editing: Always run impact() first

For detailed usage, see docs/guide.md.


Auto-Analyze Features

Running mimir analyze automatically sets up:

  1. MCP Daemon — Background server for persistent MCP availability
  2. Editor Config — Auto-configures Claude Code, VS Code, Cursor, Windsurf, Zed, OpenCode
  3. Claude Code Hooks — Pre-search (graph-augmented search) and post-write (auto re-index)
  4. Agent Skills — 4 static methodology skills + dynamic module skills per cluster
  5. Context Files — AGENTS.md and CLAUDE.md with live index statistics

Log location: ~/.mimir/mimir-mcp.log

For complete feature documentation, see docs/features.md.


HTTP API

Method Endpoint Description
GET / Web UI
GET /repos List indexed repos
GET /repo/{name}/graph Full graph (nodes + edges)
GET /repo/{name}/query?q=... Hybrid search
GET /repo/{name}/context/{symbol} Symbol detail + edges
GET /repo/{name}/impact/{target} Blast radius analysis
GET /repo/{name}/clusters Louvain clusters
GET /repo/{name}/processes Execution flow traces
POST /repo/{name}/cypher Raw SQL query

Documentation

Guide Description
Installation Detailed installation and setup
Usage Guide Perfect workflow for daily use
Features Complete feature reference
Architecture System design and components
Algorithms Louvain, BM25, HNSW details

Tech Stack

Component Technology
Language Go 1.22+
AST Parsing smacker/go-tree-sitter
Storage modernc.org/sqlite (pure Go)
Vector Search sqlite-vec (HNSW)
Text Search Custom BM25
Clustering Louvain algorithm
CLI cobra
Web UI Sigma.js v2 + Graphology

Project Structure

mimir/
├── cmd/mimir/          # CLI entrypoint
├── api/                # HTTP server + embedded Web UI
├── mcp/                # MCP stdio server
├── internal/
│   ├── walker/         # File tree walker
│   ├── parser/         # AST parser (8 languages)
│   ├── resolver/       # Import/call resolver
│   ├── graph/          # Node/edge types
│   ├── store/          # SQLite layer
│   ├── embedder/       # Embedding pipeline
│   ├── cluster/        # Louvain detection
│   ├── process/        # Flow tracer
│   ├── incremental/    # Git-diff indexing
│   └── registry/       # Multi-repo registry
└── testdata/           # Test fixtures

Contributing

Contributions welcome! See GitHub Issues for open tasks.

License: MIT

About

Mimir is a Go-based code intelligence engine that indexes your repository into a knowledge graph and exposes it to AI agents via MCP, HTTP API, and an interactive web UI.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors