A 5-layer setup gives Claude Code, Codex and Cursor the same shared memory
Arindam_1729 · x · 2026-10-21
Developer Arindam shares a practical 5-layer setup for shared context across Claude Code, Codex, Cursor and OpenCode.
The problem: every agent session starts from zero, and AGENTS.md only holds rules, not knowledge — runbooks, API docs, decisions and their rationale live elsewhere, so agents reading the same AGENTS.md still give different answers.
The five layers (with a decision table in the images):
- Rules true every session (build, test, "never") → AGENTS.md, loaded by every agent
- Rules for one part of the code → path-scoped rules (.claude/rules/ with paths, or .cursor/rules), loaded only when matching files are touched
- Runbooks, API docs, decisions, incidents → a knowledge layer, read on demand, shared across repos and agents
- Personal preferences → built-in memory or CLAUDE.local.md, per machine per person
- Why one weird line of code exists → a code comment
Knowledge layer: OpenLore runs as an MCP server (localhost:8080) exposing an in-memory shell (cat/grep/find/jq) over a docs/ tree (how-to, architecture, api, incidents). The article includes exact MCP setup commands for Claude Code, Codex, Cursor and OpenCode, plus SSH access (port 2222) for CI jobs to grep the same docs.
More from coding & agent
- Claude Code Pushes Urgent Security Update Across All Installations — umeshonai · 2026-10-23
- Claude cut a 2.6-hour video export to 20 minutes — but only after being told to rebuild the server — byhewar · 2026-10-23
- 3 flight-booking rules my AI agent checks that I'd never do by hand — Efistoffeles · 2026-10-23
- OpenJet claims Qwen3.8-27B coding runs 1.9x faster than llama.cpp on one RTX 3090 — JeremyCMorgan · 2026-10-23
- Building an autonomous SEO agent in Hermes with three skills: programmatic pages, Keywords Everywhere, DataForSEO — EXM7777 · 2026-10-23
- Building a sports betting AI agent with onchain execution and human approval by default: architecture and lessons — Dry-Comfortable-2678 · 2026-10-23