Skip to main content

mempalace-refresh

Incremental, crash-resilient re-mining wrapper for mempalace.

Mempalace's built-in mine command is skip-if-filed by design — once a file has any drawer in the palace, mine never re-visits it. That's correct for static files, but wrong for live-appending Claude Code session logs that grow every message, across compactions, for days.

mempalace-refresh makes mempalace properly incremental:

  • Only mines what's new since the last run (per-file mtime tracking)
  • Subprocess per file — a ChromaDB segfault on file N doesn't nuke the batch
  • Additive — upsert semantics + stable drawer IDs mean re-mining never deletes or duplicates; old chunks no-op, new chunks are appended
  • source_file metadata stays correct — points at the real .jsonl, not a tmp path
  • Targeted — mine just one session with ONLY <uuid>
  • Fail-loud on API drift — if a mempalace update renames what we monkey-patch, the script exits 99 with a clear message

Install

pip install mempalace-refresh

Requires mempalace 3.2.x installed.

Usage

mempalace-refresh              # catch up: mine everything new since last run
mempalace-refresh STATUS       # per-file change status
mempalace-refresh ONLY <uuid>  # mine a single session (substring match)
mempalace-refresh RESET        # wipe state (next run re-mines everything)
mempalace-refresh REPAIR       # delegates to `mempalace repair --yes`

State lives at ~/.cache/mempalace-refresh/state.json. Nothing else is stored — the palace itself is mempalace's.

Environment

  • PROJECTS_DIR — override ~/.claude/projects/ (Claude Code session logs)
  • MEMPALACE_PALACE — override ~/.mempalace

How it works (short)

  1. Each .jsonl under PROJECTS_DIR is tracked by mtime in state.
  2. Changed files are mined one at a time via a fresh Python subprocess.
  3. The subprocess monkey-patches mempalace.palace.file_already_mined to bypass mempalace's skip-check, and mempalace.convo_miner.scan_convos to feed it exactly one file.
  4. Mempalace then scans the real .jsonl, runs its regex-based general_extractor, and upserts drawers. Because drawer IDs are hash(source_file + chunk_index):
    • Chunks that already existed → upsert updates metadata in place, no-op
    • Chunks for newly appended content → new IDs → genuinely new drawers
  5. State is committed per file so any later crash loses zero progress.

Result: your palace reflects every session exactly as it would if you'd mined each one from the start, plus incremental additions for all subsequent growth.

License

MIT. See LICENSE.

Metadata

Release files for mempalace-refresh 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mempalace-refresh 0.2.4
File Size Uploaded
mempalace_refresh-0.2.4.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mempalace-refresh 0.2.4
File Interpreter ABI Platform
mempalace_refresh-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 25.0 kB

Release files / mempalace_refresh-0.2.4.tar.gz

Download URL mempalace_refresh-0.2.4.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f30c5f79cf658f7191e040959d2bc387a7b9e8096a6cc1d41e1a107f40a9a851
BLAKE2b-256 checksum
How to use checksums
464ea8036423451d34f320bfd879567de6c9ce2fca8c6bffc70c86fc72d7dc46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / mempalace_refresh-0.2.4-py3-none-any.whl

Download URL mempalace_refresh-0.2.4-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf89770394c6ed08a1e61c405229d5bfbfa202a908ac66cc13e9aa9afb1e18bd
BLAKE2b-256 checksum
How to use checksums
ee7ac4f93722a6102087faebc0e4e714b76e325cb892ee63f15b35e8f9d5c068
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page