원클릭으로
qmd-sessions
Convert Claude Code session transcripts to searchable markdown files for qmd indexing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Convert Claude Code session transcripts to searchable markdown files for qmd indexing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | qmd-sessions |
| description | Convert Claude Code session transcripts to searchable markdown files for qmd indexing |
| disable-model-invocation | true |
| argument-hint | ["refresh"] |
| allowed-tools | Bash(node *), Bash(qmd *), Bash(npm *), Bash(which *), Bash(find *), Read, Edit |
If $ARGUMENTS is refresh, skip all setup steps. Run:
node ~/.claude/skills/qmd-sessions/refresh.js
Present the output as conversation context — this is the last 50 exchanges from the most recent session. Then stop. Do not proceed to any other steps.
Convert Claude Code JSONL session transcripts into clean, searchable markdown files.
~/.claude/projects/type: "text" content blocks)<system-reminder> tags from text content{project}/{date}-{slug}-{id}.md--session mode, always overwrites with latest content.lib.isEmbedRunning() (pgrep -f "qmd.*embed") before running embed — if another session's embed is already running, skip. The next embed will catch any pending hashes.lib.js: readConfig(), isEmbedRunning() (pgrep check), qmdAvailable() (which qmd), runUpdateAndEmbed() (update then pgrep-gated embed).Every single step must prompt the user and wait for explicit confirmation before proceeding. This includes:
The user should feel in control at all times.
Formatting rule: Confirmation questions (e.g., "Continue?") must always be on their own line, never appended to status text.
One exception: The hooks (hook.js, shared logic in lib.js) run automatically — there is no user to prompt at that point. This is by design. hook.js handles PreCompact and SessionEnd (converts sessions, updates claude-sessions index). None of these hooks delete files.
Check these in order:
Check ~/.claude/skills/qmd-sessions/config.json for a saved outputDir. If found, show it:
"Found saved output directory:
<path>. Use this path?"
If no config exists, ask the user where to save the converted sessions. Do not assume a default.
Once confirmed, check if the directory is already saved in ~/.claude/skills/qmd-sessions/config.json:
"Continue?"
First, count the session files, subagent files, and project directories to give the user a preview:
find ~/.claude/projects -maxdepth 2 -name '*.jsonl' -not -name '*compact*' | wc -l
find ~/.claude/projects -path '*/subagents/*.jsonl' -not -name '*compact*' | wc -l
ls -d ~/.claude/projects/*/ 2>/dev/null | wc -l
Then confirm:
"Found N session files and S subagent files across M project directories. Ready to convert to
<output-dir>. Proceed?"
Wait for confirmation, then run:
node ~/.claude/skills/qmd-sessions/convert-sessions.js <output-directory>
If the script exits with an error, show the full error output to the user and ask:
"The conversion script failed. Error shown above. How would you like to proceed?"
Do not retry automatically.
If successful, report the results clearly:
"Converted X sessions, Y continuations, Z subagents. Skipped N (already converted). Empty: M."
After conversion, show the user a summary:
Ask:
"Does this output look correct? Continue to setup checks?"
Check each of the following. For each item, tell the user what you found and what you'd like to do. Wait for confirmation before making changes AND before moving to the next check.
Important: Later steps depend on earlier ones. If a prerequisite is not met (Bun missing, qmd not working, collection not created), stop and report the error clearly. Do not silently skip steps. Tell the user what was completed, what failed, and what remains.
Check: which bun or ~/.bun/bin/bun --version
<path>."
"Continue to next check?"
curl -fsSL https://bun.sh/install | bash? This installs to ~/.bun/bin/bun." (Note: curl is not in the skill's pre-approved tools — the user will get a separate permission prompt from Claude Code for this command.)If Bun is not installed, stop and report: "Bun is required but not available. Cannot continue setup. Run the skill again after installing Bun."
First check the active Node version: node --version
ls ~/.nvm/versions/node/ | grep -E '^v2[2-9]'
v22.22.0):
"Your active Node is
<active-version>, but qmd requires Node ≥22. Node<available-version>is available via nvm." "Would you like to switch your nvm default to<available-version>? This runsnvm alias default <available-version>." If user approves, run:nvm alias default <available-version>Then tell the user: "Default Node switched to<available-version>. Please open a new terminal tab, runnvm use <available-version>, and re-run/qmd-sessionsto continue setup." Stop here.
"Your active Node is
<active-version>, but qmd requires Node ≥22. No Node ≥22 found via nvm." "Would you like to install it? This runsnvm install 22." If user approves, run:nvm install 22Then check the exact version installed:ls ~/.nvm/versions/node/ | grep -E '^v2[2-9]' | tail -1"Node<installed-version>installed. Would you like to set it as your nvm default? This runsnvm alias default <installed-version>." If user approves, run:nvm alias default <installed-version>Then tell the user: "Default Node switched to<installed-version>. Please open a new terminal tab, runnvm use <installed-version>, and re-run/qmd-sessionsto continue setup." Stop here.
Check: which qmd
qmd --version
<version> is installed at <path>."
"Continue to next check?"
<version> is installed but outdated. Install latest with npm install -g @tobilu/qmd?"<error message>. This usually means Bun isn't available."
"Continue to next check?"
npm install -g @tobilu/qmd? Note: requires Bun runtime."If qmd is not installed or not working, stop and report: "qmd is required but not available. Cannot continue setup. Completed: Steps 1-3, 4a-4b. Not completed: Steps 4c-4g."
Check: qmd collection list
claude-sessions already configured, pointing at <path>."
"Continue to next check?"
qmd collection add <output-directory> --name claude-sessions --mask "**/*.md"
qmd context add qmd://claude-sessions "Claude Code session transcripts — conversations, subagent research, architectural decisions"
"OK to proceed?"If no qmd collections were created, stop and report: "No collections to embed. Setup cannot continue."
First run qmd update to scan all collection files into the index:
"
qmd updatewill scan all collection files into the index. Thenqmd embedwill generate vector embeddings. On first embed, this downloads the embedding model (~300MB) to~/.cache/qmd/models/. Additional models (~640MB reranker, ~1.1GB query expansion) are downloaded later when you first useqmd query. First run can take up to 20 minutes. Runqmd update && qmd embednow?"
After embed completes successfully:
"Initial embed complete. The PreCompact and SessionEnd hooks will keep the index current as you use Claude Code." "Continue to next check?"
If qmd is not installed or not working, stop and report: "qmd is required but not available. Cannot continue setup."
Read ~/.claude.json and check for mcpServers.qmd.
~/.claude.json."
"Continue to next check?"
~/.claude.json:"
{ "mcpServers": { "qmd": { "command": "qmd", "args": ["mcp"], "type": "stdio" } } }
"This will be merged with your existing MCP servers. OK?"Read ~/.claude/settings.json and check for PreCompact and SessionEnd hooks that run hook.js.
Two hooks work together to keep the claude-sessions index current (all synchronous):
pgrep -f "qmd.*embed" and runs embed if none runningCheck each hook:
"Continue to next check?"
~/.claude/settings.json:"
{
"hooks": {
"PreCompact": [{ "hooks": [{ "type": "command", "command": "node ~/.claude/skills/qmd-sessions/hook.js" }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "node ~/.claude/skills/qmd-sessions/hook.js" }] }]
}
}
"This will be merged with your existing hooks. OK?"Read ~/.claude/CLAUDE.md and check for a "Session Search" section.
"Continue to next check?"
Ask: "Would you like to automatically load the last ~50 exchanges when starting a new session? This outputs recent conversation context to Claude on every fresh startup, similar to what /qmd-sessions refresh does manually."
Read ~/.claude/skills/qmd-sessions/config.json and check for a loadContextOnStartup key.
true: "loadContextOnStartup is already enabled in config.json. All setup checks complete.""loadContextOnStartup": true in config.json. "Enabled. All setup checks complete.""loadContextOnStartup": false in config.json. "Disabled. All setup checks complete."Wait for user acknowledgement before ending.
~/.claude/CLAUDE.md so Claude uses qmd for session search. This appends:"
## Session Search (qmd)
qmd is installed as an MCP server. Use qmd MCP tools for **session history search**. qmd returns ranked snippets, saving tokens vs reading whole files. If qmd returns 0 results, fall back to Grep/Glob.
### qmd MCP tools
- `mcp__qmd__deep_search` — best quality, auto-expands query variations, use by default
- `mcp__qmd__search` — keyword-only BM25 search (fast, exact terms)
- `mcp__qmd__get` — retrieve a full session document by path or docid
### Available collections
- `claude-sessions` — past Claude Code session transcripts (conversations, subagent research, architectural decisions)
### When to search (do this proactively, don't wait to be asked)
- At session start — search for prior work on the current task before diving in
- Before investigating a bug — check if it was discussed or fixed before
- Before proposing an architecture or approach — check what was tried previously
- After receiving a correction — search for whether this mistake pattern exists
- When the user references past work — "we discussed", "last time", "remember when"
### Query strategies
- **Date-based queries** ("what did we discuss today", "sessions from last week"): Use `mcp__qmd__multi_get` with a date glob pattern. BM25 tokenizes dates on hyphens, so `search("2026-03-03")` returns nothing. Instead: `multi_get(pattern: "project-name/2026-03-03*.md")`. This lists all sessions and subagents for that date. Then use `mcp__qmd__get` to read specific ones.
- **Content-based queries** ("that crawler bug", "billing discussion"): Use `mcp__qmd__deep_search` as normal.
- **Known session lookup**: Use `mcp__qmd__get` with the file path or docid.
"OK to append?"