pycontextdb 0.3.0__tar.gz → 0.3.2__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 (148) hide show
  1. pycontextdb-0.3.2/.github/pull_request_template.md +28 -0
  2. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.github/workflows/ci.yml +45 -0
  3. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/CHANGELOG.md +39 -0
  4. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/COMMERCIAL.md +7 -3
  5. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/CONTRIBUTING.md +7 -1
  6. pycontextdb-0.3.2/OPEN_CORE.md +80 -0
  7. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/PKG-INFO +7 -5
  8. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/README.md +6 -4
  9. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/__init__.py +15 -1
  10. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/client.py +264 -128
  11. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/config.py +16 -0
  12. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/exceptions.py +24 -0
  13. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/models.py +11 -0
  14. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/retrieval.py +4 -1
  15. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/base.py +58 -1
  16. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/factory.py +7 -0
  17. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/postgres_store.py +445 -76
  18. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/sqlite_store.py +93 -8
  19. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/utils/embeddings.py +138 -10
  20. pycontextdb-0.3.2/docs/postgres.md +148 -0
  21. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/quickstart.md +17 -0
  22. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/pyproject.toml +1 -1
  23. pycontextdb-0.3.2/scripts/check_open_core_boundary.py +154 -0
  24. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/scripts/check_release.py +54 -1
  25. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_config.py +6 -0
  26. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_decision_scope.py +62 -0
  27. pycontextdb-0.3.2/tests/unit/test_embeddings.py +87 -0
  28. pycontextdb-0.3.2/tests/unit/test_init.py +81 -0
  29. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_models.py +12 -0
  30. pycontextdb-0.3.2/tests/unit/test_open_core_boundary.py +64 -0
  31. pycontextdb-0.3.2/tests/unit/test_pg_sql.py +94 -0
  32. pycontextdb-0.3.2/tests/unit/test_postgres_concurrency.py +454 -0
  33. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_store.py +110 -1
  34. pycontextdb-0.3.0/.github/pull_request_template.md +0 -10
  35. pycontextdb-0.3.0/docs/postgres.md +0 -74
  36. pycontextdb-0.3.0/tests/unit/test_embeddings.py +0 -35
  37. pycontextdb-0.3.0/tests/unit/test_init.py +0 -31
  38. pycontextdb-0.3.0/tests/unit/test_pg_sql.py +0 -34
  39. pycontextdb-0.3.0/tests/unit/test_postgres_concurrency.py +0 -179
  40. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.github/CODEOWNERS +0 -0
  41. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.github/copilot-instructions.md +0 -0
  42. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.github/workflows/publish.yml +0 -0
  43. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.gitignore +0 -0
  44. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/.pre-commit-config.yaml +0 -0
  45. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/LICENSE +0 -0
  46. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/NOTICE +0 -0
  47. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/ai-tools/.cursorrules +0 -0
  48. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/ai-tools/CLAUDE.md +0 -0
  49. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/ai-tools/README.md +0 -0
  50. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/ai-tools/llms-full.txt +0 -0
  51. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/ai-tools/llms.txt +0 -0
  52. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/README.md +0 -0
  53. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/architecture.png +0 -0
  54. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/benchmarks.png +0 -0
  55. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/hero.png +0 -0
  56. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/performance.png +0 -0
  57. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/problem.png +0 -0
  58. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/assets/quickstart.png +0 -0
  59. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/benchmarks/__init__.py +0 -0
  60. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/benchmarks/run_benchmarks.py +0 -0
  61. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/benchmarks/trust_bakeoff.py +0 -0
  62. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/agents/__init__.py +0 -0
  63. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/agents/memory_bus.py +0 -0
  64. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/agents/rl_manager.py +0 -0
  65. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/cli.py +0 -0
  66. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/__init__.py +0 -0
  67. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/clock.py +0 -0
  68. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/policy.py +0 -0
  69. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/core/slots.py +0 -0
  70. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/__init__.py +0 -0
  71. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/evolution.py +0 -0
  72. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/formation.py +0 -0
  73. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/salience.py +0 -0
  74. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/dynamics/trust.py +0 -0
  75. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/__init__.py +0 -0
  76. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/base.py +0 -0
  77. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/causal.py +0 -0
  78. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/entity.py +0 -0
  79. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/semantic.py +0 -0
  80. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/graphs/temporal.py +0 -0
  81. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/__init__.py +0 -0
  82. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/act.py +0 -0
  83. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/autogen.py +0 -0
  84. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/crewai.py +0 -0
  85. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/langchain.py +0 -0
  86. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/livekit.py +0 -0
  87. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/openai_tools.py +0 -0
  88. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/pipecat.py +0 -0
  89. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/integrations/prompting.py +0 -0
  90. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/mcp.py +0 -0
  91. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/memory/__init__.py +0 -0
  92. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/memory/experiential.py +0 -0
  93. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/memory/factual.py +0 -0
  94. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/memory/working.py +0 -0
  95. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/pool.py +0 -0
  96. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/privacy/__init__.py +0 -0
  97. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/privacy/audit.py +0 -0
  98. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/privacy/injection.py +0 -0
  99. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/privacy/pii_detector.py +0 -0
  100. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/privacy/retention.py +0 -0
  101. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/py.typed +0 -0
  102. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/serve.py +0 -0
  103. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/__init__.py +0 -0
  104. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/pg_sql.py +0 -0
  105. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/store/vector_index.py +0 -0
  106. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/utils/__init__.py +0 -0
  107. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/utils/llm.py +0 -0
  108. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/contextdb/utils/migrations.py +0 -0
  109. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/api.md +0 -0
  110. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/architecture.md +0 -0
  111. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/index.md +0 -0
  112. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/migrations.md +0 -0
  113. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/multi_tenant.md +0 -0
  114. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/prompts.md +0 -0
  115. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/serve.md +0 -0
  116. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/docs/trust_policy.md +0 -0
  117. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/examples/customer_support.py +0 -0
  118. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/examples/multi_agent_team.py +0 -0
  119. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/examples/phone_agent.py +0 -0
  120. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/examples/research_assistant.py +0 -0
  121. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/legal/CLA-entity.md +0 -0
  122. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/legal/CLA-individual.md +0 -0
  123. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/legal/signed/README.md +0 -0
  124. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/mkdocs.yml +0 -0
  125. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/__init__.py +0 -0
  126. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/conftest.py +0 -0
  127. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/evals/__init__.py +0 -0
  128. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/evals/test_trust_model.py +0 -0
  129. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/integration/__init__.py +0 -0
  130. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/integration/test_client.py +0 -0
  131. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/integration/test_langchain_integration.py +0 -0
  132. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/pg_util.py +0 -0
  133. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/test_version.py +0 -0
  134. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/__init__.py +0 -0
  135. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_audit.py +0 -0
  136. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_evolution.py +0 -0
  137. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_formation.py +0 -0
  138. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_graphs.py +0 -0
  139. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_host_api.py +0 -0
  140. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_memory_bus.py +0 -0
  141. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_pii_detector.py +0 -0
  142. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_retention.py +0 -0
  143. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_retrieval.py +0 -0
  144. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_scoped_id_access.py +0 -0
  145. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_serve.py +0 -0
  146. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_trust_policy.py +0 -0
  147. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_vector_index.py +0 -0
  148. {pycontextdb-0.3.0 → pycontextdb-0.3.2}/tests/unit/test_vector_scope.py +0 -0
