# Session Lifecycle Commands — Spec

## Overview

Four agent-invocable commands that manage audit session lifecycle. Each command is a skill markdown file loaded by the agent on invocation.

## /start

```
/start "task description"
```

Creates a named audit session:

1. Generate `session_id = adhoc_YYYYMMDD_HHMM`
2. `mkdir -p .boo/runs/{session_id}`
3. Write `session.json`:
   ```json
   {
     "session_id": "adhoc_20260320_1400",
     "task": "task description",
     "start_time": "2026-03-20T14:00:00Z",
     "status": "in_progress",
     "expected_record_types": ["data", "change", "conversation"]
   }
   ```
4. Write `.boo/runs/.current_session` containing session_id (handshake for hooks)
5. Run context recovery:
   - L0: read `index.json` → last 5 entries
   - L2: scan recent audit_trail.jsonl for `user_correction` records
6. Output recovery summary: recent activity, corrections, priorities
7. Check for unfinished sessions: scan for `status: "in_progress"` sessions, prompt user

## /end

```
/end
```

Ends the current audit session:

1. Read `.current_session` → get session_id
2. Collect remaining buffer data from `audit_buffer.jsonl` + `audit_pending.jsonl`
3. Append to `audit_trail.jsonl`
4. Clear buffer files
5. Extract `user_correction` records from audit_trail
6. Run integrity checks:
   - Has records? (>0 audit_trail lines)
   - All files covered? (changes in audit_trail match modified files)
   - Corrections persisted? (persisted_to is non-empty)
7. Generate `session_summary.md`
8. Update `session.json` status=completed, end_time
9. Clear `.current_session`

## /recover

```
/recover              # L0+L1+L2
/recover full         # L3 (full audit_trail)
/recover {session_id} # load specific session
```

Graded context loading:

- L0 (~200t): index.json → last 5 entries (id, task, status)
- L1 (~500t): .current_session + session.json + last 3 audit_trail entries
- L2 (~1000t): scan all audit_trails for user_correction records + conclusions + daily report §4+§6
- L3 (~3000t): full audit_trail.jsonl + audit_pending.jsonl

## /report-daily

```
/report-daily              # today
/report-daily 20260319     # specific date
/report-daily review       # + morning self-review
```

7-section report:

1. Task overview (from index.json)
2. Operation stats (tool counts)
3. Change records (file modifications)
4. User feedback & corrections
5. Anomaly alerts
6. Backlog tracking
7. Integrity summary

`review` variant: adds morning self-review with trend analysis and recommended priorities.
