Codex Agent Mem 标志

Codex Agent Mem

社区
MarceloCaporale

Local-first Model Context Protocol (MCP) memory layer for Codex CLI/Desktop, Claude Code, Gemini CLI, Qwen/DeepSeek/Ollama and agent workflows. SQLite + FTS5 compact context packs, token savings, read-only mode, no external memory server.

发布者MarceloCaporale
代码仓库codex-agent-mem
语言Python
复刻数
7
星标数
40
可用工具
0
传输类型stdio
许可协议Apache-2.0
链接
  • 将工具接入 AI 工作流

    Codex Agent Mem 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 40 个 Star 和 7 个 Fork。

codex-agent-mem

Ask DeepWiki

Other languages: Español | Deutsch | Português do Brasil | 中文 | 日本語

Portable, auditable, local-first MCP memory for MCP-compatible AI agents and coding workflows.

codex-agent-mem keeps durable project memory outside the model runtime, compresses continuity into smaller working packs, and carries forward operational state so MCP-compatible AI agents can resume with less repetition, fewer false “done” claims, and more control over what stays in context.

Everything is stored and processed locally by this MCP: SQLite database, FTS index, snapshots, telemetry metadata, and the optional inspector UI. codex-agent-mem does not send your memory, project data, prompts, or telemetry to any external server. MCP clients may still expose tool results to the model or service you configure, so treat retrieved memory as local tool output handed to that client.

Born for Codex and GPT workflows, codex-agent-mem has grown into a portable MCP memory layer for MCP-compatible runtimes including Codex CLI/Desktop, Claude Code, Google Gemini CLI, Qwen Code workflows using Ollama models, and other local or third-party CLI agent stacks. Validation is tracked per client/runtime and evidence level. Model-specific details stay in the validation docs so the README can describe the public surface without overclaiming one runtime.

codex-agent-mem lives locally, keeps memory auditable and pull-based, and does not send your stored memory to any external service.

Public baseline. Built in small, testable slices and still evolving, but already aligned for real use.

What’s new in v1.0.x

  • v1.0.2 fixes a project identity edge case where generated codex-agent-mem context inside AGENTS.md could be mistaken for active project scope by MCP hosts or agent clients. It also lets manual notes initialize a missing local project record and preserves existing project root metadata on conflicting updates.

  • v1.0.1 fixes one local daemon/stdio bridge idle-timeout path that could surface as a false Transport closed incident when --daemon-url is used.

  • v1.0.1 serializes shared request handling inside the optional threaded local daemon so one SQLite-backed server instance is not driven concurrently.

  • v1.0.1 hardens the public local-first daemon surface: loopback-only bind validation, optional bearer-token auth for /mcp, sanitized /health, and token forwarding from the stdio bridge.

  • v1.0.1 adds a generated-context instruction-hierarchy guardrail: retrieved memory is advisory project context, not a higher-priority instruction; this is a basic guardrail, not prompt-injection proof.

  • v1.0.1 documents that local SQLite memory is plaintext by default in the public 1.0.x line and must not be treated as a secrets vault.

  • v1.0.1 normalizes list-returning MCP tool payloads so structuredContent uses object roots like {items, count} instead of root arrays for stricter clients such as Claude Code.

  • v1.0.1 adds session-aware retrieval for persisted memory: mem_session_list lists recent sessions, mem_scope_resolve ranks persisted lanes from explicit thread/path hints, mem_bootstrap_context avoids project-wide startup packs for ambiguous containers, and optional session_id filters retrieval tools so broad project scopes do not mix chats or agents. Project-wide packs that span multiple sessions or inferred sub-scopes emit a visible scope warning and recommend narrowing first. This is not live current-turn awareness.

  • v1.0.1 keeps normal continuity installs writable by default; --read-only is an explicit retrieval-only audit/debug mode, not the default operating mode.

  • low-impact MCP runtime profiles: minimal, standard, and full

  • explicit --read-only audit/debug mode that blocks mutating tools and avoids closure writes

  • lazy SQLite initialization so unused MCP connections stay cheap

  • compact MCP responses by default, with full payloads kept in structuredContent

  • known_pack_hash / not_modified support so unchanged continuity packs are not resent

  • runtime heartbeat diagnostics, spawn-storm warning, optional telemetry, and an optional daemon/stdio bridge

