## 1. Import boocontext-audit as dependency

- [ ] 1.1 Add boocontext-audit as workspace dependency
- [ ] 1.2 Verify Guideline, GuidelineStore, SchematicGenerator exports

## 2. Implement Guideline model

- [ ] 2.1 Create GuidelineManager wrapping GuidelineStore
- [ ] 2.2 Add CRUD operations for guidelines (create, read, update, delete, list)
- [ ] 2.3 Add InMemoryGuidelineStore and FileRelationshipStore backends
- [ ] 2.4 Add criticality filtering and priority sorting

## 3. Implement multi-batch matcher

- [ ] 3.1 Create MatcherService wrapping GenericGuidelineMatchingStrategy
- [ ] 3.2 Add Observable, Actionable, PreviouslyApplied, Disambiguation, ResponseAnalysis, LowCriticality batch types
- [ ] 3.3 Add parallel batch execution for independent batches
- [ ] 3.4 Add SchematicGenerator abstraction for LLM batch calls

## 4. Implement RelationalResolver

- [ ] 4.1 Create ResolverService wrapping RelationalResolver
- [ ] 4.2 Implement DEPENDS_ON, PRIORITIZES, ENTAILS, TAG_ALL, TAG_PRIORITIZES resolution
- [ ] 4.3 Add iterative convergence loop (max 100 iterations)
- [ ] 4.4 Add resolution logging

## 5. Implement audit middleware

- [ ] 5.1 Create AuditService with PostToolUse middleware (JSONL buffer append)
- [ ] 5.2 Add Stop middleware (buffer flush to session trail)
- [ ] 5.3 Add UserPromptSubmit middleware (session context injection + CRITICAL alerts)
- [ ] 5.4 Wire audit middleware into agent's inference lifecycle

## 6. Implement graded context recovery

- [ ] 6.1 Create RecoveryService with L0-L4 recovery methods
- [ ] 6.2 Implement L0: read last 5 index entries
- [ ] 6.3 Implement L1: session.json + last 3 audit trail entries
- [ ] 6.4 Implement L2: all user_correction records
- [ ] 6.5 Implement L3: full audit trail
- [ ] 6.6 Add priority loading (user corrections first)

## 7. Wire into agent inference loop

- [ ] 7.1 Run guideline evaluation before each agent turn
- [ ] 7.2 Inject active guidelines into system prompt
- [ ] 7.3 Record guideline matches in turn metadata
- [ ] 7.4 Add guideline management commands (add-guideline, list-guidelines, remove-guideline)

## 8. Test and verify

- [ ] 8.1 Test guideline creation and storage
- [ ] 8.2 Test multi-batch matching with sample guidelines
- [ ] 8.3 Test relational resolution with dependencies
- [ ] 8.4 Test audit middleware tool logging
- [ ] 8.5 Test graded recovery at all levels