@@ -0,0 +1,28 @@
1
+ ## Summary
2
+
3
+ <!-- What changed, and why. Evals win over prose. -->
4
+
5
+ ## Open-core classification
6
+
7
+ Select exactly one and justify placement against `OPEN_CORE.md`.
8
+
9
+ - [ ] No capability change — docs/tests/build/maintenance only.
10
+ - [ ] Semantic — portable offline correctness.
11
+ - [ ] Contract — interface/schema/protocol.
12
+ - [ ] Reference — minimal single-node implementation.
13
+ - [ ] Operated — multi-tenant/process/region/people/SLA coordination; this PR
14
+ does not belong in the public SDK.
15
+
16
+ **Why this repository is the correct side of the boundary:**
17
+
18
+ <!-- For mixed features, identify the open contract and private implementation. -->
19
+
20
+ ## Checklist
21
+
22
+ - [ ] `pytest tests/evals/ -v` passes, or I explain why not.
23
+ - [ ] `python scripts/check_open_core_boundary.py` passes.
24
+ - [ ] `contextdb.init`, `factual.add`, `factual.recall`, and `search` keep working; new fields have backward-compatible defaults.
25
+ - [ ] No new runtime dependency without a discussion first.
26
+ - [ ] No hosted auth, entitlements, billing, control-plane, enterprise,
27
+ deployment, migration-orchestration, or fleet code entered the SDK.
28
+ - [ ] Substantial contribution: I agree to the CLA in CONTRIBUTING.md (legal name and email in this description). Trivial typo PRs may skip this.
@@ -54,6 +54,12 @@ jobs:
54
54
  python -m pip install --upgrade pip