Latest releases: v1.0.2 Identity + Scope Patch | v1.0.1 Transport + Local Security Hotfix | v1.0.0 Low-Impact Runtime

Snapshot (synthetic v1.0 fixtures)

ScenarioProfileSource tokensPack tokensSavednot_modifiedToolsLazy initRead-only
Small project continuityminimal1,84125386.26%true4false->truetrue
Medium agent workflowminimal4,85527094.44%true4false->truetrue
Large repeated auditminimal9,73126997.24%true4false->truetrue
Sub-agent handoff exampleminimal6,52327695.77%true4false->truetrue

Across these reproducible fixtures, repeated operational context was reduced from ~22,950 source tokens to ~1,068 memory-pack tokens, an approximate 95.35% reduction. This is not a universal guarantee; it shows the effect when an agent would otherwise resend the same project continuity.

Tools=4 refers to the pre-session-aware minimal profile used by these fixtures. In v1.0.1, minimal also includes mem_session_list, mem_scope_resolve, and mem_bootstrap_context, and the standard profile exposes 20 tools for broader retrieval, governance, and audit workflows.

Runtime validation snapshot

RuntimeSetupObserved metricsResult
Writable MCP defaultCodex/Gemini/Claude local daemon bridges, read_only=false; full where writable tools are requiredmem_note_create wrote indexed manual notes and mem_search / mem_context_pack recovered them; mem_snapshot_create(project_key, label, session_id) recorded high-confidence provenanceWritable manual-note and snapshot-provenance smokes passed
Codex DesktopCodex Desktop, MCP stdio, explicit retrieval-only minimal, read-only, compact synthetic v1.0 fixtures~22,950 source tokens -> ~1,068 pack tokens, ~95.35% repeated-context reduction, not_modified=true on repeated packsRetrieval-only MCP validation plus public reproducible verification; writable continuity is covered by the writable default row
Codex CLI / codex execCodex CLI MCP stdio path, short-lived / ephemeral executionsame local MCP server and config style as Desktop; short-lived CLI lifecycle validated separately from the long-lived Desktop host behaviorValidated Codex CLI path
Google Gemini CLIcodex-agent-mem MCP stdio, explicit retrieval-only standard, read-only; compact when structured payloads are visible, otherwise verbosestable process, request counter increased as expected, object-root payloads verified where visibleRetrieval-only MCP validation with client-exposure caveat
Claude CodeClaude Opus 4.7, codex-agent-mem MCP stdio only, explicit retrieval-only standard, read-only, compactrequests 3 -> 8, lazy init false -> true, same_db_process_count=2 with one Claude Code host active, spawn_storm_warning=false, mem_search count=2Retrieval-only MCP validation passed
Qwen CodeQwen Code 0.15.0, local Ollama, qwen3.6:latest, explicit retrieval-only standard, read-only, compactreal MCP calls to mem_context_pack, mem_search, mem_open_work, mem_completion_check, mem_health_runtime; requests 8, lazy init true, spawn_storm_warning=false, not_modified=trueRetrieval-only local MCP validation passed
Qwen local model smokesQwen Code 0.15.0 with Ollama models qwen3.6:35b-a3b-q8_0 and qwen3.5:9bboth models answered CLI smoke tests and invoked mem_health_runtime through MCP stdio; retrieval-only read_only=true, clean stdin_eof exitsRetrieval-only local model smokes passed
DeepSeek-V3.2Qwen Code 0.15.0, deepseek-v3.2:cloud through Ollama Cloud, explicit retrieval-only standard, read-only, compactreal MCP calls to mem_context_pack, mem_search, mem_health_runtime; requests 6, spawn_storm_warning=false, not_modified=trueRetrieval-only cloud-backed MCP validation passed
Minimax M2.5Qwen Code 0.15.0, minimax-m2.5:cloud through Ollama Cloud, explicit retrieval-only standard, read-only, compactreal MCP calls to mem_context_pack, mem_search, mem_health_runtime; requests 6, not_modified=trueRetrieval-only cloud-backed MCP validation passed
Kimi Code CLIKimi Code CLI 1.38.0, codex-agent-mem MCP stdio, explicit retrieval-only standard, read-only, compactkimi mcp test codex-agent-mem connected and listed the expected standard-profile tools; Kimi K2.5 / Kimi K2.6 full model tool-call validation remains in continuous evaluationRetrieval-only MCP connection validated; model-run validation not claimed
Grok / xAIProtocol-level compatibility noteMCP stdio / JSON-RPC protocol behavior reviewedProtocol note

