Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/24kchengYe/MemoMind
/ functions
Functions
1,372 in github.com/24kchengYe/MemoMind
⨍
Functions
1,372
◇
Types & classes
350
↳
Endpoints
62
↓ 2 callers
Function
initialize_metrics
Initialize OpenTelemetry metrics with Prometheus exporter. This should be called once during application startup. Args: service
engine/hindsight_api/metrics.py:94
↓ 2 callers
Method
is_fully_loaded
Check if all edges for this node have been loaded.
engine/hindsight_api/engine/search/mpfp_retrieval.py:84
↓ 2 callers
Method
is_running
Check if the PostgreSQL server is currently running.
engine/hindsight_api/pg0.py:108
↓ 2 callers
Function
is_tracing_enabled
Check if tracing is enabled.
engine/hindsight_api/tracing.py:238
↓ 2 callers
Function
load_all_edges_for_frontier
Load top-k edges per (node, edge_type) for frontier nodes. Uses a LATERAL join to efficiently fetch only the top-k edges per type, avoid
engine/hindsight_api/engine/search/mpfp_retrieval.py:159
↓ 2 callers
Function
main
Main entry point for the CLI.
engine/hindsight_api/main.py:66
↓ 2 callers
Function
matches_pattern
Check if value matches a pattern (substring or regex).
restore_backup.py:42
↓ 2 callers
Function
mpfp_traverse_hop_synchronized
Execute ALL patterns with hop-synchronized edge loading. Instead of running each pattern independently (causing multiple DB queries), th
engine/hindsight_api/engine/search/mpfp_retrieval.py:301
↓ 2 callers
Method
on_shutdown
Called when the application shuts down. Override to perform cleanup tasks like closing connections.
engine/hindsight_api/extensions/base.py:75
↓ 2 callers
Method
on_startup
Called when the application starts. Override to perform initialization tasks like connecting to external services.
engine/hindsight_api/extensions/base.py:67
↓ 2 callers
Function
parse_llm_json
Robustly parse JSON returned by an LLM. Handles common LLM output quirks: 1. Markdown code fences (```json ... ```) — strip them before
engine/hindsight_api/engine/llm_wrapper.py:85
↓ 2 callers
Method
predict
Score query-document pairs for relevance. Args: pairs: List of (query, document) tuples to score Returns:
engine/hindsight_api/engine/cross_encoder.py:77
↓ 2 callers
Function
reciprocal_rank_fusion
Merge multiple ranked result lists using Reciprocal Rank Fusion. RRF formula: score(d) = sum_over_lists(1 / (k + rank(d))) Args:
engine/hindsight_api/engine/search/fusion.py:10
↓ 2 callers
Method
record_exception
No-op.
engine/hindsight_api/tracing.py:78
↓ 2 callers
Method
refresh_mental_model
Refresh a pinned mental model by re-running its source query. This method: 1. Gets the pinned mental model 2. Runs the source
engine/hindsight_api/engine/memory_engine.py:6328
↓ 2 callers
Function
run_consolidation_job
Run consolidation job for a bank. This is called after retain operations to consolidate new memories into mental models. Args:
engine/hindsight_api/engine/consolidation/consolidator.py:160
↓ 2 callers
Function
run_migrations
Run database migrations to the latest version using programmatic Alembic configuration. This function is safe to call from multiple distribu
engine/hindsight_api/migrations.py:175
↓ 2 callers
Method
set_db_pool
Set the database pool for metrics collection. Args: pool: asyncpg connection pool instance
engine/hindsight_api/metrics.py:530
↓ 2 callers
Method
shutdown_graceful
Signal shutdown and wait for current tasks to complete. Args: timeout: Maximum time to wait for in-flight tasks (seconds
engine/hindsight_api/worker/poller.py:584
↓ 2 callers
Method
start
Start the server in a background thread. Args: timeout: Maximum time to wait for server to start (seconds) Retu
patches/hindsight_server.py:151
↓ 2 callers
Method
start
Start the PostgreSQL server with retry logic.
engine/hindsight_api/pg0.py:57
↓ 2 callers
Method
start
Start timing the search.
engine/hindsight_api/engine/search/tracer.py:98
↓ 2 callers
Method
stop
Stop the server. Args: timeout: Maximum time to wait for server to stop (seconds)
engine/hindsight/server.py:188
↓ 2 callers
Method
submit_task
Submit a task for execution. Args: task_dict: Task as a dictionary (must be serializable)
engine/hindsight_api/engine/task_backend.py:63
↓ 2 callers
Function
to_memory_facts
(facts: list[str], fact_type: str)
engine/hindsight_api/engine/search/think_utils.py:228
↓ 2 callers
Method
validate_retain
Validate a retain operation before execution. Called before the retain operation is processed. Return ValidationResult.reject()
engine/hindsight_api/extensions/operation_validator.py:349
↓ 1 callers
Method
__init__
(self, client: Hindsight)
engine/hindsight/client_wrapper.py:18
↓ 1 callers
Method
__init__
Initialize the task backend.
engine/hindsight_api/engine/task_backend.py:41
↓ 1 callers
Method
__init__
(self, config: dict[str, str])
engine/hindsight_api/extensions/builtin/tenant.py:63
↓ 1 callers
Function
_apply_bank_tool_filtering
Filter bank-level mcp_enabled_tools from both tools/list and tool invocation. Compatible with FastMCP 2.x (_tool_manager pattern) and 3.x (provid
engine/hindsight_api/mcp_tools.py:271
↓ 1 callers
Function
_backup
Backup all tables to a zip file using binary COPY protocol.
engine/hindsight_api/admin/cli.py:52
↓ 1 callers
Function
_build_directives_applied
Build list of DirectiveInfo from directives.
engine/hindsight_api/engine/reflect/agent.py:24
↓ 1 callers
Function
_build_done_tool_with_directives
Build the done tool schema with directive compliance field. When directives are present, adds a required field that forces the agent to
engine/hindsight_api/engine/reflect/tools_schema.py:171
↓ 1 callers
Function
_build_group_clause
Recursively build an inner SQL clause (no leading AND/OR) for a single TagGroup. Returns: (inner_clause, params, next_param_offset)
engine/hindsight_api/engine/search/tags.py:231
↓ 1 callers
Method
_build_labels_lookup
Build a set of valid 'key:value' entity label strings for fast lookup.
engine/hindsight_api/engine/entity_resolver.py:152
↓ 1 callers
Function
_build_labels_prompt_section
Build the entity labels classification section for the extraction prompt.
patches/fact_extraction.py:684
↓ 1 callers
Function
_build_labels_prompt_section
Build the entity labels classification section for the extraction prompt.
engine/hindsight_api/engine/retain/fact_extraction.py:684
↓ 1 callers
Function
_build_observations_for_llm
Serialize MemoryFact observations into dicts for the consolidation LLM prompt.
patches/consolidator.py:1005
↓ 1 callers
Function
_build_observations_for_llm
Serialize MemoryFact observations into dicts for the consolidation LLM prompt.
engine/hindsight_api/engine/consolidation/consolidator.py:1005
↓ 1 callers
Function
_build_request_body
Build request body for LLM API call.
patches/fact_extraction.py:868
↓ 1 callers
Function
_build_request_body
Build request body for LLM API call.
engine/hindsight_api/engine/retain/fact_extraction.py:868
↓ 1 callers
Method
_call_ollama_native
Call Ollama using native API with JSON schema enforcement. Ollama's native API supports passing a full JSON schema in the 'format' p
engine/hindsight_api/engine/providers/openai_compatible_llm.py:658
↓ 1 callers
Function
_chunk_conversation
Chunk a conversation array at turn boundaries, preserving complete turns. Args: turns: List of conversation turn dicts (with 'role'
patches/fact_extraction.py:386
↓ 1 callers
Function
_chunk_conversation
Chunk a conversation array at turn boundaries, preserving complete turns. Args: turns: List of conversation turn dicts (with 'role'
engine/hindsight_api/engine/retain/fact_extraction.py:386
↓ 1 callers
Method
_claim_batch_for_schema
Claim tasks from a specific schema respecting slot limits.
engine/hindsight_api/worker/poller.py:195
↓ 1 callers
Method
_claim_batch_for_schema_inner
Inner implementation for claiming tasks from a specific schema with slot limits.
engine/hindsight_api/worker/poller.py:207
↓ 1 callers
Function
_clean_done_answer
Clean up the answer field from a done() tool call. Some LLMs leak structured output patterns into the answer text, such as: - JSON code block
engine/hindsight_api/engine/reflect/agent.py:107
↓ 1 callers
Function
_cleanup
Synchronous cleanup function to stop resources on exit.
engine/hindsight_api/main.py:46
↓ 1 callers
Method
_cleanup_task
Remove task from tracking after completion.
engine/hindsight_api/worker/poller.py:354
↓ 1 callers
Function
_collect_config
Collect configuration from environment variables. Collects all variables matching {env_prefix}_{prefix}_* except for {env_prefix}_{prefi
engine/hindsight_api/extensions/loader.py:108
↓ 1 callers
Function
_consolidate_batch_with_llm
Single LLM call for a batch of facts against a pooled set of observations.
patches/consolidator.py:1044
↓ 1 callers
Function
_consolidate_batch_with_llm
Single LLM call for a batch of facts against a pooled set of observations.
engine/hindsight_api/engine/consolidation/consolidator.py:1044
↓ 1 callers
Function
_count_messages_tokens
Estimate the token count of the messages list using cl100k_base encoding.
engine/hindsight_api/engine/reflect/agent.py:267
↓ 1 callers
Function
_create_observation_directly
Create an observation from one or more source memories with pre-processed text.
patches/consolidator.py:1106
↓ 1 callers
Function
_create_observation_directly
Create an observation from one or more source memories with pre-processed text.
engine/hindsight_api/engine/consolidation/consolidator.py:1106
↓ 1 callers
Function
_decommission_worker
Release all tasks owned by a worker, setting them back to pending status.
engine/hindsight_api/admin/cli.py:319
↓ 1 callers
Method
_delete_operation_record
Helper to delete an operation record from the database.
engine/hindsight_api/engine/memory_engine.py:1236
↓ 1 callers
Function
_detect_text_search_extension
Detect or validate text search extension: 'native', 'vchord', or 'pg_textsearch'. Respects HINDSIGHT_API_TEXT_SEARCH_EXTENSION env var. C
engine/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:75
↓ 1 callers
Function
_detect_text_search_extension
Detect or validate text search extension: 'native', 'vchord', or 'pg_textsearch'. Respects HINDSIGHT_API_TEXT_SEARCH_EXTENSION env var. C
engine/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:82
↓ 1 callers
Function
_detect_vector_extension
Detect or validate vector extension: 'pgvector', 'vchord', or 'pgvectorscale'. Respects HINDSIGHT_API_VECTOR_EXTENSION env var if set.
engine/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:25
↓ 1 callers
Function
_detect_vector_extension
Detect or validate vector extension: 'pgvector', 'vchord', or 'pgvectorscale'. Respects HINDSIGHT_API_VECTOR_EXTENSION env var if set.
engine/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:32
↓ 1 callers
Function
_execute_create_action
Create a new observation from one or more source memories. Tags are inherited from the source facts (determined algorithmically, not by LLM)
patches/consolidator.py:870
↓ 1 callers
Function
_execute_create_action
Create a new observation from one or more source memories. Tags are inherited from the source facts (determined algorithmically, not by LLM)
engine/hindsight_api/engine/consolidation/consolidator.py:870
↓ 1 callers
Function
_execute_delete_action
Delete a superseded or contradicted observation.
patches/consolidator.py:905
↓ 1 callers
Function
_execute_delete_action
Delete a superseded or contradicted observation.
engine/hindsight_api/engine/consolidation/consolidator.py:905
↓ 1 callers
Function
_execute_hop
Execute ONE hop of traversal, return frontier nodes for next hop. This is a pure function that uses cached edges (no DB access). Returns
engine/hindsight_api/engine/search/mpfp_retrieval.py:247
↓ 1 callers
Method
_execute_task
Execute a task through the registered executor. Args: task_dict: Task dictionary to execute
engine/hindsight_api/engine/task_backend.py:79
↓ 1 callers
Method
_execute_task_inner
Inner task execution with retry/fail handling. Tasks that want to be retried raise RetryTaskAt; the poller sets next_retry_at and res
engine/hindsight_api/worker/poller.py:366
↓ 1 callers
Function
_execute_tool
Execute a single tool by name.
engine/hindsight_api/engine/reflect/agent.py:1039
↓ 1 callers
Function
_execute_tool_with_timing
Execute a tool call and return result with timing.
engine/hindsight_api/engine/reflect/agent.py:968
↓ 1 callers
Function
_execute_update_action
Update an existing observation. Extends source_memory_ids with all contributing memories, updates temporal fields (LEAST for occurred_st
patches/consolidator.py:782
↓ 1 callers
Function
_execute_update_action
Update an existing observation. Extends source_memory_ids with all contributing memories, updates temporal fields (LEAST for occurred_st
engine/hindsight_api/engine/consolidation/consolidator.py:782
↓ 1 callers
Method
_expand_combined
Single-roundtrip CTE query combining entity, semantic, and causal expansions. Uses a `source` discriminator column so the caller can
patches/link_expansion_retrieval.py:244
↓ 1 callers
Method
_expand_combined
Single-roundtrip CTE query combining entity, semantic, and causal expansions. Uses a `source` discriminator column so the caller can
engine/link_expansion_retrieval.py:244
↓ 1 callers
Method
_expand_combined
Single-roundtrip CTE query combining entity, semantic, and causal expansions. Uses a `source` discriminator column so the caller can
engine/hindsight_api/engine/search/link_expansion_retrieval.py:244
↓ 1 callers
Method
_expand_observations
Observation-specific expansion. Observations don't have direct entity links in memory_links (they're created by consolidatio
patches/link_expansion_retrieval.py:375
↓ 1 callers
Method
_expand_observations
Observation-specific expansion. Observations don't have direct entity links in memory_links (they're created by consolidatio
engine/link_expansion_retrieval.py:375
↓ 1 callers
Method
_expand_observations
Observation-specific expansion. Observations don't have direct entity links in memory_links (they're created by consolidatio
engine/hindsight_api/engine/search/link_expansion_retrieval.py:367
↓ 1 callers
Function
_extract_facts_from_chunk
Extract facts from a single chunk (internal helper for parallel processing). Note: event_date parameter is kept for backward compatibility b
patches/fact_extraction.py:895
↓ 1 callers
Function
_extract_facts_from_chunk
Extract facts from a single chunk (internal helper for parallel processing). Note: event_date parameter is kept for backward compatibility b
engine/hindsight_api/engine/retain/fact_extraction.py:895
↓ 1 callers
Function
_extract_facts_with_auto_split
Extract facts from a chunk with automatic splitting if output exceeds token limits. If the LLM output is too long (OutputTooLongError), this
patches/fact_extraction.py:1245
↓ 1 callers
Function
_extract_facts_with_auto_split
Extract facts from a chunk with automatic splitting if output exceeds token limits. If the LLM output is too long (OutputTooLongError), this
engine/hindsight_api/engine/retain/fact_extraction.py:1239
↓ 1 callers
Method
_extract_period
Extract period-based temporal expressions (week, month, year, weekend). These need special handling as they represent date ranges, n
engine/hindsight_api/engine/query_analyzer.py:161
↓ 1 callers
Method
_extract_system_instructions
Extract system instructions from messages if present.
engine/hindsight_api/tracing.py:440
↓ 1 callers
Method
_extract_with_rules
Extract temporal expressions using rule-based patterns. Handles common patterns reliably and fast. Returns None for patterns
engine/hindsight_api/engine/query_analyzer.py:333
↓ 1 callers
Function
_fact_line
(m: dict[str, Any])
patches/consolidator.py:1058
↓ 1 callers
Function
_fact_line
(m: dict[str, Any])
engine/hindsight_api/engine/consolidation/consolidator.py:1058
↓ 1 callers
Method
_filter_by_token_budget
Filter results to fit within token budget. Counts tokens only for the 'text' field using tiktoken (cl100k_base encoding). St
engine/hindsight_api/engine/memory_engine.py:3353
↓ 1 callers
Function
_finalize_pattern
Finalize pattern by adding remaining frontier mass to scores.
engine/hindsight_api/engine/search/mpfp_retrieval.py:292
↓ 1 callers
Function
_find_free_port
Find a free port on localhost.
patches/hindsight_server.py:23
↓ 1 callers
Function
_find_free_port
Find a free port on localhost.
engine/hindsight/server.py:23
↓ 1 callers
Function
_find_related_observations
Find observations related to the given query using optimized recall. SECURITY: Filters by tags using all_strict matching to prevent cross-te
patches/consolidator.py:943
↓ 1 callers
Function
_find_related_observations
Find observations related to the given query using optimized recall. SECURITY: Filters by tags using all_strict matching to prevent cross-te
engine/hindsight_api/engine/consolidation/consolidator.py:943
↓ 1 callers
Function
_find_semantic_seeds
Find semantic seeds via embedding search.
patches/link_expansion_retrieval.py:37
↓ 1 callers
Function
_find_semantic_seeds
Find semantic seeds via embedding search.
engine/link_expansion_retrieval.py:37
↓ 1 callers
Function
_find_semantic_seeds
Find semantic seeds via embedding search.
engine/hindsight_api/engine/search/link_expansion_retrieval.py:37
↓ 1 callers
Method
_find_semantic_seeds
Fallback: find semantic seeds via embedding search.
engine/hindsight_api/engine/search/mpfp_retrieval.py:662
↓ 1 callers
Method
_fire_consolidation_webhook
Fire a consolidation webhook event. Non-fatal - logs errors but does not raise.
engine/hindsight_api/engine/memory_engine.py:1061
↓ 1 callers
Method
_format_messages
Format messages into GenAI semantic convention format (JSON array). Returns JSON string representation of message array.
engine/hindsight_api/tracing.py:388
↓ 1 callers
Method
_format_output
Format output message into GenAI semantic convention format.
engine/hindsight_api/tracing.py:414
← previous
next →
301–400 of 1,372, ranked by callers