Codex Project Memory
Local repository memory for Codex that indexes TypeScript/JavaScript structure into local SQLite, exposes compact MCP tools, and renders deterministic SVG/map frames.
README
Codex Project Memory
Local repository memory for Codex. It indexes project structure into local SQLite, exposes compact MCP tools, and renders deterministic SVG/map frames.
What v0.4 does
- Stores memory locally under
.codex/memory. - Indexes TypeScript/JavaScript deeply with
ts-morph. - Detects a broad programming-language set and structurally indexes Python, Go, Java, C#, PHP, Ruby, Rust, C/C++, Kotlin, Swift, Shell, Dart, Scala, R, Lua, Elixir, Clojure, SQL, HTML/CSS and additional common languages.
- Writes explicit language capability flags so fallback/degraded analysis is visible in generated JSON and snapshots.
- Lazily uses user-space language analyzers from
.codex/memory/cache/language-toolswhen available or installable; it never changes global system PATH or installs system packages. - Runs compiler-assisted diagnostics when possible and stores normalized diagnostics in SQLite schema v3 plus
generated/diagnostics.json. - Exposes MCP tools:
memory.agent,memory.head,memory.query,memory.duplicates,memory.frame,memory.refresh,memory.diff. - Adds CLI diagnostics:
pmem diagnostics --json, with--language,--changed, and--no-install. - Provides
pmem agent runas the project-local orchestration entrypoint. - Produces deterministic SVG and map JSON. PNG export is best-effort and optional.
Runtime Requirements
- Node.js 20 or newer.
- Codex with plugin and MCP support.
sharpis optional. If PNG generation is unavailable, SVG and map JSON remain the required visual outputs.
What v0.4 does not do
- No embeddings or vector DB.
- No cloud backend.
- No dashboard.
- No direct source-code modifications.
- No required LLM in the core runtime.
- No claim that fallback analysis is compiler-equivalent for every language; capability flags identify the tier per language.
- No global compiler, SDK, PATH, registry or project lockfile modifications.
Development
npm install
npm run build
npm test
node dist/cli/pmem.js --help
Before packaging or sharing:
npm ci
npm run build
npm test
npm run marketplace:sync
node dist/cli/pmem.js --help
node dist/cli/pmem.js --version
npm pack --dry-run
Local repository setup
pmem init --json
pmem index --json
pmem render --json
pmem head --json
MCP setup
Use .mcp.json with server name project-memory. The server command is
node scripts/bootstrap-mcp.mjs; on first start, the bootstrap installs runtime
dependencies in the installed plugin folder if they are missing, then starts
dist/mcp/server.js.
Codex Plugin Distribution
This repository is a single-plugin Codex marketplace root. The marketplace file
is .agents/plugins/marketplace.json, and its plugin entry points at
./plugins/codex-project-memory.
Before sharing changes, regenerate the distributable plugin folder:
npm run build
npm run marketplace:sync
From a public or private Git repository:
codex plugin marketplace add owner/codex-project-memory --ref main
From a local clone:
codex plugin marketplace add /absolute/path/to/codex-project-memory
After adding the marketplace, open the Codex Plugin Directory, select
Codex Project Memory, install the plugin, and start a new thread. On first
MCP startup the plugin runs npm ci --omit=dev inside the installed plugin
folder so users do not need to prepare node_modules manually. That first
startup needs access to the npm registry or an already-warm npm cache.
More detail: docs/MARKETPLACE_SHARING.md.
This repository includes:
.agents/plugins/marketplace.jsonplugins/codex-project-memory/.codex-plugin/plugin.json.mcp.jsonskills/repo-memory/SKILL.md- built runtime under
dist/afternpm run build PRIVACY.mdSECURITY.mdCHANGELOG.md
Supported project lifecycle
Codex app plugin validation does not currently support plugin-declared hooks. The plugin uses a supported replacement: implicit skill invocation plus MCP tools. On project work, Codex should call memory.head, use memory.query before edits, use memory.duplicates before new artifacts, and call memory.refresh after source changes.
In v0.4 the preferred entrypoint is memory.agent, or the CLI equivalent:
pmem agent run "<intent>" --json
pmem agent run "<intent>" --phase pre_create --kind service --module <moduleId> --name <ProposedName> --json
Duplicate guard
Before creating services, controllers, DTOs, routes, tables, modules, repositories, adapters, jobs or utilities, run:
pmem duplicates --kind service --module <moduleId> --name <ProposedName> "<intent>" --json
Demo Walkthrough
From a copy of test/fixtures/nest-basic after npm run build:
node /path/to/MemoryCodex/dist/cli/pmem.js init --json
node /path/to/MemoryCodex/dist/cli/pmem.js doctor --json
node /path/to/MemoryCodex/dist/cli/pmem.js scan --json
node /path/to/MemoryCodex/dist/cli/pmem.js index --json
node /path/to/MemoryCodex/dist/cli/pmem.js diagnostics --no-install --json
node /path/to/MemoryCodex/dist/cli/pmem.js render --json
node /path/to/MemoryCodex/dist/cli/pmem.js head --json
node /path/to/MemoryCodex/dist/cli/pmem.js agent run "Aggiungi controllo che impedisca l'apertura del tornello se l'abbonamento e sospeso." --json
node /path/to/MemoryCodex/dist/cli/pmem.js query "Aggiungi controllo che impedisca l'apertura del tornello se l'abbonamento e sospeso." --visual --json
node /path/to/MemoryCodex/dist/cli/pmem.js agent run "AccessValidationService / verifica diritto accesso" --phase pre_create --kind service --module access --name AccessValidationService --json
node /path/to/MemoryCodex/dist/cli/pmem.js duplicates --kind service --module access --name AccessValidationService "AccessValidationService / verifica diritto accesso" --json
node /path/to/MemoryCodex/dist/cli/pmem.js frame current --json
node /path/to/MemoryCodex/dist/cli/pmem.js refresh --changed-only --json
node /path/to/MemoryCodex/dist/cli/pmem.js diff --json
The duplicate command should return risk: "high" and verdict: "extend_existing_artifact" for AccessService.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。