Context-governed coding CLI for more accurate AI edits.
Mimir is a coding CLI built around ideal context limits. Instead of sending a loose pile of files to a model, Mimir indexes the repository, selects the highest-signal evidence, fits it inside an explicit token budget, and writes a hashable context packet before any provider call.
The result is a more accurate coding loop: inspectable context, bounded edit targets, replayable prompts, redacted artifacts, source-controlled checks, and a fail-closed patch flow that makes AI edits easier to trust.
brew tap LivingEthos/mimir
brew install mimir
mimir --versionFor source evaluation:
git clone https://github.com/LivingEthos/mimir.git
cd mimir
cargo build --release
./target/release/mimir --version# Initialize a project
mimir init
# Check environment
mimir doctor
# Build a context packet
mimir context build
# Suggest starting context without a provider call
mimir context suggest "fix server refresh"
# Run source-controlled checks
mimir check --ci
# Persist read-only exploration evidence
mimir explore "where is packet replay handled?"
# Share or replay a portable redacted packet bundle
mimir packet share <run-id> --output shared-packet.json
mimir packet replay shared-packet.json --request-json
# Ask a provider for an implementation plan
mimir plan --editable src/lib.rs "Plan the change"
# Generate, validate, apply, and test a safe patch
mimir code --editable src/lib.rs --dry-run "Implement the change"
mimir code --editable src/lib.rs "Implement the change"
mimir code --editable src/lib.rs --recipe focused --param target=src/lib.rs "Implement the change"
# Import local session history as private provisional memory
mimir memory import-sessions --from codex path/to/session.jsonl
mimir memory import-sessions --from codex --discover --dry-run
# Inspect a saved packet in the TUI
mimir tui --packet .mimir/runs/<run-id>/context_packet.json
mimir tui --server 127.0.0.1:7788 --task "Refresh context for this repo"
# Run the local context recall eval dataset
mimir eval context --dataset fixtures/context-recall-v1.yaml
# Start the local LSP/JSON-RPC server
mimir serve --rpc-stdio
mimir serve --port 7788Provider credentials are environment-only (GLM_API_KEY, ZAI_API_KEY, OPENAI_API_KEY, or provider-compatible equivalents). mimir code requires explicit --editable paths, refuses pre-existing dirty target files, writes redacted run artifacts under .mimir/runs/<run-id>/, validates strict packet-bound patch recipes with a dry-run preflight, records provider-suggested tests without executing them, and can run a bounded repair loop when safe detected tests fail. Auto-run test subprocesses are launched with provider keys and generic secret-like environment variables stripped. If detected tests still fail, Mimir fails closed after writing artifacts and keeps the failed patch in the worktree for inspection.
See docs/context-packets.md for the build, share, and replay lifecycle. See docs/agent-workflows.md for project guidance, context suggestion, source-controlled checks, code recipes, and read-only exploration.
For development work, start with AGENTS.md and docs/HANDOFF.md. AGENTS.md is the short repo-entry guide; docs/HANDOFF.md tracks the current hardening status, dirty work buckets, validation commands, and release blockers.
crates/mimir-cli— CLI entry point and command orchestrationcrates/mimir-core— orchestration layercrates/mimir-context— Context Governor (build, validate, hash)crates/mimir-edit— patch validation, application, test detection, repair loopcrates/mimir-eval— context recall eval harnesscrates/mimir-index— repo index (files, imports, exports)crates/mimir-memory— durable lesson store, importers, publishingcrates/mimir-providers— provider-neutral gateway and provider adapterscrates/mimir-retrieval— ranked context retrievalcrates/mimir-review— review, override, and source-controlled checkscrates/mimir-runs— run directory layout (sole writer under.mimir/runs/)crates/mimir-schemas— JSON Schema typescrates/mimir-security— safety classification, secret redactioncrates/mimir-server— JSON-RPC/LSP server transport and session handlingcrates/mimir-subagents— subagent registry, cost tiers, evidence collectioncrates/mimir-telemetry— trace spans, audit eventscrates/mimir-tools— tool runner with safety classificationcrates/mimir-tui— terminal UI and live server refresh
Use focused checks while iterating, then run the full production gate before release handoff.
cargo fmt --all -- --check
cargo clippy -p <crate-name> --all-targets -- -D warnings
cargo test -p <crate-name> --all-targetsFull validation:
./scripts/validate-production.shCommon broader checks:
cargo test --workspace
cargo clippy --workspace -- -D warnings
cargo build --releaseMimir is source-visible, not open source. You may view, clone, build, and run it for evaluation, but copying, redistribution, derivative works, commercial use, or integration into another project or service requires prior written permission from Living Ethos. See LICENSE.