memdream 0.1.1__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.
- memdream-0.1.1/.env.example +193 -0
- memdream-0.1.1/.gitignore +222 -0
- memdream-0.1.1/CHANGELOG.md +86 -0
- memdream-0.1.1/CODE_OF_CONDUCT.md +26 -0
- memdream-0.1.1/CONTRIBUTING.md +231 -0
- memdream-0.1.1/Dockerfile +49 -0
- memdream-0.1.1/LICENSE +201 -0
- memdream-0.1.1/PKG-INFO +562 -0
- memdream-0.1.1/README.md +493 -0
- memdream-0.1.1/SECURITY.md +62 -0
- memdream-0.1.1/assets/README.md +23 -0
- memdream-0.1.1/assets/banner.png +0 -0
- memdream-0.1.1/assets/how-it-works.png +0 -0
- memdream-0.1.1/config/dream.yaml +135 -0
- memdream-0.1.1/console.html +1521 -0
- memdream-0.1.1/docker-compose.yml +77 -0
- memdream-0.1.1/docs/api.md +1516 -0
- memdream-0.1.1/docs/architecture.md +515 -0
- memdream-0.1.1/docs/concepts.md +400 -0
- memdream-0.1.1/docs/diagrams.md +252 -0
- memdream-0.1.1/docs/how-it-works.md +633 -0
- memdream-0.1.1/docs/prompts.md +309 -0
- memdream-0.1.1/docs/sdk.md +990 -0
- memdream-0.1.1/docs/self-hosting.md +419 -0
- memdream-0.1.1/eval/__init__.py +1 -0
- memdream-0.1.1/eval/dataset/add.jsonl +52 -0
- memdream-0.1.1/eval/dataset/merge.jsonl +52 -0
- memdream-0.1.1/eval/dataset/noop.jsonl +53 -0
- memdream-0.1.1/eval/dataset/supersede.jsonl +53 -0
- memdream-0.1.1/eval/dataset/synthesis.jsonl +54 -0
- memdream-0.1.1/eval/run.py +545 -0
- memdream-0.1.1/examples/README.md +142 -0
- memdream-0.1.1/examples/custom_agent.py +223 -0
- memdream-0.1.1/examples/embedded.py +81 -0
- memdream-0.1.1/examples/quickstart.py +230 -0
- memdream-0.1.1/examples/semantic_kernel_agent.py +296 -0
- memdream-0.1.1/memdream/__init__.py +70 -0
- memdream-0.1.1/memdream/__main__.py +109 -0
- memdream-0.1.1/memdream/client.py +861 -0
- memdream-0.1.1/memdream/embedded.py +977 -0
- memdream-0.1.1/memdream/engine/__init__.py +7 -0
- memdream-0.1.1/memdream/engine/api/__init__.py +0 -0
- memdream-0.1.1/memdream/engine/api/deps.py +138 -0
- memdream-0.1.1/memdream/engine/api/routes_dream.py +165 -0
- memdream-0.1.1/memdream/engine/api/routes_health.py +94 -0
- memdream-0.1.1/memdream/engine/api/routes_memory.py +348 -0
- memdream-0.1.1/memdream/engine/api/routes_search.py +73 -0
- memdream-0.1.1/memdream/engine/container.py +319 -0
- memdream-0.1.1/memdream/engine/core/__init__.py +0 -0
- memdream-0.1.1/memdream/engine/core/auth.py +195 -0
- memdream-0.1.1/memdream/engine/core/config.py +798 -0
- memdream-0.1.1/memdream/engine/core/exceptions.py +83 -0
- memdream-0.1.1/memdream/engine/core/identity.py +157 -0
- memdream-0.1.1/memdream/engine/core/logging.py +151 -0
- memdream-0.1.1/memdream/engine/core/metrics.py +328 -0
- memdream-0.1.1/memdream/engine/core/policy.py +114 -0
- memdream-0.1.1/memdream/engine/core/prompts.py +197 -0
- memdream-0.1.1/memdream/engine/core/shorthand.py +189 -0
- memdream-0.1.1/memdream/engine/dream/__init__.py +6 -0
- memdream-0.1.1/memdream/engine/dream/candidate_selector.py +147 -0
- memdream-0.1.1/memdream/engine/dream/clustering.py +120 -0
- memdream-0.1.1/memdream/engine/dream/compaction.py +259 -0
- memdream-0.1.1/memdream/engine/dream/consolidation.py +377 -0
- memdream-0.1.1/memdream/engine/dream/engine.py +671 -0
- memdream-0.1.1/memdream/engine/dream/merge.py +175 -0
- memdream-0.1.1/memdream/engine/dream/prompts.py +145 -0
- memdream-0.1.1/memdream/engine/dream/scheduler.py +155 -0
- memdream-0.1.1/memdream/engine/dream/service.py +236 -0
- memdream-0.1.1/memdream/engine/dream/supersede.py +150 -0
- memdream-0.1.1/memdream/engine/dream/synthesis.py +561 -0
- memdream-0.1.1/memdream/engine/dream/validation.py +146 -0
- memdream-0.1.1/memdream/engine/main.py +218 -0
- memdream-0.1.1/memdream/engine/memory/__init__.py +1 -0
- memdream-0.1.1/memdream/engine/memory/extractor.py +144 -0
- memdream-0.1.1/memdream/engine/memory/lifecycle.py +349 -0
- memdream-0.1.1/memdream/engine/memory/ranker.py +126 -0
- memdream-0.1.1/memdream/engine/memory/retriever.py +320 -0
- memdream-0.1.1/memdream/engine/memory/service.py +563 -0
- memdream-0.1.1/memdream/engine/memory/triage.py +115 -0
- memdream-0.1.1/memdream/engine/models/__init__.py +31 -0
- memdream-0.1.1/memdream/engine/models/dream.py +444 -0
- memdream-0.1.1/memdream/engine/models/enums.py +141 -0
- memdream-0.1.1/memdream/engine/models/memory.py +347 -0
- memdream-0.1.1/memdream/engine/models/requests.py +366 -0
- memdream-0.1.1/memdream/engine/models/scope.py +190 -0
- memdream-0.1.1/memdream/engine/providers/__init__.py +6 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/__init__.py +4 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/_openai_style.py +174 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/azure_openai.py +66 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/base.py +77 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/factory.py +33 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/fake.py +119 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/gemini.py +154 -0
- memdream-0.1.1/memdream/engine/providers/embeddings/openai_compatible.py +140 -0
- memdream-0.1.1/memdream/engine/providers/llm/__init__.py +4 -0
- memdream-0.1.1/memdream/engine/providers/llm/_openai_style.py +264 -0
- memdream-0.1.1/memdream/engine/providers/llm/anthropic.py +244 -0
- memdream-0.1.1/memdream/engine/providers/llm/azure_openai.py +63 -0
- memdream-0.1.1/memdream/engine/providers/llm/base.py +203 -0
- memdream-0.1.1/memdream/engine/providers/llm/factory.py +40 -0
- memdream-0.1.1/memdream/engine/providers/llm/fake.py +674 -0
- memdream-0.1.1/memdream/engine/providers/llm/gemini.py +222 -0
- memdream-0.1.1/memdream/engine/providers/llm/openai_compatible.py +155 -0
- memdream-0.1.1/memdream/engine/providers/queue/__init__.py +4 -0
- memdream-0.1.1/memdream/engine/providers/queue/base.py +37 -0
- memdream-0.1.1/memdream/engine/providers/queue/database_queue.py +114 -0
- memdream-0.1.1/memdream/engine/providers/queue/factory.py +36 -0
- memdream-0.1.1/memdream/engine/providers/queue/inline_queue.py +266 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/__init__.py +4 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/_scope_keys.py +92 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/azure_search_store.py +271 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/base.py +93 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/chroma_store.py +204 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/factory.py +104 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/faiss_store.py +447 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/memory_store.py +107 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/milvus_store.py +223 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/pgvector_store.py +243 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/pinecone_store.py +210 -0
- memdream-0.1.1/memdream/engine/providers/vector_store/qdrant_store.py +245 -0
- memdream-0.1.1/memdream/engine/repositories/__init__.py +23 -0
- memdream-0.1.1/memdream/engine/repositories/base.py +471 -0
- memdream-0.1.1/memdream/engine/repositories/factory.py +106 -0
- memdream-0.1.1/memdream/engine/repositories/mongo/__init__.py +36 -0
- memdream-0.1.1/memdream/engine/repositories/mongo/audit.py +140 -0
- memdream-0.1.1/memdream/engine/repositories/mongo/database.py +263 -0
- memdream-0.1.1/memdream/engine/repositories/mongo/jobs.py +177 -0
- memdream-0.1.1/memdream/engine/repositories/mongo/memories.py +632 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/__init__.py +37 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/_sql.py +116 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/audit.py +160 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/database.py +324 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/jobs.py +185 -0
- memdream-0.1.1/memdream/engine/repositories/postgres/memories.py +734 -0
- memdream-0.1.1/memdream/engine/workers/__init__.py +0 -0
- memdream-0.1.1/memdream/engine/workers/synthesis_worker.py +199 -0
- memdream-0.1.1/memdream/exceptions.py +81 -0
- memdream-0.1.1/memdream/models.py +293 -0
- memdream-0.1.1/prompts/README.md +41 -0
- memdream-0.1.1/prompts/compaction.md +11 -0
- memdream-0.1.1/prompts/decision.md +23 -0
- memdream-0.1.1/prompts/extraction.md +19 -0
- memdream-0.1.1/prompts/merge.md +17 -0
- memdream-0.1.1/prompts/supersede.md +13 -0
- memdream-0.1.1/prompts/synthesis.md +25 -0
- memdream-0.1.1/pyproject.toml +119 -0
- memdream-0.1.1/requirements-dev.txt +22 -0
- memdream-0.1.1/requirements.txt +55 -0
- memdream-0.1.1/scripts/calibrate.py +154 -0
- memdream-0.1.1/scripts/consolidate.py +134 -0
- memdream-0.1.1/scripts/migrate_scope_key.py +227 -0
- memdream-0.1.1/scripts/rebuild_index.py +153 -0
- memdream-0.1.1/scripts/seed_demo.py +189 -0
- memdream-0.1.1/tests/conftest.py +220 -0
- memdream-0.1.1/tests/test_acceptance.py +296 -0
- memdream-0.1.1/tests/test_api.py +336 -0
- memdream-0.1.1/tests/test_auth_binding.py +251 -0
- memdream-0.1.1/tests/test_compaction.py +322 -0
- memdream-0.1.1/tests/test_config.py +246 -0
- memdream-0.1.1/tests/test_consolidate_endpoint.py +318 -0
- memdream-0.1.1/tests/test_consolidation.py +312 -0
- memdream-0.1.1/tests/test_decay_and_schedule.py +342 -0
- memdream-0.1.1/tests/test_embedded_queue.py +341 -0
- memdream-0.1.1/tests/test_embedded_sdk.py +388 -0
- memdream-0.1.1/tests/test_flexible_scope.py +281 -0
- memdream-0.1.1/tests/test_gemini_anthropic.py +359 -0
- memdream-0.1.1/tests/test_isolation_and_retrieval.py +368 -0
- memdream-0.1.1/tests/test_library_mode.py +200 -0
- memdream-0.1.1/tests/test_llm_provider.py +216 -0
- memdream-0.1.1/tests/test_manual_management.py +367 -0
- memdream-0.1.1/tests/test_merge.py +259 -0
- memdream-0.1.1/tests/test_openai_compatible.py +182 -0
- memdream-0.1.1/tests/test_prompt_budget.py +266 -0
- memdream-0.1.1/tests/test_prompts.py +381 -0
- memdream-0.1.1/tests/test_queue_and_trigger.py +311 -0
- memdream-0.1.1/tests/test_requirements.py +98 -0
- memdream-0.1.1/tests/test_schema_migration.py +249 -0
- memdream-0.1.1/tests/test_sdk.py +239 -0
- memdream-0.1.1/tests/test_sdk_parity.py +428 -0
- memdream-0.1.1/tests/test_supersede.py +414 -0
- memdream-0.1.1/tests/test_synthesis.py +345 -0
- memdream-0.1.1/tests/test_token_accounting.py +303 -0
- memdream-0.1.1/tests/test_triage.py +175 -0
- memdream-0.1.1/tests/test_vector_store_conformance.py +392 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# ---------------------------------------------------------------------------
|
|
2
|
+
# Dream Memory — example environment file.
|
|
3
|
+
# Copy to `.env` and fill in. NEVER commit a real `.env`.
|
|
4
|
+
# ---------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
# --- Service -----------------------------------------------------------------
|
|
7
|
+
DREAM_ENV=local
|
|
8
|
+
DREAM_LOG_LEVEL=INFO
|
|
9
|
+
DREAM_LOG_JSON=true
|
|
10
|
+
# Optional YAML file that overlays the tuning sections (see config/dream.yaml).
|
|
11
|
+
DREAM_CONFIG_FILE=config/dream.yaml
|
|
12
|
+
# Comma separated API keys accepted on the X-API-Key header. Empty = auth disabled.
|
|
13
|
+
DREAM_API_KEYS=
|
|
14
|
+
|
|
15
|
+
# --- MongoDB (canonical source of truth) -------------------------------------
|
|
16
|
+
DREAM_MONGODB_URI=mongodb://localhost:27017
|
|
17
|
+
DREAM_MONGODB_DATABASE=memdream
|
|
18
|
+
|
|
19
|
+
# --- Queue -------------------------------------------------------------------
|
|
20
|
+
# inline | database
|
|
21
|
+
#
|
|
22
|
+
# Where *background synthesis* runs. Nothing on the user's path goes through
|
|
23
|
+
# here - remember, recall, supersede and merge are synchronous in the API.
|
|
24
|
+
#
|
|
25
|
+
# `inline` is the default: synthesis runs in a bounded pool of tasks inside the
|
|
26
|
+
# API. One process, no broker, nothing else to deploy.
|
|
27
|
+
#
|
|
28
|
+
# `database` moves it to a separate worker claiming rows from the jobs table -
|
|
29
|
+
# still no broker. Use it only for several API replicas sharing one queue.
|
|
30
|
+
DREAM_QUEUE_PROVIDER=inline
|
|
31
|
+
|
|
32
|
+
# How many synthesis jobs this process runs at once, and how many may wait.
|
|
33
|
+
DREAM_DREAM__SYNTHESIS__MAX_CONCURRENT=2
|
|
34
|
+
DREAM_DREAM__SYNTHESIS__MAX_QUEUED=100
|
|
35
|
+
|
|
36
|
+
# --- Consolidation -----------------------------------------------------------
|
|
37
|
+
# Record which memories each search returned, so consolidation can later tell
|
|
38
|
+
# what is still earning its place from what nothing has needed in months.
|
|
39
|
+
# Collects only - nothing reads it yet, and decay thresholds set against a week
|
|
40
|
+
# of data would be guesses.
|
|
41
|
+
DREAM_TRACK_RECALL=true
|
|
42
|
+
|
|
43
|
+
# Retire memories whose validity window has closed. "Retire" means a status
|
|
44
|
+
# change to `expired`: the row is kept and leaves the search index, so being
|
|
45
|
+
# wrong costs a flip rather than a row. Runs before each synthesis pass, needs
|
|
46
|
+
# no model and no embedding.
|
|
47
|
+
DREAM_DREAM__CONSOLIDATION__ENABLED=true
|
|
48
|
+
DREAM_DREAM__CONSOLIDATION__MAX_PER_RUN=500
|
|
49
|
+
|
|
50
|
+
# The nightly clock. An asyncio task inside the API process - not a cron
|
|
51
|
+
# container - that walks every partition once a day and consolidates each one.
|
|
52
|
+
# A user who stops talking never triggers synthesis, and that is exactly the
|
|
53
|
+
# account accumulating memories that have quietly stopped being true.
|
|
54
|
+
DREAM_DREAM__CONSOLIDATION__SCHEDULE_ENABLED=true
|
|
55
|
+
DREAM_DREAM__CONSOLIDATION__SCHEDULE_HOUR_UTC=0
|
|
56
|
+
|
|
57
|
+
# --- Recall decay (OFF - turn on only after measuring) -----------------------
|
|
58
|
+
# Retiring a memory because nothing has recalled it is a judgement, not a fact.
|
|
59
|
+
# The evidence is `lastRecalledAt`, which only accumulates from the day recall
|
|
60
|
+
# tracking is switched on - before that every row reads `null`, which is
|
|
61
|
+
# indistinguishable from "nothing ever wanted this".
|
|
62
|
+
#
|
|
63
|
+
# So leave this off, read `consolidation_would_expire` in the logs for a few
|
|
64
|
+
# weeks, and set the thresholds from what you actually see:
|
|
65
|
+
#
|
|
66
|
+
# python -m scripts.consolidate --user <id> --dry-run --decay --decay-after 30
|
|
67
|
+
#
|
|
68
|
+
DREAM_DREAM__CONSOLIDATION__DECAY_ENABLED=false
|
|
69
|
+
DREAM_DREAM__CONSOLIDATION__DECAY_AFTER_DAYS=90
|
|
70
|
+
# Importance at or above this is never decayed, however long it sits untouched.
|
|
71
|
+
DREAM_DREAM__CONSOLIDATION__DECAY_IMPORTANCE_FLOOR=0.5
|
|
72
|
+
# REQUIRED for decay: the date recall tracking began, as an ISO date. Empty
|
|
73
|
+
# disables decay outright whatever DECAY_ENABLED says - the cold-start guard,
|
|
74
|
+
# without which day one would expire the entire database in a single pass.
|
|
75
|
+
DREAM_DREAM__CONSOLIDATION__RECALL_EPOCH=
|
|
76
|
+
|
|
77
|
+
# --- Compaction (OFF - the only part that costs a model call) ----------------
|
|
78
|
+
# Folds crowds of near-identical low-value memories ("User ordered a dosa on a
|
|
79
|
+
# Tuesday", two hundred times) into one that says what they jointly say. Reuses
|
|
80
|
+
# MERGE, so every original stays readable with a `mergedInto` pointer.
|
|
81
|
+
#
|
|
82
|
+
# One model call per cluster, which is why it is gated on a user having enough
|
|
83
|
+
# clutter to be worth it. Nothing at or above the importance floor, nothing
|
|
84
|
+
# permanent, no pattern evidence and nothing recent is ever an input.
|
|
85
|
+
DREAM_DREAM__COMPACTION__ENABLED=false
|
|
86
|
+
DREAM_DREAM__COMPACTION__IMPORTANCE_FLOOR=0.4
|
|
87
|
+
DREAM_DREAM__COMPACTION__MIN_MEMORIES=40
|
|
88
|
+
DREAM_DREAM__COMPACTION__MIN_AGE_DAYS=30
|
|
89
|
+
DREAM_DREAM__COMPACTION__MAX_CLUSTERS_PER_RUN=5
|
|
90
|
+
|
|
91
|
+
# --- Prompts (required) ------------------------------------------------------
|
|
92
|
+
# MemDream ships NO prompts. The engine knows how to extract, decide, supersede,
|
|
93
|
+
# merge and synthesise; what to say to the model depends on your product, so you
|
|
94
|
+
# write it. A deployment without prompts does not start.
|
|
95
|
+
#
|
|
96
|
+
# Get a working set to edit:
|
|
97
|
+
#
|
|
98
|
+
# python -m memdream prompts ./prompts
|
|
99
|
+
#
|
|
100
|
+
# That writes one file per prompt: extraction, decision, supersede, merge,
|
|
101
|
+
# synthesis, compaction. The whole file is the prompt - no front matter, no
|
|
102
|
+
# comment syntax. `{domain}` anywhere in one is replaced with DREAM_DOMAIN below.
|
|
103
|
+
#
|
|
104
|
+
# Which are required depends on configuration: unified decisions need
|
|
105
|
+
# `decision`, staged need `supersede` + `merge`, and synthesis and compaction
|
|
106
|
+
# only when enabled. See docs/prompts.md.
|
|
107
|
+
DREAM_PROMPTS_DIR=./prompts
|
|
108
|
+
|
|
109
|
+
# A single prompt can be overridden inline, which beats the file:
|
|
110
|
+
# DREAM_PROMPTS__EXTRACTION="Extract facts about the user that ..."
|
|
111
|
+
|
|
112
|
+
# --- Domain ------------------------------------------------------------------
|
|
113
|
+
# One sentence describing what this deployment is. Injected into the extraction
|
|
114
|
+
# and decision prompts, costs ~30 tokens per call, and is the cheapest accuracy
|
|
115
|
+
# win available - it tells the model that "no onions" is a standing constraint
|
|
116
|
+
# rather than small talk, which no amount of generic rule-writing conveys.
|
|
117
|
+
#
|
|
118
|
+
# Leave empty for a general-purpose assistant.
|
|
119
|
+
DREAM_DOMAIN="A restaurant ordering assistant. Remember contact and delivery details, dietary needs, dislikes, and usual orders per meal."
|
|
120
|
+
|
|
121
|
+
# --- Vector store ------------------------------------------------------------
|
|
122
|
+
# faiss | memory
|
|
123
|
+
DREAM_VECTOR_PROVIDER=faiss
|
|
124
|
+
DREAM_FAISS_PATH=./data/faiss
|
|
125
|
+
DREAM_FAISS_MAX_LOADED_INDEXES=128
|
|
126
|
+
|
|
127
|
+
# --- Providers ---------------------------------------------------------------
|
|
128
|
+
# LLM and embeddings are chosen independently: Anthropic serves chat but not
|
|
129
|
+
# embeddings, so "Claude for chat, OpenAI for embeddings" is a normal pairing.
|
|
130
|
+
#
|
|
131
|
+
# LLM azure_openai | openai | ollama | together | fireworks
|
|
132
|
+
# | openai_compatible | gemini | anthropic | fake
|
|
133
|
+
# Embedding azure_openai | openai | ollama | openai_compatible | gemini | fake
|
|
134
|
+
DREAM_LLM_PROVIDER=azure_openai
|
|
135
|
+
DREAM_EMBEDDING_PROVIDER=azure_openai
|
|
136
|
+
|
|
137
|
+
# --- OpenAI-compatible endpoints ---------------------------------------------
|
|
138
|
+
# Shared by openai / ollama / together / fireworks. Leave blank to accept
|
|
139
|
+
# the preset for the chosen provider. OPENAI_API_KEY is read too, so an already
|
|
140
|
+
# exported key needs no restating.
|
|
141
|
+
#
|
|
142
|
+
# Fully local, no key, no cost:
|
|
143
|
+
# DREAM_LLM_PROVIDER=ollama
|
|
144
|
+
# DREAM_EMBEDDING_PROVIDER=ollama
|
|
145
|
+
#
|
|
146
|
+
# Claude for chat, OpenAI for embeddings:
|
|
147
|
+
# DREAM_LLM_PROVIDER=anthropic ANTHROPIC_API_KEY=sk-ant-...
|
|
148
|
+
# DREAM_EMBEDDING_PROVIDER=openai OPENAI_API_KEY=sk-...
|
|
149
|
+
DREAM_OPENAI_API_KEY=
|
|
150
|
+
DREAM_OPENAI_BASE_URL=
|
|
151
|
+
DREAM_OPENAI_CHAT_MODEL=
|
|
152
|
+
DREAM_OPENAI_EMBEDDING_MODEL=
|
|
153
|
+
DREAM_OPENAI_EMBEDDING_DIMENSIONS=0
|
|
154
|
+
|
|
155
|
+
# --- Gemini ------------------------------------------------------------------
|
|
156
|
+
# pip install memdream[gemini]
|
|
157
|
+
# Does chat *and* embeddings, so it can be the only provider you configure:
|
|
158
|
+
# DREAM_LLM_PROVIDER=gemini
|
|
159
|
+
# DREAM_EMBEDDING_PROVIDER=gemini
|
|
160
|
+
# GEMINI_API_KEY and GOOGLE_API_KEY are read too, so an exported key needs no
|
|
161
|
+
# restating.
|
|
162
|
+
DREAM_GEMINI_API_KEY=
|
|
163
|
+
DREAM_GEMINI_CHAT_MODEL=gemini-2.0-flash
|
|
164
|
+
DREAM_GEMINI_EMBEDDING_MODEL=gemini-embedding-001
|
|
165
|
+
# Matryoshka width. 768 keeps the per-write similarity search cheap.
|
|
166
|
+
DREAM_GEMINI_EMBEDDING_DIMENSIONS=768
|
|
167
|
+
|
|
168
|
+
# --- Anthropic ---------------------------------------------------------------
|
|
169
|
+
# pip install memdream[anthropic]
|
|
170
|
+
# Chat only — Anthropic has no embeddings API, so pair it with another provider:
|
|
171
|
+
# DREAM_LLM_PROVIDER=anthropic ANTHROPIC_API_KEY=sk-ant-...
|
|
172
|
+
# DREAM_EMBEDDING_PROVIDER=openai OPENAI_API_KEY=sk-...
|
|
173
|
+
DREAM_ANTHROPIC_API_KEY=
|
|
174
|
+
DREAM_ANTHROPIC_MODEL=claude-sonnet-4-5
|
|
175
|
+
|
|
176
|
+
# --- Azure OpenAI ------------------------------------------------------------
|
|
177
|
+
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
|
|
178
|
+
AZURE_OPENAI_API_KEY=
|
|
179
|
+
AZURE_OPENAI_API_VERSION=2024-10-21
|
|
180
|
+
|
|
181
|
+
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4o-mini
|
|
182
|
+
AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-3-small
|
|
183
|
+
AZURE_OPENAI_EMBEDDING_DIMENSIONS=1536
|
|
184
|
+
|
|
185
|
+
# --- Privacy -----------------------------------------------------------------
|
|
186
|
+
# Salt used when hashing phone numbers. Change it and existing hashes stop
|
|
187
|
+
# matching, so treat it as a long-lived secret.
|
|
188
|
+
DREAM_IDENTITY_SALT=change-me-to-a-long-random-string
|
|
189
|
+
|
|
190
|
+
# --- Observability -----------------------------------------------------------
|
|
191
|
+
DREAM_OTEL_ENABLED=false
|
|
192
|
+
OTEL_EXPORTER_OTLP_ENDPOINT=
|
|
193
|
+
OTEL_SERVICE_NAME=dream-memory
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
data/
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to MemDream are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/) — while MemDream is `0.x`, a minor
|
|
6
|
+
version may contain breaking changes, and they are always listed.
|
|
7
|
+
|
|
8
|
+
Install a specific release:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install memdream==0.1.1
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## [Unreleased]
|
|
15
|
+
|
|
16
|
+
## [0.1.1] - 2026-11-23
|
|
17
|
+
|
|
18
|
+
First release on PyPI: `pip install memdream`. No API changes from 0.1.0.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Install instructions and missing-dependency hints now use PyPI
|
|
23
|
+
(`pip install "memdream[qdrant]"`) instead of a GitHub URL.
|
|
24
|
+
- README links are absolute, so they work on the PyPI project page.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- The wheel declared a `memdream-eval` command pointing at the `eval` package,
|
|
29
|
+
which is not shipped; installing created a command that always failed. The
|
|
30
|
+
evaluation harness is run from a checkout: `python -m eval.run`.
|
|
31
|
+
|
|
32
|
+
## [0.1.0] - 2026-11-07
|
|
33
|
+
|
|
34
|
+
First tagged release.
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- **A library first.** `MemDream` / `AsyncMemDream` run the whole engine inside
|
|
39
|
+
your process — no server, no worker. `DreamClient` / `AsyncDreamClient` offer
|
|
40
|
+
the same methods over HTTP for the optional shared service.
|
|
41
|
+
- **Contradiction-aware memory.** Every new fact is decided as ADD, SUPERSEDE,
|
|
42
|
+
MERGE or NOOP against what is already known, using prompts you write.
|
|
43
|
+
Superseded and merged memories are kept as history with pointers to their
|
|
44
|
+
replacements.
|
|
45
|
+
- **Dream, automatically** (`auto_dream=True`): synthesis of pattern memories
|
|
46
|
+
with links to their evidence, and a daily pass that retires memories whose
|
|
47
|
+
validity has ended. Compaction and decay are available, off by default.
|
|
48
|
+
- **Manual control:** `create`, `update`, `forget` (reversible), `delete`
|
|
49
|
+
(permanent), `purge` (everything for one user).
|
|
50
|
+
- **Inspection:** `get`, `list`, `history`, `audit` (every decision, NOOPs
|
|
51
|
+
included), `stats` (counts, tokens, estimated cost).
|
|
52
|
+
- `database="memory"`: an in-process store, to try MemDream with no database.
|
|
53
|
+
- Providers: OpenAI, Azure OpenAI, Anthropic, Gemini, Ollama, Together,
|
|
54
|
+
Fireworks and any OpenAI-compatible endpoint; MongoDB or PostgreSQL; FAISS,
|
|
55
|
+
Qdrant, pgvector, Chroma, Pinecone, Milvus or Azure AI Search.
|
|
56
|
+
- `python -m memdream prompts ./prompts` copies a working starter prompt set.
|
|
57
|
+
- Security policy, code of conduct, issue templates and CI (Python 3.10–3.13,
|
|
58
|
+
integration suites against real MongoDB, pgvector and Qdrant).
|
|
59
|
+
|
|
60
|
+
### Upgrade notes — if you used MemDream from `main` before this release
|
|
61
|
+
|
|
62
|
+
- **The engine moved from `app` to `memdream.engine`.** Installing MemDream no
|
|
63
|
+
longer creates a top-level `app` package. Update direct imports
|
|
64
|
+
(`from app.core.config import Settings` →
|
|
65
|
+
`from memdream.engine.core.config import Settings`) and commands
|
|
66
|
+
(`uvicorn app.main:app` → `uvicorn memdream.engine.main:app`;
|
|
67
|
+
`python -m app.workers.synthesis_worker` →
|
|
68
|
+
`python -m memdream.engine.workers.synthesis_worker`). Code using only
|
|
69
|
+
`from memdream import ...` is unaffected.
|
|
70
|
+
- **Phone-number identity needs a private salt.** Deriving a user id from a phone
|
|
71
|
+
number now fails while `DREAM_IDENTITY_SALT` is unset or a published
|
|
72
|
+
placeholder (including the old built-in default). If you already stored
|
|
73
|
+
memories under ids derived with the default salt, setting a real salt gives
|
|
74
|
+
those users new ids, so their existing memories would need re-keying to stay
|
|
75
|
+
reachable. Callers passing `user_id` are unaffected.
|
|
76
|
+
- **The Groq provider was removed.** Use another OpenAI-compatible provider, or
|
|
77
|
+
`openai_compatible` with Groq's base URL.
|
|
78
|
+
- **`delete()` now redacts the audit log.** Rows referencing a permanently
|
|
79
|
+
deleted memory keep their ids and timestamps but lose `inputContent` and
|
|
80
|
+
`reason`.
|
|
81
|
+
- Library mode now logs warnings only, to stderr; pass `log_level="INFO"` for
|
|
82
|
+
the previous detail.
|
|
83
|
+
|
|
84
|
+
[Unreleased]: https://github.com/Mamlesh18/MemDream/compare/v0.1.1...HEAD
|
|
85
|
+
[0.1.1]: https://github.com/Mamlesh18/MemDream/releases/tag/v0.1.1
|
|
86
|
+
[0.1.0]: https://github.com/Mamlesh18/MemDream/releases/tag/v0.1.0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
MemDream adopts the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)
|
|
4
|
+
as its code of conduct. Everyone who takes part in the project — in issues, pull
|
|
5
|
+
requests, discussions, and any other project space — is expected to follow it.
|
|
6
|
+
|
|
7
|
+
In short: be welcoming and respectful, give and accept constructive feedback
|
|
8
|
+
gracefully, and focus on what is best for the community. Harassment, insults,
|
|
9
|
+
personal or political attacks, and publishing others' private information are
|
|
10
|
+
not acceptable.
|
|
11
|
+
|
|
12
|
+
## Reporting
|
|
13
|
+
|
|
14
|
+
If you experience or witness unacceptable behaviour, contact the maintainer
|
|
15
|
+
privately at **mamlesh.va06@gmail.com**. Reports are handled confidentially.
|
|
16
|
+
|
|
17
|
+
Security vulnerabilities are not conduct issues — please report those as
|
|
18
|
+
described in [SECURITY.md](SECURITY.md).
|
|
19
|
+
|
|
20
|
+
## Enforcement
|
|
21
|
+
|
|
22
|
+
The maintainers will review every report and respond in a way they consider
|
|
23
|
+
appropriate, following the
|
|
24
|
+
[Contributor Covenant enforcement guidelines](https://www.contributor-covenant.org/version/2/1/code_of_conduct/#enforcement-guidelines):
|
|
25
|
+
from a private warning, through a temporary ban, to a permanent ban from the
|
|
26
|
+
project's spaces.
|