Skip to main content
Glama

Codex History Hub

简体中文 | English

Local-first、源数据只读的 Codex 会话聚合器。它将一个或多个 CODEX_HOME 索引到独立 SQLite 数据库,并通过本地网页和 MCP 提供跨项目、归档与子代理历史查询。

当前为 alpha 版本。请先阅读隐私与安全,不要上传 Hub 数据库或真实会话文件。

能力与边界

  • 以 Codex 的 state_5.sqlite 为线程索引,按 rollout_path 增量读取 sessions/archived_sessions/

  • 覆盖主会话、归档会话、子代理、用户/助手消息及工具事件。

  • 提供本地只读网页,以及 5 个 MCP 工具用于近期上下文、搜索、线程读取和项目总览。

  • 不读取 auth.json、Cookie、API Key 或 logs_2.sqlite,不修改 Codex 原始数据库、JSONL 或侧栏。

  • 不合并或改写 Codex 原生账号会话库;所有索引和长期总结仅写入 Hub 自己的数据库。

Related MCP server: vshulcz/deja-vu

安装

需要 Python 3.10 或更新版本,无第三方运行时依赖。

git clone <YOUR_REPOSITORY_URL>
cd codex-history-hub
python -m venv .venv
.\.venv\Scripts\python -m pip install -e .

注册当前 Windows 用户的 Codex Home:

codex-history-hub --db data/history-hub.db add-source `
  --name local-codex `
  --path "$env:USERPROFILE\.codex"

codex-history-hub --db data/history-hub.db sync
codex-history-hub --db data/history-hub.db status

macOS/Linux 可将路径写为 ${CODEX_HOME:-$HOME/.codex}。另一个独立 CODEX_HOME 可用不同 --name 再次注册;旧式纯 JSONL 目录使用 --type jsonl

也可通过环境变量设置数据库位置:

$env:HISTORY_HUB_DB = "D:\private\codex-history\history-hub.db"
codex-history-hub status

本地网页

Windows 用户可双击 open-history-hub.cmd。也可以运行:

codex-history-hub --db data/history-hub.db serve

然后访问 http://127.0.0.1:8765。服务立即同步一次,此后默认每 30 秒增量同步;网页也会每 30 秒静默更新联动数量和当前列表,并保留筛选、页码和已打开详情。

页面按 50 条分页,来源、模型提供方、项目和会话类型的数量会随其他条件联动。活动筛选可单独移除或全部清除。搜索按会话去重,默认只查用户与 Codex 正文;“搜索设置”可分别开启工具输出、Developer 指令、System 消息和 Event 事件,这些偏好只保存在当前浏览器。详情正文分页读取,技术记录在展开时才加载,不会静默截断长会话。

网页只允许绑定 localhost127.0.0.1::1。项目没有远程认证机制,因此会拒绝 0.0.0.0 和其他非回环地址。

全局 MCP 配置

将下列配置加入用户级 Codex config.toml。所有路径都应替换为本机实际的绝对路径;建议直接使用虚拟环境的 Python,避免依赖当前工作目录或系统 PATH。

[mcp_servers.history_hub]
command = "D:\\path\\to\\codex-history-hub\\.venv\\Scripts\\python.exe"
args = [
  "-m", "history_hub",
  "--db", "D:\\private\\codex-history\\history-hub.db",
  "mcp"
]

重启 Codex 或新开任务后,可调用:

  • history_get_recent_context:项目总览和最近 3 条主会话;子代理默认排除。

  • history_search:搜索全部会话,包括归档和子代理;默认仅搜索用户与助手正文,可显式设置 include_technical

  • history_get_thread:按需读取选中线程;工具输出默认排除。

  • history_get_project_summary:读取长期项目总览。

  • history_update_project_summary:仅更新 Hub 数据库中的项目总览。

每次 MCP 工具调用前都会执行增量同步,因此网页无需常驻。

隐私与安全

