fix(feeders): make post-mine repair opt-in, not default
The three feeder wrappers (mempalace-docs, mempalace-pi-session,
mempalace-session) unconditionally ran 'mempalace repair --yes' after
mining, controllable only via --no-repair opt-out. The contrib launchd
and systemd templates did not pass --no-repair, so every scheduled tick
invoked the destructive in-place HNSW rebuild.
This has bitten us twice:
- 2026-05-04 09:08: a kickstart triggered repair while an MCP
subprocess held the DB open; the live collection was wiped (0
drawers) and had to be restored from the palace.backup snapshot.
- 2026-05-05 10:00: post-mine repair crashed mid-rebuild with
'NotFoundError: Collection [<uuid>] does not exist' - chromadb's
rebuild recreated the collection under a new UUID while the code
still held the old handle. Live DB survived only by luck (crash
hit before the swap).
Fix: flip the default.
- New flag: --repair (opt-in). Prints a warning and sleeps 3s before
invoking 'mempalace repair --yes'.
- --no-repair is retained as a deprecated no-op alias for backward
compatibility with any scripts/units still passing it.
- Default behavior: no repair. Routine ChromaDB add() keeps HNSW
consistent; repair is a recovery op, not a maintenance tick.
Docs updated to match: README, SKILL, ARCHITECTURE, AGENTS,
contrib/README. Scheduling guidance now explicitly warns against
enabling --repair on cron/launchd/systemd-timer runs.
This commit is contained in:
@@ -33,10 +33,10 @@ bin/
|
||||
A third wrapper would justify factoring a shared helper library. Until then, copy the pattern from `mempalace-session` (richest example):
|
||||
|
||||
1. Create `bin/<name>` with `#!/usr/bin/env bash` + `chmod +x`.
|
||||
2. Implement `--help`, `--dry-run`, `--no-repair` flags.
|
||||
2. Implement `--help`, `--dry-run`, `--repair` flags (repair is opt-in; `--no-repair` kept as deprecated alias).
|
||||
3. Stage to `~/.cache/<name>/<wing>/` with deterministic filenames.
|
||||
4. Invoke `mempalace mine ...` (choose `--mode convos` if input is chat-like).
|
||||
5. End with `mempalace repair` unless `--no-repair`.
|
||||
5. Do NOT end with `mempalace repair` unless `--repair` was explicitly passed. Repair is a destructive in-place HNSW rebuild and must never run on an unattended schedule.
|
||||
6. Update `README.md` with usage + rationale.
|
||||
7. Update `install.sh`? No — `bin/*` is auto-linked.
|
||||
8. Update `ARCHITECTURE.md` if the wrapper fills a new architectural gap.
|
||||
|
||||
Reference in New Issue
Block a user