Neal006

Deja — Development skill for Claude Code

Development community

Déjà vu for your coding agent: cache-safe back-reference compression that stops Claude Code from paying twice for context it has already seen.

How to install Deja

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Neal006/deja and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Deja does

Déjà vu for your coding agent: cache-safe back-reference compression that stops Claude Code from paying twice for context it has already seen.

Alternatives in Development

README

deja

**Your coding agent pays for the same context over and over. deja stops that, and doesn't break your prompt cache doing it.**

npx dejactx audit      # what did stale context cost you? (reads local history, sends nothing)
npx dejactx claude     # run Claude Code through deja

On 48 real Claude Code sessions (2,740 API requests), replayed request by request with exact prompt-cache billing:

strategy input bill average prompt
as it happened $202 87.6k tokens
eager pruning (what context pruners do) −14.1%
deja −31.0% 55.9k

Run `npx dejactx audit` to get this table for your own history.


The problem nobody measures

Every API request an agent makes resends the **entire** conversation. A 400-line `npm test` log the agent glanced at once rides along in every request after that. In the sessions above, tool output alone was **1.3M tokens when counted once, but 76M tokens actually sent**, because each result was resent about **58 times** on average.

Prompt caching makes those resends cheaper (0.1× price), but not free. They also fill the context window, which triggers lossy auto-compaction sooner.

The obvious fix is to prune old tool output. **It backfires.** The prompt cache matches on an exact prefix, so editing an old message invalidates everything after it, and the whole tail is re-billed at 1.25×. Prune eagerly and you keep paying for cache rewrites. In the replay, eager pruning that waits 20 requests before pruning cost **28% more than doing nothing at all**:

output counts as stale after eager pruning deja
5 requests −14.1% −31.0%
10 requests +4.2% −26.9%
20 requests +28.4% −21.7%

(Reproduce with `npx dejactx audit --min-age 20`.)

How deja works

deja is a local proxy between your agent and the Anthropic API (`ANTHROPIC_BASE_URL`). It has two engines.

1. Dedup: back-references that never touch the cache

Each new