55
55
  pip install -e ".[dev]"
56
56
 
57
+ - name: Open-core boundary
58
+ run: python scripts/check_open_core_boundary.py
59
+ env:
60
+ CONTEXTDB_REQUIRE_PR_CLASSIFICATION: ${{ github.event_name == 'pull_request' }}
61
+ CONTEXTDB_PR_BODY: ${{ github.event.pull_request.body }}
62
+
57
63
  - name: Lint with ruff
58
64
  run: ruff check .
59
65
 
@@ -62,3 +68,42 @@ jobs:
62
68
 
63
69
  - name: Run tests
64
70
  run: pytest
71
+
72
+ postgres:
73
+ name: Postgres integration
74
+ runs-on: ubuntu-latest
75
+ services:
76
+ postgres:
77
+ image: postgres:16
78
+ env:
79
+ POSTGRES_USER: postgres
80
+ POSTGRES_PASSWORD: postgres
81
+ POSTGRES_DB: postgres
82
+ ports:
83
+ - 5432:5432
84
+ options: >-
85
+ --health-cmd "pg_isready -U postgres"
86
+ --health-interval 5s
87
+ --health-timeout 5s
88
+ --health-retries 10
89
+ env:
90
+ CONTEXTDB_TEST_POSTGRES_URL: postgresql://postgres:postgres@127.0.0.1:5432/postgres
91
+ steps:
92
+ - uses: actions/checkout@v4
93
+
94
+ - uses: actions/setup-python@v5
95
+ with:
96
+ python-version: "3.12"
97
+ cache: pip
98
+
99
+ - name: Install package with Postgres support
100
+ run: |
101
+ python -m pip install --upgrade pip
102
+ pip install -e ".[dev,postgres]"
103
+
104
+ - name: Run real Postgres tests
105
+ run: |
106
+ pytest \
107
+ tests/unit/test_postgres_concurrency.py \
108
+ tests/unit/test_scoped_id_access.py \
109
+ tests/unit/test_vector_scope.py
@@ -2,6 +2,45 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.2 — 2026-08-20
6
+
7
+ ### Added
8
+
9
+ - Host-owned asyncpg pools and embedding providers can be shared safely across
10
+ project runtimes without being closed on runtime eviction.
11
+ - Mutations return project-scoped memory versions and Postgres WAL positions;
12
+ reads can require those floors and fail closed when unavailable.
13
+ - Embeddings carry model identity and distinct query/document roles, including
14
+ role-aware OpenAI-compatible transport.
15
+ - Project-scoped vector and immutable item caches remove redundant warm recall
16
+ queries while preserving user isolation and cross-worker coherence.
17
+ - A durable read-audit hook lets hosted runtimes persist exact PII-processed
18
+ recall evidence outside the synchronous SDK audit chain.
19
+ - The open-core constitution, PR classification, CI source scanner, and release
20
+ gate prevent operated Cloud capabilities from entering the Apache package.
21
+
22
+ ### Fixed
23
+
24
+ - Memory mutation, project/global revision changes, and write audit now commit
25
+ in one Postgres transaction.
26
+ - Advisory locks execute their protected work on the same transaction-bound
27
+ connection instead of accidentally hopping pool connections.
28
+ - Public commercial-use guidance now matches Apache-2.0 while preserving
29
+ ContextDB trademark controls.
30
+
31
+ `contextdb.init`, `factual.add`, `factual.recall`, and `search` remain
32
+ backward-compatible. All new host-sharing and consistency arguments are
33
+ optional.
34
+
35
+ ## 0.3.1 — 2026-08-18
36
+
37
+ ### Fixed
38
+
39
+ - README links to docs/COMMERCIAL.md/CONTRIBUTING.md are absolute GitHub
40
+ URLs — relative targets 404 on the PyPI project page.
41
+ - `scripts/check_release.py` now scans the built package description for
42
+ relative Markdown links so this fails in CI before it reaches PyPI.
43
+
5
44
  ## 0.3.0 — 2026-08-18
