AI
Grok Build's memory beats Claude Code on cross-project retention and cost
A head-to-head test of two AI coding agents' memory systems reveals Grok handles global rules better and at less than half the price.
The New Stack
Both xAI's Grok Build and Anthropic's Claude Code recently rolled out persistent memory for their coding agents, promising that development instructions and project context survive between sessions. To see whether that pledge held up in practice, I put both through identical tests on the same codebases and tracked not just accuracy but also speed and cost.
How each system stores notes#
Grok Build, announced in mid-September, saves notes as Markdown files organized in two scopes: project-level memory that applies to one repo, and a global scope accessible across all projects. Users browse stored notes via a /memory command.
Claude Code takes a similar but narrower approach. Its auto memory feature (which has been available for months) maintains a central MEMORY.md index along with individual note files per repository. The feature is enabled by default on the CLI, though Anthropic's newer Projects beta offers cloud-based shared memory—but only to select Pro and Max subscribers without existing projects.
The three tests#
I designed three scenarios to challenge each system's memory across typical workflows:
- Test command: Session 1 notes that
make testpasses whilenpm testfails. Session 2 asks for a new endpoint with passing tests, after removing the README hint about the Makefile. - Project decisions with a trap: Session 1 establishes that CSV export was abandoned and amounts are stored as integer cents (not floats), despite bait code sitting in the repo. Session 2 requests a refund endpoint and a way for support staff to export orders.
- Cross-project rule: Session 1 sets two conventions "for all projects"—conventional commit messages and no comments on obvious code. Session 2 runs in an unrelated repository and asks for a small feature with a commit.
Both tools ran on the same four Node.js test repos on my Mac, each using its respective CLI headless mode. Grok Build 1.0.40 ran Grok 4.6 at high effort; Claude Code 2.1.226 ran Opus 5.
The results#
Grok Build passed all three tests. It wrote rules into memory immediately, read them back in session 2, and applied them consistently. On the cross-project rule, Grok's global scope successfully carried both conventions into the second unrelated repository. Total runtime: 165 seconds, 390,848 tokens, $0.41 across all three tests.

