Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bunkerlab-net/mempalace
/ functions
Functions
2,248 in github.com/bunkerlab-net/mempalace
⨍
Functions
2,248
◇
Types & classes
117
↓ 7 callers
Function
register
Register `constructor` under `name`. Explicit registration wins over any later call with the same name. Safe to call from `main` before processing be
src/sources/registry.rs:31
↓ 7 callers
Function
run_confirm_and_save
Confirm detected entities with the user, then persist to the global registry and `entities.json`. Calls [`confirm_entities`] (auto or interactive), t
src/cli/init.rs:620
↓ 7 callers
Function
run_gitignore_protect
Append `/mempalace.yaml`, `/entities.json`, and `/corpus_origin.json` (anchored to repo root) to the `.gitignore` in `directory` if the directory is t
src/cli/init.rs:759
↓ 7 callers
Function
sanitize_content
Validate drawer/diary content. Returns `Ok(trimmed)` if valid, or `Err(error_json)` if not.
src/mcp/tools.rs:279
↓ 7 callers
Method
save
Persist the registry data to disk atomically. Writes JSON to a sibling temp file, fsyncs it, renames over the target, then fsyncs the parent director
src/palace/entity_registry.rs:723
↓ 7 callers
Function
split_file
Process a single mega-file: split it into per-session files and return the number written.
src/cli/split.rs:312
↓ 7 callers
Method
status
Return aggregated palace statistics.
src/palace/stack.rs:76
↓ 7 callers
Function
sweep
Sweep a single Claude Code `.jsonl` file into the palace. Parses every user/assistant message, skips those already stored (identified by UUID), and i
src/palace/sweeper.rs:340
↓ 7 callers
Function
tool_kg_query
Query all knowledge-graph facts for an entity, with optional direction and as-of filters.
src/mcp/tools.rs:1153
↓ 7 callers
Function
tool_list_drawers
List drawers with optional wing/room filtering and cursor-style pagination.
src/mcp/tools.rs:780
↓ 7 callers
Function
try_parse
Try to parse a Gemini CLI JSONL session into transcript text. Returns `None` when the content lacks a `session_metadata` entry, fewer than 2 messages
src/normalize/gemini_cli.rs:20
↓ 6 callers
Function
anthropic_extract_text
Extract concatenated text from an Anthropic Messages API response. The response `content` array may contain multiple text blocks. This function joins
src/llm/client.rs:502
↓ 6 callers
Function
build_corpus_origin_preamble
Build a system-prompt preamble from a corpus-origin detection result. Returns an empty string when the origin adds no useful context (no platform, no
src/llm/refine.rs:70
↓ 6 callers
Function
check_text_entity_confusion
Called by `check_text` to detect mentioned names close in edit distance to other registry names. Only O(m × n) comparisons are made, where m is the n
src/palace/fact_checker.rs:153
↓ 6 callers
Function
dedup_jaccard
Compute Jaccard similarity between two word sets. Returns 0.0 when both sets are empty, and 1.0 when sets are identical.
src/palace/dedup.rs:250
↓ 6 callers
Function
detect_convo_room
Classify conversation content into the best-matching topic room. Scans the first 3000 characters for keyword matches across the `TOPIC_KEYWORDS` tabl
src/palace/convo_miner.rs:112
↓ 6 callers
Function
detect_origin_llm
Tier 2 LLM-assisted detection — confirms platform and extracts persona names. Passes up to [`MAX_SAMPLES_FOR_LLM`] excerpts to `provider.classify` wi
src/palace/corpus_origin.rs:535
↓ 6 callers
Function
ensure_schema
(connection: &Connection)
src/schema.rs:130
↓ 6 callers
Function
find_session_boundaries
Find lines where true new sessions begin (Claude Code v header not followed by context restore). Returns an empty Vec for empty input — callers treat
src/cli/split.rs:128
↓ 6 callers
Function
get_topics_by_wing
Read `topics_by_wing` from the registry. Returns an empty map when the registry is absent, unreadable, or lacks a valid `topics_by_wing` object. Wing
src/palace/known_entities.rs:113
↓ 6 callers
Function
hook_mine_already_running
Return `true` if a previous background mine process named by `pid_file_name` is still running. Each mine target writes its own pid file (see [`PID_FI
src/cli/hook.rs:706
↓ 6 callers
Function
hook_open_log
Open (or create and append to) `hook.log` in `state_dir`.
src/cli/hook.rs:1085
↓ 6 callers
Function
hook_sanitize_session_id
Strip all characters except alphanumeric, dash, and underscore. Prevents path traversal when the session ID is used as a filename stem.
src/cli/hook.rs:170
↓ 6 callers
Function
is_skip_dir
(name: &str)
src/palace/room_detect.rs:312
↓ 6 callers
Function
layer1
Layer 1: Essential story — top drawers grouped by room.
src/palace/layers.rs:54
↓ 6 callers
Method
learn_from_text_process
Process detected entity candidates and insert high-confidence people. Helper for [`EntityRegistry::learn_from_text`]. Returns names of newly inserted
src/palace/entity_registry.rs:987
↓ 6 callers
Function
mine_apply_include_ignored
Append any `include_ignored_paths` entries not already in `scanned`. Called by [`mine`] after the gitignore-aware scan to honour the `--include-ignor
src/palace/miner.rs:718
↓ 6 callers
Function
onboarding_ask_mode
Print the three mode choices and read the user's selection. Returns one of `"work"`, `"personal"`, or `"combo"`. Loops until valid.
src/cli/onboarding.rs:158
↓ 6 callers
Function
onboarding_ask_people_one
Read one person from stdin (name + optional nickname, relationship, context). Returns a `PersonEntry` with an empty `name` when the user presses ente
src/cli/onboarding.rs:213
↓ 6 callers
Function
optional_str_arg
Read an optional string argument from the MCP tool args, treating empty or whitespace-only values as absent. Mirrors the Python pattern `value if val
src/mcp/tools.rs:1266
↓ 6 callers
Function
resolve_adapter_name
Resolve the adapter name per RFC 002 §3.3 priority order. 1. Explicit `--source` flag (`explicit`) 2. Per-source config value (`config_value`) 3. Def
src/sources/registry.rs:86
↓ 6 callers
Function
run
Run `mempalace init` for `directory`. Discovers entities, optionally refines via LLM, confirms with the user, detects rooms, then writes `entities.js
src/cli/init.rs:90
↓ 6 callers
Function
run_print_summary
Print the init summary including detected entities and rooms. Called by [`run`] to keep that function within the 70-line limit.
src/cli/init.rs:818
↓ 6 callers
Function
run_with_json
Dispatch a hook from a pre-parsed JSON payload. Extracted from `run()` so tests can inject JSON without requiring stdin. Returns `Err` for unknown ho
src/cli/hook.rs:99
↓ 6 callers
Function
stats
Knowledge graph stats.
src/kg/query.rs:323
↓ 6 callers
Function
sweep_directory_collect_files
Collect all `.jsonl` files under `dir_path` up to `WALK_DEPTH_LIMIT` deep. Extracted from `sweep_directory` to keep that function within the 70-line l
src/palace/sweeper.rs:410
↓ 6 callers
Function
sync_apply_bucket
Update `report` and the removable lists for one classification result. Extracted from `run` so the main loop stays under the 70-line ceiling.
src/cli/sync.rs:240
↓ 6 callers
Method
union
Union the components containing `a` and `b`.
src/palace/project_scanner.rs:249
↓ 6 callers
Function
unregister
Remove an adapter registration (primarily for tests).
src/sources/registry.rs:44
↓ 5 callers
Function
check_text_extract_claims
Called by `check_text_kg_contradictions` to extract structured claims from text. Supports two surface forms — `"X is Y's Z"` and `"X's Z is Y"` — bot
src/palace/fact_checker.rs:331
↓ 5 callers
Function
chunk_by_paragraph
Split content into chunks by paragraph (blank-line boundary) or line groups. Falls back to 25-line groups when the content has only one paragraph but
src/palace/convo_miner.rs:330
↓ 5 callers
Function
classify_entity
Classify `name` into `"person"`, `"project"`, or `"uncertain"` based on its signal scores and occurrence frequency.
src/palace/entity_detect.rs:656
↓ 5 callers
Function
dedup_drawers
Find and remove near-duplicate drawers across the palace. Groups drawers by `source_file`, computes pairwise Jaccard similarity using `drawer_words`,
src/palace/dedup.rs:55
↓ 5 callers
Function
dedup_fetch_groups
Fetch all source-file groups with 2+ drawers (optionally filtered by wing). Returns a map from `source_file` → Vec<DrawerInfo>, ordered by content le
src/palace/dedup.rs:99
↓ 5 callers
Function
diary_ingest_content_hash
Hex-encoded SHA-256 of the diary's full text. Used by the change-detection rule to catch same-size edits (e.g. `"teh" → "the"`) that `(size, mtime)` a
src/palace/diary_ingest.rs:325
↓ 5 callers
Function
empty_origin
()
src/llm/refine.rs:1097
↓ 5 callers
Function
entity_registry_url_encode
Percent-encode a word for use as a Wikipedia REST API URL path segment. Only unreserved characters (A-Z, a-z, 0-9, `-`, `_`, `.`, `~`) are kept as-is
src/palace/entity_registry.rs:1152
↓ 5 callers
Function
extract_json_block
Extract a JSON block from `text` — handles markdown fences and raw brace pairs. Tries ```` ```json ```` fences first, then bare ```` ``` ```` fences,
src/llm/refine.rs:339
↓ 5 callers
Function
extract_key_sentence
Extract the most memorable sentence from `text` for the AAAK quote field. Tries the locale's `quote_pattern` first (verbatim quoted strings are ideal
src/dialect/mod.rs:135
↓ 5 callers
Function
extract_timestamp
Extract timestamp from session lines.
src/cli/split.rs:146
↓ 5 callers
Function
get_adapter
Return a fresh adapter instance for `name`, or `None` if not registered. Each call creates a new instance via the registered constructor.
src/sources/registry.rs:53
↓ 5 callers
Function
header_field_decode
Inverse of [`header_field_encode`]. `?` decodes to empty; the five known `%XX` escapes decode to their literal characters; any other `%XX` (or a trai
src/dialect/mod.rs:540
↓ 5 callers
Function
hook_extract_recent_messages
Extract the last `RECENT_MSG_COUNT` user messages from a JSONL transcript.
src/cli/hook.rs:472
↓ 5 callers
Function
hook_extract_themes
Extract the top `THEMES_MAX` topic words from recent messages. Uses a static stopword list; English-only. Non-English messages produce noisier themes
src/cli/hook.rs:544
↓ 5 callers
Function
hook_ingest_transcript
Spawn `mempalace mine <transcript_parent> --mode convos` in the background. The transcript's parent directory is always mined as a conversation sourc
src/cli/hook.rs:927
↓ 5 callers
Function
hook_stop
Stop hook: auto-save every `SAVE_INTERVAL` messages. In silent mode, writes a diary entry directly to the palace DB and emits a `systemMessage`. In b
src/cli/hook.rs:218
↓ 5 callers
Function
hook_validate_transcript_path
Validate a transcript path: must have `.jsonl`/`.json` extension and no `..`.
src/cli/hook.rs:184
↓ 5 callers
Function
hook_wing_from_transcript
Derive a project wing name from a Claude Code transcript path. Claude Code encodes the project directory with dashes, e.g.: `~/.claude/projects/-User
src/cli/hook.rs:601
↓ 5 callers
Function
ignore_duplicate_column
Suppress the benign `SQLite` error that occurs when an `ALTER TABLE ADD COLUMN` targets a column that already exists (idempotent migration). Any othe
src/schema.rs:109
↓ 5 callers
Function
int_arg
Extract a positive integer argument, coercing floats and strings. MCP JSON transport sometimes delivers integers as floats (`5.0`) or strings (`"5"`)
src/mcp/tools.rs:92
↓ 5 callers
Function
lookup_disambiguate
Disambiguate a word that is both a registered person name and a common English word. Scores context patterns for person usage vs concept usage and re
src/palace/entity_registry.rs:1079
↓ 5 callers
Function
mine_canonicalise_pre_scanned
Rebase pre-scanned file paths onto the canonicalised `project_dir`. Callers (`init::run` → `app::run_mine_after_init`) scan with their own idea of th
src/palace/miner.rs:787
↓ 5 callers
Function
mine_convos_print_summary
( dry_run: bool, file_count: usize, files_skipped: usize, files_unreadable: usize, files_t
src/palace/convo_miner.rs:460
↓ 5 callers
Function
mine_convos_resolve_wing
Canonicalize `directory` and resolve the wing name. Returns `(canonical_path, wing_name)` where `wing_name` is either the explicit override from `opt
src/palace/convo_miner.rs:649
↓ 5 callers
Function
open_db
Open (or create) a local turso database and return a connection. For file-backed databases, WAL journal mode is enabled for better concurrency and cr
src/db.rs:21
↓ 5 callers
Function
parse_claude_jsonl
Parse a Claude Code `.jsonl` file and return all user/assistant messages. Each JSONL line is parsed independently; malformed lines are silently skipp
src/palace/sweeper.rs:202
↓ 5 callers
Function
parse_response
Parse an LLM response into a name → `(label, reason)` map. Extracts a JSON block, validates each label against [`VALID_LABELS`], and filters to entri
src/llm/refine.rs:401
↓ 5 callers
Function
refine_entities
Refine a [`DetectedDict`] using an LLM to drop false positives and reclassify entities. Sends candidates in batches of [`BATCH_SIZE`] to `provider.cl
src/llm/refine.rs:142
↓ 5 callers
Function
regenerate_closets_parse_response
Called by `regenerate_closets_process_drawer` to parse the LLM JSON response. Strips optional markdown code fences (` ```json `) before parsing. Retu
src/palace/closet_llm.rs:310
↓ 5 callers
Function
run
Run the export command, writing drawers to `output_dir`.
src/cli/export.rs:11
↓ 5 callers
Function
run
Run a sync pass over the palace. `apply = false` returns the classification report without touching the database. `apply = true` deletes the gitignor
src/cli/sync.rs:177
↓ 5 callers
Function
run_derive_wing_name
Derive the wing name: prefer the user's own project name from scan results, fall back to the directory name sanitized to `snake_case`. Called by [`ru
src/cli/init.rs:683
↓ 5 callers
Function
run_print_entities
Print a labelled entity list. Called by [`run_print_summary`].
src/cli/init.rs:867
↓ 5 callers
Function
run_setup_llm_consent_check
Print the privacy warning and optionally prompt for consent when an external LLM is configured via an env-fallback API key. Returns `false` if the us
src/cli/init.rs:469
↓ 5 callers
Function
run_with_provider
Inner execution after the LLM provider is confirmed available. Logs progress messages, calls `regenerate_closets`, asserts stat invariants, and logs
src/cli/closet_llm.rs:81
↓ 5 callers
Function
sanitize_label
Validate tunnel label: trim, non-empty, reject null bytes and length violations.
src/mcp/tools.rs:250
↓ 5 callers
Function
scan_claude_projects
Scan a `.claude/projects/` directory and return one [`ProjectInfo`] per project. `total_commits` is repurposed as session count — a density signal th
src/palace/session_scanner.rs:72
↓ 5 callers
Function
scan_for_detection
(project_dir: &Path, max_files: usize)
src/palace/entity_detect.rs:741
↓ 5 callers
Function
seed_tunnel
(connection: &Connection)
src/mcp/tools.rs:2794
↓ 5 callers
Function
timeline
Get chronological timeline of facts.
src/kg/query.rs:247
↓ 5 callers
Function
to_detected_dict
Convert `scan` results into [`DetectedDict`] — the same shape as `entity_detect::detect_entities`. Capped at `PROJECT_CAP` projects and `PEOPLE_CAP`
src/palace/project_scanner.rs:941
↓ 5 callers
Method
to_signal
Human-readable evidence string used as the `signals` entry in [`DetectedEntity`].
src/palace/project_scanner.rs:113
↓ 5 callers
Function
tokenize
Tokenize text into lowercase words, filtering stop words and short words.
src/palace/drawer.rs:37
↓ 5 callers
Function
tokenize_query
Tokenize a query string into searchable words. The minimum length of 3 matches the indexing threshold in `index_words`: shorter tokens (single letter
src/palace/search.rs:562
↓ 5 callers
Function
tool_delete_tunnel
Delete an explicit tunnel by its 16-character hex ID.
src/mcp/tools.rs:1479
↓ 5 callers
Function
try_parse
Try to parse a Codex CLI JSONL session into transcript text. Returns `None` if the file lacks a `session_meta` entry, contains fewer than 2 messages,
src/normalize/codex.rs:13
↓ 5 callers
Function
try_parse
Try to parse a Slack JSON message export into transcript text. Valid messages are JSON objects with `type == "message"`, non-empty `text`, and non-em
src/normalize/slack.rs:41
↓ 5 callers
Function
unreachable_port
Bind a random port then immediately drop it, leaving the port unreachable. Used to produce a predictable "connection refused" in network error path t
src/llm/client.rs:976
↓ 5 callers
Function
walk_convos
Iteratively walk `directory` (depth-limited DFS) and collect conversation files. Symlinks are skipped; directories named `tool-results` or `memory` a
src/palace/convo_miner.rs:383
↓ 4 callers
Function
add_entity
( connection: &Connection, name: &str, entity_type: &str, properties: Option<&str>, )
src/kg/mod.rs:531
↓ 4 callers
Function
apply_corpus_origin
Filter AI agent persona names out of `detected` to prevent them from being confirmed as human entities during the init pipeline. When `origin.agent_p
src/palace/entity_detect.rs:808
↓ 4 callers
Function
build_graph
Build the palace graph from drawer metadata. Returns (nodes, edges) where nodes are rooms and edges are tunnels.
src/palace/graph.rs:83
↓ 4 callers
Function
check_extraction_safety
Verify that `extracted` matches the palace row count before any destructive write. Two signals trip the guard: 1. **Strong** — the DB reports more dr
src/palace/repair.rs:43
↓ 4 callers
Function
chunk_by_exchange_flush
Flush an assembled exchange into `chunks`, splitting on `CHUNK_SIZE` boundaries. When content fits in one chunk it is pushed as-is (guarded by `CHUNK
src/palace/convo_miner.rs:230
↓ 4 callers
Function
chunk_exchanges
Split conversation content into chunks, routing to `chunk_by_exchange` or `chunk_by_paragraph` depending on whether the content uses the quoted-turn f
src/palace/convo_miner.rs:137
↓ 4 callers
Function
classify_entity_build
Called by [`classify_entity`] to keep that function within the 70-line limit. Constructs the [`DetectedEntity`] from pre-computed ratio and corrobora
src/palace/entity_detect.rs:686
↓ 4 callers
Function
compute_topic_tunnels
clamped to `max(1, min_count)` so a value of 0 still requires one match. Returns the number of tunnels created or refreshed.
src/palace/graph.rs:835
↓ 4 callers
Function
current_lang
Return the active locale language code. Resolution order: `MEMPALACE_LANG`, then `MEMPAL_LANG`, then `"en"`. The result is always lowercased and vali
src/i18n/mod.rs:186
↓ 4 callers
Function
current_thread_runtime
()
tests/concurrent_access.rs:4
↓ 4 callers
Function
dedup_find_duplicates
Compute pairwise Jaccard similarity and return IDs of drawers to delete. For each pair (i, j) where i < j: if Jaccard ≥ `threshold`, the shorter draw
src/palace/dedup.rs:196
← previous
next →
101–200 of 2,248, ranked by callers