Skip to main content

Python API

omega.bridge public API -- 36 functions.

This is the main programmatic interface used internally by the MCP handlers. All functions are importable from omega.bridge.

from omega.bridge import store, query, remember, auto_capture

Core

FunctionSignatureDescription
storestore(content, event_type="memory", metadata=None, session_id=None, entity_id=None) -> strStore a memory with metadata. Wraps auto_capture with a default event type.
rememberremember(text, session_id=None) -> strStore a permanent memory as user_preference type.
auto_captureauto_capture(content, event_type, metadata=None, session_id=None, project=None, ttl_override=None, entity_id=None) -> strPrimary ingestion function. Handles dedup (SHA256 + Jaccard), evolution (appends to similar memories), auto-tagging, auto-relating, and blocklist filtering.
delete_memorydelete_memory(memory_id) -> dictDelete a memory by its node ID. Returns {"success": bool}.
edit_memoryedit_memory(memory_id, new_content) -> dictUpdate a memory's content and regenerate its embedding.

Query

FunctionSignatureDescription
queryquery(text, limit=10, event_type=None, filter_tags=None, temporal_range=None, context_file=None, context_tags=None, entity_id=None, project=None, session_id=None) -> strSemantic search with blended ranking (70% vector, 30% FTS5) and contextual re-ranking. Returns markdown-formatted results.
query_structuredquery_structured(text, limit=10, event_type=None, filter_tags=None, ...) -> list[dict]Same search pipeline as query but returns structured dicts instead of markdown.
phrase_searchphrase_search(phrase, limit=10, event_type=None, project=None, case_sensitive=False) -> strExact substring match via FTS5 full-text search.
find_similar_memoriesfind_similar_memories(memory_id, limit=5) -> strFind memories similar to a given memory by embedding distance.

Session

FunctionSignatureDescription
welcomewelcome(session_id=None, project=None) -> dictSession briefing: recent memories, user profile, project context.
get_session_contextget_session_context(session_id, project=None) -> dictRetrieve session context for handoff or resume.
clear_sessionclear_session(session_id) -> dictDelete all memories associated with a session.
batch_storebatch_store(items) -> dictStore multiple memories in a single call. Each item is a dict with content and optional event_type, metadata, etc.

Health and Stats

FunctionSignatureDescription
check_healthcheck_health(warn_mb=350, critical_mb=500, max_nodes=10000) -> dictSystem health check: memory usage, node counts, cache stats, warnings.
statusstatus() -> dictMemory count, database size, model status, edge count.
get_dedup_statsget_dedup_stats() -> dictDeduplication statistics (duplicates found, evolved, blocked).
type_statstype_stats() -> dictMemory counts grouped by event type.
session_statssession_stats() -> dictMemory counts grouped by session (top 20).
get_activity_summaryget_activity_summary(days=7) -> dictRecent session activity overview.

Profile

FunctionSignatureDescription
get_profileget_profile() -> dictUser profile built from memory patterns.
save_profilesave_profile(profile) -> boolSave or update user profile fields.
extract_preferencesextract_preferences(text) -> dictExtract preference signals from text content.
list_preferenceslist_preferences() -> list[dict]List all stored user preferences.

Lessons

FunctionSignatureDescription
get_cross_session_lessonsget_cross_session_lessons(task=None, limit=5, project_path=None, exclude_project=None, exclude_session=None) -> listLessons across sessions, ranked by verification count and access frequency.
get_cross_project_lessonsget_cross_project_lessons(task=None, limit=5, exclude_project=None, exclude_session=None) -> listLessons across all projects.

Maintenance

FunctionSignatureDescription
consolidateconsolidate(prune_days=30, max_summaries=50) -> strPrune stale low-value memories, cap session summaries, clean orphaned edges. Auto-backs up before running.
compactcompact(event_type="lesson_learned", threshold=0.6, min_cluster=3, dry_run=False) -> strCluster similar memories (Jaccard similarity) and create summary nodes. Originals marked as superseded.
deduplicatededuplicate() -> dictRemove exact content duplicates (SHA256 hash match).
timelinetimeline(days=7, limit_per_day=10) -> strMemory timeline grouped by day.
traversetraverse(memory_id, max_hops=2, min_weight=0.0) -> strBFS traversal of the memory relationship graph (max 5 hops).

Export and Import

FunctionSignatureDescription
export_memoriesexport_memories(filepath) -> strExport all memories to a JSON file.
import_memoriesimport_memories(filepath, clear_existing=True) -> strImport memories from a JSON file. Optionally clears existing data first.
reingestreingest() -> dictReload entries from legacy store.jsonl into the graph system.

Constraints

FunctionSignatureDescription
check_constraintscheck_constraints(file_path, project=None) -> list[dict]Check a file against stored project constraints.
list_constraintslist_constraints(project=None) -> dictList all constraints for a project.
save_constraintssave_constraints(constraints, project=None) -> dictSave or update project constraints.

Feedback

FunctionSignatureDescription
record_feedbackrecord_feedback(memory_id, rating, reason=None) -> dictRate a memory as helpful, unhelpful, or outdated. Affects future search ranking via feedback dampening.

Testing

FunctionSignatureDescription
reset_memoryreset_memory() -> NoneReset the memory store. For testing only -- destroys all data.

Notes

  • All functions are importable from omega.bridge.
  • The MCP handlers in server/handlers.py call these functions directly.
  • auto_capture is the primary ingestion path -- store and remember are convenience wrappers around it.
  • Functions returning str typically return markdown-formatted output suitable for display in agent conversations.
  • Functions returning dict or list return structured data for programmatic use.