@chendpoc/pi-memory 0.2.0 → 0.2.1
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/README.md +320 -60
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/preflight.d.ts +8 -0
- package/dist/config/preflight.d.ts.map +1 -0
- package/dist/config/preflight.js +22 -0
- package/dist/config/preflight.js.map +1 -0
- package/dist/constants/env.d.ts +3 -0
- package/dist/constants/env.d.ts.map +1 -1
- package/dist/constants/env.js +3 -0
- package/dist/constants/env.js.map +1 -1
- package/dist/constants/preflight.d.ts +7 -0
- package/dist/constants/preflight.d.ts.map +1 -1
- package/dist/constants/preflight.js +7 -0
- package/dist/constants/preflight.js.map +1 -1
- package/dist/constants/timing.d.ts +2 -0
- package/dist/constants/timing.d.ts.map +1 -1
- package/dist/constants/timing.js +2 -0
- package/dist/constants/timing.js.map +1 -1
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +21 -2
- package/dist/pi-extension.js.map +1 -1
- package/dist/preflight/episodic.d.ts +7 -1
- package/dist/preflight/episodic.d.ts.map +1 -1
- package/dist/preflight/episodic.js +20 -4
- package/dist/preflight/episodic.js.map +1 -1
- package/dist/preflight/intentCache.d.ts +13 -0
- package/dist/preflight/intentCache.d.ts.map +1 -0
- package/dist/preflight/intentCache.js +37 -0
- package/dist/preflight/intentCache.js.map +1 -0
- package/dist/preflight/queryIntent.d.ts +14 -5
- package/dist/preflight/queryIntent.d.ts.map +1 -1
- package/dist/preflight/queryIntent.js +27 -11
- package/dist/preflight/queryIntent.js.map +1 -1
- package/dist/sidecar/warmup.d.ts +6 -0
- package/dist/sidecar/warmup.d.ts.map +1 -0
- package/dist/sidecar/warmup.js +39 -0
- package/dist/sidecar/warmup.js.map +1 -0
- package/doc/README-zh.md +365 -0
- package/doc/ROADMAP-zh.md +52 -0
- package/doc/ROADMAP.md +52 -0
- package/package.json +4 -1
- package/src/config/index.ts +1 -0
- package/src/config/preflight.ts +34 -0
- package/src/constants/env.ts +3 -0
- package/src/constants/preflight.ts +9 -0
- package/src/constants/timing.ts +2 -0
- package/src/pi-extension.ts +22 -2
- package/src/preflight/episodic.ts +28 -4
- package/src/preflight/intentCache.ts +44 -0
- package/src/preflight/queryIntent.ts +46 -12
- package/src/sidecar/warmup.ts +50 -0
package/README.md
CHANGED
|
@@ -1,84 +1,287 @@
|
|
|
1
|
-
# pi-memory
|
|
1
|
+
# @chendpoc/pi-memory
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="README.md">English</a> |
|
|
5
|
+
<a href="doc/README-zh.md">简体中文</a>
|
|
6
|
+
</p>
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Cross-session episodic memory for the [Pi coding agent](https://pi.dev).
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|-------|------|
|
|
9
|
-
| **Ground Truth** | `MEMORY.md` + `auto-*.md` overflow files |
|
|
10
|
-
| **Vector Index** | `memory.vec.sqlite` (derived; cosine scan + MMR; default top-3, min relevance 0.4) |
|
|
11
|
-
| **Sidecar** | Separate Node process over UDS JSONL (`query`, `reindex`, `ping`) |
|
|
12
|
-
| **Preflight** | QueryIntent → Sidecar → Fallback to MEMORY.md → silent empty inject |
|
|
10
|
+
`pi-memory` gives Pi a local, auditable memory layer across sessions. It keeps durable facts in **`MEMORY.md` as the source of truth**, derives a vector index in `memory.vec.sqlite`, and injects relevant private context through Preflight before the main model answers.
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
## What It Does
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
2. **Compaction** — dual-purpose summary → `appendFromCompaction` (Compact Delta for subagents)
|
|
18
|
-
3. **Consolidate** — OR trigger (overflow ≥12 / 7 days / daily 03:00 cron)
|
|
14
|
+
Pi already has compaction for long sessions. That solves "this conversation is too long"; it does not solve "a new session forgot my preferences, project conventions, prior decisions, and unresolved todos."
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
`pi-memory` fills that gap:
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
```text
|
|
19
|
+
durable facts -> MEMORY.md -> derived vector index -> per-turn Preflight recall
|
|
20
|
+
```
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
It provides:
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
- **Explicit memory** through `/remember`.
|
|
25
|
+
- **Automatic durable fact export** from Pi compaction.
|
|
26
|
+
- **Shutdown queue recovery** for short or missed sessions.
|
|
27
|
+
- **Per-turn private recall** before the main model runs.
|
|
28
|
+
- **Human-editable storage** in Markdown, with vector search as a rebuildable index.
|
|
29
|
+
- **Offline maintenance** for consolidation, dedupe, overflow handling, and queue draining.
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|------|---------|
|
|
30
|
-
| `MEMORY.md` | Ground truth |
|
|
31
|
-
| `auto-*.md` | Overflow entries |
|
|
32
|
-
| `memory.vec.sqlite` | Vector index (derived) |
|
|
33
|
-
| `memory.sock` | Sidecar UDS |
|
|
31
|
+
## Installation
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
Requirements:
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
- Node.js `>=24 <25`
|
|
36
|
+
- pnpm
|
|
37
|
+
- Pi extension runtime packages supplied by Pi
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
Install as a package in the Pi extension environment:
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
```bash
|
|
42
|
+
pnpm add @chendpoc/pi-memory
|
|
43
|
+
```
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
- Four sections: **Preferences**, **Conventions**, **Findings**, **Todos**
|
|
46
|
-
- Entries: `- [user] note <!-- id:... user ts:... -->` (via `/remember`) or `- note <!-- id:... ts:... -->`
|
|
47
|
-
- 150-line cap; overflow spills to `auto-*.md`
|
|
45
|
+
For local development from this repository:
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
```bash
|
|
48
|
+
pnpm install
|
|
49
|
+
pnpm build
|
|
50
|
+
pnpm typecheck
|
|
51
|
+
pnpm test
|
|
52
|
+
```
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
2. First Pi session → `MemoryStore.ensureInitialized()` on `session_start`
|
|
53
|
-
3. Manual: `pi-memory init`
|
|
54
|
+
Enable the extension through Pi's extension loading mechanism. This package declares:
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"pi": {
|
|
59
|
+
"extensions": ["./src/pi-extension.ts"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
Initialize memory explicitly when needed:
|
|
58
65
|
|
|
59
66
|
```bash
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
pi-memory init
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Initialization never overwrites a non-empty `MEMORY.md`.
|
|
71
|
+
|
|
72
|
+
## Why Choose `pi-memory`
|
|
73
|
+
|
|
74
|
+
### Agent Before / After
|
|
75
|
+
|
|
76
|
+
| Situation | Without `pi-memory` | With `pi-memory` |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| New session asks "continue the plan from last time" | Agent has to ask for context or guess from the current repo. | Preflight recalls matching `MEMORY.md` facts and injects private reference context. |
|
|
79
|
+
| User says "remember that this repo uses Vitest" | The fact may stay only in the current session summary. | `/remember` writes a `[user]` entry that consolidate must preserve. |
|
|
80
|
+
| Long session compacts | Compaction helps continue that session but does not create durable cross-session facts. | One dual-purpose compact summary keeps session context and exports durable facts. |
|
|
81
|
+
| Subagent is spawned | It may over-recall or duplicate the parent session's memory writes. | Subagents get Memory Cap only and write Compact Delta facts. |
|
|
82
|
+
| Vector sidecar is down | A hard dependency would break the turn. | Preflight silently falls back to Markdown or injects nothing; the model still runs. |
|
|
83
|
+
| Memory grows | A file can become noisy and unbounded. | 150-line `MEMORY.md` cap, `auto-*.md` overflow, consolidate merge/dedupe. |
|
|
84
|
+
|
|
85
|
+
### Key Advantages
|
|
86
|
+
|
|
87
|
+
- **Markdown Ground Truth**: `MEMORY.md` and `auto-*.md` can be opened, reviewed, edited, grepped, copied, or versioned.
|
|
88
|
+
- **Derived index, not hidden state**: `memory.vec.sqlite` can be deleted and rebuilt from Markdown.
|
|
89
|
+
- **Preflight recall**: Memory is injected before the main model answers instead of hoping the model calls a search tool.
|
|
90
|
+
- **Hot-path budget**: Default Preflight budget is **800ms**, with QueryIntent, sidecar query, and fallback all bounded.
|
|
91
|
+
- **Protected user notes**: `/remember` writes `[user]` entries that consolidate must not remove or rewrite.
|
|
92
|
+
- **Sidecar isolation**: embedding, vector scan, MMR, stats, and reindex run outside the extension process, while writes stay owned by `MemoryStore`.
|
|
93
|
+
- **Subagent policy**: root sessions get Memory Cap + Episodic Preflight; subagents get Memory Cap only by default.
|
|
94
|
+
- **Graceful fallback**: if sidecar recall is empty, timed out, or unavailable, the turn still runs.
|
|
95
|
+
|
|
96
|
+
### Comparison
|
|
97
|
+
|
|
98
|
+
`pi-memory` is not trying to be every memory system. The value is a specific Pi-native loop: Markdown ground truth, Preflight injection, sidecar retrieval, compaction export, and offline maintenance.
|
|
99
|
+
|
|
100
|
+
| System | Strength | Difference From `@chendpoc/pi-memory` |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| Cursor Rules / OpenCode `AGENTS.md` | Static project instructions, predictable injection. | Mostly user-authored rules; no automatic durable fact extraction or per-turn episodic Preflight. |
|
|
103
|
+
| Claude Code Auto Memory | Agent can write local memory files. | File-based memory, but no sidecar vector recall or Pi compact/shutdown integration. |
|
|
104
|
+
| `pi-hermes-memory` | Rich Pi package with FTS5, failure memory, correction learning, security scanning. | More automated and feature-heavy; no `<private_memory>` Preflight loop or sidecar-derived vector index. |
|
|
105
|
+
| OpenClaw memory-core | Mature file + index design, dreaming, hybrid search, local embeddings. | Broader memory platform; `pi-memory` is narrower and Pi-extension focused. |
|
|
106
|
+
| Mem0 / Zep | Managed memory APIs with hybrid search, graph, temporal modeling. | Stronger retrieval infrastructure, but external service/database oriented and not Markdown-ground-truth first. |
|
|
107
|
+
| Letta | Context engineering with git-backed memory repos and sleep-time compute. | Powerful for autonomous memory management; heavier mental model than Pi's extension lifecycle. |
|
|
108
|
+
| Cognee | Knowledge engine with graph/vector/relational stores and many retrieval modes. | Better for knowledge graphs; overkill for lightweight coding-agent preferences and conventions. |
|
|
109
|
+
|
|
110
|
+
Where other systems are stronger:
|
|
111
|
+
|
|
112
|
+
- `pi-hermes-memory`: failure memory, correction detector, tool quirks, secret scanning.
|
|
113
|
+
- OpenClaw: dreaming stages, memory wiki, hybrid FTS/vector search, local embedding providers.
|
|
114
|
+
- Zep/Cognee: temporal graph reasoning and multi-hop graph retrieval.
|
|
115
|
+
- Mem0: hosted multi-tenant memory API.
|
|
116
|
+
- Letta: autonomous context repositories and sleep-time memory work.
|
|
117
|
+
|
|
118
|
+
## How It Works
|
|
119
|
+
|
|
120
|
+
### Architecture
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
Pi extension process
|
|
124
|
+
|- session_start
|
|
125
|
+
| |- initialize MEMORY.md
|
|
126
|
+
| |- start/warm sidecar
|
|
127
|
+
| |- reindex derived vector index
|
|
128
|
+
| `- preload Memory Cap
|
|
129
|
+
|
|
|
130
|
+
|- before_agent_start / context
|
|
131
|
+
| `- Preflight recall -> <private_memory> injection
|
|
132
|
+
|
|
|
133
|
+
|- /remember
|
|
134
|
+
| `- append [user] Memory Entry
|
|
135
|
+
|
|
|
136
|
+
|- session_before_compact / session_compact
|
|
137
|
+
| `- dual-purpose summary -> Memory Export ingest
|
|
138
|
+
|
|
|
139
|
+
|- session_shutdown
|
|
140
|
+
| `- append shutdown metadata only
|
|
141
|
+
|
|
|
142
|
+
`- consolidate scheduler
|
|
143
|
+
`- merge/dedupe -> rewrite Ground Truth -> reindex
|
|
144
|
+
|
|
145
|
+
Sidecar process over UDS JSONL
|
|
146
|
+
|- ping
|
|
147
|
+
|- stats
|
|
148
|
+
|- query: embed -> cosine scan -> MMR
|
|
149
|
+
`- reindex: upsert chunks into memory.vec.sqlite
|
|
62
150
|
```
|
|
63
151
|
|
|
64
|
-
|
|
152
|
+
### Read Path
|
|
153
|
+
|
|
154
|
+
Root session:
|
|
65
155
|
|
|
66
|
-
|
|
156
|
+
```text
|
|
157
|
+
Memory Cap from Ground Truth
|
|
158
|
+
+ Episodic Preflight for the current user message
|
|
159
|
+
-> merged <private_memory>
|
|
160
|
+
```
|
|
67
161
|
|
|
68
|
-
|
|
162
|
+
Subagent session:
|
|
69
163
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
| `PI_MEMORY_HELPER_MODEL` | Helper LLM for QueryIntent + consolidate |
|
|
75
|
-
| `PI_MEMORY_PREFLIGHT_BUDGET_MS` | Preflight shared budget (default 800ms: ~240 intent + ~560 sidecar) |
|
|
76
|
-
| `PI_MEMORY_REINDEX_DEBOUNCE_MS` | Debounced reindex after writes |
|
|
77
|
-
| `PI_MEMORY_DEBUG` | `1` enables debug stderr logs (preflight timings) |
|
|
164
|
+
```text
|
|
165
|
+
Memory Cap only
|
|
166
|
+
-> no episodic QueryIntent / sidecar query by default
|
|
167
|
+
```
|
|
78
168
|
|
|
79
|
-
|
|
169
|
+
Fallback chain:
|
|
80
170
|
|
|
81
|
-
|
|
171
|
+
```text
|
|
172
|
+
Sidecar results
|
|
173
|
+
-> if empty/error/timeout: MEMORY.md fallback
|
|
174
|
+
-> if empty: no injection
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Write Paths
|
|
178
|
+
|
|
179
|
+
| Path | Trigger | LLM? | Blocking? | Purpose |
|
|
180
|
+
| --- | --- | --- | --- | --- |
|
|
181
|
+
| `/remember` | User command | No | Yes | Explicit durable note |
|
|
182
|
+
| Compaction | `session_before_compact` + `session_compact` | One summary call | Summary blocks; ingest is background | Continue current session and export durable facts |
|
|
183
|
+
| Shutdown Queue | `session_shutdown` + `pi-memory maintenance` | Only offline, when no compaction summary exists | No during shutdown | Recover facts from short or missed sessions |
|
|
184
|
+
| Consolidate | overflow >= 12, 7 days, or daily cron | Optional | Offline/background | Dedupe, merge, prune obsolete todos |
|
|
185
|
+
|
|
186
|
+
## Data And Memory Format
|
|
187
|
+
|
|
188
|
+
All artifacts live under one memory agent directory.
|
|
189
|
+
|
|
190
|
+
Resolution order:
|
|
191
|
+
|
|
192
|
+
1. `--agent-dir` CLI flag
|
|
193
|
+
2. `PI_MEMORY_AGENT_DIR`
|
|
194
|
+
3. default `~/.pi/pi-memory-data`
|
|
195
|
+
|
|
196
|
+
| File | Role |
|
|
197
|
+
| --- | --- |
|
|
198
|
+
| `MEMORY.md` | Ground Truth file |
|
|
199
|
+
| `auto-*.md` | Overflow files after the 150-line cap |
|
|
200
|
+
| `.memory_gc` | Last consolidate timestamp |
|
|
201
|
+
| `.memory_compactions.json` | Compaction idempotency state |
|
|
202
|
+
| `.memory_shutdown_queue.jsonl` | Append-only shutdown metadata |
|
|
203
|
+
| `.memory_shutdown_processed.json` | Drain idempotency state |
|
|
204
|
+
| `memory.vec.sqlite` | Derived Vector Index |
|
|
205
|
+
| `memory.sock` | Sidecar Unix domain socket |
|
|
206
|
+
|
|
207
|
+
Canonical scaffold: [`templates/MEMORY.md.example`](./templates/MEMORY.md.example)
|
|
208
|
+
|
|
209
|
+
```markdown
|
|
210
|
+
# Memory
|
|
211
|
+
|
|
212
|
+
## Preferences
|
|
213
|
+
|
|
214
|
+
## Conventions
|
|
215
|
+
|
|
216
|
+
## Findings
|
|
217
|
+
|
|
218
|
+
## Todos
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Entries are single Markdown bullets:
|
|
222
|
+
|
|
223
|
+
```markdown
|
|
224
|
+
- [user] Prefer pnpm over npm <!-- id:abc123 user ts:2026-07-04T09:00:00.000+08:00 -->
|
|
225
|
+
- Project tests use Vitest <!-- id:def456 ts:2026-07-04T09:05:00.000+08:00 -->
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Rules:
|
|
229
|
+
|
|
230
|
+
- `/remember` writes `[user]` entries.
|
|
231
|
+
- Consolidate must not remove or rewrite `[user]` entries.
|
|
232
|
+
- `MEMORY.md` is capped at 150 lines.
|
|
233
|
+
- Overflow entries spill to `auto-*.md`, with a pointer in `MEMORY.md`.
|
|
234
|
+
- Vector chunks are derived from entries; by default long entries split beyond `PI_MEMORY_CHUNK_MAX_CHARS=512`.
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
Optional env file locations are loaded in this order:
|
|
239
|
+
|
|
240
|
+
1. `PI_MEMORY_ENV_FILE`
|
|
241
|
+
2. project `.env`
|
|
242
|
+
3. project `.env.local`
|
|
243
|
+
4. `~/.pi/agent/pi-memory.env`
|
|
244
|
+
|
|
245
|
+
Common variables:
|
|
246
|
+
|
|
247
|
+
| Variable | Default | Purpose |
|
|
248
|
+
| --- | --- | --- |
|
|
249
|
+
| `PI_MEMORY_AGENT_DIR` | `~/.pi/pi-memory-data` | Memory data root |
|
|
250
|
+
| `PI_MEMORY_EMBEDDER` | `hash` | `hash`, `ollama`, or `openai` |
|
|
251
|
+
| `PI_MEMORY_HELPER_MODEL` | `deepseek/deepseek-v4-flash` | Helper model spec for QueryIntent and consolidate |
|
|
252
|
+
| `PI_MEMORY_PREFLIGHT_BUDGET_MS` | `800` | Shared Preflight budget, clamped to 250-1500ms |
|
|
253
|
+
| `PI_MEMORY_INTENT_RETRIES` | `0` | Helper LLM retries after the first attempt |
|
|
254
|
+
| `PI_MEMORY_WARM_SIDECAR` | `1` | Warm sidecar at `session_start` |
|
|
255
|
+
| `PI_MEMORY_INTENT_CACHE` | `1` | Cache QueryIntent per session |
|
|
256
|
+
| `PI_MEMORY_REINDEX_DEBOUNCE_MS` | `500` | Debounce sidecar reindex after writes |
|
|
257
|
+
| `PI_MEMORY_TOP_K` | `3` | Vector recall result count |
|
|
258
|
+
| `PI_MEMORY_MMR_LAMBDA` | `0.8` | MMR relevance/diversity balance |
|
|
259
|
+
| `PI_MEMORY_MIN_RELEVANCE` | `0.4` | Minimum cosine similarity |
|
|
260
|
+
| `PI_MEMORY_CHUNK_MAX_CHARS` | `512` | Split long entries for indexing; `0` disables |
|
|
261
|
+
| `PI_MEMORY_DEBUG` | unset | `1` prints debug timing logs |
|
|
262
|
+
|
|
263
|
+
See [`.env.example`](./.env.example) for the full list.
|
|
264
|
+
|
|
265
|
+
### Embedders
|
|
266
|
+
|
|
267
|
+
| Embedder | Use When | Notes |
|
|
268
|
+
| --- | --- | --- |
|
|
269
|
+
| `hash` | Zero-config local development | Offline, deterministic, lower semantic quality |
|
|
270
|
+
| `ollama` | Local semantic embeddings | Uses `PI_MEMORY_OLLAMA_BASE_URL` and `PI_MEMORY_OLLAMA_EMBED_MODEL` |
|
|
271
|
+
| `openai` | Higher-quality cloud embeddings | Requires `PI_MEMORY_OPENAI_API_KEY` or `OPENAI_API_KEY` |
|
|
272
|
+
|
|
273
|
+
The Vector Index stores embedding provider, model, and dimension metadata. When they change, old chunks are cleared and rebuilt.
|
|
274
|
+
|
|
275
|
+
## Commands
|
|
276
|
+
|
|
277
|
+
Inside Pi:
|
|
278
|
+
|
|
279
|
+
```text
|
|
280
|
+
/remember [section] <content>
|
|
281
|
+
/memory-status [refresh|expand|collapse|hide]
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
CLI:
|
|
82
285
|
|
|
83
286
|
```bash
|
|
84
287
|
pi-memory init
|
|
@@ -88,17 +291,74 @@ pi-memory consolidate --force --verbose
|
|
|
88
291
|
pi-memory drain-shutdown-queue --verbose
|
|
89
292
|
```
|
|
90
293
|
|
|
91
|
-
`maintenance`
|
|
92
|
-
|
|
93
|
-
|
|
294
|
+
`maintenance` is the recommended scheduler entrypoint:
|
|
295
|
+
|
|
296
|
+
```text
|
|
297
|
+
consolidate -> drain-shutdown-queue
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Scheduler templates:
|
|
301
|
+
|
|
302
|
+
- [`templates/com.pi.memory.consolidate.plist.example`](./templates/com.pi.memory.consolidate.plist.example)
|
|
303
|
+
- [`templates/crontab.example`](./templates/crontab.example)
|
|
304
|
+
- [`templates/consolidate.cmd.example`](./templates/consolidate.cmd.example)
|
|
305
|
+
- [`templates/schtasks.example.txt`](./templates/schtasks.example.txt)
|
|
306
|
+
|
|
307
|
+
## Diagnostics
|
|
308
|
+
|
|
309
|
+
Use `/memory-status` or `pi-memory status` to inspect:
|
|
310
|
+
|
|
311
|
+
- memory agent directory
|
|
312
|
+
- `MEMORY.md` line count
|
|
313
|
+
- entry count
|
|
314
|
+
- overflow count
|
|
315
|
+
- last consolidate timestamp
|
|
316
|
+
- sidecar socket status
|
|
317
|
+
- vector index generation and chunk count
|
|
318
|
+
- configured embedder
|
|
319
|
+
- index embedder mismatch
|
|
320
|
+
|
|
321
|
+
Use `PI_MEMORY_DEBUG=1` to log Preflight timings:
|
|
322
|
+
|
|
323
|
+
```json
|
|
324
|
+
{
|
|
325
|
+
"phase": "preflight",
|
|
326
|
+
"event": "recall",
|
|
327
|
+
"intent_ms": 0,
|
|
328
|
+
"intent_skipped": true,
|
|
329
|
+
"intent_cache_hit": false,
|
|
330
|
+
"sidecar_ms": 42,
|
|
331
|
+
"cache_hit": true,
|
|
332
|
+
"total_ms": 45,
|
|
333
|
+
"fallback": false,
|
|
334
|
+
"results": 3
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Non-Goals
|
|
339
|
+
|
|
340
|
+
- Replacing Pi compaction.
|
|
341
|
+
- Replacing session search; use a dedicated session-search extension for old conversations.
|
|
342
|
+
- Maintaining a graph database inside this package.
|
|
343
|
+
- Making the sidecar authoritative.
|
|
344
|
+
- Storing full chat transcripts as memory.
|
|
345
|
+
- Adding multi-second reflection to every user turn.
|
|
346
|
+
|
|
347
|
+
## Development
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
pnpm typecheck
|
|
351
|
+
pnpm test
|
|
352
|
+
pnpm build
|
|
353
|
+
```
|
|
94
354
|
|
|
95
|
-
|
|
355
|
+
The sidecar IPC test opens a Unix domain socket. If it fails with `listen EPERM` inside a restricted sandbox, run the test in a normal local shell.
|
|
96
356
|
|
|
97
357
|
## Docs
|
|
98
358
|
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [UBIQUITOUS_LANGUAGE.md](./UBIQUITOUS_LANGUAGE.md)
|
|
359
|
+
- [Chinese README](./doc/README-zh.md)
|
|
360
|
+
- [Roadmap](./doc/ROADMAP.md)
|
|
361
|
+
- [UBIQUITOUS_LANGUAGE.md](./UBIQUITOUS_LANGUAGE.md) - domain glossary
|
|
102
362
|
|
|
103
363
|
## License
|
|
104
364
|
|
package/dist/config/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { KNOWN_EMBED_DIMS, readPiMemoryEnv, resolveEmbedDim, type EmbedderProvid
|
|
|
2
2
|
export { readRetrievalConfig, type RetrievalConfig } from "./retrieval.js";
|
|
3
3
|
export { readChunkingConfig, type ChunkingConfig } from "./chunking.js";
|
|
4
4
|
export { resolvePreflightBudget, type PreflightBudget } from "./preflightBudget.js";
|
|
5
|
+
export { readPreflightRuntimeConfig, type PreflightRuntimeConfig } from "./preflight.js";
|
|
5
6
|
export { resolveAgentDirFromEnv, resolveMemoryAgentDir, type ResolveMemoryAgentDirOptions } from "./agentDir.js";
|
|
6
7
|
export { loadEnv } from "./loadEnv.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { KNOWN_EMBED_DIMS, readPiMemoryEnv, resolveEmbedDim } from "./env.js";
|
|
|
2
2
|
export { readRetrievalConfig } from "./retrieval.js";
|
|
3
3
|
export { readChunkingConfig } from "./chunking.js";
|
|
4
4
|
export { resolvePreflightBudget } from "./preflightBudget.js";
|
|
5
|
+
export { readPreflightRuntimeConfig } from "./preflight.js";
|
|
5
6
|
export { resolveAgentDirFromEnv, resolveMemoryAgentDir } from "./agentDir.js";
|
|
6
7
|
export { loadEnv } from "./loadEnv.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAA2C,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAuB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAqC,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAA2C,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAuB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAA+B,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAqC,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type PreflightRuntimeConfig = {
|
|
2
|
+
intentRetries: number;
|
|
3
|
+
warmSidecar: boolean;
|
|
4
|
+
intentCache: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** Runtime toggles for preflight latency optimizations. */
|
|
7
|
+
export declare function readPreflightRuntimeConfig(env?: NodeJS.ProcessEnv): PreflightRuntimeConfig;
|
|
8
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/config/preflight.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AASF,2DAA2D;AAC3D,wBAAgB,0BAA0B,CACxC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,sBAAsB,CASxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ENV_KEYS } from "../constants/env.js";
|
|
2
|
+
import { DEFAULT_INTENT_CACHE_ENABLED, DEFAULT_INTENT_RETRIES, DEFAULT_WARM_SIDECAR_ENABLED, MAX_INTENT_RETRIES, } from "../constants/preflight.js";
|
|
3
|
+
function parseOnOff(value, defaultOn) {
|
|
4
|
+
if (value === undefined || value.trim() === "")
|
|
5
|
+
return defaultOn;
|
|
6
|
+
const normalized = value.trim().toLowerCase();
|
|
7
|
+
if (normalized === "0" || normalized === "false" || normalized === "no")
|
|
8
|
+
return false;
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
/** Runtime toggles for preflight latency optimizations. */
|
|
12
|
+
export function readPreflightRuntimeConfig(env = process.env) {
|
|
13
|
+
const retries = Number.parseInt(env[ENV_KEYS.INTENT_RETRIES] ?? String(DEFAULT_INTENT_RETRIES), 10);
|
|
14
|
+
return {
|
|
15
|
+
intentRetries: Number.isFinite(retries)
|
|
16
|
+
? Math.min(Math.max(0, retries), MAX_INTENT_RETRIES)
|
|
17
|
+
: DEFAULT_INTENT_RETRIES,
|
|
18
|
+
warmSidecar: parseOnOff(env[ENV_KEYS.WARM_SIDECAR], DEFAULT_WARM_SIDECAR_ENABLED),
|
|
19
|
+
intentCache: parseOnOff(env[ENV_KEYS.INTENT_CACHE], DEFAULT_INTENT_CACHE_ENABLED),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/config/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAQnC,SAAS,UAAU,CAAC,KAAyB,EAAE,SAAkB;IAC/D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACjE,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,OAAO,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,0BAA0B,CACxC,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;IACpG,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;YACrC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC;YACpD,CAAC,CAAC,sBAAsB;QAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC;QACjF,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC;KAClF,CAAC;AACJ,CAAC"}
|
package/dist/constants/env.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export declare const ENV_KEYS: {
|
|
|
24
24
|
readonly MMR_LAMBDA: "PI_MEMORY_MMR_LAMBDA";
|
|
25
25
|
readonly MIN_RELEVANCE: "PI_MEMORY_MIN_RELEVANCE";
|
|
26
26
|
readonly CHUNK_MAX_CHARS: "PI_MEMORY_CHUNK_MAX_CHARS";
|
|
27
|
+
readonly INTENT_RETRIES: "PI_MEMORY_INTENT_RETRIES";
|
|
28
|
+
readonly WARM_SIDECAR: "PI_MEMORY_WARM_SIDECAR";
|
|
29
|
+
readonly INTENT_CACHE: "PI_MEMORY_INTENT_CACHE";
|
|
27
30
|
readonly AGENT_DIR: "PI_MEMORY_AGENT_DIR";
|
|
28
31
|
readonly ENV_FILE: "PI_MEMORY_ENV_FILE";
|
|
29
32
|
readonly DEBUG: "PI_MEMORY_DEBUG";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/constants/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D,sCAAsC;AACtC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;IAgBnB,oDAAoD
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/constants/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D,sCAAsC;AACtC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;IAgBnB,oDAAoD;;;;;;;;;;;;;;CAc5C,CAAC;AAEX,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,EAAE,gBAAyB,CAAC;AACzD,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAClD,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AACxD,eAAO,MAAM,yBAAyB,+BAAuD,CAAC;AAE9F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnD,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAM,CAAC"}
|
package/dist/constants/env.js
CHANGED
|
@@ -23,6 +23,9 @@ export const ENV_KEYS = {
|
|
|
23
23
|
MMR_LAMBDA: "PI_MEMORY_MMR_LAMBDA",
|
|
24
24
|
MIN_RELEVANCE: "PI_MEMORY_MIN_RELEVANCE",
|
|
25
25
|
CHUNK_MAX_CHARS: "PI_MEMORY_CHUNK_MAX_CHARS",
|
|
26
|
+
INTENT_RETRIES: "PI_MEMORY_INTENT_RETRIES",
|
|
27
|
+
WARM_SIDECAR: "PI_MEMORY_WARM_SIDECAR",
|
|
28
|
+
INTENT_CACHE: "PI_MEMORY_INTENT_CACHE",
|
|
26
29
|
AGENT_DIR: "PI_MEMORY_AGENT_DIR",
|
|
27
30
|
ENV_FILE: "PI_MEMORY_ENV_FILE",
|
|
28
31
|
DEBUG: "PI_MEMORY_DEBUG",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/constants/env.ts"],"names":[],"mappings":"AAEA,sCAAsC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ,EAAE,oBAAoB;IAC9B,SAAS,EAAE,qBAAqB;IAChC,cAAc,EAAE,0BAA0B;I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CAAC;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAChE,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,uBAAuB,IAAI,oBAAoB,EAAE,CAAC;AAE9F,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,wBAAwB,EAAE,IAAI;IAC9B,wBAAwB,EAAE,IAAI;IAC9B,kBAAkB,EAAE,GAAG;IACvB,mBAAmB,EAAE,IAAI;IACzB,YAAY,EAAE,GAAG;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC"}
|
|
@@ -7,4 +7,11 @@ export declare const PRIVATE_MEMORY_CLOSE = "</private_memory>";
|
|
|
7
7
|
export declare const MEMORY_CUE_RE: RegExp;
|
|
8
8
|
export declare const PREFLIGHT_SKIP_MIN_LENGTH = 12;
|
|
9
9
|
export declare const PREFLIGHT_EXTRACT_MIN_LENGTH = 24;
|
|
10
|
+
/** Helper LLM retries after the first attempt (0 = single try). */
|
|
11
|
+
export declare const DEFAULT_INTENT_RETRIES = 0;
|
|
12
|
+
export declare const MAX_INTENT_RETRIES = 3;
|
|
13
|
+
/** Sidecar warm start + intent LRU defaults. */
|
|
14
|
+
export declare const DEFAULT_WARM_SIDECAR_ENABLED = true;
|
|
15
|
+
export declare const DEFAULT_INTENT_CACHE_ENABLED = true;
|
|
16
|
+
export declare const INTENT_CACHE_MAX_ENTRIES = 128;
|
|
10
17
|
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/constants/preflight.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,eAAO,MAAM,4BAA4B,QAAW,CAAC;AAErD,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,mBAAmB,qBAA4B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,sBAA6B,CAAC;AAE/D,qEAAqE;AACrE,eAAO,MAAM,aAAa,QACiF,CAAC;AAE5G,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/constants/preflight.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,eAAO,MAAM,4BAA4B,QAAW,CAAC;AAErD,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,mBAAmB,qBAA4B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,sBAA6B,CAAC;AAE/D,qEAAqE;AACrE,eAAO,MAAM,aAAa,QACiF,CAAC;AAE5G,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,gDAAgD;AAChD,eAAO,MAAM,4BAA4B,OAAO,CAAC;AACjD,eAAO,MAAM,4BAA4B,OAAO,CAAC;AACjD,eAAO,MAAM,wBAAwB,MAAM,CAAC"}
|
|
@@ -7,4 +7,11 @@ export const PRIVATE_MEMORY_CLOSE = `</${PRIVATE_MEMORY_TAG}>`;
|
|
|
7
7
|
export const MEMORY_CUE_RE = /(?:\b(recent|recently|last time|continue|previous|remember|recall|before|earlier)\b|之前|上次|继续|记得|回忆|刚才)/i;
|
|
8
8
|
export const PREFLIGHT_SKIP_MIN_LENGTH = 12;
|
|
9
9
|
export const PREFLIGHT_EXTRACT_MIN_LENGTH = 24;
|
|
10
|
+
/** Helper LLM retries after the first attempt (0 = single try). */
|
|
11
|
+
export const DEFAULT_INTENT_RETRIES = 0;
|
|
12
|
+
export const MAX_INTENT_RETRIES = 3;
|
|
13
|
+
/** Sidecar warm start + intent LRU defaults. */
|
|
14
|
+
export const DEFAULT_WARM_SIDECAR_ENABLED = true;
|
|
15
|
+
export const DEFAULT_INTENT_CACHE_ENABLED = true;
|
|
16
|
+
export const INTENT_CACHE_MAX_ENTRIES = 128;
|
|
10
17
|
//# sourceMappingURL=preflight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/constants/preflight.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,GAAG,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,kBAAkB,GAAG,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,kBAAkB,GAAG,CAAC;AAE/D,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GACxB,yGAAyG,CAAC;AAE5G,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/constants/preflight.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,GAAG,IAAI,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,kBAAkB,GAAG,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,kBAAkB,GAAG,CAAC;AAE/D,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GACxB,yGAAyG,CAAC;AAE5G,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C,mEAAmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,gDAAgD;AAChD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC"}
|
|
@@ -29,6 +29,8 @@ export declare const SIDECAR_FORCE_KILL_DELAY_MS = 5000;
|
|
|
29
29
|
export declare const SIDECAR_PING_TIMEOUT_MS = 1000;
|
|
30
30
|
export declare const SIDECAR_QUERY_TIMEOUT_MS = 3000;
|
|
31
31
|
export declare const SIDECAR_REINDEX_TIMEOUT_MS = 10000;
|
|
32
|
+
/** Warm start dummy query (session_start; not counted against Preflight budget). */
|
|
33
|
+
export declare const SIDECAR_WARMUP_QUERY_TIMEOUT_MS = 500;
|
|
32
34
|
/** proper-lockfile on MEMORY.md. */
|
|
33
35
|
export declare const MEMORY_LOCK_RETRIES = 5;
|
|
34
36
|
export declare const MEMORY_LOCK_MIN_TIMEOUT_MS = 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/constants/timing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAsB,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAC9C,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD,2EAA2E;AAC3E,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/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+CAA+C;AAC/C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,qDAAqD;AACrD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,uDAAuD;AACvD,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AAErD,sEAAsE;AACtE,eAAO,MAAM,qCAAqC,QAAa,CAAC;AAEhE,2CAA2C;AAC3C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,iCAAiC;AACjC,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAC9C,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,mCAAmC;AACnC,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAC9C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,oFAAoF;AACpF,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,oCAAoC;AACpC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,0BAA0B,MAAM,CAAC"}
|
package/dist/constants/timing.js
CHANGED
|
@@ -29,6 +29,8 @@ export const SIDECAR_FORCE_KILL_DELAY_MS = 5_000;
|
|
|
29
29
|
export const SIDECAR_PING_TIMEOUT_MS = 1_000;
|
|
30
30
|
export const SIDECAR_QUERY_TIMEOUT_MS = 3_000;
|
|
31
31
|
export const SIDECAR_REINDEX_TIMEOUT_MS = 10_000;
|
|
32
|
+
/** Warm start dummy query (session_start; not counted against Preflight budget). */
|
|
33
|
+
export const SIDECAR_WARMUP_QUERY_TIMEOUT_MS = 500;
|
|
32
34
|
/** proper-lockfile on MEMORY.md. */
|
|
33
35
|
export const MEMORY_LOCK_RETRIES = 5;
|
|
34
36
|
export const MEMORY_LOCK_MIN_TIMEOUT_MS = 100;
|
|
@@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AmC;AACnC,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AACjD,oFAAoF;AACpF,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,oCAAoC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-extension.d.ts","sourceRoot":"","sources":["../src/pi-extension.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"pi-extension.d.ts","sourceRoot":"","sources":["../src/pi-extension.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AA0HtF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAwKhE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|