memhouse 0.18.9 → 0.18.10
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/AGENTS.md +194 -0
- package/CHANGELOG.md +970 -0
- package/README.md +54 -423
- package/SECURITY.md +68 -0
- package/bin/memhouse.js +202 -92
- package/docs/README.md +46 -0
- package/docs/guides/admin-password.md +95 -0
- package/docs/guides/configuration.md +109 -0
- package/docs/guides/daemons.md +53 -0
- package/docs/guides/install.md +128 -0
- package/docs/guides/invite.md +87 -0
- package/docs/guides/operate.md +112 -0
- package/docs/guides/search-and-resume.md +95 -0
- package/docs/guides/share.md +102 -0
- package/docs/guides/storage.md +90 -0
- package/docs/guides/troubleshooting.md +78 -0
- package/docs/guides/uninstall.md +35 -0
- package/docs/guides/update.md +68 -0
- package/docs/releases/README.md +10 -0
- package/docs/releases/v0.18.10.md +226 -0
- package/docs/tutorials/01-first-house.md +132 -0
- package/docs/tutorials/02-join-a-house.md +91 -0
- package/docs/tutorials/03-share-your-memory.md +96 -0
- package/examples/01-local-one-machine/README.md +99 -0
- package/examples/01-local-one-machine/run.sh +61 -0
- package/examples/02-existing-clickhouse/README.md +121 -0
- package/examples/02-existing-clickhouse/run.sh +71 -0
- package/examples/03-team-house/README.md +129 -0
- package/examples/03-team-house/run.sh +124 -0
- package/examples/04-self-hosted-team/.env.example +22 -0
- package/examples/04-self-hosted-team/README.md +187 -0
- package/examples/04-self-hosted-team/compose.yml +158 -0
- package/examples/04-self-hosted-team/smoke.sh +113 -0
- package/examples/README.md +42 -0
- package/examples/fixtures/README.md +24 -0
- package/examples/fixtures/make-sessions.js +63 -0
- package/memhouse/admin-secret.js +81 -0
- package/memhouse/delivery/plugin/.claude-plugin/plugin.json +1 -1
- package/memhouse/deploy.js +4 -2
- package/memhouse/flags.js +4 -4
- package/memhouse/provision.js +12 -3
- package/memhouse/service.js +5 -0
- package/package.json +10 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Working on memhouse
|
|
2
|
+
|
|
3
|
+
Conventions for any coding agent in this repository — Claude Code, Codex, Gemini CLI,
|
|
4
|
+
OpenCode, whatever comes next. `CLAUDE.md` points here; this file is the canonical copy.
|
|
5
|
+
|
|
6
|
+
Constellation-wide rules (worktrees, branch naming, never pushing to `ramazanpolat/*`)
|
|
7
|
+
live in [`~/agent-realm/CLAUDE.md`](../CLAUDE.md) and are not repeated here.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Release lines — read before tagging, publishing, or merging a release
|
|
11
|
+
|
|
12
|
+
memhouse shipped two lines while zeo ran the pre-0.18 layout. Since its conversion there
|
|
13
|
+
is one line; the rules below are kept because a second line can happen again.
|
|
14
|
+
|
|
15
|
+
| line | git branch | npm dist-tag | versions | who installs it |
|
|
16
|
+
|---|---|---|---|---|
|
|
17
|
+
| the one line | `main` (default) | `latest`, and `team` as an alias | 0.18.x | everyone — `npm install -g memhouse` (zeo was converted to the one layout with `memhouse convert`; `release/0.17` is retired) |
|
|
18
|
+
|
|
19
|
+
Rules, each learned once:
|
|
20
|
+
|
|
21
|
+
- **Tag on the line's branch, publish from the tag, from the primary checkout.** A 0.17.1 was
|
|
22
|
+
built on `master` (the retired default) and published from a worktree: the branch and the
|
|
23
|
+
registry disagreed for a day, and the package lost its `gitHead`. `misc/publish-guard.js`
|
|
24
|
+
runs as `prepublishOnly` and refuses a publish whose version, `--tag`, branch, or HEAD tag
|
|
25
|
+
disagree with this table. If you need a new line (0.19.x), edit the table **and** the
|
|
26
|
+
guard's `LINES` in the same commit.
|
|
27
|
+
- **A fix lands on one line.** Porting to the other is a deliberate merge or cherry-pick with
|
|
28
|
+
its own CHANGELOG entry, never assumed. The one-layout (0.18) renamed every room to
|
|
29
|
+
`<member>_*`; anything touching room names ports with care (`house/HOUSE.md`).
|
|
30
|
+
- **`memhouse update` follows the channel a machine was installed from** (`MEMHOUSE_CHANNEL`),
|
|
31
|
+
so a zeo machine never receives a team build by accident, and vice versa.
|
|
32
|
+
- **`master` is retired.** It was the pre-0.18 default; `main` is the default now. Do not
|
|
33
|
+
branch from it, tag on it, or push to it.
|
|
34
|
+
- **A publish is live when `npm view` says so.** `npm publish` prints `+ memhouse@x.y.z`;
|
|
35
|
+
confirm with `npm view memhouse dist-tags --prefer-online`. A version that seems missing
|
|
36
|
+
right after a publish is registry lag or a stale local npm cache (`npm cache verify`),
|
|
37
|
+
not a "staged" publish. That misdiagnosis cost three releases.
|
|
38
|
+
- **Which token.** The pilot's publish token lives in the macOS keychain as `npmjs-token`
|
|
39
|
+
(`~/.pilot-profile/online/npm.md` has the temp-userconfig recipe). Lend it to the one
|
|
40
|
+
command; never print it.
|
|
41
|
+
- **One owner per line at a time.** Before releasing, check `ListAgents`/herdr for another
|
|
42
|
+
session on the same repo and agree who cuts it; the release record lives in `CHANGELOG.md`
|
|
43
|
+
on the line's branch and in `drills/`.
|
|
44
|
+
|
|
45
|
+
## What memhouse is
|
|
46
|
+
|
|
47
|
+
A local shipper parses coding-agent sessions (16 adapters covering 18 apps) and writes them as typed rows
|
|
48
|
+
into a ClickHouse database the user owns. A **house** is a database; its **rooms** are
|
|
49
|
+
tables, one set per **member** and named for them (`mem.alice_messages`). A member holds
|
|
50
|
+
one grant — `ON mem.alice_*` — and nothing else in the database; nobody is ever granted the
|
|
51
|
+
database itself. `roomNames()` in `memhouse/house/house.js` is the only place a table name
|
|
52
|
+
is produced, and `memhouse/provision.js` is the only description of what a member is
|
|
53
|
+
granted — the live path executes it and `--print-sql` prints it.
|
|
54
|
+
The ClickHouse is whichever one the user points at — local container, their own server,
|
|
55
|
+
or ClickHouse Cloud; memhouse runs no service of its own and proxies nothing. There is no
|
|
56
|
+
LLM anywhere in the write or read path.
|
|
57
|
+
|
|
58
|
+
`memhouse/DESIGN.md` argues the design. `TERMINOLOGY.md` is the canon for names — if a
|
|
59
|
+
thing has a name there, use it and do not invent another.
|
|
60
|
+
|
|
61
|
+
## The three instruments, and what each cannot see
|
|
62
|
+
|
|
63
|
+
| instrument | asks | blind to |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `npm test` | is the logic right | anything needing a server |
|
|
66
|
+
| `misc/invite-matrix.sh` | does it work against a real ClickHouse | anything a person has to read |
|
|
67
|
+
| **a drill** | can someone actually use it | nothing — which is why it is slow |
|
|
68
|
+
|
|
69
|
+
**[`drills/DRILLS.md`](drills/DRILLS.md) is the drill protocol**, borrowed from
|
|
70
|
+
[`kernel`](https://github.com/agent-realm/kernel). A drill is memhouse being used by
|
|
71
|
+
agents in real roles who have **not read this repository**. Four things it is easiest to
|
|
72
|
+
get wrong:
|
|
73
|
+
|
|
74
|
+
- **Write a plan first** — roles staffed, and the situation to create.
|
|
75
|
+
- **A plan must contain no expected results**, or it is a test that knows the answer.
|
|
76
|
+
- **Agents must run where this repo is unreachable**, or they read the source instead of
|
|
77
|
+
reporting the confusion. The installed package's `README.md` and the `/mem:*` skills
|
|
78
|
+
*are* in scope; a real user has those.
|
|
79
|
+
- **Never fix memhouse mid-drill**, or the record describes a build that never existed.
|
|
80
|
+
|
|
81
|
+
Run one after the matrix passes, and before any release that changes a surface a person
|
|
82
|
+
touches.
|
|
83
|
+
|
|
84
|
+
## Things this codebase has learned the hard way
|
|
85
|
+
|
|
86
|
+
Each of these cost a real incident. They are in the commit log with the measurements.
|
|
87
|
+
|
|
88
|
+
- **A probe that says yes to everyone is worse than no probe.** `invite` tested
|
|
89
|
+
`SELECT 1 FROM system.users`, which every member passes since they all hold `SHOW USERS`
|
|
90
|
+
— so it announced success and then failed at `CREATE DATABASE`.
|
|
91
|
+
- **Scope is part of a privilege.** A member holds `CREATE DATABASE` inside their own
|
|
92
|
+
database and can mint nothing. Match the grant *and* its scope, never the name alone.
|
|
93
|
+
- **A flag that is ignored rather than refused** is how a `--dry-run` typo becomes a real
|
|
94
|
+
migration. Every command declares its options in `memhouse/flags.js`.
|
|
95
|
+
- **One `data` event is not one keystroke.** Reading a hidden password chunk-at-a-time
|
|
96
|
+
hung forever the moment anyone pasted.
|
|
97
|
+
- **Row policies are OR'd, so a permissive catch-all fails open.** A second scoped share
|
|
98
|
+
saw everything. See `memhouse/share.js`.
|
|
99
|
+
- **A skill that reasons about privileges in prose gets it wrong.** Put the logic in a
|
|
100
|
+
command and have the skill call it — that is why `memhouse whoami` and `memhouse share`
|
|
101
|
+
exist.
|
|
102
|
+
- **Never print a credential.** memhouse ships this transcript into the house being
|
|
103
|
+
administered, and the archive is insert-only. Expand a shell variable; never a literal.
|
|
104
|
+
|
|
105
|
+
## Testing before you claim it works
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm test # syntax gate + unit checks
|
|
109
|
+
misc/invite-matrix.sh <url> <admin-user> <password> # against a real ClickHouse
|
|
110
|
+
misc/origin-matrix.sh … # the import/ship data guarantees
|
|
111
|
+
memhouse nightly --out /tmp # a real installable tarball
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`node bin/memhouse.js` from a checkout is **not** the product — the files are laid out
|
|
115
|
+
differently and the design is sitting next to it. Anything about installation, first run,
|
|
116
|
+
or what a user sees must be verified from a built package on a machine without a checkout.
|
|
117
|
+
|
|
118
|
+
CI runs `npm test`, both matrices and a headless e2e across ClickHouse 25.11 and 26.7, on
|
|
119
|
+
ubuntu only. macOS and Windows are untested there; say so rather than implying coverage.
|
|
120
|
+
|
|
121
|
+
## Releasing
|
|
122
|
+
|
|
123
|
+
Version lives in `package.json`, `package-lock.json` and the plugin manifest
|
|
124
|
+
(`memhouse/delivery/plugin/.claude-plugin/plugin.json`). All three move together, along
|
|
125
|
+
with the memhouse.io badges. `## Unreleased` in `CHANGELOG.md` becomes
|
|
126
|
+
`## <version> — <date>`. Tag `v<version>`, push the tag, then publish. A new user-facing
|
|
127
|
+
capability is a **minor** bump; so is a behaviour change like refusing a flag that used
|
|
128
|
+
to be ignored.
|
|
129
|
+
|
|
130
|
+
Every release also has:
|
|
131
|
+
|
|
132
|
+
- **A release document**, `docs/releases/v<version>.md`: what changed, what a user must
|
|
133
|
+
do, the upgrade steps, deprecations with their removal version, and what was deferred.
|
|
134
|
+
The CHANGELOG entry links to it, and the GitHub release uses it as its notes
|
|
135
|
+
(`gh release create v<version> --notes-file docs/releases/v<version>.md`).
|
|
136
|
+
- **The documentation standard:**
|
|
137
|
+
- a short README (what, why, how);
|
|
138
|
+
- `docs/`, with tutorials and guides for common operations;
|
|
139
|
+
- `examples/`, from smallest to full, each with its own README;
|
|
140
|
+
- the agent install section below.
|
|
141
|
+
|
|
142
|
+
A change to a command, a flag or a default updates the guide that describes it in the
|
|
143
|
+
same PR.
|
|
144
|
+
- **A drill** when the release changes a surface a person touches (see above), recorded
|
|
145
|
+
in `drills/`.
|
|
146
|
+
|
|
147
|
+
## Installing and deploying memhouse (for agents)
|
|
148
|
+
|
|
149
|
+
How an agent installs memhouse for its principal, unattended. Every command takes `--yes`
|
|
150
|
+
and most take `--json`. Follow the first route that applies, and never invent a house.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm install -g memhouse # Node 24+. Distro Node: sudo. Homebrew/nvm/fnm/volta: no sudo
|
|
154
|
+
|
|
155
|
+
# 1. The principal handed you an invite file:
|
|
156
|
+
memhouse install --env invite-<name>.env --yes # rotates the password, deletes the file
|
|
157
|
+
|
|
158
|
+
# 2. The principal has a member credential, held by a secret manager:
|
|
159
|
+
with-secret MEMHOUSE_PASSWORD=<reference> -- \
|
|
160
|
+
memhouse install --url <url> --user <member> --db mem --yes
|
|
161
|
+
|
|
162
|
+
# 3. The principal administers the server (creates the member, ships as the member):
|
|
163
|
+
with-secret MEMHOUSE_ADMIN_PASSWORD=<reference> -- \
|
|
164
|
+
memhouse install --url <url> --admin-user <admin> --member <name> --yes
|
|
165
|
+
|
|
166
|
+
# 4. Nothing exists yet, and docker or podman is present: a house on this machine
|
|
167
|
+
memhouse deploy --local --yes
|
|
168
|
+
|
|
169
|
+
# Then verify, and keep it running:
|
|
170
|
+
memhouse status --json # connection, rooms, last pass
|
|
171
|
+
memhouse whoami --json # which credential, and what it may do
|
|
172
|
+
memhouse service install # survive reboots
|
|
173
|
+
memhouse plugins install claude --yes
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`memhouse prompt --install` prints an install prompt rendered for the current machine,
|
|
177
|
+
with its state and the one route that applies.
|
|
178
|
+
|
|
179
|
+
Rules:
|
|
180
|
+
|
|
181
|
+
- **Never put a secret in the conversation, in argv, or in a file you write.** memhouse
|
|
182
|
+
ships transcripts into the house, and the archive is insert-only. Take passwords by
|
|
183
|
+
reference (`with-secret`, `MEMHOUSE_ADMIN_PASSWORD`, `--admin-password-file -`). Never
|
|
184
|
+
print `~/.memhouse/env`. If a secret reaches a transcript, say so and recommend rotation.
|
|
185
|
+
- **Never guess a house.** With no URL from the principal and no invite file, stop and ask.
|
|
186
|
+
Do not point at `localhost:8123` because something answers there.
|
|
187
|
+
- **Destructive commands need the principal's explicit yes, for that object:**
|
|
188
|
+
`memhouse reset`, `deploy --down` (deletes the local house's data),
|
|
189
|
+
`uninstall --full-removal`, and any `DROP`/`DELETE` in SQL. Look first, report the
|
|
190
|
+
counts, then ask.
|
|
191
|
+
- **Verify from the outside.** `status --json` and a row count in `mem.<member>_messages`
|
|
192
|
+
are the evidence that it works. A started daemon is not.
|
|
193
|
+
|
|
194
|
+
The user-facing version of all this is in [`docs/guides/install.md`](docs/guides/install.md).
|