# Documentation Context Cache

## Purpose

Caches the output of `docs-context-reader` agent to avoid redundant documentation scans.

## Location

`.claude/cache/docs-context.json`

## Schema

```json
{
  "generatedAt": "ISO-date",
  "commitHash": "git-sha",
  "ttl": 86400,
  "summary": {
    "totalModules": 5,
    "documented": 3,
    "synced": 2,
    "drift": 1,
    "missing": 2
  },
  "modules": {
    "business/support/sla": {
      "featureId": "FEAT-003",
      "status": "synced",
      "useCaseCount": 4,
      "ruleCount": 6,
      "permissionCount": 5,
      "sections": ["overview", "useCases", "benefits", "features", "steps", "technicalRef"],
      "missingSections": ["beforeAfter", "faq"]
    }
  }
}
```

## TTL (Time To Live)

| Condition | Cache Valid |
|-----------|------------|
| Same git commit hash | Yes |
| Different git commit hash | No (invalidate) |
| > 24 hours old | No (invalidate) |
| docs-manifest.json modified | No (invalidate) |

## Usage

1. **Before launching docs-context-reader agent**: Check cache
2. **If cache valid**: Use cached summary (0 tokens)
3. **If cache invalid**: Launch agent, save result to cache
4. **On commit**: Invalidate cache (commit changes may affect docs)

## Integration Points

| Consumer | Check Cache? |
|----------|-------------|
| BA step-01 (discover) | Yes |
| docs-sync-checker agent | No (always fresh) |
