Skip to main content
Glama

lore

License: MIT TypeScript lore MCP server

跨 Claude Code OpenAI Codex CLI 对话的语义搜索。 查找你曾经讨论过的任何内容——涵盖所有项目、所有会话、任何分支、任何代理。

lore MCP server

功能特性

  • 混合搜索(向量 + 关键词) 结合了 multilingual-e5-small 嵌入与 FTS5/BM25,并通过倒数排名融合(Reciprocal Rank Fusion)进行排序。既能按语义查找,也能按精确术语查找。

  • 多代理支持:Claude Code + Codex CLI 在同一个数据库中索引 ~/.claude/projects/ (Claude Code) 和 ~/.codex/sessions/ (OpenAI Codex CLI)。Codex 会话按 session_meta 中的 cwd 分组,并作为 codex-<path> 虚拟项目呈现,因此你可以一起搜索它们或过滤到单个代理。

  • 完全本地化,无需 API 密钥 一切都在你的机器上运行。使用 ONNX Runtime 进行嵌入,使用 sqlite-vec 进行存储。没有任何数据会离开你的设备。

  • 会话结束自动索引 SessionEnd 钩子会在后台自动索引所有新会话。无需手动触发。

  • 后台索引 手动触发索引会立即返回。你可以在继续工作的同时监控进度。在后台处理剩余内容的同时,可以搜索已索引的内容。

  • 默认选择退出 所有项目都会自动索引。你可以排除不需要的项目。无需注册。

  • 感知对话的分块 按逻辑轮次(用户问题 + 完整的助手响应链)进行拆分,而不是任意的 token 窗口。正确处理工具使用链、思考块和多步交互。

  • 100+ 种语言 支持韩语、日语、中文、英语等 90 多种语言。具备 CJK 感知的 token 估算,以实现精确分块。

Related MCP server: Semantic Search MCP Server

快速开始

添加到 Claude Code

# No install needed — always runs latest version
claude mcp add -s user lore -- npx getlore

# Or for a single project only
claude mcp add -s project lore -- npx getlore

添加到 OpenAI Codex CLI

# No install needed
codex mcp add lore -- npx getlore
npm install -g getlore

# Then register with your tool:
claude mcp add -s user lore -- getlore   # Claude Code
codex mcp add lore -- getlore            # Codex CLI

# Manage your install:
getlore --version   # Check installed version
getlore update      # Update to latest

使用方法

连接后,AI 可以直接使用 lore 的工具:

You: "What did we discuss about auth refactoring last week?"

Claude: [calls lore search] Found 3 relevant conversations...
        In your "my-webapp" project on March 15, you decided to...

首次设置:

  1. 索引 (Index) -- index() 会自动扫描所有项目,并在后台运行

  2. 搜索 (Search) -- 询问关于过去对话的任何内容

  3. 排除 (Exclude) (可选) -- 隐藏你不需要的嘈杂项目

工具

工具

用途

manage_projects

从索引中排除/包含项目(选择退出模型)

index

启动后台索引。索引所有未排除的项目。模式:incremental(默认)、rebuildcancel

status

检查索引进度、预计完成时间、跳过原因、数据库健康状况

search

跨对话的语义 + 关键词搜索

get_context

使用周围的对话扩展搜索结果

list_sessions

按项目浏览已索引的会话

为什么存在这个工具

Claude Code 将每次对话存储为 ~/.claude/projects/ 中的 JSONL 转录文件,而 OpenAI Codex CLI 将其记录存储在 ~/.codex/sessions/YYYY/MM/DD/ 中。几周后,你会在几十个项目中拥有数百个会话,通常分布在两个代理之间——包括关于架构决策、调试会话、代码审查和设计探索的讨论。

但没有办法搜索它们。你无法询问“我们对身份验证中间件采取了什么方法?”或“哪个项目进行了那次数据库迁移讨论?”

现有的工具要么需要云 API,要么会产生僵尸进程,要么将对话视为通用文档。lore 是专为 AI 编码会话构建的:它理解轮次边界、工具使用链和思考块,并能原生解析 Claude Code 和 Codex 的 JSONL 格式。它完全在本地运行,除了 Node.js 外没有其他依赖。

工作原理

~/.claude/projects/*/*.jsonl     ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
        \                                       /
         \                                     /
          JSONL Parser (Claude Code + Codex formats, skips noise)
                              |
          Turn-pair Chunker (groups by logical conversation turns)
                              |
          Transformers.js (multilingual-e5-small, INT8 quantized, 384d)
                              |
          sqlite-vec + FTS5 (hybrid vector + keyword storage)
                              |
          Reciprocal Rank Fusion (combines both signals for ranking)

Codex 会话按从每个文件的 session_meta 行中提取的 cwd 进行分组,并作为索引中的 codex-<path> 虚拟项目呈现。

存储: 单个 SQLite 文件位于 ~/.lore/lore.db,使用 WAL 模式以支持并发读取。

配置: 项目排除项存储在 ~/.lore/config.json 中。

环境变量

变量

默认值

描述

LORE_DIR

~/.lore

数据目录

LORE_DB

~/.lore/lore.db

数据库路径

CLAUDE_PROJECTS_DIR

~/.claude/projects

Claude Code 转录文件位置

CODEX_SESSIONS_DIR

~/.codex/sessions

OpenAI Codex CLI 记录位置

在 Apple Silicon (M 系列) 上测量:

指标

数值

搜索延迟

20-30ms

索引速度

~10 个会话/秒

首次搜索(冷模型加载)

~5s

数据库大小

每 10 个会话 ~0.1MB

模型大小(下载一次)

~112MB

“未找到会话”

运行 manage_projects 并使用 list 操作查看可用项目。除非被排除,否则所有项目默认都会被索引。

过期的锁文件

如果索引被中断,锁文件会在下次运行时自动清理(基于 PID 的检测)。

数据库损坏

删除 ~/.lore/lore.db 并重新索引。你的源数据 (~/.claude/projects/) 永远不会被修改。

开发

git clone https://github.com/hyunjae-labs/lore.git
cd lore
npm install
npm run build
npm test          # 135 tests

技术栈

许可证

MIT

Available Tools

6 tools
get_contextA

Retrieve more conversation context around a specific search result. Use ONLY after calling search, when you need to see what was discussed before or after a result.

ParametersJSON Schema
NameRequiredDescriptionDefault
chunk_idYes
directionNo
countNo

TDQS

A3.8/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool retrieves context, it lacks details on permissions, rate limits, error handling, or what the output looks like (e.g., format, size limits). For a tool with no annotation coverage, this leaves significant gaps in understanding its 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?

The description is highly concise and front-loaded, with two sentences that directly state the purpose and usage guidelines without any wasted words. Every sentence earns its place by providing essential information efficiently.

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?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description covers purpose and usage well but is incomplete. It lacks details on parameters, behavioral traits, and output format, which are necessary for full understanding. The description is adequate as a minimum but has clear gaps in context.

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%, so the description must compensate for undocumented parameters. It only vaguely references 'a specific search result' (implied to relate to 'chunk_id') and 'before or after a result' (implied to relate to 'direction'), but provides no specifics on parameter meanings, formats, or constraints. This fails to adequately explain the three parameters beyond basic schema hints.

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 clearly states the specific action ('Retrieve more conversation context') and resource ('around a specific search result'), distinguishing it from siblings like 'search' (which finds results) or 'list_sessions' (which lists sessions). It explicitly defines the tool's scope as fetching contextual conversation snippets.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Use ONLY after calling search, when you need to see what was discussed before or after a result'), including a prerequisite (must call 'search' first) and a clear use-case (viewing surrounding context). It effectively differentiates from alternatives by specifying its post-search role.

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

indexA

Update the search index with recent Claude Code sessions. Call if search returns stale results or the user asks to refresh the index. Modes: 'incremental' (default, only new/changed), 'full' (delete all and rebuild from scratch), 'cancel' (stop running index).

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNo
projectNo
confirmNo

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining the three modes and their behaviors ('incremental' for new/changed, 'full' for delete and rebuild, 'cancel' to stop). It could mention performance impact or permissions but covers core operational traits.

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?

Three sentences with zero waste: first states purpose, second gives usage guidelines, third details modes. Each sentence earns its place, and the structure is front-loaded with essential information.

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

Completeness4/5

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

For a tool with 3 parameters, no annotations, and no output schema, the description is quite complete—covering purpose, usage, and key parameter semantics. It could note that 'full' mode might be resource-intensive or that 'confirm' is for safety, but it's largely adequate.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It explains the 'mode' parameter's three values and their meanings, which adds crucial semantics beyond the bare enum in the schema. It doesn't cover 'project' or 'confirm', but the mode explanation is substantial.

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 clearly states the tool's purpose with specific verbs ('Update the search index') and resources ('recent Claude Code sessions'), distinguishing it from sibling tools like 'search' or 'list_sessions' which query rather than update the index.

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

Usage Guidelines5/5

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

Explicit guidance is provided on when to use this tool: 'if search returns stale results or the user asks to refresh the index.' This directly addresses the tool's purpose relative to alternatives like 'search'.

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

list_sessionsB

List all indexed Claude Code sessions. Use when the user wants to browse conversation history or find sessions by project/date.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectNo
limitNo
sortNo

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that sessions are 'indexed' and implies filtering capabilities ('by project/date'), but lacks details on permissions, rate limits, pagination, or what 'indexed' entails. For a list tool with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior and constraints.

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 concise and well-structured, consisting of two sentences that efficiently convey the tool's purpose and usage. The first sentence states what it does, and the second provides context for when to use it, with no wasted words or redundancy.

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?

Given the complexity (3 parameters, no annotations, no output schema), the description is incomplete. It lacks details on behavioral aspects like permissions or rate limits, and parameter semantics are underspecified. Without an output schema, it also doesn't describe return values (e.g., session format). For a tool with moderate complexity and no structured support, the description should provide more comprehensive guidance.

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 3 parameters with 0% description coverage, meaning no parameter details are documented in the schema. The description only vaguely references 'project/date' for filtering, which partially covers the 'project' parameter but ignores 'limit' and 'sort'. It doesn't explain what 'limit' controls (e.g., number of results) or the meaning of 'sort' enum values ('recent', 'oldest'), failing to compensate for the low schema coverage.

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 tool's purpose: 'List all indexed Claude Code sessions.' It specifies the verb ('List') and resource ('indexed Claude Code sessions'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate this tool from sibling tools like 'search' or 'get_context', which might also involve session retrieval.

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 provides clear usage guidance: 'Use when the user wants to browse conversation history or find sessions by project/date.' This gives context for when to invoke the tool, such as for browsing or filtering by project/date. It doesn't explicitly state when not to use it or name alternatives like 'search', but the context is sufficient for basic decision-making.

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

manage_projectsA

Manage which projects are registered for indexing. Use 'list' to see all projects on disk and their registration status. Use 'add' to register a project for indexing. Use 'remove' to unregister. Projects must be registered before they can be indexed.

ParametersJSON Schema
NameRequiredDescriptionDefault
actionYes
projectNo

TDQS

A4.3/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the three discrete actions and the registration requirement, but doesn't mention permissions needed, whether changes are reversible, rate limits, or what the response looks like. For a mutation tool with zero annotation coverage, this leaves significant gaps.

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 efficiently structured with three sentences: an overview statement, specific action explanations, and a prerequisite. Every sentence adds value with no redundant information, making it easy to parse and understand.

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 2-parameter tool with no annotations and no output schema, the description provides good purpose and usage guidance but lacks details about response format, error conditions, and the exact format of the 'project' parameter. It's adequate but has clear gaps in behavioral transparency.

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

Parameters4/5

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

With 0% schema description coverage, the description must compensate. It explains the meaning of the 'action' parameter values ('list', 'add', 'remove') and implies the 'project' parameter is used with 'add' and 'remove' actions. However, it doesn't specify what format the 'project' parameter expects (path, name, ID).

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 clearly states the tool's purpose with specific verbs ('manage', 'list', 'add', 'remove') and resources ('projects', 'indexing'), distinguishing it from sibling tools like 'index' or 'search'. It explains that this tool handles registration status for indexing, not the indexing process itself.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use each action ('list' to see status, 'add' to register, 'remove' to unregister) and includes a prerequisite statement ('Projects must be registered before they can be indexed') that helps differentiate from the 'index' sibling tool.

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

statusA

Check the health and progress of lore indexing. Shows indexing status, session counts, DB size. Use this to monitor indexing progress after calling index.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool does (checking health/progress and showing specific metrics) but lacks details on permissions needed, rate limits, or what happens if indexing isn't running. It doesn't contradict annotations, but could be more informative.

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 appropriately sized with two sentences that are front-loaded: the first states the purpose and what it shows, the second provides usage guidance. Every sentence adds value without redundancy or waste.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is reasonably complete. It explains the tool's purpose, what it returns, and when to use it. However, without an output schema, it could benefit from more detail on return format or error conditions, but this is minor for a status-check tool.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter information, but it implicitly confirms no parameters are needed by not mentioning any. This meets the baseline for zero-parameter tools.

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 clearly states the tool's purpose with specific verbs ('check', 'shows') and resources ('health and progress of lore indexing', 'indexing status, session counts, DB size'). It distinguishes from siblings by focusing on monitoring rather than performing operations like 'index' or '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 provides clear context for usage ('Use this to monitor indexing progress after calling index'), indicating when to use it in relation to the 'index' sibling tool. However, it doesn't explicitly state when not to use it or mention alternatives among other siblings like 'list_sessions' or 'get_context'.

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. Dates show when Glama detected each change.

  1. 6 tool updates
    • First observedget_context
    • First observedindex
    • First observedlist_sessions
    • First observedmanage_projects
    • First observedsearch
    • First observedstatus

TDQS

A4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: get_context retrieves conversation context around search results, index updates the search index, list_sessions lists indexed sessions, manage_projects handles project registration, search performs searches, and status checks indexing health. The descriptions explicitly differentiate their use cases, preventing agent confusion.

Naming Consistency4/5

Tool names follow a consistent snake_case pattern and use clear verbs like get, index, list, manage, search, and status. However, 'status' deviates slightly as a noun rather than a verb (e.g., 'check_status' would be more consistent), but overall the naming is predictable and readable.

Tool Count5/5

With 6 tools, this server is well-scoped for its purpose of managing and searching conversation history. Each tool serves a specific function in the indexing and retrieval workflow, from setup (manage_projects, index) to query (search, get_context) and monitoring (list_sessions, status), with no unnecessary bloat.

Completeness5/5

The tool set provides complete coverage for the domain of indexing and searching Claude Code sessions. It includes project management (manage_projects), indexing operations (index, status), session listing (list_sessions), search functionality (search), and context retrieval (get_context), ensuring agents can handle the full lifecycle without gaps.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables comprehensive search and analysis of Claude Code conversation history using full-text search, optional semantic vector search, and conversation management tools. Provides fast SQLite-based indexing with role-based filtering, project organization, and hybrid search capabilities combining keyword and semantic matching.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides hybrid semantic and keyword code search for Claude Code using BM25 and vector retrieval. It enables indexing and searching local codebases with language-aware chunking and local embeddings.
    -
  • A
    license
    A
    quality
    A
    maintenance
    Enables local semantic search over documents and code for Claude Code and Claude Desktop, running entirely offline with local embeddings and vector storage.
    12
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides Claude Code with local semantic search and indexing of your codebase using AST-aware chunking and hybrid search, enabling deep code understanding without sending data to the cloud.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hyunjae-labs/lore'

If you have feedback or need assistance with the MCP directory API, please join our Discord server