Grok / xAI is listed as a protocol-level compatibility note, not live model tool-call validation. The live validated rows are the MCP client/model pairs measured directly: Codex Desktop/CLI, Google Gemini CLI, Claude Code, Qwen Code, Qwen local model smokes, DeepSeek-V3.2 through Ollama Cloud, Minimax M2.5 through Ollama Cloud, and Kimi Code CLI connection validation. More generally, codex-agent-mem is model-agnostic at the MCP layer; new pairs are added as their live measurements are captured.

Verifiable Results

codex-agent-mem includes a reproducible verification sandbox and a public evidence export for v1.0.0. The fixture approach is intentional: the MCP optimizes repeatable operational-context handling, so the public evidence keeps the repeated context controlled instead of turning the benchmark into a different conversation every run.

The public v1.0.x evidence combines reproducible verification fixtures with live MCP runtime validation across the runtimes listed above. It reports context compression, repeated-pack avoidance with known_pack_hash, lazy initialization, minimal tool surface, explicit read-only mode safety, response diet, local telemetry, closure control, and a sub-agent handoff example.

See: Verification Evidence and v1.0.0 Results.

Claude Code and claude-mem

codex-agent-mem runs in Claude Code as a standard MCP stdio server. It does not install session-start hooks, stop hooks, or automatic post-turn summarization. Memory is retrieved on demand through MCP tools such as mem_context_pack, mem_search, mem_open_work, and mem_completion_check.

If you already use claude-mem, both tools can technically coexist. For lower-overhead, lower-latency workflows, use one active memory layer at a time. In local validation with one Claude Code host active, codex-agent-mem alone kept the runtime compact (same_db_process_count=2, spawn_storm_warning=false). Running it alongside claude-mem increased visible tool surface to 61 tools, added a session-start memory block of about 6,995 tokens, and showed post-turn stop-hook delays. This does not break codex-agent-mem, but it makes results harder to compare and can increase overhead and latency.

Use codex-agent-mem when you prefer local-first, auditable, pull-based memory with explicit retrieval and deterministic closure checks. Use additional memory plugins only when you intentionally want their automatic hook-based behavior.

For token-sensitive Claude Code workflows, codex-agent-mem is designed for low overhead by default: no session-start injection, no stop-hook summarization, compact responses, explicit budgets, and pack_hash / not_modified short-circuiting for unchanged packs.

Optional companion: clean-process-ended

codex-agent-mem v1.0.1 and clean-process-ended (GitHub) v0.7.2 work independently, but they solve adjacent problems in local agent workflows.

  • codex-agent-mem preserves continuity: project memory, scoped context packs, manual notes, snapshots, open work, blockers, and deterministic closure checks.
  • clean-process-ended handles local process hygiene: ownership-first diagnostics, dry-run close checks, and compact janitor receipts.

Together they improve end-of-task workflows: recover context, finish the work, check local process state, and store compact close evidence without making either MCP a hard dependency of the other.

What you get

Continuity

  • Compact continuity, not raw replay: turns repeated session context into smaller AGENTS.md working packs when compression is actually favorable
  • Operational state across sessions and agents: keeps objective, constraints, pending work, blockers, Definition of Done, and scope guardrails visible and reusable so context is not captive to one model, one session, or one provider UI
  • MCP-native integration: runs as a local MCP stdio server for Codex, Claude Code, Google Gemini CLI, Qwen Code, and other MCP-compatible clients; Codex notify and optional AGENTS.md sync remain available where useful
  • Token efficiency for agent workflows: improves the token economy of repeated agent work by reducing continuity replay when the compact pack wins; the public v1.0 fixtures show 86% to 97% reduction on repeated-context scenarios

Closure Control

  • Deterministic closure control: exposes mem_open_work and mem_completion_check so open work beats stale completion claims
  • Scope retention: carries forward must-not-drop continuity, recent changes, and active blockers instead of only decisions

