pi-observational-memory-extension 0.1.3 → 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/CHANGELOG.md +56 -0
- package/README.md +16 -4
- package/extensions/index.ts +798 -49
- package/package.json +1 -1
- package/scripts/test.mjs +65 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,62 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### 📖 How to Work with This Changelog
|
|
11
|
+
|
|
12
|
+
When preparing a new release:
|
|
13
|
+
1. **Always use Semantic Versioning** (`[Major.Minor.Patch]`).
|
|
14
|
+
2. **Group changes under standard subheadings**:
|
|
15
|
+
- `Added` for new features.
|
|
16
|
+
- `Changed` for changes in existing functionality.
|
|
17
|
+
- `Deprecated` for soon-to-be removed features.
|
|
18
|
+
- `Removed` for now removed features.
|
|
19
|
+
- `Fixed` for any bug fixes.
|
|
20
|
+
- `Security` in case of vulnerabilities or security updates.
|
|
21
|
+
3. **Keep descriptions concise, technical, and objective** (lowcase, founder-builder voice).
|
|
22
|
+
4. **Link references or commit highlights** if appropriate.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [0.2.1] - 2026-06-23
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- **status**: Restored the colored OM footer metrics after reloads and session restarts.
|
|
30
|
+
- **status**: Prevented failed OM states from permanently disabling future observation attempts.
|
|
31
|
+
- **status**: Clamped footer percentages to readable `100%+` overflow instead of noisy `999%` values.
|
|
32
|
+
- **observer**: Forced/block-after observation now processes bounded chunks instead of sending the entire backlog to the Observer.
|
|
33
|
+
- **observer**: Automatically recovers from oversized stale backlogs by retaining the latest tail-window and recording a diagnostic observation.
|
|
34
|
+
- **observer**: Treats empty observer output and stale reload races as non-fatal skips that advance the cursor safely.
|
|
35
|
+
- **ui**: Added resilient status bootstrapping on `session_start`, `agent_start`, and `turn_start`.
|
|
36
|
+
- **recovery**: Shows an explicit OM footer error if state recovery fails instead of leaving the status area empty.
|
|
37
|
+
- **recovery**: Removed stdout/stderr recovery logging so internal extension diagnostics do not leak into chat transcripts.
|
|
38
|
+
|
|
39
|
+
## [0.2.0] - 2026-06-23
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- **retrieval**: Added vector retrieval for observations before context injection.
|
|
43
|
+
- **retrieval**: Added local hash/BOW retrieval as the default offline provider.
|
|
44
|
+
- **retrieval**: Added configurable Gemini embedding retrieval with `gemini-embedding-001`.
|
|
45
|
+
- **scope**: Added `session` and `project` memory scopes with separate durable storage paths.
|
|
46
|
+
- **attachments**: Added `auto`, `on`, and `off` attachment observation modes with image and size safeguards.
|
|
47
|
+
- **caveman**: Replaced the simplified terse mode with Mastra-style caveman compression instructions.
|
|
48
|
+
- **dedupe**: Added exact-hash and similarity-based duplicate suppression before appending observations.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- **state**: Migrated OM state schema to v3 for retrieval, vectors, attachment modes, and scoped storage.
|
|
52
|
+
- **settings**: Extended `/om set` with `scope`, `retrieval`, `retrieval-model`, `retrieval-top-k`, and `retrieval-threshold`.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- **state**: Resolved JSON state file corruption caused by running regex redactions after serialization.
|
|
56
|
+
- **redaction**: Refined token/secret sanitization to avoid over-redacting non-sensitive metrics (e.g., `observationTokens`).
|
|
57
|
+
- **scope**: Added durable session pointer resolution, ensuring project scope selection persists across separate run processes.
|
|
58
|
+
- **durability**: Added automatic `.corrupted` rename recovery for unparseable state files instead of crashing.
|
|
59
|
+
|
|
60
|
+
### Tested
|
|
61
|
+
- **regression**: Added tests for scope settings, attachment gates, duplicate suppression, and local retrieval.
|
|
62
|
+
- **provider**: Smoke-tested Gemini embeddings against `gemini-embedding-001` with valid 3072-dimensional normalized vectors.
|
|
63
|
+
|
|
8
64
|
## [0.1.3] - 2026-06-23
|
|
9
65
|
|
|
10
66
|
### Added
|
package/README.md
CHANGED
|
@@ -25,9 +25,13 @@ Legacy compaction compresses raw history into a single monolithic block of text,
|
|
|
25
25
|
- **Async Buffering:** Extracts observations in the background at regular intervals (every 20% of the threshold) so that when the main threshold is hit, the accumulated memory is swapped/activated instantly with zero LLM-latency overhead.
|
|
26
26
|
- **Adaptive Thresholds:** The active message-observation threshold expands dynamically based on remaining memory capacity in the reflection pool, maximizing raw context usage safely.
|
|
27
27
|
- **Recall-driven Retrieval:** Exposes an `om_recall` tool to the Actor so it can retrieve full, raw message payloads from observed history when exact code, quotes, or numbers are needed.
|
|
28
|
+
- **Vector Retrieval:** Ranks relevant observations before context injection. Local hash/BOW retrieval is enabled by default; Gemini embeddings (`gemini-embedding-001`) are available through `/om set retrieval gemini`.
|
|
29
|
+
- **Session or Project Scope:** Stores memory either per session head or shared project memory via `/om set scope session|project`.
|
|
30
|
+
- **Attachment Observation Modes:** Supports `auto`, `on`, and `off` with image-only auto mode and size limits to avoid unsafe prompt bloat.
|
|
31
|
+
- **Duplicate Suppression:** Skips exact and near-duplicate observations before appending new memory.
|
|
28
32
|
- **Custom Compaction Hook:** Plugs directly into Pi's `session_before_compact` lifecycle event. Typing `/compact` or triggering auto-compaction launches the Observer/Reflector memory consolidation flow instead of Pi's legacy summary compaction.
|
|
29
33
|
- **TUI Overlay Panel:** Fully custom, responsive, multi-tab overlay (`/om-memory`) in interactive mode for inspecting memory. Features tabbed navigation, smooth scroll, and precise border framing.
|
|
30
|
-
- **Durable Persistence:** Serializes and loads state files safely under `.pi/om/<session-id>.json` using atomic writes and `.bak` recovery. Outputs JSON-formatted diagnostic logs to `.pi/om/debug/` for every operation.
|
|
34
|
+
- **Durable Persistence:** Serializes and loads state files safely under `.pi/om/sessions/<session-id>.json` or `.pi/om/projects/project.json` using atomic writes and `.bak` recovery. Outputs JSON-formatted diagnostic logs to `.pi/om/debug/` for every operation.
|
|
31
35
|
- **Secret Redaction:** Redacts common API keys, npm/GitHub tokens, bearer tokens, passwords, and secret fields before writing state/debug artifacts or observer text.
|
|
32
36
|
- **Stale Lock Recovery:** Recovers old interrupted OM operation locks automatically so a crashed or killed process does not block future memory runs.
|
|
33
37
|
- **Bounded Observer Context:** Sends only a safe tail of previous observations to the Observer, preventing recursive prompt bloat while preserving full memory in the main runtime.
|
|
@@ -36,7 +40,7 @@ Legacy compaction compresses raw history into a single monolithic block of text,
|
|
|
36
40
|
|
|
37
41
|
## 📋 Configuration & Settings
|
|
38
42
|
|
|
39
|
-
Use `/om` in Pi to inspect and update runtime settings. Settings are persisted in the
|
|
43
|
+
Use `/om` in Pi to inspect and update runtime settings. Settings are persisted in the OM state file under `.pi/om/sessions/<session-id>.json` or `.pi/om/projects/project.json`.
|
|
40
44
|
|
|
41
45
|
```bash
|
|
42
46
|
/om
|
|
@@ -48,7 +52,13 @@ Use `/om` in Pi to inspect and update runtime settings. Settings are persisted i
|
|
|
48
52
|
/om set observation-model google/gemini-2.5-flash
|
|
49
53
|
/om set reflection-model google/gemini-2.5-flash
|
|
50
54
|
/om set caveman on
|
|
51
|
-
/om set attachments
|
|
55
|
+
/om set attachments auto
|
|
56
|
+
/om set scope project
|
|
57
|
+
/om set retrieval local
|
|
58
|
+
/om set retrieval gemini
|
|
59
|
+
/om set retrieval-model gemini-embedding-001
|
|
60
|
+
/om set retrieval-top-k 6
|
|
61
|
+
/om set retrieval-threshold 12%
|
|
52
62
|
/om reset
|
|
53
63
|
```
|
|
54
64
|
|
|
@@ -56,7 +66,9 @@ Use `/om` in Pi to inspect and update runtime settings. Settings are persisted i
|
|
|
56
66
|
- **Reflection Trigger Threshold:** default `40,000` observation tokens.
|
|
57
67
|
- **Default Models:** `google/gemini-2.5-flash` with 0.3 temperature for Observer, and 0.0 temperature for Reflector.
|
|
58
68
|
- **Caveman Mode:** optional terse compression style for denser memory.
|
|
59
|
-
- **Attachment Observation
|
|
69
|
+
- **Attachment Observation Mode:** `auto` observes small images only, `on` allows supported attachments, and `off` omits them.
|
|
70
|
+
- **Scope:** `session` keeps each session isolated; `project` shares one memory file for the current project.
|
|
71
|
+
- **Retrieval:** `local` is the default and works offline; `gemini` uses Gemini embeddings when `GEMINI_API_KEY` or `GOOGLE_GENERATIVE_AI_API_KEY` is available; `off` disables vector retrieval.
|
|
60
72
|
|
|
61
73
|
---
|
|
62
74
|
|