/recall: session memory engine skill
Find prior Claude Code and Codex sessions with an indexed local search engine, then continue the work, repeat it with fresh inputs, or distill it into a skill.
by Parcha-ai·MIT license·GitHub ↗
★ 62 Stars on the repo·Checked
npx degit Parcha-ai/parcha-skills/recall/skills/recall#main ~/.claude/skills/recallFiles of /recall: session memory engine
Files 1 file
Show the full text217 lines
/recall: session memory engine
Claude Code and Codex sessions on this machine are indexed into a local SQLite engine. Query the index and read only the best-supported session instead of searching entire transcripts. All commands go through one CLI:
python3 scripts/recall.py <command> # relative to this skill directory
If Recall MCP tools are available in the current agent, immediately
read references/central-brain.md
before running commands and use those tools directly. Do not run the local CLI
as a parallel or fallback retrieval path. The same central instructions apply
when RECALL_URL is set, RECALL_MODE is remote or shadow, or
~/.config/recall-brain/client.json exists. Otherwise everything below is fully local and nothing
touches a network.
No index yet? Search anyway
If search reports the index does not exist (or doctor shows
db exists=False), search the raw JSONL transcripts immediately while the
first index builds:
rg -l -i "<terms>" ~/.claude/projects ~/.codex/sessions # candidate files
ls -t <hits> # newest first
rg -n -i -C3 "<terms>" <best-hit> # read the window
Choose terms and regular expressions based on the request. Exact identifiers
are stronger evidence than general prose. If rg is unavailable, use
grep -rl. Start the index in the background at the same time:
setsid nohup python3 scripts/recall.py index >/dev/null 2>&1 &
The first build over a large history can take many minutes; later runs are
incremental and fast. Tell the user when an answer came from a cold scan of the
raw transcripts. Once doctor shows a healthy db, switch to indexed search,
which ranks results, explains the WHY for each match, and matches identifiers
exactly.
First: pick the outcome
- Find / verify: answer "did we…", "which session…", "how did we…". Search, read the best hit's relevant window, answer with the session path as the receipt.
- Continue: resume in-progress work. This needs the session's tail plus its branch and worktree.
- Repeat: redo the same kind of task with fresh inputs. This needs the original driving prompts, verbatim.
- Skill-ify: turn the recipe into a reusable skill. This needs the steps that
worked, minus one-off data. Chain into the harness's skill creator when one
is installed; otherwise write the standard
SKILL.mdpackage directly.
Ask only if the outcome is genuinely ambiguous.
Search
python3 scripts/recall.py search "<what the user said>" [filters]
- Pass the user's phrasing plus any identifier you have. Identifiers (job UUIDs, PR numbers, pod names, error strings, filenames) are the strongest evidence and are matched exactly, including inside tool output.
- Apply filters as flags rather than approximating them in the query text:
ask flag "last 48h", "back in May" --since 2026-05-01 --until 2026-06-01(UTC; both bounds include the specified instant. To cover a full local day, use the NEXT day's date as--until; convert the user's local day first)"in the other worktree/checkout" --cwd <any-cwd-substring>"what did codex do" --harness codexbranch-scoped --branch <substring> - Output is ranked sessions with date, cwd, slot, branch, a matched snippet,
and
WHYit matched. Empty output means nothing cleared the evidence gate; it does not prove the work never happened. Retry once with a distinctive identifier or a wider window. If output is still empty, tell the user what you searched and that no supported match was found. --pathsprints bare file paths (for scripting);--limit Nwidens.
Read the best-supported hit
Check the WHY line on the top few results first. Matches on only generic words
are weak evidence. Prefer a result whose WHY includes an identifier, phrase,
or exact-entity match rather than selecting rank 1 automatically.
python3 scripts/recall.py show <path> --prompts # user prompts only
python3 scripts/recall.py show <path> --around 2026-07-03T14:20 # ±3-turn window; use the date printed in the search result
python3 scripts/recall.py show <path> --tail 30 # the session's final turns (for Continue)
Pass the session file path from the search output. Use show rather than
cat: sessions can reach 80 MB, and show parses and prints only the requested
content.
Related work (no query needed)
python3 scripts/recall.py related --cwd "$(pwd)" --branch "$(git branch --show-current)"
This returns sessions that share the project, branch, or touched files, ranked by overlap and recency. Use it at session start when the user references prior work without naming it.
Outcome playbooks
Find / verify: search → show --around the matched timestamp → answer
with evidence. This usually requires two commands.
Continue: search → show --tail 30 for the final state (last actions,
tool results, open errors) → check the session's branch/slot still exists
(git -C <cwd> branch --show-current) → summarize: "Found <session> in
<cwd> on <date>, last action <x>, branch <b>; resume there or here?"
Repeat: search → show --prompts → present the driving prompts verbatim
and confirm fresh inputs (dates, scope) before re-running.
Skill-ify: search → show the working window → separate the durable
recipe (commands, endpoints, auth patterns) from one-off data (specific IDs,
dates) → invoke the available skill creator with the recipe and a proposed
name, or create a standard Agent Skills directory when none is installed.
Export one exact session for another skill
Use the machine-readable session export when /recap or another evidence consumer needs complete,
ordered coverage rather than a human window:
python3 scripts/recall.py session-export --current --limit 1000
python3 scripts/recall.py session-export --target <exact-path-or-receipt> --limit 1000
python3 scripts/recall.py session-export --cursor <opaque-next-cursor> --limit 1000
Each JSON page contains stable evidence IDs, redacted text and digests, sanitized typed entities
(including native tool identity when observed), native session identity, projection/privacy
versions, a boundary receipt, a content-free page receipt, and complete plus next_cursor.
Consume pages in sequence and accept immutable-snapshot completeness only on the final page; inspect
source_snapshot_stable before claiming a live source did not advance. Cursors are stored
owner-private under ~/.recall and never encode transcript text or a path.
--current resolves Codex only through exact CODEX_THREAD_ID, and Claude through exact
CLAUDE_SESSION_ID when the harness exposes it. Otherwise it fails closed with content-free ranked
candidate receipts; pass the exact path found by Recall rather than guessing. Child and continuation
sessions are separate boundaries by default. A standalone local export stamps an explicit
local:<harness> source.
To resolve a local native relationship graph for Recap without reading transcript prose, use:
python3 scripts/recall.py session-relations --current --include-children
python3 scripts/recall.py session-relations --target <exact-path> --chain
python3 scripts/recall.py session-relations --target <exact-path> --chain --include-children
The closed recall.session-relations.v1 JSON uses Claude sessionId/agentId sidechain metadata
and Codex parent_thread_id/forked_from_id metadata. It excludes merely adjacent or similar
sessions and fails when a requested native link is missing or ambiguous. This command is
local-only.
Index health
python3 scripts/recall.py index # incremental; run if results look stale
python3 scripts/recall.py doctor # coverage, index age, retention watchdog
Never run index --rebuild without the user's explicit request; large session
histories can require gigabytes of temporary WAL and substantial CPU time.
doctor warning about cleanupPeriodDays means transcript retention got
re-enabled. Surface that to the user immediately because history is being
deleted.
Gotchas
- The engine indexes user text, assistant text, and tool input/output, but reasoning/thinking blocks are never stored, and secret-shaped lines are redacted at ingest. If the only trace of something was a thinking block, it is not findable.
- Codex sessions are one file per rollout under a date tree;
showhandles both schemas transparently. - Running Recall from pi is supported, but pi's own session format is not yet indexed. Do not claim that a cold result proves no pi session exists.
- A query about work that never happened can still return lexically-adjacent
sessions. The ranked
WHYline tells you what actually matched; read it before asserting the session answers the question. - Subagent and workflow transcripts are indexed as their own sessions and
live under the parent session's directory (
<session-uuid>/subagents/…); the path itself tells you which main session spawned them.
Upgrade: central Recall Brain (optional)
Recall can sync into a private central Brain service that provides deliberate
memory writes, cross-device search, consented ChatGPT-export import, a Cowork
collector, pull connectors, and MCP capture. The service is off unless
explicitly configured. Setup, mode routing, and all Brain commands are in
references/central-brain.md; doctor prints
the current mode.
References
- references/query-cookbook.md: worked examples per stratum: identifiers, error strings, time windows, cross-worktree, cross-harness, paraphrase.
- references/central-brain.md: optional central Brain upgrade: setup, modes, deliberate writes, connectors, privacy, export inbox, MCP capture.
| 1 | |
| 2 | name recall |
| 3 | description Find prior Claude Code and Codex sessions with an indexed local search engine, then continue the work, repeat it with fresh inputs, or distill it into a skill. Runs from Claude Code, Codex, or pi; the current index covers Claude Code and Codex transcripts. Use when the user names Recall, says "find that conversation where…", "what did we do last time about…", "continue what we did yesterday on X", "what did codex do on this branch", "turn what we did about Y into a skill", or "remember when you…". Not for searching code (use grep on the repo) or for facts already in MEMORY.md. |
| 4 | |
| 5 | |
| 6 | # /recall: session memory engine |
| 7 | |
| 8 | Claude Code and Codex sessions on this machine are indexed into a local |
| 9 | SQLite engine. Query the index and read only the best-supported session instead |
| 10 | of searching entire transcripts. All commands go through one CLI: |
| 11 | |
| 12 | |
| 13 | python3 scripts/recall.py <command> # relative to this skill directory |
| 14 | |
| 15 | |
| 16 | If Recall MCP tools are available in the current agent, immediately |
| 17 | read [references/central-brain.md] |
| 18 | before running commands and use those tools directly. Do not run the local CLI |
| 19 | as a parallel or fallback retrieval path. The same central instructions apply |
| 20 | when `RECALL_URL` is set, `RECALL_MODE` is `remote` or `shadow`, or |
| 21 | `~/.config/recall-brain/client.json` exists. Otherwise everything below is fully local and nothing |
| 22 | touches a network. |
| 23 | |
| 24 | ## No index yet? Search anyway |
| 25 | |
| 26 | If `search` reports the index does not exist (or `doctor` shows |
| 27 | `db exists=False`), search the raw JSONL transcripts immediately while the |
| 28 | first index builds: |
| 29 | |
| 30 | |
| 31 | rg -l -i "<terms>" ~/.claude/projects ~/.codex/sessions # candidate files |
| 32 | ls -t <hits> # newest first |
| 33 | rg -n -i -C3 "<terms>" <best-hit> # read the window |
| 34 | |
| 35 | |
| 36 | Choose terms and regular expressions based on the request. Exact identifiers |
| 37 | are stronger evidence than general prose. If `rg` is unavailable, use |
| 38 | `grep -rl`. Start the index in the background at the same time: |
| 39 | |
| 40 | |
| 41 | setsid nohup python3 scripts/recall.py index >/dev/null 2>&1 & |
| 42 | |
| 43 | |
| 44 | The first build over a large history can take many minutes; later runs are |
| 45 | incremental and fast. Tell the user when an answer came from a cold scan of the |
| 46 | raw transcripts. Once `doctor` shows a healthy db, switch to indexed `search`, |
| 47 | which ranks results, explains the `WHY` for each match, and matches identifiers |
| 48 | exactly. |
| 49 | |
| 50 | ## First: pick the outcome |
| 51 | |
| 52 | **Find / verify:** answer "did we…", "which session…", "how did we…". |
| 53 | Search, read the best hit's relevant window, answer with the session path |
| 54 | as the receipt. |
| 55 | **Continue:** resume in-progress work. This needs the session's tail plus its |
| 56 | branch and worktree. |
| 57 | **Repeat:** redo the same kind of task with fresh inputs. This needs the |
| 58 | original driving prompts, verbatim. |
| 59 | **Skill-ify:** turn the recipe into a reusable skill. This needs the steps that |
| 60 | worked, minus one-off data. Chain into the harness's skill creator when one |
| 61 | is installed; otherwise write the standard `SKILL.md` package directly. |
| 62 | |
| 63 | Ask only if the outcome is genuinely ambiguous. |
| 64 | |
| 65 | ## Search |
| 66 | |
| 67 | |
| 68 | python3 scripts/recall.py search "<what the user said>" [filters] |
| 69 | |
| 70 | |
| 71 | Pass the user's phrasing plus any identifier you have. Identifiers (job |
| 72 | UUIDs, PR numbers, pod names, error strings, filenames) are the strongest |
| 73 | evidence and are matched exactly, including inside tool output. |
| 74 | Apply filters as flags rather than approximating them in the query text: |
| 75 | | ask | flag | |
| 76 | |---|---| |
| 77 | | "last 48h", "back in May" | `--since 2026-05-01 --until 2026-06-01` (UTC; both bounds include the specified instant. To cover a full local day, use the NEXT day's date as `--until`; convert the user's local day first) | |
| 78 | | "in the other worktree/checkout" | `--cwd <any-cwd-substring>` | |
| 79 | | "what did codex do" | `--harness codex` | |
| 80 | | branch-scoped | `--branch <substring>` | |
| 81 | Output is ranked sessions with date, cwd, slot, branch, a matched snippet, |
| 82 | and `WHY` it matched. Empty output means nothing cleared the evidence gate; |
| 83 | it does not prove the work never happened. Retry once with a distinctive |
| 84 | identifier or a wider window. If output is still empty, tell the user what |
| 85 | you searched and that no supported match was found. |
| 86 | `--paths` prints bare file paths (for scripting); `--limit N` widens. |
| 87 | |
| 88 | ## Read the best-supported hit |
| 89 | |
| 90 | Check the `WHY` line on the top few results first. Matches on only generic words |
| 91 | are weak evidence. Prefer a result whose `WHY` includes an identifier, phrase, |
| 92 | or exact-entity match rather than selecting rank 1 automatically. |
| 93 | |
| 94 | |
| 95 | python3 scripts/recall.py show <path> --prompts # user prompts only |
| 96 | python3 scripts/recall.py show <path> --around 2026-07-03T14:20 # ±3-turn window; use the date printed in the search result |
| 97 | python3 scripts/recall.py show <path> --tail 30 # the session's final turns (for Continue) |
| 98 | |
| 99 | |
| 100 | Pass the session file path from the search output. Use `show` rather than |
| 101 | `cat`: sessions can reach 80 MB, and `show` parses and prints only the requested |
| 102 | content. |
| 103 | |
| 104 | ## Related work (no query needed) |
| 105 | |
| 106 | |
| 107 | python3 scripts/recall.py related --cwd "$(pwd)" --branch "$(git branch --show-current)" |
| 108 | |
| 109 | |
| 110 | This returns sessions that share the project, branch, or touched files, ranked |
| 111 | by overlap and recency. Use it at session start when the user references prior |
| 112 | work without naming it. |
| 113 | |
| 114 | ## Outcome playbooks |
| 115 | |
| 116 | **Find / verify:** search → `show --around` the matched timestamp → answer |
| 117 | with evidence. This usually requires two commands. |
| 118 | |
| 119 | **Continue:** search → `show --tail 30` for the final state (last actions, |
| 120 | tool results, open errors) → check the session's branch/slot still exists |
| 121 | (`git -C <cwd> branch --show-current`) → summarize: "Found `<session>` in |
| 122 | `<cwd>` on `<date>`, last action `<x>`, branch `<b>`; resume there or here?" |
| 123 | |
| 124 | **Repeat:** search → `show --prompts` → present the driving prompts verbatim |
| 125 | and confirm fresh inputs (dates, scope) before re-running. |
| 126 | |
| 127 | **Skill-ify:** search → `show` the working window → separate the durable |
| 128 | recipe (commands, endpoints, auth patterns) from one-off data (specific IDs, |
| 129 | dates) → invoke the available skill creator with the recipe and a proposed |
| 130 | name, or create a standard Agent Skills directory when none is installed. |
| 131 | |
| 132 | ## Export one exact session for another skill |
| 133 | |
| 134 | Use the machine-readable session export when `/recap` or another evidence consumer needs complete, |
| 135 | ordered coverage rather than a human window: |
| 136 | |
| 137 | |
| 138 | python3 scripts/recall.py session-export --current --limit 1000 |
| 139 | python3 scripts/recall.py session-export --target <exact-path-or-receipt> --limit 1000 |
| 140 | python3 scripts/recall.py session-export --cursor <opaque-next-cursor> --limit 1000 |
| 141 | |
| 142 | |
| 143 | Each JSON page contains stable evidence IDs, redacted text and digests, sanitized typed entities |
| 144 | (including native tool identity when observed), native session identity, projection/privacy |
| 145 | versions, a boundary receipt, a content-free page receipt, and `complete` plus `next_cursor`. |
| 146 | Consume pages in sequence and accept immutable-snapshot completeness only on the final page; inspect |
| 147 | `source_snapshot_stable` before claiming a live source did not advance. Cursors are stored |
| 148 | owner-private under `~/.recall` and never encode transcript text or a path. |
| 149 | |
| 150 | `--current` resolves Codex only through exact `CODEX_THREAD_ID`, and Claude through exact |
| 151 | `CLAUDE_SESSION_ID` when the harness exposes it. Otherwise it fails closed with content-free ranked |
| 152 | candidate receipts; pass the exact path found by Recall rather than guessing. Child and continuation |
| 153 | sessions are separate boundaries by default. A standalone local export stamps an explicit |
| 154 | `local:<harness>` source. |
| 155 | |
| 156 | To resolve a local native relationship graph for Recap without reading transcript prose, use: |
| 157 | |
| 158 | |
| 159 | python3 scripts/recall.py session-relations --current --include-children |
| 160 | python3 scripts/recall.py session-relations --target <exact-path> --chain |
| 161 | python3 scripts/recall.py session-relations --target <exact-path> --chain --include-children |
| 162 | |
| 163 | |
| 164 | The closed `recall.session-relations.v1` JSON uses Claude `sessionId`/`agentId` sidechain metadata |
| 165 | and Codex `parent_thread_id`/`forked_from_id` metadata. It excludes merely adjacent or similar |
| 166 | sessions and fails when a requested native link is missing or ambiguous. This command is |
| 167 | local-only. |
| 168 | |
| 169 | ## Index health |
| 170 | |
| 171 | |
| 172 | python3 scripts/recall.py index # incremental; run if results look stale |
| 173 | python3 scripts/recall.py doctor # coverage, index age, retention watchdog |
| 174 | |
| 175 | |
| 176 | Never run `index --rebuild` without the user's explicit request; large session |
| 177 | histories can require gigabytes of temporary WAL and substantial CPU time. |
| 178 | |
| 179 | `doctor` warning about `cleanupPeriodDays` means transcript retention got |
| 180 | re-enabled. Surface that to the user immediately because history is being |
| 181 | deleted. |
| 182 | |
| 183 | ## Gotchas |
| 184 | |
| 185 | The engine indexes user text, assistant text, and tool input/output, but |
| 186 | reasoning/thinking blocks are never stored, and secret-shaped lines are |
| 187 | redacted at ingest. If the only trace of something was a thinking block, it |
| 188 | is not findable. |
| 189 | Codex sessions are one file per rollout under a date tree; `show` handles |
| 190 | both schemas transparently. |
| 191 | Running Recall from pi is supported, but pi's own session format is not yet |
| 192 | indexed. Do not claim that a cold result proves no pi session exists. |
| 193 | A query about work that never happened can still return lexically-adjacent |
| 194 | sessions. The ranked `WHY` line tells you what actually matched; read it |
| 195 | before asserting the session answers the question. |
| 196 | Subagent and workflow transcripts are indexed as their own sessions and |
| 197 | live under the parent session's directory (`<session-uuid>/subagents/…`); |
| 198 | the path itself tells you which main session spawned them. |
| 199 | |
| 200 | ## Upgrade: central Recall Brain (optional) |
| 201 | |
| 202 | Recall can sync into a private central Brain service that provides deliberate |
| 203 | memory writes, cross-device search, consented ChatGPT-export import, a Cowork |
| 204 | collector, pull connectors, and MCP capture. The service is off unless |
| 205 | explicitly configured. Setup, mode routing, and all Brain commands are in |
| 206 | [references/central-brain.md]; `doctor` prints |
| 207 | the current mode. |
| 208 | |
| 209 | ## References |
| 210 | |
| 211 | [references/query-cookbook.md]: worked |
| 212 | examples per stratum: identifiers, error strings, time windows, |
| 213 | cross-worktree, cross-harness, paraphrase. |
| 214 | [references/central-brain.md]: optional |
| 215 | central Brain upgrade: setup, modes, deliberate writes, connectors, |
| 216 | privacy, export inbox, MCP capture. |
| 217 |
Discussion
Browse more free Claude skills or everything in Operations.