Governance and Audit

  • Governed memory selection: applies project policies, inheritance rules, and repair events instead of mixing everything blindly
  • Inspectable MCP memory: the local /ui lets you navigate recent changes, scope guard, provenance, health, snapshots, governance state, and stored memory without opening the SQLite database by hand
  • Fully local and auditable: SQLite + FTS5, provenance, health diagnostics, snapshots, and a local inspector UI with no external memory service and no outbound memory sync
  • Clear local security boundary: v1.0.1 hardens loopback daemon access, optional bearer-token auth, sanitized health output, and generated-context instruction hierarchy; this is not prompt-injection proof, and the public 1.0.x SQLite database remains plaintext by default and should not be used as a secrets vault

Key docs: AGENTS.md | Quickstart | Codex Integration | Codex Desktop Note | Support Matrix | Design Decisions

Built for long audits, multi-step project continuity, and workflows where the real failure mode is not only forgetting decisions, but also dropping scope, losing blockers, and declaring completion too early.

Status

1.0.2 is the current 1.0.x maintenance release. 1.0.0 remains the public verification baseline for the reproducible metrics below.

What works today:

  • Codex notify ingestion on agent-turn-complete
  • local SQLite persistence with FTS5
  • heuristic extraction of session_summary, decision, objective, constraint, pending_item, completed_item, blocker, and completion_claim
  • hierarchical Definition of Done tracking across project_dod, mission_dod, and session_dod
  • generated working-memory packs with approximate token budget and compression stats
  • budgeted packs for micro, normal, and full reinjection
  • opt-in AGENTS.md sync through --sync-project-doc when the generated pack is smaller than the source context
  • operational-state carry-forward so the next run can recover objective, pending work, blockers, and scope guardrails
  • deterministic closure control with mem_open_work and mem_completion_check
  • recent-change deltas through mem_recent_changes
  • scope continuity and must-not-drop guardrails through mem_scope_guard
  • false-completion guardrails that keep “done” from overriding open work when pending items, blockers, or DoD gaps still exist
  • context sync and closure metrics persisted per project
  • automatic budget selection for context packs when budget=auto
  • memory provenance persisted per observation and queryable through mem_provenance
  • diagnostic health reporting through mem_health
  • MCP runtime diagnostics through mem_health_runtime
  • manual operational notes through mem_note_create, indexed for mem_search and eligible for mem_context_pack
  • versioned project snapshots through mem_snapshot_create, mem_snapshot_list, and mem_snapshot_restore
  • governed memory policies through mem_policy_validate, mem_policy_add, mem_policy_list, and mem_policy_remove
  • selective inheritance links through mem_inheritance_add, mem_inheritance_list, and mem_inheritance_remove
  • governed repair proposals and derived repair events through mem_repair_propose and mem_repair_apply
  • low-impact MCP profiles through --profile minimal|standard|full
  • explicit read-only audit/debug mode through --read-only
  • compact MCP response text with full structuredContent
  • known_pack_hash / not_modified continuity-pack reuse
  • short in-process caching for expensive read tools
  • lazy SQLite initialization for cheap unused MCP connections
  • enriched runtime health with profile, mutability, cache, lazy-init, heartbeat, and spawn-storm diagnostics
  • optional local runtime telemetry through --telemetry-mode off|summary|debug
  • optional local daemon through codex-agent-mem-daemon and stdio bridge mode with --daemon-url
  • FastAPI inspection API
  • local inspection UI at /ui, including recent changes, scope guard, provenance, health, snapshots, and governance state
  • local policy CLI with codex-agent-mem-policy
  • MCP stdio server with:
    • mem_search
    • mem_get
    • mem_recent
    • mem_session_list
    • mem_scope_resolve
    • mem_bootstrap_context
    • mem_project_brief
    • mem_open_work
    • mem_completion_check
    • mem_recent_changes
    • mem_scope_guard
    • mem_context_pack
    • mem_provenance
    • mem_health
    • mem_health_runtime
    • mem_snapshot_list
    • mem_note_create
    • mem_snapshot_create
    • mem_snapshot_restore
    • mem_policy_list
    • mem_policy_validate
    • mem_policy_add
    • mem_policy_remove
    • mem_inheritance_list
    • mem_inheritance_add
    • mem_inheritance_remove
    • mem_repair_propose
    • mem_repair_apply
  • automated tests

What is intentionally not in scope yet:

  • embeddings
  • vector stores
  • Codex App Server ingestion
  • Codex hooks adapter
  • Ollama adapter
  • multi-agent orchestration

