cfgit
# cfgit
Git-style version control for records that live in your database, without moving them.
cfgit gives history, diff, rollback, tags, promotion between environments and drift detection
to the records that drive your system at runtime: agent configs, prompts, model routing,
feature flags, pricing and policy tables. Your app keeps reading the same MongoDB or Postgres
store, and scripts and admin tools can keep writing it. cfgit sits beside it, records every
change it makes, and refuses to overwrite a change it did not record.
<p align="center">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-inbox-dark.png"><img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-inbox.png" alt="The cfg ui inbox: records changed outside cfgit, each with recorded against live and adopt or discard" width="32%" /></picture>
<picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-diff-dark.png"><img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-diff.png" alt="Reviewing a record changed outside cfgit: local impact, recorded against live, and its history" width="32%" /></picture>
<picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-pull-request-dark.png"><img src="https://storage.googleapis.com/ausaf-public/portfolio-assets/cfgit-20261129/cfgit-pull-request.png" alt="A cfgit pull request: changed records and the diff it will write" width="32%" /></picture>
</p>
<p align="center">
<img src="docs/assets/cfgit-drift.gif" alt="Someone edits a record straight in Mongo; cfg status flags the drift, cfg set refuses to overwrite it and explains the fix, then adopt and the edit go through and status is clean" width="75%" />
</p>
**Try it in one command** (nothing to set up: it brings its own throwaway database, about 10 seconds):
```bash
uvx --python 3.12 --from 'cfgit[demo]' cfg demo
```
## What you get
- **Drift detection.** `cfg status` shows records someone changed outside cfgit; `cfg diff`
shows what changed; keep it (`adopt`) or throw it away (`restore --discard-drift`).
- **Safe writes.** Every commit is transactional and compare-and-swap guarded, and confirmed
by the database before it is reported. Partial edits with `cfg set`, previews with `--dry-run`.
- **Impact before you write.** Which other records and which lines of code (`file:line`) use
a record, a risk level, and optional LLM narration (Claude, OpenAI or Gemini).
- **Rollback and releases.** Tags, restore to a tag or a point in time, and `cfg promote`
between dev and prod through the target's own rules.
- **Built for agents.** An MCP server with dry runs, strict arguments and self-explaining
results, plus a skill for Claude Code and Codex.
- Also: branches and PRs over live records, a local web UI, Slack/webhook notifications,
write-time validation, secret stripping, and verified identity per environment.
Good for curated control-plane data edited by people and agents. Not for user content,
events, logs or high-write tables.
## Use it from an agent
<p align="center">
<a href="https://ausafmo.com/cfgit.html#install-claude-code"><img alt="Add to Claude Code" src="https://img.shields.io/badge/Claude_Code-Add_plugin-EC5B2C?style=for-the-badge&labelColor=2B2420&logo=claude&logoColor=white" height="32"></a>
<a href="https://ausafmo.com/cfgit.html#install-codex"><img alt="Add to Codex" src="https://img.shields.io/badge/Codex-Add_plugin-EC5B2C?style=for-the-badge&labelColor=2B2420" height="32"></a>
<br>
<a href="https://cursor.com/install-mcp?name=cfgit&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJjZmdpdFttY3AsbW9uZ28scG9zdGdyZXNdIiwiY2ZnLW1jcCJdfQ%3D%3D"><img alt="Add to Cursor" src="https://img.shields.io/badge/Cursor-Add_MCP-EC5B2C?style=for-the-badge&labelColor=2B2420&logo=cursor&logoColor=white" height="32"></a>
<a href="https://github.com/AusafMo/cfgit/releases/latest/download/cfgit.mcpb"><img alt="Install in Claude Desktop" src="https://img.shields.io/badge/Claude_Desktop-Install-EC5B2C?style=for-the-badge&labelColor=2B2420&logo=claude&logoColor=white" height="32"></a>
</p>
Or from a terminal (each installs the MCP server and the cfgit skill):
```bash
# Claude Code
claude plugin install cfgit --marketplace AusafMo/cfgit
# Codex
codex plugin marketplace add AusafMo/cfgit
codex plugin add cfgit@cfgit
```
- **Claude Desktop:** the button downloads `cfgit.mcpb`. Open it and pick your `.cfg.toml`.
- **Any other MCP client:** run `uvx --from 'cfgit[mcp,mongo,postgres]' cfg-mcp` over stdio with
`CFG_CONFIG` set to your `.cfg.toml`.
- **ChatGPT and claude.ai on the web** only connect to remote MCP servers; cfgit runs locally beside
your database, so they can't use it.
All the options, with copy buttons, are on the [install page](https://ausafmo.com/cfgit.html#install).
What agents should know: [docs/AGENTS.md](docs/AGENTS.md).
## Install
```bash
pip install 'cfgit[mongo,postgres,mcp]' # or just [mongo] / [postgres]
```
## Quick start
```toml
# .cfg.toml
[project]
name = "control-plane"
[[collection]]
name = "agent_configs"
id_field = "config_id"
[env.dev]
database = "mongo"
uri = "env:DEV_MONGODB_URI"
db = "my-dev-db"
```
```bash
cfg init && cfg doctor # history store; secret / size check
cfg import --all -m "initial import" # start tracking
cfg status # anything changed outside cfgit?
cfg set agent_configs:planner model=fast --dry-run
cfg set agent_configs:planner model=fast -m "faster planner"
cfg log agent_configs:planner
cfg restore agent_configs:planner @1 -m "roll back"
cfg ui # local web UI
```
## Documentation
| Doc | What's inside |
|---|---|
| [Guide](docs/GUIDE.md) | Why cfgit, setup, everyday flows, UI, agents, impact, safety model |
| [Usage](docs/USAGE.md) | Every command with examples |
| [Configuration](docs/CONFIGURATION.md) | `.cfg.toml` reference: collections, envs, validation, notifications, code refs |
| [Agents](docs/AGENTS.md) | MCP server, client setup, what agents should know |
| [Identity](docs/IDENTITY_AND_ATTRIBUTION.md) | Identity modes, tokens and permissions |
| [Adapters](docs/ADAPTERS.md) | MongoDB and Postgres details |
| [History contract](docs/HISTORY_CONTRACT.md) | Reading cfgit history from your own tools |
| [Upgrading](docs/UPGRADING.md) | Changes between versions |
| [Index](docs/README.md) | Everything else |
## License
Apache-2.0. See [LICENSE](LICENSE), [NOTICE](NOTICE) and [CREDITS.md](CREDITS.md).
TDQS
Scored across 33 tools
Most tools target clearly distinct resources/actions, and the descriptions actively differentiate overlapping areas such as drift comparison, impact analysis, and branch diff. The main ambiguity is among the several mutating paths (cfg_set, cfg_commit, cfg_bulk_commit, cfg_import, cfg_adopt, cfg_restore), but their scopes are mostly clarified.
All tools share a cfg_ prefix and are readable, but conventions are mixed: action-first names like cfg_show and cfg_diff coexist with resource-first names like cfg_branch_list and cfg_pr_create. Noun-like names such as cfg_status, cfg_doctor, and cfg_fsck also break a strict verb_noun pattern.
With 33 tools, the surface is heavy for a config-versioning server, especially after adding five branch tools and five PR tools. Each tool appears purposeful, but the count exceeds a well-scoped range and increases selection burden.
The set covers record lifecycle, history, drift detection, import/export, promotion, tags, branches, PRs, integrity checks, and identity setup. Minor gaps remain, such as no obvious record/collection listing or search tool and no tag-listing operation.