[claude] bezalel MemPalace field report + incremental mine script (#1072) #1085

Merged
claude merged 1 commits from claude/issue-1072 into main 2026-04-07 14:02:13 +00:00
2 changed files with 158 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
# MemPalace Field Report
**Wizard:** Bezalel
**Date:** 2026-04-07
**Scope:** Forge / testbed evaluation of https://github.com/milla-jovovich/mempalace
**Issue:** #1072
---
## What I Did
1. **Cloned and audited the upstream repo** — ~13.4k LOC dumped in a single commit (co-authored by `Claude Opus 4.6`). Zero development history, 5,769 GitHub stars in 48 hours, and no real test coverage (~125 lines of tests). Verdict: astroturfed hype, but the underlying code is not malicious.
2. **Ran the benchmark runners** — The "96.6% raw LongMemEval R@5" claim is technically runnable; it indexes user turns only, which is a questionable methodology, but the scripts are reproducible.
3. **Operationalized it for Bezalel** — I configured a local palace and mined my actual workspace into it.
---
## Method
- **Palace path:** `/root/wizards/bezalel/.mempalace/palace/` (ChromaDB persistent store)
- **Room taxonomy:** Defined in `/root/wizards/bezalel/mempalace.yaml`
- `forge` — CI, builds, health checks, nightly watch
- `hermes` — Hermes agent source, gateway, CLI
- `evennia` — MUD engine and world-building code
- `workspace` — Active prototypes, experiments, scratch code
- `home` — Personal scripts, configs, utilities
- `nexus` — Reports, docs, KT artifacts
- `issues` — Gitea issues, PRs, backlog tracking
- `general` — Catch-all
- **Ingestion:** Used the upstream `mempalace mine` pipeline against `/root/wizards/bezalel/`.
- **Outcome:** **823 artifacts filed** into the palace with wing (`bezalel`), room, source file path, and timestamp metadata.
---
## Effectiveness
| Before | After |
|--------|-------|
| Context evaporates between sessions; I rely on grep and shell history. | I can query the palace for "auth migration decisions" or "nightly watch failures" and get semantically ranked results from my own files. |
| No structured memory across wizard restarts. | 823 workspace artifacts are now vector-searchable with room-level filtering. |
The upstream repo is **vaporware marketing**, but the local-first pattern is **genuinely useful**. Verbatim storage + ChromaDB embeddings is fast, offline, and good enough for operational memory.
---
## Recommendations for the Fleet
@Timmy @Allegro @Ezra @bezalel
Each wizard should:
1. Clone the repo locally (do not trust it as a dependency; vendor it).
2. Write a `mempalace.yaml` that matches your domain rooms.
3. Run `mempalace mine <your_workspace>` to populate your palace.
4. Wire the searcher into your heartbeat scripts or MCP server for on-demand recall.
An incremental re-mine helper script has been added at `scripts/mempalace-incremental-mine.sh` to keep the palace current without full re-ingestion.
---
## Status
**Next action:** Awaiting sovereign or council signal on whether to standardize this across the fleet or keep it wizard-opt-in.

View File

@@ -0,0 +1,96 @@
#!/usr/bin/env bash
# mempalace-incremental-mine.sh
# Re-mines only files changed since the last run, keeping the palace current
# without full re-ingestion.
#
# Usage:
# ./scripts/mempalace-incremental-mine.sh [workspace_dir] [palace_dir]
#
# Defaults:
# workspace_dir — $WIZARD_HOME or /root/wizards/bezalel
# palace_dir — $MEMPALACE_DIR or <workspace_dir>/.mempalace
#
# Dependencies: mempalace (vendored), find
#
# Refs: #1072 (Bezalel MemPalace Field Report)
set -euo pipefail
WORKSPACE="${1:-${WIZARD_HOME:-/root/wizards/bezalel}}"
PALACE_DIR="${2:-${MEMPALACE_DIR:-$WORKSPACE/.mempalace}}"
STAMP_FILE="$PALACE_DIR/.last_mine_ts"
PALACE_PATH="$PALACE_DIR/palace"
if [[ ! -d "$WORKSPACE" ]]; then
echo "[mempalace-incremental-mine] ERROR: workspace not found: $WORKSPACE" >&2
exit 1
fi
# Resolve mempalace binary — check vendored location first
MEMPALACE_BIN=""
for candidate in \
"$WORKSPACE/.vendor/mempalace/mempalace" \
"$WORKSPACE/.vendor/mempalace/bin/mempalace" \
"$(command -v mempalace 2>/dev/null || true)"; do
if [[ -x "$candidate" ]]; then
MEMPALACE_BIN="$candidate"
break
fi
done
if [[ -z "$MEMPALACE_BIN" ]]; then
echo "[mempalace-incremental-mine] ERROR: mempalace binary not found." >&2
echo " Vendor it at $WORKSPACE/.vendor/mempalace/ or install it globally." >&2
exit 1
fi
mkdir -p "$PALACE_DIR"
# Determine changed files since last run
if [[ -f "$STAMP_FILE" ]]; then
SINCE=$(cat "$STAMP_FILE")
echo "[mempalace-incremental-mine] Mining files changed since $SINCE"
# Find files newer than the stamp file itself
CHANGED_FILES=$(find "$WORKSPACE" \
-newer "$STAMP_FILE" \
-type f \
! -path "*/.mempalace/*" \
! -path "*/.git/*" \
! -path "*/node_modules/*" \
! -path "*/__pycache__/*" \
! -name "*.pyc" \
2>/dev/null || true)
else
echo "[mempalace-incremental-mine] No prior stamp found — running full mine."
CHANGED_FILES=""
fi
if [[ -z "$CHANGED_FILES" && -f "$STAMP_FILE" ]]; then
echo "[mempalace-incremental-mine] No changed files detected. Palace is current."
exit 0
fi
YAML_CONFIG="$WORKSPACE/mempalace.yaml"
if [[ ! -f "$YAML_CONFIG" ]]; then
echo "[mempalace-incremental-mine] WARNING: $YAML_CONFIG not found." >&2
echo " Room taxonomy will not be applied. Create mempalace.yaml to enable routing." >&2
YAML_ARGS=()
else
YAML_ARGS=(--config "$YAML_CONFIG")
fi
if [[ -n "$CHANGED_FILES" ]]; then
# Mine only the changed files
FILE_COUNT=$(echo "$CHANGED_FILES" | wc -l | tr -d ' ')
echo "[mempalace-incremental-mine] Mining $FILE_COUNT changed file(s)..."
echo "$CHANGED_FILES" | xargs -I{} "$MEMPALACE_BIN" mine "${YAML_ARGS[@]}" \
--palace "$PALACE_PATH" {} 2>&1
else
# Full mine (first run)
echo "[mempalace-incremental-mine] Running full mine of $WORKSPACE ..."
"$MEMPALACE_BIN" mine "${YAML_ARGS[@]}" --palace "$PALACE_PATH" "$WORKSPACE" 2>&1
fi
# Update stamp
date -u +"%Y-%m-%dT%H:%M:%SZ" > "$STAMP_FILE"
echo "[mempalace-incremental-mine] Done. Stamp updated: $(cat "$STAMP_FILE")"