Git for the config living in your database.
Version, diff, and roll back the rows that drive your app, without moving them out of Mongo or Postgres.
Feature flags, agent configs, model routing, thresholds: the config people edit straight in prod. A clean tool for dirty workflows.
The diff between what cfgit recorded and what is live in the database right now.
People and agents change your app's behavior by editing rows straight in the database. No diff, no history, no undo.
You can't put that config in git without moving it out of your database. So nobody does.
Adds versions, diffs, drift detection, and rollback around those rows, in place.
try it against a dev datastore
About 5 minutes against a local or staging database. A change made straight in the DB becomes a diff you can see and adopt, not a 2am incident.
00
install
pip install 'cfgit[mongo,postgres,mcp]'. Extras pick adapters.
01
configure
Add a .cfg.toml with your collection, id field, and env URI.
02
initialize
Run doctor, init history, import live records as the first head.
03
inspect
Run status and diff to see if the live DB drifted from history.
04
operate
status, diff, adopt, commit, restore, or the local UI.
track live records without owning the store
The interesting state is drift. Someone bumps the planner model in Mongo to unblock a demo, tells no one, and cfgit shows you exactly that diff instead of leaving you bisecting prod at midnight.
status flags drift, adopt folds it into history, and every write checks the live value first.
01
live record
The app keeps reading the same collection. cfgit never moves the runtime path.
02
recorded head
History keeps full JSON versions with stable content hashes.
03
drift check
Status compares live hash to head hash, marks out-of-band edits dirty.
04
adopt or stop
Bypassed changes become history, or commits refuse to overwrite them.
engine, adapters, CLI, UI, MCP
One engine does the careful part. The CLI, UI, and agent tools all get the same guarantees.
record history
Versioned JSON records with readable diffs, tags, show, restore, import, and system restore.
drift guard
Catches changes made straight in the DB and refuses to clobber them. Nothing gets silently overwritten.
Mongo and Postgres
The core imports no database drivers. Adapters implement the storage contract per datastore.
web UI
A localhost UI to browse history, diffs, adopt, and restore by clicking.
agent-safe
Let an agent edit config through MCP, and every change is versioned, diffable, and revertable like any other.
branches and PRs
Opt-in branches and pull requests for draft changes. Diff main..branch, then merge.
guardrails
Per-env identity, an optional approval gate, and secrets stripped before they hit history.
impact preview
See what a change touches before you commit it. Optional plugin, core stays provider-free.
shared action layer
Four layers, one operation envelope. Storage is swappable; the core imports no DB drivers and no LLM providers.
interfaces
CLI commands, JSON output, localhost UI, MCP tools, and portable agent instructions route through one operation envelope.
core engine
Opaque JSON records, canonical hashing, diffing, status, commit, adopt, tag, restore, branch refs, identity checks, and secret checks.
storage
MongoDB and Postgres adapters implement the storage contract and expose only the guarantees each store can back.
plugin boundary
cfgit-impact owns deterministic impact summaries and optional LLM narration. The core stays provider-free.
set it up with your coding agent
cfgit ships a Claude Code / Codex skill, an cfg-mcp MCP server, and portable agent instructions. Humans and agents use the same operation surface, so an agent can inspect, diff, and version config with the same guardrails you get.
1. Point your agent at cfgit
Set up cfgit in this repo. Install it (pip install 'cfgit[mongo,postgres,mcp]'), create a .cfg.toml pointing at my dev/staging database, install the cfgit skill and the cfg-mcp MCP server, then run cfg doctor and cfg import --all to record the current config as history. Docs are at github.com/AusafMo/cfgit. Never write to prod or use cross-project DB URIs without asking me first.
2. Or wire it manually
$ pip install 'cfgit[mongo,postgres,mcp]' $ cfg-mcp # run the MCP server your agent connects to # drop skills/cfgit/SKILL.md into your agent's skills, or point it at docs/AGENTS.md
The flow an agent follows
01
status
The agent runs cfg_status to see what drifted before touching anything.
02
diff + impact
cfg_diff then cfg_impact on any behavior-affecting record before it commits.
03
commit or adopt
Mutates through cfgit, never a raw DB write, so history and rollback stay coherent.
04
guardrails
It never commits over drift, and it can't write prod or cross-project without your say-so.