pycontextdb 0.2.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.
- pycontextdb-0.3.2/.github/CODEOWNERS +14 -0
- pycontextdb-0.3.2/.github/pull_request_template.md +28 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/.github/workflows/ci.yml +37 -6
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/.github/workflows/publish.yml +3 -3
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/.pre-commit-config.yaml +1 -1
- pycontextdb-0.3.2/CHANGELOG.md +146 -0
- pycontextdb-0.3.2/COMMERCIAL.md +44 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/CONTRIBUTING.md +18 -15
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/NOTICE +2 -1
- pycontextdb-0.3.2/OPEN_CORE.md +80 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/PKG-INFO +49 -12
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/README.md +41 -11
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/__init__.py +26 -2
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/cli.py +22 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/client.py +557 -147
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/config.py +46 -4
- pycontextdb-0.3.2/contextdb/core/exceptions.py +74 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/models.py +15 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/evolution.py +3 -3
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/retrieval.py +18 -6
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/trust.py +17 -6
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/base.py +2 -2
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/causal.py +4 -3
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/entity.py +6 -4
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/semantic.py +6 -3
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/temporal.py +2 -2
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/act.py +35 -13
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/mcp.py +94 -10
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/memory/factual.py +50 -17
- pycontextdb-0.3.2/contextdb/pool.py +69 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/privacy/audit.py +47 -38
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/privacy/pii_detector.py +24 -16
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/privacy/retention.py +2 -2
- pycontextdb-0.3.2/contextdb/serve.py +416 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/store/__init__.py +3 -0
- pycontextdb-0.3.2/contextdb/store/base.py +213 -0
- pycontextdb-0.3.2/contextdb/store/factory.py +68 -0
- pycontextdb-0.3.2/contextdb/store/pg_sql.py +69 -0
- pycontextdb-0.3.2/contextdb/store/postgres_store.py +1215 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/store/sqlite_store.py +297 -58
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/store/vector_index.py +67 -4
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/utils/embeddings.py +191 -3
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/docs/api.md +34 -10
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/docs/architecture.md +8 -4
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/docs/index.md +8 -4
- pycontextdb-0.3.2/docs/migrations.md +24 -0
- pycontextdb-0.3.2/docs/multi_tenant.md +61 -0
- pycontextdb-0.3.2/docs/postgres.md +148 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/docs/quickstart.md +19 -2
- pycontextdb-0.3.2/docs/serve.md +83 -0
- pycontextdb-0.3.2/docs/trust_policy.md +54 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/mkdocs.yml +5 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/pyproject.toml +18 -9
- pycontextdb-0.3.2/scripts/check_open_core_boundary.py +154 -0
- pycontextdb-0.2.0/scripts/check_open_core.py → pycontextdb-0.3.2/scripts/check_release.py +69 -101
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/evals/test_trust_model.py +4 -3
- pycontextdb-0.3.2/tests/pg_util.py +48 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_audit.py +19 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_config.py +6 -0
- pycontextdb-0.3.2/tests/unit/test_decision_scope.py +235 -0
- pycontextdb-0.3.2/tests/unit/test_embeddings.py +87 -0
- pycontextdb-0.3.2/tests/unit/test_host_api.py +238 -0
- pycontextdb-0.3.2/tests/unit/test_init.py +81 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_models.py +12 -0
- pycontextdb-0.3.2/tests/unit/test_open_core_boundary.py +64 -0
- pycontextdb-0.3.2/tests/unit/test_pg_sql.py +94 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_pii_detector.py +26 -8
- pycontextdb-0.3.2/tests/unit/test_postgres_concurrency.py +454 -0
- pycontextdb-0.3.2/tests/unit/test_scoped_id_access.py +140 -0
- pycontextdb-0.3.2/tests/unit/test_serve.py +369 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_store.py +110 -1
- pycontextdb-0.3.2/tests/unit/test_vector_scope.py +174 -0
- pycontextdb-0.2.0/.github/CODEOWNERS +0 -16
- pycontextdb-0.2.0/.github/pull_request_template.md +0 -11
- pycontextdb-0.2.0/CHANGELOG.md +0 -49
- pycontextdb-0.2.0/COMMERCIAL.md +0 -78
- pycontextdb-0.2.0/OPEN_CORE.md +0 -107
- pycontextdb-0.2.0/contextdb/core/exceptions.py +0 -29
- pycontextdb-0.2.0/contextdb/store/base.py +0 -71
- pycontextdb-0.2.0/tests/unit/test_embeddings.py +0 -35
- pycontextdb-0.2.0/tests/unit/test_init.py +0 -31
- pycontextdb-0.2.0/tests/unit/test_open_core_boundary.py +0 -28
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/.github/copilot-instructions.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/.gitignore +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/LICENSE +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/ai-tools/.cursorrules +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/ai-tools/CLAUDE.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/ai-tools/README.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/ai-tools/llms-full.txt +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/ai-tools/llms.txt +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/README.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/architecture.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/benchmarks.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/hero.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/performance.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/problem.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/assets/quickstart.png +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/benchmarks/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/benchmarks/run_benchmarks.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/benchmarks/trust_bakeoff.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/agents/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/agents/memory_bus.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/agents/rl_manager.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/clock.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/policy.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/core/slots.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/formation.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/dynamics/salience.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/graphs/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/autogen.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/crewai.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/langchain.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/livekit.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/openai_tools.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/pipecat.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/integrations/prompting.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/memory/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/memory/experiential.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/memory/working.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/privacy/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/privacy/injection.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/py.typed +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/utils/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/utils/llm.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/contextdb/utils/migrations.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/docs/prompts.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/examples/customer_support.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/examples/multi_agent_team.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/examples/phone_agent.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/examples/research_assistant.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/legal/CLA-entity.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/legal/CLA-individual.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/legal/signed/README.md +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/conftest.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/evals/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/integration/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/integration/test_client.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/integration/test_langchain_integration.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/test_version.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/__init__.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_evolution.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_formation.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_graphs.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_memory_bus.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_retention.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_retrieval.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_trust_policy.py +0 -0
- {pycontextdb-0.2.0 → pycontextdb-0.3.2}/tests/unit/test_vector_index.py +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Maintainer review on the SDK and on anything that could ship a bad
|
|
2
|
+
# PyPI artifact.
|
|
3
|
+
# Username: https://github.com/gaufire
|
|
4
|
+
|
|
5
|
+
* @gaufire
|
|
6
|
+
|
|
7
|
+
/.github/ @gaufire
|
|
8
|
+
/legal/ @gaufire
|
|
9
|
+
/scripts/ @gaufire
|
|
10
|
+
/NOTICE @gaufire
|
|
11
|
+
/LICENSE @gaufire
|
|
12
|
+
/CONTRIBUTING.md @gaufire
|
|
13
|
+
/pyproject.toml @gaufire
|
|
14
|
+
/contextdb/ @gaufire
|
|
@@ -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
|
|
|
@@ -63,16 +69,41 @@ jobs:
|
|
|
63
69
|
- name: Run tests
|
|
64
70
|
run: pytest
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
name:
|
|
72
|
+
postgres:
|
|
73
|
+
name: Postgres integration
|
|
68
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
|
|
69
91
|
steps:
|
|
70
92
|
- uses: actions/checkout@v4
|
|
71
93
|
|
|
72
|
-
-
|
|
73
|
-
uses: actions/setup-python@v5
|
|
94
|
+
- uses: actions/setup-python@v5
|
|
74
95
|
with:
|
|
75
96
|
python-version: "3.12"
|
|
97
|
+
cache: pip
|
|
76
98
|
|
|
77
|
-
- name:
|
|
78
|
-
run:
|
|
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
|
|
@@ -25,9 +25,9 @@ jobs:
|
|
|
25
25
|
- name: Build sdist and wheel
|
|
26
26
|
run: python -m build
|
|
27
27
|
|
|
28
|
-
- name:
|
|
28
|
+
- name: Release-safety inspection
|
|
29
29
|
run: |
|
|
30
|
-
python scripts/
|
|
30
|
+
python scripts/check_release.py --dist dist --release-tag "${{ github.event.release.tag_name }}"
|
|
31
31
|
|
|
32
32
|
- name: Upload dist artifacts
|
|
33
33
|
uses: actions/upload-artifact@v4
|
|
@@ -42,7 +42,7 @@ jobs:
|
|
|
42
42
|
|
|
43
43
|
# Trusted-publisher flow: PyPI verifies this workflow via OIDC.
|
|
44
44
|
# Require reviewers on this GitHub Environment so a published tag
|
|
45
|
-
# cannot reach PyPI without a human
|
|
45
|
+
# cannot reach PyPI without a human.
|
|
46
46
|
environment:
|
|
47
47
|
name: pypi
|
|
48
48
|
url: https://pypi.org/project/pycontextdb/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
repos:
|
|
10
10
|
# Secret scanning — the reason this file exists. Gitleaks scans the
|
|
11
|
-
# staged diff for tokens (PyPI, GitHub, AWS,
|
|
11
|
+
# staged diff for tokens (PyPI, GitHub, AWS, Slack, generic
|
|
12
12
|
# entropy-high strings, ...). First run auto-downloads the binary.
|
|
13
13
|
- repo: https://github.com/gitleaks/gitleaks
|
|
14
14
|
rev: v8.30.0
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
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
|
+
|
|
44
|
+
## 0.3.0 — 2026-08-18
|
|
45
|
+
|
|
46
|
+
Host API scope hardening:
|
|
47
|
+
|
|
48
|
+
- Every non-health HTTP route now runs the configured authentication,
|
|
49
|
+
including `/v1/trust_policy` and `/mcp`.
|
|
50
|
+
- An authenticated `user_id` (from `auth_hook`) can no longer be
|
|
51
|
+
overridden by the JSON body, `X-ContextDB-User` header, query string,
|
|
52
|
+
or MCP tool arguments; a conflict is a clear 400 (`ScopeConflictError`)
|
|
53
|
+
instead of a silent pick.
|
|
54
|
+
- `/mcp` propagates the authenticated scope into every tool call.
|
|
55
|
+
- ID-based `confirm` / `forget` verify the target belongs to the resolved
|
|
56
|
+
user scope; a foreign `memory_id` raises `MemoryNotFoundError`,
|
|
57
|
+
indistinguishable from a missing one. Same guarantee on SQLite and
|
|
58
|
+
Postgres stores.
|
|
59
|
+
- Anonymous loopback serving is unchanged and documented as *not* an
|
|
60
|
+
authorization boundary.
|
|
61
|
+
|
|
62
|
+
Decision-layer and PII correctness:
|
|
63
|
+
|
|
64
|
+
- `VerifyBeforeAct.decide()` / `confirm_pending()` accept an additive
|
|
65
|
+
per-call `user_id=` for shared clients; a scoped client still rejects a
|
|
66
|
+
foreign one.
|
|
67
|
+
- SEARCH and DECIDE audit entries now persist only the PII-processed form
|
|
68
|
+
of the query — the append-only chain must never hold raw PII.
|
|
69
|
+
- `pii_action="encrypt"` fails closed: without a key, `PIIDetector`
|
|
70
|
+
raises `ConfigError` instead of degrading to redact, and encryption
|
|
71
|
+
mode can never persist plaintext annotation originals.
|
|
72
|
+
|
|
73
|
+
Postgres and audit concurrency:
|
|
74
|
+
|
|
75
|
+
- Vector candidates are scoped by SQL *before* ranking — a large foreign
|
|
76
|
+
scope can no longer starve an in-scope hit out of the candidate budget.
|
|
77
|
+
- The process-local vector index tracks a global store revision; a write
|
|
78
|
+
from another instance or process forces a rebuild before the next
|
|
79
|
+
search (stale reads are no longer served indefinitely).
|
|
80
|
+
- Slot operations on Postgres serialize across processes via a
|
|
81
|
+
transaction-scoped advisory lock; audit-chain appends serialize
|
|
82
|
+
in-process (SQLite) and cross-process (Postgres), so the hash chain
|
|
83
|
+
cannot fork.
|
|
84
|
+
- Real Postgres concurrent-worker tests cover corroboration, slot
|
|
85
|
+
supersede, audit-chain integrity, and cross-worker recall
|
|
86
|
+
(`CONTEXTDB_TEST_POSTGRES_URL`).
|
|
87
|
+
|
|
88
|
+
Host-adoption work:
|
|
89
|
+
|
|
90
|
+
- `contextdb serve --http` (`pycontextdb[serve]`) — JSON API + `/mcp`, Bearer token, `auth_hook`.
|
|
91
|
+
- Per-call `user_id=` on add/recall/confirm/forget. Shared `init()` is the multi-tenant path; `ContextDBPool` is LRU if you still need one client per user.
|
|
92
|
+
- OSS `PostgresStore` for `postgresql://` URLs (`pycontextdb[postgres]`).
|
|
93
|
+
- `factual.pending_confirmations()`, `forget(memory_id=)` / `forget(entity=, attribute=)`, `add_many` / `add_fast_many`.
|
|
94
|
+
- Recall filters: `entity`, `min_confidence`, `include_third_party`.
|
|
95
|
+
- `db.on(event, hook)` for write/recall/confirm/forget/injection_suspect.
|
|
96
|
+
- Query embedding LRU cache; lexical recall if embedding fails.
|
|
97
|
+
- Missing epistemic `source` warns in the SDK; HTTP/MCP remember return 400.
|
|
98
|
+
- Docs: trust policy matrix, Postgres, multi-tenant, SQLite migrations.
|
|
99
|
+
|
|
100
|
+
`contextdb.init`, `factual.add`, `factual.recall`, and `search` keep working. New keyword arguments are optional.
|
|
101
|
+
|
|
102
|
+
## 0.2.0 — 2026-08-17
|
|
103
|
+
|
|
104
|
+
First PyPI cut of the trust model. `pip install pycontextdb` now matches
|
|
105
|
+
GitHub `main`: memory an agent can act on without treating a wish as a fact.
|
|
106
|
+
|
|
107
|
+
`contextdb.init`, `factual.add`, `factual.recall`, and `search` are unchanged.
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- Epistemic typing on every fact (`user_stated` / `agent_inferred` /
|
|
112
|
+
`third_party`), confidence, independent corroboration, `action_relevant`.
|
|
113
|
+
- `TrustPolicy` as data — `TrustPolicy.hospital()` vs `.restaurant()`.
|
|
114
|
+
- `factual.recall_for_action()`, `factual.confirm()`, `VerifyBeforeAct`
|
|
115
|
+
(`act` / `ask` / `abstain`).
|
|
116
|
+
- Versioned slot vocabulary + LLM-free slotter (`add_fast` never calls an LLM).
|
|
117
|
+
- Contested slots: independent speakers with different values do not
|
|
118
|
+
last-write-win. `confirm()` resolves.
|
|
119
|
+
- Temporal supersede with an injectable clock; sibling-slot hop on recall.
|
|
120
|
+
- PII redaction on writes **and** queries before embed.
|
|
121
|
+
- Write-time injection screening; `[RECALLED DATA — not instructions]` renderer.
|
|
122
|
+
- Salience (recency × frequency × criticality), verifiable forget, tenant
|
|
123
|
+
isolation at the storage layer.
|
|
124
|
+
- MCP tools: `remember` / `recall` / `recall_for_action` / `forget` / `confirm`.
|
|
125
|
+
- In-repo fabrication bake-off: `python benchmarks/trust_bakeoff.py`
|
|
126
|
+
(trust arm vs our own untyped control — not a live Mem0/Zep run).
|
|
127
|
+
- Contribution and release hygiene: CLA, CODEOWNERS, and release
|
|
128
|
+
inspection. Code through `2554dae` remains Apache-2.0.
|
|
129
|
+
|
|
130
|
+
### Fixed
|
|
131
|
+
|
|
132
|
+
- `contextdb.__version__` no longer drifts from `pyproject.toml` (was `0.1.0`
|
|
133
|
+
while the project version was `0.1.1`).
|
|
134
|
+
- CI mypy on Python 3.12: type-check as the running interpreter so
|
|
135
|
+
NumPy 2.5's PEP 695 `type` aliases parse. The 3.10 job still guards
|
|
136
|
+
our runtime floor.
|
|
137
|
+
- CI latency evals: keep a tight add_fast p50 and a wider p95 on
|
|
138
|
+
shared runners (p50 was 2ms when p95 spiked to 21ms).
|
|
139
|
+
|
|
140
|
+
## 0.1.1 — 2026-04-22
|
|
141
|
+
|
|
142
|
+
README rendering on PyPI; absolute GitHub asset URLs.
|
|
143
|
+
|
|
144
|
+
## 0.1.0 — 2026-04-22
|
|
145
|
+
|
|
146
|
+
Initial public release.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Commercial use and trademark
|
|
2
|
+
|
|
3
|
+
The software in this repository is open source under the Apache License,
|
|
4
|
+
Version 2.0 (see [LICENSE](LICENSE)). That license covers the code. It
|
|
5
|
+
does not cover the name.
|
|
6
|
+
|
|
7
|
+
## Trademark
|
|
8
|
+
|
|
9
|
+
**ContextDB** and the ContextDB logo are trademarks of Atoms AI. The
|
|
10
|
+
Apache License is a copyright and patent license; it does not grant
|
|
11
|
+
rights to the marks (Apache License §6).
|
|
12
|
+
|
|
13
|
+
You may:
|
|
14
|
+
|
|
15
|
+
- Say you use ContextDB, cite the project, and link to this repository.
|
|
16
|
+
- State compatibility ("works with ContextDB") when that is true.
|
|
17
|
+
|
|
18
|
+
You may not, without a commercial agreement with Atoms AI:
|
|
19
|
+
|
|
20
|
+
- Offer ContextDB as a hosted or managed service, or resell it as part
|
|
21
|
+
of a service, under the ContextDB name or branding.
|
|
22
|
+
- Use ContextDB or a confusingly similar mark as the name of a competing
|
|
23
|
+
product, hosted service, or company.
|
|
24
|
+
- Use the logo or word mark to imply endorsement by Atoms AI.
|
|
25
|
+
- Register domains, social handles, or trademarks that trade on the mark.
|
|
26
|
+
|
|
27
|
+
## Resale and commercial agreements
|
|
28
|
+
|
|
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**.
|
|
36
|
+
|
|
37
|
+
## Attribution (optional)
|
|
38
|
+
|
|
39
|
+
Apache-2.0 does not require a public credit line. If you ship a product
|
|
40
|
+
that uses ContextDB and want to credit the project, the preferred form
|
|
41
|
+
is a visible **Built with ContextDB** link to
|
|
42
|
+
https://github.com/atomsai/contextdb — a courtesy, not a license
|
|
43
|
+
condition. Redistributors must still keep `LICENSE` and `NOTICE` as
|
|
44
|
+
Apache requires.
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
# Contributing to ContextDB
|
|
2
2
|
|
|
3
3
|
Thank you for wanting to improve ContextDB. This repository is the
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
not belong here.
|
|
4
|
+
Apache-2.0 ContextDB SDK: everything here works offline, with no feature
|
|
5
|
+
gates.
|
|
7
6
|
|
|
8
7
|
## What we accept here
|
|
9
8
|
|
|
10
9
|
Trust and safety correctness, local runtime fixes, adapters, docs, and
|
|
11
|
-
evals.
|
|
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`.
|
|
12
14
|
|
|
13
15
|
We do **not** accept:
|
|
14
16
|
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
- Imports of
|
|
17
|
+
- Feature gates of any kind — no license keys, no `if paid:` branches,
|
|
18
|
+
no flags that only work against a hosted service
|
|
19
|
+
- Imports of packages outside the declared dependencies
|
|
18
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
|
|
19
24
|
|
|
20
25
|
## Contributor License Agreement
|
|
21
26
|
|
|
22
27
|
Trivial changes (typos, broken links, comment nits) do not need a CLA.
|
|
23
28
|
|
|
24
29
|
**Substantial contributions** (new or material code, evals, or docs that
|
|
25
|
-
are not typo-fixes) require a signed CLA **before** merge. The CLA
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
are not typo-fixes) require a signed CLA **before** merge. The CLA grants
|
|
31
|
+
the project broad rights to distribute your contribution, including under
|
|
32
|
+
different license terms; code already released under Apache-2.0 stays
|
|
33
|
+
Apache-2.0.
|
|
29
34
|
|
|
30
35
|
1. Read [legal/CLA-individual.md](legal/CLA-individual.md) (or
|
|
31
36
|
[legal/CLA-entity.md](legal/CLA-entity.md) if you contribute on
|
|
@@ -50,7 +55,6 @@ pre-commit install
|
|
|
50
55
|
ruff check .
|
|
51
56
|
mypy contextdb --strict
|
|
52
57
|
pytest
|
|
53
|
-
python scripts/check_open_core.py
|
|
54
58
|
```
|
|
55
59
|
|
|
56
60
|
Do not break `contextdb.init`, `factual.add`, `factual.recall`, or
|
|
@@ -58,9 +62,8 @@ Do not break `contextdb.init`, `factual.add`, `factual.recall`, or
|
|
|
58
62
|
|
|
59
63
|
## Review
|
|
60
64
|
|
|
61
|
-
[`.github/CODEOWNERS`](.github/CODEOWNERS) routes reviews.
|
|
62
|
-
|
|
63
|
-
need a maintainer.
|
|
65
|
+
[`.github/CODEOWNERS`](.github/CODEOWNERS) routes reviews. `LICENSE`,
|
|
66
|
+
`NOTICE`, `legal/`, and the workflows need a maintainer.
|
|
64
67
|
|
|
65
68
|
## License of your contribution
|
|
66
69
|
|
|
@@ -6,4 +6,5 @@ Licensed under the Apache License, Version 2.0. See LICENSE.
|
|
|
6
6
|
|
|
7
7
|
ContextDB and the ContextDB logo are trademarks of Atoms AI.
|
|
8
8
|
The Apache License does not grant permission to use the ContextDB
|
|
9
|
-
trademarks.
|
|
9
|
+
trademarks. For trademark and commercial licensing (including resale
|
|
10
|
+
or hosted services), contact contextdb@atomsai.com. See COMMERCIAL.md.
|
|
@@ -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.2
|
|
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
|
|
@@ -33,7 +33,10 @@ Requires-Dist: neo4j>=5.0; extra == 'all'
|
|
|
33
33
|
Requires-Dist: pgvector>=0.2; extra == 'all'
|
|
34
34
|
Requires-Dist: redis>=5.0; extra == 'all'
|
|
35
35
|
Requires-Dist: sentence-transformers>=2.0; extra == 'all'
|
|
36
|
+
Requires-Dist: starlette>=0.37; extra == 'all'
|
|
37
|
+
Requires-Dist: uvicorn>=0.27; extra == 'all'
|
|
36
38
|
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
37
40
|
Requires-Dist: hypothesis>=6.0; extra == 'dev'
|
|
38
41
|
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
39
42
|
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
@@ -41,6 +44,7 @@ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
|
41
44
|
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
42
45
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
43
46
|
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
47
|
+
Requires-Dist: starlette>=0.37; extra == 'dev'
|
|
44
48
|
Provides-Extra: faiss
|
|
45
49
|
Requires-Dist: faiss-cpu>=1.7; extra == 'faiss'
|
|
46
50
|
Provides-Extra: local
|
|
@@ -55,6 +59,9 @@ Requires-Dist: redis>=5.0; extra == 'redis'
|
|
|
55
59
|
Provides-Extra: rl
|
|
56
60
|
Requires-Dist: torch>=2.0; extra == 'rl'
|
|
57
61
|
Requires-Dist: trl>=0.7; extra == 'rl'
|
|
62
|
+
Provides-Extra: serve
|
|
63
|
+
Requires-Dist: starlette>=0.37; extra == 'serve'
|
|
64
|
+
Requires-Dist: uvicorn>=0.27; extra == 'serve'
|
|
58
65
|
Description-Content-Type: text/markdown
|
|
59
66
|
|
|
60
67
|
<p align="center">
|
|
@@ -67,7 +74,7 @@ Description-Content-Type: text/markdown
|
|
|
67
74
|
<p align="center">
|
|
68
75
|
<a href="https://pypi.org/project/pycontextdb/"><img src="https://img.shields.io/pypi/v/pycontextdb.svg" alt="PyPI version"></a>
|
|
69
76
|
<a href="https://github.com/atomsai/contextdb/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
|
70
|
-
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-
|
|
77
|
+
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-139%20passing-brightgreen.svg" alt="Tests"></a>
|
|
71
78
|
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
|
|
72
79
|
<a href="https://github.com/atomsai/contextdb/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/mypy-strict-blue.svg" alt="Type Checked"></a>
|
|
73
80
|
<a href="https://github.com/atomsai/contextdb/blob/main/benchmarks/run_benchmarks.py"><img src="https://img.shields.io/badge/search_p95-%3C5ms_%40_5K-brightgreen.svg" alt="Search p95"></a>
|
|
@@ -95,9 +102,14 @@ Description-Content-Type: text/markdown
|
|
|
95
102
|
| **Search latency (5K memories)** | p50 **3.9ms** · p95 **5.0ms** |
|
|
96
103
|
| **Vector search (10K × 1,536d)** | p50 **0.8ms** · p95 **1.0ms** |
|
|
97
104
|
| **PII detection** | 100,000+ texts/sec |
|
|
98
|
-
| **Tests** |
|
|
105
|
+
| **Tests** | 139 passing (incl. 34 trust-model acceptance evals) · ruff clean · mypy `--strict` clean |
|
|
99
106
|
| **Dependencies** | SQLite + NumPy (FAISS / Postgres optional) |
|
|
100
107
|
|
|
108
|
+
Those search numbers are **SQLite + the in-repo mock embedder**. A recall
|
|
109
|
+
that embeds the query with OpenAI is typically **100–300ms** before the
|
|
110
|
+
store is touched. Use `embedding_cache_size`, `pip install 'pycontextdb[local]'`,
|
|
111
|
+
or `lexical_on_embed_failure` when the voice turn budget cannot wait.
|
|
112
|
+
|
|
101
113
|
Hermetic, reproducible — run the suite yourself: `python benchmarks/run_benchmarks.py`.
|
|
102
114
|
|
|
103
115
|
---
|
|
@@ -549,7 +561,7 @@ Numbers above are from a MacBook-class laptop with no FAISS. Rerun `python bench
|
|
|
549
561
|
|
|
550
562
|
## Why not just use...
|
|
551
563
|
|
|
552
|
-
**Mem0?** Their graph intelligence is a commercial add-on. ContextDB ships experiential memory, working-memory paging, and the trust bar in the Apache SDK
|
|
564
|
+
**Mem0?** Their graph intelligence is a commercial add-on. ContextDB ships experiential memory, working-memory paging, and the trust bar in the Apache SDK.
|
|
553
565
|
|
|
554
566
|
**Zep?** Strong bitemporal knowledge graphs. But no experiential memory, no working memory paging, no learned retrieval policies. Scope is narrower than a full memory OS.
|
|
555
567
|
|
|
@@ -588,19 +600,44 @@ Python 3.10+. No system dependencies for the default install — SQLite and NumP
|
|
|
588
600
|
|
|
589
601
|
---
|
|
590
602
|
|
|
591
|
-
##
|
|
603
|
+
## HTTP and multi-tenant hosts
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
pip install 'pycontextdb[serve]'
|
|
607
|
+
contextdb serve --http --port 8080 --token "$CONTEXTDB_SERVE_TOKEN"
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
One process, many users: `init()` without `user_id`, then pass `user_id=`
|
|
611
|
+
on each call (or `X-ContextDB-User` on HTTP). Postgres:
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
pip install 'pycontextdb[postgres]'
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
```python
|
|
618
|
+
db = contextdb.init(storage_url="postgresql://...")
|
|
619
|
+
```
|
|
620
|
+
|
|
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
|
+
|
|
624
|
+
## License and attribution
|
|
592
625
|
|
|
593
|
-
The SDK, trust model, and evals are Apache-2.0
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
626
|
+
The SDK, trust model, and evals are Apache-2.0 — everything described in
|
|
627
|
+
this README ships in this tree, with no feature gates. **ContextDB** is a
|
|
628
|
+
trademark; the Apache license is not a trademark license. Reselling
|
|
629
|
+
ContextDB as a service, or as part of one, under the ContextDB name or
|
|
630
|
+
branding requires a commercial agreement with Atoms AI — contact
|
|
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
|
|
634
|
+
credit line is optional — if you want one, use **Built with ContextDB**
|
|
635
|
+
linking to this repository.
|
|
599
636
|
|
|
600
637
|
## Contributing
|
|
601
638
|
|
|
602
639
|
Apache 2.0 — see [LICENSE](https://github.com/atomsai/contextdb/blob/main/LICENSE).
|
|
603
|
-
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)).
|
|
604
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).
|
|
605
642
|
|
|
606
643
|
**Local setup:**
|