memarium 0.13.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/LICENSE +21 -0
- package/README.md +146 -0
- package/assets/scripts/merge-books.mjs +921 -0
- package/assets/workflows/memarium-aggregate.yml +66 -0
- package/dist/bin/memarium.js +6 -0
- package/dist/src/aggregated-store.js +95 -0
- package/dist/src/cli.js +175 -0
- package/dist/src/commands/cat.js +20 -0
- package/dist/src/commands/doctor.js +383 -0
- package/dist/src/commands/init-wizard.js +201 -0
- package/dist/src/commands/init.js +45 -0
- package/dist/src/commands/list.js +19 -0
- package/dist/src/commands/prune.js +108 -0
- package/dist/src/commands/resume/config-pathmap.js +38 -0
- package/dist/src/commands/resume/fuzzy-match.js +13 -0
- package/dist/src/commands/resume/list-sessions.js +54 -0
- package/dist/src/commands/resume/render-prompt.js +121 -0
- package/dist/src/commands/resume/resume.js +121 -0
- package/dist/src/commands/show.js +21 -0
- package/dist/src/commands/sync.js +279 -0
- package/dist/src/commands/upgrade.js +47 -0
- package/dist/src/commands/workflow.js +126 -0
- package/dist/src/config.js +98 -0
- package/dist/src/content-project-inference.js +185 -0
- package/dist/src/device.js +47 -0
- package/dist/src/digest/manifest.js +121 -0
- package/dist/src/digest/project-filter.js +32 -0
- package/dist/src/digest/session-signal.js +106 -0
- package/dist/src/digest/toc.js +127 -0
- package/dist/src/git-ops.js +359 -0
- package/dist/src/index-store.js +35 -0
- package/dist/src/migrate.js +72 -0
- package/dist/src/project-identity.js +139 -0
- package/dist/src/project-resolve.js +42 -0
- package/dist/src/prompts.js +87 -0
- package/dist/src/repo-data-dir.js +25 -0
- package/dist/src/slug.js +28 -0
- package/dist/src/sources/base.js +1 -0
- package/dist/src/sources/claude-code.js +294 -0
- package/dist/src/sources/vscode-copilot.js +400 -0
- package/dist/src/types.js +1 -0
- package/dist/src/writer.js +240 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yue Liu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# memarium
|
|
2
|
+
|
|
3
|
+
Cross-device sync for your AI coding sessions.
|
|
4
|
+
|
|
5
|
+
`memarium` is the npm CLI half of a two-package system. It collects
|
|
6
|
+
Claude Code + VS Code Copilot Chat sessions on every machine you use,
|
|
7
|
+
pushes them to a private git repo, and lets you `resume` a session
|
|
8
|
+
on a different laptop than where it started.
|
|
9
|
+
|
|
10
|
+
For digest + recall (chronicles, topics, "what did past-me figure out"
|
|
11
|
+
queries), install the **Claude Code plugin**:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
/plugin marketplace add june9593/memarium-plugin
|
|
15
|
+
/plugin install memarium
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The plugin is independent — install it without the npm CLI if you only
|
|
19
|
+
work on one machine. Install both if you want sync + digest.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install -g memarium
|
|
25
|
+
memarium init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The wizard walks you through:
|
|
29
|
+
|
|
30
|
+
1. **Sync to a remote git repo?** (yes/no — local-only is also valid)
|
|
31
|
+
2. **Repo URL** + local checkout path
|
|
32
|
+
3. **Stable device name** for this machine's git branch (defaults to a
|
|
33
|
+
cleaned hostname; pick a physical label like `mini2` if it drifts)
|
|
34
|
+
|
|
35
|
+
CI cross-device aggregation is auto-enabled when you sync to a remote, and
|
|
36
|
+
assistant reasoning is always included in synced markdown.
|
|
37
|
+
|
|
38
|
+
After init, push your sessions:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
memarium sync
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Cross-device resume (NEW in 0.5.0)
|
|
45
|
+
|
|
46
|
+
Once you've sync'd from machine A, machine B can resume a session that
|
|
47
|
+
started on A:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
# On machine B (after `memarium sync` pulls A's session-repo):
|
|
51
|
+
memarium list-sessions --since 7d # Find sessions from this week
|
|
52
|
+
memarium resume <sessionId> # Copy jsonl + emit `claude --resume` hint
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If A and B have different home dir layouts (e.g. `/Users/yueA` vs
|
|
56
|
+
`/Users/yueB`), tell memarium how to translate paths once:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
memarium config --map-path /Users/yueA=/Users/yueB
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
After that, `memarium resume` rewrites all absolute paths in the jsonl
|
|
63
|
+
during copy, so `claude --resume` lands in the right local cwd.
|
|
64
|
+
|
|
65
|
+
Each resume is a **fork** — B gets a fresh sessionId so you can
|
|
66
|
+
continue on B without colliding with A if A also keeps chatting on
|
|
67
|
+
the same source session. The fork's origin is recorded in
|
|
68
|
+
`~/.memarium/resume-forks.json` and stamped onto the spool index entry
|
|
69
|
+
on the next `memarium sync` (as `originSessionId`), so plugin-side
|
|
70
|
+
digest tooling can later reason about same-source threads.
|
|
71
|
+
|
|
72
|
+
## Commands
|
|
73
|
+
|
|
74
|
+
| Command | What it does |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `memarium init` | Interactive wizard. One-time setup. |
|
|
77
|
+
| `memarium sync` | Extract local sessions, push to your device branch. |
|
|
78
|
+
| `memarium list-sessions [--project --since --device]` | List sessions in spool, sortable for resume. |
|
|
79
|
+
| `memarium resume <sessionId>` | Copy jsonl into `~/.claude/projects/`, print `claude --resume` hint. |
|
|
80
|
+
| `memarium config [--map-path FROM=TO]` | Read or modify `~/.memarium/config.json`. |
|
|
81
|
+
| `memarium upgrade` | `npm install -g memarium@latest`. |
|
|
82
|
+
| `memarium doctor` | Health check: CLI, config, spool state, plugin install status. |
|
|
83
|
+
| `memarium workflow <init\|...>` | Install GitHub Actions for cross-device aggregation. |
|
|
84
|
+
| `memarium list` | List sessions in spool (simple table). |
|
|
85
|
+
| `memarium show <ref>` | Print one session's markdown to stdout. |
|
|
86
|
+
| `memarium cat <path>` | Print one file from the spool to stdout. |
|
|
87
|
+
|
|
88
|
+
## Files written
|
|
89
|
+
|
|
90
|
+
- `~/.memarium/config.json` — your settings (`mode 0600`)
|
|
91
|
+
- `~/.memarium/session-repo/` — git working tree of your private memory repo
|
|
92
|
+
- `raw_sessions/<tool>/<project>/<date>/*.{md,raw.json,jsonl}` — sync-rendered session copies plus the original jsonl (preserved for resume)
|
|
93
|
+
- `.memarium/index.json` — spool index (co-owned with the plugin)
|
|
94
|
+
- `book/` and `.memarium/index.book.json` — written by the plugin if you have it installed
|
|
95
|
+
|
|
96
|
+
The npm CLI does not touch `book/` or `.memarium/index.book.json` — those
|
|
97
|
+
are the plugin's domain. The plugin in turn does not touch `.git/` or
|
|
98
|
+
`config.json` — those are sync's.
|
|
99
|
+
|
|
100
|
+
## Migration from v0.4.x
|
|
101
|
+
|
|
102
|
+
If you upgraded from v0.4.x and miss `memarium prepare` / `publish` /
|
|
103
|
+
`recall` / `serve` / `build-site` — those moved to the Claude Code plugin.
|
|
104
|
+
Install it as shown at the top of this README. Your existing
|
|
105
|
+
`~/.memarium/session-repo/` data is unchanged; the plugin reads it and
|
|
106
|
+
writes its own additions there.
|
|
107
|
+
|
|
108
|
+
### Note for v0.4.x upgraders: spool format is single-`.md`-per-session
|
|
109
|
+
|
|
110
|
+
Starting in 0.6.0, sync writes a **single `.md` per session** under
|
|
111
|
+
`raw_sessions/<tool>/<project>/<date>/` — no `.raw.json` or `.jsonl`
|
|
112
|
+
sibling. The `.md` carries everything via YAML frontmatter (commits,
|
|
113
|
+
files_touched, tools_used, candidate_decisions) plus a `# Table of
|
|
114
|
+
Contents` block with `→L<line>` jump offsets and the body. `memarium
|
|
115
|
+
resume` reads this `.md` directly; for sessions larger than ~200 KB it
|
|
116
|
+
embeds only the manifest + TOC inline and points Claude at the on-disk
|
|
117
|
+
file (chunked mode, 0.7.0+).
|
|
118
|
+
|
|
119
|
+
If you have a pre-0.6 spool with old `.raw.json` / `.jsonl` siblings
|
|
120
|
+
sitting around, the cleanest path is to wipe and re-sync:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
rm -rf ~/.memarium/session-repo/raw_sessions
|
|
124
|
+
memarium sync
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
If your repo also accumulated duplicate `.md` files or `1970-01-01/`
|
|
128
|
+
empty-shell dirs from the 0.5–0.7.0 Copilot extractor bugs, run
|
|
129
|
+
`memarium prune` (added 0.7.1) to clean orphans first.
|
|
130
|
+
|
|
131
|
+
See [CHANGELOG](./CHANGELOG.md) for the full breaking-change list.
|
|
132
|
+
|
|
133
|
+
## Repo layout (for contributors)
|
|
134
|
+
|
|
135
|
+
- `src/` — TypeScript source
|
|
136
|
+
- `commands/` — one file per CLI subcommand
|
|
137
|
+
- `commands/resume/` — list-sessions, resume, path-rewrite, config-pathmap
|
|
138
|
+
- `digest/{project-filter,session-signal}.ts` — sync-side filtering helpers (the rest of the dir was moved to the plugin)
|
|
139
|
+
- `sources/` — Claude Code + Copilot adapters (sync uses both)
|
|
140
|
+
- `tests/` — vitest, parallel structure to src/
|
|
141
|
+
- `assets/{workflows,scripts}` — GitHub Actions YAML + cross-device aggregate script
|
|
142
|
+
- `bin/memarium.ts` — commander entry, built to `dist/bin/memarium.js`
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|