ormah 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. ormah-0.1.0/.env.example +93 -0
  2. ormah-0.1.0/.gitignore +63 -0
  3. ormah-0.1.0/CLAUDE.md +124 -0
  4. ormah-0.1.0/LICENSE +21 -0
  5. ormah-0.1.0/Makefile +46 -0
  6. ormah-0.1.0/PKG-INFO +400 -0
  7. ormah-0.1.0/README.md +356 -0
  8. ormah-0.1.0/hatch_build.py +35 -0
  9. ormah-0.1.0/install.sh +148 -0
  10. ormah-0.1.0/memory/config.yaml +20 -0
  11. ormah-0.1.0/memory/logs/.gitkeep +0 -0
  12. ormah-0.1.0/memory/nodes/.gitkeep +0 -0
  13. ormah-0.1.0/pyproject.toml +85 -0
  14. ormah-0.1.0/src/ormah/__init__.py +0 -0
  15. ormah-0.1.0/src/ormah/adapters/__init__.py +0 -0
  16. ormah-0.1.0/src/ormah/adapters/cli_adapter.py +589 -0
  17. ormah-0.1.0/src/ormah/adapters/mcp_adapter.py +334 -0
  18. ormah-0.1.0/src/ormah/adapters/openai_adapter.py +20 -0
  19. ormah-0.1.0/src/ormah/adapters/space_detect.py +56 -0
  20. ormah-0.1.0/src/ormah/adapters/tool_schemas.py +381 -0
  21. ormah-0.1.0/src/ormah/api/__init__.py +0 -0
  22. ormah-0.1.0/src/ormah/api/middleware.py +32 -0
  23. ormah-0.1.0/src/ormah/api/routes_admin.py +177 -0
  24. ormah-0.1.0/src/ormah/api/routes_agent.py +342 -0
  25. ormah-0.1.0/src/ormah/api/routes_ingest.py +64 -0
  26. ormah-0.1.0/src/ormah/api/routes_ui.py +153 -0
  27. ormah-0.1.0/src/ormah/background/__init__.py +0 -0
  28. ormah-0.1.0/src/ormah/background/auto_cluster.py +63 -0
  29. ormah-0.1.0/src/ormah/background/auto_linker.py +262 -0
  30. ormah-0.1.0/src/ormah/background/conflict_detector.py +240 -0
  31. ormah-0.1.0/src/ormah/background/consolidator.py +222 -0
  32. ormah-0.1.0/src/ormah/background/decay_manager.py +68 -0
  33. ormah-0.1.0/src/ormah/background/duplicate_merger.py +274 -0
  34. ormah-0.1.0/src/ormah/background/hippocampus.py +276 -0
  35. ormah-0.1.0/src/ormah/background/importance_scorer.py +111 -0
  36. ormah-0.1.0/src/ormah/background/job_tracker.py +86 -0
  37. ormah-0.1.0/src/ormah/background/llm/__init__.py +41 -0
  38. ormah-0.1.0/src/ormah/background/llm/base.py +18 -0
  39. ormah-0.1.0/src/ormah/background/llm/litellm_adapter.py +40 -0
  40. ormah-0.1.0/src/ormah/background/llm/normalize.py +50 -0
  41. ormah-0.1.0/src/ormah/background/llm/ollama_adapter.py +47 -0
  42. ormah-0.1.0/src/ormah/background/llm_client.py +40 -0
  43. ormah-0.1.0/src/ormah/background/scheduler.py +117 -0
  44. ormah-0.1.0/src/ormah/background/session_watcher.py +262 -0
  45. ormah-0.1.0/src/ormah/cli.py +212 -0
  46. ormah-0.1.0/src/ormah/config.py +385 -0
  47. ormah-0.1.0/src/ormah/embeddings/__init__.py +39 -0
  48. ormah-0.1.0/src/ormah/embeddings/base.py +28 -0
  49. ormah-0.1.0/src/ormah/embeddings/encoder.py +36 -0
  50. ormah-0.1.0/src/ormah/embeddings/hybrid_search.py +303 -0
  51. ormah-0.1.0/src/ormah/embeddings/litellm_adapter.py +48 -0
  52. ormah-0.1.0/src/ormah/embeddings/local_adapter.py +84 -0
  53. ormah-0.1.0/src/ormah/embeddings/ollama_adapter.py +53 -0
  54. ormah-0.1.0/src/ormah/embeddings/reranker.py +89 -0
  55. ormah-0.1.0/src/ormah/embeddings/vector_store.py +90 -0
  56. ormah-0.1.0/src/ormah/engine/__init__.py +0 -0
  57. ormah-0.1.0/src/ormah/engine/context_builder.py +619 -0
  58. ormah-0.1.0/src/ormah/engine/memory_engine.py +1742 -0
  59. ormah-0.1.0/src/ormah/engine/prompt_classifier.py +325 -0
  60. ormah-0.1.0/src/ormah/engine/tier_manager.py +74 -0
  61. ormah-0.1.0/src/ormah/engine/traversal.py +214 -0
  62. ormah-0.1.0/src/ormah/index/__init__.py +0 -0
  63. ormah-0.1.0/src/ormah/index/builder.py +207 -0
  64. ormah-0.1.0/src/ormah/index/db.py +175 -0
  65. ormah-0.1.0/src/ormah/index/graph.py +238 -0
  66. ormah-0.1.0/src/ormah/index/schema.sql +94 -0
  67. ormah-0.1.0/src/ormah/instructions.md +47 -0
  68. ormah-0.1.0/src/ormah/logging_setup.py +62 -0
  69. ormah-0.1.0/src/ormah/main.py +127 -0
  70. ormah-0.1.0/src/ormah/models/__init__.py +0 -0
  71. ormah-0.1.0/src/ormah/models/node.py +105 -0
  72. ormah-0.1.0/src/ormah/models/proposals.py +36 -0
  73. ormah-0.1.0/src/ormah/models/search.py +25 -0
  74. ormah-0.1.0/src/ormah/server_manager.py +215 -0
  75. ormah-0.1.0/src/ormah/setup.py +645 -0
  76. ormah-0.1.0/src/ormah/store/__init__.py +0 -0
  77. ormah-0.1.0/src/ormah/store/file_store.py +179 -0
  78. ormah-0.1.0/src/ormah/store/markdown.py +97 -0
  79. ormah-0.1.0/src/ormah/store/watcher.py +43 -0
  80. ormah-0.1.0/src/ormah/transcript/__init__.py +0 -0
  81. ormah-0.1.0/src/ormah/transcript/parser.py +133 -0
  82. ormah-0.1.0/src/ormah/ui_dist/assets/index-Bx0ty03o.js +370 -0
  83. ormah-0.1.0/src/ormah/ui_dist/assets/index-CZlRGpit.css +1 -0
  84. ormah-0.1.0/src/ormah/ui_dist/index.html +13 -0
  85. ormah-0.1.0/tests/__init__.py +0 -0
  86. ormah-0.1.0/tests/conftest.py +47 -0
  87. ormah-0.1.0/tests/test_adapters/__init__.py +0 -0
  88. ormah-0.1.0/tests/test_adapters/test_cli_adapter.py +684 -0
  89. ormah-0.1.0/tests/test_adapters/test_space_detect.py +92 -0
  90. ormah-0.1.0/tests/test_api/__init__.py +0 -0
  91. ormah-0.1.0/tests/test_api/test_routes.py +97 -0
  92. ormah-0.1.0/tests/test_background/__init__.py +0 -0
  93. ormah-0.1.0/tests/test_background/test_auto_linker.py +252 -0
  94. ormah-0.1.0/tests/test_background/test_conflict_detector.py +278 -0
  95. ormah-0.1.0/tests/test_background/test_consolidator.py +128 -0
  96. ormah-0.1.0/tests/test_background/test_decay_manager.py +160 -0
  97. ormah-0.1.0/tests/test_background/test_duplicate_merger.py +158 -0
  98. ormah-0.1.0/tests/test_background/test_hippocampus.py +319 -0
  99. ormah-0.1.0/tests/test_background/test_importance_scorer.py +378 -0
  100. ormah-0.1.0/tests/test_background/test_job_tracker.py +89 -0
  101. ormah-0.1.0/tests/test_background/test_llm_adapters.py +106 -0
  102. ormah-0.1.0/tests/test_background/test_llm_normalize.py +62 -0
  103. ormah-0.1.0/tests/test_background/test_session_watcher.py +250 -0
  104. ormah-0.1.0/tests/test_config.py +169 -0
  105. ormah-0.1.0/tests/test_embeddings/__init__.py +0 -0
  106. ormah-0.1.0/tests/test_embeddings/test_adapters.py +230 -0
  107. ormah-0.1.0/tests/test_embeddings/test_reranker.py +595 -0
  108. ormah-0.1.0/tests/test_engine/__init__.py +0 -0
  109. ormah-0.1.0/tests/test_engine/test_adaptive_context.py +577 -0
  110. ormah-0.1.0/tests/test_engine/test_audit_log.py +138 -0
  111. ormah-0.1.0/tests/test_engine/test_feedback.py +77 -0
  112. ormah-0.1.0/tests/test_engine/test_hybrid_search.py +1219 -0
  113. ormah-0.1.0/tests/test_engine/test_ingest.py +176 -0
  114. ormah-0.1.0/tests/test_engine/test_memory_engine.py +168 -0
  115. ormah-0.1.0/tests/test_engine/test_merge_undo.py +301 -0
  116. ormah-0.1.0/tests/test_engine/test_prompt_classifier.py +518 -0
  117. ormah-0.1.0/tests/test_engine/test_scoring_signals.py +498 -0
  118. ormah-0.1.0/tests/test_engine/test_self_node.py +203 -0
  119. ormah-0.1.0/tests/test_engine/test_spreading_activation.py +215 -0
  120. ormah-0.1.0/tests/test_engine/test_temporal_search.py +160 -0
  121. ormah-0.1.0/tests/test_engine/test_tier_manager.py +45 -0
  122. ormah-0.1.0/tests/test_engine/test_whisper_context.py +1522 -0
  123. ormah-0.1.0/tests/test_index/__init__.py +0 -0
  124. ormah-0.1.0/tests/test_index/test_builder.py +54 -0
  125. ormah-0.1.0/tests/test_index/test_graph.py +100 -0
  126. ormah-0.1.0/tests/test_logging.py +93 -0
  127. ormah-0.1.0/tests/test_setup.py +571 -0
  128. ormah-0.1.0/tests/test_store/__init__.py +0 -0
  129. ormah-0.1.0/tests/test_store/test_file_cache.py +83 -0
  130. ormah-0.1.0/tests/test_store/test_file_store.py +132 -0
  131. ormah-0.1.0/tests/test_store/test_markdown.py +52 -0
  132. ormah-0.1.0/tests/test_store/test_markdown_enriched.py +109 -0
  133. ormah-0.1.0/tests/test_transcript/__init__.py +0 -0
  134. ormah-0.1.0/tests/test_transcript/test_parser.py +217 -0
  135. ormah-0.1.0/tests/test_whisper/__init__.py +0 -0
  136. ormah-0.1.0/tests/test_whisper/test_whisper_out.py +459 -0
  137. ormah-0.1.0/ui/index.html +12 -0
  138. ormah-0.1.0/ui/package-lock.json +1960 -0
  139. ormah-0.1.0/ui/package.json +26 -0
  140. ormah-0.1.0/ui/src/App.tsx +215 -0
  141. ormah-0.1.0/ui/src/api.ts +86 -0
  142. ormah-0.1.0/ui/src/components/AdminPanel.tsx +176 -0
  143. ormah-0.1.0/ui/src/components/FilterDrawer.tsx +127 -0
  144. ormah-0.1.0/ui/src/components/GraphView.tsx +614 -0
  145. ormah-0.1.0/ui/src/components/InsightsPanel.tsx +159 -0
  146. ormah-0.1.0/ui/src/components/NodeDetail.tsx +108 -0
  147. ormah-0.1.0/ui/src/components/ReviewQueue.tsx +150 -0
  148. ormah-0.1.0/ui/src/components/SearchResults.tsx +35 -0
  149. ormah-0.1.0/ui/src/components/Toast.tsx +23 -0
  150. ormah-0.1.0/ui/src/components/TopBar.tsx +191 -0
  151. ormah-0.1.0/ui/src/env.d.ts +3 -0
  152. ormah-0.1.0/ui/src/hooks/useKeyboardShortcuts.ts +69 -0
  153. ormah-0.1.0/ui/src/main.tsx +10 -0
  154. ormah-0.1.0/ui/src/styles.css +1031 -0
  155. ormah-0.1.0/ui/src/types.ts +123 -0
  156. ormah-0.1.0/ui/tsconfig.json +21 -0
  157. ormah-0.1.0/ui/vite.config.ts +18 -0
