mempalace/mempalace
Lochness b70f06a69e feat: add exclude_patterns config key to mempalace.yaml
Allow projects to specify .gitignore-style patterns that the miner should
skip, without relying on .gitignore for mining control.

A new optional exclude_patterns list in mempalace.yaml is parsed by the
existing GitignoreMatcher class via a new from_patterns() classmethod —
same syntax, same semantics as .gitignore, no new dependency.

  exclude_patterns:
    - '*.md'
    - '*.yaml'
    - 'docs/'        # dir-only: prunes entire tree without descending
    - 'dist/'
    - 'coverage/'

Key behaviour:
- Patterns follow .gitignore rules: anchoring (/pattern), dir-only
- dirs[:] pruning via GitignoreMatcher.matches(..., is_dir=True) so
  excluded subtrees are never walked
- Checked after .gitignore filtering; force_include (--include-ignored)
  bypasses exclude_patterns
- Pre-scanned files lists (init double-scan optimisation) are filtered too
- Backwards compatible: omitting exclude_patterns changes nothing

Changes:
- GitignoreMatcher.from_patterns(): new classmethod, same rule parser as
  from_dir(), reads from a list instead of a file on disk
- scan_project(): builds one exclude_matcher before os.walk; used for
  both dirs[:] pruning and per-file filtering
- _mine_impl(): applies the exclude matcher to pre-scanned files lists
  when provided by the caller
- tests/test_miner.py: three new tests
    test_scan_project_exclude_patterns_skips_matching_files
    test_scan_project_exclude_patterns_prunes_entire_directory
    test_scan_project_exclude_patterns_include_ignored_bypasses_exclusion
