git-daily-review
by mrosano1987
README.md
# π Git Daily Review
**Automated daily AI code review for any Git repository β usable as a CLI, a scheduled routine, or an MCP server for AI agents.**
Git Daily Review analyzes your daily commits across multiple repositories, checks them against your project's conventions and quality gates, and produces a structured Markdown report. It ships with an **MCP (Model Context Protocol) server**, so agents like Claude Code and Claude Desktop can run reviews, read reports, and curate the project knowledge base conversationally.
License: **AGPL-3.0-only** Β· Python 3.10+ core Β· TypeScript MCP server
---
## Highlights
- **Any repo, any language** β the AI adapts to your stack (TypeScript, Python, Java, Go, Rust, C#, β¦)
- **Multi-repo** β monitor as many repositories as you need in a single run
- **MCP server** β expose reviews, reports, and knowledge-base curation as agent tools
- **Multi-provider AI** β Anthropic Claude, OpenAI, Google Gemini, or any local model via Ollama (fully offline)
- **Self-improving knowledge base** β 7-layer project context that learns from each review, with a code-enforced auto-merge policy and human approval for high-impact changes
- **Markdown + HTML output** β every run writes `daily-summary.md` and a self-contained `dashboard.html` (quality trend, gate and per-author charts, filterable commit list, a table view behind every chart). No CDN, no network calls: your code review data never leaves the machine
- **Web portal** β a local, navigable interface over every report collected: a default reviewer dashboard plus custom ones you build from widgets, commit and review history with diffs, per-day reports, a git-flow graph of the real branch topology, release timeline from version tags, author mentoring signals and the KB queue
- **RAG-ready** β optional integration with an external RAG service for semantic context
- **Cross-platform scheduling** β macOS (launchd), Linux (cron), Windows (Task Scheduler); secrets stay in `.env`, never in the scheduler files
- **Setup wizard** β web-based configuration, no manual YAML editing required
---
## Quick start (CLI)
```bash
git clone https://github.com/YOUR_USER/git-daily-review.git
cd git-daily-review
# 0. Dependencies in a virtualenv (setup.py does this for you if you skip it)
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
# 1. Configure (opens the wizard in your browser)
python3 setup.py
# 2. Secrets (cloud providers only β Ollama needs none)
cp .env.example .env # then add e.g. ANTHROPIC_API_KEY=...
chmod 600 .env
# 3. First review
python3 scripts/daily_review.py
# 4. Schedule daily runs
python3 scripts/scheduler.py --install
```
CLI reference:
```bash
python3 scripts/daily_review.py # review today
python3 scripts/daily_review.py --date 2026-05-12 # specific date
python3 scripts/daily_review.py --days 5 # last N days
python3 scripts/daily_review.py --collect-only # git data only, no AI
python3 scripts/daily_review.py --history # report history index
python3 scripts/daily_review.py --catch-up-check # show skipped runs and the recovery plan
python3 scripts/daily_review.py --catch-up-only # recover skipped runs only (no review of today)
python3 scripts/daily_review.py --catch-up-only --catch-up-all # also the ones beyond the limit of 6
python3 scripts/daily_review.py --catch-up-ignore-before 2026-09-24 # stop flagging older skipped runs
python3 scripts/daily_review.py --no-catch-up # skip the preventive check
python3 scripts/portal.py # web portal on http://127.0.0.1:8765
python3 scripts/review_db.py --sync # import new report files into the database
python3 scripts/review_db.py --rebuild # rebuild the database from reports/
python3 scripts/review_db.py --stats
python3 scripts/kb_manager.py --review # interactive KB curation
python3 scripts/kb_manager.py --approve <ID> # non-interactive approve
python3 scripts/kb_manager.py --reject <ID> # non-interactive reject
python3 scripts/kb_manager.py --stats
```
### Skipped runs are recovered automatically
Every scheduled run (no `--date`/`--days`) starts with a preventive check of
the last 30 days of working days (MonβFri). A run counts as **skipped** when
that day has no report, when its `git fetch` failed (incomplete data), or when
it ran before the scheduled hour (it only saw the morning's commits). A day
is covered by a valid run of its own or by a recovery run that included it.
Skipped runs are recovered with **one** run over the continuous interval from
the oldest one to recover until today 00:00, excluding commits already
reviewed (from the review database). The report goes into the folder of the
last skipped day, with the covered interval and the recovered runs in its
header; today's report notes what was recovered.
At most **6** runs are recovered without asking (the most recent). Beyond
that, an interactive run asks for confirmation; an unattended run recovers the
6 and leaves the older ones *awaiting confirmation*: they are flagged in
today's report (so in the digest and briefing) until you recover them
(`--catch-up-only --catch-up-all`) or dismiss them
(`--catch-up-ignore-before`). The recovery is postponed if `git fetch` fails.
State lives in `data/catch_up.json` (git-ignored).
The `python3` above can be any interpreter: if it lacks the dependencies, the
entry points re-exec themselves under the project `.venv` (or `$GDR_PYTHON`),
and tell you how to create it if there isn't one. This matters for cron and
launchd, where `python3` is often the bare system Python.
---
## Web portal
```bash
python3 scripts/portal.py # opens http://127.0.0.1:8765
python3 scripts/portal.py --port 9000 --no-browser
```
A single local page (Python standard library + vanilla JS, SVG charts, no CDN,
listening on `127.0.0.1` only) backed by a local SQLite database:
| View | What it shows |
|------|---------------|
| **Dashboard** | Default *reviewer overview* (KPIs with delta vs. previous period, quality trend, commits per branch type, findings per severity, top violated gates, quality per author, directory hotspots, commit-time heatmap, findings to discuss). Create custom dashboards β blank or from the *Author mentoring* / *Releases & stability* templates β and add widgets: KPI, line, columns, stacked columns, horizontal ranking, heatmap, commit or finding tables. Each widget picks a metric (commits, quality, findings, critical+error, churn, files, % reviewed, authors, lines per commit), a grouping (day/week/month, author, repo, branch, branch type, gate, severity, directory, file, weekday, hour, quality band), an optional split and its own filters. |
| **Daily reports** | Coverage per day (failed `git fetch` flagged), then per-day KPIs, charts, the digest, briefing and full report rendered, and a link to that day's `dashboard.html`. |
| **Briefing** | Every dev-team briefing, current and earlier versions, by preparation date: the five points as sections, the open question highlighted, links to the source digest; digests left without a briefing are flagged, and a table collects the open questions asked to the team over time. |
| **Commit history** | Every collected commit with its review outcome; search, filter, sort; a drawer with findings, files and the diff (falls back to `git show` on the local clone when the diff was not saved). |
| **Authors** | Quality, findings by severity, average commit size and the recurring gate per author (mentoring signal). |
| **Git-flow** | Lane graph of the real topology from the local clone (`git log --all`, never `fetch`): branches coloured by type (main, develop, release, hotfix, feature, bugfix), merges, tags, and review score on reviewed commits; weekly activity by branch type and review coverage. |
| **Releases** | Version tags with the number of commits each release introduced and the days between releases. |
| **KB suggestions** | Read-only view of the suggestion queue; decisions still go through `kb_manager.py`. |
Global filters (period, repository, author) apply to every view.
### Review database
`data/review.db` (SQLite, git-ignored, override with `$GDR_DB`) archives what
the routines produce: collected commits with diffs, review outcomes and
findings, per-repo collection status and AI summaries, the day's documents
(`daily-summary.md`, `digest.md`, `briefing.md`, β¦) plus the briefings parsed
into structure (digest date, preparation date, sections, open question β
table `briefings`), the KB suggestion queue
and the custom dashboards. It is fed in three ways:
- `daily_review.py` imports the day at the end of every run;
- `html_report.py --date` (the step after the digest) re-imports the day, so the digest lands too;
- the portal runs an incremental sync (file mtimes under `reports/` and
`config/kb_suggestions/`) at most every 5 s while in use, so documents
written by agents β such as the morning briefing β show up with no extra hook.
`reports/` stays the source of truth: `review_db.py --rebuild` recreates the
database from it (custom dashboards are kept). Days stay in the database even
if their report folder is later deleted. Git-flow and releases are still read
live from the local clones.
---
## Autofix: from findings to pull requests
An agent run (the `autofix` project skill, usually as the last phase of the
scheduled routine) can turn the day's critical/error findings into small
fixes, each reviewed by a project bot and opened as a pull request. **Nothing
is ever merged automatically**: the PR is where a person does the final review.
```
candidates β triage (fix | skip) β prepare (worktree on autofix/<day>-<hash>)
β fix + commit β check β bot review (VERDETTO: APPROVATO)
β publish (push the autofix branch + open PR) β report
```
`scripts/autofix.py` owns every step that must not be skipped; the agent only
supplies the judgement (is the finding real, what is the minimal fix, does
the bot's feedback make sense):
- **candidates** come from the review database: configured severities only,
process rules such as `GIT-*` excluded, one candidate per commit, already
handled commits never come back;
- **check** refuses uncommitted work, diffs over `max_files`/`max_lines`,
secrets and lock files, and runs the repository's own checks if configured;
- **review** sends the findings, the rationale and the diff to the reviewer
command (by default `pa bot ask`) and approves only a complete answer that
ends with `VERDETTO: APPROVATO` β escalations and low confidence count as
"no". Rounds are capped;
- **publish** is the only path to the remote. It pushes nothing unless the
approved review and a passing check both refer to the exact head commit,
the branch is an `autofix/β¦` branch, and today's PR cap is not reached.
It then opens the PR on Bitbucket (REST API) or GitHub (`gh`) toward the
branch of the original commit. The Bitbucket token is read from an
environment variable or the macOS Keychain and never printed or stored.
Without a token (or when the API refuses it) the branch is still pushed and
the report links Bitbucket's "create pull request" page, with the title and
description ready to paste in `reports/<day>/autofix/<id>-pr.md`.
Setup: copy `routine/autofix.example.yaml` to `routine/autofix.yaml`
(git-ignored), list the repositories with their reviewer profile and PR host,
and, for Bitbucket, store a token with pull-request write access:
```bash
security add-generic-password -U -s git-daily-review-bitbucket -a "$USER" -w
```
State lives in `data/autofix.json`; per-day output in
`reports/<day>/autofix.md` and `reports/<day>/autofix/*-review-N.md`.
Tests: `python3 -m unittest discover -s tests`.
### One daily run, any agent harness
The whole routine (RAG and Confluence ingest, review, digest, next-morning
briefing, autofix) is the `daily-agent` skill, in `.agents/skills/` (read by
Antigravity and other harnesses) and `.claude/skills/`. Site values live in
`routine/agent.yaml` (template `routine/agent.example.yaml`, git-ignored copy).
Schedule it on more than one harness β e.g. Claude Code at 17:00 and
Antigravity at 19:30 as a backup for days when the first app is closed or its
credit runs out. `scripts/agent_run.py begin|end --harness X` makes sure only
one run completes the day: the backup exits at once if the day is done, waits
if a run is in progress, and takes over a run that went stale.
The autofix reviewer can have backups too (`reviewer.fallbacks` in
`routine/autofix.yaml`): they are tried in order only when the previous one
gives no complete answer (credit exhausted, error, timeout); a real negative
verdict is final. `format: agy-json` reads `agy -p β¦ --output-format json`.
In headless mode Antigravity cannot ask for permissions, so pass the reviewed
repositories with `--add-dir` (files outside the workspace are denied).
### Notifications (Teams or Telegram) and evening watchdog
With `notify` in `routine/agent.yaml`, `agent_run.py end` posts the day's
outcome and `begin` posts when a backup takes over an interrupted run.
Messages carry outcomes and counts only: no repository, file, author or
finding text.
`scripts/notify.py watchdog` (launchd template
`routine/com.gitdailyreview.watchdog.plist`, 21:00) is plain Python: it warns
when no harness closed the day, even if every agent app is closed or out of
credit.
**Teams.** In Teams, create a Workflow from the template *Post to a channel
when a webhook request is received* (or *Post to a chatβ¦*), pick the channel,
copy the URL it shows and store it in the Keychain from the clipboard (the
interactive `-w` prompt cuts input at 128 characters, shorter than these URLs):
`security add-generic-password -U -s git-daily-review-teams -a "$USER" -w "$(pbpaste)"; pbcopy </dev/null`.
With the trigger's *Who can trigger the flow* set to *Anyone* the URL carries
an access signature (`sig=`): anyone holding it can post, so treat it as a
token. Many tenants only allow *Any user in my tenant*; Teams then answers 401
`DirectApiAuthorizationRequired` without a user token. In that case install
Azure CLI (`brew install azure-cli`), sign in once with `az login` and set
`auth: azure-cli` under `notify.teams`: each send asks `az` for a Power
Automate token of your account (never stored by this project; Azure CLI
refreshes it).
With `detail: full` under `notify.teams`, the run summary becomes a card with
the steps run, the day's numbers, a line per repository, the top
critical/error findings, each autofix attempt with the reviewer's verdict and
a button to the PR, and the briefing's headline and open question. Author
names and the per-author mentoring section never leave the local briefing,
since the channel is shared with the team. Telegram always gets the
outcome-only text. Messages arrive as Adaptive Cards.
**Telegram.** Store the bot token with
`security add-generic-password -U -s git-daily-review-telegram -a "$USER" -w`,
find the channel id with `python3 scripts/notify.py chat-ids`. Some managed
Macs block `api.telegram.org` (e.g. Microsoft Defender web filtering): use
Teams there.
`python3 scripts/notify.py test` sends a test message. When the channel is
unreachable or not fully configured, messages wait in `data/notify-outbox.jsonl`
and go out later, marked as late with their original time;
`routine/com.gitdailyreview.notify-flush.plist` retries every 30 minutes.
---
## MCP server (use it as an agent)
The `mcp/` directory contains a TypeScript MCP server that wraps the review engine.
```bash
cd mcp
npm install
npm run build
```
Register it with **Claude Code**:
```bash
claude mcp add git-daily-review -- node /absolute/path/to/git-daily-review/mcp/dist/index.js
```
Or add it to **Claude Desktop** (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"git-daily-review": {
"command": "node",
"args": ["/absolute/path/to/git-daily-review/mcp/dist/index.js"]
}
}
}
```
Exposed tools:
| Tool | What it does |
|------|--------------|
| `run_daily_review` | Run the review for today, a date, or the last N days |
| `get_report` | Read the full Markdown report for a date |
| `list_reports` | List available reports + history index |
| `list_kb_suggestions` | List KB suggestions (filter by status) |
| `decide_kb_suggestion` | Approve/reject a pending suggestion by ID |
| `kb_stats` | Knowledge-base statistics |
Then just ask your agent things like *βrun today's review and summarize the critical issuesβ* or *βshow me pending KB suggestions and approve the ones about naming conventionsβ*.
Environment overrides: `GDR_ROOT` (project root, default: repo root), `GDR_PYTHON` (Python executable; default: the project `.venv` if present, otherwise `python3`).
---
## AI providers
| Provider | Models | API key env var | Notes |
|----------|--------|-----------------|-------|
| **Anthropic** | Claude Haiku, Sonnet, Opus | `ANTHROPIC_API_KEY` | |
| **OpenAI** | GPT-4o-mini, GPT-4o, o1-mini | `OPENAI_API_KEY` | |
| **Google Gemini** | Gemini 2.0 Flash, 1.5 Flash/Pro | `GEMINI_API_KEY` | |
| **Ollama** (local) | any pulled model | *(none)* | fully offline; set `num_ctx` in config (default 32768) to avoid prompt truncation |
Secrets live in a `.env` file at the project root (see `.env.example`), loaded automatically at startup. They are **never** written into launchd plists, crontabs, or batch files.
---
## Knowledge base (7 layers)
`config/knowledge-base.yaml` gives the reviewer structured project context:
```
L0 Identity Β· L1 Architecture Β· L2 Conventions Β· L3 Quality Gates
L4 Domain Β· L5 Integrations Β· L6 Release
```
After each run the system extracts *new knowledge* surfaced by the review and stores it as suggestions in `config/kb_suggestions/`. The auto-merge policy is **enforced by code** (not by the model): only new conventions and info/warning gates with confidence β₯ 0.85 can auto-merge, capped at 2 per run. Critical gates, domain rules, and integrations always require human approval β interactively (`kb_manager.py --review`), via CLI flags, or through the MCP `decide_kb_suggestion` tool.
Disable learning entirely with `kb_learning: false` in the `ai:` section of `config.yaml`.
---
## Project structure
```
git-daily-review/
βββ setup.py β setup wizard entry point
βββ requirements.txt
βββ .env.example β secrets template (never commit .env)
βββ config/
β βββ config.example.yaml
β βββ knowledge-base.example.yaml
βββ scripts/ β Python core
β βββ daily_review.py β orchestrator (loads .env at startup)
β βββ git_collector.py β fetch, commits, diffs
β βββ ai_reviewer.py β review pipeline
β βββ ai_provider.py β Anthropic/OpenAI/Ollama/Gemini abstraction
β βββ kb_updater.py β KB learning + code-enforced auto-merge policy
β βββ kb_manager.py β KB curation CLI (interactive + --approve/--reject)
β βββ rag_client.py β optional RAG client
β βββ report_generator.py β Markdown reports + history index
β βββ html_report.py β self-contained HTML dashboard (charts, filters)
β βββ catch_up.py β skipped-run detection and single-run recovery
β βββ autofix.py β findings β worktree fix β bot review β PR (gated)
β βββ agent_run.py β one completed daily run across harnesses (lock + marker)
β βββ notify.py β Teams/Telegram outcome messages + evening watchdog
β βββ keychain.py β tokens from env or macOS Keychain, never printed
β βββ portal.py β local web portal (HTTP server, read-only API)
β βββ review_db.py β SQLite review database: schema, import from reports, queries
β βββ portal_data.py β git-flow layout, releases, git show fallback
β βββ scheduler.py β launchd / cron / schtasks (no secrets on disk)
β βββ wizard_app.py β wizard HTTP backend
βββ mcp/ β MCP server (TypeScript)
β βββ src/index.ts
βββ routine/
β βββ agent.example.yaml β daily-agent site values template (copy to agent.yaml)
β βββ autofix.example.yaml β autofix settings template (copy to autofix.yaml)
βββ tests/ β python3 -m unittest discover -s tests
βββ templates/
β βββ wizard.html
β βββ portal.html β portal single-page app
βββ reports/ β generated daily reports (git-ignored)
```
---
## Roadmap
- [ ] Slack/email notifications for the daily report
- [ ] `--ci` mode: non-zero exit on critical findings (PR gating)
- [ ] Full TypeScript port of the core
- [ ] Remote repository support (review without a local clone)
Contributions welcome β open an issue or a PR.
---
## License
This project is licensed under the **GNU Affero General Public License v3.0** (AGPL-3.0-only). If you run a modified version as a network service, you must offer its source to the users of that service. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessOutdated data