19 files (~1604 LOC). The `rulesInjectorHook` — Tool Guard Tier hook that auto-injects AGENTS.md (and similar rule files) into context when a file in a directory is read, written, or edited. Proximity-based: closest rule file to the target path wins.
## HOW IT WORKS
```
tool.execute.after (read/write/edit/multiedit)
→ Extract file path from tool output
→ Find rule files near that path (finder.ts)
→ Already injected this session? (cache.ts)
→ Inject rule content into tool output (injector.ts)
```
## TRACKED TOOLS
`["read", "write", "edit", "multiedit"]` — triggers only on file manipulation tools.
Same-distance tie: all injected. Per-session dedup prevents re-injection.
## TRUNCATION
Uses `DynamicTruncator` — adapts injection size based on model context window (1M context models get full content, smaller models get truncated summaries).