/darwin:memory-searchfrom darwin
Query the raw trajectory SQLite database directly when the built-in darwin_memory and darwin_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.
Ships in darwin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Direct SQL access to darwin's trajectory database for structured analysis that the darwin_memory (BM25 over curated markdown) and darwin_history (FTS over raw messages) tools cannot perform — aggregation, filtering by tool/status/time, cross-session pattern detection, and execution chain inspection.
darwin_memory and darwin_history tools returned nothing useful despite multiple query attempts.# Typically at this path. DARWIN_DB env var overrides if set.
sqlite3 -readonly ~/.local/share/darwin/darwin.db ".tables"
Always use -readonly or only SELECT queries — never modify the database.
| 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.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 (no output field; 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 boundaryagent_id = 'main' = main agent; other values = subagent (e.g. "explore-1", "general-1").$.state.output only exists when $.state.status = "completed". Failures store the message in $.state.error.time_created is Unix milliseconds.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 7 days):
SELECT substr(json_extract(p.data, '$.state.output'), 1, 200) as error_output,
COUNT(*) as occurrences,
GROUP_CONCAT(DISTINCT m.session_id) as sessions
FROM part p
JOIN message m ON m.id = p.message_id AND m.session_id = p.session_id
WHERE json_extract(p.data, '$.type') = 'tool'
AND json_extract(p.data, '$.tool') = 'bash'
AND json_extract(p.data, '$.state.status') = 'completed'
AND json_extract(p.data, '$.state.output') LIKE '%error%'
AND m.time_created > (strftime('%s', 'now') - 7*86400) * 1000
GROUP BY substr(json_extract(p.data, '$.state.output'), 1, 200)
HAVING occurrences > 1
ORDER BY occurrences DESC
LIMIT 10;
Find actual tool failures (any tool, last 7 days):
SELECT json_extract(p.data, '$.tool') as tool,
substr(json_extract(p.data, '$.state.error'), 1, 200) as error_msg,
COUNT(*) as occurrences,
GROUP_CONCAT(DISTINCT m.session_id) as sessions
FROM part p
JOIN message m ON m.id = p.message_id AND m.session_id = p.session_id
WHERE json_extract(p.data, '$.type') = 'tool'
AND json_extract(p.data, '$.state.status') = 'error'
AND m.time_created > (strftime('%s', 'now') - 7*86400) * 1000
GROUP BY json_extract(p.data, '$.tool'), substr(json_extract(p.data, '$.state.error'), 1, 200)
HAVING occurrences > 1
ORDER BY occurrences DESC
LIMIT 10;
| Goal | Strategy |
|---|---|
| Find a user's stated rule/preference | Search user text parts for '%always%', '%never%', '%remember%', '%rule%' |
| Find a design decision | Search '%decided%', '%tradeoff%', '%reason%' in user text |
| Find a specific file path or command | LIKE match on tool output/error |
| Find repeated workflows | Group tool call sequences by session, look for recurring tool×N patterns |
| Verify a memory claim | Find the session_id from the memory entry [ses_xxx], then query its full execution chain |
| Count tool usage | GROUP BY json_extract(p.data, '$.tool') with COUNT |
sqlite3 -readonly or SELECT only.session_id or time_created range.json_extract() for structured field access.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
9 skills in this plugin
/compose-askUse whenever you need a decision, clarification, or approval from the user — covers how to ask the user (one question at a time), and how to resolve the decision yourself when no user is available (unattended run, or a [Never-Ask] response)/compose-nextUse for multi-step feature work, bug fixes, or refactors where requirements need to settle, a feature document should carry design + tasks + delivery evidence, and the change deserves independent review before merge. Use it only when the user explicitly requests this workflow, whether with `/compose-next`, by name, or in any other clear natural language; do not infer the request from task complexity alone. Not for one-shot edits, single-file tweaks, or answering questions — those need no orchestration overhead./npx claudepluginhub alliecatowo/claude-code-darwin --plugin darwin