v0.6.6 on PyPIPython 3.11+Apache-2.0

cfgit: A clean tool for dirty workflows. Git for database config.

For the config rows your app and agents change in MongoDB or Postgres.

Set up with your agent

A 10-second demo. Nothing to set up.

How cfgit handles a row edited outside it

agent_configs:planner changed_outside_cfgit
-recorded @1provider.model "gpt-4.1", retry.max 2
+live in MongoDBprovider.model "gemini-2.5-pro", retry.max 4edited straight in the database
  • cfg impact --llmexplains what it touches and how to roll back, before you write Claude · OpenAI · Gemini
  • cfg commitrefused, it would overwrite the edit
  • cfg adoptrecords the edit as @2
  • cfg restore @1puts the row back
  • cfg promoteships it from dev to prod and posts it to Slack

cfgit with a coding agent: drift, rollback, preview, branch review and promotion

claude · ~/support-agent
mcp: cfgit

Catch a drifted edit

Raise the planner's retry max to 3 in dev.
cfgit - cfg_commit (MCP)(record: "agent_configs:planner", doc_json: "{…}", message: "raise planner retry max to 3")
Running cfg_commit…
write refused
status: dirtystate: changed_outside_cfgitcode: 2
live_oidb1d66d1b0da9…
head_oidc2a93a020293…

Look at the drift, then fold it into history (adopt) or throw it away (restore), then retry.

