Skip to content

fix: key prompt-cache affinity on git root, not cwd - #659

Closed
justrach wants to merge 1 commit into
mainfrom
cursor/cache-affinity-gitroot-4ffc
Closed

fix: key prompt-cache affinity on git root, not cwd#659
justrach wants to merge 1 commit into
mainfrom
cursor/cache-affinity-gitroot-4ffc

Conversation

@justrach

Copy link
Copy Markdown
Owner

Prompt-cache max was already on (ADR 0011: stable catalog, /btw parent key, child role lanes). The rematch still paid a cold ~8k on every first call because prompt_cache_key hashed the leaf cwd.

xAI partitions cache by that key. Sibling graff-evals sandboxes have the same system+tools prefix and different paths, so every task was a first-request write (cache 0–512). Grok-build’s first calls arrived already warm (11k–43k).

Change

Root affinity (x-grok-conv-id / prompt_cache_key) is now:

  • the git root when cwd is inside a repo (worktrees and eval sandboxes under this tree share)
  • graff-scratch when there is no repo (scratch -p shares)

Prefix bytes still have to match. A repo CLAUDE.md does not hit another repo. Children still use role lanes, not the root id.

/cache names the lever. ADR 0011 updated so this does not get “fixed” back to cwd.

Open in Web Open in Cursor 

xAI partitions cache by prompt_cache_key. Hashing the leaf cwd made every
graff-evals sandbox a cold ~8k write (rematch first-call cache 0–512 vs
grok 11k–43k already warm). Seed is the git root so worktrees and sibling
sandboxes share; scratch -p uses graff-scratch. Prefix bytes still have to
match. ADR 0011.
@justrach

Copy link
Copy Markdown
Owner Author

Already on main (git-root cache affinity). Closing as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants