index1
AI memory system for coding agents with BM25 + vector hybrid search. Provides 6 MCP tools for intelligent code/doc search and cognitive fact recording.
What it does
- - Dual memory: corpus (code index) + cognition (episodic facts)
- Hybrid search: BM25 full-text + vector semantic search with RRF fusion
- Structure-aware chunking: Markdown, Python, Rust, JavaScript, plain text
- MCP Server: 6 tools (
recall, learn, read, status, reindex, config) - CJK optimized: Chinese/Japanese/Korean query detection with dynamic weight tuning
- Built-in ONNX embedding: Vector search works out of the box, no Ollama required
- Graceful degradation: Works without any embedding service (BM25-only mode)
Install
CODEBLOCK0
One-click plugin setup:
CODEBLOCK1
Verify:
CODEBLOCK2
Setup MCP
Create .mcp.json in your project root:
CODEBLOCK3
If index1 is not in PATH, use the full path from which index1.
Add Search Rules
Add to your project's .claude/CLAUDE.md:
CODEBLOCK4
Impact:
CODEBLOCK5
Index Your Project
CODEBLOCK6
Optional: Multilingual Enhancement
index1 v2 has built-in ONNX embedding (bge-small-en-v1.5). For better multilingual support:
CODEBLOCK7
Without Ollama, ONNX embedding provides vector search out of the box.
Web UI
CODEBLOCK8
MCP Tools Reference
| Tool | Description |
|---|
| INLINECODE10 | Unified search — code + cognitive facts, BM25 + vector hybrid |
| INLINECODE11 |
Record insights, decisions, lessons learned (auto-classify + dedup) |
|
read | Read file content + index metadata |
|
status | Index and cognition statistics |
|
reindex | Rebuild index for a path or collection |
|
config | View or modify configuration |
Troubleshooting
| Issue | Fix |
|---|
| Tools not showing | Check .mcp.json format and index1 path |
| AI doesn't use recall |
Add search rules to CLAUDE.md |
|
command not found | Use full path from
which index1 |
| Chinese search returns 0 | Install Ollama +
bge-m3 model |
| No vector search | Built-in ONNX should work; run
index1 doctor |
技能名称: index1
详细描述:
index1
面向编码智能体的AI记忆系统,采用BM25+向量混合搜索。提供6个MCP工具,用于智能代码/文档搜索和认知事实记录。
功能特性
- - 双重记忆:语料库(代码索引)+ 认知(情景事实)
- 混合搜索:BM25全文搜索 + 向量语义搜索,支持RRF融合
- 结构感知分块:支持Markdown、Python、Rust、JavaScript、纯文本
- MCP服务器:6个工具(recall、learn、read、status、reindex、config)
- 中日韩优化:支持中文/日文/韩文查询检测,动态权重调整
- 内置ONNX嵌入:开箱即用的向量搜索,无需Ollama
- 优雅降级:无嵌入服务时仍可工作(仅BM25模式)
安装
bash
推荐
pipx install index1
或通过pip
pip install index1
或通过npm(自动安装Python包)
npx index1@latest
一键插件设置:
bash
index1 setup # 为Claude Code自动配置钩子+MCP
验证:
bash
index1 --version
index1 doctor # 检查环境
配置MCP
在项目根目录创建.mcp.json:
json
{
mcpServers: {
index1: {
type: stdio,
command: index1,
args: [serve]
}
}
}
如果index1不在PATH中,请使用which index1获取的完整路径。
添加搜索规则
添加到项目的.claude/CLAUDE.md:
markdown
搜索策略
本项目已配置index1 MCP服务器(recall + 其他5个工具)。搜索代码时:
- 1. 已知标识符(函数/类/文件名)-> 直接使用Grep/Glob(4毫秒)
- 探索性问题(XX如何工作)-> 先使用recall,再用Grep获取细节
- 针对英文代码的中日韩查询 -> 必须使用recall(Grep无法跨语言)
- 高频关键词(预期匹配50+)-> 优先使用recall(节省90%+上下文)
效果:
无规则:Grep search -> 881行 -> 35,895 tokens
有规则:recall -> 5条摘要 -> 460 tokens(节省97%)
索引项目
bash
index1 index ./src ./docs # 索引源代码和文档
index1 status # 查看索引统计
index1 search your query # 测试搜索
可选:多语言增强
index1 v2内置ONNX嵌入(bge-small-en-v1.5)。如需更好的多语言支持:
bash
curl -fsSL https://ollama.com/install.sh | sh
ollama pull nomic-embed-text # 标准版,270MB
或
ollama pull bge-m3 # 中日韩最佳,1.2GB
index1 config embed_backend ollama
index1 doctor # 验证设置
无需Ollama,ONNX嵌入即可提供开箱即用的向量搜索。
Web界面
bash
index1 web # 在端口6888启动Web界面
index1 web --port 8080 # 自定义端口
MCP工具参考
| 工具 | 描述 |
|---|
| recall | 统一搜索 — 代码+认知事实,BM25+向量混合 |
| learn |
记录见解、决策、经验教训(自动分类+去重) |
| read | 读取文件内容+索引元数据 |
| status | 索引和认知统计 |
| reindex | 重建指定路径或集合的索引 |
| config | 查看或修改配置 |
故障排除
| 问题 | 解决方案 |
|---|
| 工具未显示 | 检查.mcp.json格式和index1路径 |
| AI不使用recall |
在CLAUDE.md中添加搜索规则 |
| command not found | 使用which index1获取的完整路径 |
| 中文搜索返回0结果 | 安装Ollama + bge-m3模型 |
| 无向量搜索 | 内置ONNX应可工作;运行index1 doctor |