@hcflabs/pi-session-recall 0.0.0-stage → 5.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +146 -2
- package/docs/session-search-routing.html +138 -0
- package/docs/session-search-routing.svg +121 -0
- package/extensions/hydrate.ts +258 -0
- package/extensions/query.ts +379 -0
- package/extensions/repository-inventory.ts +499 -0
- package/extensions/search-core.ts +724 -0
- package/extensions/session-recall.ts +556 -0
- package/extensions/transcript.ts +112 -0
- package/extensions/types.ts +53 -0
- package/package.json +60 -4
- package/skills/pi-session-pattern-miner/SKILL.md +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Henry Wang
|
|
4
|
+
Copyright (c) 2026 hcflabs
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@hcflabs/pi-session-recall`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Search past Pi sessions locally for decisions and context. Saved transcripts enter model context only when requested, not on every turn.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@hcflabs/pi-session-recall
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
Ask the agent to search distinctive keywords:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{ "query": "database migration rollback" }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use a result's `path` and `matchMessageId` for transcript retrieval.
|
|
20
|
+
|
|
21
|
+
| Surface | Type | Purpose |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `session_search` | tool | Agents browse, search, read, scroll, or prepare a bounded pattern-mining corpus. |
|
|
24
|
+
| `/skill:pi-session-pattern-miner` | skill | Users ask the agent to find repeated work and select useful automation. |
|
|
25
|
+
|
|
26
|
+
### Tool modes
|
|
27
|
+
|
|
28
|
+
| Mode | Arguments | Result |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| Discovery | `query` | BM25 text-ranked metadata and snippets, including `path` and `matchMessageId`. |
|
|
31
|
+
| Browse | No arguments | Recent sessions: path, name, cwd, start date, and preview. |
|
|
32
|
+
| Read | `sessionId` | Raw messages, including tool results. Large sessions return the first 20 and last 10 messages. |
|
|
33
|
+
| Scroll | `sessionId` + `aroundMessageId` | Raw messages within ±`window` of the scroll anchor on the selected branch. `window`: 1 to 20, default 5. |
|
|
34
|
+
| Pattern preparation | `operation:"prepare-pattern-miner"` + `scope:"repository"` or `scope:"all"` | Recent lineage-distinct sessions and repository inventory. |
|
|
35
|
+
|
|
36
|
+
Browse and discovery `limit` defaults to 3; preparation defaults to 10. All clamp `limit` to 1 to 10.
|
|
37
|
+
|
|
38
|
+
Narrow discovery before retrieving transcripts. To scroll to a result, use:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"sessionId": "<result path>",
|
|
43
|
+
"aroundMessageId": "<result matchMessageId>",
|
|
44
|
+
"window": 10
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This retrieves up to ten messages on either side. Scroll further from the first or last message ID. Across forks, retain the response's `branchTip`; `aroundMessageId` must belong to that branch. `sessionId` must name a `.jsonl` file under Pi's sessions directory.
|
|
49
|
+
|
|
50
|
+
Start pattern mining with:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"operation": "prepare-pattern-miner",
|
|
55
|
+
"scope": "repository",
|
|
56
|
+
"limit": 10
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Repository scope selects exact and descendant `cwd` values before applying the limit. It excludes the current session file. Use `scope:"all"` across repositories, including when inventory is unavailable.
|
|
61
|
+
|
|
62
|
+
The TUI shows the last five visual lines and earlier-line count. Press the tool expand key (`Ctrl+O` by default) for the full bounded response; the model always receives it.
|
|
63
|
+
|
|
64
|
+
### Programmatic output
|
|
65
|
+
|
|
66
|
+
The output schema gives programmatic callers, including Pi `codemode`, a structured value. The model receives the same JSON. `mode` selects the schema variant; fields include `contentTruncated` and `syncWarning`. Results and errors stay within 50,000 characters, including rejected paths and scroll identifiers.
|
|
67
|
+
|
|
68
|
+
Failures are tool errors, not success JSON; codemode calls reject with the error message. Errors include invalid/conflicting arguments, missing or refused paths, unknown scroll anchors, oversized files, required inventory failures, cancellation, and metadata exceeding the output limit.
|
|
69
|
+
|
|
70
|
+
The tool uses Pi's default `direct` exposure and a read-only annotation. It writes only its derived index and does not enable codemode. Its schema, descriptions, and guideline still add prompt cost while active.
|
|
71
|
+
|
|
72
|
+
### Pattern-miner skill
|
|
73
|
+
|
|
74
|
+
Read the [pi-session-pattern-miner skill](./skills/pi-session-pattern-miner/SKILL.md) for its procedure and evidence rules.
|
|
75
|
+
|
|
76
|
+
### Repository inventory
|
|
77
|
+
|
|
78
|
+
Inventory gives discovery hints, not workflow ownership or verified worktree content (`worktreeVerified:false`). Package scripts, executables, and instructions come from stage-0 Git-index entries; package content comes from indexed blobs, never working-tree package paths.
|
|
79
|
+
|
|
80
|
+
Executables require mode `100755`. Instructions require recognized names and regular-file modes. Skills come from Pi's effective command registry, with canonical source paths inside the repository.
|
|
81
|
+
|
|
82
|
+
Available inventory reports:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"packageScripts": "git-index",
|
|
87
|
+
"executableScripts": "git-index",
|
|
88
|
+
"agentInstructions": "git-index",
|
|
89
|
+
"skills": "pi-effective-registry"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Staged additions, changes, and deletions affect Git-index collections. Unstaged changes, deletions, mode changes, symlinks, and untracked files do not; effective skills can include untracked files. Check current files before assigning ownership. Make no recommendation if safe checks are not possible.
|
|
94
|
+
|
|
95
|
+
## Flow
|
|
96
|
+
|
|
97
|
+

|
|
98
|
+
|
|
99
|
+
Search makes no model calls.
|
|
100
|
+
|
|
101
|
+
### Query and index
|
|
102
|
+
|
|
103
|
+
- Queries are trimmed, then limited to 512 characters; later text is ignored.
|
|
104
|
+
- Prefer distinctive identifiers, package names, issue numbers, or uncommon terms. Quote phrases only when you know their exact wording.
|
|
105
|
+
- FTS5 trigram search uses AND between words. Use `OR`, quoted phrases, and `NOT` for alternatives, exact matches, and exclusions. Wildcards need stems of at least three characters.
|
|
106
|
+
- Only user and assistant text is searchable, never thinking or tool output.
|
|
107
|
+
- Messages exceeding 20,000 characters contribute only their first and last regions. Phrases and `NEAR` cannot cross the omitted middle; ordinary AND terms can.
|
|
108
|
+
- Discovery excludes the current session file when its path is available. Matching forks collapse into their matching parent.
|
|
109
|
+
|
|
110
|
+
### Retrieval and sync
|
|
111
|
+
|
|
112
|
+
Browse, discovery, and preparation sync the index before use. Preparation reports `sync.walkComplete`, `sync.backlogRemaining`, and `sync.complete`. Completion requires a complete walk and zero backlog.
|
|
113
|
+
|
|
114
|
+
Preparation returns non-empty user and assistant text, never thinking or tool results. Unreadable sources retain citation and lineage metadata.
|
|
115
|
+
|
|
116
|
+
**Historical tool output can contain secrets or sensitive data. Raw retrieval puts that output in active model context.** All returned content follows your configured model provider's data path.
|
|
117
|
+
|
|
118
|
+
## State and storage
|
|
119
|
+
|
|
120
|
+
The derived SQLite index is `~/.pi/agent/config/pi-session-recall/index.db`. Delete it to rebuild from session files; no migration or recovery tools are necessary. Index and transcript reads are local; transcripts stay in place.
|
|
121
|
+
|
|
122
|
+
## Limits and recovery
|
|
123
|
+
|
|
124
|
+
Incomplete sync can leave partly updated or stale results. Files reached before failure can update; unreached rows remain stale.
|
|
125
|
+
|
|
126
|
+
| Sync result | Report |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| Partial walk | `syncWarning: {kind:"incomplete-walk"}`; unseen indexed paths are never purged. |
|
|
129
|
+
| Total failure | `syncWarning: {kind:"sync-failed", error}` with a capped error. |
|
|
130
|
+
| Completed sync | No warning. |
|
|
131
|
+
|
|
132
|
+
Session directories starting with encoded `--tmp-` or `--private-tmp-` are never indexed; these represent `/tmp` or `/private/tmp`.
|
|
133
|
+
|
|
134
|
+
Files over 32 MiB are neither indexed nor retrieved. Discovery cannot find new oversized files, but can return earlier metadata after source changes. Read and scroll report size errors.
|
|
135
|
+
|
|
136
|
+
Preparation runs one sync pass. Backlog or incomplete walks limit the sample and set `sync.complete:false`. Total sync failure is a tool error. Preparation rejects `query`, session cursors, or `window`; `scope` requires the preparation operation.
|
|
137
|
+
|
|
138
|
+
Repository scope fails outside Git or when inventory fails. All scope returns its corpus with `inventory.available:false` for nonzero Git-root lookup (`reason:"not-a-git-repository"`) or later inventory failure (`reason:"inventory-failed"`).
|
|
139
|
+
|
|
140
|
+
| Limit | Maximum |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| Serialized preparation output | 50,000 characters |
|
|
143
|
+
| Inventory output | 10,000 characters |
|
|
144
|
+
|
|
145
|
+
Inventory rejects malformed index data, invalid UTF-8, conflict entries, unsupported package modes, Git errors, unexpected stderr, and stream overflow. It reads Git objects locally without lazy fetching or replacement refs.
|
|
146
|
+
|
|
147
|
+
`omittedCounts` counts only omitted inventory entries; `inventory.truncated` reports those omissions. Session and top-level `contentTruncated` report transcript budget trimming only; session `truncated` reports omitted middle messages.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>session_search routing</title>
|
|
7
|
+
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
8
|
+
<style>
|
|
9
|
+
html, body { min-height: 100%; margin: 0; background: #f0eee9; }
|
|
10
|
+
body { display: grid; place-items: center; }
|
|
11
|
+
figure { width: min(100%, 1280px); margin: 0; }
|
|
12
|
+
svg { display: block; width: 100%; height: auto; }
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<figure>
|
|
17
|
+
<svg width="1280" height="720" viewBox="0 0 1280 720" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="session-search-routing-title session-search-routing-desc">
|
|
18
|
+
<title id="session-search-routing-title">session_search progressive search and scroll</title>
|
|
19
|
+
<desc id="session-search-routing-desc">Flowchart routing progressive keyword discovery to metadata results, then using each result path and matchMessageId for direct transcript scroll.</desc>
|
|
20
|
+
<defs>
|
|
21
|
+
<style>
|
|
22
|
+
.eyebrow { fill: #6a7282; font: 500 8px 'Geist Mono', monospace; letter-spacing: .16em; }
|
|
23
|
+
.diagram-title { fill: #101828; font: 400 28px 'Instrument Serif', serif; }
|
|
24
|
+
.zone-label { fill: #4c5665; font: 500 8px 'Geist Mono', monospace; letter-spacing: .12em; }
|
|
25
|
+
.zone-note { fill: #6a7282; font: 400 8px 'Geist Mono', monospace; letter-spacing: .04em; }
|
|
26
|
+
.node-name { fill: #101828; font: 600 12px 'Geist', sans-serif; text-anchor: middle; }
|
|
27
|
+
.technical-name { fill: #101828; font: 500 12px 'Geist Mono', monospace; text-anchor: middle; }
|
|
28
|
+
.node-sub { fill: #4c5665; font: 400 8px 'Geist Mono', monospace; text-anchor: middle; }
|
|
29
|
+
.edge { fill: none; stroke: #4c5665; stroke-width: 1.2; marker-end: url(#session-search-routing-arrow); }
|
|
30
|
+
.edge-label { fill: #4c5665; font: 500 8px 'Geist Mono', monospace; text-anchor: middle; letter-spacing: .08em; }
|
|
31
|
+
</style>
|
|
32
|
+
<marker id="session-search-routing-arrow" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
33
|
+
<polygon points="0 0,8 4,0 8" fill="#4c5665"/>
|
|
34
|
+
</marker>
|
|
35
|
+
<marker id="session-search-routing-arrow-accent" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
36
|
+
<polygon points="0 0,8 4,0 8" fill="#1d4ed8"/>
|
|
37
|
+
</marker>
|
|
38
|
+
<marker id="session-search-routing-arrow-link" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
39
|
+
<polygon points="0 0,8 4,0 8" fill="#1d4ed8"/>
|
|
40
|
+
</marker>
|
|
41
|
+
</defs>
|
|
42
|
+
|
|
43
|
+
<rect width="1280" height="720" fill="#f0eee9"/>
|
|
44
|
+
|
|
45
|
+
<text class="eyebrow" x="40" y="48">PI-SESSION-RECALL · FLOWCHART</text>
|
|
46
|
+
<text class="diagram-title" x="40" y="88">Five routes through session_search</text>
|
|
47
|
+
|
|
48
|
+
<!-- Routing zones are backgrounds, not primary nodes. -->
|
|
49
|
+
<rect x="40" y="352" width="752" height="320" rx="8" fill="#e6e4de" stroke="rgba(16,24,40,0.14)" stroke-width="1"/>
|
|
50
|
+
<text class="zone-label" x="56" y="376">INDEX-BACKED CALLS · LAZY SYNC</text>
|
|
51
|
+
<text class="zone-note" x="56" y="392">PREPARE · DISCOVERY · BROWSE</text>
|
|
52
|
+
|
|
53
|
+
<rect x="816" y="352" width="424" height="320" rx="8" fill="#e6e4de" stroke="rgba(16,24,40,0.14)" stroke-width="1"/>
|
|
54
|
+
<text class="zone-label" x="832" y="376">DIRECT TRANSCRIPT READS</text>
|
|
55
|
+
<text class="zone-note" x="832" y="392">RAW ROLES · TOOL RESULTS</text>
|
|
56
|
+
|
|
57
|
+
<!-- Connectors: all routes are painted before their nodes. -->
|
|
58
|
+
<path class="edge" d="M640 180 V212"/>
|
|
59
|
+
<path class="edge" d="M532 264 H320 Q312 264 312 272 V388 Q312 396 304 396 H184 Q176 396 176 404 V412"/>
|
|
60
|
+
<path class="edge" d="M640 316 V336 Q640 344 632 344 H432 Q424 344 424 352 V392"/>
|
|
61
|
+
<path class="edge" d="M748 264 H792 Q800 264 800 272 V328 Q800 336 808 336 H1016 Q1024 336 1024 344 V392"/>
|
|
62
|
+
<path class="edge" d="M536 448 H576"/>
|
|
63
|
+
<path class="edge" d="M424 504 V544"/>
|
|
64
|
+
<path class="edge" d="M1136 448 V536"/>
|
|
65
|
+
<path class="edge" d="M912 448 H896 Q888 448 888 456 V520 Q888 528 896 528 H912 Q920 528 920 536"/>
|
|
66
|
+
|
|
67
|
+
<!-- Branch labels stay 8px clear of their connectors. -->
|
|
68
|
+
<rect x="384" y="244" width="72" height="12" rx="2" fill="#f0eee9"/>
|
|
69
|
+
<text class="edge-label" x="420" y="252">PREPARE</text>
|
|
70
|
+
|
|
71
|
+
<rect x="488" y="324" width="112" height="12" rx="2" fill="#f0eee9"/>
|
|
72
|
+
<text class="edge-label" x="544" y="332">SEARCH / BROWSE</text>
|
|
73
|
+
|
|
74
|
+
<rect x="808" y="288" width="56" height="12" rx="2" fill="#f0eee9"/>
|
|
75
|
+
<text class="edge-label" x="836" y="296">INSPECT</text>
|
|
76
|
+
|
|
77
|
+
<rect x="544" y="428" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
78
|
+
<text class="edge-label" x="556" y="436">YES</text>
|
|
79
|
+
|
|
80
|
+
<rect x="432" y="516" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
81
|
+
<text class="edge-label" x="444" y="524">NO</text>
|
|
82
|
+
|
|
83
|
+
<rect x="1144" y="480" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
84
|
+
<text class="edge-label" x="1156" y="488">YES</text>
|
|
85
|
+
|
|
86
|
+
<rect x="896" y="480" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
87
|
+
<text class="edge-label" x="908" y="488">NO</text>
|
|
88
|
+
|
|
89
|
+
<!-- Primary nodes: one start, three decisions, and five terminal modes. -->
|
|
90
|
+
<rect x="540" y="132" width="200" height="48" rx="20" fill="rgba(16,24,40,0.03)" stroke="#4c5665" stroke-width="1"/>
|
|
91
|
+
<text class="technical-name" x="640" y="156">session_search</text>
|
|
92
|
+
<text class="node-sub" x="640" y="172">ONE LOCAL TOOL</text>
|
|
93
|
+
|
|
94
|
+
<polygon points="640,212 748,264 640,316 532,264" fill="rgba(29,78,216,0.08)" stroke="#1d4ed8" stroke-width="1.2"/>
|
|
95
|
+
<text class="node-name" x="640" y="260">Call family?</text>
|
|
96
|
+
<text class="node-sub" x="640" y="280">ROUTE BY ARGUMENTS</text>
|
|
97
|
+
|
|
98
|
+
<rect x="48" y="412" width="240" height="128" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
99
|
+
<text class="node-name" x="168" y="444">Pattern preparation</text>
|
|
100
|
+
<text class="node-sub" x="168" y="472">operation + scope · lazy sync</text>
|
|
101
|
+
<text class="node-sub" x="168" y="488">bounded user/assistant corpus</text>
|
|
102
|
+
<text class="node-sub" x="168" y="504">+ repository inventory · never tool results</text>
|
|
103
|
+
|
|
104
|
+
<polygon points="424,392 536,448 424,504 312,448" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
105
|
+
<text class="technical-name" x="424" y="444">query?</text>
|
|
106
|
+
<text class="node-sub" x="424" y="464">PRESENT</text>
|
|
107
|
+
|
|
108
|
+
<rect x="576" y="400" width="200" height="96" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
109
|
+
<text class="node-name" x="676" y="428">Discovery</text>
|
|
110
|
+
<text class="node-sub" x="676" y="452">keyword query · lazy sync + FTS5</text>
|
|
111
|
+
<text class="node-sub" x="676" y="468">metadata + snippets only</text>
|
|
112
|
+
<text class="node-sub" x="676" y="484">path + matchMessageId → SCROLL</text>
|
|
113
|
+
|
|
114
|
+
<rect x="328" y="544" width="192" height="96" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
115
|
+
<text class="node-name" x="424" y="572">Browse</text>
|
|
116
|
+
<text class="node-sub" x="424" y="596">no args · lazy sync</text>
|
|
117
|
+
<text class="node-sub" x="424" y="612">recent session metadata</text>
|
|
118
|
+
|
|
119
|
+
<polygon points="1024,392 1136,448 1024,504 912,448" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
120
|
+
<text class="technical-name" x="1024" y="444">aroundMessageId?</text>
|
|
121
|
+
<text class="node-sub" x="1024" y="464">WITH sessionId</text>
|
|
122
|
+
|
|
123
|
+
<rect x="1040" y="536" width="192" height="112" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
124
|
+
<text class="node-name" x="1136" y="564">Scroll</text>
|
|
125
|
+
<text class="node-sub" x="1136" y="588">sessionId + aroundMessageId</text>
|
|
126
|
+
<text class="node-sub" x="1136" y="604">direct saved JSONL</text>
|
|
127
|
+
<text class="node-sub" x="1136" y="620">raw roles including tool results</text>
|
|
128
|
+
<text class="node-sub" x="1136" y="636">±window with branchTip</text>
|
|
129
|
+
|
|
130
|
+
<rect x="824" y="536" width="192" height="112" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
131
|
+
<text class="node-name" x="920" y="564">Read</text>
|
|
132
|
+
<text class="node-sub" x="920" y="588">sessionId · direct saved JSONL</text>
|
|
133
|
+
<text class="node-sub" x="920" y="604">raw roles including tool results</text>
|
|
134
|
+
<text class="node-sub" x="920" y="620">head 20 + tail 10</text>
|
|
135
|
+
</svg>
|
|
136
|
+
</figure>
|
|
137
|
+
</body>
|
|
138
|
+
</html>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="1280" height="720" viewBox="0 0 1280 720" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="session-search-routing-title session-search-routing-desc">
|
|
3
|
+
<title id="session-search-routing-title">session_search progressive search and scroll</title>
|
|
4
|
+
<desc id="session-search-routing-desc">Flowchart routing progressive keyword discovery to metadata results, then using each result path and matchMessageId for direct transcript scroll.</desc>
|
|
5
|
+
<defs>
|
|
6
|
+
<style>@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap');</style>
|
|
7
|
+
<style>
|
|
8
|
+
.eyebrow { fill: #6a7282; font: 500 8px 'Geist Mono', monospace; letter-spacing: .16em; }
|
|
9
|
+
.diagram-title { fill: #101828; font: 400 28px 'Instrument Serif', serif; }
|
|
10
|
+
.zone-label { fill: #4c5665; font: 500 8px 'Geist Mono', monospace; letter-spacing: .12em; }
|
|
11
|
+
.zone-note { fill: #6a7282; font: 400 8px 'Geist Mono', monospace; letter-spacing: .04em; }
|
|
12
|
+
.node-name { fill: #101828; font: 600 12px 'Geist', sans-serif; text-anchor: middle; }
|
|
13
|
+
.technical-name { fill: #101828; font: 500 12px 'Geist Mono', monospace; text-anchor: middle; }
|
|
14
|
+
.node-sub { fill: #4c5665; font: 400 8px 'Geist Mono', monospace; text-anchor: middle; }
|
|
15
|
+
.edge { fill: none; stroke: #4c5665; stroke-width: 1.2; marker-end: url(#session-search-routing-arrow); }
|
|
16
|
+
.edge-label { fill: #4c5665; font: 500 8px 'Geist Mono', monospace; text-anchor: middle; letter-spacing: .08em; }
|
|
17
|
+
</style>
|
|
18
|
+
<marker id="session-search-routing-arrow" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
19
|
+
<polygon points="0 0,8 4,0 8" fill="#4c5665"/>
|
|
20
|
+
</marker>
|
|
21
|
+
<marker id="session-search-routing-arrow-accent" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
22
|
+
<polygon points="0 0,8 4,0 8" fill="#1d4ed8"/>
|
|
23
|
+
</marker>
|
|
24
|
+
<marker id="session-search-routing-arrow-link" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
|
|
25
|
+
<polygon points="0 0,8 4,0 8" fill="#1d4ed8"/>
|
|
26
|
+
</marker>
|
|
27
|
+
</defs>
|
|
28
|
+
|
|
29
|
+
<rect width="1280" height="720" fill="#f0eee9"/>
|
|
30
|
+
|
|
31
|
+
<text class="eyebrow" x="40" y="48">PI-SESSION-RECALL · FLOWCHART</text>
|
|
32
|
+
<text class="diagram-title" x="40" y="88">Five routes through session_search</text>
|
|
33
|
+
|
|
34
|
+
<!-- Routing zones are backgrounds, not primary nodes. -->
|
|
35
|
+
<rect x="40" y="352" width="752" height="320" rx="8" fill="#e6e4de" stroke="#101828" stroke-opacity="0.14" stroke-width="1"/>
|
|
36
|
+
<text class="zone-label" x="56" y="376">INDEX-BACKED CALLS · LAZY SYNC</text>
|
|
37
|
+
<text class="zone-note" x="56" y="392">PREPARE · DISCOVERY · BROWSE</text>
|
|
38
|
+
|
|
39
|
+
<rect x="816" y="352" width="424" height="320" rx="8" fill="#e6e4de" stroke="#101828" stroke-opacity="0.14" stroke-width="1"/>
|
|
40
|
+
<text class="zone-label" x="832" y="376">DIRECT TRANSCRIPT READS</text>
|
|
41
|
+
<text class="zone-note" x="832" y="392">RAW ROLES · TOOL RESULTS</text>
|
|
42
|
+
|
|
43
|
+
<!-- Connectors: all routes are painted before their nodes. -->
|
|
44
|
+
<path class="edge" d="M640 180 V212"/>
|
|
45
|
+
<path class="edge" d="M532 264 H320 Q312 264 312 272 V388 Q312 396 304 396 H184 Q176 396 176 404 V412"/>
|
|
46
|
+
<path class="edge" d="M640 316 V336 Q640 344 632 344 H432 Q424 344 424 352 V392"/>
|
|
47
|
+
<path class="edge" d="M748 264 H792 Q800 264 800 272 V328 Q800 336 808 336 H1016 Q1024 336 1024 344 V392"/>
|
|
48
|
+
<path class="edge" d="M536 448 H576"/>
|
|
49
|
+
<path class="edge" d="M424 504 V544"/>
|
|
50
|
+
<path class="edge" d="M1136 448 V536"/>
|
|
51
|
+
<path class="edge" d="M912 448 H896 Q888 448 888 456 V520 Q888 528 896 528 H912 Q920 528 920 536"/>
|
|
52
|
+
|
|
53
|
+
<!-- Branch labels stay 8px clear of their connectors. -->
|
|
54
|
+
<rect x="384" y="244" width="72" height="12" rx="2" fill="#f0eee9"/>
|
|
55
|
+
<text class="edge-label" x="420" y="252">PREPARE</text>
|
|
56
|
+
|
|
57
|
+
<rect x="488" y="324" width="112" height="12" rx="2" fill="#f0eee9"/>
|
|
58
|
+
<text class="edge-label" x="544" y="332">SEARCH / BROWSE</text>
|
|
59
|
+
|
|
60
|
+
<rect x="808" y="288" width="56" height="12" rx="2" fill="#f0eee9"/>
|
|
61
|
+
<text class="edge-label" x="836" y="296">INSPECT</text>
|
|
62
|
+
|
|
63
|
+
<rect x="544" y="428" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
64
|
+
<text class="edge-label" x="556" y="436">YES</text>
|
|
65
|
+
|
|
66
|
+
<rect x="432" y="516" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
67
|
+
<text class="edge-label" x="444" y="524">NO</text>
|
|
68
|
+
|
|
69
|
+
<rect x="1144" y="480" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
70
|
+
<text class="edge-label" x="1156" y="488">YES</text>
|
|
71
|
+
|
|
72
|
+
<rect x="896" y="480" width="24" height="12" rx="2" fill="#f0eee9"/>
|
|
73
|
+
<text class="edge-label" x="908" y="488">NO</text>
|
|
74
|
+
|
|
75
|
+
<!-- Primary nodes: one start, three decisions, and five terminal modes. -->
|
|
76
|
+
<rect x="540" y="132" width="200" height="48" rx="20" fill="#101828" fill-opacity="0.03" stroke="#4c5665" stroke-width="1"/>
|
|
77
|
+
<text class="technical-name" x="640" y="156">session_search</text>
|
|
78
|
+
<text class="node-sub" x="640" y="172">ONE LOCAL TOOL</text>
|
|
79
|
+
|
|
80
|
+
<polygon points="640,212 748,264 640,316 532,264" fill="#1d4ed8" fill-opacity="0.08" stroke="#1d4ed8" stroke-width="1.2"/>
|
|
81
|
+
<text class="node-name" x="640" y="260">Call family?</text>
|
|
82
|
+
<text class="node-sub" x="640" y="280">ROUTE BY ARGUMENTS</text>
|
|
83
|
+
|
|
84
|
+
<rect x="48" y="412" width="240" height="128" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
85
|
+
<text class="node-name" x="168" y="444">Pattern preparation</text>
|
|
86
|
+
<text class="node-sub" x="168" y="472">operation + scope · lazy sync</text>
|
|
87
|
+
<text class="node-sub" x="168" y="488">bounded user/assistant corpus</text>
|
|
88
|
+
<text class="node-sub" x="168" y="504">+ repository inventory · never tool results</text>
|
|
89
|
+
|
|
90
|
+
<polygon points="424,392 536,448 424,504 312,448" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
91
|
+
<text class="technical-name" x="424" y="444">query?</text>
|
|
92
|
+
<text class="node-sub" x="424" y="464">PRESENT</text>
|
|
93
|
+
|
|
94
|
+
<rect x="576" y="400" width="200" height="96" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
95
|
+
<text class="node-name" x="676" y="428">Discovery</text>
|
|
96
|
+
<text class="node-sub" x="676" y="452">keyword query · lazy sync + FTS5</text>
|
|
97
|
+
<text class="node-sub" x="676" y="468">metadata + snippets only</text>
|
|
98
|
+
<text class="node-sub" x="676" y="484">path + matchMessageId → SCROLL</text>
|
|
99
|
+
|
|
100
|
+
<rect x="328" y="544" width="192" height="96" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
101
|
+
<text class="node-name" x="424" y="572">Browse</text>
|
|
102
|
+
<text class="node-sub" x="424" y="596">no args · lazy sync</text>
|
|
103
|
+
<text class="node-sub" x="424" y="612">recent session metadata</text>
|
|
104
|
+
|
|
105
|
+
<polygon points="1024,392 1136,448 1024,504 912,448" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
106
|
+
<text class="technical-name" x="1024" y="444">aroundMessageId?</text>
|
|
107
|
+
<text class="node-sub" x="1024" y="464">WITH sessionId</text>
|
|
108
|
+
|
|
109
|
+
<rect x="1040" y="536" width="192" height="112" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
110
|
+
<text class="node-name" x="1136" y="564">Scroll</text>
|
|
111
|
+
<text class="node-sub" x="1136" y="588">sessionId + aroundMessageId</text>
|
|
112
|
+
<text class="node-sub" x="1136" y="604">direct saved JSONL</text>
|
|
113
|
+
<text class="node-sub" x="1136" y="620">raw roles including tool results</text>
|
|
114
|
+
<text class="node-sub" x="1136" y="636">±window with branchTip</text>
|
|
115
|
+
|
|
116
|
+
<rect x="824" y="536" width="192" height="112" rx="20" fill="#f0eee9" stroke="#101828" stroke-width="1"/>
|
|
117
|
+
<text class="node-name" x="920" y="564">Read</text>
|
|
118
|
+
<text class="node-sub" x="920" y="588">sessionId · direct saved JSONL</text>
|
|
119
|
+
<text class="node-sub" x="920" y="604">raw roles including tool results</text>
|
|
120
|
+
<text class="node-sub" x="920" y="620">head 20 + tail 10</text>
|
|
121
|
+
</svg>
|