Why this repository exists

  • Agent workflows often need durable context that stays outside one runtime process.
  • Retrieval alone does not solve the bigger failure mode: losing scope and forcing the user to restate prior context.
  • A compressed continuity block or MCP context pack can reduce how much prior context must be replayed manually.
  • Carrying only decisions is not enough; the runtime also needs active objective, open work, blockers, and a rule against false closure.
  • SQLite keeps the implementation local-first, auditable, and easy to inspect.
  • The current release intentionally focuses on a narrow, testable slice rather than a broad unfinished platform.
  • Long-lived and short-lived MCP hosts can behave differently under runtime load; see the validation docs for the exact runtime boundary.

Installation model

codex-agent-mem is installed as a local Python package and exposed to MCP-compatible clients through stdio commands.

The stable pattern is:

  1. install the package
  2. point the MCP client at the installed command
  3. keep the memory database local and auditable

Codex-specific notify and mcp_servers snippets are generated by codex-agent-mem-bootstrap-codex; other MCP clients use their own configuration files.

Quickstart

If you want the shortest path from clone to a working local setup:

PowerShell / Windows

powershell
git clone https://github.com/MarceloCaporale/codex-agent-mem.git
cd codex-agent-mem
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .[dev]
codex-agent-mem-smoke
codex-agent-mem-bootstrap-codex --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

bash / macOS / Linux

bash
git clone https://github.com/MarceloCaporale/codex-agent-mem.git
cd codex-agent-mem
python3 -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
codex-agent-mem-smoke
codex-agent-mem-bootstrap-codex --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"

For Codex, paste the generated snippet into ~/.codex/config.toml. For other MCP clients, use the common stdio command in Configure MCP clients.

Install

Option A: pipx from GitHub

Install directly from the repository URL:

bash
pipx install "git+https://github.com/MarceloCaporale/codex-agent-mem.git"
codex-agent-mem-smoke
powershell
pipx install "git+https://github.com/MarceloCaporale/codex-agent-mem.git"
codex-agent-mem-smoke

Option B: local development install

bash
git clone https://github.com/MarceloCaporale/codex-agent-mem.git
cd codex-agent-mem
python3 -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest -q
codex-agent-mem-smoke
powershell
git clone https://github.com/MarceloCaporale/codex-agent-mem.git
cd codex-agent-mem
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .[dev]
pytest -q
codex-agent-mem-smoke

Configure MCP clients

The MCP server entry point is the same for every compatible client:

bash
codex-agent-mem-mcp --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"
powershell
codex-agent-mem-mcp --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

Point your MCP-capable client at that installed stdio command. The validated public v1.0.x paths include Codex CLI/Desktop, Claude Code, Google Gemini CLI, Qwen Code with local Qwen models through Ollama, DeepSeek-V3.2 and Minimax M2.5 through Ollama Cloud, plus Kimi Code CLI connection validation.

Codex helper

Generate a ready-to-paste snippet:

bash
codex-agent-mem-bootstrap-codex --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"
powershell
codex-agent-mem-bootstrap-codex --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

For Codex, that prints the notify block, the [mcp_servers."codex-agent-mem"] block, an explicit stdio idle-timeout, and MCP tool approvals you can paste into ~/.codex/config.toml.

For long-lived Codex Desktop sessions, prefer a longer MCP idle timeout such as --idle-timeout-seconds 1800 so the Desktop thread is less likely to keep a closed stdio transport. For short CLI or codex exec runs, 300 seconds is usually enough and keeps cleanup faster.

Automatic AGENTS.md reinjection is now opt-in. Add --sync-project-doc to the notify command only if you want generated working-memory blocks written back into the working directory.

How agents should use it

Once configured, the agent should use codex-agent-mem proactively when continuity matters. You should not need to repeat "use the memory MCP" every few turns.

Recommended pattern:

  • start with mem_bootstrap_context when prior decisions, pending work, blockers, constraints, or project state may matter; pass thread, chat-title, cwd, or repo hints when the host exposes them
  • call mem_context_pack directly only when the scope is already explicit, preferably with session_id for broad workspaces
  • pass known_pack_hash on repeated checks so unchanged packs return not_modified instead of resending context
  • use mem_search only when the compact pack is not enough
  • before claiming done, call mem_open_work and mem_completion_check for implementation, validation, publishing, migration, or documentation tasks

This is where the practical token economy comes from: compact continuity first, targeted expansion only when needed, and no repeated pack when nothing changed.

Example files live under examples/codex, with Ollama workflow notes under examples/ollama.

