@henryqw/pi-memory 0.2.2 → 1.0.0

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 CHANGED
@@ -28,7 +28,7 @@ To inspect live state, read `<directory>/MEMORY.md`.
28
28
 
29
29
  ## Config
30
30
 
31
- `~/.pi/agent/config/pi-memory.json`
31
+ `~/.pi/agent/config/pi-memory/config.json`
32
32
 
33
33
  ```json
34
34
  {
@@ -38,7 +38,7 @@ To inspect live state, read `<directory>/MEMORY.md`.
38
38
  }
39
39
  ```
40
40
 
41
- - `directory`: absolute path where `MEMORY.md` and `USER.md` live. Required only when overriding the default (`~/.pi/agent/memory`). Point it at an iCloud- or Obsidian-synced folder to sync across machines.
41
+ - `directory`: absolute path where `MEMORY.md` and `USER.md` live. Required only when overriding the default (`~/.pi/agent/config/pi-memory/memory`). Point it at an iCloud- or Obsidian-synced folder to sync across machines.
42
42
  - `memoryCharLimit` / `userCharLimit`: positive integers, maximum 100000.
43
43
 
44
44
  Invalid configuration fails fast; malformed config files are never rewritten.
@@ -47,7 +47,7 @@ Invalid configuration fails fast; malformed config files are never rewritten.
47
47
 
48
48
  Point `directory` at an iCloud Drive or Obsidian-vault-synced folder. The synced vault acts as a dumb sync pipe: pi-memory owns the file format and treats the remote as opaque storage, so no merge logic runs on the Pi side.
49
49
 
50
- Backups and the lock file live outside `directory`, under `~/.pi/agent/backups/pi-memory/`.
50
+ Backups and the lock file live outside `directory`, under `~/.pi/agent/config/pi-memory/backups/`.
51
51
 
52
52
  ## Threat model
53
53
 
@@ -5,13 +5,13 @@ import { getAgentDir, withFileMutationQueue, type ExtensionAPI } from "@earendil
5
5
  import { Text } from "@earendil-works/pi-tui";
6
6
  import { lock } from "proper-lockfile";
7
7
  import { Type } from "typebox";
8
- import { loadMemoryConfig, type MemoryConfig } from "../src/config.ts";
8
+ import { configPath, loadMemoryConfig, type MemoryConfig } from "../src/config.ts";
9
9
  import { ENTRY_DELIMITER, MemoryStore, type Target } from "../src/store.ts";
10
10
 
11
11
  const SEPARATOR = "═".repeat(46);
12
12
  // Backups and the lock file live OUTSIDE config.directory (which may be
13
13
  // iCloud-synced) so the memory dir holds exactly MEMORY.md and USER.md (ADR 005).
14
- const BACKUP_DIR = () => join(getAgentDir(), "backups", "pi-memory");
14
+ const BACKUP_DIR = () => join(getAgentDir(), "config", "pi-memory", "backups");
15
15
  // Defense-in-depth against snapshot frame spoofing by poisoned on-disk entries.
16
16
  const FRAME_TOKEN_LINE = /^\s*(?:═{3,}|MEMORY \(your personal notes|USER PROFILE \(who the user is)/;
17
17
  const FRAME_TOKEN_REPLACEMENT = "[filtered frame token]";
@@ -271,7 +271,7 @@ export default function memoryExtension(pi: ExtensionAPI): void {
271
271
  // Failed init stays visible every turn (correctness-critical config must
272
272
  // not vanish silently) but as a warning line, not a per-turn throw-loop.
273
273
  if (state.initError) {
274
- return { systemPrompt: `${event.systemPrompt}\n\nWARNING: persistent memory is DISABLED this session — initialization failed: ${sanitizeName(state.initError)} Fix config/pi-memory.json and restart.` };
274
+ return { systemPrompt: `${event.systemPrompt}\n\nWARNING: persistent memory is DISABLED this session — initialization failed: ${sanitizeName(state.initError)} Fix ${configPath()} and restart.` };
275
275
  }
276
276
  if (!state.config || !state.stores || !state.snapshotBlocks) return;
277
277
  const blocks = [...state.snapshotBlocks, ...state.conflictWarnings].filter(Boolean).join("\n\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-memory",
3
- "version": "0.2.2",
3
+ "version": "1.0.0",
4
4
  "description": "Auto-managed markdown memory for Pi: capped MEMORY.md/USER.md entry stores with frozen session snapshots.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/config.ts CHANGED
@@ -2,8 +2,9 @@ import { readFileSync } from "node:fs";
2
2
  import { isAbsolute, join } from "node:path";
3
3
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
4
4
 
5
- // Repository-mandated single-extension config path boundary (root AGENTS.md).
6
- export const configPath = () => join(getAgentDir(), "config", "pi-memory.json");
5
+ // Repository-mandated extension config directory boundary (root AGENTS.md):
6
+ // all pi-memory state lives under config/pi-memory/.
7
+ export const configPath = () => join(getAgentDir(), "config", "pi-memory", "config.json");
7
8
 
8
9
  export interface MemoryConfig {
9
10
  directory: string;
@@ -12,7 +13,7 @@ export interface MemoryConfig {
12
13
  }
13
14
 
14
15
  export function DEFAULT_DIRECTORY(): string {
15
- return join(getAgentDir(), "memory");
16
+ return join(getAgentDir(), "config", "pi-memory", "memory");
16
17
  }
17
18
 
18
19
  export const DEFAULT_MEMORY_CHAR_LIMIT = 8800;