Git Audit Scheduled Hook
Periodic trigger for scripts/git_audit.py to maintain Git repository hygiene across the CODITECT ecosystem.
Purpose
Automatically run Git audit scans on a schedule to:
- Detect uncommitted work — Flag repos with changes at risk of data loss
- Identify stale repos — Surface repositories with no recent activity
- Monitor submodule health — Catch drift between submodule pointers and actual state
- Generate trend reports — Track hygiene metrics over time
Trigger
Event: Scheduled (cron/launchd)
| Schedule | Scope | Threshold |
|---|---|---|
| Daily (8am) | Active project dirs | 7 days |
| Weekly (Monday) | All project dirs | 30 days |
| Pre-release | Full submodule tree | 14 days |
Configuration
macOS (launchd)
<!-- ~/Library/LaunchAgents/com.coditect.git-audit.plist -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.coditect.git-audit</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python3</string>
<string>scripts/git_audit.py</string>
<string>/Users/halcasteel/PROJECTS</string>
<string>--output</string>
<string>/Users/halcasteel/PROJECTS/.coditect-data/audit-reports/git-audit-latest.md</string>
<string>--days</string>
<string>30</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>WorkingDirectory</key>
<string>/Users/halcasteel/PROJECTS/coditect-rollout-master/submodules/core/coditect-core</string>
</dict>
</plist>
Linux (cron)
# Daily at 8am — audit all projects
0 8 * * * cd ~/coditect-core && python3 scripts/git_audit.py ~/PROJECTS --output ~/.coditect-data/audit-reports/git-audit-$(date +\%Y\%m\%d).md --days 30
Output Location
~/.coditect-data/audit-reports/
├── git-audit-latest.md # Most recent report
├── git-audit-20260215.md # Daily snapshots
└── git-audit-20260215.json # JSON for dashboarding
Integration
| Component | Role |
|---|---|
scripts/git_audit.py | Audit engine |
/git-audit command | On-demand invocation |
skills/git-audit-patterns | Usage patterns and workflow |
hooks/git-audit-pre-push.md | Push-time guard |
Behavior
- Run
python3 scripts/git_audit.py <root> --output <report> --days <threshold> - Parse results for critical issues (UNSTAGED, STAGED_UNCOMMITTED)
- If critical issues found in active project repos, surface warning on next session start
- Archive report with date suffix for trend analysis