What problem does it solve?
Golem agent methods that only read state still go through the full invocation pipeline and cannot be cached. This Skill shows how to mark TypeScript agent methods as read-only so the host can treat them as pure queries, enforce a no-side-effect contract at runtime, and cache their results.
Core Features & Use Cases
- Read-Only Method Declaration: Set
readOnly: true on a method(...) spec in defineAgent to declare a pure read over already-loaded agent state.
- Runtime Enforcement: Writes to persistent state, outgoing HTTP (
fetch), and RPC calls trap with a ReadOnlyViolation error before they execute.
- Configurable Cache Policies: Choose
no-cache, until-write, or a { ttlNanos } time-to-live, and optionally key the cache per caller principal with usesPrincipal.
- Use Case: Expose a
getCount query on a counter agent as an HTTP GET endpoint that participates in HTTP caching semantics without loading the agent or queuing an invocation.
Quick Start
Ask the AI to mark the getCount method of your Golem TypeScript counter agent as read-only with the until-write cache policy.