使用说明
Kiro全面召回
曾经告诉Kiro“就像我们昨天讨论的那样”,但后来才意识到。..它不知道吗?
全面回忆 给了基洛它所缺失的记忆。
问题
- 会话是隔离的:每次Kiro课程都会重新开始。昨天的架构讨论?跑了。
- 项目不共享知识:您的偏好(测试风格、包管理器、模式)在项目中不会被记住。
- CLI和IDE是分开的:Kiro CLI中的对话无法连接到Kiro IDE。
Total Recall索引每个Kiro对话并提供语义搜索。 按以下方式查找讨论 意义不仅仅是关键词。
快速入门
作为Kiro Power(推荐,仅限IDE)
- 在Kiro IDE中:电源面板→ 从GitHub添加电源
- 输入:
https://github.com/danilop/kiro-total-recall - 当你提到“回忆”、“记住”或“过去的对话”时,电源会自动激活
手动MCP设置(CLI和IDE)
添加到 ~/.kiro/settings/mcp.json (此配置由CLI和IDE共享):
{
"mcpServers": {
"total-recall": {
"command": "uvx",
"args": ["--from", "git+https://github.com/danilop/kiro-total-recall", "kiro-total-recall"]
}
}
}
重新启动Kiro CLI/IDE 添加后。MCP服务器仅在启动时加载。
验证安装
在Kiro CLI中: /mcp 应列出 total-recall
在Kiro IDE中:检查MCP服务器面板
运作原理
┌─────────────────────────────────────────────────────────────────────────┐
│ Kiro CLI & IDE │
│ ┌──────────────────────────┐ ┌──────────────────────────────────┐ │
│ │ CLI: SQLite DB │ │ IDE: .chat JSON files │ │
│ │ ~/Library/App Support/ │ │ ~/Library/App Support/Kiro/ │ │
│ │ kiro-cli/data.sqlite3 │ │ User/globalStorage/.../*.chat │ │
│ └────────────┬─────────────┘ └─────────────┬────────────────────┘ │
│ └────────────────┬───────────────┘ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ Unified Loader │ │
│ └───────────┬───────────┘ │
└────────────────────────────────┼────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Kiro Total Recall │
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌────────────────────┐ │
│ │ loader │───▶│ indexer │───▶│ query │───▶│ MCP server │ │
│ │ CLI+IDE │ │ 384-dim │ │ cosine │ │ 4 search tools │ │
│ └─────────┘ └────┬─────┘ └─────────┘ └────────────────────┘ │
│ ▼ │
│ ~/.cache/kiro-total-recall/embeddings.pkl │
└─────────────────────────────────────────────────────────────────────────┘
索引:快速搜索
首次搜索时,全面召回:
- 负载 来自CLI(SQLite)和IDE(.chat文件)的所有消息
- 派遣 每条消息使用 全迷你LM-L6-v2 (384维向量)
- 缓存 嵌入到
~/.cache/kiro-total-recall/embeddings.pkl
后续搜索速度很快,因为:
- 指纹识别:仅在对话发生变化时重建
- 增量更新:嵌入新消息;从缓存加载的现有嵌入
- 基于哈希的重复数据删除:相同的文本=相同的嵌入(无需重新计算)
特性
- 语义搜索:按含义查找,而不仅仅是关键字
- 双源:搜索CLI和IDE对话
- 上下文窗口:查看每场比赛的周边消息
- 日期筛选:按时间范围过滤(ISO 8601)
- 增量索引:仅处理新对话
- 内存限制:可配置的RAM使用率(默认值:RAM的1/3)
MCP工具
| 工具 | 范围 | 用例 |
|---|---|---|
search_project_history |
当前工作区 | 中的错误、决策 这 代码库 |
search_global_history |
所有工作区 | 首选项、模式 全部 工作 |
search_cli_history |
仅限CLI | Kiro CLI对话 |
search_ide_history |
仅限IDE | Kiro IDE对话 |
参数
所有工具均接受:
| 参数 | 默认值 | 说明 |
|---|---|---|
query |
必填 | 要搜索的关键字或句子 |
after |
none | 筛选到此日期(含)当天/之后的邮件。ISO 8601格式。 |
before |
none | 筛选到此日期之前的邮件(不包括)。ISO 8601格式。 |
context_size |
3 | 每场比赛前后的消息 |
threshold |
0.2 | 最小相似性(0-1,较高=更严格) |
max_results |
10 | 返回的最大结果 |
offset |
0 | 跳过结果(用于分页) |
日期筛选示例
# Messages from a specific day
search_project_history(query="auth bug", after="2025-01-15", before="2025-01-16")
# Messages from the past week
search_project_history(query="refactoring", after="2025-01-25")
# Messages in January
search_project_history(query="database", after="2025-01-01", before="2025-02-01")
响应结构
{
"results": [
{
"matched_message": {
"role": "assistant",
"content": "To fix the authentication bug...",
"timestamp": "2025-01-15T10:30:00",
"workspace": "/Users/dev/myproject",
"session_id": "abc123",
"uuid": "msg-456",
"source": "cli"
},
"score": 0.8542,
"context": [
{"role": "user", "content": "How do I fix this auth bug?", "timestamp": "...", "is_match": false},
{"role": "assistant", "content": "To fix the authentication bug...", "timestamp": "...", "is_match": true}
]
}
],
"query": "authentication bug fix",
"total_matches": 25,
"offset": 0,
"has_more": true,
"hint": "Showing 1-10 of 25 matches. Use offset: 10 for more."
}
用法示例
自然地问:
"How did we fix that auth bug?"
"What did we discuss about the database schema?"
"What's my usual approach to error handling?"
"Find our React component discussions from last week"
或者直接使用工具:
search_project_history(query="authentication bug fix")
search_global_history(query="React component patterns")
search_cli_history(query="deployment", after="2025-01-01")
配置
创建 ~/.config/kiro-total-recall/config.toml 自定义:
[sources.cli]
enabled = true
paths = [
"~/Library/Application Support/kiro-cli/data.sqlite3",
"~/.local/share/kiro-cli/data.sqlite3",
"~/AppData/Roaming/kiro-cli/data.sqlite3",
]
[sources.ide]
enabled = true
patterns = [
"~/Library/Application Support/Kiro/User/globalStorage/kiro.kiroagent/*/*.chat",
"~/.config/Kiro/User/globalStorage/kiro.kiroagent/*/*.chat",
"~/AppData/Roaming/Kiro/User/globalStorage/kiro.kiroagent/*/*.chat",
]
[embedding]
model = "all-MiniLM-L6-v2"
cache_dir = "~/.cache/kiro-total-recall"
[search]
default_threshold = 0.2
default_max_results = 10
default_context_window = 3
[memory]
fraction = 0.33 # Use 1/3 of RAM
# limit_mb = 512 # Or set explicit limit
内存管理
内存索引大小的总召回限制,以防止内存过度使用。默认情况下,它使用1/3的物理RAM。当达到限制时,最旧的会话将被排除在索引之外(最新的会话将保留)。
| 变量 | 描述 | 默认值 |
|---|---|---|
KIRO_RECALL_MEMORY_LIMIT_MB |
覆盖内存限制(MB) | 1/3 RAM |
KIRO_RECALL_NO_MEMORY_LIMIT |
设置为任何值以禁用限制 | - |
测试
# Test server starts
uvx kiro-total-recall
# Ctrl+C to exit
# Test search directly
uv run python -c "
from kiro_total_recall.query import search_conversations
result = search_conversations(query='bug fix', max_results=3)
print(f'Found {result.total_matches} matches')
"
项目结构
kiro-total-recall/
├── POWER.md # Kiro Power manifest + steering
├── mcp.json # MCP server config for Power
├── config.default.toml # Default configuration
├── src/kiro_total_recall/
│ ├── server.py # FastMCP server, tool definitions
│ ├── query.py # Search engine, deduplication
│ ├── indexer.py # Embedding, caching, fingerprinting
│ ├── loader.py # Unified loader (CLI + IDE)
│ ├── cli_loader.py # SQLite parsing for CLI
│ ├── ide_loader.py # JSON parsing for IDE .chat files
│ ├── config.py # Configuration management
│ └── models.py # Pydantic data models
├── pyproject.toml
└── LICENSE
技术细节
| 组件 | 技术 |
|---|---|
| 嵌入模型 | 全迷你LM-L6-v2 (384个维度) |
| 矢量搜索 | 通过NumPy点积进行余弦相似度 |
| 缓存格式 | 带文件锁定的Python pickle |
| MCP框架 | 快速MCP |
| 包管理器 | 紫外线 |