memory-search
できること
このスキルは、保存されたコーディングのセッション履歴に対して、読み取り専用のデータベースのクエリを実行できるようにします。通常のテキスト検索では見えない、過去の作業のパターンを見つけたい人向けです。
使う場面
- ✓セッションをまたいで、あるツールやコマンドが何回失敗したかを数えたいとき。
- ✓過去の特定のコマンドや判断を探したいとき。
- ✓一つのセッションの中の、操作の全体の流れを見たいとき。
スキルのリンク
https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/memory-search/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“過去のコーディングのセッションで、どのツールが最も多く失敗したかを見つけてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、読み取り専用のモードでセッションのデータベースを開き、そのテーブルに対してSQLのクエリを実行します。結果を使って質問に答え、データは決して変更しません。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Memory Search: SQLite Trajectory Database
Direct SQL access to mimocode's trajectory database for structured analysis that the memory (BM25 over curated markdown) and history (FTS over raw messages) tools cannot perform — aggregation, filtering by tool/status/time, cross-session pattern detection, and execution chain inspection.
When to use
- You need to aggregate or count across sessions (e.g. "which tool fails most often?", "how many sessions touched file X?").
- You need to filter by structure — tool name, status, agent_id, time range — not just text content.
- You need to view a complete execution chain for a session (every tool call in order).
- You need to verify a memory claim against what actually happened (the DB is the source of truth).
- The
memoryandhistorytools returned nothing useful despite multiple query attempts.
Locating the database
# Typically at this path. MIMOCODE_DB env var overrides if set.
sqlite3 -readonly ~/.local/share/mimocode/mimocode.db ".tables"
Always use -readonly or only SELECT queries — never modify the database.
Schema
| Table | Purpose | Key columns |
|---|---|---|
session |
Session metadata | id, project_id, title, time_created, parent_id |
message |
User/assistant turns | id, session_id, agent_id, time_created, data (JSON: $.role) |
part |
Message parts (text, tool calls, steps) | id, message_id, session_id, time_created, data (JSON) |
task |
Task tree | id, session_id, summary, status |
task_event |
Task state transitions | id, session_id, task_id, at, kind, summary |
actor_registry |
Subagent/peer history | session_id, actor_id, agent, mode, status, description |
Part types in part.data
{"type":"text","text":"..."}— agent text output{"type":"tool","tool":"<name>","callID":"...","state":{"status":"completed","input":{...},"output":"..."}}— completed tool call{"type":"tool","tool":"<name>","callID":"...","state":{"status":"error","input":{...},"error":"..."}}— failed tool call (nooutputfield; error message in$.state.error){"type":"step-start"}/{"type":"step-finish","tokens":...}— step boundaries{"type":"compaction","auto":true/false}— compaction boundary{"type":"checkpoint",...}— checkpoint/rebuild boundary
Key conventions
agent_id = 'main'= main agent; other values = subagent (e.g."explore-1","general-1").$.state.outputonly exists when$.state.status = "completed". Failures store the message in$.state.error.time_createdis Unix milliseconds.
Query templates
List recent sessions for this project:
SELECT id, title, time_created,
datetime(time_created/1000, 'unixepoch', 'localtime') as created
FROM session
WHERE project_id = '<PROJECT_ID>'
AND parent_id IS NULL
ORDER BY time_created DESC
LIMIT 20;
Find user messages containing a keyword:
SELECT m.session_id, m.id,
substr(json_extract(p.data, '$.text'), 1, 200) as preview
FROM message m
JOIN part p ON p.message_id = m.id AND p.session_id = m.session_id
WHERE json_extract(m.data, '$.role') = 'user'
AND json_extract(p.data, '$.type') = 'text'
AND json_extract(p.data, '$.text') LIKE '%keyword%'
ORDER BY m.time_created DESC
LIMIT 10;
Find tool calls by tool name:
SELECT m.session_id, m.id, m.agent_id,
json_extract(p.data, '$.tool') as tool,
json_extract(p.data, '$.state.status') as status,
substr(COALESCE(json_extract(p.data, '$.state.output'), json_extract(p.data, '$.state.error')), 1, 300) as result_preview
FROM message m
JOIN part p ON p.message_id = m.id AND p.session_id = m.session_id
WHERE json_extract(m.data, '$.role') = 'assistant'
AND json_extract(p.data, '$.type') = 'tool'
AND json_extract(p.data, '$.tool') = '<TOOL_NAME>'
AND m.session_id = '<SESSION_ID>'
ORDER BY m.time_created DESC
LIMIT 20;
View a session's full execution chain:
SELECT m.id, m.agent_id,
json_extract(p.data, '$.type') as part_type,
json_extract(p.data, '$.tool') as tool,
substr(p.data, 1, 800) as preview
FROM message m
JOIN part p ON p.message_id = m.id AND p.session_id = m.session_id
WHERE m.session_id = '<SESSION_ID>'
AND json_extract(m.data, '$.role') = 'assistant'
ORDER BY m.time_created, p.time_created;
**Find repeated stdout errors (completed bash calls, last
よくある質問
セッションのデータを変更できますか?
いいえ。このスキルは、読み取り専用のアクセスか、SELECTのクエリだけを使うよう求めています。
通常のメモリ検索と比べていつ役立ちますか?
数えたり、ツールや状態で絞り込んだり、セッションを比べたりするときです。テキスト検索ではこれらがうまくできません。
データベースはどこにありますか?
典型的な場所を示しています。環境変数を使って、別のパスを指定することもできると述べています。
詳細
作者による元の説明
Query the raw trajectory SQLite database directly when the built-in memory and history tools are insufficient. Use when you need structured analysis across sessions: finding repeated errors, grouping tool calls by pattern, verifying what was actually executed, or locating specific past commands/decisions that text search cannot surface. Provides the database schema, ready-to-use SQL query templates, and per-goal strategies.
repo: XiaomiMiMo/MiMo-Code
人気
- GitHubのスター
- 14k
- ランキング
- #11332
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
effect
14kエージェントが、Effect TypeScriptフレームワークに関する質問に、記憶に頼らず、ソースコードとドキュメントを確認して答えられるよう支援します。
arxiv
14kエージェントが、arXivの学術論文を検索、閲覧、引用、追跡できるよう支援します。要約、BibTeXの引用、PDFのダウンロード、引用リンクを扱います。
claude-code
14kエージェントが、Claude Codeのコマンドラインツールにコーディング作業を任せられるよう支援します。一回だけの実行、対話セッション、バックグラウンドのジョブのいずれにも対応します。
codex
14kエージェントが、チャット画面なしでOpenAI Codexのコマンドラインツールを実行できるよう支援します。コーディングの作業、スクリプト、自動化されたパイプラインに使えます。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。