You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/pi-session-recall/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ pi install npm:@henryqw/pi-session-recall
27
27
28
28
**Browse** — recent sessions: path, name, cwd, started date, preview.
29
29
30
-
Query syntax: FTS5 over a trigram index — multi-word = AND by default, `OR` for breadth, quoted phrases for exact match, `NOT` to exclude. Wildcards only help stems ≥3 chars. Only user/assistant text is indexed; thinking blocks and tool output are not searchable. For message text over the 20,000-character indexing budget, only first/last regions are indexed and the middle is omitted; phrases and `NEAR` cannot cross those regions, but ordinary AND terms can. `sessionId` must be a `.jsonl` file under the Pi sessions directory.
30
+
Query syntax: Prefer distinctive identifiers, package names, issue numbers, or uncommon terms; use quoted phrases only when exact wording is known. FTS5 over a trigram index — multi-word = AND by default, `OR` for breadth, quoted phrases for exact match, `NOT` to exclude. Wildcards only help stems ≥3 chars. Only user/assistant text is indexed; thinking blocks and tool output are not searchable. For message text over the 20,000-character indexing budget, only first/last regions are indexed and the middle is omitted; phrases and `NEAR` cannot cross those regions, but ordinary AND terms can. `sessionId` must be a `.jsonl` file under the Pi sessions directory.
31
31
32
32
Hits inside the current session's live context are suppressed; compacted-away or inactive-branch history stays discoverable. Forked sessions collapse into their parent when both match.
Copy file name to clipboardExpand all lines: packages/pi-session-recall/extensions/session-recall.ts
+5-23Lines changed: 5 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -85,30 +85,12 @@ interface ToolParams {
85
85
detail?: "adaptive"|"full";
86
86
}
87
87
88
-
constDESCRIPTION=`Search past Pi sessions stored on disk (FTS5-backed over a local SQLite index), or inspect one session in detail. No LLM calls — every shape returns actual messages.
88
+
constDESCRIPTION=`Search past Pi sessions locally with FTS5; returns stored messages.
89
89
90
-
FOUR CALLING SHAPES
91
-
92
-
1) DISCOVERY — pass \`query\`:
93
-
session_search(query="auth refactor", limit=3)
94
-
Runs FTS5 search and returns the top N sessions with metadata, match snippet, and messages around each match. Adaptive detail (default): the top-ranked result carries a ±5 message window plus first/last bookend messages; lower-ranked results carry only the anchor message. Pass \`detail="full"\` to hydrate every result fully.
Returns ±window messages centered on the anchor (clamped to [1,20]). Use after discovery when you need more context than the default ±5 window. To scroll forward/backward, pass the last/first message entryId of the previous window back as aroundMessageId; messagesBefore/messagesAfter tell you where you are. Across forks, re-anchoring on a shared ancestor can jump branches — pass the previous response's branchTip as the branchTip argument (aroundMessageId only moves the center) to stay on that branch.
99
-
100
-
3) READ — pass \`sessionId\` only:
101
-
session_search(sessionId="...")
102
-
Returns the session's active branch (first 20 + last 10 messages when large).
103
-
104
-
4) BROWSE — no args:
105
-
session_search()
106
-
Returns recent sessions: name, cwd, start time, first-user-message preview. Use when asked "what was I working on" without a topic.
107
-
108
-
Mode is inferred from args; precedence: scroll > read > browse > discovery.
109
-
110
-
FTS5 SYNTAX
111
-
AND is the default — multi-word queries require all terms. Use OR for broader recall (\`alpha OR beta\`), quoted phrases for exact match (\`"docker networking"\`), NOT to exclude (\`python NOT java\`). Wildcards work only as stem expansion of tokens ≥3 chars (trigram tokenizer); very short terms fall back to substring matching. The index covers user/assistant message text only — thinking, tool calls/results are not searchable.`;
90
+
- \`query\`: discover matches. Prefer distinctive identifiers or uncommon terms; multi-word queries are AND. Use \`OR\`/\`NOT\` for Boolean queries and quotes only when exact wording is known.
91
+
- \`sessionId\` + \`aroundMessageId\`: scroll ±\`window\`; retain \`branchTip\` across forks.
92
+
- \`sessionId\` alone: read; no args: browse recent sessions.
93
+
- Discovery is adaptive; use \`detail: "full"\` to hydrate every result.`;
112
94
113
95
exportdefaultfunction(pi: ExtensionAPI): void{
114
96
// Best-effort sync at startup, deferred so the synchronous walk + SQLite
0 commit comments