Aller au contenu
Hermès Skills
← Retour au catalogue

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.sh after every major action (>3 tool calls)
  • Cron: daily INDEX.md health check script (now regenerated by central/scripts/index-update.sh at 7h20)
  • Drive sync: central/scripts/sync-drive.sh at 7h15 daily β€” pushes central/ archive to Google Drive VPS_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 tac for 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