@@ -0,0 +1,93 @@
1
+ # Ormah Configuration
2
+
3
+ # Server
4
+ ORMAH_HOST=0.0.0.0
5
+ ORMAH_PORT=8787
6
+
7
+ # Logging: "text" (human-readable, default) or "json" (structured, one JSON object per line)
8
+ # ORMAH_LOG_FORMAT=text
9
+
10
+ # Memory store path (relative to project root or absolute)
11
+ ORMAH_MEMORY_DIR=memory
12
+
13
+ # Embeddings model
14
+ ORMAH_EMBEDDING_MODEL=all-MiniLM-L6-v2
15
+
16
+ # ── LLM Provider ─────────────────────────────────────────────────────────────
17
+ #
18
+ # Controls which LLM backend the background jobs (auto-linker, conflict
19
+ # detector, duplicate merger, log ingester) use.
20
+ #
21
+ # Options:
22
+ # "ollama" — local Ollama instance (default, no API key needed)
23
+ # "litellm" — any model via LiteLLM (requires `pip install 'ormah[litellm]'`)
24
+ # "none" — disable all LLM-powered background jobs
25
+ #
26
+ ORMAH_LLM_PROVIDER=ollama
27
+
28
+ # ── LLM Model ────────────────────────────────────────────────────────────────
29
+ #
30
+ # The model identifier passed to the provider.
31
+ #
32
+ # Ollama examples: llama3.2, mistral, gemma2
33
+ # LiteLLM examples: claude-sonnet-4-20250514, gpt-4o-mini, ollama/llama3.2
34
+ #
35
+ # LiteLLM model strings follow the format documented at:
36
+ # https://docs.litellm.ai/docs/providers
37
+ #
38
+ ORMAH_LLM_MODEL=llama3.2
39
+
40
+ # ── Ollama settings (only when ORMAH_LLM_PROVIDER=ollama) ────────────────────
41
+ ORMAH_LLM_BASE_URL=http://localhost:11434
42
+
43
+ # ── LLM timeout (applies to all providers) ───────────────────────────────────
44
+ # Maximum seconds to wait for an LLM response before giving up.
45
+ # ORMAH_LLM_TIMEOUT_SECONDS=60
46
+
47
+ # ── API Keys (only when ORMAH_LLM_PROVIDER=litellm) ──────────────────────────
48
+ #
49
+ # LiteLLM reads standard provider environment variables. Set the one(s)
50
+ # that match your chosen model:
51
+ #
52
+ # Anthropic (claude-* models):
53
+ # ANTHROPIC_API_KEY=sk-ant-...
54
+ #
55
+ # OpenAI (gpt-* models):
56
+ # OPENAI_API_KEY=sk-...
57
+ #
58
+ # Google (gemini-* models):
59
+ # GEMINI_API_KEY=...
60
+ #
61
+ # Azure OpenAI:
62
+ # AZURE_API_KEY=...
63
+ # AZURE_API_BASE=https://your-resource.openai.azure.com
64
+ # AZURE_API_VERSION=2024-02-01
65
+ #
66
+ # AWS Bedrock (bedrock/claude-* models):
67
+ # AWS_ACCESS_KEY_ID=...
68
+ # AWS_SECRET_ACCESS_KEY=...
69
+ # AWS_REGION_NAME=us-east-1
70
+ #
71
+ # See https://docs.litellm.ai/docs/providers for the full list.
72
+ # ──────────────────────────────────────────────────────────────────────────────
73
+
74
+ # Background processing
75
+ ORMAH_AUTO_LINK_INTERVAL_MINUTES=5
76
+ ORMAH_DECAY_INTERVAL_HOURS=24
77
+ ORMAH_CONFLICT_CHECK_INTERVAL_MINUTES=60
78
+ ORMAH_DUPLICATE_CHECK_INTERVAL_MINUTES=60
79
+ ORMAH_AUTO_CLUSTER_INTERVAL_MINUTES=60
80
+ ORMAH_LOG_INGEST_INTERVAL_MINUTES=10
81
+
82
+ # Tier limits
83
+ ORMAH_CORE_MEMORY_CAP=50
84
+ ORMAH_WORKING_DECAY_DAYS=14
85
+
86
+ # Importance scoring
87
+ # ORMAH_IMPORTANCE_RECOMPUTE_INTERVAL_MINUTES=120
88
+
89
+ # Adaptive context
90
+ # ORMAH_CONTEXT_MAX_NODES=20
91
+
92
+ # Memory consolidation (requires LLM)
93
+ # ORMAH_CONSOLIDATION_INTERVAL_MINUTES=360
ormah-0.1.0/.gitignore ADDED
@@ -0,0 +1,63 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+ *.swp
19
+ *.swo
20
+
21
+ # Environment
22
+ .env
23
+
24
+ # SQLite index (rebuildable from markdown files)
25
+ memory/index.db
26
+ memory/index.db-wal
27
+ memory/index.db-shm
28
+
29
+ # Memory node data (user data, not source code)
30
+ memory/nodes/*.md
31
+ memory/logs/*.txt
32
+ memory/logs/.processed
33
+
34
+ # OS
35
+ .DS_Store
36
+ Thumbs.db
37
+
38
+ # Node
39
+ ui/node_modules/
40
+ src/ormah/ui_dist/
41
+
42
+ # uv
43
+ uv.lock
44
+
45
+ # Claude Code
46
+ .claude/
47
+
48
+ # Ormah runtime database
49
+ ormah.db
50
+
51
+ # Deleted memories
52
+ memory/deleted/
53
+
54
+ # Eval scripts and snapshots (local dev only)
55
+ scripts/eval_*.py
56
+ scripts/eval_snapshots/
57
+
58
+ # Generated docs and plans (local dev artifacts)
59
+ ARCHITECTURE.md
60
+ GRAPH_IMPROVEMENTS.md
61
+ REVIEW_FINDINGS.md
62
+ docs/plans/
63
+ .mcp.json
ormah-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,124 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Development Commands
6
+
7
+ ```bash
8
+ make install # Install Python package (dev mode) + UI deps
9
+ make dev # Start backend + UI together
10
+ make server # Start backend only (auto-reloads)
11
+ make ui-dev # Start Vite dev server (hot-reload)
12
+ make restart # Rebuild UI and restart backend
13
+ make test # Run pytest suite
14
+ make lint # Run ruff linter (src/, tests/)
15
+ ```
16
+
17
+ Run a single test: `uv run pytest tests/path/to/test.py::test_name -v`
18
+
19
+ The CLI is also the primary interface:
20
+ ```bash
21
+ ormah server start [-d] # Start server (foreground or daemon)
22
+ ormah setup # One-shot setup (hooks, MCP, server)
23
+ ormah mcp # Run MCP stdio server
24
+ ```
25
+
26
+ ## Architecture
27
+
28
+ Ormah is a local-first persistent memory system for AI agents. It exposes memory operations via MCP (for Claude), REST API, and CLI.
29
+
30
+ ### Core Concepts
31
+
32
+ **Nodes** are memories with: content, type (fact/decision/preference/event/etc.), tier (core/working/archival), space (project namespace), confidence (0–1), importance (0–1), and FSRS stability for spaced repetition decay.
33
+
34
+ **Edges** are typed relationships between nodes (supports, contradicts, part_of, evolved_from, etc.) with a weight and optional reason.
35
+
36
+ **Space** scopes memories to a project — auto-detected from the git repo name.
37
+
38
+ ### Layer Stack
39
+
40
+ ```
41
+ Adapters (MCP, CLI, OpenAI)
42
+
43
+ API (FastAPI routes: /agent, /admin, /ui, /ingest)
44
+
45
+ MemoryEngine ← Background Jobs (auto-linker, conflict detector, decay, etc.)
46
+
47
+ Embeddings layer (hybrid FTS5 + vector via sqlite-vec, fused with RRF)
48
+
49
+ Index layer (SQLite: nodes, edges, proposals, audit_log)
50
+
51
+ Store layer (markdown files in memory/nodes/*.md as backup)
52
+ ```
53
+
54
+ ### Key Implementation Details
55
+
56
+ - **Hybrid search**: FTS5 full-text + vector similarity fused via Reciprocal Rank Fusion (RRF). Weights configurable via `ORMAH_FTS_WEIGHT` / `ORMAH_VECTOR_WEIGHT`.
57
+ - **Embeddings**: Default provider is `local` with `BAAI/bge-base-en-v1.5` (768-dim, no task prefixes needed). Also supports ollama and litellm.
58
+ - **Background jobs** (APScheduler): auto-linker, conflict detector, duplicate merger, importance scorer, decay manager, consolidator, hippocampus (file watcher), session watcher.
59
+ - **Tier decay**: working-tier memories decay after ~14 days using FSRS spaced repetition; `core` is capped at 50.
60
+ - **MCP tools exposed**: `remember`, `recall`, `get_context`, `get_self`, `mark_outdated`, `ingest_conversation`, `get_insights`.
61
+
62
+ ### Frontend
63
+
64
+ React + TypeScript (Vite). Key views: search results, node detail, graph visualization (Cytoscape.js with fcose layout), review queue, insights panel, admin panel. API client in `ui/src/api.ts`.
65
+
66
+ ### Configuration
67
+
68
+ Via `.env` (see `.env.example`). Key vars:
69
+ - `ORMAH_PORT` (default 8787), `ORMAH_MEMORY_DIR`
70
+ - `ORMAH_EMBEDDING_MODEL`, `ORMAH_EMBEDDING_PROVIDER`
71
+ - `ORMAH_LLM_PROVIDER`, `ORMAH_LLM_MODEL` (for background jobs)
72
+
73
+ ---
74
+
75
+ ## Ormah Memory System
76
+
77
+ You have access to a persistent memory system (via MCP tools) that maintains knowledge across conversations.
78
+
79
+ ### Tools
80
+
81
+ - **remember**: Store new facts, decisions, preferences, events, or any knowledge worth retaining. Set `confidence` (0.0–1.0) to indicate belief strength when storing uncertain information. Set `about_self` to true for identity/preference memories.
82
+ - **recall**: Search for relevant memories using natural language. Results are ranked by importance and confidence; expired memories are demoted.
83
+ - **get_context**: Load core memories (call at conversation start). Pass `task_hint` to filter context to only the most relevant memories for the current task instead of loading everything.
84
+ - **get_self**: Get the user's identity profile — name, preferences, and personal facts. Returns all identity-linked memories.
85
+ - **mark_outdated**: Mark a memory as no longer valid. Optionally provide a `reason`. Outdated memories are heavily demoted in search results.
86
+ - **ingest_conversation**: Bulk-import memories from raw conversation text. The server extracts memorable information via its LLM. Use this for importing logs or transcripts. For individual memories you've already identified, use `remember` directly.
87
+ - **get_insights**: Show belief evolutions and conflicting ideas detected by the system. Evolutions are cases where the user's view changed over time; conflicting ideas are genuinely incompatible beliefs held simultaneously.
88
+
89
+ ### Project Awareness
90
+
91
+ Memories are automatically scoped to the current project directory. The MCP server detects the project from the git repo name (or directory name as fallback) and uses it as the default `space` for all operations:
92
+
93
+ - **`remember`**: Memories automatically get `space` set to the current project. Explicitly set `space` to `null` for personal/global memories (identity, preferences, cross-project facts).
94
+ - **`recall`**: Results are prioritized — current project first, then global (`space=null`), then other projects.
95
+ - **`get_context`**: Returns core memories (all projects) + working-tier memories for the current project. With `task_hint`, returns only the top-N most relevant memories.
96
+ - **Cross-project recall**: Memories from other projects are included in `recall` results (with lower priority), enabling cross-project knowledge.
97
+
98
+ ### Guidelines
99
+
100
+ 1. **Proactively remember**: When the user shares important information (preferences, decisions, facts about themselves or their projects), store it *without being asked*. Names, preferences, project context, technical decisions — all worth remembering.
101
+ 2. **Remember at natural save points**: Call `remember` immediately after these events — don't wait for the conversation to end:
102
+ - **After committing code**: Architectural decisions, design patterns chosen, and the reasoning behind them.
103
+ - **After choosing between alternatives**: Why option A was picked over B (e.g., "chose bge-base-en-v1.5 over nomic-embed because it needs no task prefixes").
104
+ - **After completing a feature or fix**: What was built, how it works, and key implementation details a future session would need.
105
+ - **After the user states a preference or corrects you**: Their preferred approach, style, or constraints.
106
+ Each memory should be self-contained — someone reading it later should understand it without the original conversation.
107
+ 3. **Notice what stands out**: Humans form strong memories around novelty, mistakes, and emotion. Use the same instincts:
108
+ - **Something unexpected happened** (a bug had a surprising cause, a library behaved differently than docs say) → remember the lesson.
109
+ - **The user corrected you or said "no"** → remember what they wanted instead and why.
110
+ - **You tried something and it failed** → remember what didn't work so you don't repeat it.
111
+ - **The user repeated themselves or said "I already told you"** → something was missed. Store it at `core` tier so it's never missed again.
112
+ - **A pattern is emerging** (user keeps preferring X over Y, the codebase follows a convention) → remember the pattern.
113
+ 4. **Check before assuming**: Use `recall` to search for relevant context before making assumptions about past conversations. For personal info (name, location, preferences), prefer `get_self` — it returns all identity-linked memories directly.
114
+ 5. **Memory supports the flow, not the other way around**: Don't let recalled memories override or derail the current working context. If you're mid-task and `recall` returns something from a different context, let it go — stay in the flow. Use `recall` when you're genuinely unsure or the user asks about something from a prior session. Memory should feel like a natural extension of your knowledge, not an interruption. A whisper, not a shout.
115
+ 6. **Keep memories atomic**: One concept per memory. The system automatically links related memories.
116
+ 7. **Use appropriate tiers**: `core` for always-relevant info (user identity, preferences, key architectural decisions), `working` for active project details, `archival` for historical/reference data.
117
+ 8. **Tag and categorize**: Use tags and spaces to organize memories for efficient retrieval.
118
+ 9. **Start with context**: Call `get_context` at the beginning of conversations to load core memories. Use `task_hint` when the task is known to get focused context.
119
+ 10. **Global vs project memories**: Use `space=null` explicitly for memories that apply everywhere (user identity, general preferences). Let project-specific memories use the auto-detected space.
120
+ 11. **Mark outdated info**: When a memory is wrong or outdated, call `mark_outdated` with a reason so it gets demoted in future searches.
121
+ 12. **Set confidence**: When storing information you're not fully certain about, set `confidence` below 1.0. This affects how prominently the memory appears in search results.
122
+
123
+
124
+ Strict Rule: When fixing issues always make sure you are fixing the root cause and not patching or papering over issues.
ormah-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Rishikesh Chirammel Ajit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ormah-0.1.0/Makefile ADDED
@@ -0,0 +1,46 @@
1
+ .PHONY: help dev server ui-dev ui-build install test restart clean logs
2
+
3
+ help: ## Show this help
4
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
5
+
6
+ install: ## Install Python package in dev mode + UI deps
7
+ pip install -e ".[dev]"
8
+ cd ui && npm install
9
+
10
+ server: ## Start the backend server (auto-reloads on Python changes)
11
+ python -m ormah.main
12
+
13
+ ui-dev: ## Start the Vite dev server (hot-reload for UI work)
14
+ cd ui && npm run dev
15
+
16
+ ui-build: ## Build the UI into ui/dist/ for production
17
+ cd ui && npx vite build
18
+
19
+ dev: ## Start backend + UI dev server together (requires ctrl-c to stop both)
20
+ @trap 'kill 0' EXIT; \
21
+ python -m ormah.main & \
22
+ cd ui && npm run dev
23
+
24
+ restart: ## Rebuild UI and restart backend (kills existing ormah.main process)
25
+ @echo "==> Building UI..."
26
+ cd ui && npx vite build
27
+ @echo "==> Stopping existing server..."
28
+ -pkill -f "ormah.main" 2>/dev/null || true
29
+ @sleep 1
30
+ @echo "==> Starting server..."
31
+ python -m ormah.main &
32
+ @echo "==> Server restarted. Open http://localhost:8787"
33
+
34
+ test: ## Run the test suite
35
+ python -m pytest tests/ -v
36
+
37
+ lint: ## Run ruff linter
38
+ ruff check src/ tests/
39
+
40
+ clean: ## Remove build artifacts
41
+ rm -rf src/ormah/ui_dist ui/node_modules/.vite
42
+ find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
43
+ rm -rf .pytest_cache
44
+
45
+ logs: ## Tail the server logs (if running in background)
46
+ @echo "Server runs with stdout logging. Use 'make server' in foreground to see logs."