feat(coder,server): audit engine — session audit, guideline compliance, user correction tracking
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.
This commit is contained in:
72
data/skills/boocode/command-start/SKILL.md
Normal file
72
data/skills/boocode/command-start/SKILL.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
name: command-start
|
||||
description: Create an audit session with context recovery before starting work. Use when beginning a new task, analysis, or code modification — establishes a session for tracking tool usage, user corrections, and decisions. Examples: "start", "begin session", "start work", "/start 'migrate database schema'".
|
||||
allowed-tools:
|
||||
- Read
|
||||
- Glob
|
||||
- Grep
|
||||
- Bash
|
||||
- Write
|
||||
---
|
||||
|
||||
# /start — Audit Session Start + Context Recovery
|
||||
|
||||
## Trigger
|
||||
|
||||
```
|
||||
/start "task description"
|
||||
```
|
||||
|
||||
## Why
|
||||
|
||||
Every task should run in an audit session. Without one:
|
||||
- Tool-use data goes to unnamed sessions with no task context
|
||||
- `/end` can't run integrity checks
|
||||
- Daily reports miss task descriptions
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Create session
|
||||
|
||||
Generate `session_id = adhoc_YYYYMMDD_HHMM`, create `.boo/runs/{session_id}/`, write `session.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"session_id": "adhoc_20260320_1400",
|
||||
"task": "task description",
|
||||
"start_time": "ISO 8601",
|
||||
"status": "in_progress",
|
||||
"expected_record_types": ["data", "change", "conversation"]
|
||||
}
|
||||
```
|
||||
|
||||
Write session_id to `.boo/runs/.current_session` (the Stop hook reads this for buffer archiving).
|
||||
|
||||
### 2. Context recovery (L0 + L2)
|
||||
|
||||
**L0 — Index summary**: read `.boo/runs/index.json`, last 5 entries.
|
||||
|
||||
**L2 — User corrections (critical)**: scan all `audit_trail.jsonl` and `audit_pending.jsonl` for `user_correction` records — these must be restored first to avoid repeating mistakes.
|
||||
|
||||
**Check for unfinished sessions**: scan `.boo/runs/adhoc_*/session.json` for `status: "in_progress"`. If found, prompt the user to continue the old session instead.
|
||||
|
||||
### 3. Output summary
|
||||
|
||||
```
|
||||
Session created: adhoc_20260320_1400
|
||||
Task: {description}
|
||||
|
||||
Context recovery:
|
||||
Recent activity: {last 3 completed tasks}
|
||||
User corrections (must follow): {all user_correction records}
|
||||
Unresolved issues: {open anomalies/alerts}
|
||||
Today's priorities: {from morning review}
|
||||
|
||||
All [AUDIT] blocks use batch_id = {session_id}
|
||||
```
|
||||
|
||||
### 4. Notes
|
||||
|
||||
- If `.boo/runs/` doesn't exist, create it and skip recovery
|
||||
- If `.current_session` already points to an in_progress session, prompt before creating a new one
|
||||
- The session_id stays constant for the whole session — all [AUDIT] blocks share it
|
||||
Reference in New Issue
Block a user