raw
  ⎿  {
       "status": "dirty",
       "code": 2,
       "message": "",
       "data": {
         "state": "changed_outside_cfgit",
         "live_oid": "b1d66d1b0da9…",
         "head_oid": "c2a93a020293…"
       },
       "state": "changed_outside_cfgit",
       "next": {
         "why": "The live record differs from what cfgit last recorded \u2026",
         "remedy": "Look at the drift, then fold it into history (adopt) or throw it away (restore), then retry.",
         "commands": [
           "cfg diff agent_configs:planner =HEAD =live",
           "cfg adopt agent_configs:planner -m 'adopt out-of-band change'",
           "cfg restore agent_configs:planner =HEAD -m 'discard drift'"
         ],
         "docs": "SKILL.md#reconcile-drift"
     … +2 lines (ctrl+o to expand)
cfgit - cfg_diff (MCP)(record: "agent_configs:planner", a: "=HEAD", b: "=live")
Running cfg_diff…
diff =HEAD → =live
status: ok
pathbeforeafter
provider.model'gpt-4.1''gemini-2.5-pro'
retry.max24
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "changes": [
           {
             "path": "provider.model",
             "op": "change",
     … +15 lines (ctrl+o to expand)

The commit was refused. Someone changed the planner outside cfgit: model gpt-4.1 to gemini-2.5-pro, retry.max 2 to 4. I won't write over that.

Want me to adopt their change first, then set retry.max to 3 on top?

yes
cfgit - cfg_adopt (MCP)(record: "agent_configs:planner", message: "adopt out-of-band model switch")
Running cfg_adopt…
adoptedstatus: ok
b1d66d1b0da9…seq 2
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "adopted",
         "oid": "b1d66d1b0da9…",
         "seq": 2
     … +4 lines (ctrl+o to expand)
cfgit - cfg_commit (MCP)(record: "agent_configs:planner", doc_json: "{…}", message: "raise planner retry max to 3")
Running cfg_commit…
committedstatus: ok
20e35401ca10…seq 3
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "committed",
         "oid": "20e35401ca10…",
         "seq": 3
     … +4 lines (ctrl+o to expand)

Done. The planner is at @3 with retry.max 3, on top of @2, the adopted model switch.
If 3 is wrong, cfg restore agent_configs:planner @2 puts it back.

Roll back a change

Roll the planner back to @2.
cfgit - cfg_restore (MCP)(record: "agent_configs:planner", ref: "@2", message: "put retry max back to 4")
Running cfg_restore…
restoredstatus: ok
b1d66d1b0da9…seq 4
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "restored",
         "oid": "b1d66d1b0da9…",
         "seq": 4
     … +4 lines (ctrl+o to expand)
cfgit - cfg_log (MCP)(record: "agent_configs:planner", limit: 4)
Running cfg_log…
history agent_configs:planner
status: ok
@4restoreb1d66d1b0da9put retry max back to 4
@3commit20e35401ca10raise planner retry max to 3
@2adoptb1d66d1b0da9adopt out-of-band model switch
@1importc2a93a020293initial import
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": [
         {
           "collection": "agent_configs",
           "record_id": "planner",
           "env": "dev",
           "seq": 4,
           "oid": "b1d66d1b0da9…",
           "parent_oid": "20e35401ca10…",
           "message": "put retry max back to 4",
     … +173 lines (ctrl+o to expand)
cfgit - cfg_status (MCP)()
Running cfg_status…
  • agent_configs:plannerclean@4
  • agent_configs:refund_resolutionclean@1
  • agent_configs:support_orchestratorclean@1
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": [
         {
           "collection": "agent_configs",
           "record_id": "planner",
           "state": "clean",
           "live_oid": "b1d66d1b0da9…",
           "head_oid": "b1d66d1b0da9…",
           "head_seq": 4,
     … +24 lines (ctrl+o to expand)

Rolled back. The planner is at @4, the same content as @2, and every record is clean. @3 is still in history if you want it again.

Preview before writing

Let refunds auto-approve up to 100 USD. Show me before you write it.
cfgit - cfg_commit (MCP)(record: "agent_configs:refund_resolution", doc_json: "{…}", message: "auto-approve refunds under 100 usd", dry_run: true)
Running cfg_commit…
dry run, nothing written
would_commitstatus: ok
pathbeforeafter
auto_approve_under_usd50100
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "would_commit",
         "type_changes": [],
         "validation_problems": [],
         "changes": [
           {
             "path": "auto_approve_under_usd",
             "op": "change",
             "before": 50,
             "after": 100
           }
         ],
     … +13 lines (ctrl+o to expand)

One field changes: auto_approve_under_usd goes from 50 to 100. Nothing is written yet. Go ahead?

go ahead
cfgit - cfg_commit (MCP)(record: "agent_configs:refund_resolution", doc_json: "{…}", message: "auto-approve refunds under 100 usd")
Running cfg_commit…
committedstatus: ok
94f5d3977ef2…seq 2
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "committed",
         "oid": "94f5d3977ef2…",
         "seq": 2
     … +4 lines (ctrl+o to expand)

Written as @2. The diff you saw is exactly what landed.

Review on a branch

Try gpt-4.1 for the orchestrator on a branch and open a PR. Don't touch live.
cfgit - cfg_branch_create (MCP)(name: "orchestrator-gpt-4.1", message: "try gpt-4.1 for the orchestrator")
Running cfg_branch_create…
branchorchestrator-gpt-4.1
from main
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "type": "branch",
         "id": "orchestrator-gpt-4.1",
         "name": "orchestrator-gpt-4.1",
         "base_branch": "main",
     … +11 lines (ctrl+o to expand)
cfgit - cfg_commit (MCP)(record: "agent_configs:support_orchestrator", doc_json: "{…}", message: "switch orchestrator to gpt-4.1", branch: "orchestrator-gpt-4.1")
Running cfg_commit…
committedruntime_mutated: false
bc_33c49a6b6c5f408a
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "committed",
         "branch": "orchestrator-gpt-4.1",
         "commit_id": "bc_33c49a6b6c5f408a",
         "collection": "agent_configs",
         "record_id": "support_orchestrator",
         "oid": "e7c667aa541a…",
         "runtime_mutated": false
       },
     … +3 lines (ctrl+o to expand)
cfgit - cfg_pr_create (MCP)(head: "orchestrator-gpt-4.1", message: "Switch orchestrator to gpt-4.1")
Running cfg_pr_create…
pr_fe4d17890978
openruntime_mutated: false
main←orchestrator-gpt-4.1
  • agent_configs:support_orchestrator1 change
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "type": "pr",
         "id": "pr_fe4d17890978",
         "status": "open",
         "base_branch": "main",
         "head_branch": "orchestrator-gpt-4.1",
         "head_commit_id": "bc_33c49a6b6c5f408a",
     … +20 lines (ctrl+o to expand)

pr_fe4d17890978 is open. Live still runs gpt-4.1-mini; nothing changes until it merges.

merge it
cfgit - cfg_pr_merge (MCP)(id: "pr_fe4d17890978")
Running cfg_pr_merge…
mergedruntime_mutated: true
e7c667aa541a…seq 2
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "state": "merged",
         "pr": "pr_fe4d17890978",
         "results": [
           {
     … +15 lines (ctrl+o to expand)

Merged. The orchestrator runs gpt-4.1 now, recorded as @2.

Promote dev to prod

Ship the planner change from dev to prod. Show me the diff first.
cfgit - cfg_promote (MCP)(from_env: "dev", to_env: "prod", record: "agent_configs:planner", message: "ship planner gemini change", dry_run: true)
Running cfg_promote…
dry run, dev → prod
would_commitstatus: ok
pathbeforeafter
provider.model'gpt-4.1''gemini-2.5-pro'
retry.max23
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "collection": "agent_configs",
         "record_id": "planner",
         "state": "would_commit",
         "type_changes": [],
         "validation_problems": [],
         "changes": [
           {
             "path": "provider.model",
             "op": "change",
     … +34 lines (ctrl+o to expand)

Two fields change in prod: provider.model gpt-4.1 to gemini-2.5-pro, and retry.max 2 to 3. provider.base_url is not copied, so prod keeps its own gateway. Ship it?

ship it
cfgit - cfg_promote (MCP)(from_env: "dev", to_env: "prod", record: "agent_configs:planner", message: "ship planner gemini change")
Running cfg_promote…
committeddev → prod
59c0ab5e0c73…seq 2
raw
  ⎿  {
       "status": "ok",
       "code": 0,
       "message": "",
       "data": {
         "collection": "agent_configs",
         "record_id": "planner",
         "state": "committed",
         "oid": "59c0ab5e0c73…",
     … +16 lines (ctrl+o to expand)
SlackBlock Kit, posted by [env.prod.notify]
cfgitAPP
planner promoted to prod
agent@demo.dev · “ship planner gemini change”
Record
agent_configs:planner @2
Changed
provider.model, retry.max
From
dev → prod
cfgit ·
raw
  ⎿  {
       "text": "planner promoted to prod by agent@demo.dev: ship planner gemini change",
       "blocks": [
         {
           "type": "header",
           "text": {
             "type": "plain_text",
             "text": "planner promoted to prod",
             "emoji": false
           }
         },
         {
           "type": "context",
           "elements": [
             {
               "type": "mrkdwn",
     … +32 lines (ctrl+o to expand)

Live in prod as @2, with where it came from recorded in history. Your team saw it land in Slack.

9 / 9

Install

Each install adds the cfgit MCP server and the cfgit skill. It runs on your machine and reads your project's .cfg.toml.

Try it without a database

Starts a throwaway Postgres, seeds two agent configs and a feature flag, and plays the whole story: an outside edit, the refused write, then diff, adopt and restore. Add --step to go one step at a time, or --keep to hand the demo database to your agent.

Claude Code

Open in Claude Code for VS Code

or in a terminal

More options

Inside a Claude Code session:

Older Claude Code versions:

Codex

1 Add the marketplace, once

2 Install the plugin

Or open the install in Codex
More options

The Codex button needs step 1 first. For the MCP server only, without the skill:

Cursor

Add to Cursor

Adds the cfgit MCP server in one click. It runs through uvx, so nothing else to install.

Claude Desktop

Download cfgit.mcpb

Open the file and Claude Desktop installs the extension.

Python

The CLI, for you and for scripts. Pick [mongo] or [postgres] if you only need one.

Questions

What is cfgit?
cfgit is open-source, non-custodial version control for config records in MongoDB and Postgres. It adds history, diffs, drift detection, rollback and dev-to-prod promotion to the rows your app already reads, without moving them, and agents use it over an MCP server.
Can cfgit promote config from dev to prod?
Yes. cfg promote copies a record, or every record with a tag, from one environment to another through the target's own permissions and validation. Fields listed in promote_ignore, like endpoints and keys, keep their per-environment values, and each promotion can post to Slack or a webhook.
Can cfgit explain a config change before I make it?
Yes. cfg impact lists the other records and the file:line places in your code that read a record, gives a risk level, and with --llm asks Claude, OpenAI or Gemini to explain what the change does, what it ripples into and how to roll it back. Pass --from with a proposed document to check a change before writing it. Agents get the same through the cfg_impact MCP tool.
How do I version control config stored in MongoDB?
Install cfgit, point a .cfg.toml at the collection and its id field, and import the live records as the first version. From then on, cfg status shows drift, cfg diff compares versions, and cfg restore rolls a record back. The records stay in MongoDB and your app keeps reading them as before.
Does cfgit move my data out of the database?
No. It's non-custodial: the live rows stay where they are, and cfgit keeps history in separate collections or tables next to them.
Which databases does it support?
MongoDB and Postgres, through adapters. The core imports no database drivers, so another store can be added by implementing the storage contract.
Can AI agents use it safely?
Yes. cfgit ships an MCP server, so a coding agent can inspect, diff, and change config through the same guarded operations as the CLI. Every change is versioned and revertable, and writes refuse to overwrite drift.
How is this different from backups or migrations?
Backups restore a whole database to a point in time, and migrations change schema. cfgit works per record: it shows what changed in one config row and lets you roll back just that row.
Is cfgit free?
Yes. It's open source under Apache-2.0 and installs with pip.