2026-07-07 15:29:30 -04:00
..
backends fix: sanitize embedded NUL bytes before they reach ChromaDB 2026-07-06 09:23:35 -03:00
data feat(entity): known-systems lexicon keeps multi-word product names atomic 2026-05-24 13:50:53 -07:00
i18n fix(entity): reduce noise in regex-based detection 2026-04-24 00:20:32 -03:00
instructions feat: add mempalace_checkpoint batch save tool 2026-06-22 13:41:15 +10:00
sources fix(sources): address Copilot review on #1014 2026-04-18 17:17:50 -03:00
README.md feat: add mempalace_checkpoint batch save tool 2026-06-22 13:41:15 +10:00
__init__.py fix(init): keep PYTHONPATH env for embedded callers, strip only in CLI entry points 2026-05-13 22:53:36 +05:00
__main__.py MemPalace: palace architecture, AAAK compression, knowledge graph 2026-04-04 18:16:04 -07:00
_stdio.py refactor(stdio): extract Windows UTF-8 reconfigure into shared helper 2026-05-03 22:25:31 +05:00
backups.py fix(backups): add max_backups retention to bound backup disk usage 2026-06-05 14:52:06 -04:00
cli.py feat(serve): turnkey secure remote MCP server (#1877) (#1900) 2026-06-29 03:28:06 -03:00
closet_llm.py fix(closet_llm): replace non-ASCII symbols in progress output (#1034) 2026-05-30 14:47:03 +02:00
collision_scan.py fix(ids): delimit hash inputs to prevent drawer_id collisions (#80) 2026-05-30 12:44:47 -07:00
config.py fix: sanitize embedded NUL bytes before they reach ChromaDB 2026-07-06 09:23:35 -03:00
convo_miner.py Merge pull request #924 from mvalentsev/fix/mine-log-oversized-skips 2026-07-06 08:18:55 -03:00
convo_scanner.py fix(llm): tighter refinement — word boundaries, JSON extraction, authoritative sources 2026-04-24 01:30:40 -03:00
corpus_origin.py feat(init): context-aware corpus detection 2026-04-26 12:37:26 -07:00
daemon.py fix: spawn daemon with CREATE_NO_WINDOW to match hook miner (#1783) (#1857) 2026-06-25 23:51:22 -03:00
dedup.py feat: add pgvector backend + namespace-isolation conformance contract 2026-06-05 21:41:21 -03:00
dialect.py refactor: fix ruff bugbear and silent-except findings 2026-05-06 04:12:09 -03:00
diary_ingest.py Merge origin/develop into feat/benchmark-multilingual 2026-05-24 13:18:08 -03:00
dynamics.py Merge origin/develop into feat/benchmark-multilingual 2026-05-24 13:18:08 -03:00
embedding.py fix: address PR review feedback (preserve "unknown" label; use super().model) 2026-06-20 18:05:15 -03:00
entities.py feat(graph): auto-populate the associative graph from mined sessions (#1895) 2026-06-28 19:44:11 -03:00
entity_detector.py feat: add LaTeX (.tex, .bib) to readable and prose extensions 2026-06-29 07:25:50 +00:00
entity_registry.py fix(entity_registry): clean up .tmp sidecar on write or rename failure (#1373) 2026-05-10 12:56:50 +02:00
exporter.py fix(exporter): refuse symlinks at file targets and skip tests on Windows 2026-05-07 12:51:47 -03:00
fact_checker.py refactor: fix ruff bugbear and silent-except findings 2026-05-06 04:12:09 -03:00
format_miner.py fix(miner): count only new work toward --limit, not already-mined skips (#1535) 2026-06-06 17:56:08 +05:00
general_extractor.py Merge origin/develop into feat/benchmark-multilingual 2026-05-24 13:18:08 -03:00
hallways.py fixup(hallways): drop _HALLWAY_FILE back-compat shim, migrate existing tests to resolver 2026-06-11 19:11:52 +00:00
hook_shell.py fix(hooks): typo regression addressed 2026-06-13 06:37:26 +00:00
hooks_cli.py fix(hooks): hide conhost window on Windows in _mine_sync non-daemon path (#1863) 2026-06-25 23:59:08 -03:00
ids.py fix(ids): simplify v3 length-prefixed hashing 2026-06-12 07:39:57 +00:00
instructions_cli.py fix: add explicit UTF-8 encoding to read_text() calls (#776) 2026-04-16 16:00:29 +05:00
knowledge_graph.py fix: half-open as-of interval for KG supersession 2026-07-06 09:23:46 -03:00
layers.py feat(convo): preserve authored timestamp from transcripts (#1890) 2026-06-28 18:13:06 -03:00
llm_client.py fix: green up CI for hardened file handling 2026-06-24 01:12:24 -03:00
llm_refine.py feat(init): context-aware corpus detection 2026-04-26 12:37:26 -07:00
mcp_server.py fix: keep status from taking writer lease 2026-07-06 09:26:16 -03:00
migrate.py fix: tighten local guards and file handling 2026-06-23 23:45:03 -03:00
miner.py feat: add exclude_patterns config key to mempalace.yaml 2026-07-07 15:29:30 -04:00
normalize.py fix: tighten local guards and file handling 2026-06-23 23:45:03 -03:00
onboarding.py feat(onboarding): multilingual embedder by default for new installs 2026-05-14 06:40:27 -03:00
palace.py fix(palace): process-wide mine_palace_lock re-entrancy so the HTTP transport can write (#1859) 2026-06-28 18:24:10 -03:00
palace_graph.py Merge origin/develop into feat/benchmark-multilingual 2026-05-24 13:18:08 -03:00
project_scanner.py fix: handle rootless Java subprojects 2026-06-07 16:01:57 +08:00
py.typed chore: tighten chromadb version range and add py.typed marker 2026-04-07 18:51:42 -03:00
query_sanitizer.py refactor(mcp): move lone-surrogate strip into shared sanitizers (#1235) 2026-05-24 12:12:52 -03:00
repair.py fix(repair): auto-heal isolated FTS5 inverted-index corruption (#1596) 2026-06-26 03:13:44 -03:00
room_detector_local.py refactor: fix ruff bugbear and silent-except findings 2026-05-06 04:12:09 -03:00
searcher.py feat(convo): preserve authored timestamp from transcripts (#1890) 2026-06-28 18:13:06 -03:00
service.py fix: keep status from taking writer lease 2026-07-06 09:26:16 -03:00
spellcheck.py MemPalace: palace architecture, AAAK compression, knowledge graph 2026-04-04 18:16:04 -07:00
split_mega_files.py Merge pull request #681 from jphein/fix/unicode-checkmark 2026-04-18 23:27:57 -07:00
sweeper.py fix: address Copilot review on release/3.3.2 2026-04-19 18:19:28 -03:00
sync.py fix(sync): symmetric source_file resolve + perf optimizations 2026-05-09 04:01:34 +05:00
version.py chore(release): 3.5.0 2026-06-22 16:39:37 -03:00
wal.py fix(daemon): address post-merge review feedback on #1826 2026-06-19 11:56:09 -03:00

README.md

mempalace/ — Core Package

The Python package that powers MemPalace. All modules, all logic.

Modules

Module What it does
cli.py CLI entry point — routes to mine, search, init, compress, wake-up
config.py Configuration loading — ~/.mempalace/config.json, env vars, defaults
normalize.py Converts 5 chat formats (Claude Code JSONL, Claude.ai JSON, ChatGPT JSON, Slack JSON, plain text) to standard transcript format
miner.py Project file ingest — scans directories, chunks by paragraph, stores to ChromaDB
convo_miner.py Conversation ingest — chunks by exchange pair (Q+A), detects rooms from content
searcher.py Semantic search via ChromaDB vectors — filters by wing/room, returns verbatim + scores
layers.py 4-layer memory stack: L0 (identity), L1 (critical facts), L2 (room recall), L3 (deep search)
dialect.py AAAK compression — entity codes, emotion markers, 30x lossless ratio
knowledge_graph.py Temporal entity-relationship graph — SQLite, time-filtered queries, fact invalidation
palace_graph.py Room-based navigation graph — BFS traversal, tunnel detection across wings
mcp_server.py MCP server — 34 tools, AAAK auto-teach, Palace Protocol, agent diary
onboarding.py Guided first-run setup — asks about people/projects, generates AAAK bootstrap + wing config
entity_registry.py Entity code registry — maps names to AAAK codes, handles ambiguous names
entity_detector.py Auto-detect people and projects from file content
general_extractor.py Classifies text into 5 memory types (decision, preference, milestone, problem, emotional)
room_detector_local.py Maps folders to room names using 70+ patterns — no API
spellcheck.py Name-aware spellcheck — won't "correct" proper nouns in your entity registry
split_mega_files.py Splits concatenated transcript files into per-session files

Architecture

User → CLI → miner/convo_miner → ChromaDB (palace)
                                     ↕
                              knowledge_graph (SQLite)
                                     ↕
User → MCP Server → searcher → results
                  → kg_query → entity facts
                  → diary    → agent journal

The palace (ChromaDB) stores verbatim content. The knowledge graph (SQLite) stores structured relationships. The MCP server exposes both to any AI tool.