@fabersep/memory 0.2.0 → 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 +34 -0
- package/README.md +63 -324
- package/dist/src/cli.js +89 -14
- package/dist/src/doctor.js +2 -2
- package/dist/src/importer.js +7 -2
- package/dist/src/init.d.ts +1 -0
- package/dist/src/init.js +4 -3
- package/dist/src/mcp.d.ts +2 -2
- package/dist/src/mcp.js +3 -2
- package/dist/src/stats.d.ts +2 -1
- package/dist/src/stats.js +2 -16
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +22 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@fabersep/memory`. Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## 0.2.1 (unreleased)
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Docs pointed to `~/.faber/memory-state/` for config and state; the real location is `~/.config/faber-memory/`.
|
|
9
|
+
- The MCP server reported version `0.1.0` and the compiled L0 header said `v0.1.0`; both now use the package version.
|
|
10
|
+
- `import --split-headings` no longer creates an empty entry for a title heading that has only sub-headings under it.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `--version` (also `-v`, `version`).
|
|
14
|
+
- The `init` instruction block for Claude Code and Antigravity now tells the agent when to call `memory_propose`; the `memory_propose` tool description says the same for MCP-only engines. Re-run `init` to pick it up.
|
|
15
|
+
- `import` ends with a `NOT imported: N item(s)` line when the hygiene check leaves items out.
|
|
16
|
+
- `docs/guide.md` (technical guide and full command reference), `CHANGELOG.md`, `CONTRIBUTING.md` and a CI test workflow.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **`setup` is optional for solo use:** `init` creates `~/.faber/memory` when no memory is configured, and `init <folder>` puts it in a folder you choose. `setup` still works, and team mode still starts with `setup --team`.
|
|
20
|
+
- Flags that take no value (`--preview`, `--apply`, `--json`, …) no longer swallow the next argument, so `init --preview ~/notes` works.
|
|
21
|
+
- **`init` now applies by default** (with `.bak` backups and `--undo`). Use `init --preview` (alias `--dry-run`) to see the diff only. `--apply` still works as an alias.
|
|
22
|
+
- The README is now a plain-language, story-first introduction; technical detail moved to `docs/guide.md`.
|
|
23
|
+
|
|
24
|
+
## 0.2.0 (2026-11-27)
|
|
25
|
+
|
|
26
|
+
- Local metrics ledger, `stats` (context size, retrieval, proposal funnel), `stats --cache` (prompt-cache hit rate from local engine logs), `stats --share` (anonymized benchmark card) and the read-only `doctor` checklist. Spec: `docs/features/02-metrics-and-stats`.
|
|
27
|
+
|
|
28
|
+
## 0.1.1 (2026-11-26)
|
|
29
|
+
|
|
30
|
+
- CLI UX: review progress line, back and view keys, quit-and-save, `reject --all`, `config unset`, `reset`, team URL shorthands, `--normalize-paths`, troubleshooting guide.
|
|
31
|
+
|
|
32
|
+
## 0.1.0 (2026-11-26)
|
|
33
|
+
|
|
34
|
+
- Core: Git-backed Markdown memory with `personal`, `team` and `project` scopes, deterministic L0 compiler, 3-tool BM25 MCP server, `pre-memory` review, hygiene scan, multi-engine `init` and zero-LLM `import`. Spec: `docs/features/01-core-memory`.
|
package/README.md
CHANGED
|
@@ -1,399 +1,138 @@
|
|
|
1
|
-
# FaberSEP Memory
|
|
1
|
+
# FaberSEP Memory
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@fabersep/memory)
|
|
3
4
|
[](LICENSE)
|
|
4
5
|
|
|
5
|
-
**
|
|
6
|
+
**Your AI coding assistant forgets everything when the chat ends. FaberSEP Memory gives it a memory you can read, trust and take with you.**
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
<!-- Video: a 60-second walkthrough will go here. -->
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
- [Why FaberSEP Memory?](#why-fabersep-memory)
|
|
14
|
-
- [How It Works](#how-it-works-the-2-minute-mental-model)
|
|
15
|
-
- [Prerequisites](#prerequisites)
|
|
16
|
-
- [Solo / Personal Setup (5 Steps)](#step-by-step-quickstart-solo--personal-setup)
|
|
17
|
-
- [Team Mode Setup (Shared Private Repo)](#team-mode-setup-shared-private-git-repo)
|
|
18
|
-
- [Everyday Workflow](#everyday-workflow)
|
|
19
|
-
- [Updating to a Newer Version](#updating-to-a-newer-version)
|
|
20
|
-
- [Cleaning Up or Resetting](#cleaning-up-or-resetting)
|
|
21
|
-
- [CLI Command Reference](#cli-command-reference)
|
|
22
|
-
- [MCP Tools](#mcp-tools)
|
|
23
|
-
- [FAQ & Comparisons](docs/why-faber-memory.md)
|
|
24
|
-
- [Troubleshooting & Edge Cases](docs/troubleshooting.md)
|
|
12
|
+
## The problem you already know
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Why FaberSEP Memory?
|
|
29
|
-
|
|
30
|
-
*"Doesn't Claude Code, Antigravity, or Cursor already have built-in memory?"*
|
|
31
|
-
|
|
32
|
-
Built-in auto-memory is tied to a single tool and lets agents silently overwrite your rules. Vector-DB memory servers add Docker/DB overhead and break prompt caching with dynamic injections. **`@fabersep/memory` solves all four at once:**
|
|
33
|
-
|
|
34
|
-
| | Built-in Auto-Memory | Vector-DB Memory MCPs | `@fabersep/memory` |
|
|
35
|
-
| :--- | :--- | :--- | :--- |
|
|
36
|
-
| **Portability** | Locked to one tool | Needs hosted DB/SDK | **One Git repo across Claude, Antigravity, Cursor, Codex** |
|
|
37
|
-
| **Safety** | Agents write silently (drift) | Auto-extracted noise | **Read-only active memory + human `pre-memory` review** |
|
|
38
|
-
| **Prompt Cache** | Grows unpredictably | Dynamic RAG breaks prefix | **Deterministic L0 (<1,500 tok), cache-warm (~80%+)** |
|
|
39
|
-
| **Setup & Team** | Local only, no PRs | Docker / DB / API keys | **Zero dependencies, pure Git `HEAD` + team PRs** |
|
|
14
|
+
It's Monday. You tell your AI assistant: *"We use pnpm here, not npm."* It says "Got it!" and does a great job.
|
|
40
15
|
|
|
41
|
-
|
|
16
|
+
On Tuesday you open a new chat. It runs `npm install`.
|
|
42
17
|
|
|
43
|
-
|
|
18
|
+
So you write the rule down in a long instructions file. A month later that file has 300 lines nobody reads, half of them out of date. You switch from Claude to Antigravity for a day, and the other tool knows none of it. Some tools try to "remember" by themselves, and one day you find a rule in there you never wrote.
|
|
44
19
|
|
|
45
|
-
##
|
|
20
|
+
## What changes with FaberSEP Memory
|
|
46
21
|
|
|
47
|
-
|
|
48
|
-
flowchart LR
|
|
49
|
-
subgraph Git["Git HEAD (Source of Truth)"]
|
|
50
|
-
T["Team Repo<br/>(shared private repo)"]
|
|
51
|
-
P["Personal Repo<br/>(~/.faber/memory)"]
|
|
52
|
-
PR["Project Repo<br/>(.faber/memory/)"]
|
|
53
|
-
end
|
|
22
|
+
The same Monday, with FaberSEP Memory:
|
|
54
23
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
1. **Your assistant notices a lesson** ("this team uses pnpm") and *suggests* saving it. It does not save it by itself.
|
|
25
|
+
2. **You approve it** with one key press when you have a minute, usually at the end of the day.
|
|
26
|
+
3. **From Tuesday on, every assistant you use knows it**: Claude Code, Antigravity, Claude Desktop, Cursor. They all read the same memory.
|
|
58
27
|
|
|
59
|
-
|
|
60
|
-
L2 --> Agent
|
|
61
|
-
```
|
|
28
|
+
Your memory is a folder of short notes on your own computer, kept in Git so every change is saved and can be undone. Nothing goes to a cloud service, and you don't need an account, a database or an API key.
|
|
62
29
|
|
|
63
|
-
|
|
30
|
+
## Why you can trust it
|
|
64
31
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
3. **Agents propose; humans approve (`pre-memory`).** Active memory is read-only for agents. When an agent learns a new rule or lesson, it calls `memory_propose`, which stages a proposal in `pre-memory`. You review and approve it in one batch — keeping your memory accurate and noise-free.
|
|
71
|
-
4. **Three scopes:**
|
|
72
|
-
- **`personal`** — Your own rules, lessons, and preferences (solo local Git repo, e.g. `~/.faber/memory`).
|
|
73
|
-
- **`team`** — Shared engineering rules in a private team Git repo.
|
|
74
|
-
- **`project`** — Optional repo-specific memory in `<repo>/.faber/memory/`.
|
|
32
|
+
- **Nothing gets in without your OK.** Assistants can only suggest. You decide what stays.
|
|
33
|
+
- **You can read all of it.** Each memory is a small text file. Open it, edit it, delete it.
|
|
34
|
+
- **It stays small.** Your assistant gets a short table of contents at the start of every chat and looks up details only when it needs them. That keeps chats fast and cheap.
|
|
35
|
+
- **It guards against mistakes.** Passwords, API keys and paths that only work on your computer are blocked before they get saved.
|
|
36
|
+
- **It works with your team, too.** Share a set of rules through a private Git repository, so every teammate's assistant follows them.
|
|
75
37
|
|
|
76
38
|
---
|
|
77
39
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
- **Node.js 20 or newer** (`node -v` to check)
|
|
81
|
-
- **Git** (`git --version` to check)
|
|
82
|
-
|
|
83
|
-
You do **not** need to install anything globally to try it — `npx @fabersep/memory` runs the CLI directly.
|
|
84
|
-
*(If you prefer shorter commands, install globally once with `npm install -g @fabersep/memory` and use `faber-memory` instead of `npx @fabersep/memory`.)*
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Step-by-Step Quickstart (Solo / Personal Setup)
|
|
89
|
-
|
|
90
|
-
Follow these 5 steps in order. Each step is safe and reversible.
|
|
91
|
-
|
|
92
|
-
### Step 1: Create your personal memory folder
|
|
93
|
-
|
|
94
|
-
Run:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
npx @fabersep/memory setup ~/.faber/memory
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**What this does:**
|
|
101
|
-
- Creates `~/.faber/memory` (you can pick any folder path you like) and initializes a local Git repository on branch `main`.
|
|
102
|
-
- Saves your configuration in `~/.faber/memory-state/config.json`.
|
|
40
|
+
## Get started (about 2 minutes)
|
|
103
41
|
|
|
104
|
-
|
|
42
|
+
You need **Node.js 20 or newer** and **Git**. To check, run `node -v` and `git --version` in a terminal.
|
|
105
43
|
|
|
106
|
-
|
|
44
|
+
**1. Set it up**
|
|
107
45
|
|
|
108
46
|
```bash
|
|
109
47
|
npx @fabersep/memory init
|
|
110
48
|
```
|
|
111
49
|
|
|
112
|
-
|
|
50
|
+
This creates your memory folder (`~/.faber/memory`, with its own Git history), finds the AI assistants on your computer and connects them. It keeps a backup of every file it touches, and you can undo it at any time with `npx @fabersep/memory init --undo`.
|
|
113
51
|
|
|
114
|
-
|
|
115
|
-
npx @fabersep/memory init --apply
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**What this does:**
|
|
119
|
-
- Compiles your L0 index first to `~/.faber/memory-state/MEMORY.md`.
|
|
120
|
-
- Creates a `.bak` backup of every file it touches.
|
|
121
|
-
- Adds a clearly marked `<!-- faber-memory:start --> ... <!-- faber-memory:end -->` block and registers the `faber-memory` MCP server (`npx -y @fabersep/memory serve`).
|
|
122
|
-
- **Trust & safety:** `init --apply` never disables your AI tool's built-in settings behind your back (for example, it does not edit `~/.claude/settings.json`). If you use Claude Code and want to avoid running two parallel memory systems, see [how to optionally disable Claude auto-memory](docs/troubleshooting.md#claude-auto-memory).
|
|
123
|
-
|
|
124
|
-
> **Tip:** Target specific engines with `--engine`:
|
|
125
|
-
> ```bash
|
|
126
|
-
> npx @fabersep/memory init --engine claude-code,antigravity --apply
|
|
127
|
-
> ```
|
|
128
|
-
> Revert the wiring cleanly at any time (keeps your memory repos & proposals intact):
|
|
129
|
-
> ```bash
|
|
130
|
-
> npx @fabersep/memory init --undo
|
|
131
|
-
> ```
|
|
132
|
-
|
|
133
|
-
#### Supported Engines & What `init --apply` Wires
|
|
134
|
-
|
|
135
|
-
| Engine | Instruction File | MCP Config | Notes |
|
|
136
|
-
| :--- | :--- | :--- | :--- |
|
|
137
|
-
| **Claude Code** | `~/.claude/CLAUDE.md` (`@path` include) | `~/.claude.json` | Native `@path` L0 include + MCP tools |
|
|
138
|
-
| **Antigravity** | `~/.gemini/GEMINI.md` (read-at-start rule) | `~/.gemini/config/mcp_config.json` | Reads L0 at start + MCP tools |
|
|
139
|
-
| **Claude Desktop** | — | `claude_desktop_config.json` | MCP tools (`--engine claude-desktop`) |
|
|
140
|
-
| **Cursor** | — (GAP) | `~/.cursor/mcp.json` | MCP-only |
|
|
141
|
-
| **Codex** | — (GAP) | — | MCP-only (manual config) |
|
|
142
|
-
|
|
143
|
-
### Step 3: Import your existing memory files (optional, zero LLM)
|
|
144
|
-
|
|
145
|
-
Already have Markdown notes, Claude auto-memory files, an `AGENTS.md`, or Cursor rules? You can import them deterministically without spending any LLM tokens.
|
|
146
|
-
|
|
147
|
-
Pick the command that matches your source:
|
|
52
|
+
Want your notes in another folder? Give its path:
|
|
148
53
|
|
|
149
54
|
```bash
|
|
150
|
-
|
|
151
|
-
npx @fabersep/memory import --from markdown-dir ./path/to/your/memory
|
|
152
|
-
|
|
153
|
-
# 2. Existing Claude Code auto-memory folder
|
|
154
|
-
npx @fabersep/memory import --from claude-memory ~/.claude/projects/<your-project>/memory
|
|
155
|
-
|
|
156
|
-
# 3. A single AGENTS.md or CLAUDE.md (split each # / ## heading into its own entry)
|
|
157
|
-
npx @fabersep/memory import --from agents-md ./AGENTS.md --split-headings
|
|
158
|
-
|
|
159
|
-
# 4. Existing Cursor rules
|
|
160
|
-
npx @fabersep/memory import --from cursor-rules ./.cursor/rules
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
**What this does:**
|
|
164
|
-
- Scans your files, infers frontmatter (`id`, `type`, `summary`), skips old index files (`MEMORY.md`, `CATALOG.md`, `README.md`, `INDEX.md`), checks for near-duplicates and hygiene issues (secrets or machine-specific paths), and stages valid items into **`pre-memory`**.
|
|
165
|
-
- Nothing becomes active until you approve it in Step 4.
|
|
166
|
-
- **Have `/Users/<name>/...` or `/home/<name>/...` paths in your old notes?** Add `--normalize-paths` to automatically convert them to portable `~/` paths in the staged copy (your source files stay untouched). See [Machine-Specific Paths](docs/troubleshooting.md#machine-specific-paths).
|
|
167
|
-
|
|
168
|
-
### Step 4: Review and approve staged proposals
|
|
169
|
-
|
|
170
|
-
Review everything waiting in `pre-memory`:
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
npx @fabersep/memory review
|
|
55
|
+
npx @fabersep/memory init ~/my-notes
|
|
174
56
|
```
|
|
175
57
|
|
|
176
|
-
|
|
177
|
-
- `a` — **approve** (queued for a single batch commit)
|
|
178
|
-
- `e` — **edit** the body before approving
|
|
179
|
-
- `r` — **reject** and remove the proposal
|
|
180
|
-
- `s` — **skip** for now
|
|
181
|
-
- `v` — **view full** body (when a long entry is truncated)
|
|
182
|
-
- `b` — **back** to the previous proposal to change your mind
|
|
183
|
-
- `q` — **quit & save** everything you approved/rejected so far in one commit (pressing `Ctrl+C` also saves your progress safely)
|
|
184
|
-
|
|
185
|
-
*(Shortcuts: `npx @fabersep/memory review --approve-all`, `npx @fabersep/memory approve <id1> <id2>`, or `npx @fabersep/memory reject <id>`.)*
|
|
186
|
-
|
|
187
|
-
### Step 5: Verify everything is healthy
|
|
188
|
-
|
|
189
|
-
Check your current setup and pending queue:
|
|
58
|
+
**2. Check that everything is connected**
|
|
190
59
|
|
|
191
60
|
```bash
|
|
192
|
-
npx @fabersep/memory
|
|
61
|
+
npx @fabersep/memory doctor
|
|
193
62
|
```
|
|
194
63
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
npx @fabersep/memory compile --check
|
|
199
|
-
```
|
|
64
|
+
You should see `PASS` lines. Each `WARN` or `FAIL` line comes with a one-line hint on how to fix it.
|
|
200
65
|
|
|
201
|
-
|
|
66
|
+
**3. Start a new chat in your assistant**
|
|
202
67
|
|
|
203
|
-
|
|
68
|
+
Tell it something about your project that it would otherwise get wrong, for example:
|
|
204
69
|
|
|
205
|
-
|
|
70
|
+
> *"In this project we run the tests with `make test`, never `npm test`. Please remember that."*
|
|
206
71
|
|
|
207
|
-
|
|
72
|
+
It should suggest saving this as a memory. (If it doesn't, ask it: *"Propose this as a memory."*)
|
|
208
73
|
|
|
209
|
-
|
|
74
|
+
**4. Approve what you want to keep**
|
|
210
75
|
|
|
211
76
|
```bash
|
|
212
|
-
# 1. Clone and register your private team memory repo
|
|
213
|
-
# Accepts HTTPS, github.com/org/repo, org/repo, or SSH (git@github.com:org/repo.git)
|
|
214
|
-
npx @fabersep/memory setup --team https://github.com/your-org/team-memory.git
|
|
215
|
-
|
|
216
|
-
# Optional: clone into a custom directory (default: ~/.faber/memory-state/clones/team)
|
|
217
|
-
# npx @fabersep/memory setup --team https://github.com/your-org/team-memory.git --path ~/team-memory
|
|
218
|
-
|
|
219
|
-
# 2. Connect your AI coding agent (skip if you already ran init --apply in Solo setup)
|
|
220
|
-
npx @fabersep/memory init --apply
|
|
221
|
-
|
|
222
|
-
# 3. (Optional) Import existing Markdown notes into the team scope
|
|
223
|
-
npx @fabersep/memory import --from markdown-dir ./path/to/your/memory --scope team
|
|
224
|
-
|
|
225
|
-
# 4. Review & approve (pushes to the team repo and compiles L0)
|
|
226
77
|
npx @fabersep/memory review
|
|
227
78
|
```
|
|
228
79
|
|
|
229
|
-
|
|
80
|
+
You'll see each suggestion as a card. Press `a` to keep it, `e` to edit it first, `r` to throw it away, `s` to skip, or `q` to save and quit.
|
|
230
81
|
|
|
231
|
-
|
|
232
|
-
npx @fabersep/memory sync
|
|
233
|
-
```
|
|
82
|
+
Now open a **new** chat and ask: *"How do I run the tests here?"* Your assistant answers `make test`, without you telling it again.
|
|
234
83
|
|
|
235
|
-
**
|
|
236
|
-
- **`--submit-mode auto` (default):** Pushes directly to the team repo's default branch via a clean temporary worktree. If branch protection rejects the push, it automatically falls back to creating a branch and opening a PR.
|
|
237
|
-
- **`--submit-mode pr`:** Always submits via a Pull Request (`npx @fabersep/memory config set-submit-mode pr`).
|
|
238
|
-
|
|
239
|
-
*(See also: [Step 2: Connect your AI coding agent](#step-2-connect-your-ai-coding-agent) · [Step 3: Import](#step-3-import-your-existing-memory-files-optional-zero-llm) · [Step 4: Review](#step-4-review-and-approve-staged-proposals))*
|
|
84
|
+
> **Already have notes?** If you keep rules in an `AGENTS.md`, a `CLAUDE.md`, Cursor rules or a folder of Markdown files, you can bring them in. They go to the same review step first. See [Importing existing notes](docs/guide.md#importing-existing-notes).
|
|
240
85
|
|
|
241
86
|
---
|
|
242
87
|
|
|
243
|
-
##
|
|
88
|
+
## A normal day with it
|
|
244
89
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
C -->|"Reject"| D["Discarded<br/>(no Git commit)"]
|
|
250
|
-
C -->|"Approve (batched)"| E["Single Git Commit<br/>(or Team PR)"]
|
|
251
|
-
E -->|"Auto-recompile"| F["Updated L0 MEMORY.md<br/>(ready for next session)"]
|
|
252
|
-
```
|
|
90
|
+
- **While you work:** nothing to do. Your assistant reads its short memory list at the start and looks things up as it goes.
|
|
91
|
+
- **When it learns something:** it suggests a memory. The suggestion waits in a "to review" box (`pre-memory`) and changes nothing yet.
|
|
92
|
+
- **When you have a minute:** run `npx @fabersep/memory review`. All your approvals are saved together, in one step.
|
|
93
|
+
- **Changed your mind?** Every memory is a file in `~/.faber/memory`. Edit or delete it like any file, then run `npx @fabersep/memory compile`. Git keeps the history.
|
|
253
94
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
1. **During a session:** Your agent loads the compact L0 index, searches deeper with `memory_search` + `memory_get`, and proposes new lessons via `memory_propose`.
|
|
257
|
-
2. **Whenever you have a minute:** Run `npx @fabersep/memory status` to see pending proposals, then `npx @fabersep/memory review` to approve or reject them in one batch.
|
|
258
|
-
3. **In team mode:** Run `npx @fabersep/memory sync` whenever you want to pull teammates' updates.
|
|
259
|
-
|
|
260
|
-
### Writing a Memory File by Hand
|
|
261
|
-
|
|
262
|
-
Memory files are standard Markdown with a small YAML frontmatter block:
|
|
95
|
+
A memory file looks like this:
|
|
263
96
|
|
|
264
97
|
```markdown
|
|
265
98
|
---
|
|
266
|
-
id:
|
|
99
|
+
id: use-pnpm
|
|
267
100
|
type: rule
|
|
268
|
-
|
|
269
|
-
summary: Never run pkill or killall by broad pattern; stop only your own PID or task.
|
|
270
|
-
tags: [safety, shell]
|
|
101
|
+
summary: Use pnpm, not npm, in this team's projects.
|
|
271
102
|
---
|
|
272
103
|
|
|
273
|
-
|
|
274
|
-
Always stop only the specific PID or background task you started.
|
|
104
|
+
Run `pnpm install` and `pnpm test`. Never commit a package-lock.json.
|
|
275
105
|
```
|
|
276
106
|
|
|
277
|
-
Valid `type` values: `rule`, `decision`, `lesson`, `preference`, `reference`.
|
|
278
|
-
After editing or adding a file manually in your memory repo, commit it with Git and run `npx @fabersep/memory compile`.
|
|
279
|
-
|
|
280
107
|
---
|
|
281
108
|
|
|
282
|
-
##
|
|
283
|
-
|
|
284
|
-
How you update depends on how you run `@fabersep/memory`:
|
|
285
|
-
|
|
286
|
-
- **Using `npx` (no global install):**
|
|
287
|
-
Pass `@latest` to make sure `npx` fetches the newest release instead of a cached copy:
|
|
288
|
-
```bash
|
|
289
|
-
npx @fabersep/memory@latest --help
|
|
290
|
-
```
|
|
291
|
-
- **Installed globally via npm:**
|
|
292
|
-
```bash
|
|
293
|
-
npm install -g @fabersep/memory@latest
|
|
294
|
-
```
|
|
295
|
-
- **Cloned from GitHub source:**
|
|
296
|
-
```bash
|
|
297
|
-
cd /path/to/memory
|
|
298
|
-
git pull
|
|
299
|
-
npm install
|
|
300
|
-
npm run build
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
After updating, your existing memory repos and config continue working as-is. If a new version updates engine wiring, re-running `npx @fabersep/memory@latest init --apply` is safe and idempotent.
|
|
109
|
+
## Common questions
|
|
304
110
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
## Cleaning Up or Resetting
|
|
308
|
-
|
|
309
|
-
- **Remove only agent wiring** (keeps all memory repos and pending proposals):
|
|
310
|
-
```bash
|
|
311
|
-
npx @fabersep/memory init --undo
|
|
312
|
-
```
|
|
313
|
-
- **Clear all pending `pre-memory` proposals** (with confirmation):
|
|
314
|
-
```bash
|
|
315
|
-
npx @fabersep/memory reject --all
|
|
316
|
-
```
|
|
317
|
-
- **Disconnect a configured root** (removes it from `config.json` without deleting files on disk):
|
|
318
|
-
```bash
|
|
319
|
-
npx @fabersep/memory config unset personal
|
|
320
|
-
# or: npx @fabersep/memory config unset team
|
|
321
|
-
```
|
|
322
|
-
- **Full reset** (undoes agent wiring and deletes `~/.faber/memory-state/` after confirmation; add `--include-personal-repo` to also remove your local personal Git repo):
|
|
323
|
-
```bash
|
|
324
|
-
npx @fabersep/memory reset
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
## Installing Globally or Running from Source
|
|
111
|
+
**Doesn't my AI tool already have memory?**
|
|
112
|
+
Some do, but it stays inside that one tool, and the tool can write to it without asking you. FaberSEP Memory works across tools, and only you can approve what goes in. More in [Why FaberSEP Memory?](docs/why-faber-memory.md)
|
|
330
113
|
|
|
331
|
-
**
|
|
114
|
+
**Does it cost anything or send my data anywhere?**
|
|
115
|
+
No. It's free and open source (Apache-2.0), and it runs on your computer. Your notes go only where you push them yourself, for example to a private team repository.
|
|
332
116
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
faber-memory --help
|
|
336
|
-
```
|
|
117
|
+
**Can I use it on my phone?**
|
|
118
|
+
Not directly yet. If you control a computer or server from your phone (for example with Claude Remote Control), memory works in that session.
|
|
337
119
|
|
|
338
|
-
**
|
|
120
|
+
**How do I update or remove it?**
|
|
121
|
+
`npx @fabersep/memory@latest --version` fetches the newest version and prints its number. `npx @fabersep/memory init --undo` disconnects your assistants and leaves your notes in place. See [Updating and cleaning up](docs/guide.md#updating-and-cleaning-up).
|
|
339
122
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
cd memory
|
|
343
|
-
npm install
|
|
344
|
-
npm test
|
|
345
|
-
npm link
|
|
346
|
-
```
|
|
123
|
+
**Something went wrong.**
|
|
124
|
+
Run `npx @fabersep/memory doctor` first. Then check [Troubleshooting](docs/troubleshooting.md) or [open an issue](https://github.com/fabersep/memory/issues).
|
|
347
125
|
|
|
348
126
|
---
|
|
349
127
|
|
|
350
|
-
##
|
|
351
|
-
|
|
352
|
-
| Command | Description |
|
|
353
|
-
| :--- | :--- |
|
|
354
|
-
| `setup [path]` | Initialize a local solo (personal) memory Git repo. |
|
|
355
|
-
| `setup --team <url\|org/repo> [--path <dir>] [--submit-mode auto\|pr]` | Clone and configure a shared team memory repo. |
|
|
356
|
-
| `config` | Print current `~/.faber/memory-state/config.json`. |
|
|
357
|
-
| `config set-path <personal\|team> <new-path>` | Move a configured memory root while keeping its UUID. |
|
|
358
|
-
| `config set-submit-mode <auto\|pr>` | Change team approval mode (`auto` push with PR fallback, or always `pr`). |
|
|
359
|
-
| `config unset <personal\|team>` | Disconnect a root from config without deleting files on disk. |
|
|
360
|
-
| `init [--apply \| --undo] [--engine ...] [--project-hint]` | Preview (Before/After), apply (with `.bak` backups), or undo user-level agent wiring. |
|
|
361
|
-
| `compile [--check] [--repo <dir>]` | Compile L0 `MEMORY.md`, or validate schema/budget/hygiene in CI (`--check`). |
|
|
362
|
-
| `sync [--timeout <ms>]` | Fast-forward pull remote updates and recompile L0. |
|
|
363
|
-
| `status` | Show compiled L0 status, configured roots, warnings, and pending/stale proposals. |
|
|
364
|
-
| `review [--approve-all]` | Interactively approve, edit, reject, skip, go back, or quit & save `pre-memory` proposals. |
|
|
365
|
-
| `approve <id...> [--mode auto\|pr]` | Approve one or more proposals by ID in a single batch commit. |
|
|
366
|
-
| `reject <id>` / `reject --all [--yes]` | Reject and delete one or all pending proposals. |
|
|
367
|
-
| `reset [--include-personal-repo] [--yes]` | Undo agent wiring and wipe local state (optionally including personal repo). |
|
|
368
|
-
| `import --from <type> <path> [--scope ...] [--split-headings] [--normalize-paths] [--approve]` | Deterministically import existing memory into `pre-memory`. |
|
|
369
|
-
| `serve` | Run the 3-tool stdio MCP server (used by your AI agent's MCP config). |
|
|
128
|
+
## Going further
|
|
370
129
|
|
|
371
|
-
|
|
130
|
+
- **[User guide and reference](docs/guide.md):** how it works inside, team setup, importing, every command, the MCP tools and where files live.
|
|
131
|
+
- **[Why FaberSEP Memory?](docs/why-faber-memory.md):** comparisons with built-in memory and vector databases, and why the design keeps prompt caching cheap.
|
|
132
|
+
- **[Troubleshooting](docs/troubleshooting.md):** every warning, explained.
|
|
133
|
+
- **[Contributing](CONTRIBUTING.md)** and **[Changelog](CHANGELOG.md)**.
|
|
372
134
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
The MCP server exposes exactly **3 lean tools** (~350 tokens total tool schema):
|
|
376
|
-
|
|
377
|
-
| Tool | Purpose |
|
|
378
|
-
| :--- | :--- |
|
|
379
|
-
| `memory_search` | Pure-JS BM25 full-text search across active `team`, `personal`, and `project` scopes (returns compact L1 summaries). Automatically reindexes on Git `HEAD` change. |
|
|
380
|
-
| `memory_get` | Fetch the full L2 Markdown body of a specific entry by ID. |
|
|
381
|
-
| `memory_propose` | Stage a new entry or update into `pre-memory` for human review (never writes directly to active memory). |
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
## Documentation & Specs
|
|
386
|
-
|
|
387
|
-
This repository follows the [FaberSEP Spec](https://github.com/fabersep/spec) standard:
|
|
388
|
-
|
|
389
|
-
- [Why FaberSEP Memory? (FAQ & Comparisons)](docs/why-faber-memory.md)
|
|
390
|
-
- [Troubleshooting & Edge Cases](docs/troubleshooting.md)
|
|
391
|
-
- [Master PRD](docs/master-prd.md)
|
|
392
|
-
- [Architecture](docs/architecture.md)
|
|
393
|
-
- [Core Memory PRD](docs/features/01-core-memory/prd.md)
|
|
394
|
-
- [BDD Acceptance Criteria (55 scenarios)](docs/features/01-core-memory/acceptance_criteria.md)
|
|
395
|
-
|
|
396
|
-
---
|
|
135
|
+
FaberSEP Memory is part of [FaberSEP](https://github.com/fabersep), open-source tools that help AI coding assistants work with more discipline.
|
|
397
136
|
|
|
398
137
|
## License
|
|
399
138
|
|
package/dist/src/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as readline from 'node:readline';
|
|
|
5
5
|
import { compileGlobalL0 } from './compiler.js';
|
|
6
6
|
import { generateUuid, getCompiledL0Path, getDefaultPersonalPath, getHomeDir, loadConfig, saveConfig, } from './config.js';
|
|
7
7
|
import { formatDoctorReport, runDoctor } from './doctor.js';
|
|
8
|
-
import { getDefaultBranch, getHeadSha, gitCloneTeamRepo, gitInitSoloRepo, isGitRepo, } from './git.js';
|
|
8
|
+
import { getDefaultBranch, getHeadSha, gitCloneTeamRepo, gitInitSoloRepo, gitSync, isGitRepo, } from './git.js';
|
|
9
9
|
import { runImport } from './importer.js';
|
|
10
10
|
import { formatPlanBeforeAfter, planOrApplyInit } from './init.js';
|
|
11
11
|
import { FaberMemoryMcpServer } from './mcp.js';
|
|
@@ -13,7 +13,14 @@ import { approveProposalsBatch, findProposalById, reconcileAwaitingCommitProposa
|
|
|
13
13
|
import { buildShareableBenchmark, computeStats, formatShareableMarkdown, formatStatsReport, validateDaysArg, } from './stats.js';
|
|
14
14
|
import { loadAllScopes, resolveProjectRoot } from './store.js';
|
|
15
15
|
import { syncAllRoots } from './sync.js';
|
|
16
|
+
import { getPackageVersion } from './version.js';
|
|
16
17
|
import { c, hr, inferErrorAnchor, normalizeTeamUrl, troubleshootingLink, } from './ui.js';
|
|
18
|
+
// Flags that never take a value, so `init --preview ~/notes` keeps ~/notes as a positional.
|
|
19
|
+
const BOOLEAN_FLAGS = new Set([
|
|
20
|
+
'apply', 'undo', 'preview', 'dry-run', 'check', 'json', 'strict', 'cache', 'share', 'yes',
|
|
21
|
+
'all', 'approve', 'approve-all', 'split-headings', 'normalize-paths', 'project-hint',
|
|
22
|
+
'include-personal-repo', 'help',
|
|
23
|
+
]);
|
|
17
24
|
function parseFlags(args) {
|
|
18
25
|
const positional = [];
|
|
19
26
|
const flags = {};
|
|
@@ -27,7 +34,7 @@ function parseFlags(args) {
|
|
|
27
34
|
else {
|
|
28
35
|
const key = arg.slice(2);
|
|
29
36
|
const next = args[i + 1];
|
|
30
|
-
if (next && !next.startsWith('--')) {
|
|
37
|
+
if (next && !next.startsWith('--') && !BOOLEAN_FLAGS.has(key)) {
|
|
31
38
|
flags[key] = next;
|
|
32
39
|
i++;
|
|
33
40
|
}
|
|
@@ -60,11 +67,42 @@ function printErrorWithHelp(errMsg) {
|
|
|
60
67
|
console.error(c.dim(` Details: ${troubleshootingLink(anchor)}`));
|
|
61
68
|
}
|
|
62
69
|
}
|
|
70
|
+
function createPersonalRoot(config, personalPath, homeDir) {
|
|
71
|
+
const existed = isGitRepo(personalPath);
|
|
72
|
+
gitInitSoloRepo(personalPath, 'main');
|
|
73
|
+
config.roots.personal = {
|
|
74
|
+
uuid: config.roots.personal?.uuid || generateUuid(),
|
|
75
|
+
path: personalPath,
|
|
76
|
+
scope: 'personal',
|
|
77
|
+
defaultBranch: existed ? getDefaultBranch(personalPath) : 'main',
|
|
78
|
+
};
|
|
79
|
+
saveConfig(config, homeDir);
|
|
80
|
+
}
|
|
81
|
+
// Notes already in a chosen folder are not active until they are in Git HEAD.
|
|
82
|
+
function printUncommittedNotesHint(dir) {
|
|
83
|
+
let count = 0;
|
|
84
|
+
try {
|
|
85
|
+
const res = gitSync(['--no-optional-locks', '-C', dir, 'status', '--porcelain', '-uall']);
|
|
86
|
+
if (!res.ok)
|
|
87
|
+
return;
|
|
88
|
+
count = res.stdout.split('\n').filter((l) => /\.md"?$/i.test(l.trim())).length;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (count > 0) {
|
|
94
|
+
console.log(c.yellow(`Found ${count} Markdown file(s) in ${dir} that are not committed yet; memory only reads committed notes. Commit them, or bring them in for review with: faber-memory import --from markdown-dir ${dir}`));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
63
97
|
async function main() {
|
|
64
98
|
const argv = process.argv.slice(2);
|
|
65
99
|
const cmd = argv[0];
|
|
66
100
|
const { positional, flags } = parseFlags(argv.slice(1));
|
|
67
101
|
const homeDir = getHomeDir();
|
|
102
|
+
if (cmd === '--version' || cmd === '-v' || cmd === 'version') {
|
|
103
|
+
console.log(getPackageVersion());
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
68
106
|
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
69
107
|
printHelp();
|
|
70
108
|
return 0;
|
|
@@ -106,15 +144,9 @@ async function main() {
|
|
|
106
144
|
: positional[0]
|
|
107
145
|
? path.resolve(positional[0])
|
|
108
146
|
: getDefaultPersonalPath();
|
|
109
|
-
|
|
110
|
-
config.roots.personal = {
|
|
111
|
-
uuid: config.roots.personal?.uuid || generateUuid(),
|
|
112
|
-
path: personalPath,
|
|
113
|
-
scope: 'personal',
|
|
114
|
-
defaultBranch: 'main',
|
|
115
|
-
};
|
|
116
|
-
saveConfig(config, homeDir);
|
|
147
|
+
createPersonalRoot(config, personalPath, homeDir);
|
|
117
148
|
console.log(c.green(`Initialized personal memory root at ${personalPath} (uuid: ${config.roots.personal.uuid})`));
|
|
149
|
+
printUncommittedNotesHint(personalPath);
|
|
118
150
|
return 0;
|
|
119
151
|
}
|
|
120
152
|
if (cmd === 'config') {
|
|
@@ -572,6 +604,9 @@ async function main() {
|
|
|
572
604
|
console.log(c.dim(` details: ${troubleshootingLink(s.anchor)}`));
|
|
573
605
|
}
|
|
574
606
|
}
|
|
607
|
+
if (res.skippedHygiene.length > 0) {
|
|
608
|
+
console.log(c.yellow(`NOT imported: ${res.skippedHygiene.length} item(s) were left out because of the hygiene check above. Fix them (or add --normalize-paths for paths) and run import again; already staged items are not duplicated.`));
|
|
609
|
+
}
|
|
575
610
|
for (const n of res.notes)
|
|
576
611
|
console.log(n);
|
|
577
612
|
return 0;
|
|
@@ -583,9 +618,42 @@ async function main() {
|
|
|
583
618
|
}
|
|
584
619
|
if (cmd === 'init') {
|
|
585
620
|
const config = loadConfig(homeDir);
|
|
586
|
-
const apply = Boolean(flags.apply);
|
|
587
621
|
const undo = Boolean(flags.undo);
|
|
622
|
+
// init applies by default; --preview (alias --dry-run) only shows the diff.
|
|
623
|
+
// --apply is kept as a no-op alias for older docs and scripts.
|
|
624
|
+
const preview = Boolean(flags.preview || flags['dry-run']);
|
|
625
|
+
if (preview && flags.apply) {
|
|
626
|
+
printErrorWithHelp('Use either --preview or --apply, not both.');
|
|
627
|
+
return 1;
|
|
628
|
+
}
|
|
629
|
+
const apply = !undo && !preview;
|
|
588
630
|
const projectHint = Boolean(flags['project-hint']);
|
|
631
|
+
// init also creates the personal memory folder, so `setup` is optional:
|
|
632
|
+
// `init <folder>` picks the folder; plain `init` uses ~/.faber/memory when
|
|
633
|
+
// no personal or team root is configured yet.
|
|
634
|
+
if (!undo) {
|
|
635
|
+
const requested = positional[0] ? path.resolve(positional[0]) : undefined;
|
|
636
|
+
const current = config.roots.personal?.path;
|
|
637
|
+
if (requested && current && path.resolve(current) !== requested) {
|
|
638
|
+
printErrorWithHelp(`Personal memory is already at ${current}. To move it, run: faber-memory config set-path personal ${requested}`);
|
|
639
|
+
return 1;
|
|
640
|
+
}
|
|
641
|
+
const target = requested && !current
|
|
642
|
+
? requested
|
|
643
|
+
: !current && !config.roots.team
|
|
644
|
+
? getDefaultPersonalPath()
|
|
645
|
+
: undefined;
|
|
646
|
+
if (target) {
|
|
647
|
+
if (preview) {
|
|
648
|
+
console.log(c.cyan(`Would create your personal memory folder at ${target}.`));
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
createPersonalRoot(config, target, homeDir);
|
|
652
|
+
console.log(c.green(`Created your personal memory folder at ${target}.`));
|
|
653
|
+
printUncommittedNotesHint(target);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
589
657
|
const engines = typeof flags.engine === 'string'
|
|
590
658
|
? flags.engine.split(',').map((e) => e.trim())
|
|
591
659
|
: undefined;
|
|
@@ -611,8 +679,12 @@ async function main() {
|
|
|
611
679
|
if (res.projectHint) {
|
|
612
680
|
console.log(`Project hint: ${res.projectHint}`);
|
|
613
681
|
}
|
|
614
|
-
if (
|
|
615
|
-
console.log(c.yellow('\
|
|
682
|
+
if (preview) {
|
|
683
|
+
console.log(c.yellow('\nPreview only. Run "faber-memory init" to write these changes.'));
|
|
684
|
+
}
|
|
685
|
+
else if (apply) {
|
|
686
|
+
const wired = [...new Set(res.plans.map((p) => p.engine))];
|
|
687
|
+
console.log(c.green(`\nConnected: ${wired.join(', ') || 'nothing to change'}. Backups are saved as .bak; undo any time with "faber-memory init --undo". Start a new chat in your assistant to use memory.`));
|
|
616
688
|
}
|
|
617
689
|
return 0;
|
|
618
690
|
}
|
|
@@ -676,7 +748,7 @@ function printHelp() {
|
|
|
676
748
|
Commands:
|
|
677
749
|
setup [path] [--team <git-url|org/repo> --path <dir> --submit-mode auto|pr]
|
|
678
750
|
config [set-path <personal|team> <new-path> | set-submit-mode <auto|pr> | unset <personal|team>]
|
|
679
|
-
init [--
|
|
751
|
+
init [folder] [--preview | --undo] [--engine claude-code,antigravity,claude-desktop,cursor,codex] [--project-hint]
|
|
680
752
|
compile [--check] [--repo <dir>]
|
|
681
753
|
sync [--timeout <ms>]
|
|
682
754
|
status
|
|
@@ -688,6 +760,9 @@ Commands:
|
|
|
688
760
|
reset [--include-personal-repo] [--yes]
|
|
689
761
|
import --from <markdown-dir|claude-memory|agents-md|cursor-rules> <path> [--scope personal|team|project] [--split-headings] [--normalize-paths] [--approve]
|
|
690
762
|
serve
|
|
763
|
+
--version
|
|
764
|
+
|
|
765
|
+
Docs: https://github.com/fabersep/memory#readme
|
|
691
766
|
`);
|
|
692
767
|
}
|
|
693
768
|
main()
|
package/dist/src/doctor.js
CHANGED
|
@@ -311,12 +311,12 @@ export function runDoctor(options = {}) {
|
|
|
311
311
|
}
|
|
312
312
|
if (mismatchedEngines.length > 0) {
|
|
313
313
|
wiringStatus = 'WARN';
|
|
314
|
-
wiringHint = 'Run "faber-memory init
|
|
314
|
+
wiringHint = 'Run "faber-memory init" to update engine pointers to the current compiled MEMORY.md path.';
|
|
315
315
|
}
|
|
316
316
|
else if (wiredEngines.length === 0) {
|
|
317
317
|
wiringStatus = 'WARN';
|
|
318
318
|
wiringDetails.push('No AI coding engine appears wired for faber-memory.');
|
|
319
|
-
wiringHint = 'Run "faber-memory init
|
|
319
|
+
wiringHint = 'Run "faber-memory init" to wire Claude Code, Antigravity, Claude Desktop, or Cursor.';
|
|
320
320
|
}
|
|
321
321
|
else {
|
|
322
322
|
wiringDetails.push(`Wired engines: ${wiredEngines.join(', ')}.`);
|
package/dist/src/importer.js
CHANGED
|
@@ -44,6 +44,11 @@ function inferSummary(raw, body, fallbackName) {
|
|
|
44
44
|
.find((l) => l.length > 0);
|
|
45
45
|
return (firstLine || fallbackName).slice(0, 140);
|
|
46
46
|
}
|
|
47
|
+
// A heading with nothing under it but the next heading (e.g. a "# Rules" title
|
|
48
|
+
// above "## ..." sections) is not an entry of its own.
|
|
49
|
+
function hasSectionBody(section) {
|
|
50
|
+
return section.lines.slice(1).join('\n').trim().length > 0;
|
|
51
|
+
}
|
|
47
52
|
function splitTopLevelHeadings(content) {
|
|
48
53
|
const lines = content.replace(/\r\n/g, '\n').split('\n');
|
|
49
54
|
const sections = [];
|
|
@@ -51,7 +56,7 @@ function splitTopLevelHeadings(content) {
|
|
|
51
56
|
for (const line of lines) {
|
|
52
57
|
const m = line.match(/^#{1,2}\s+(.+)$/);
|
|
53
58
|
if (m) {
|
|
54
|
-
if (current && current
|
|
59
|
+
if (current && hasSectionBody(current)) {
|
|
55
60
|
sections.push(current);
|
|
56
61
|
}
|
|
57
62
|
current = { title: m[1].trim(), lines: [line] };
|
|
@@ -60,7 +65,7 @@ function splitTopLevelHeadings(content) {
|
|
|
60
65
|
current.lines.push(line);
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
|
-
if (current && current
|
|
68
|
+
if (current && hasSectionBody(current)) {
|
|
64
69
|
sections.push(current);
|
|
65
70
|
}
|
|
66
71
|
return sections.map((s) => ({ title: s.title, body: s.lines.join('\n').trim() }));
|
package/dist/src/init.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UserConfig } from './types.js';
|
|
2
2
|
export declare const BLOCK_START = "<!-- faber-memory:start -->";
|
|
3
3
|
export declare const BLOCK_END = "<!-- faber-memory:end -->";
|
|
4
|
+
export declare const TOOL_GUIDANCE_LINE = "Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly).";
|
|
4
5
|
export declare const PROJECT_HINT_LINE = "Project memory: run npx @fabersep/memory init";
|
|
5
6
|
export type EngineName = 'claude-code' | 'claude-desktop' | 'antigravity' | 'cursor' | 'codex';
|
|
6
7
|
export interface EngineSpec {
|
package/dist/src/init.js
CHANGED
|
@@ -6,6 +6,7 @@ import { compileGlobalL0 } from './compiler.js';
|
|
|
6
6
|
import { c, hr, shouldUseColor } from './ui.js';
|
|
7
7
|
export const BLOCK_START = '<!-- faber-memory:start -->';
|
|
8
8
|
export const BLOCK_END = '<!-- faber-memory:end -->';
|
|
9
|
+
export const TOOL_GUIDANCE_LINE = 'Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly).';
|
|
9
10
|
export const PROJECT_HINT_LINE = 'Project memory: run npx @fabersep/memory init';
|
|
10
11
|
export function getEngineSpecs() {
|
|
11
12
|
return {
|
|
@@ -15,7 +16,7 @@ export function getEngineSpecs() {
|
|
|
15
16
|
gap: false,
|
|
16
17
|
instructionFile: (home) => path.join(home, '.claude', 'CLAUDE.md'),
|
|
17
18
|
mcpConfigFile: (home) => path.join(home, '.claude.json'),
|
|
18
|
-
renderBlock: (l0Path) => `${BLOCK_START}\n@${l0Path}\n${BLOCK_END}`,
|
|
19
|
+
renderBlock: (l0Path) => `${BLOCK_START}\n@${l0Path}\n${TOOL_GUIDANCE_LINE}\n${BLOCK_END}`,
|
|
19
20
|
},
|
|
20
21
|
'claude-desktop': {
|
|
21
22
|
name: 'claude-desktop',
|
|
@@ -31,7 +32,7 @@ export function getEngineSpecs() {
|
|
|
31
32
|
gap: false,
|
|
32
33
|
instructionFile: (home) => path.join(home, '.gemini', 'GEMINI.md'),
|
|
33
34
|
mcpConfigFile: (home) => path.join(home, '.gemini', 'config', 'mcp_config.json'),
|
|
34
|
-
renderBlock: (l0Path) => `${BLOCK_START}\nAt session start, read ${l0Path}
|
|
35
|
+
renderBlock: (l0Path) => `${BLOCK_START}\nAt session start, read ${l0Path} (global L0 memory).\n${TOOL_GUIDANCE_LINE}\n${BLOCK_END}`,
|
|
35
36
|
},
|
|
36
37
|
cursor: {
|
|
37
38
|
name: 'cursor',
|
|
@@ -139,7 +140,7 @@ export function planOrApplyInit(config, options = {}) {
|
|
|
139
140
|
// Always compile L0 BEFORE writing any user-level pointer (AC-19b1)
|
|
140
141
|
const comp = compileGlobalL0(config, { homeDir, trigger: 'init' });
|
|
141
142
|
if (!comp.ok) {
|
|
142
|
-
throw new Error(`L0 compilation failed before init
|
|
143
|
+
throw new Error(`L0 compilation failed before init:\n${comp.errors.join('\n')}`);
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
for (const engineName of engines) {
|
package/dist/src/mcp.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const MCP_TOOLS: readonly [{
|
|
|
46
46
|
};
|
|
47
47
|
}, {
|
|
48
48
|
readonly name: "memory_propose";
|
|
49
|
-
readonly description: "
|
|
49
|
+
readonly description: "Propose a durable rule, decision, lesson or preference you learned (or a fix to an existing entry). Goes to pre-memory for human approval; never edits active memory.";
|
|
50
50
|
readonly inputSchema: {
|
|
51
51
|
readonly type: "object";
|
|
52
52
|
readonly properties: {
|
|
@@ -157,7 +157,7 @@ export declare class FaberMemoryMcpServer {
|
|
|
157
157
|
};
|
|
158
158
|
}, {
|
|
159
159
|
readonly name: "memory_propose";
|
|
160
|
-
readonly description: "
|
|
160
|
+
readonly description: "Propose a durable rule, decision, lesson or preference you learned (or a fix to an existing entry). Goes to pre-memory for human approval; never edits active memory.";
|
|
161
161
|
readonly inputSchema: {
|
|
162
162
|
readonly type: "object";
|
|
163
163
|
readonly properties: {
|
package/dist/src/mcp.js
CHANGED
|
@@ -9,6 +9,7 @@ import { appendMetric, MAX_GET_FOUND_IDS } from './metrics.js';
|
|
|
9
9
|
import { createProposal, reconcileAwaitingCommitProposals } from './proposals.js';
|
|
10
10
|
import { loadAllScopes, resolveProjectRoot } from './store.js';
|
|
11
11
|
import { syncAllRoots } from './sync.js';
|
|
12
|
+
import { getPackageVersion } from './version.js';
|
|
12
13
|
import { VALID_TYPES, } from './types.js';
|
|
13
14
|
export const MCP_TOOLS = [
|
|
14
15
|
{
|
|
@@ -37,7 +38,7 @@ export const MCP_TOOLS = [
|
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
name: 'memory_propose',
|
|
40
|
-
description: '
|
|
41
|
+
description: 'Propose a durable rule, decision, lesson or preference you learned (or a fix to an existing entry). Goes to pre-memory for human approval; never edits active memory.',
|
|
41
42
|
inputSchema: {
|
|
42
43
|
type: 'object',
|
|
43
44
|
properties: {
|
|
@@ -364,7 +365,7 @@ export class FaberMemoryMcpServer {
|
|
|
364
365
|
},
|
|
365
366
|
serverInfo: {
|
|
366
367
|
name: '@fabersep/memory',
|
|
367
|
-
version:
|
|
368
|
+
version: getPackageVersion(),
|
|
368
369
|
},
|
|
369
370
|
},
|
|
370
371
|
};
|
package/dist/src/stats.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CacheAnalysisResult, CacheEngineOption } from './cache-logs.js';
|
|
2
|
+
import { getPackageVersion } from './version.js';
|
|
3
|
+
export { getPackageVersion };
|
|
2
4
|
export declare const STATS_SCHEMA_VERSION = 1;
|
|
3
5
|
export declare const MCP_SCHEMA_TOKEN_TARGET = 500;
|
|
4
6
|
export declare const STALE_VERIFIED_DAYS = 90;
|
|
5
7
|
export declare const L0_CHURN_WARN_THRESHOLD = 5;
|
|
6
|
-
export declare function getPackageVersion(): string;
|
|
7
8
|
export declare function validateDaysArg(raw: unknown): {
|
|
8
9
|
ok: true;
|
|
9
10
|
days: number;
|
package/dist/src/stats.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
2
|
import { analyzeCacheLogs } from './cache-logs.js';
|
|
5
3
|
import { estimateCorpusTokens, estimateTokens, renderGlobalL0 } from './compiler.js';
|
|
6
4
|
import { getCompiledL0Path, getConfigPath, getHomeDir, loadConfig } from './config.js';
|
|
@@ -8,24 +6,12 @@ import { MCP_TOOLS } from './mcp.js';
|
|
|
8
6
|
import { readMetrics, } from './metrics.js';
|
|
9
7
|
import { loadScopeFromHead, PROJECT_MEMORY_REL_DIR, resolveProjectRoot } from './store.js';
|
|
10
8
|
import { c, hr } from './ui.js';
|
|
9
|
+
import { getPackageVersion } from './version.js';
|
|
10
|
+
export { getPackageVersion };
|
|
11
11
|
export const STATS_SCHEMA_VERSION = 1;
|
|
12
12
|
export const MCP_SCHEMA_TOKEN_TARGET = 500;
|
|
13
13
|
export const STALE_VERIFIED_DAYS = 90;
|
|
14
14
|
export const L0_CHURN_WARN_THRESHOLD = 5;
|
|
15
|
-
export function getPackageVersion() {
|
|
16
|
-
try {
|
|
17
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
const pkgPath = path.resolve(__dirname, '../../package.json');
|
|
19
|
-
const raw = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
20
|
-
if (typeof raw.version === 'string' && raw.version.trim()) {
|
|
21
|
-
return raw.version.trim();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// Fallback below
|
|
26
|
-
}
|
|
27
|
-
return '0.2.0';
|
|
28
|
-
}
|
|
29
15
|
export function validateDaysArg(raw) {
|
|
30
16
|
if (raw === undefined || raw === false) {
|
|
31
17
|
return { ok: true, days: 30 };
|
package/dist/src/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type TeamSubmitMode = 'auto' | 'pr';
|
|
|
6
6
|
export type ProposalAction = 'create' | 'update' | 'supersede';
|
|
7
7
|
export type ProposalStatus = 'pending' | 'awaiting_commit' | 'push_failed';
|
|
8
8
|
export type ProjectRootSource = 'mcp-roots' | 'cwd' | 'none';
|
|
9
|
-
export declare const COMPILER_VERSION
|
|
9
|
+
export declare const COMPILER_VERSION: string;
|
|
10
10
|
export declare const DEFAULT_TOKEN_BUDGET = 1500;
|
|
11
11
|
export declare const DEFAULT_STALE_DAYS = 14;
|
|
12
12
|
export declare const DEFAULT_SIMILARITY_THRESHOLD = 0.45;
|
package/dist/src/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { getPackageVersion } from './version.js';
|
|
2
|
+
export const COMPILER_VERSION = getPackageVersion();
|
|
2
3
|
export const DEFAULT_TOKEN_BUDGET = 1500;
|
|
3
4
|
export const DEFAULT_STALE_DAYS = 14;
|
|
4
5
|
export const DEFAULT_SIMILARITY_THRESHOLD = 0.45;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
let cached;
|
|
5
|
+
/** The installed package version, read from package.json (dist/src/ -> ../../package.json). */
|
|
6
|
+
export function getPackageVersion() {
|
|
7
|
+
if (cached)
|
|
8
|
+
return cached;
|
|
9
|
+
try {
|
|
10
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const raw = JSON.parse(fs.readFileSync(path.resolve(here, '../../package.json'), 'utf8'));
|
|
12
|
+
if (typeof raw.version === 'string' && raw.version.trim()) {
|
|
13
|
+
cached = raw.version.trim();
|
|
14
|
+
return cached;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// Fallback below
|
|
19
|
+
}
|
|
20
|
+
cached = '0.0.0';
|
|
21
|
+
return cached;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabersep/memory",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Prefix-cache-first, Git-backed Markdown memory MCP server, pre-memory staging, and import CLI for AI coding agents.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"dist/src",
|
|
33
33
|
"LICENSE",
|
|
34
|
-
"README.md"
|
|
34
|
+
"README.md",
|
|
35
|
+
"CHANGELOG.md"
|
|
35
36
|
],
|
|
36
37
|
"engines": {
|
|
37
38
|
"node": ">=20"
|