Imagine your AI is a goldfish.

You've heard the line: a goldfish has a 15-second memory. Every lap of the bowl is a brand-new world.

Here's the funny part. It isn't true. Researchers have trained goldfish to respond to sounds and feeding cues, and the fish remember those for months. Goldfish are fine.

Your coding agent is the one with the 15-second memory.

Every session starts empty. It doesn't remember yesterday, the bug you fixed in March, or the approach you rejected last Tuesday. All it has is the bowl, the context window, and whatever you put in it before it starts swimming.

And most of us fill that bowl before we even say good morning.

A morning in the bowl

6:59. The goldfish is asleep. Bubbles. Quiet. Context: empty. Ready for anything.

7:00. One eye opens. Before you've typed a word, it has already loaded a 400-line CLAUDE.md, AGENTS.md, rules.md, a skill catalog and an mcp.json worth of servers.

7:00 and one second. Both eyes open. Plugin lists. MCP tool schemas. "Always use tabs." "Never use tabs in YAML." A rule about TDD, copy-pasted into this repo the same way it was copy-pasted into the last eleven.

7:01. You tap the glass: "Good morning! Can we fix the bug in ticket 4182?"

7:01 and two seconds. Then you drop fifty lines of stack trace and a Jira paste into the bowl. Splash.

7:02. Now watch the goldfish sweat. "Let me recheck what this whole project does... reading files... finding the root cause... how do I test this... the DB isn't connected, can I spin it up?" It rereads the whole project like it has never met you. Because it hasn't.

7:03. You type "yes". The bowl is nearly full. Older parts of the conversation start getting summarized or dropped. The goldfish is about to forget its own name.

Four panels of a cartoon goldfish in a bowl: asleep at 6:59, files dropping in at 7:00, a hand tapping the glass as stack traces splash in at 7:01, and the bowl crammed with paper and the goldfish sweating at 7:03

But why would you do that?

The percentages in my video version of this (40%, 65%, 92%) are cartoon numbers. Your real ones depend on your rule files, your MCP servers and your client. In Claude Code, run /context and look at what's already in the bowl before your first message. It's worth a minute.

The bowl isn't the problem. What you put in it is.

Context windows are big now. That doesn't make the space free. Everything loaded at session start:

  • costs tokens on every turn, relevant or not,
  • competes for attention with the thing you actually asked,
  • and leaves less room before the client starts compacting your conversation.

The usual answer is "put it in CLAUDE.md". So the instruction file grows. It picks up the test command, the architecture overview, three postmortems, a style guide, a rule from a tool you uninstalled in August, and the same block pasted into the global file and the project file.

I'm not judging. I found that last one on my own machine today: a block of instructions for a CLI tool that wasn't even installed anymore, sitting in both my global and my project CLAUDE.md, plus 113 permission rules for it in my Codex config. Every session loaded it twice and couldn't use any of it.

What goes where

Here's how I sort it.

What goes where: 1. global instruction file, rules true in every project; 2. project instruction file, what every task in this repo needs; 3. skills and MCP servers, only the ones this work needs; 4. memory (Palace), recalled when the question comes up

1. Global instruction file: rules that are true everywhere

~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, Cursor's global rules. These load into every session in every project, for certain. That guarantee is exactly why they should be short.

Put things here only if they're true in every project and must hold even if nothing else loads.

If you do TDD everywhere, why is "use TDD" in your project file? Write it once, globally. If you only do TDD in one repo, it belongs in that repo's file and nowhere else. If it's in both, you pay for it twice and they'll drift apart the first time you edit one of them.

2. Project instruction file: what this repo needs for every task

CLAUDE.md or AGENTS.md in the repo. It also serves people and tools that don't have your memory: contributors, CI agents, a teammate's fresh checkout.

Keep it to what every task in this repo needs. Here's the whole project CLAUDE.md for Palace itself:

Use `palace mcp` to expose this repository as an MCP server. Development commands: cargo fmt cargo clippy --all-targets --all-features -- -D warnings cargo test --all-features cargo audit Releases: bump `version` in `plugin/.claude-plugin/plugin.json` to the new `Cargo.toml` version in the same release commit. 

That's it. How to build, how to check, and the one mistake that has actually happened more than once.

What doesn't belong here: why we chose SQLite, what broke in the last migration, which approach we tried and dropped. That's history, and history grows every day. If it lives in an always-loaded file, the bowl fills up a little more every week.

3. Skills and MCP servers: only the ones this work needs

Skills and MCP servers are tools, not memory. Many clients now load them lazily: a skill shows only its description until it's used, and Claude Code can hide MCP tool schemas behind a tool search. Even so, every server you've connected still adds names and instructions to the bowl. If a project never touches Jira, the goldfish doesn't need to know Jira exists.

4. Memory: everything that happened

Decisions and the reasons behind them. What broke last time and how you fixed it. The command that finally worked. Preferences you stated once and are tired of repeating.

None of this needs to be in the bowl at 7:00. It needs to be there when the question comes up, and only the part that answers it.

That's the job I built Palace for.

Palace: what matters, when it matters

Palace is local-first memory for coding agents. One Rust binary, one SQLite file on your machine, no API keys, no cloud. It works with Claude Code, Codex, Cursor, Gemini CLI, VS Code, OpenCode, Cline, Zed, Goose, Windsurf, Antigravity and Claude Desktop, and they all share the same memory.