Run locally

Start the inspection API:

bash
codex-agent-mem-api --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"
powershell
codex-agent-mem-api --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

Then open:

text
http://127.0.0.1:37770/ui

Start the MCP server:

bash
codex-agent-mem-mcp --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"
powershell
codex-agent-mem-mcp --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

The current MCP transport is stdio. That means one process per host connection is normal; it is not a singleton daemon. The defensive idle timeout is there to let unused or orphaned instances exit cleanly.

Recommended defaults: use a longer timeout for Codex Desktop sessions, for example 1800 seconds, and a shorter timeout for CLI/ephemeral runs, for example 300 seconds.

Manually rebuild the generated continuity block for one directory:

bash
codex-agent-mem-refresh-context --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db" --project-key YOUR_PROJECT --cwd /path/to/project
powershell
codex-agent-mem-refresh-context --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db --project-key YOUR_PROJECT --cwd C:\Path\To\Project

Quick verification

Run the smoke test:

bash
codex-agent-mem-smoke --db-path "$HOME/.codex_agent_mem/codex_agent_mem.db"
powershell
codex-agent-mem-smoke --db-path C:\Users\YOU\.codex_agent_mem\codex_agent_mem.db

That inserts a sample turn, extracts observations, and verifies recent retrieval and project brief generation.

Token efficiency: what saves tokens now

  • The package compiles a smaller working-memory pack from recent turns, durable decisions, and derived operational state.
  • When --sync-project-doc is enabled and that pack is actually smaller than the source context, it is synced into AGENTS.md for the working directory.
  • MCP retrieval and optional AGENTS.md sync let future sessions start with compressed continuity instead of forcing you to restate old scope.
  • mem_context_pack exposes the same compact pack over MCP for on-demand retrieval.
  • The pack now carries forward pending work and blockers, so a future run can recover “what remains” instead of only “what was decided.”

This is token efficiency for agent workflows, not magic compression. codex-agent-mem improves the token economy by reducing repeated project context, reusing unchanged packs through known_pack_hash, and letting agents expand only the memory they need.

Approximate token savings

In plain language: this usually aims to cut down the amount of repeated context you have to replay, not to eliminate it completely.

What we can say honestly from local validation:

  • the public v1.0 fixtures reduced repeated context from ~22,950 source tokens to ~1,068 memory-pack tokens, about 95.35% in that controlled scenario
  • individual repeated-context scenarios in the fixture suite landed between 86% and 97% reduction
  • live runtime checks confirmed compact MCP retrieval, stable process lifecycle, object-root/no-reinjection behavior where visible, and writable snapshot provenance for local Codex/Gemini/Claude daemon bridges

Examples from the public v1.0 verification sandbox:

  • 1,841 -> 253 approximate tokens
  • 4,855 -> 270 approximate tokens
  • 9,731 -> 269 approximate tokens
  • 6,523 -> 276 approximate tokens

Important: this is not a fixed guarantee per prompt. If the compact pack is not actually smaller than the source context, codex-agent-mem skips reinjection instead of pretending it saved tokens.

What this helps catch now

  • losing the original objective after a few runs
  • silently narrowing scope when the user asked for more
  • declaring completion while pending work still exists
  • forgetting blockers and re-entering the next run as if the task were finished

Repository layout

Documentation map

Release surface

This repository includes:

  • clean root package layout
  • installable pyproject.toml
  • command entry points
  • tests
  • CI workflow
  • license
  • changelog

Author

Created and maintained by Marcelo Caporale.

将 Codex Agent Mem MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Codex Agent Mem 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Codex Agent Mem 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Codex Agent Mem MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "codex-agent-mem": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Codex Agent Mem MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Codex Agent Mem MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Codex Agent Mem 帮我完成这项任务吗?
Codex Agent Mem
当然。我已阅读。
以下是我使用 Codex Agent Mem 得到的结果。

常见问题

Codex Agent Mem MCP 服务器有什么用途?

Codex Agent Mem 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Codex Agent Mem MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Codex Agent Mem,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Codex Agent Mem MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Codex Agent Mem 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Codex Agent Mem MCP 连接到 TypingMind?

Codex Agent Mem 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Codex Agent Mem MCP 在 TypingMind 中提供哪些工具?

Codex Agent Mem 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Codex Agent Mem MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Codex Agent Mem 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