@hmanlab/memo 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/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @hmanlab/memo
2
+
3
+ Local-first MCP server for persistent, persona-aware memory across projects.
4
+
5
+ `memo` ships two surfaces: an MCP server (33 tools) for AI clients like
6
+ Claude Code, and a Node CLI (`hmanlab-memory`) for power users. Both
7
+ share the same backend — the CLI is a thin wrapper, not a re-implementation.
8
+
9
+ Everything lives under `~/.hmanlab/`: one root SQLite DB + a `personas/`
10
+ directory of YAML files + one DB per registered project. No cloud, no
11
+ account, no telemetry.
12
+
13
+ ## What's in the box (v1.0.0)
14
+
15
+ ### MCP tools (33)
16
+ - **Persona (11):** `persona_list`, `persona_get`, `persona_create`,
17
+ `persona_update`, `persona_delete`, `persona_clone`,
18
+ `persona_reload`, `user_persona_get`, `user_persona_update`
19
+ - **Project (7):** `project_register`, `project_list`, `project_get`,
20
+ `project_switch`, `get_active_project`, `project_archive`,
21
+ `project_unregister`
22
+ - **Memory (12):** `memory_save`, `memory_get`, `memory_update`,
23
+ `memory_delete`, `memory_search`, `memory_semantic_search`,
24
+ `memory_recent`, `memory_supersede`, `memory_promote`,
25
+ `memory_promote_to_global`, `memory_archive`, `memory_hygiene`,
26
+ `memory_link`, `memory_related`
27
+ - **Session (3):** `session_start`, `session_end`, `session_list`
28
+
29
+ Full list with schemas: [`docs/USAGE.md`](./docs/USAGE.md).
30
+ Architecture: [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md).
31
+ Changelog: [`CHANGELOG.md`](./CHANGELOG.md).
32
+
33
+ ## Setup (one-time, on the machine)
34
+
35
+ ### As part of hl-plugins (dev)
36
+ ```bash
37
+ pnpm install
38
+ pnpm --filter @hmanlab/memo build
39
+ hl-plugins install memo
40
+ ```
41
+
42
+ ### Standalone (after publishing to npm)
43
+ ```bash
44
+ pnpm install -g @hmanlab/memo
45
+ hmanlab-memory init # ~1s
46
+ hmanlab-memory mcp-config claude-code # prints `claude mcp add hmanlab-memory -- ...`
47
+ ```
48
+
49
+ The CLI auto-installs Bun if missing and registers the MCP bundle
50
+ under `~/.local/share/hl-plugins/memo/`, then wires it into
51
+ `~/.claude.json`.
52
+
53
+ ## CLI quickstart
54
+
55
+ ```bash
56
+ hmanlab-memory init
57
+ hmanlab-memory project register ~/projects/ftmo ftmo
58
+ hmanlab-memory project switch ftmo
59
+ hmanlab-memory memory save "FTMO daily loss limit is 5 percent" --category rules --importance 0.9
60
+ hmanlab-memory memory search "FTMO daily loss" # JSON output, pipe to jq
61
+ hmanlab-memory memory hygiene all # structured report
62
+ hmanlab-memory project export ftmo # → ~/hmanlab-exports/ftmo-<date>.zip
63
+ hmanlab-memory project import ~/hmanlab-exports/ftmo-*.zip
64
+ hmanlab-memory status
65
+ ```
66
+
67
+ Full CLI reference: [`docs/USAGE.md`](./docs/USAGE.md).
68
+
69
+ ## On-disk layout
70
+
71
+ ```
72
+ ~/.hmanlab/
73
+ ├── config.yaml # cwd_auto_detect, persona_filter_mode, decay knobs
74
+ ├── root.db # user_persona, ai_personas, projects,
75
+ │ # global_memories (+ _fts + _edges), schema migrations
76
+ ├── personas/ # persona YAML files (built-in + user)
77
+ │ ├── default.yaml
78
+ │ ├── work.yaml # parent: default
79
+ │ ├── creative.yaml # parent: default
80
+ │ └── <user-defined>.yaml
81
+ └── projects/<name>/
82
+ ├── project.yaml # description, decay_policy, channels
83
+ └── hmanlab.db # memories (+ _fts + _vec + _edges), sessions
84
+ ```
85
+
86
+ YAML is the source of truth for personas. SQLite is the source of truth
87
+ for everything else. `persona_reload` re-syncs the DB after a hand edit.
88
+
89
+ ## What's in each phase (6 phases shipped)
90
+
91
+ - **Phase 01:** Root DB, persona CRUD, FastMCP skeleton, 3 starter personas
92
+ - **Phase 02:** Per-project DB, register, switch, archive, unregister
93
+ - **Phase 03:** Memory CRUD, FTS5 search, hybrid ranking (MVP)
94
+ - **Phase 04:** Cross-DB search, cwd auto-detect, sessions
95
+ - **Phase 05:** Decay engine, conflict detection, hygiene, promotion
96
+ - **Phase 06:** Export/import (zip), CLI, memory graph, docs
97
+
98
+ Full changelog: [`CHANGELOG.md`](./CHANGELOG.md).
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ pnpm install # workspace setup (from monorepo root)
104
+ pnpm --filter @hmanlab/memo build # build MCP bundle + CLI
105
+ bun test packages/plugin-memo/tests/ # 175 tests
106
+ pnpm typecheck # green
107
+ ```
108
+
109
+ The MCP server is built to a single Bun bundle at `dist/memo-mcp-server.js`.
110
+ The CLI is built to `dist/cli.js` and exposed via `bin/hmanlab-memory.js`.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ // CLI entry point. Built artifact at packages/plugin-memo/dist/cli.js is what
3
+ // `pnpm install` actually puts on PATH (see package.json bin field).
4
+ //
5
+ // Source CLI is in src/cli/main.ts; this file is the install path shim
6
+ // so the CLI works even before the build step.
7
+
8
+ import { run } from "../dist/cli.js"
9
+ // Commander expects [executable, script-path, ...args]. Under node this is
10
+ // already the shape. Under bun, argv[0] is the bun binary and argv[1] is the
11
+ // script — also already correct. So we just pass argv through.
12
+ run(process.argv)
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: memo
3
+ description: Use when the user wants persistent memory across projects, persona-aware AI behavior, or to manage hmanlab-memo (multi-persona, multi-project, local-first memory for AI coding assistants). Front-load keywords: memory, persona, project, save, recall, search, decay, conflict, SQLite, hmanlab-memo, persona-aware, multi-persona, hmanlab-memory.
4
+ ---
5
+
6
+ # memo — hmanlab-memo (local-first MCP memory)
7
+
8
+ The `memo` MCP server exposes 9 tools that give an AI coding assistant
9
+ persistent, persona-aware memory on the user's machine. Everything lives under
10
+ `~/.hmanlab/` (one root SQLite DB + a `personas/` directory of YAML files).
11
+ No cloud, no account, no telemetry.
12
+
13
+ This is the Phase 01 slice: persona + user-persona CRUD only. Projects,
14
+ memories, embeddings, and hybrid search land in later phases.
15
+
16
+ | Tool | What it does |
17
+ | --------------------- | ----------------------------------------------------------- |
18
+ | `persona_list` | List all personas (built-in + user) |
19
+ | `persona_get` | Read one persona (resolves `parent` chain) |
20
+ | `persona_create` | Write a new YAML persona + DB row |
21
+ | `persona_update` | Edit a persona, bump version |
22
+ | `persona_delete` | Soft-delete (archive) — YAML stays |
23
+ | `persona_clone` | Duplicate a persona as a starting point |
24
+ | `persona_reload` | Re-scan `~/.hmanlab/personas/` and resync the DB |
25
+ | `user_persona_get` | Read the user's persona singleton |
26
+ | `user_persona_update` | Edit the user's persona |
27
+
28
+ ## Setup (one-time, on the machine)
29
+
30
+ 1. Install Bun: `curl -fsSL https://bun.sh/install | bash`
31
+ 2. Install the plugin via the `hl-plugins` CLI:
32
+ ```bash
33
+ hl-plugins install memo
34
+ ```
35
+ 3. Restart Claude Code. The 9 tools above appear under the `memo` MCP server.
36
+
37
+ The CLI auto-installs Bun if missing and registers the MCP bundle under
38
+ `~/.local/share/hl-plugins/memo/`, then wires it into `~/.claude.json`.
39
+
40
+ ## On-disk layout
41
+
42
+ ```
43
+ ~/.hmanlab/
44
+ ├── config.yaml # paths + embedding defaults (phase-01 reads/writes subset)
45
+ ├── root.db # WAL-mode SQLite: user_persona, ai_personas
46
+ └── personas/
47
+ ├── default.yaml # built-in (warm, balanced)
48
+ ├── work.yaml # built-in (parent: default)
49
+ ├── creative.yaml # built-in (parent: default)
50
+ └── <user-defined>.yaml
51
+ ```
52
+
53
+ YAML is the source of truth. Editing a file on disk and calling `persona_reload`
54
+ updates the DB to match. The starter pack is extracted only on first boot;
55
+ existing YAMLs are never overwritten.
56
+
57
+ ## When to use these tools
58
+
59
+ - **User asks to switch hats / "talk like X" / use a persona** → `persona_list`
60
+ to see options, `persona_get` to read the full prompt, then continue the
61
+ conversation as that persona.
62
+ - **User asks to remember a preference** → `user_persona_update` with the
63
+ preference text.
64
+ - **User asks to create / edit a persona** → `persona_create` or
65
+ `persona_update`.
66
+ - **User edits a persona YAML directly** → `persona_reload` to make the DB
67
+ match.
68
+ - **User wants to fork an existing persona** → `persona_clone`.