Islands: what is cached, how prefixes match
What an island is
An island is one corpus, wrapped in a fixed system prompt, prefilled once on the model and kept as KV cache. The model has already read it. A request that starts with the same tokens continues from there instead of reading the corpus again.
How a request matches
Two ways. Send island: "uniswap-v4" and the gateway puts the island's exact system prompt in front of your messages. Or send the exact system prompt yourself as the first message: the gateway hashes it (SHA-256) and routes to the island with that prefix_sha256. Get the exact text from GET /v1/islands/<id>/prefix.
Any other system message is dropped when an island is set, because one changed token at the start would break the match and force a full prefill.
Resident and snapshot
The engine is llama.cpp's llama-server with two slots of 16k tokens each and an 8-bit KV cache. Each slot holds one island. Every island is also saved to disk as a KV snapshot with --slot-save-path. When a request arrives for an island that is not resident, the gateway restores its snapshot into the least recently used slot, then answers.
Current islands
| id | Corpus | Tokens |
|---|---|---|
uniswap-v4 | Uniswap v4 docs: overview, PoolManager, hooks, flash accounting, dynamic fees, ERC-6909, security, first hook, unlock callback, custom accounting | 12,896 |
mcp-spec | Model Context Protocol specification 2025-11-25: architecture, lifecycle, transports, tools, resources, prompts, sampling, elicitation, roots, authorization | 12,887 |
ethereum-eips | EIP-1559, EIP-7702 and EIP-4844, full text | 12,992 |
Token counts are measured with the model's own tokenizer, before the system prompt is added.
Prefill