# read-cap

`read-cap` defines the shared Vera policy for Pi's `read` tool: every read must be a bounded slice with both `offset` and `limit`, and `limit` is capped at 200 lines.

- `offset` is the 1-indexed start line.
- `limit` is required and must be `<= 200`.
- Whole-file reads are rejected; read larger files with adjacent slice calls.

## Architecture

The policy source for this extension lives at `extensions/read-cap/policy.ts`. It is duplicated into the two places that need to compose it with their local tool creation path:

- `packages/vera-theme/src/read-cap-policy.ts` — duplicate used by `vera-theme` to compose the 200-line policy with Kylin chrome for the main agent's wrapped `read` tool.
- `packages/vera-subagents/src/read-cap-policy.ts` — duplicate used by `vera-subagents` when creating child-session built-in tools.

These three small copies are intentionally kept instead of introducing a new shared package. Each copy has a synchronization comment so policy changes can be mirrored across all copies.

The extension entrypoint (`extensions/read-cap/index.ts`) is diagnostic-only. It does not register or wrap `read`; main-agent tool registration is owned by `vera-theme`, which applies the read-cap policy before applying Kylin chrome so one `registerTool("read", ...)` delivers both behaviors. Vera setups must load `vera-theme` for the main-agent cap; without it, this diagnostic extension alone does not cap main-agent reads. Child sessions remain capped through `vera-subagents` independently.
