@alisio/plugin-memory 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +69 -9
- package/dist/index.js +2 -1
- package/dist/version.d.ts +8 -0
- package/dist/version.js +28 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,14 +1,74 @@
|
|
|
1
1
|
# @alisio/plugin-memory
|
|
2
2
|
|
|
3
|
-
Engram-style persistent memory for [Alisio](https://github.com/GustavoGutierrez/alisio)
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
**Engram-style persistent memory for [Alisio](https://github.com/GustavoGutierrez/alisio).** The
|
|
4
|
+
model saves decisions, bug fixes and discoveries across sessions, and recalls them with context;
|
|
5
|
+
compaction and session end turn meetings into structured, searchable memory.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Tools: `memory_save`, `memory_search`, `memory_get`, `memory_context`, `memory_timeline`, `memory_pin`, `memory_forget`.
|
|
9
|
-
- Memory-aware compaction: extracts observations in the same summarizer call, archives the checkpoint
|
|
10
|
-
and injects budgeted recall; session summaries on exit; `/memory` command.
|
|
7
|
+
## What it is
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Shipped as a built-in plugin of the `alisio` CLI (disable with `--disable-plugin memory` or
|
|
10
|
+
`builtinPlugins.memory.enabled: false`). It depends only on `@alisio/sdk` and stores data through
|
|
11
|
+
the SDK storage port — a local SQLite database with FTS5 trigram indexing, BM25 ranking combined
|
|
12
|
+
with recency; no embeddings and no network. The file lives at `<state home>/memory.sqlite` with
|
|
13
|
+
0600 permissions.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Preinstalled in the `alisio` CLI. For an embedded host, register it through `createApplication`'s
|
|
18
|
+
`builtins` list (the CLI wires it for you).
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
21
|
+
|
|
22
|
+
| Tool | Purpose |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `memory_save` | Save or upsert an observation |
|
|
25
|
+
| `memory_search` | Full-text search; AND by default, `match: "any"` and `all_projects` available |
|
|
26
|
+
| `memory_get` | Full observation by ID |
|
|
27
|
+
| `memory_context` | Recent memory context (summaries, prompts, pinned, recent) |
|
|
28
|
+
| `memory_timeline` | Chronological neighbours of a memory within a session |
|
|
29
|
+
| `memory_pin` | Pin (or unpin) a memory so it always appears in memory context |
|
|
30
|
+
| `memory_forget` | Soft delete; `hard: true` removes it permanently |
|
|
31
|
+
|
|
32
|
+
An observation has a title, a type (`decision`, `bugfix`, `discovery`, `pattern`, `architecture`,
|
|
33
|
+
`config`, `preference`, `learning`), a **What / Why / Where / Learned** body, a `project` or
|
|
34
|
+
`personal` scope and an optional `topic_key` for upserts. All memory tools use the `internal`
|
|
35
|
+
effect: they only touch the memory database, never the workspace, so they stay available under
|
|
36
|
+
`--read-only`.
|
|
37
|
+
|
|
38
|
+
## Behaviour
|
|
39
|
+
|
|
40
|
+
- **Memory-aware compaction** — in the same summarizer call, observations are extracted from the
|
|
41
|
+
discarded span (with upsert/dedup), the checkpoint is archived as the session summary, and
|
|
42
|
+
relevant memories are injected within a token budget.
|
|
43
|
+
- **Session summaries** — on `/clear`, `/exit` or quitting the TUI, writes a structured
|
|
44
|
+
Goal/Instructions/Discoveries/Accomplished/Next Steps/Relevant Files summary (option
|
|
45
|
+
`autoSummary`, on by default).
|
|
46
|
+
- **`/memory` command** — `/memory` (recent), `/memory <query>`, and
|
|
47
|
+
`/memory show|forget|pin|unpin <id>`; a `mem N` counter in the TUI status bar.
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
Under `builtinPlugins.memory`:
|
|
52
|
+
|
|
53
|
+
| Field | Default | Description |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `enabled` | `true` | Enable the plugin |
|
|
56
|
+
| `dbPath` | `<state home>/memory.sqlite` | Database path; relative paths resolve from the config file |
|
|
57
|
+
| `injectBudgetTokens` | `1500` | Token budget (100–20000) for injected memory context |
|
|
58
|
+
| `recallLimit` | `8` | Memories recalled after compaction (0–20) |
|
|
59
|
+
| `autoSummary` | `true` | Write a session summary on session end |
|
|
60
|
+
| `defaultScope` | `project` | `project` or `personal` |
|
|
61
|
+
|
|
62
|
+
## Docs
|
|
63
|
+
|
|
64
|
+
[Memory plugin](https://gustavogutierrez.github.io/alisio/memory) ·
|
|
65
|
+
[Configuration](https://gustavogutierrez.github.io/alisio/configuration).
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
|
|
69
|
+
Node.js **>= 22.16** or Bun **>= 1.4.2**.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT. Maintained by Gustavo Gutiérrez Mercado. Source: <https://github.com/GustavoGutierrez/alisio> ·
|
|
74
|
+
npm: <https://www.npmjs.com/settings/alisio/packages>.
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { memoryConfigSchema } from "./config.js";
|
|
|
8
8
|
import { COMPACTION_GUIDANCE, formatObservation, MEMORY_PROTOCOL, memoryLine, OBSERVATIONS_FIELD, parseObservations, parseSessionSummary, renderInjection, SESSION_SUMMARY_SYSTEM, } from "./format.js";
|
|
9
9
|
import { projectId, SQLiteMemoryStore } from "./store.js";
|
|
10
10
|
import { memoryContextText, memoryTools } from "./tools.js";
|
|
11
|
+
import { loadVersion } from "./version.js";
|
|
11
12
|
const userTexts = (messages) => messages.flatMap((m) => (m.role === "user" && !m.summary && m.text.trim() ? [m.text] : []));
|
|
12
13
|
function transcript(messages, maxChars = 60_000) {
|
|
13
14
|
const lines = messages.map((m) => m.role === "user"
|
|
@@ -43,7 +44,7 @@ export function createMemoryPlugin(rawOptions, context) {
|
|
|
43
44
|
id: "memory",
|
|
44
45
|
name: "Memory",
|
|
45
46
|
description: "Persistent memory and memory-aware context compaction",
|
|
46
|
-
version:
|
|
47
|
+
version: loadVersion(import.meta.url),
|
|
47
48
|
apiVersion: 1,
|
|
48
49
|
async setup(api) {
|
|
49
50
|
const project = await projectId(context.workspace);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads this plugin package's version at runtime so plugin metadata, user-agent defaults and CLI
|
|
3
|
+
* reports stay in sync with the published package without a build-time constant to update.
|
|
4
|
+
* The manifest is resolved relative to the module (`src/version.ts` → `../package.json` in the
|
|
5
|
+
* source tree; `dist/version.js` → `../package.json` of the installed package). Standalone
|
|
6
|
+
* binaries inject the version at build time via ALISIO_PACKAGE_VERSION (scripts/binary-build.ts).
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadVersion(fromHere: string): string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* Fallback used when neither the build-time injection nor the package manifest is readable
|
|
6
|
+
* (e.g. an unpackaged embed). Keep it a development marker, never a publish literal, so it
|
|
7
|
+
* cannot silently desync from the published package.
|
|
8
|
+
*/
|
|
9
|
+
const FALLBACK = "dev";
|
|
10
|
+
/**
|
|
11
|
+
* Reads this plugin package's version at runtime so plugin metadata, user-agent defaults and CLI
|
|
12
|
+
* reports stay in sync with the published package without a build-time constant to update.
|
|
13
|
+
* The manifest is resolved relative to the module (`src/version.ts` → `../package.json` in the
|
|
14
|
+
* source tree; `dist/version.js` → `../package.json` of the installed package). Standalone
|
|
15
|
+
* binaries inject the version at build time via ALISIO_PACKAGE_VERSION (scripts/binary-build.ts).
|
|
16
|
+
*/
|
|
17
|
+
export function loadVersion(fromHere) {
|
|
18
|
+
if (process.env.ALISIO_PACKAGE_VERSION)
|
|
19
|
+
return process.env.ALISIO_PACKAGE_VERSION;
|
|
20
|
+
try {
|
|
21
|
+
const manifest = join(dirname(fileURLToPath(fromHere)), "..", "package.json");
|
|
22
|
+
const parsed = JSON.parse(readFileSync(manifest, "utf8"));
|
|
23
|
+
return typeof parsed.version === "string" && parsed.version ? parsed.version : FALLBACK;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return FALLBACK;
|
|
27
|
+
}
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/plugin-memory",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Engram-style persistent memory for Alisio: SQLite FTS5 observations with topic-key upserts, memory-aware compaction, session summaries and recall tools. Built-in, disableable plugin.",
|
|
5
5
|
"author": "Gustavo Gutiérrez",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"zod": "4.6.5"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@alisio/sdk": "^0.1.0-alpha.
|
|
49
|
+
"@alisio/sdk": "^0.1.0-alpha.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@alisio/sdk": "0.1.0-alpha.
|
|
52
|
+
"@alisio/sdk": "0.1.0-alpha.7"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public",
|