feat(memory): add memory extension with core functionality and tests

- Implemented MemoryStore class for managing concepts with YAML frontmatter.
- Added methods for creating, reading, updating, and deleting concepts.
- Introduced locking mechanism for concurrent access.
- Developed search and hinting capabilities for concept retrieval.
- Created tests for access control and store functionality.
- Added long-term memory skill documentation and operational guidelines.
- Included package.json and package-lock.json for dependency management.
This commit is contained in:
syntaxbullet
2026-07-23 20:35:08 +02:00
parent 212af9301e
commit 91e5f44cc8
13 changed files with 1333 additions and 4 deletions

View File

@@ -4,7 +4,13 @@ This directory is the user/config directory for an isolated [Pi coding agent](ht
## Start Pi
From this directory:
Install the memory extension's pinned YAML parser after cloning:
```bash
npm ci --prefix extensions/memory
```
Then start from this directory:
```bash
./launch
@@ -46,8 +52,9 @@ Or use provider API-key environment variables before starting Pi. `auth.json`, t
- `settings.json` — instance-wide Pi settings
- `models.json` — custom providers/models
- `keybindings.json` — keybinding overrides
- `extensions/` — global extensions for this instance
- `skills/` — global skills for this instance
- `extensions/` — global extensions for this instance, including deterministic OKF memory tools
- `skills/` — global skills for this instance, including progressively disclosed memory guidance
- `memory/` — the human-readable OKF long-term-memory bundle
- `prompts/` — global prompt templates for this instance
- `themes/` — global themes for this instance
- `sessions/` — generated conversation history
@@ -62,6 +69,24 @@ Install a package into only this instance by using the launcher:
./launch list
```
## Long-term memory
Kimiko stores durable memory as an OKF v0.1 bundle in `memory/`. It is ignored by Git by default because it may contain personal data; remove that ignore rule only after choosing an explicit private backup/versioning policy. Each user turn resets detailed memory tools. Explicit memory language reveals them for that turn so the model can see the capability; otherwise `memory_search` progressively enables them. Conservative metadata hints may be added to that turn's system prompt, but are never written to session history and disappear on the next turn. Existing concepts cannot be updated or forgotten until they have been returned by search and read in the same turn. The extension owns frontmatter, timestamps, path validation, generated indexes, logs, locking, atomic writes, verification, repair, and one retry. The model supplies only semantic content.
```text
/memory-path Show the bundle location
/memory-check Validate without changing concepts
/memory-check --repair Repair structure and regenerate indexes
```
Run the deterministic store tests with:
```bash
npm test --prefix extensions/memory
```
See [`docs/memory-design.md`](docs/memory-design.md) for scope, tradeoffs, and staged production improvements.
## Isolation boundary
`PI_CODING_AGENT_DIR` isolates Pi's user config, credentials, sessions, model config, and managed packages from `~/.pi/agent`. It is not an OS sandbox. Pi can still use inherited environment variables and shell/user configuration, and—when trusted—load project-local `.pi` resources. Pi also discovers the cross-agent global skill location `~/.agents/skills`; use `--no-skills` when you need to suppress all automatic skill discovery for a run.