memhouse 0.3.1 → 0.4.2

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.
Files changed (37) hide show
  1. package/README.md +83 -6
  2. package/bin/memhouse.js +882 -40
  3. package/editors/zed.js +55 -6
  4. package/index.js +2 -2
  5. package/mem-house/COMPETITION.md +217 -0
  6. package/mem-house/DESIGN.md +61 -32
  7. package/mem-house/delivery/AGENT-INSTALL.md +23 -3
  8. package/mem-house/delivery/PROMPT.md +23 -10
  9. package/mem-house/delivery/install.sh +9 -7
  10. package/mem-house/delivery/kernel-install.md +56 -25
  11. package/mem-house/delivery/skills/memhouse-search/SKILL.md +46 -16
  12. package/mem-house/delivery/skills/memhouse-sessions/SKILL.md +38 -7
  13. package/mem-house/delivery/skills/memhouse-sql/SKILL.md +48 -17
  14. package/mem-house/deploy.js +333 -0
  15. package/mem-house/envfile.js +49 -0
  16. package/mem-house/per-member/INSTALL.md +183 -0
  17. package/mem-house/per-member/PLAN.md +174 -0
  18. package/mem-house/per-member/PROVISIONING.md +177 -0
  19. package/mem-house/per-member/README.md +48 -0
  20. package/mem-house/per-member/SCHEMA.md +73 -0
  21. package/mem-house/per-member/SHARING.md +102 -0
  22. package/mem-house/per-member/provision.js +142 -0
  23. package/mem-house/per-member/rooms.js +132 -0
  24. package/mem-house/per-member/schema-member.sql.tpl +85 -0
  25. package/mem-house/per-member/schema-merge.sql.tpl +24 -0
  26. package/mem-house/server/queries.js +103 -53
  27. package/mem-house/service.js +400 -0
  28. package/mem-house/shipper/ship.js +61 -18
  29. package/package.json +3 -3
  30. package/pricing.js +20 -2
  31. package/pricing.json +216 -24
  32. package/public/assets/{index-CCPh7a2Z.js → index-CtH-5i95.js} +5 -5
  33. package/public/index.html +1 -1
  34. package/ui/src/App.jsx +3 -2
  35. package/ui/src/pages/SqlViewer.jsx +39 -21
  36. package/mem-house/rls.sql +0 -17
  37. package/mem-house/schema.sql +0 -145
package/README.md CHANGED
@@ -2,12 +2,21 @@
2
2
 
3
3
  **memhouse** — agent conversation memory as a product. Every coding-agent session
4
4
  on your machines — across the **17 editors** the agentlytics adapters support —
5
- parsed locally, shipped to one typed ClickHouse store, shareable with a team,
5
+ parsed locally, shipped to a typed ClickHouse store, shareable with a team,
6
6
  installable on the ultimagent kernel as an **agency**, and visible through the
7
7
  agentlytics dashboard unchanged.
8
8
 
9
+ **One house, a set of rooms per member.** Each member owns
10
+ `sessions_<them>`, `messages_<them>`, `tool_calls_<them>`, and holds grants on
11
+ those and nothing else — isolation is a grant that is simply absent, so it fails
12
+ closed. All of *your* machines ship into *your* rooms (the `host` column tells them
13
+ apart); another member's machines never do. A team-wide read is a `Merge` room plus
14
+ a `GRANT`, which narrows to whatever the caller can already see.
15
+
16
+ There is no shared-table layout. That was memory-house's model and 0.4.0 removed it.
17
+
9
18
  An **agency** in the constellation sense (`TERMINOLOGY.md`): a **house** — the
10
- `memhouse` database — plus a **resident** working in it, the shipper. The test is
19
+ `mem` database — plus a **resident** working in it, the shipper. The test is
11
20
  what writes. The shipper fires on its own loop and puts rows in the house that
12
21
  outlive any query; everything else here is only ever read. The house alone would
13
22
  hold; the shipper is what makes it act.
@@ -20,7 +29,7 @@ memory-house v4. Start with `mem-house/DESIGN.md` for the four bets
20
29
 
21
30
  | Path | What |
22
31
  |---|---|
23
- | `mem-house/` | the product: `DESIGN.md`, `schema.sql`, `rls.sql`, `shipper/`, `server/`, `delivery/` |
32
+ | `mem-house/` | the product: `DESIGN.md`, `per-member/`, `shipper/`, `server/`, `delivery/` |
24
33
  | `editors/` | the 17 editor adapters (inherited from agentlytics; the crown jewels) |
25
34
  | `pricing.js` + `pricing.json` | the cost engine |
26
35
  | `ui/` | the dashboard SPA (built to `public/`, served unchanged by the memhouse server) |
@@ -42,6 +51,25 @@ install scripts by default, so without the flag those five read nothing and you
42
51
  silently ship a partial history. `memhouse discover` and `memhouse doctor` both
43
52
  say so when the binding is missing.
44
53
 