6
45
 
7
46
  Host API scope hardening:
@@ -26,9 +26,13 @@ You may not, without a commercial agreement with Atoms AI:
26
26
 
27
27
  ## Resale and commercial agreements
28
28
 
29
- If your company resells ContextDB as a service or as part of a service,
30
- or wants OEM/embedded licensing, support, or a trademark arrangement,
31
- contact **contextdb@atomsai.com** before you ship.
29
+ Apache-2.0 permits commercial use, modification, redistribution, embedding,
30
+ and hosted use of the code, subject to its terms. No separate copyright
31
+ license is required for those uses.
32
+
33
+ If your company wants to use the ContextDB name or logo for a hosted offering,
34
+ or wants a supported OEM arrangement, Cloud service, support, or a trademark
35
+ agreement, contact **contextdb@atomsai.com**.
32
36
 
33
37
  ## Attribution (optional)
34
38
 
@@ -7,7 +7,10 @@ gates.
7
7
  ## What we accept here
8
8
 
9
9
  Trust and safety correctness, local runtime fixes, adapters, docs, and
10
- evals. Evals win over prose: `pytest tests/evals/ -v`.
10
+ evals. Portable contracts and minimal single-node reference implementations
11
+ also belong here. Classify every substantial change under
12
+ [OPEN_CORE.md](OPEN_CORE.md). Evals win over prose:
13
+ `pytest tests/evals/ -v`.
11
14
 
12
15
  We do **not** accept:
13
16
 
@@ -15,6 +18,9 @@ We do **not** accept:
15
18
  no flags that only work against a hosted service
16
19
  - Imports of packages outside the declared dependencies
17
20
  - Changes that loosen PII-before-embed or the hash-chained audit log
21
+ - Hosted auth, tenancy, entitlements, billing, organization control-plane,
22
+ enterprise governance, managed-service, deployment, migration-orchestration,
23
+ or fleet code
18
24
 
19
25
  ## Contributor License Agreement
20
26
 
