alexknowshtml/kuato
Built for Claude Code but works in any agent that supports skills, easily recall what you discussed with your favorite coding agents, what decisions you made, and where you left off so you can pick up where you left off as easily as asking "where did we leave off on XYZ..."
Deep Analysis
Claude Code会话记忆检索技能,支持文件和PostgreSQL双引擎全文搜索恢复上下文
Core Features
会话历史检索
按主题、工具、文件模式检索历史会话
双引擎搜索
文件模式零配置,PostgreSQL模式加速查询
智能排序
基于关键词匹配数量和权重值排序
API服务
PostgreSQL模式提供REST API供外部集成
Technical Implementation
从Claude Code JSONL文件读取会话元数据
提取用户消息、工具列表、文件路径
PostgreSQL使用tsvector词干提取
使用tsquery语言感知匹配
按ts_rank权重排序
- 文件模式零配置,即插即用快速检索
- PostgreSQL模式100ms查询时间
- 语言感知搜索支持词干提取
- API服务支持定时同步和跨应用集成
- 接续前次对话快速找到相关会话
- 主题回溯搜索特定功能开发记录
- 工具追踪查找使用特定工具的会话
- 文件模式检索涉及特定目录的会话
- 只能检索会话元数据,无完整内容存储
- PostgreSQL模式需额外配置
Kuato
Easily recall what you discussed with your favorite coding agents, what decisions you made, and where you left off so you can pick up where you left off as easily as asking "where did we leave off on XYZ..."
This simple, fully local session recall skill works on Claude Code & other coding agents that support skills. Instant use with text search, optional local postgres with faster and more accurate search on larger session histories.
The Problem
Claude Code forgets everything between sessions. You're deep in a feature, close the tab, and the next day ask "where were we?" only to get a blank stare.
Kuato: What do you want, Mr. Quaid?
Quaid: The same as you; to remember.
Kuato: But why?
Quaid: To be myself again.
Kuato: You are what you do. A man is defined by his actions, not his memory.
Kuato gives Claude access to what you did - the actions that define your work.
Two Versions
| Feature | File-Based | PostgreSQL |
|---|---|---|
| Setup time | 0 minutes | 5 minutes |
| Dependencies | Bun only | Bun + Postgres |
| Search speed | ~1-5 seconds | <100ms |
| Full-text search | Basic matching | Weighted, ranked |
| Fuzzy matching | No | Yes (trigram) |
| API server | No | Yes |
| Token tracking | Yes | Yes + per-model |
| Best for | Quick lookups | Daily use |
Start with file-based. Upgrade to PostgreSQL when you're running 10+ sessions a day and want faster, smarter search.
Quick Start: File-Based
Zero setup. Works directly with Claude Code's JSONL files.
# Clone the repo
git clone https://github.com/alexknowshtml/kuato.git
cd kuato
# Search your sessions
bun run file-based/search.ts --query "email system" --days 7
# Filter by tools used
bun run file-based/search.ts --tools Edit,Bash --limit 10
# Filter by file patterns
bun run file-based/search.ts --file-pattern "components/"
Output is JSON with all session metadata:
[
{
"id": "abc123-def456",
"startedAt": "2025-01-15T10:30:00Z",
"endedAt": "2025-01-15T11:45:00Z",
"messageCount": 42,
"toolsUsed": ["Edit", "Bash", "Read"],
"filesFromToolCalls": ["src/api/email.ts", "src/utils/filter.ts"],
"userMessages": [
"Let's build an email filtering system",
"Yes, use that approach",
"Commit this and we'll continue tomorrow"
],
"relevance": 23
}
]
Quick Start: PostgreSQL
One-command database setup, then sync and search.
cd kuato/postgres
# Start PostgreSQL (creates database + schema)
bun run db:up
# Install dependencies
bun install
# Sync your sessions
DATABASE_URL="postgres://claude:sessions@localhost:5433/claude_sessions" bun run sync
# Start API server
DATABASE_URL="postgres://claude:sessions@localhost:5433/claude_sessions" bun run serve
Then query the API:
# Search
curl "http://localhost:3847/sessions?search=email+filtering&days=7"
# Get single session
curl "http://localhost:3847/sessions/abc123-def456"
# With full transcript
curl "http://localhost:3847/sessions/abc123-def456?with_transcript=true"
# Statistics
curl "http://localhost:3847/sessions/stats?days=30"
Using with Claude Code
The real power is teaching Claude how to search your history. Create a skill file:
# Session Search
When the user asks "where did we leave off" or "what did we discuss about X":
1. Search sessions:
curl "http://localhost:3847/sessions?search=TOPIC&days=14"
2. The results include `user_messages` - these tell the whole story
(requests, confirmations, decisions)
3. Summarize what happened and offer to continue
See shared/claude-skill.md for a complete skill template.
How It Works
The Key Insight: User Messages
You don't need the full transcript to understand what happened. User messages are the signal:
- "Let's build an email filtering system" → Request
- "Yes, use that approach" → Decision
- "Actually, make it async" → Correction
- "Commit this" → Completion
Combined with files_touched and tools_used, you can reconstruct the session without loading 50k tokens.
File-Based Search
Simple substring matching on user messages, tools, and file paths.
Query: "septa"
↓
Scan each JSONL file
↓
Check if "septa" appears in:
- userMessages[]
- toolsUsed[]
- filesFromToolCalls[]
↓
Score by match count
↓
Return sorted results
Pros: Zero setup, no dependencies beyond Bun
Cons: Slower on large histories, no stemming ("running" won't match "run")
PostgreSQL Search
Full-text search with linguistic processing using tsvector and tsquery.
Step 1: Text becomes tokens (tsvector)
SELECT to_tsvector('english', 'The quick brown foxes are jumping');
-- Result: 'brown':3 'fox':4 'jump':5 'quick':2
Notice:
- Stop words removed: "The", "are" → gone
- Stemming: "foxes" →
fox, "jumping" →jump - Positions tracked:
fox:4means 4th significant word
Step 2: Queries match stems
-- All of these match "The quick brown fox":
SELECT to_tsvector('english', 'The quick brown fox')
@@ to_tsquery('english', 'foxes'); -- true (stems to fox)
@@ to_tsquery('english', 'quick & brown'); -- true (AND)
@@ to_tsquery('english', 'quick | cat'); -- true (OR)
Step 3: Weights rank importance
Sessions are indexed with weighted fields:
| Weight | Field | Priority |
|---|---|---|
| A | summary |
Highest (future use) |
| B | search_text |
User messages |
| C | tools_used, files_touched |
Tools and paths |
| D | cwd |
Working directory |
-- "holiday" in user messages (B) ranks higher than in file path (C)
SELECT ts_rank(search_vector, to_tsquery('holiday')) FROM sessions;
Step 4: GIN index makes it fast
CREATE INDEX idx_sessions_search_vector ON sessions USING GIN(search_vector);
GIN (Generalized Inverted Index) is like a book index:
- Without index: scan every row → O(n)
- With GIN: lookup "holiday" → [session1, session5, session12] → O(log n)
Step 5: File paths are tokenized
Raw paths like /Users/alex/septa-holiday-bus/App.jsx become searchable tokens:
-- We transform: '/path/to/septa-holiday/' → 'path to septa holiday'
regexp_replace(path, '[/\-_.]', ' ', 'g')
So searching "septa" finds sessions that touched files in septa-* directories.
Speed comparison:
- File-based: ~150ms (substring scan)
- PostgreSQL: ~30ms (index lookup)
The gap grows with session count. At 1000+ sessions, PostgreSQL is 10-50x faster.
API Reference (PostgreSQL)
GET /sessions
Search sessions with filters.
| Param | Description |
|---|---|
search |
Full-text search (weighted: summary > messages > tools) |
days |
Last N days only |
since |
Sessions after date (YYYY-MM-DD) |
until |
Sessions before date |
tools |
Filter by tool names (comma-separated) |
file_pattern |
Filter by file path pattern |
limit |
Max results (default 20, max 100) |
GET /sessions/:id
Get single session. Add ?with_transcript=true for full messages.
GET /sessions/stats
Usage statistics. Add ?days=30 to customize window.
Returns: session count, token totals, breakdown by model.
Environment Variables
| Variable | Default | Description |
|---|---|---|
CLAUDE_SESSIONS_DIR |
~/.claude/projects |
Where Claude Code stores sessions |
DATABASE_URL |
postgres://localhost/claude_sessions |
PostgreSQL connection |
PORT |
3847 |
API server port |
Tips
Scheduled Sync
Run sync every 15 minutes to keep the database current:
# crontab -e
*/15 * * * * cd /path/to/kuato/postgres && DATABASE_URL="..." bun run sync >> /var/log/kuato-sync.log 2>&1
Search Strategies
By topic:
curl "http://localhost:3847/sessions?search=authentication"
By file:
curl "http://localhost:3847/sessions?file_pattern=src/auth"
Recent activity:
curl "http://localhost:3847/sessions?days=3&limit=50"
Combined:
curl "http://localhost:3847/sessions?search=refactor&tools=Edit&days=7"
Contributing
Issues and PRs welcome. This started as a personal tool - feedback on what's useful appreciated.
License
MIT
Related Skills
wshobson/agents
wshobsonIntelligent automation and multi-agent orchestration for Claude Code
The most comprehensive Claude Code plugin ecosystem, covering full-stack development scenarios with a three-tier model strategy balancing performance and cost.
ComposioHQ/awesome-claude-skills
ComposioHQA curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows
The most comprehensive Claude Skills resource list; connect-apps is a killer feature.
code-yeongyu/oh-my-opencode
code-yeongyuThe Best Agent Harness. Meet Sisyphus: The Batteries-Included Agent that codes like you.
Powerful multi-agent coding tool, but note OAuth limitations.
nextlevelbuilder/ui-ux-pro-max-skill
nextlevelbuilderAn AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
Essential for designers; comprehensive UI/UX knowledge base.
thedotmack/claude-mem
thedotmackA Claude Code plugin that automatically captures everything Claude does during your coding sessions, compresses it with AI (using Claude's agent-sdk), and injects relevant context back into future sessions.
A practical solution for Claude's memory issues.
OthmanAdi/planning-with-files
OthmanAdiClaude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.
Context engineering best practices; an open-source implementation of Manus mode.

