memory-search
Skill này làm gì
Skill này cho phép agent chạy các truy vấn cơ sở dữ liệu chỉ đọc trên lịch sử phiên lập trình đã lưu. Skill dành cho người muốn tìm các mẫu trong công việc cũ mà tìm kiếm văn bản thông thường không thể hiển thị.
Khi nào nên dùng
- ✓Khi bạn muốn đếm số lần một công cụ hoặc lệnh bị lỗi qua các phiên.
- ✓Khi bạn cần tìm một lệnh hoặc quyết định cụ thể trong quá khứ.
- ✓Khi bạn muốn toàn bộ chuỗi hành động trong một phiên.
Liên kết skill
https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/memory-search/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn tìm xem công cụ nào thất bại nhiều nhất trong các phiên lập trình trước đây của mình.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent mở cơ sở dữ liệu phiên ở chế độ chỉ đọc và chạy các truy vấn SQL trên các bảng. Nó dùng kết quả để trả lời câu hỏi của bạn và không bao giờ thay đổi dữ liệu.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Nó có thay đổi dữ liệu phiên của tôi không?
Không. Skill nói dùng truy cập chỉ đọc hoặc chỉ truy vấn SELECT.
Khi nào nó tốt hơn tìm kiếm bộ nhớ thông thường?
Nó dành cho việc đếm, lọc theo công cụ hoặc trạng thái, và so sánh các phiên, điều mà tìm kiếm văn bản làm không tốt.
Cơ sở dữ liệu nằm ở đâu?
Skill cho một vị trí thông thường, và lưu ý rằng một biến môi trường có thể trỏ đến đường dẫn khác.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 14k
- Vị trí xếp hạng
- #11332
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
effect
14kGiúp agent của bạn trả lời câu hỏi về framework TypeScript Effect bằng cách kiểm tra mã nguồn và tài liệu, thay vì dựa vào trí nhớ.
arxiv
14kGiúp agent của bạn tìm, đọc, trích dẫn và theo dõi các bài báo học thuật trên arXiv, gồm tóm tắt, trích dẫn BibTeX, tải PDF và liên kết trích dẫn.
claude-code
14kGiúp agent của bạn giao một tác vụ lập trình cho công cụ dòng lệnh Claude Code, dưới dạng chạy một lần, phiên tương tác hoặc tác vụ nền.
codex
14kGiúp agent của bạn chạy công cụ dòng lệnh OpenAI Codex mà không cần cửa sổ chat, cho tác vụ lập trình, tập lệnh và quy trình tự động.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.