ChangeGuard is a local-first Rust CLI for change intelligence and Gemini-assisted development. It turns repository edits into deterministic impact packets, risk summaries, hotspot rankings, targeted verification plans, and bounded Gemini context.
The tool is designed to stay local and explain its work. It does not act as an autonomous coding agent.
One-line install for AI agents and developers:
iwr https://raw.githubusercontent.com/UnlikelyKiller/ChangeGuard/main/install/install.ps1 -UseB | iexcurl -fsSL https://raw.githubusercontent.com/UnlikelyKiller/ChangeGuard/main/install/install.sh | shManual install from a checkout:
cargo install --path .The LSP daemon is behind an optional feature:
cargo install --path . --features daemonSee docs/installation.md for installer options, release assets, and agent bootstrap instructions.
changeguard init
changeguard doctor
changeguard index
changeguard scan
changeguard impact
changeguard verify
changeguard hotspots
changeguard ask "What should I verify next?"init: create.changeguard/, starter config, starter rules, and.gitignorewiring.doctor: report platform, shell, path, and tool health.index: parse source code to build structural, entrypoint, call-graph, data-model, observability, and semantic vector indices. Supports SCIP ingestion.scan: summarize staged and unstaged git changes.watch: debounce file-system events into persisted batches.impact: generatelatest-impact.jsonwith symbols, imports, runtime usage, complexity, temporal coupling, hotspots, CI predictions, and federated impact.verify: build and run a deterministic verification plan using structural impact, temporal coupling, CI predictions, and Bayesian failure probability ordering. Includes--explainfor LLM failure rationales.ask: send sanitized impact context to Gemini or a local LLM. Supports natural-language--semanticcodebase search.search: sub-millisecond regex search via Tantivy trigrams and ranked BM25 codebase queries.hotspots: rank files by temporal change frequency multiplied by complexity.viz: export an interactive HTML Knowledge Graph visualization of codebase dependencies and risk heatmaps.federate: export public interfaces, scan sibling repositories, and show known federated links.ledger: transactional architectural memory (start, commit, rollback, audit, search, adr).daemon: optional LSP server with diagnostics, Hover, CodeLens, stale-data handling, and lifecycle management.reset: remove derived local state. Preservesledger.dbby default; use--include-ledgerto remove provenance data.
Generate an impact report using first-parent git history:
changeguard impactInclude all parent traversal for merge-heavy repositories:
changeguard impact --all-parentsRun predictive verification:
changeguard verifyDisable prediction and use rule-only verification:
changeguard verify --no-predictInspect risk hotspots:
changeguard hotspots --limit 20 --commits 500 --dir src --lang rs
changeguard hotspots --jsonUse Gemini narrative reporting:
changeguard ask --narrativeUse federated intelligence across sibling repositories:
changeguard federate export
changeguard federate scan
changeguard federate status
changeguard impactTrack changes with transactional provenance:
# Start a transaction before editing
changeguard ledger start --entity src/main.rs --category FEATURE --message "Add auth module"
# After editing and verifying
changeguard ledger commit --tx-id <id> --change-type MODIFY --summary "Added auth" --reason "API needs authentication"
# Quick single-file change
changeguard ledger atomic --entity src/config.rs --category REFACTOR --summary "Extract config validation" --reason "SRP"
# Lightweight note for docs changes
changeguard ledger note --entity docs/api.md "Update endpoint docs"
# Check status and reconcile drift
changeguard ledger status
changeguard ledger reconcile --all --reason "Intentional local changes"
# Search and audit
changeguard ledger search "auth logic" --category FEATURE --days 30
changeguard ledger audit --include-unaudited
changeguard ledger adr --output-dir docs/adrcargo run --features daemon -- daemonChangeGuard stores repo-local state in .changeguard/.
.changeguard/config.toml: runtime configuration, watch debounce, Gemini timeout/context, temporal traversal, hotspot defaults, and ledger settings (enforcement, auto-reconcile, verification gating)..changeguard/rules.toml: policy rules, protected paths, and required verification commands.
Examples live in docs/examples/config.toml, docs/examples/rules.toml, and docs/examples/CHANGEGUARD.md.
Generated state is rebuildable and stays inside .changeguard/.
.changeguard/reports/latest-scan.json.changeguard/reports/latest-impact.json.changeguard/reports/latest-verify.json.changeguard/reports/fallback-impact.json.changeguard/state/ledger.db.changeguard/state/schema.json.changeguard/state/current-batch.json
Impact packets are redacted before SQLite persistence. Gemini prompts are sanitized and truncated before subprocess execution.
ChangeGuard shells out to the gemini CLI. Ensure it is on PATH before using changeguard ask.
GEMINI_API_KEYcan be supplied from the process environment or a repo-local.envfile..envis ignored by git; use.env.exampleas the template.- By default, routine
analyze,suggest, and narrative requests usegemini-3.1-flash-lite-previewfor lower latency and cost. - High-risk packets and
review-patchrequests usegemini-3.1-pro-previewfor deeper reasoning and code review. - Set
gemini.modelin.changeguard/config.tomlonly when you want one explicit model for every ask mode. --mode analyze: blast-radius and risk reasoning--mode suggest: targeted verification recommendations--mode review-patch: patch review with live diff context--narrative: senior-architect risk narrative generated from one structured prompt
If Gemini fails after an impact packet is available, ChangeGuard writes a fallback impact artifact or reports why it could not.
- Windows 11 + PowerShell is the primary environment.
- Mixed Windows/WSL filesystem setups can be slower and may produce different tool availability.
- Keep
gitandgeminiinstalled in the environment where you run ChangeGuard.
See docs/architecture.md for module boundaries and current data flow.
- Work by conductor track.
- Keep changes phase-bounded and deterministic.
- Run
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --all-features -j 1 -- --test-threads=1before pushing.
See LICENSE.