pycontextdb 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pycontextdb-0.2.0/.github/CODEOWNERS +16 -0
- pycontextdb-0.2.0/.github/pull_request_template.md +11 -0
- pycontextdb-0.2.0/.github/workflows/ci.yml +78 -0
- pycontextdb-0.2.0/.github/workflows/publish.yml +60 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/.gitignore +15 -0
- pycontextdb-0.2.0/.pre-commit-config.yaml +31 -0
- pycontextdb-0.2.0/CHANGELOG.md +49 -0
- pycontextdb-0.2.0/COMMERCIAL.md +78 -0
- pycontextdb-0.2.0/CONTRIBUTING.md +69 -0
- pycontextdb-0.2.0/NOTICE +9 -0
- pycontextdb-0.2.0/OPEN_CORE.md +107 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/PKG-INFO +68 -24
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/README.md +63 -20
- pycontextdb-0.2.0/ai-tools/README.md +29 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/hero.png +0 -0
- pycontextdb-0.2.0/benchmarks/__init__.py +1 -0
- pycontextdb-0.2.0/benchmarks/trust_bakeoff.py +613 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/__init__.py +22 -2
- pycontextdb-0.2.0/contextdb/client.py +1186 -0
- pycontextdb-0.2.0/contextdb/core/clock.py +43 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/core/config.py +37 -2
- pycontextdb-0.2.0/contextdb/core/models.py +339 -0
- pycontextdb-0.2.0/contextdb/core/policy.py +138 -0
- pycontextdb-0.2.0/contextdb/core/slots.py +255 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/dynamics/evolution.py +28 -1
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/dynamics/formation.py +68 -7
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/dynamics/retrieval.py +121 -9
- pycontextdb-0.2.0/contextdb/dynamics/salience.py +78 -0
- pycontextdb-0.2.0/contextdb/dynamics/trust.py +362 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/integrations/__init__.py +6 -1
- pycontextdb-0.2.0/contextdb/integrations/act.py +103 -0
- pycontextdb-0.2.0/contextdb/integrations/livekit.py +67 -0
- pycontextdb-0.2.0/contextdb/integrations/pipecat.py +114 -0
- pycontextdb-0.2.0/contextdb/integrations/prompting.py +72 -0
- pycontextdb-0.2.0/contextdb/mcp.py +221 -0
- pycontextdb-0.2.0/contextdb/memory/factual.py +135 -0
- pycontextdb-0.2.0/contextdb/privacy/injection.py +43 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/store/base.py +6 -2
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/store/sqlite_store.py +401 -45
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/store/vector_index.py +10 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/utils/embeddings.py +28 -6
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/utils/llm.py +87 -5
- pycontextdb-0.2.0/docs/api.md +87 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/docs/architecture.md +32 -7
- pycontextdb-0.2.0/docs/index.md +53 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/docs/prompts.md +40 -8
- pycontextdb-0.2.0/docs/quickstart.md +74 -0
- pycontextdb-0.2.0/legal/CLA-entity.md +67 -0
- pycontextdb-0.2.0/legal/CLA-individual.md +66 -0
- pycontextdb-0.2.0/legal/signed/README.md +3 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/pyproject.toml +57 -4
- pycontextdb-0.2.0/scripts/check_open_core.py +223 -0
- pycontextdb-0.2.0/tests/evals/test_trust_model.py +1348 -0
- pycontextdb-0.2.0/tests/test_version.py +18 -0
- pycontextdb-0.2.0/tests/unit/test_evolution.py +43 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_init.py +2 -1
- pycontextdb-0.2.0/tests/unit/test_open_core_boundary.py +28 -0
- pycontextdb-0.2.0/tests/unit/test_trust_policy.py +103 -0
- pycontextdb-0.1.0/.github/workflows/ci.yml +0 -39
- pycontextdb-0.1.0/agentic-memory-complete-deep-dive.md +0 -850
- pycontextdb-0.1.0/agentic-memory-deep-dive.md +0 -455
- pycontextdb-0.1.0/assets/Untitled 2.rtf +0 -8
- pycontextdb-0.1.0/contextdb/client.py +0 -516
- pycontextdb-0.1.0/contextdb/core/models.py +0 -151
- pycontextdb-0.1.0/contextdb/memory/factual.py +0 -58
- pycontextdb-0.1.0/contextdb-business-strategy.md +0 -465
- pycontextdb-0.1.0/contextdb-cursor-prompt.md +0 -2317
- pycontextdb-0.1.0/contextdb-paper.pdf +0 -0
- pycontextdb-0.1.0/contextdb-prd.md +0 -837
- pycontextdb-0.1.0/docs/api.md +0 -50
- pycontextdb-0.1.0/docs/index.md +0 -34
- pycontextdb-0.1.0/docs/quickstart.md +0 -48
- pycontextdb-0.1.0/prompts for users/.cursorrules +0 -49
- pycontextdb-0.1.0/prompts for users/.github/copilot-instructions.md +0 -34
- pycontextdb-0.1.0/prompts for users/CLAUDE.md +0 -42
- pycontextdb-0.1.0/prompts for users/llms-full.txt +0 -226
- pycontextdb-0.1.0/prompts for users/llms.txt +0 -85
- pycontextdb-0.1.0/prompts for users/prompts.md +0 -319
- pycontextdb-0.1.0/tests/test_version.py +0 -9
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/.github/copilot-instructions.md +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/LICENSE +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0/ai-tools}/.cursorrules +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0/ai-tools}/CLAUDE.md +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0/ai-tools}/llms-full.txt +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0/ai-tools}/llms.txt +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/README.md +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/architecture.png +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/benchmarks.png +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/performance.png +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/problem.png +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/assets/quickstart.png +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/benchmarks/run_benchmarks.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/agents/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/agents/memory_bus.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/agents/rl_manager.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/cli.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/core/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/core/exceptions.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/dynamics/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/base.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/causal.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/entity.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/semantic.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/graphs/temporal.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/integrations/autogen.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/integrations/crewai.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/integrations/langchain.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/integrations/openai_tools.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/memory/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/memory/experiential.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/memory/working.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/privacy/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/privacy/audit.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/privacy/pii_detector.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/privacy/retention.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/py.typed +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/store/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/utils/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/contextdb/utils/migrations.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/examples/customer_support.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/examples/multi_agent_team.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/examples/phone_agent.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/examples/research_assistant.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/mkdocs.yml +0 -0
- {pycontextdb-0.1.0/benchmarks → pycontextdb-0.2.0/tests}/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/conftest.py +0 -0
- {pycontextdb-0.1.0/tests → pycontextdb-0.2.0/tests/evals}/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/integration/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/integration/test_client.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/integration/test_langchain_integration.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/__init__.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_audit.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_config.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_embeddings.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_formation.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_graphs.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_memory_bus.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_models.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_pii_detector.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_retention.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_retrieval.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_store.py +0 -0
- {pycontextdb-0.1.0 → pycontextdb-0.2.0}/tests/unit/test_vector_index.py +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Maintainer review on the open-core SDK and on anything that could
|
|
2
|
+
# move the Apache / Cloud boundary or ship a bad PyPI artifact.
|
|
3
|
+
# Username: https://github.com/gaufire
|
|
4
|
+
|
|
5
|
+
* @gaufire
|
|
6
|
+
|
|
7
|
+
/.github/ @gaufire
|
|
8
|
+
/legal/ @gaufire
|
|
9
|
+
/scripts/check_open_core.py @gaufire
|
|
10
|
+
/OPEN_CORE.md @gaufire
|
|
11
|
+
/COMMERCIAL.md @gaufire
|
|
12
|
+
/NOTICE @gaufire
|
|
13
|
+
/LICENSE @gaufire
|
|
14
|
+
/CONTRIBUTING.md @gaufire
|
|
15
|
+
/pyproject.toml @gaufire
|
|
16
|
+
/contextdb/ @gaufire
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What changed, and why. Evals win over prose. -->
|
|
4
|
+
|
|
5
|
+
## Open-core checklist
|
|
6
|
+
|
|
7
|
+
- [ ] I have read OPEN_CORE.md. This PR does not add cloud, billing, SSO, or entitlement code to the Apache tree.
|
|
8
|
+
- [ ] The SDK still does not import `contextdb_cloud` or any cloud control plane.
|
|
9
|
+
- [ ] No new local paid / license-key / entitlement boolean.
|
|
10
|
+
- [ ] Substantial contribution: I agree to the CLA in CONTRIBUTING.md (legal name and email in this description). Trivial typo PRs may skip this.
|
|
11
|
+
- [ ] `pytest tests/evals/ -v` and `python scripts/check_open_core.py` pass, or I explain why not.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# Gitleaks + pre-commit checks. Scans the staged diff (and on CI the
|
|
11
|
+
# full history via --no-git-log=false by default) for tokens. Runs in
|
|
12
|
+
# parallel with `test` so secret leaks fail the PR even if contributors
|
|
13
|
+
# skipped `pre-commit install` locally.
|
|
14
|
+
secret-scan:
|
|
15
|
+
name: Secret scan (gitleaks + pre-commit)
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
# gitleaks needs the full history to scan across commits,
|
|
21
|
+
# not just the shallow checkout.
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
cache: pip
|
|
28
|
+
|
|
29
|
+
- name: Install pre-commit
|
|
30
|
+
run: pip install pre-commit
|
|
31
|
+
|
|
32
|
+
- name: Run pre-commit on all files
|
|
33
|
+
run: pre-commit run --all-files --show-diff-on-failure
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
strategy:
|
|
39
|
+
fail-fast: false
|
|
40
|
+
matrix:
|
|
41
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
47
|
+
uses: actions/setup-python@v5
|
|
48
|
+
with:
|
|
49
|
+
python-version: ${{ matrix.python-version }}
|
|
50
|
+
cache: pip
|
|
51
|
+
|
|
52
|
+
- name: Install package and dev dependencies
|
|
53
|
+
run: |
|
|
54
|
+
python -m pip install --upgrade pip
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
|
|
57
|
+
- name: Lint with ruff
|
|
58
|
+
run: ruff check .
|
|
59
|
+
|
|
60
|
+
- name: Type-check with mypy
|
|
61
|
+
run: mypy contextdb --python-version ${{ matrix.python-version }}
|
|
62
|
+
|
|
63
|
+
- name: Run tests
|
|
64
|
+
run: pytest
|
|
65
|
+
|
|
66
|
+
open-core:
|
|
67
|
+
name: Open-core boundary
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
|
|
72
|
+
- name: Set up Python
|
|
73
|
+
uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: "3.12"
|
|
76
|
+
|
|
77
|
+
- name: Package-boundary and accidental-publication checks
|
|
78
|
+
run: python scripts/check_open_core.py
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
inspect:
|
|
12
|
+
name: Inspect package contents
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
|
|
22
|
+
- name: Install build
|
|
23
|
+
run: python -m pip install --upgrade build
|
|
24
|
+
|
|
25
|
+
- name: Build sdist and wheel
|
|
26
|
+
run: python -m build
|
|
27
|
+
|
|
28
|
+
- name: Open-core and accidental-publication inspection
|
|
29
|
+
run: |
|
|
30
|
+
python scripts/check_open_core.py --dist dist --release-tag "${{ github.event.release.tag_name }}"
|
|
31
|
+
|
|
32
|
+
- name: Upload dist artifacts
|
|
33
|
+
uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: python-package-distributions
|
|
36
|
+
path: dist/
|
|
37
|
+
|
|
38
|
+
publish:
|
|
39
|
+
name: Publish to PyPI
|
|
40
|
+
needs: inspect
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
|
|
43
|
+
# Trusted-publisher flow: PyPI verifies this workflow via OIDC.
|
|
44
|
+
# Require reviewers on this GitHub Environment so a published tag
|
|
45
|
+
# cannot reach PyPI without a human (OPEN_CORE.md).
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/project/pycontextdb/
|
|
49
|
+
permissions:
|
|
50
|
+
id-token: write
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- name: Download dist artifacts
|
|
54
|
+
uses: actions/download-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: python-package-distributions
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
- name: Publish to PyPI
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -55,3 +55,18 @@ Thumbs.db
|
|
|
55
55
|
*.sqlite3
|
|
56
56
|
team.db
|
|
57
57
|
contextdb.db
|
|
58
|
+
|
|
59
|
+
# Secrets and scratch files — the 0.1.0 PyPI release shipped a .rtf
|
|
60
|
+
# containing a token because these patterns were not gated anywhere.
|
|
61
|
+
*.rtf
|
|
62
|
+
*.key
|
|
63
|
+
*.pem
|
|
64
|
+
*.p12
|
|
65
|
+
.env
|
|
66
|
+
.env.*
|
|
67
|
+
secrets/
|
|
68
|
+
Untitled*
|
|
69
|
+
|
|
70
|
+
# CLA acceptances (personal data — keep out of the sdist)
|
|
71
|
+
legal/signed/*
|
|
72
|
+
!legal/signed/README.md
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Run locally before each commit:
|
|
2
|
+
# pip install -e ".[dev]"
|
|
3
|
+
# pre-commit install
|
|
4
|
+
#
|
|
5
|
+
# Then every git commit is gated on the hooks below. CI also runs them
|
|
6
|
+
# via .github/workflows/ci.yml, so skipping locally is only a temporary
|
|
7
|
+
# papercut — the PR will fail.
|
|
8
|
+
|
|
9
|
+
repos:
|
|
10
|
+
# Secret scanning — the reason this file exists. Gitleaks scans the
|
|
11
|
+
# staged diff for tokens (PyPI, GitHub, AWS, Stripe, Slack, generic
|
|
12
|
+
# entropy-high strings, ...). First run auto-downloads the binary.
|
|
13
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
14
|
+
rev: v8.30.0
|
|
15
|
+
hooks:
|
|
16
|
+
- id: gitleaks
|
|
17
|
+
|
|
18
|
+
# Lightweight second-layer checks from the standard pre-commit-hooks
|
|
19
|
+
# repo. `detect-private-key` catches PEM-style keys that gitleaks'
|
|
20
|
+
# default rules occasionally miss in non-standard encodings.
|
|
21
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
22
|
+
rev: v6.0.0
|
|
23
|
+
hooks:
|
|
24
|
+
- id: detect-private-key
|
|
25
|
+
- id: check-added-large-files
|
|
26
|
+
args: ["--maxkb=2048"]
|
|
27
|
+
- id: end-of-file-fixer
|
|
28
|
+
- id: trailing-whitespace
|
|
29
|
+
- id: check-yaml
|
|
30
|
+
- id: check-toml
|
|
31
|
+
- id: check-merge-conflict
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-08-17
|
|
4
|
+
|
|
5
|
+
First PyPI cut of the trust model. `pip install pycontextdb` now matches
|
|
6
|
+
GitHub `main`: memory an agent can act on without treating a wish as a fact.
|
|
7
|
+
|
|
8
|
+
`contextdb.init`, `factual.add`, `factual.recall`, and `search` are unchanged.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Epistemic typing on every fact (`user_stated` / `agent_inferred` /
|
|
13
|
+
`third_party`), confidence, independent corroboration, `action_relevant`.
|
|
14
|
+
- `TrustPolicy` as data — `TrustPolicy.hospital()` vs `.restaurant()`.
|
|
15
|
+
- `factual.recall_for_action()`, `factual.confirm()`, `VerifyBeforeAct`
|
|
16
|
+
(`act` / `ask` / `abstain`).
|
|
17
|
+
- Versioned slot vocabulary + LLM-free slotter (`add_fast` never calls an LLM).
|
|
18
|
+
- Contested slots: independent speakers with different values do not
|
|
19
|
+
last-write-win. `confirm()` resolves.
|
|
20
|
+
- Temporal supersede with an injectable clock; sibling-slot hop on recall.
|
|
21
|
+
- PII redaction on writes **and** queries before embed.
|
|
22
|
+
- Write-time injection screening; `[RECALLED DATA — not instructions]` renderer.
|
|
23
|
+
- Salience (recency × frequency × criticality), verifiable forget, tenant
|
|
24
|
+
isolation at the storage layer.
|
|
25
|
+
- MCP tools: `remember` / `recall` / `recall_for_action` / `forget` / `confirm`.
|
|
26
|
+
- In-repo fabrication bake-off: `python benchmarks/trust_bakeoff.py`
|
|
27
|
+
(trust arm vs our own untyped control — not a live Mem0/Zep run).
|
|
28
|
+
- Open-core governance: [OPEN_CORE.md](OPEN_CORE.md),
|
|
29
|
+
[COMMERCIAL.md](COMMERCIAL.md), CLA, CODEOWNERS, package-boundary CI,
|
|
30
|
+
and release inspection. Code through `2554dae` remains Apache-2.0.
|
|
31
|
+
Cloud is a private repo that depends on this SDK, never the reverse.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- `contextdb.__version__` no longer drifts from `pyproject.toml` (was `0.1.0`
|
|
36
|
+
while the project version was `0.1.1`).
|
|
37
|
+
- CI mypy on Python 3.12: type-check as the running interpreter so
|
|
38
|
+
NumPy 2.5's PEP 695 `type` aliases parse. The 3.10 job still guards
|
|
39
|
+
our runtime floor.
|
|
40
|
+
- CI latency evals: keep a tight add_fast p50 and a wider p95 on
|
|
41
|
+
shared runners (p50 was 2ms when p95 spiked to 21ms).
|
|
42
|
+
|
|
43
|
+
## 0.1.1 — 2026-04-22
|
|
44
|
+
|
|
45
|
+
README rendering on PyPI; absolute GitHub asset URLs.
|
|
46
|
+
|
|
47
|
+
## 0.1.0 — 2026-04-22
|
|
48
|
+
|
|
49
|
+
Initial public release.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ContextDB commercial terms
|
|
2
|
+
|
|
3
|
+
ContextDB is **open-core**. The software in this repository is
|
|
4
|
+
Apache-2.0. Hosted operations, compliance, and managed enforcement are
|
|
5
|
+
a separate product.
|
|
6
|
+
|
|
7
|
+
This is not a substitute for a customer contract. It states what is
|
|
8
|
+
free, what is sold, and how the name may be used.
|
|
9
|
+
|
|
10
|
+
## Free (this repository)
|
|
11
|
+
|
|
12
|
+
`pip install pycontextdb` (and this GitHub tree) includes:
|
|
13
|
+
|
|
14
|
+
- The full local SDK and CLI
|
|
15
|
+
- Epistemic typing, `TrustPolicy`, `VerifyBeforeAct`, `confirm()`
|
|
16
|
+
- SQLite runtime, backend interfaces, `add_fast`, recall, forget, export
|
|
17
|
+
- Stock adapters (Pipecat, LiveKit, MCP, …) and prompt-injection defenses
|
|
18
|
+
- Baseline policies and the public eval / bake-off suite
|
|
19
|
+
|
|
20
|
+
There is **no license key**. There is **no local paid boolean**. If a
|
|
21
|
+
flag exists in `ContextDBConfig`, it is an optional local pathway, not
|
|
22
|
+
an entitlement.
|
|
23
|
+
|
|
24
|
+
## Paid (ContextDB Cloud)
|
|
25
|
+
|
|
26
|
+
Sold from the private `contextdb-cloud` control plane, enforced
|
|
27
|
+
**server-side**:
|
|
28
|
+
|
|
29
|
+
- Hosted multi-tenant runtime and managed storage / indexing
|
|
30
|
+
- Organizations, projects, API keys, entitlements
|
|
31
|
+
- SSO, SCIM, RBAC, approval workflows
|
|
32
|
+
- Policy deployment, versioning, canaries, rollback
|
|
33
|
+
- Audit retention, signed exports, compliance evidence
|
|
34
|
+
- Managed confirmation workflows and SLAs
|
|
35
|
+
- Customer-transcript evaluation and trust reports
|
|
36
|
+
- Proprietary ranking / consolidation models
|
|
37
|
+
- Regional hosting, backups, HA, observability, support
|
|
38
|
+
- PyAI-native managed memory and voice-path enforcement
|
|
39
|
+
|
|
40
|
+
Cloud **depends on** the open SDK. The SDK **never** depends on cloud.
|
|
41
|
+
See [OPEN_CORE.md](OPEN_CORE.md).
|
|
42
|
+
|
|
43
|
+
## Trademark
|
|
44
|
+
|
|
45
|
+
**ContextDB** and the ContextDB logo are trademarks of Atoms AI.
|
|
46
|
+
|
|
47
|
+
The Apache License 2.0 grants rights to the *software*. It does **not**
|
|
48
|
+
grant rights to the *marks* (Apache License §6).
|
|
49
|
+
|
|
50
|
+
You may:
|
|
51
|
+
|
|
52
|
+
- Say you use ContextDB
|
|
53
|
+
- Cite the project and link to this repository
|
|
54
|
+
- State compatibility (“works with ContextDB”) when that is true
|
|
55
|
+
|
|
56
|
+
You may not, without written permission:
|
|
57
|
+
|
|
58
|
+
- Use ContextDB or confusingly similar names as the name of a competing
|
|
59
|
+
product, hosted service, or company
|
|
60
|
+
- Use the logo or word mark to imply Atoms AI endorsement
|
|
61
|
+
- Register domains, social handles, or trademarks that trade on the mark
|
|
62
|
+
|
|
63
|
+
File notices and the [NOTICE](NOTICE) file exist so redistributors keep
|
|
64
|
+
this distinction visible.
|
|
65
|
+
|
|
66
|
+
## Dual licensing
|
|
67
|
+
|
|
68
|
+
Code published through `2554dae` is Apache-2.0 forever, including forks
|
|
69
|
+
already taken. New substantial contributions to *this* repo are accepted
|
|
70
|
+
only under the CLA in [CONTRIBUTING.md](CONTRIBUTING.md) so Atoms AI can
|
|
71
|
+
relicense *future* work if needed. That does not revoke Apache-2.0 on
|
|
72
|
+
anything already released.
|
|
73
|
+
|
|
74
|
+
## Contact
|
|
75
|
+
|
|
76
|
+
- Product and Cloud: Gaurav Sharma — gaurav@saaslabs.co
|
|
77
|
+
- Issues (SDK): https://github.com/atomsai/contextdb/issues
|
|
78
|
+
- Trademark misuse: the same address, subject `ContextDB trademark`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Contributing to ContextDB
|
|
2
|
+
|
|
3
|
+
Thank you for wanting to improve ContextDB. This repository is the
|
|
4
|
+
**open-core SDK**. Read [OPEN_CORE.md](OPEN_CORE.md) before you write
|
|
5
|
+
code. If the change belongs in hosted multi-tenant operations, it does
|
|
6
|
+
not belong here.
|
|
7
|
+
|
|
8
|
+
## What we accept here
|
|
9
|
+
|
|
10
|
+
Trust and safety correctness, local runtime fixes, adapters, docs, and
|
|
11
|
+
evals. Evals win over prose: `pytest tests/evals/ -v`.
|
|
12
|
+
|
|
13
|
+
We do **not** accept:
|
|
14
|
+
|
|
15
|
+
- Cloud control-plane, billing, SSO, or entitlement code
|
|
16
|
+
- Local license keys or `if paid:` branches
|
|
17
|
+
- Imports of `contextdb_cloud` or any private cloud package
|
|
18
|
+
- Changes that loosen PII-before-embed or the hash-chained audit log
|
|
19
|
+
|
|
20
|
+
## Contributor License Agreement
|
|
21
|
+
|
|
22
|
+
Trivial changes (typos, broken links, comment nits) do not need a CLA.
|
|
23
|
+
|
|
24
|
+
**Substantial contributions** (new or material code, evals, or docs that
|
|
25
|
+
are not typo-fixes) require a signed CLA **before** merge. The CLA lets
|
|
26
|
+
Atoms AI relicense *future* contributions if dual-licensing ever
|
|
27
|
+
matters. It does not change the Apache-2.0 grant on code already
|
|
28
|
+
public through `2554dae`.
|
|
29
|
+
|
|
30
|
+
1. Read [legal/CLA-individual.md](legal/CLA-individual.md) (or
|
|
31
|
+
[legal/CLA-entity.md](legal/CLA-entity.md) if you contribute on
|
|
32
|
+
behalf of an employer).
|
|
33
|
+
2. Open a pull request whose description includes:
|
|
34
|
+
|
|
35
|
+
> I have read and agree to the ContextDB CLA
|
|
36
|
+
> (legal/CLA-individual.md or legal/CLA-entity.md).
|
|
37
|
+
> Legal name: \<name\>. Email: \<email\>.
|
|
38
|
+
|
|
39
|
+
3. Maintainers record acceptances under `legal/signed/` (gitignored
|
|
40
|
+
from the sdist; not a public dump of personal data).
|
|
41
|
+
|
|
42
|
+
We may enable a CLA bot later. The requirement is the signature, not
|
|
43
|
+
the bot.
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install -e ".[dev]"
|
|
49
|
+
pre-commit install
|
|
50
|
+
ruff check .
|
|
51
|
+
mypy contextdb --strict
|
|
52
|
+
pytest
|
|
53
|
+
python scripts/check_open_core.py
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Do not break `contextdb.init`, `factual.add`, `factual.recall`, or
|
|
57
|
+
`search`. New fields need backward-compatible defaults.
|
|
58
|
+
|
|
59
|
+
## Review
|
|
60
|
+
|
|
61
|
+
[`.github/CODEOWNERS`](.github/CODEOWNERS) routes reviews. Governance
|
|
62
|
+
files (`OPEN_CORE.md`, `COMMERCIAL.md`, `LICENSE`, `legal/`, workflows)
|
|
63
|
+
need a maintainer.
|
|
64
|
+
|
|
65
|
+
## License of your contribution
|
|
66
|
+
|
|
67
|
+
By opening a substantial PR you agree the contribution is your original
|
|
68
|
+
work (or you have the right to submit it) and you offer it under
|
|
69
|
+
Apache-2.0 **and** the CLA.
|
pycontextdb-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ContextDB
|
|
2
|
+
Copyright 2026 Atoms AI and contributors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Atoms AI and contributors.
|
|
5
|
+
Licensed under the Apache License, Version 2.0. See LICENSE.
|
|
6
|
+
|
|
7
|
+
ContextDB and the ContextDB logo are trademarks of Atoms AI.
|
|
8
|
+
The Apache License does not grant permission to use the ContextDB
|
|
9
|
+
trademarks. See COMMERCIAL.md.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# ContextDB open-core boundary
|
|
2
|
+
|
|
3
|
+
**Decision:** ContextDB remains open-core.
|
|
4
|
+
|
|
5
|
+
All code public through commit `2554dae` remains Apache-2.0. This
|
|
6
|
+
repository stays Apache-2.0. New work in *this* tree is the community
|
|
7
|
+
SDK. Hosted operations live in a private `contextdb-cloud` repository
|
|
8
|
+
that **depends on** this SDK and that this SDK **must never** depend on.
|
|
9
|
+
|
|
10
|
+
The evals in `tests/evals/test_trust_model.py` are the spec for trust
|
|
11
|
+
and safety. Monetize operating, proving, and governing that spec — not
|
|
12
|
+
hiding it.
|
|
13
|
+
|
|
14
|
+
## Public — `atomsai/contextdb` (this repo)
|
|
15
|
+
|
|
16
|
+
Apache-2.0. Anyone may use, modify, and ship it under that license.
|
|
17
|
+
|
|
18
|
+
- Epistemic types, provenance, and corroboration
|
|
19
|
+
- `TrustPolicy`, `VerifyBeforeAct`, `decide()`, and confirmation APIs
|
|
20
|
+
- Local SQLite runtime and backend interfaces
|
|
21
|
+
- `add_fast`, recall, deletion, and export
|
|
22
|
+
- Safe Pipecat, LiveKit, and agent adapters
|
|
23
|
+
- Prompt rendering and injection defenses
|
|
24
|
+
- Baseline policy implementations (`TrustPolicy.hospital()`, `.restaurant()`)
|
|
25
|
+
- Trust evals, fabrication benchmarks, and synthetic fixtures
|
|
26
|
+
- Community SDK, CLI, and documentation
|
|
27
|
+
|
|
28
|
+
Local feature flags (`enable_multi_graph`, `enable_rl_manager`, …) are
|
|
29
|
+
**optional pathways in the open SDK**. They are not entitlements. They
|
|
30
|
+
must never consult a license key, a cloud control plane, or a “paid”
|
|
31
|
+
boolean.
|
|
32
|
+
|
|
33
|
+
## Private — `contextdb-cloud`
|
|
34
|
+
|
|
35
|
+
Not in this tree. Cloud depends on `pycontextdb`. The SDK does not
|
|
36
|
+
import it.
|
|
37
|
+
|
|
38
|
+
- Hosted, multi-tenant runtime
|
|
39
|
+
- Managed distributed storage and indexing
|
|
40
|
+
- Organization, project, API-key, and entitlement control plane
|
|
41
|
+
- SSO, SCIM, RBAC, and approval workflows
|
|
42
|
+
- Policy deployment, versioning, canaries, and rollback
|
|
43
|
+
- Audit retention, signed exports, and compliance evidence
|
|
44
|
+
- Managed human-confirmation workflows and SLAs
|
|
45
|
+
- Customer-transcript evaluation and trust reports
|
|
46
|
+
- Advanced proprietary ranking / consolidation models
|
|
47
|
+
- Regional hosting, backups, HA, observability, and support
|
|
48
|
+
- PyAI-native managed memory and voice-path enforcement
|
|
49
|
+
|
|
50
|
+
## Hard rules
|
|
51
|
+
|
|
52
|
+
1. **Dependency direction.** Cloud may import `contextdb`. `contextdb`
|
|
53
|
+
must not import cloud, billing, or entitlement packages.
|
|
54
|
+
2. **No premium-in-Apache.** Do not place cloud code in this repo behind
|
|
55
|
+
feature flags. If it is here, it is Apache-2.0.
|
|
56
|
+
3. **Entitlements are server-side.** Never a local boolean, license
|
|
57
|
+
file, or compiled-in key. A checkout of this repo can do everything
|
|
58
|
+
the SDK documents, offline.
|
|
59
|
+
4. **Trust and safety stay open.** Typing, corroboration, contest,
|
|
60
|
+
`VerifyBeforeAct`, PII-before-embed, injection rendering, forget, and
|
|
61
|
+
the evals that lock those behaviors are not paid features.
|
|
62
|
+
5. **Trademark.** Apache-2.0 is a copyright and patent license, not a
|
|
63
|
+
trademark license. See [COMMERCIAL.md](COMMERCIAL.md) and [NOTICE](NOTICE).
|
|
64
|
+
6. **Releases.** PyPI publishes only from a GitHub Release after package
|
|
65
|
+
inspection and the `pypi` environment approval. See below.
|
|
66
|
+
7. **CLA.** Substantial external contributions require a signed CLA so
|
|
67
|
+
future dual-licensing of *new* work remains possible. Code through
|
|
68
|
+
`2554dae` is already Apache-2.0 and stays that way. See
|
|
69
|
+
[CONTRIBUTING.md](CONTRIBUTING.md).
|
|
70
|
+
|
|
71
|
+
## What we monetize
|
|
72
|
+
|
|
73
|
+
Operating the trust bar in production (hosted runtime, isolation,
|
|
74
|
+
uptime), proving it on customer transcripts, and governing it (SSO,
|
|
75
|
+
policy canaries, signed audit, confirmation SLAs). Not the correctness
|
|
76
|
+
of `decide()`.
|
|
77
|
+
|
|
78
|
+
## Release and accidental publication
|
|
79
|
+
|
|
80
|
+
- `scripts/check_open_core.py` — import direction, forbidden paths,
|
|
81
|
+
no local entitlement fields, sdist/wheel denylist.
|
|
82
|
+
- CI job **Open-core boundary** runs the source checks on every push
|
|
83
|
+
and pull request to `main`.
|
|
84
|
+
- `publish.yml` builds the distributions, inspects them, checks the
|
|
85
|
+
release tag against `pyproject.toml`, then publishes only after the
|
|
86
|
+
GitHub Environment `pypi` is approved.
|
|
87
|
+
- Hatch excludes secrets, keys, and stray scratch files from sdist and
|
|
88
|
+
wheel (the 0.1.0 release shipped a token in an `.rtf`; that must not
|
|
89
|
+
happen again).
|
|
90
|
+
- [`.github/CODEOWNERS`](.github/CODEOWNERS) requires a maintainer
|
|
91
|
+
review on governance, license, and the SDK tree.
|
|
92
|
+
|
|
93
|
+
Configure the `pypi` environment with **required reviewers** so a
|
|
94
|
+
published tag cannot reach PyPI without a human.
|
|
95
|
+
|
|
96
|
+
## Moving a feature across the boundary
|
|
97
|
+
|
|
98
|
+
- **SDK → cloud:** delete it from this repo in a public commit. Do not
|
|
99
|
+
leave a stub that phones home.
|
|
100
|
+
- **Cloud → SDK:** land it here as Apache-2.0 with an eval. No
|
|
101
|
+
“disabled unless entitled” branch.
|
|
102
|
+
|
|
103
|
+
## Related
|
|
104
|
+
|
|
105
|
+
- [COMMERCIAL.md](COMMERCIAL.md) — product split, trademark, contact
|
|
106
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — CLA and review
|
|
107
|
+
- [CHANGELOG.md](CHANGELOG.md) — 0.2.0 is the first trust-model PyPI cut
|