Implements audit-harness-inspired session lifecycle: audit session creation/end/recover/report-daily with JSONL buffer and graded context recovery (L0-L4). Guideline service for behavioral compliance rules (condition/action model with criticality). Correction service for persistent user correction tracking across agent sessions. 8 supporting skills: audit-start/end/report-daily/recover + command variants for slash-command integration.
2.3 KiB
2.3 KiB
name, description
| name | description |
|---|---|
| audit-end | End an audit session with integrity checks and summary. Use when the user says "/end", "done", "pause", or when the current task is complete. |
/end — Audit Session End + Integrity Check
Trigger
/end
Steps
1. Determine current session
Read .boo/runs/.current_session for session_id.
If missing:
- Check for
auto_sessions (hook-created) - If none, report "No active session"
2. Collect audit data
Sources:
.boo/runs/audit_buffer.jsonl— hook-recorded Write/Edit/Bash ops.boo/runs/audit_pending.jsonl— agent [AUDIT] blocks.boo/runs/{session_id}/audit_trail.jsonl— previously flushed records
Steps:
- Read buffer + pending remaining data
- Append to
audit_trail.jsonl - Clear buffer + pending files
3. Extract user corrections
Scan audit_trail for user_correction records:
{
"record_type": "conversation",
"action_type": "user_correction",
"priority": "critical_for_recovery",
"timestamp": "<ISO 8601>",
"original_claim": "<what agent said>",
"correction": "<what user corrected>",
"principle_extracted": "<general principle>",
"persisted_to": ["CLAUDE.md", ".boo/guidelines/..."]
}
4. Integrity checks
| Check | Condition | Fail |
|---|---|---|
| Has records | audit_trail lines > 0 | ⚠️ "Zero audit records" |
| Files covered | Write/Edit entries exist for modified files | ⚠️ List uncovered files |
| Corrections persisted | persisted_to is non-empty for each correction | ⚠️ Remind to persist |
Output:
=== Session Audit Check ===
Session: <id>
Task: <task>
Duration: <start → end>
[✅] Records: N
[⚠️] Files not in audit: <list>
[✅] Corrections persisted: M
5. Generate session summary
Write .boo/runs/{session_id}/session_summary.md:
# Session Summary | <id>
## Task: <description>
## Time: <start → end>
## Status: completed
## Completed
- <action list>
## User Corrections
- <correction records>
## Stats
- Records: N
- Corrections: M
6. Update state
- Set
session.json status = "completed", end_time = now() - Update
index.jsonentry - Clear
.current_session
Notes
- Save even if checks find problems — recording > perfection
- ⚠️ = don't block save; ❌ = warn user, still save
- /end itself may trigger one more Stop hook flush — normal