cache_contract

A rule for keeping temporary workspace details out of a saved session prompt. Current workspace paths are added as a separate reminder that can be refreshed each turn.

In plain words
What is it for?
Use it when maintaining session state, workspace mounting, prompt construction, or debug checks around cached session data.
Why use it?
It prevents outdated paths from being stored permanently and ensures workspace changes appear in the next turn. Debug checks also identify callers that put workspace tokens in the saved prompt.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/burin-labs/harn/cache_contract
Clone the repo
git clone --depth 1 https://github.com/burin-labs/harn
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 281 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00281
Opus 5 $0.00000 $0.00140
Sonnet 5 $0.00000 $0.00056
Haiku 4.5 $0.00000 $0.00028

Measured 2d ago against content hash c76b8f2fa6cd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cache_contract scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/src/agents/cache_contract.md · 34 lines

What it actually says

Workspace Anchor Cache Contract

The session workspace_anchor is transient turn context, not durable system prompt content.

The contract is:

  • SessionState::system_prompt must stay free of {{workspace_*}} and {{project_*}} template tokens.
  • active workspace state is rendered through the canonical workspace_anchor reminder provider instead
  • downstream callers that still assemble pipeline_input or system prompt text by hand must keep workspace/project fields out of the persisted session prompt surface

The canonical reminder body is:

<workspace-anchor>
primary: /Users/me/projects/X
additional_roots:
  - /Users/me/projects/Y (mount_mode: read_only, mounted_at: 2026-05-23T10:15:00Z)
</workspace-anchor>

That reminder is injected on SessionStart and refreshed after each turn via the OnBudgetThreshold provider pass. Re-anchoring therefore updates the next turn's reminder payload without rewriting the stored session prompt.

In debug builds, Harn asserts this contract when it records a session system prompt. If the prompt text contains {{workspace_*}} or {{project_*}}, the runtime panics with HARN-CACHE-001 so the offending caller can move that data into reminder space instead.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 34 lines · 0 tokens per session scan A c76b8f2fa6cd

Subscribe to this mod's changes

cache_contract is an agent published in the GitHub repository burin-labs/harn (20 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 281 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.