@fabersep/memory 0.3.0 → 0.5.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/CHANGELOG.md +18 -0
- package/README.md +67 -89
- package/dist/src/cli.js +106 -3
- package/dist/src/config.js +1 -0
- package/dist/src/direct-save.d.ts +53 -0
- package/dist/src/direct-save.js +226 -0
- package/dist/src/doctor.js +4 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/init.d.ts +1 -1
- package/dist/src/init.js +1 -1
- package/dist/src/mcp.d.ts +45 -2
- package/dist/src/mcp.js +281 -142
- package/dist/src/metrics.d.ts +4 -2
- package/dist/src/proposals.d.ts +10 -3
- package/dist/src/proposals.js +14 -2
- package/dist/src/stats.d.ts +8 -0
- package/dist/src/stats.js +16 -2
- package/dist/src/types.d.ts +12 -0
- package/dist/src/web-assets.d.ts +4 -0
- package/dist/src/web-assets.js +1390 -0
- package/dist/src/web.d.ts +41 -0
- package/dist/src/web.js +997 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@fabersep/memory`. Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.5.0](https://github.com/fabersep/memory/compare/v0.4.0...v0.5.0) (2026-12-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* save memories the user dictates directly, always in the startup index ([#19](https://github.com/fabersep/memory/issues/19)) ([edbbc0c](https://github.com/fabersep/memory/commit/edbbc0c209a2c4eea5ebc2952bd9b273b8670193))
|
|
11
|
+
|
|
12
|
+
## 0.4.0 (2026-12-02)
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Local web UI (feature 04):** `faber-memory web` and `faber-memory review --web` open a zero-dependency UI in your browser, bound to `127.0.0.1` only. Review, edit, approve, reject or skip proposals and commit them in one batch; browse, search, edit or delete active memories across scopes; see a compact status, doctor and stats summary.
|
|
16
|
+
- Flags: `--port <n>`, `--no-open`, `--idle-timeout <min>` and `--read-only` (read-only hosts are always read-only).
|
|
17
|
+
- Security: a per-launch token exchanged for an `HttpOnly` `SameSite=Strict` cookie, CSRF and DNS-rebinding checks, a strict CSP, and shutdown on idle timeout or from the UI.
|
|
18
|
+
- Brand logo and favicon in the web UI.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- The README installs the package globally and uses `faber-memory`, with a how-it-works animation and a web UI screenshot.
|
|
22
|
+
|
|
5
23
|
## 0.3.0 (2026-11-29)
|
|
6
24
|
|
|
7
25
|
### Added
|
package/README.md
CHANGED
|
@@ -1,138 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
<h1><img src="docs/assets/logo.svg" alt="" width="28" height="28" align="absmiddle"> FaberSEP Memory</h1>
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@fabersep/memory)
|
|
4
|
+
[](https://github.com/fabersep/memory/actions/workflows/test.yml)
|
|
4
5
|
[](LICENSE)
|
|
5
6
|
|
|
6
|
-
**
|
|
7
|
+
**One memory for every AI coding agent you use, on every machine you use it. Agents propose, you approve, Git keeps it.**
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="docs/assets/one-memory-hero.svg" alt="One memory for every AI tool: FaberSEP Memory in the center, connected to Claude Code, Antigravity, Cursor, Codex, Claude Desktop, agents on a server, teammates and any MCP client." width="920">
|
|
11
|
+
</p>
|
|
9
12
|
|
|
10
13
|
---
|
|
11
14
|
|
|
12
|
-
##
|
|
15
|
+
## Why it exists
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
AI coding agents remember things now. Claude Code writes its own memory files, Antigravity keeps its own knowledge, Cursor has rules. But each one remembers **for itself, on one machine**.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
FaberSEP Memory started from a common setup: several AI tools on a workstation, plus agents running unattended on a server. Without a shared layer, a rule settled with one tool stays unknown to the others, and every machine drifts on its own. FaberSEP Memory gives all of them **one** memory: a rule approved once is known to every tool on every machine, and nothing becomes a rule without the owner's approval.
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
## How it differs from an agent's built-in memory
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
| | Built-in agent memory | FaberSEP Memory |
|
|
24
|
+
| :--- | :--- | :--- |
|
|
25
|
+
| **Who can read it** | The one tool that wrote it | Claude Code, Antigravity, Cursor, Claude Desktop, Codex (manual setup) |
|
|
26
|
+
| **Where it lives** | One machine | A Git repo you can clone to any machine, a server included (read-only there) |
|
|
27
|
+
| **Who writes it** | The agent, silently | What you tell it to remember is saved at once; what the agent decides on its own waits for your approval |
|
|
28
|
+
| **History and undo** | Usually none | Every change is a Git commit |
|
|
29
|
+
| **Team use** | Not shareable | Optional private team repo |
|
|
30
|
+
| **Context cost** | Grows with the file | A fixed-size index (max ~1,500 tokens); details fetched on demand |
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
If you use one tool on one machine and are happy with its memory, you don't need this.
|
|
23
33
|
|
|
24
|
-
|
|
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.
|
|
34
|
+
## What `init` changes, and how your agent finds it
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
There is **no background service and no account**. `faber-memory` is a CLI plus a small MCP server that your AI tool starts by itself (stdio) when a chat opens.
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
`faber-memory init` does three things:
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
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.
|
|
40
|
+
1. **Creates your memory folder** at `~/.faber/memory`: plain Markdown notes in a Git repo.
|
|
41
|
+
2. **Adds one marked block** to each tool's global instruction file. For Claude Code, in `~/.claude/CLAUDE.md`:
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
```markdown
|
|
44
|
+
<!-- faber-memory:start -->
|
|
45
|
+
@/Users/you/.config/faber-memory/state/MEMORY.md
|
|
46
|
+
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). When the user explicitly asks you to remember something, call memory_propose with source "user" and their exact words in user_quote; it is saved at once.
|
|
47
|
+
<!-- faber-memory:end -->
|
|
48
|
+
```
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx @fabersep/memory init
|
|
48
|
-
```
|
|
50
|
+
`MEMORY.md` is a short index compiled from your notes, so the agent knows what exists from the first message.
|
|
51
|
+
3. **Registers the MCP server** `faber-memory` in each tool's MCP config. It gives the agent three tools: `memory_search`, `memory_get` and `memory_propose`. Agents can only propose; they never write active memory.
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
| Tool | Instruction file | MCP config |
|
|
54
|
+
| :--- | :--- | :--- |
|
|
55
|
+
| Claude Code | `~/.claude/CLAUDE.md` | `~/.claude.json` |
|
|
56
|
+
| Antigravity | `~/.gemini/GEMINI.md` | `~/.gemini/config/mcp_config.json` |
|
|
57
|
+
| Cursor | none | `~/.cursor/mcp.json` |
|
|
58
|
+
| Claude Desktop | none | `claude_desktop_config.json` (`--engine claude-desktop`) |
|
|
59
|
+
| Codex | none | add the MCP server by hand |
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
Every touched file gets a `.bak` backup. `init --preview` shows the exact diff first, and `init --undo` removes the block and the MCP entry and leaves your notes alone. Details: [Connecting engines](docs/guide.md#connecting-engines-init).
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
npx @fabersep/memory init ~/my-notes
|
|
56
|
-
```
|
|
63
|
+
## Get started
|
|
57
64
|
|
|
58
|
-
|
|
65
|
+
You need Node.js 20+ and Git.
|
|
59
66
|
|
|
60
67
|
```bash
|
|
61
|
-
|
|
68
|
+
npm install -g @fabersep/memory
|
|
69
|
+
faber-memory init # add --preview to see the changes first
|
|
70
|
+
faber-memory doctor # every line should say PASS
|
|
62
71
|
```
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
**3. Start a new chat in your assistant**
|
|
67
|
-
|
|
68
|
-
Tell it something about your project that it would otherwise get wrong, for example:
|
|
69
|
-
|
|
70
|
-
> *"In this project we run the tests with `make test`, never `npm test`. Please remember that."*
|
|
71
|
-
|
|
72
|
-
It should suggest saving this as a memory. (If it doesn't, ask it: *"Propose this as a memory."*)
|
|
73
|
+
Open a **new** chat and tell your agent something it would otherwise get wrong, for example *"In this project we run the tests with `make test`. Remember that."* Because you asked, it is saved at once, and the agent tells you how to undo it (`faber-memory undo <id>`).
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
When the agent learns something on its own (say, from a failed build), it only *proposes* a memory. Approve those in the review page:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
|
-
|
|
78
|
+
faber-memory web # local review UI on 127.0.0.1 (or: faber-memory review)
|
|
78
79
|
```
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
Either way, any connected tool knows it from its next new chat.
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
<p align="center">
|
|
84
|
+
<img src="docs/assets/web-ui-review.png" alt="FaberSEP Memory local Web UI showing pending memory proposals with Approve, Edit, Reject, Skip and Commit Batch controls alongside Browse and Health tabs." width="820">
|
|
85
|
+
</p>
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
Already have rules in `AGENTS.md`, `CLAUDE.md` or Cursor rules? [Import them](docs/guide.md#importing-existing-notes); they go through the same review.
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## A normal day with it
|
|
89
|
-
|
|
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.
|
|
89
|
+
## More than one machine
|
|
94
90
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```markdown
|
|
98
|
-
---
|
|
99
|
-
id: use-pnpm
|
|
100
|
-
type: rule
|
|
101
|
-
summary: Use pnpm, not npm, in this team's projects.
|
|
102
|
-
---
|
|
91
|
+
Your memory is a Git repo, so push it to a **private** remote and clone it elsewhere:
|
|
103
92
|
|
|
104
|
-
|
|
93
|
+
```bash
|
|
94
|
+
faber-memory remote add git@github.com:<you>/<private-repo>.git # on your main machine
|
|
95
|
+
faber-memory setup --read-only <repo-url> # on a server that runs agents
|
|
96
|
+
faber-memory init # then connect that server's agents
|
|
105
97
|
```
|
|
106
98
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## Common questions
|
|
110
|
-
|
|
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)
|
|
113
|
-
|
|
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.
|
|
116
|
-
|
|
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.
|
|
99
|
+
A read-only host pulls on start and serves the same memory to its agents; proposals and approvals stay on your main machine. See [Personal remote and a second machine](docs/guide.md#personal-remote-and-a-second-machine).
|
|
119
100
|
|
|
120
|
-
|
|
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).
|
|
101
|
+
## Teams
|
|
122
102
|
|
|
123
|
-
|
|
124
|
-
Run `npx @fabersep/memory doctor` first. Then check [Troubleshooting](docs/troubleshooting.md) or [open an issue](https://github.com/fabersep/memory/issues).
|
|
103
|
+
Connect a private team repo and one approved rule reaches every teammate, whatever tool each person uses. See [Team mode](docs/guide.md#team-mode-shared-private-repo).
|
|
125
104
|
|
|
126
105
|
---
|
|
127
106
|
|
|
128
|
-
##
|
|
107
|
+
## Learn more
|
|
129
108
|
|
|
130
|
-
- **[User guide and reference](docs/guide.md):** how it works inside,
|
|
131
|
-
- **[Why FaberSEP Memory?](docs/why-faber-memory.md):** comparisons with built-in memory
|
|
132
|
-
- **[Troubleshooting](docs/troubleshooting.md)
|
|
133
|
-
- **[Contributing](CONTRIBUTING.md)** and **[Changelog](CHANGELOG.md)**.
|
|
109
|
+
- **[User guide and reference](docs/guide.md):** how it works inside, every command, the MCP tools, where files live, updating and removing.
|
|
110
|
+
- **[Why FaberSEP Memory?](docs/why-faber-memory.md):** comparisons with built-in memory, one big `AGENTS.md` and vector databases.
|
|
111
|
+
- **[Troubleshooting](docs/troubleshooting.md)**, **[Contributing](CONTRIBUTING.md)**, **[Changelog](CHANGELOG.md)**.
|
|
134
112
|
|
|
135
|
-
|
|
113
|
+
Free and open source, runs on your computer, no account or API key. Part of [FaberSEP](https://github.com/fabersep).
|
|
136
114
|
|
|
137
115
|
## License
|
|
138
116
|
|
package/dist/src/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as path from 'node:path';
|
|
|
4
4
|
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
|
+
import { countRecentDirectSaves, DIRECT_SAVE_RECENT_DAYS, isDirectUserSaveOn, undoDirectSave, } from './direct-save.js';
|
|
7
8
|
import { formatDoctorReport, runDoctor } from './doctor.js';
|
|
8
9
|
import { getDefaultBranch, getHeadSha, gitCloneTeamRepo, gitInitSoloRepo, gitSync, isGitRepo, } from './git.js';
|
|
9
10
|
import { runImport } from './importer.js';
|
|
@@ -16,11 +17,12 @@ import { syncAllRoots } from './sync.js';
|
|
|
16
17
|
import { addPersonalRemote, DEFAULT_READ_ONLY_PATH, getAheadInfo, getPushMode, getUnpushedReminder, isReadOnlyRoot, pushPersonalRoot, READ_ONLY_MESSAGE, removePersonalRemote, } from './personal-remote.js';
|
|
17
18
|
import { getPackageVersion } from './version.js';
|
|
18
19
|
import { c, hr, inferErrorAnchor, normalizeTeamUrl, troubleshootingLink, } from './ui.js';
|
|
20
|
+
import { openBrowserBestEffort, startWebServer, validateIdleTimeoutArg, validatePortArg, } from './web.js';
|
|
19
21
|
// Flags that never take a value, so `init --preview ~/notes` keeps ~/notes as a positional.
|
|
20
22
|
const BOOLEAN_FLAGS = new Set([
|
|
21
23
|
'apply', 'undo', 'preview', 'dry-run', 'check', 'json', 'strict', 'cache', 'share', 'yes',
|
|
22
24
|
'all', 'approve', 'approve-all', 'split-headings', 'normalize-paths', 'project-hint',
|
|
23
|
-
'include-personal-repo', 'help', 'allow-public',
|
|
25
|
+
'include-personal-repo', 'help', 'allow-public', 'web', 'no-open',
|
|
24
26
|
]);
|
|
25
27
|
function parseFlags(args) {
|
|
26
28
|
const positional = [];
|
|
@@ -292,6 +294,19 @@ async function main() {
|
|
|
292
294
|
console.log(c.green(`Updated personal push mode to ${mode}`));
|
|
293
295
|
return 0;
|
|
294
296
|
}
|
|
297
|
+
if (sub === 'set-direct-save') {
|
|
298
|
+
const value = positional[1];
|
|
299
|
+
if (value !== 'on' && value !== 'off') {
|
|
300
|
+
console.error('Usage: faber-memory config set-direct-save <on|off>');
|
|
301
|
+
return 1;
|
|
302
|
+
}
|
|
303
|
+
config.directUserSave = value === 'on';
|
|
304
|
+
saveConfig(config, homeDir);
|
|
305
|
+
console.log(c.green(value === 'on'
|
|
306
|
+
? 'Direct save is on: memories you ask the agent to remember are saved to personal memory at once.'
|
|
307
|
+
: 'Direct save is off: memories you ask the agent to remember wait for review like any proposal.'));
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
295
310
|
if (sub === 'unset') {
|
|
296
311
|
const scope = positional[1];
|
|
297
312
|
if (!scope || !['personal', 'team'].includes(scope)) {
|
|
@@ -391,6 +406,25 @@ async function main() {
|
|
|
391
406
|
}
|
|
392
407
|
return 0;
|
|
393
408
|
}
|
|
409
|
+
if (cmd === 'undo') {
|
|
410
|
+
const config = loadConfig(homeDir);
|
|
411
|
+
const entryId = positional[0];
|
|
412
|
+
if (!entryId) {
|
|
413
|
+
console.error('Usage: faber-memory undo <entry-id> (undo a memory saved directly on your word)');
|
|
414
|
+
return 1;
|
|
415
|
+
}
|
|
416
|
+
const res = undoDirectSave(config, entryId, homeDir);
|
|
417
|
+
for (const m of res.messages)
|
|
418
|
+
console.log(m);
|
|
419
|
+
if (!res.ok) {
|
|
420
|
+
for (const e of res.errors)
|
|
421
|
+
printErrorWithHelp(e);
|
|
422
|
+
return 1;
|
|
423
|
+
}
|
|
424
|
+
const ask = isInteractive() && !flags.yes ? (q) => promptLine(q) : undefined;
|
|
425
|
+
await afterPersonalCommit(config, homeDir, ask);
|
|
426
|
+
return 0;
|
|
427
|
+
}
|
|
394
428
|
if (cmd === 'reject') {
|
|
395
429
|
if (flags.all) {
|
|
396
430
|
const proposals = reconcileAwaitingCommitProposals(homeDir);
|
|
@@ -462,7 +496,68 @@ async function main() {
|
|
|
462
496
|
console.log(c.green('Reset complete.'));
|
|
463
497
|
return 0;
|
|
464
498
|
}
|
|
499
|
+
async function runWebCommand(initialView) {
|
|
500
|
+
const portCheck = validatePortArg(flags.port);
|
|
501
|
+
if (!portCheck.ok) {
|
|
502
|
+
printErrorWithHelp(portCheck.error);
|
|
503
|
+
return 1;
|
|
504
|
+
}
|
|
505
|
+
const idleCheck = validateIdleTimeoutArg(flags['idle-timeout']);
|
|
506
|
+
if (!idleCheck.ok) {
|
|
507
|
+
printErrorWithHelp(idleCheck.error);
|
|
508
|
+
return 1;
|
|
509
|
+
}
|
|
510
|
+
let srv;
|
|
511
|
+
try {
|
|
512
|
+
srv = await startWebServer({
|
|
513
|
+
homeDir,
|
|
514
|
+
cwd: process.cwd(),
|
|
515
|
+
port: portCheck.port,
|
|
516
|
+
idleTimeoutMinutes: idleCheck.minutes,
|
|
517
|
+
readOnly: Boolean(flags['read-only']),
|
|
518
|
+
initialView,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
catch (err) {
|
|
522
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
523
|
+
printErrorWithHelp(`Failed to start local web UI: ${msg}`);
|
|
524
|
+
return 1;
|
|
525
|
+
}
|
|
526
|
+
const onSignal = () => {
|
|
527
|
+
void srv.close();
|
|
528
|
+
};
|
|
529
|
+
process.on('SIGINT', onSignal);
|
|
530
|
+
process.on('SIGTERM', onSignal);
|
|
531
|
+
try {
|
|
532
|
+
const modeLabel = srv.readOnly ? 'read-only' : 'writable';
|
|
533
|
+
const timeoutLabel = idleCheck.minutes > 0 ? `${idleCheck.minutes}m idle timeout` : 'idle timeout disabled';
|
|
534
|
+
console.log(c.bold('FaberSEP Memory Web UI'));
|
|
535
|
+
console.log(`URL: ${srv.authUrl}`);
|
|
536
|
+
console.log(c.dim(`Mode: ${modeLabel} | Loopback only (127.0.0.1) | ${timeoutLabel}`));
|
|
537
|
+
if (!flags['no-open'] && isInteractive()) {
|
|
538
|
+
const opened = openBrowserBestEffort(srv.authUrl);
|
|
539
|
+
if (!opened) {
|
|
540
|
+
console.log(c.dim('Could not launch browser automatically; open the URL above manually.'));
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const reason = await srv.waitForClose;
|
|
544
|
+
if (reason === 'idle') {
|
|
545
|
+
console.log(c.dim('Local web UI shut down after idle timeout.'));
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
finally {
|
|
549
|
+
process.off('SIGINT', onSignal);
|
|
550
|
+
process.off('SIGTERM', onSignal);
|
|
551
|
+
}
|
|
552
|
+
return 0;
|
|
553
|
+
}
|
|
554
|
+
if (cmd === 'web') {
|
|
555
|
+
return runWebCommand('auto');
|
|
556
|
+
}
|
|
465
557
|
if (cmd === 'review') {
|
|
558
|
+
if (flags.web) {
|
|
559
|
+
return runWebCommand('review');
|
|
560
|
+
}
|
|
466
561
|
const config = loadConfig(homeDir);
|
|
467
562
|
if (isReadOnlyRoot(config.roots.personal)) {
|
|
468
563
|
printErrorWithHelp(READ_ONLY_MESSAGE);
|
|
@@ -528,6 +623,9 @@ async function main() {
|
|
|
528
623
|
if (p.forceNew && p.reason) {
|
|
529
624
|
console.log(`${c.yellow('force_new reason:')} ${p.reason}`);
|
|
530
625
|
}
|
|
626
|
+
if (p.source === 'user') {
|
|
627
|
+
console.log(`${c.green('User asked:')} "${p.userQuote || ''}"`);
|
|
628
|
+
}
|
|
531
629
|
console.log(c.dim(hr('─', 68)));
|
|
532
630
|
const bodyLines = p.body.split('\n');
|
|
533
631
|
if (!showFull && bodyLines.length > MAX_PREVIEW_LINES) {
|
|
@@ -662,6 +760,7 @@ async function main() {
|
|
|
662
760
|
const reminder = getUnpushedReminder(config, homeDir);
|
|
663
761
|
if (reminder)
|
|
664
762
|
console.log(c.yellow(` ${reminder}`));
|
|
763
|
+
console.log(` Direct save: ${isDirectUserSaveOn(config) ? 'on' : 'off'} (${countRecentDirectSaves(homeDir)} in the last ${DIRECT_SAVE_RECENT_DAYS} days)`);
|
|
665
764
|
}
|
|
666
765
|
console.log(` Project root: ${projectRes.projectRoot || 'none'} (source: ${projectRes.source})`);
|
|
667
766
|
if (loaded.uncommittedWarnings.length > 0) {
|
|
@@ -678,6 +777,8 @@ async function main() {
|
|
|
678
777
|
const flagsList = [p.status];
|
|
679
778
|
if (isStale)
|
|
680
779
|
flagsList.push(`STALE (${ageDays}d > ${config.staleDays}d)`);
|
|
780
|
+
if (p.source === 'user')
|
|
781
|
+
flagsList.push('user asked');
|
|
681
782
|
console.log(` - ${p.id} [${p.scope}/${p.action}] (${flagsList.join(', ')}): ${p.summary}`);
|
|
682
783
|
if (p.status === 'awaiting_commit' && p.targetFilePath) {
|
|
683
784
|
console.log(` file: ${p.targetFilePath} — run "git add ${p.targetFilePath} && git commit" to activate`);
|
|
@@ -892,16 +993,18 @@ Commands:
|
|
|
892
993
|
setup --read-only <git-url> [path] (a host that only reads, e.g. a server)
|
|
893
994
|
remote add <git-url> [--allow-public] | remote remove
|
|
894
995
|
push
|
|
895
|
-
config [set-path <personal|team> <new-path> | set-submit-mode <auto|pr> | set-push-mode <ask|auto|never> | unset <personal|team>]
|
|
996
|
+
config [set-path <personal|team> <new-path> | set-submit-mode <auto|pr> | set-push-mode <ask|auto|never> | set-direct-save <on|off> | unset <personal|team>]
|
|
896
997
|
init [folder] [--remote <git-url>] [--preview | --undo] [--engine claude-code,antigravity,claude-desktop,cursor,codex] [--project-hint]
|
|
897
998
|
compile [--check] [--repo <dir>]
|
|
898
999
|
sync [--timeout <ms>]
|
|
899
1000
|
status
|
|
900
1001
|
stats [--days 1..90] [--json] [--cache] [--engine claude-code|antigravity|all] [--log-dir <path>] [--share]
|
|
901
1002
|
doctor [--json] [--strict]
|
|
902
|
-
review [--approve-all] [--yes]
|
|
1003
|
+
review [--approve-all] [--yes] [--web [--port <n>] [--no-open] [--idle-timeout <min>] [--read-only]]
|
|
1004
|
+
web [--port <n>] [--no-open] [--idle-timeout <min>] [--read-only]
|
|
903
1005
|
approve <proposal-id> [...] [--mode auto|pr] [--yes]
|
|
904
1006
|
reject <proposal-id> | reject --all [--yes]
|
|
1007
|
+
undo <entry-id> [--yes] (undo a memory saved directly on your word)
|
|
905
1008
|
reset [--include-personal-repo] [--yes]
|
|
906
1009
|
import --from <markdown-dir|claude-memory|agents-md|cursor-rules> <path> [--scope personal|team|project] [--split-headings] [--normalize-paths] [--approve]
|
|
907
1010
|
serve
|
package/dist/src/config.js
CHANGED
|
@@ -67,6 +67,7 @@ export function loadConfig(homeDir = getHomeDir()) {
|
|
|
67
67
|
? raw.similarityThreshold
|
|
68
68
|
: DEFAULT_SIMILARITY_THRESHOLD,
|
|
69
69
|
...(typeof raw.similarityHintFloor === 'number' ? { similarityHintFloor: raw.similarityHintFloor } : {}),
|
|
70
|
+
...(typeof raw.directUserSave === 'boolean' ? { directUserSave: raw.directUserSave } : {}),
|
|
70
71
|
roots: raw.roots || {},
|
|
71
72
|
};
|
|
72
73
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Proposal, ProposalAction, StagedReason, UserConfig } from './types.js';
|
|
2
|
+
/** 06 FR-06: direct saves allowed per MCP server process; later ones are staged. */
|
|
3
|
+
export declare const DIRECT_SAVE_SESSION_CAP = 5;
|
|
4
|
+
/** 06 FR-01: longest accepted `user_quote`. */
|
|
5
|
+
export declare const MAX_USER_QUOTE_CHARS = 1000;
|
|
6
|
+
export declare const DIRECT_SAVE_RECENT_DAYS = 7;
|
|
7
|
+
export interface DirectSaveRecord {
|
|
8
|
+
type: 'save' | 'undo';
|
|
9
|
+
ts: string;
|
|
10
|
+
entryId: string;
|
|
11
|
+
/** Full SHA of the direct-save commit (for `undo`, the commit that was reverted). */
|
|
12
|
+
commit: string;
|
|
13
|
+
action?: ProposalAction;
|
|
14
|
+
summary?: string;
|
|
15
|
+
quote?: string;
|
|
16
|
+
/** `undo` only: the revert commit. */
|
|
17
|
+
revertCommit?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function getDirectSaveLogPath(homeDir?: string): string;
|
|
20
|
+
export declare function isDirectUserSaveOn(config: UserConfig): boolean;
|
|
21
|
+
export declare function readDirectSaveRecords(homeDir?: string): DirectSaveRecord[];
|
|
22
|
+
/** Latest direct save per entry id that has not been undone. */
|
|
23
|
+
export declare function getActiveDirectSaves(homeDir?: string): Map<string, DirectSaveRecord>;
|
|
24
|
+
export declare function countRecentDirectSaves(homeDir?: string, days?: number, now?: number): number;
|
|
25
|
+
export type DirectSaveResult = {
|
|
26
|
+
ok: true;
|
|
27
|
+
commit: string;
|
|
28
|
+
estimatedTokens: number;
|
|
29
|
+
budget: number;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
stagedReason: StagedReason;
|
|
33
|
+
errors: string[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 06 FR-02: write the entry, make one commit, recompile L0 once. On a failed recompile the
|
|
37
|
+
* commit is undone and the caller stages the proposal instead. Pull and push are the caller's.
|
|
38
|
+
*/
|
|
39
|
+
export declare function directSavePersonal(config: UserConfig, proposal: Proposal, homeDir?: string): DirectSaveResult;
|
|
40
|
+
/**
|
|
41
|
+
* After a push that rebased the direct-save commit onto origin (03 FR-04), point the log at
|
|
42
|
+
* the rebased commit and recompile L0 (remote entries may have come in underneath).
|
|
43
|
+
* Returns the new full SHA, or null when the commit did not move.
|
|
44
|
+
*/
|
|
45
|
+
export declare function followRebasedDirectSave(config: UserConfig, commit: string, homeDir?: string): string | null;
|
|
46
|
+
export interface UndoResult {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
messages: string[];
|
|
49
|
+
errors: string[];
|
|
50
|
+
revertCommit?: string;
|
|
51
|
+
}
|
|
52
|
+
/** 06 FR-06: revert the latest direct-save commit of an entry in one commit and recompile L0. */
|
|
53
|
+
export declare function undoDirectSave(config: UserConfig, entryId: string, homeDir?: string): UndoResult;
|