agent-audit
Audit system for agent interventions (Hermes, Claude Code, subagents). 100% .md files, no database. Snapshots, rollback, chronological search. Tracks every action across months with ability to revert. Includes FR reference at references/audit-system-fr.md.
Quand l'utiliser (Trigger)
Déclenchement standard selon le contexte de l'écosystème Hermès.
Mode d'emploi (Usage)
Mode d'emploi standard via l'agent Hermès. Agent Audit System
.md-based audit trail for ALL agent interventions (Hermes, Claude Code, subagents). Snapshots for rollback. No database required.
Architecture
central/ # β Root: NOT audit-log/ standalone anymore
βββ INDEX.md # Automatically regenerated 7h20 daily
βββ audit/ # β Audit trail (was audit-log/)
β βββ INDEX.md # Chronological index (reverse order)
β βββ YYYY/
β β βββ MM/
β β β βββ YYYY-MM-DD.md # One entry per intervention
β β β βββ β¦
β β βββ β¦
β βββ snapshots/ # For rollback
β β βββ YYYY-MM-DD-HHMM/ # Timestamped snapshot
β β β βββ manifest.md # What was snapshotted
β β β βββ data/ # Copied files
β β βββ β¦
β βββ scripts/ # Migrated from audit-log/
β βββ audit-log.sh
β βββ audit-search.sh
β βββ audit-snapshot.sh
β βββ audit-rollback.sh
βββ documents/ # Guides, manuels
β βββ guides/
β βββ manuels/
βββ rapports/ # Veille RF, system, quotidien
βββ logs/quotidien/ # Copy of second-brain/05-Log/
βββ signaux/ # Cron output logs
βββ snapshots/configs/ # Claude/Hermes config backups
βββ configs/ # Active config snapshots
βββ scripts/
βββ sync-drive.sh # Daily Drive sync (cron 7h15)
βββ index-update.sh # Auto-regenerate INDEX.md (cron 7h20)
Entry Format
# Audit β 2026-05-29 06:00
## Intervention #042 β Title
- **Agent:** Hermes | Claude Code | subagent
- **Duration:** X min | **Model:** claude-sonnet-4-6
- **Tokens:** ~XK input / ~XK output
### Actions
1. Action 1
2. Action 2
### Files modified
- path/file (created|modified, X chars)
### Result
β
Done. Summary.
### Rollback
```bash
bash /home/bf/central/audit/scripts/audit-rollback.sh YYYY-MM-DD-HHMM
Snapshot
- ID: YYYY-MM-DD-HHMM
- Path: /home/bf/central/audit/snapshots/YYYY-MM-DD-HHMM/
## Scripts
See `references/scripts.md` for full bash scripts: audit-log.sh, audit-search.sh, audit-snapshot.sh, audit-rollback.sh.
### audit-log.sh
```bash
# Usage: audit-log.sh --agent TYPE --title "Title" [--desc "Description"]
# Creates entry in central/audit/YYYY/MM/YYYY-MM-DD.md
# Updates central/audit/INDEX.md with reverse-chronological entry
audit-search.sh
# Usage: audit-search.sh "search term"
# Greps across all central/audit/*.md files
# Returns: date, intervention#, title, agent, summary
audit-snapshot.sh
# Usage: audit-snapshot.sh "Snapshot description"
# Archives: ~/.claude/,~/.hermes/config.yaml,~/_claude/CLAUDE.md,
# ~/.hermes/skills/, second-brain/05-Log/
# Creates: snapshots/YYYY-MM-DD-HHMM/
audit-rollback.sh
# Usage: audit-rollback.sh SNAPSHOT_ID [files...]
# Shows diff before restoring
# Restores from snapshots/YYYY-MM-DD-HHMM/data/
# Without [files], lists all available files and asks
Multi-Channel Logging (Advanced)
For critical sync operations (Vikunja β Calendar, deploys, data transformations), use 3 channels instead of 1:
ββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Fichier .md (central/audit/) β
β β Section dΓ©diΓ©e, datΓ©e, action+status β
β β Path: /home/bf/central/audit/YYYY/MM/ β
ββββββββββββββββββββββββββββββββββββββββββββββββ€
β 2. Google Sheets β
β β Feuille "Log" dΓ©diΓ©e par opΓ©ration β
β β Colonnes: Date, Heure, Action, DΓ©tail, β
β Statut, Rollback β
β β Spreadsheet: 1U-GaOz6qmQaBP8NRwwRl... β
ββββββββββββββββββββββββββββββββββββββββββββββββ€
β 3. Vikunja (tΓ’che de log) β
β β Dans le projet concernΓ© β
β β Label "Sync" ou "Log" β
β β Description = dΓ©tail de l'action β
ββββββββββββββββββββββββββββββββββββββββββββββββ
Quand utiliser 3 canaux :
- Sync bidirectionnelle entre services (Vikunja β Calendar, etc.)
- Opérations avec rollback (modifications système)
- Actions qui impactent plusieurs services simultanΓ©ment
Quand 1 canal suffit :
- Actions simples (crΓ©ation fichier, lecture API)
- Modifications non-critiques
Integration
- Claude Code PostToolUse hook: auto-log every Write/Bash command
- Hermes: call
audit-log.shafter every major action (>3 tool calls) - Cron: daily INDEX.md health check script (now regenerated by
central/scripts/index-update.shat 7h20) - Drive sync:
central/scripts/sync-drive.shat 7h15 daily β pushescentral/archive to Google DriveVPS_Backups/central/
Migration History
Originally audit-log/ was standalone under /home/bf/. On 2026-05-29 it was migrated into /home/bf/central/audit/ as part of the unified central directory initiative. The old audit-log/ was preserved as central/.audit-log-backup-20260529-1246/ for rollback.
Scripts path update: If copying audit scripts from this skill, ALL paths use /home/bf/central/audit/ (not audit-log/).
Pitfalls
- Snapshots grow fast β auto-prune (>30 days old) via cron
- INDEX.md is append-only β use
tacfor reverse chronological (legacy);central/now uses auto-index via index-update.sh - Rollback = file restore, not git revert β always check diff first
- Never snapshot secrets (.env, credentials/) β add to .gitignore-style skip list