@@ -0,0 +1,80 @@
1
+ # ContextDB open-core constitution
2
+
3
+ **Status: binding for all future work.** Changes require an explicit
4
+ architecture decision and maintainer approval.
5
+
6
+ > Open the single-node semantics and reference engine. Keep multi-tenant coordination, operated guarantees, governance, and proof private.
7
+
8
+ This repository is the public Apache-2.0 engine. It must remain complete,
9
+ useful offline, inspectable, and safe without a hosted account, license key,
10
+ paid flag, time bomb, or phone-home.
11
+
12
+ Existing Apache grants are permanent. New code is reviewed prospectively
13
+ against this constitution before merge and again before package publication.
14
+
15
+ ## Four change classes
16
+
17
+ Every capability-changing contribution is classified as exactly one:
18
+
19
+ 1. **Semantic** — portable correctness required offline: open implementation.
20
+ 2. **Contract** — interface, schema, protocol, or compatibility test: open.
21
+ 3. **Reference** — minimal single-node implementation proving a contract: open.
22
+ 4. **Operated** — coordinates tenants, processes, regions, people, or an SLA:
23
+ private Cloud implementation, not this repository.
24
+
25
+ Docs, tests, and maintenance with no capability change declare that explicitly.
26
+ Mixed features are split. This repository may contain the contract and minimal
27
+ reference implementation. Distributed schedulers, controllers, managed
28
+ workers, deployment topology, and operations stay private.
29
+
30
+ ## What belongs here
31
+
32
+ - Memory and epistemic data models.
33
+ - `TrustPolicy`, act/ask/abstain, confirmation, and local explanation.
34
+ - PII-before-embed, injection defenses, and public adversarial evals.
35
+ - Local CRUD, SQLite, and a basic Postgres reference adapter.
36
+ - Atomic mutation/version/audit behavior required for correct storage.
37
+ - Deletion semantics and local verification.
38
+ - Portable consistency-token, embedding-provider, and connector contracts.
39
+ - Minimal reference implementations and compatibility tests.
40
+
41
+ Safety and correctness are never commercially gated or intentionally weaker
42
+ than the hosted service.
43
+
44
+ ## What does not belong here
45
+
46
+ - Hosted gateway, tenancy, API-key auth, entitlements, quotas, billing, or
47
+ abuse controls.
48
+ - Organization/project/team control plane or governance console.
49
+ - Multi-worker routing, replica orchestration, failover, autoscaling, backups,
50
+ incidents, or availability guarantees.
51
+ - Managed model fleet, batching service, backfill control, or deployment code.
52
+ - Managed connector sync, checkpoints, retries, observability, or support SLAs.
53
+ - Organization Action Ledger, signed compliance exports, or retention service.
54
+ - Policy rollout/canary/approval controllers.
55
+ - SSO, SCIM, KMS/BYOK, private networking, residency, or contractual controls.
56
+
57
+ Thin generated Cloud clients, public API schemas, connector interfaces, and
58
+ common community adapters are public distribution artifacts because they grow
59
+ the ecosystem; they may live in separate public packages and contain no hosted
60
+ implementation.
61
+
62
+ ## Contribution and release gate
63
+
64
+ - Pull requests declare one change class and justify repository placement.
65
+ - Ambiguous changes stop for boundary review; publication is never the default.
66
+ - Contract tests may be shared; private implementations are not copied here.
67
+ - Every PyPI release receives an open-core diff review.
68
+ - `scripts/check_open_core_boundary.py` and CI enforce mechanical invariants.
69
+
70
+ Private code can be opened later. An Apache grant cannot be clawed back.
71
+
72
+ ## Commercial model
73
+
74
+ ContextDB Cloud sells operation, coordination, governance, and proof of this
75
+ open correctness model. The SDK is not a crippled free tier. If Cloud cannot
76
+ win while this engine is useful, Cloud must become stronger rather than making
77
+ the SDK weaker.
78
+
79
+ See [COMMERCIAL.md](COMMERCIAL.md) for trademark rules. Apache-2.0 permits
80
+ commercial use of the code; it does not grant rights to ContextDB trademarks.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pycontextdb
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: The unified context layer for AI agents — memory you can act on without treating wishes as facts
5
5
  Project-URL: Homepage, https://github.com/atomsai/contextdb
6
6
  Project-URL: Documentation, https://contextdb.dev
@@ -618,8 +618,8 @@ pip install 'pycontextdb[postgres]'
618
618
  db = contextdb.init(storage_url="postgresql://...")