54
+ If that install fails with `EACCES`, `sudo` is the right answer for only one of the
55
+ two causes, and the thing that tells them apart is **who owns the prefix root** —
56
+ not the path, and not the failing file. The path proves nothing: Homebrew's prefix
57
+ is `/usr/local` on Intel and `/opt/homebrew` on Apple Silicon, and is yours in both
58
+ cases. The failing file proves nothing either: an earlier `sudo npm` leaves
59
+ root-owned files *inside* a prefix that is still yours.
60
+
61
+ ```bash
62
+ ls -ld "$(npm prefix -g)" # the prefix ROOT — this is the deciding one
63
+ ```
64
+
65
+ - **Prefix root owned by `root`** — a genuinely system-managed Node (distro
66
+ packages under `/usr`). Re-run with `sudo`.
67
+ - **Prefix root owned by you** — the prefix is yours (Homebrew, fnm, nvm, volta),
68
+ so whatever root-owned file npm tripped on is a stray from an earlier `sudo npm`.
69
+ Another `sudo` adds more of them. Repair just that path:
70
+ `sudo chown -R "$(id -u):$(id -g)" <the path npm named>`. The same applies to the
71
+ cache (`~/.npm`).
72
+
45
73
  To try it without installing, npx takes the same flag — it has to come before the
46
74
  package name:
47
75
 
@@ -50,22 +78,71 @@ npx --allow-scripts=better-sqlite3 -y memhouse discover
50
78
  ```
51
79
 
52
80
  Working from a checkout instead: `npm install` (the repo's `allowScripts` field
53
- covers the binding), then `node bin/memhouse.js …`.
81
+ covers the binding), then `node bin/memhouse.js …`. `npm test` is a syntax gate plus
82
+ unit checks; `misc/tier-matrix-test.sh` walks the tier/ownership matrix against a real
83
+ container engine on Linux and takes a few minutes, so it is not part of `npm test`.
54
84
 
55
85
  ```text
56
86
  memhouse onboard | install | setup | discover | uninstall | reset
57
87
  memhouse ship [--full|--loop N] | stats | search <terms> | start | stop | status | doctor
58
88
  memhouse plugins install claude | prompt
89
+ memhouse deploy --local | --down # stand up a house to point at
90
+ memhouse service install | uninstall | status # survive a reboot
59
91
  ```
60
92
 
93
+ ### Where the memory lives
94
+
95
+ `memhouse onboard` assumes you already have a ClickHouse. If you do not, `deploy`
96
+ is the missing first mile:
97
+
98
+ | | What it runs | Who it is for |
99
+ |---|---|---|
100
+ | `deploy --local` | stock ClickHouse in docker or podman, loopback-bound | one machine, or several members later |
101
+ | kernel install | an agency house on an ultimagent kernel | a team, provisioned centrally |
102
+ | point at your own | any reachable ClickHouse — a server, ClickHouse Cloud | you already have one |
103
+
104
+ `deploy --local` needs docker or podman. If you have neither and no ClickHouse, install
105
+ one of them — memhouse does not embed a database. An earlier `--solo` tier ran chdb
106
+ behind a hand-written ClickHouse-HTTP shim and was removed: emulating the HTTP protocol
107
+ meant every setting or request shape the shim did not implement became a silently wrong
108
+ answer, and half the defects found reviewing this branch came from it.
109
+
110
+ `deploy` labels what it creates and refuses to replace or remove a container or
111
+ volume it did not create, so a name collision costs you an error rather than
112
+ somebody else's data.
113
+
114
+ ### Surviving a reboot
115
+
116
+ `memhouse start` detaches with pidfiles: the daemons outlive the shell, and nothing
117
+ brings them back after a restart. `memhouse service install` writes a real user
118
+ service instead — systemd `--user` on Linux, a launchd LaunchAgent on macOS — and
119
+ takes over from the pidfile daemons. On Linux a `--user` unit stops at logout
120
+ unless lingering is on, so install detects that and prints the `loginctl` command.
121
+
122
+ ### One set of rooms per member
123
+
124
+ Every member owns their rooms — `messages_alice`, `sessions_alice`,
125
+ `tool_calls_alice`. This is the only layout. Isolation is a grant that is simply
126
+ absent, not a row policy that has to be right on every table and every read path, so it
127
+ fails closed. A shared read is a Merge room (`all_sessions`) plus a GRANT, which reduces
128
+ to whatever rooms the caller can already read — strictly less machinery than the policy
129
+ it replaced.
130
+
131
+ The session rollup is a saved query over those rooms rather than a stored view, so there
132
+ is no fourth object to provision, grant, or collide with the team rooms;
133
+ `memhouse sessions-query` prints it. On a house you own, `memhouse install` mints your
134
+ three rooms and you are done. On someone else's, the owner mints them
135
+ (`mem-house/per-member/provision.js`) and sharing a whole room is then self-serve, with
136
+ no operator. Design and measurements: `mem-house/per-member/`.
137
+
61
138
  Every command is dual-mode: interactive for humans, `--yes`/flags/`--json` for
62
139
  agents — so an agent can self-install its own memory (`memhouse install --yes …`,
63
140
  `memhouse plugins install claude`). Config: flags > `MEMHOUSE_*` env >
64
141
  `~/.memhouse/env` > defaults.
65
142
 
66
143
  Deeper docs: `mem-house/delivery/AGENT-INSTALL.md`, kernel install (agency
67
- `memhouse`, members, own-only RLS): `mem-house/delivery/kernel-install.md`,
68
- skills/plugin payloads: `mem-house/delivery/`.
144
+ `memhouse`, members, per-member rooms and their grants):
145
+ `mem-house/delivery/kernel-install.md`, skills/plugin payloads: `mem-house/delivery/`.
69
146
 
70
147
  ## Heritage & license
71
148