It stores text verbatim: code, notes, conversations and the agent's own diary, exactly as written. No LLM rewrites them into summaries. Search is hybrid (BM25 keywords plus local embeddings on your CPU), and every result carries a receipt: wing, room, source file, drawer id and a score breakdown.

The important part for the goldfish is how it gets into the bowl. palace install registers hooks, and every hook has a hard limit.

At session start: a small, capped warm-up

The session-start hook injects:

  • Your standing rules from one place in Palace (general/preferences), word for word. At most 20 rules, each cut to 300 characters, with the full text one drawer id away. A rule that names a different project is left out. Your TDD rule reaches every repo, and your "port 8040+ on the shared droplet" rule stays with the project it's about.
  • The last few diary entries for this project, from any agent and up to 30 days back. Codex picks up where yesterday's Claude Code session stopped.
  • The top few drawers of this project's wing.

The whole block is held under 9,000 bytes. That number isn't arbitrary. Claude Code saves hook output over 10,000 characters to a file and gives the agent only a preview, so anything past that limit would never reach the fish anyway.

Memories from your other projects stay out. The goldfish working on your API doesn't wake up thinking about your side-project game.

When you send a prompt: three memories, or none

When you ask something, the prompt hook searches Palace with your actual question and injects up to 3 matching memories, and only if they clear a relevance threshold. If nothing is relevant, nothing is added.

Prompts under three words aren't searched at all. The "yes" you typed at 7:03 costs you nothing.

While it works: memory follows the code

While the agent greps and reads files, the post-tool hook surfaces memory related to what it's looking at. That's how "we tried this in October and it broke the seed script" shows up before the agent tries it again, without anyone asking.

Before it stops: write it down

The stop hook closes the loop. If the session did real work but saved nothing, it asks the agent once to write a diary entry and record any decisions before it finishes. Memory only works if something gets written, and today's fix becomes tomorrow's recall.

Every hook fails open. If the palace is missing or broken, your agent works exactly as before.

The same morning, with memory

Rewind. 7:00. The goldfish wakes up in a suit and tie. There's a small Palace badge on the bowl.

The same goldfish in a navy suit and red tie, in a clean bowl with a Palace badge and one small glowing note, raising a fin for a fin-five

The bowl holds the short global rules, the repo's build commands, your standing preferences, and yesterday's diary entry for this project. That's all.

Ticket 4182 arrives. Before the goldfish starts rereading the whole project, one memory comes up, with a receipt:

[palace → wing my_api, room decisions, diary 2026-03-14] Same symptom fixed in March: the DB seed script ran before the migration. Fix and test command are in the same entry. 

(Illustrative example. Your receipts will point at your own drawers.)

No full reread. No "can I spin up the DB?" detour. The goldfish fixes the bug, writes one diary line, and gives you a little fin-five.

"But retrieval can miss"

It can. That's exactly why hard rules stay in always-loaded files: they're guaranteed, and retrieval isn't. Palace is for history, not for the three rules that must never be broken.

How often does it miss? The numbers are public and reproducible:

  • LongMemEval s_cleaned (470 questions, each searching about 50 past sessions and ~115k tokens): the right session is in the top 5 for 98.7% of questions. Those five results hold about 1,700 tokens, which is 1.3% of the haystack. No LLM and no GPU are involved at any stage.
  • Coding-agent eval (51 questions like "why did we choose bundled sqlite?" and "what clippy command should I run?"): recall@1 0.882, recall@5 1.000, with no tuning on the eval's own questions.

Method, splits and the failures are in docs/benchmarks.md. The 1.3% is the whole argument of this post in one number: the goldfish doesn't need the whole ocean. It needs the right spoonful.

And palace gain shows what it's doing in your sessions: hit rate, precision, repeat questions avoided, estimated tokens saved and p95 latency, computed from your local database.

Clean your bowl in four steps

Clean your bowl in four steps: 1. run /context, 2. deduplicate, 3. move history out with palace init . --yes --auto-mine, 4. disconnect MCP servers and plugins you don't use

  1. Run /context (or your client's equivalent) at the start of a fresh session. Look at what's already there before you've said a word.
  2. Deduplicate. Anything in both your global and your project file goes in exactly one of them. Rules that apply everywhere go global, repo-specific ones stay in the repo.
  3. Move history out. Postmortems, "why we chose X" and old investigation notes don't need to load on every turn. Mine them into Palace (palace init . --yes --auto-mine) or tell your agent to remember them, then delete them from the instruction file.
  4. Disconnect what this work doesn't use. MCP servers and plugins you don't touch here are just noise in the water.

Try it

# macOS / Linux curl -fsSL https://raw.githubusercontent.com/AncientiCe/palace-rs/main/scripts/install.sh | sh # Windows (PowerShell) irm https://raw.githubusercontent.com/AncientiCe/palace-rs/main/scripts/install.ps1 | iex palace install # wires up every agent on this machine palace doctor # checks each one is connected 

Free, open source, MIT licensed. Everything runs on your machine.

Your goldfish has a small bowl, and that space is precious. Keep the rules short. Give it the rest when it matters.

Keep it healthy. Give it a memory! 🐟

iCe