619
619
  ```
620
620
 
621
- See [docs/serve.md](docs/serve.md), [docs/multi_tenant.md](docs/multi_tenant.md),
622
- and [docs/trust_policy.md](docs/trust_policy.md).
621
+ See [docs/serve.md](https://github.com/atomsai/contextdb/blob/main/docs/serve.md), [docs/multi_tenant.md](https://github.com/atomsai/contextdb/blob/main/docs/multi_tenant.md),
622
+ and [docs/trust_policy.md](https://github.com/atomsai/contextdb/blob/main/docs/trust_policy.md).
623
623
 
624
624
  ## License and attribution
625
625
 
@@ -628,14 +628,16 @@ this README ships in this tree, with no feature gates. **ContextDB** is a
628
628
  trademark; the Apache license is not a trademark license. Reselling
629
629
  ContextDB as a service, or as part of one, under the ContextDB name or
630
630
  branding requires a commercial agreement with Atoms AI — contact
631
- contextdb@atomsai.com (see [COMMERCIAL.md](COMMERCIAL.md)). A public
631
+ contextdb@atomsai.com (see [COMMERCIAL.md](https://github.com/atomsai/contextdb/blob/main/COMMERCIAL.md)).
632
+ The binding product boundary is documented in
633
+ [OPEN_CORE.md](https://github.com/atomsai/contextdb/blob/main/OPEN_CORE.md). A public
632
634
  credit line is optional — if you want one, use **Built with ContextDB**
633
635
  linking to this repository.
634
636
 
635
637
  ## Contributing
636
638
 
637
639
  Apache 2.0 — see [LICENSE](https://github.com/atomsai/contextdb/blob/main/LICENSE).
638
- Substantial PRs need a CLA ([CONTRIBUTING.md](CONTRIBUTING.md)).
640
+ Substantial PRs need a CLA ([CONTRIBUTING.md](https://github.com/atomsai/contextdb/blob/main/CONTRIBUTING.md)).
639
641
  See [`docs/architecture.md`](https://github.com/atomsai/contextdb/blob/main/docs/architecture.md) for the design rationale. Issues and pull requests welcome on [GitHub](https://github.com/atomsai/contextdb).
640
642
 
641
643
  **Local setup:**
@@ -552,8 +552,8 @@ pip install 'pycontextdb[postgres]'
552
552
  db = contextdb.init(storage_url="postgresql://...")
553
553
  ```
554
554
 