Hub 在写入和输出时对常见 API Key、访问令牌、私钥、JWT、邮箱和用户主目录路径进行脱敏。Web/MCP 输出还会移除源根目录、rollout 文件路径和可能带凭据的 Git URL。升级后的数据库会执行一次 Hub 内部脱敏迁移;原始 Codex 文件始终不变。

这些规则不能识别所有自然语言中的个人信息。请遵守以下原则:

  • data/*.db、SQLite sidecar 和日志已被 .gitignore 排除,永远不要强制提交。

  • Hub 数据库仍包含完整聊天内容,以及增量同步必需的本机源路径;应将其视为敏感文件。

  • 分享截图、导出结果或数据库前必须人工复核。

  • 不要将本地网页通过端口转发、代理或公网地址直接暴露。

  • 安全问题请按 SECURITY.md 私下报告,不要在 issue 中粘贴真实会话或凭据。

开发与验证

python -m compileall -q history_hub tests
python -m unittest discover -s tests -v
npm ci
npx playwright install chromium
npm run test:e2e

CI 会在 Windows 与 Ubuntu、Python 3.10 和 3.13 上执行安装、编译和后端测试,并在 Ubuntu 上运行 Playwright 网页交互测试。Playwright 仅为开发依赖,History Hub 运行时仍无第三方 Python 依赖。贡献要求与隐私测试规范见 CONTRIBUTING.md

许可证

本项目采用 MIT License。版本号遵循语义化版本,当前网页与搜索稳定性版本为 0.4.0

Available Tools

5 tools
history_get_project_summaryA

Get the durable overview of a project without loading conversation transcripts.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectNo

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that the operation does not load conversation transcripts, implying a lightweight read. However, it does not explicitly state whether it is read-only, what 'durable overview' contains, or error behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with no filler; the information is front-loaded and every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no annotations or output schema, the description provides core purpose and one distinguishing behavior, but omits parameter details, explicit alternative tool references, and return format. It is adequate for a simple getter but has gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one parameter 'project' with no description (0% coverage). The description fails to explain the parameter format or whether it is required (required params = 0). The name 'project' is self-evident but no further guidance is given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and identifies a distinct resource ('durable overview of a project') while explicitly differentiating from sibling tools that load conversation transcripts (like history_get_thread). This clearly communicates what the tool does and how it differs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly indicates the use case: retrieving a project overview without loading full transcripts, which implies when to prefer this over history_get_thread. However, it does not explicitly name alternatives or state exclusions, preventing a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

history_get_recent_contextB

Get a project overview plus recent primary conversation summaries. Subagents are excluded by default.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
sourceNo
projectNo
include_subagentsNo

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does add some behavioral context: 'Subagents are excluded by default' and 'primary conversation summaries.' However, it omits return format, recency definition, required context, and potential side effects, so transparency is only partial.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short, front-loaded with the main action and resource, and every sentence adds value. It is not overly verbose, though it could be slightly more organized given the absence of schema descriptions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With four parameters, no output schema, and no annotations, the description is too brief to be complete. It covers the core purpose and one default, but leaves parameter behavior, return structure, and recency semantics unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description only clarifies the include_subagents default (false) and hints at 'recent' limiting summaries. It does not explain limit, source, or project parameters, leaving most of the parameter semantics unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and resource ('project overview plus recent primary conversation summaries'), which clearly states what the tool returns. It also distinguishes itself from siblings like history_get_project_summary by including recent conversation summaries and noting subagent exclusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly state when to use this tool versus alternatives such as history_get_thread or history_get_project_summary. It provides no exclusions, prerequisites, or alternative guidance, only a statement of what the tool does and a default behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

history_get_threadB

Read a selected history thread after identifying it via recent context or search. Full mode should be used only when the user explicitly requests the full thread.

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNorelevant
queryNo
max_charsNo
thread_idYes
include_toolsNo

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden. It discloses a caution about 'full' mode requiring explicit user request, which is useful. However, it does not describe return behavior, side effects, or cost implications for other modes (summary/relevant).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, direct and front-loaded. Every word earns its place, with no fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no output schema, and no annotations, the description is far from complete. It omits parameter semantics, return value expectations, and any mention of resource costs besides the 'full mode' caution.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must compensate. It only references 'full mode' (one enum value) but does not explain thread_id, query, max_chars, include_tools, or mode differences. This is insufficient for 5 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'read' and the resource 'history thread', and introduces the prerequisite of identifying the thread via recent context or search. It does not explicitly name sibling tools, but the reference to 'recent context or search' strongly implies the context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies a usage flow (identify thread first) and provides a specific constraint for 'full' mode, but does not explicitly state when to use this tool versus alternatives or provide exclusions. Sibling tools are not named, so guidance is only implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

history_update_project_summaryA

Update the confirmed durable project overview in the independent Hub only. Never writes to any source Codex account/session store.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectYes
summaryYes

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses a critical behavioral trait: writes only to the independent Hub and never to source Codex stores, which is valuable side-effect context. It does not mention permissions, return behavior, or whether the update is idempotent, but the most essential transparency about write scope is present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences that are front-loaded with the action ('Update') and the resource. Every word adds value: the scope ('independent Hub only') and the exclusion ('never writes to any source Codex account/session store') are concise and non-redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description provides a solid baseline: it states the core function and a key side-effect boundary. However, it leaves gaps such as what 'confirmed durable' means, whether the summary replaces the entire overview, and what success/failure looks like. Basic use is clear, but important details for safe invocation are missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, and the description does not clarify the meaning of the 'project' and 'summary' parameters. The phrase 'project overview' hints that 'summary' might be the new overview text, but it does not explicitly state that 'project' is the identifier or what format the summary should take. The description completely fails to compensate for the schema's lack of parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Update' and names the resource as 'the confirmed durable project overview in the independent Hub only,' which precisely identifies the tool's function. It clearly distinguishes this write operation from the sibling read-only tools like history_get_project_summary and history_search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool: whenever you need to update the durable project overview. It also draws a clear boundary by stating it never writes to source Codex account/session stores. However, it does not explicitly name alternative tools or state when not to use it, though the sibling tools are all read-oriented, making the intended context fairly clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.4.0
    • First observedhistory_get_project_summary
    • First observedhistory_get_recent_context
    • First observedhistory_get_thread
    • First observedhistory_search
    • First observedhistory_update_project_summary

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct operation: recent context retrieval, cross-account search, thread reading, project summary retrieval, and project summary update. The overlap between recent context and project summary is intentional, and descriptions clarify the difference.

Naming Consistency4/5

All tools share the 'history_' prefix and mostly follow a verb_noun pattern (get_recent_context, get_thread, get_project_summary, update_project_summary). The exception is 'history_search' which lacks an explicit object, but the pattern remains clear.

Tool Count5/5

With five tools, the set is well-scoped for a history hub: retrieval, search, and update operations. Each tool serves a clear purpose without redundancy.

Completeness4/5

The surface covers core history workflows: recent context, search, thread retrieval, and project summary read/update. A minor gap is the lack of an explicit list projects tool, but search and recent context can compensate.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Indexes the session histories Claude Code, Codex CLI and opencode already write into a local searchable memory. MCP recall tools, session-start auto-recall, secret redaction at index time, cross-machine sync over SSH.
    1
    710 npm
    859
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Provides a read-only interface to audit and continue coding agent sessions by extracting plans, intents, and edit authorship from history across multiple agents (Claude, Codex, OpenCode, Antigravity, Pi) via MCP, CLI, and Python SDK.
    18
    29 PyPI
    3
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server for unified full-text search across chat histories from Claude Code, Codex, Cursor CLI, and Antigravity CLI, using SQLite FTS5. Provides read-only tools to search sessions, list conversations, and retrieve session details.
    MIT