brain-memory 0.1.0-beta.15 → 0.1.0-beta.16
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 +74 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,8 @@ Existing AI memory solutions use flat databases with tag-based retrieval. Brain
|
|
|
44
44
|
- **Context-dependent recall** — Memories encoded in a similar context to the current session are scored higher
|
|
45
45
|
- **Spaced reinforcement** — Memories recalled after longer intervals get bigger boosts, cramming produces diminishing returns
|
|
46
46
|
- **Cognitive types** — Episodic, semantic, and procedural memories each decay differently, just like in the brain
|
|
47
|
+
- **Always-present knowledge** — Pin critical conventions and preferences so they load every session, bypassing recall and never decaying — the facts your agent must never miss
|
|
48
|
+
- **Procedural skills** — Reusable how-to workflows with progressive disclosure, learned automatically from repeated experience and exportable to your agent's native skills
|
|
47
49
|
- **On-demand depth** — Subcategories are created as needed, not pre-defined
|
|
48
50
|
- **Consolidation** — Weak related memories merge into stronger combined knowledge
|
|
49
51
|
- **Zero dependencies** — Pure file I/O, no databases, no servers, no embeddings required
|
|
@@ -78,6 +80,8 @@ brain update
|
|
|
78
80
|
|
|
79
81
|
The first command updates the package and the `brain` CLI. The second command refreshes the slash command prompts for your installed runtimes. Target specific runtimes with `--claude`, `--gemini`, `--openai`, or `--all`.
|
|
80
82
|
|
|
83
|
+
> **Upgrading from an older version?** The separate binaries (`brain-recall`, `brain-memorize`, `brain-reinforce`, `brain-cloud`, `brain-memory`) were unified into a single `brain` dispatcher — use `brain recall`, `brain memorize`, `brain reinforce`, `brain cloud <…>` instead. Run `brain update` to refresh your runtime prompts to the new command surface.
|
|
84
|
+
|
|
81
85
|
> **Why not `npx`?** `npx` runs the setup wizard in a temporary directory that is discarded after execution. The `brain` CLI (`brain recall`, `brain memorize`, `brain reinforce`) won't be available in your PATH, which means agents will fall back to less reliable manual file operations. Always use `npm install -g` to ensure everything works correctly.
|
|
82
86
|
|
|
83
87
|
### Uninstall
|
|
@@ -120,6 +124,8 @@ Then append the contents of the corresponding prompt file to your agent's instru
|
|
|
120
124
|
| `/brain:init` | Initialize `~/.brain/` directory structure with default categories |
|
|
121
125
|
| `/brain:memorize [topic] [--sync]` | Store memories from current session context (add `--sync` to auto-push) |
|
|
122
126
|
| `/brain:remember [query]` | Recall relevant memories with spreading activation and context matching |
|
|
127
|
+
| `/brain:pin [id\|query]` | Pin a memory to the always-present tier — loads every session, never decays |
|
|
128
|
+
| `/brain:unpin [id\|query]` | Remove a memory from the always-present tier |
|
|
123
129
|
| `/brain:review [scope]` | Spaced repetition review session for due memories |
|
|
124
130
|
| `/brain:explore [category]` | Browse the brain hierarchy with visual tree view |
|
|
125
131
|
| `/brain:consolidate [scope]` | Merge related weak memories into stronger combined ones |
|
|
@@ -127,6 +133,7 @@ Then append the contents of the corresponding prompt file to your agent's instru
|
|
|
127
133
|
| `/brain:sunshine [target]` | Deep forensic erasure — trace and remove all references |
|
|
128
134
|
| `/brain:sleep [scope]` | Full maintenance cycle — 9 neuroscience-inspired phases |
|
|
129
135
|
| `/brain:status` | Dashboard with brain health metrics and recommendations |
|
|
136
|
+
| `/brain:skill [list\|show\|add\|use\|remove\|export]` | Manage procedural skills — reusable how-to workflows with progressive disclosure |
|
|
130
137
|
| `/brain:sync [subcommand]` | Sync memories via Git remote or export/import for portability |
|
|
131
138
|
|
|
132
139
|
## Session Lifecycle
|
|
@@ -135,18 +142,19 @@ Brain Memory works automatically in the background — no commands needed for ba
|
|
|
135
142
|
|
|
136
143
|
### Session Start
|
|
137
144
|
|
|
138
|
-
When a session begins and `~/.brain/` exists, the agent
|
|
145
|
+
When a session begins and `~/.brain/` exists, the agent makes a single `brain session-start` call. This aggregator returns one deterministic, **token-budget-bounded** payload so the brain can never bloat the context window (the budget lives in `~/.brain/config.json`):
|
|
139
146
|
|
|
140
|
-
1.
|
|
141
|
-
2.
|
|
142
|
-
3.
|
|
147
|
+
1. **Pinned memories** — always-present conventions and preferences, injected verbatim regardless of recall score
|
|
148
|
+
2. **Skills index** — the name + description of each available procedural skill (~100 tokens each; full instructions are loaded only when a task matches)
|
|
149
|
+
3. **Context recall** — the top memories relevant to the current project
|
|
150
|
+
4. **Review queue + low-confidence alerts**, then a brief status line:
|
|
143
151
|
|
|
144
152
|
```
|
|
145
153
|
🧠 Brain active — 42 memories loaded (8 in current project context)
|
|
146
154
|
📋 3 memories due for review — run /brain:review
|
|
147
155
|
```
|
|
148
156
|
|
|
149
|
-
The agent silently internalizes relevant memories and references them naturally during the session — no information dump.
|
|
157
|
+
The agent treats pinned facts as active constraints, notes which skills exist, silently internalizes relevant memories, and references them naturally during the session — no information dump.
|
|
150
158
|
|
|
151
159
|
### Ambient Session Tracking
|
|
152
160
|
|
|
@@ -240,6 +248,38 @@ Each memory is also classified by how the brain processes it:
|
|
|
240
248
|
|
|
241
249
|
During sleep, frequently-recalled episodic memories are **crystallized** into semantic memories — the specific event fades but the lesson persists. This mirrors how humans extract general principles from repeated experiences.
|
|
242
250
|
|
|
251
|
+
### Always-Present Memories (Pinning)
|
|
252
|
+
|
|
253
|
+
Recall is probabilistic — a stored preference only applies if scoring happens to surface it. For the facts an agent must **never** miss (coding conventions, standing decisions, hard constraints), that's not good enough. Pinning fixes it:
|
|
254
|
+
|
|
255
|
+
- **`pinned`** — the memory is injected at **every** session start regardless of recall score, and is **decay-exempt** (it never fades). Scope it `global` (loads everywhere) or `project:<name>` (loads only in that project).
|
|
256
|
+
- **`stable`** — an independent flag that exempts a memory from decay and pruning **without** forcing it to always load — for timeless facts you recall on demand but don't want to fade.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
brain pin <id> --scope global --priority 1 # or: /brain:pin always use tabs
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Pinned and stable memories are skipped by sleep-cycle homeostasis and pruning, and `/brain:memorize` proactively proposes pinning durable conventions. The always-present set is budget-capped (`pin_budget_tokens`) so it can't crowd out the context window. This maps cleanly to the **semantic memory** type in the [CoALA](https://arxiv.org/abs/2309.02427) agent-memory model — knowledge that is always in context — decomposed into two orthogonal properties (always-loaded vs. non-decaying).
|
|
263
|
+
|
|
264
|
+
### Procedural Skills
|
|
265
|
+
|
|
266
|
+
Procedural memory is *how* to do things — reusable, step-by-step workflows stored as `~/.brain/_skills/<name>/SKILL.md`. To keep them from flooding the context window, skills use **three-level progressive disclosure**:
|
|
267
|
+
|
|
268
|
+
| Level | When | What loads |
|
|
269
|
+
|-------|------|------------|
|
|
270
|
+
| **L0** | Every session start | Only each skill's name + description (~100 tokens) |
|
|
271
|
+
| **L1** | A task matches a skill | The full `SKILL.md` step-by-step instructions |
|
|
272
|
+
| **L2** | A step needs them | Referenced `resources/` (templates, scripts) |
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
brain skill list # advertised skills (L0)
|
|
276
|
+
brain skill show structured-code-review # full instructions (L1)
|
|
277
|
+
brain skill use structured-code-review # record outcome (--failed weakens it)
|
|
278
|
+
brain skill export structured-code-review --target claude # → native .claude/skills/
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Skills strengthen on successful `use` and weaken on `--failed` — one that fails too often demotes itself out of the advertised L0 index. And they aren't only hand-authored: during sleep, Brain **crystallizes** recurring task-solving patterns from repeated experience into new skills (user-confirmed). Finally, `brain skill export` emits a skill in your agent's **native** format so it becomes directly executable.
|
|
282
|
+
|
|
243
283
|
### Memory File Format
|
|
244
284
|
|
|
245
285
|
Each memory is a Markdown file with YAML frontmatter:
|
|
@@ -442,9 +482,16 @@ Sync state is stored locally in `~/.brain/.sync/` and is never pushed to the rem
|
|
|
442
482
|
```
|
|
443
483
|
~/.brain/
|
|
444
484
|
├── index.json # Memory inventory — fast lookup for all memories
|
|
485
|
+
├── config.json # Working-memory token budgets (session-start injection)
|
|
445
486
|
├── associations.json # Weighted associative network between memories
|
|
446
487
|
├── contexts.json # Session context snapshots for context-dependent recall
|
|
447
488
|
├── review-queue.json # Spaced repetition scheduling
|
|
489
|
+
├── pinned.json # Always-present tier manifest (pinned memory IDs + scope)
|
|
490
|
+
├── skills-index.json # Advertised procedural skills (L0 — name + description)
|
|
491
|
+
├── _skills/ # Procedural skills
|
|
492
|
+
│ └── <skill-name>/
|
|
493
|
+
│ ├── SKILL.md # Advertised description + step-by-step instructions
|
|
494
|
+
│ └── resources/ # Optional templates/scripts (loaded only at execution)
|
|
448
495
|
├── professional/ # Work, career, technical skills
|
|
449
496
|
│ ├── _meta.json # Category metadata and stats
|
|
450
497
|
│ ├── _expertise.md # Generated expertise profile
|
|
@@ -515,6 +562,28 @@ Brain configuration lives in `~/.brain/index.json` under the `config` key:
|
|
|
515
562
|
| `association_config.spreading_activation_depth` | 2 | Maximum hops for spreading activation traversal |
|
|
516
563
|
| `association_config.spreading_activation_decay` | 0.5 | Decay factor per hop during spreading activation |
|
|
517
564
|
|
|
565
|
+
### Working-Memory Budget
|
|
566
|
+
|
|
567
|
+
A separate `~/.brain/config.json` (created lazily with safe defaults) caps how much the brain injects into the context window at session start, so the always-present tier can never crowd out your actual work:
|
|
568
|
+
|
|
569
|
+
```json
|
|
570
|
+
{
|
|
571
|
+
"working_memory_budget_tokens": 3000,
|
|
572
|
+
"pin_budget_tokens": 1500,
|
|
573
|
+
"skills_index_budget_tokens": 800,
|
|
574
|
+
"recall_budget_tokens": 700
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
| Setting | Default | Description |
|
|
579
|
+
|---------|---------|-------------|
|
|
580
|
+
| `working_memory_budget_tokens` | 3000 | Total token ceiling for the whole `brain session-start` payload |
|
|
581
|
+
| `pin_budget_tokens` | 1500 | Sub-budget for pinned, always-present memories |
|
|
582
|
+
| `skills_index_budget_tokens` | 800 | Sub-budget for the advertised skills index (L0) |
|
|
583
|
+
| `recall_budget_tokens` | 700 | Sub-budget for context-relevant recalled memories |
|
|
584
|
+
|
|
585
|
+
Token counts use a dependency-free heuristic stored on each memory at write time. When pins exceed their budget they're selected by `--priority` then strength, and the overflow is reported rather than silently dropped.
|
|
586
|
+
|
|
518
587
|
## Benchmark
|
|
519
588
|
|
|
520
589
|
Empirical benchmarks show that agents with Brain Memory produce **more consistent** and **more successful** outputs across sessions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brain-memory",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.16",
|
|
4
4
|
"description": "A brain-inspired hierarchical memory system for AI coding agents. Deep nested file structure that mimics human memory with time-decay and strength-based recall.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|