555
- See [docs/serve.md](docs/serve.md), [docs/multi_tenant.md](docs/multi_tenant.md),
556
- and [docs/trust_policy.md](docs/trust_policy.md).
555
+ See [docs/serve.md](https://github.com/atomsai/contextdb/blob/main/docs/serve.md), [docs/multi_tenant.md](https://github.com/atomsai/contextdb/blob/main/docs/multi_tenant.md),
556
+ and [docs/trust_policy.md](https://github.com/atomsai/contextdb/blob/main/docs/trust_policy.md).
557
557
 
558
558
  ## License and attribution
559
559
 
@@ -562,14 +562,16 @@ this README ships in this tree, with no feature gates. **ContextDB** is a
562
562
  trademark; the Apache license is not a trademark license. Reselling
563
563
  ContextDB as a service, or as part of one, under the ContextDB name or
564
564
  branding requires a commercial agreement with Atoms AI — contact
565
- contextdb@atomsai.com (see [COMMERCIAL.md](COMMERCIAL.md)). A public
565
+ contextdb@atomsai.com (see [COMMERCIAL.md](https://github.com/atomsai/contextdb/blob/main/COMMERCIAL.md)).
566
+ The binding product boundary is documented in
567
+ [OPEN_CORE.md](https://github.com/atomsai/contextdb/blob/main/OPEN_CORE.md). A public
566
568
  credit line is optional — if you want one, use **Built with ContextDB**
567
569
  linking to this repository.
568
570
 
569
571
  ## Contributing
570
572
 
571
573
  Apache 2.0 — see [LICENSE](https://github.com/atomsai/contextdb/blob/main/LICENSE).
572
- Substantial PRs need a CLA ([CONTRIBUTING.md](CONTRIBUTING.md)).
574
+ Substantial PRs need a CLA ([CONTRIBUTING.md](https://github.com/atomsai/contextdb/blob/main/CONTRIBUTING.md)).
573
575
  See [`docs/architecture.md`](https://github.com/atomsai/contextdb/blob/main/docs/architecture.md) for the design rationale. Issues and pull requests welcome on [GitHub](https://github.com/atomsai/contextdb).
574
576
 
575
577
  **Local setup:**
@@ -14,12 +14,14 @@ from contextdb.core.exceptions import (
14
14
  PrivacyError,
15
15
  ScopeConflictError,
16
16
  SourceRequiredError,
17
+ StaleReadError,
17
18
  StorageError,
18
19
  UnauthorizedError,
19
20
  )
20
21
  from contextdb.core.models import (
21
22
  Edge,
22
23
  Entity,
24
+ MemoryConsistencyToken,
23
25
  MemoryItem,
24
26
  MemoryStatus,
25
27
  MemoryType,
@@ -29,8 +31,9 @@ from contextdb.core.models import (
29
31
  )
30
32
  from contextdb.core.policy import TrustPolicy
31
33
  from contextdb.pool import ContextDBPool
34
+ from contextdb.utils.embeddings import EmbeddingProvider
32
35
 
33
- __version__ = "0.3.0"
36
+ __version__ = "0.3.2"
34
37
 
35
38
  __all__ = [
36
39
  "Clock",
@@ -40,9 +43,11 @@ __all__ = [
40
43
  "ContextDBError",
41
44
  "ContextDBPool",
42
45
  "Edge",
46
+ "EmbeddingProvider",
43
47
  "Entity",
44
48
  "FrozenClock",
45
49
  "MemoryItem",
50
+ "MemoryConsistencyToken",
46
51
  "MemoryNotFoundError",
47
52
  "MemoryStatus",
48
53
  "MemoryType",
@@ -52,6 +57,7 @@ __all__ = [
52
57
  "RetentionPolicy",
53
58
  "ScopeConflictError",
54
59
  "SourceRequiredError",
60
+ "StaleReadError",
55
61
  "StorageError",
56
62
  "TrustPolicy",
57
63
  "UnauthorizedError",
@@ -70,6 +76,8 @@ def init(
70
76
  session_id: str | None = None,
71
77
  clock: Clock | None = None,
72
78
  trust_policy: TrustPolicy | None = None,
79
+ postgres_pool: Any | None = None,
80
+ embedding_provider: EmbeddingProvider | None = None,
73
81
  **kwargs: Any,
74
82
  ) -> ContextDB:
75
83
  """Create a :class:`ContextDB` client.
@@ -84,6 +92,10 @@ def init(
84
92
  config: Pre-built configuration. When ``None`` one is constructed
85
93
  from ``kwargs`` and environment variables prefixed with
86
94
  ``CONTEXTDB_``.
95
+ postgres_pool: Optional externally owned asyncpg pool. Valid only with
96
+ a PostgreSQL ``storage_url``. ContextDB never closes this pool.
97
+ embedding_provider: Optional externally owned provider shared by the
98
+ host. ContextDB uses but never closes this provider.
87
99
  **kwargs: Forwarded to :class:`ContextDBConfig` if ``config`` is
88
100
  not provided.
89
101
 
@@ -99,4 +111,6 @@ def init(
99
111
  session_id=session_id,
100
112
  clock=clock,
101
113
  trust_policy=trust_policy,
114
+ postgres_pool=postgres_pool,
115
+ embedding_provider=embedding_provider,
102
116
  )