Deterministic run-scoped governance for local coding agents: budget profiles, SQLite ledgering, patch/test checks, and advisory continue/warn/ask/stop decisions.
- Expanded budget profiles:
research_only,analysis,documentation_read,documentation_write,data_intake,tiny_fix,small_patch,medium_refactor,feature_work,architecture_review,debug_failure,test_work,exploratory_work,general_work,maintenance_work,supervised_work. - SQLite-backed run ledger at
state/governor/governor.sqlite. - Queryable runs/events/tests/patches with recent/search/get actions.
- Patch guard from unified git diff analysis.
- Test recording and summaries.
- Deterministic policy decisions:
continue,warn,ask_confirmation,stop. - CLI and MCP surfaces backed by the same service layer.
- Default:
<AGENT_GOVERNOR_ROOT>/state/governor/governor.sqlite - Override directory with:
AGENT_GOVERNOR_STATE_DIR - Legacy
.agent-governorfolders are tolerated but no longer used as default.
python -m pip install -e .
python -m agent_governor init
python -m agent_governor start --task "fix thrift prompt loop" --profile small_patch
python -m agent_governor check-budget
python -m agent_governor patch-check
python -m agent_governor record-test --command "python -m unittest" --exit-code 0 --summary "tests passed"
python -m agent_governor status
python -m agent_governor finish --status successLocal source usage without install:
$env:PYTHONPATH="src"
python -m agent_governor profilespython -m agent_governor init
python -m agent_governor profiles
python -m agent_governor doctor
python -m agent_governor version
python -m agent_governor start --task "..." --profile small_patch
python -m agent_governor event --kind tool_call --data '{"tool":"thrift.file_window","path":"README.md"}'
python -m agent_governor record-test --command "python -m unittest" --exit-code 0 --summary "ok"
python -m agent_governor check-budget
python -m agent_governor patch-check
python -m agent_governor status
python -m agent_governor finish --status success
python -m agent_governor finish --result success
python -m agent_governor reset --yesfinish --result is an alias for finish --status. If both are provided, they must match.
- Module:
src/agent_governor/mcp_server.py - Root selection:
AGENT_GOVERNOR_ROOT(defaults to current working directory) - State override:
AGENT_GOVERNOR_STATE_DIR - Public tool surface: exactly one MCP tool,
governor
{
"action": "start_run",
"params": {
"task": "Fix failing tests",
"profile": "small_patch"
}
}doctorversionlist_profilesstart_runrecord_eventrecord_tool_callrecord_testpatch_checkcheck_budgetstatusfinish_runreset_runrecent_runsget_runsearch_runsrecent_eventssearch_eventsget_eventmaintenance
doctorstale_runsclose_stale_runs_dry_runclose_stale_runs_apply(requiresconfirm=true)prune_old_events_dry_runprune_old_events_apply(requiresconfirm=true)export_jsonl
Governor stores run metadata in runs and run chronology in run_events, with normalized run_tests and run_patches tables. Searches use FTS5 when available and fall back to LIKE queries otherwise.
python -m compileall -q .
python smoke_test.py
python mcp_smoke_test.py
python -m unittest discover -s . -p "test*.py"MIT