extremis 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. extremis-0.1.0/.github/workflows/ci.yml +72 -0
  2. extremis-0.1.0/.github/workflows/publish.yml +44 -0
  3. extremis-0.1.0/.gitignore +15 -0
  4. extremis-0.1.0/.python-version +1 -0
  5. extremis-0.1.0/CONTRIBUTING.md +71 -0
  6. extremis-0.1.0/Dockerfile +25 -0
  7. extremis-0.1.0/LICENSE +21 -0
  8. extremis-0.1.0/PKG-INFO +801 -0
  9. extremis-0.1.0/README.md +723 -0
  10. extremis-0.1.0/SECURITY.md +39 -0
  11. extremis-0.1.0/docker-compose.yml +34 -0
  12. extremis-0.1.0/pyproject.toml +84 -0
  13. extremis-0.1.0/src/extremis/__init__.py +15 -0
  14. extremis-0.1.0/src/extremis/api.py +277 -0
  15. extremis-0.1.0/src/extremis/client.py +248 -0
  16. extremis-0.1.0/src/extremis/config.py +67 -0
  17. extremis-0.1.0/src/extremis/consolidation/__init__.py +3 -0
  18. extremis-0.1.0/src/extremis/consolidation/consolidator.py +168 -0
  19. extremis-0.1.0/src/extremis/consolidation/prompts.py +41 -0
  20. extremis-0.1.0/src/extremis/embeddings/__init__.py +3 -0
  21. extremis-0.1.0/src/extremis/embeddings/openai.py +55 -0
  22. extremis-0.1.0/src/extremis/embeddings/sentence_transformers.py +34 -0
  23. extremis-0.1.0/src/extremis/interfaces.py +80 -0
  24. extremis-0.1.0/src/extremis/mcp/__init__.py +3 -0
  25. extremis-0.1.0/src/extremis/mcp/server.py +433 -0
  26. extremis-0.1.0/src/extremis/migrate.py +233 -0
  27. extremis-0.1.0/src/extremis/migrations/001_initial.sql +69 -0
  28. extremis-0.1.0/src/extremis/migrations/001_initial_sqlite.sql +91 -0
  29. extremis-0.1.0/src/extremis/observer/__init__.py +3 -0
  30. extremis-0.1.0/src/extremis/observer/observer.py +145 -0
  31. extremis-0.1.0/src/extremis/scorer/__init__.py +3 -0
  32. extremis-0.1.0/src/extremis/scorer/attention.py +198 -0
  33. extremis-0.1.0/src/extremis/server/__init__.py +0 -0
  34. extremis-0.1.0/src/extremis/server/app.py +156 -0
  35. extremis-0.1.0/src/extremis/server/auth.py +95 -0
  36. extremis-0.1.0/src/extremis/server/deps.py +56 -0
  37. extremis-0.1.0/src/extremis/server/routes/__init__.py +0 -0
  38. extremis-0.1.0/src/extremis/server/routes/health.py +37 -0
  39. extremis-0.1.0/src/extremis/server/routes/kg.py +54 -0
  40. extremis-0.1.0/src/extremis/server/routes/memories.py +98 -0
  41. extremis-0.1.0/src/extremis/storage/__init__.py +5 -0
  42. extremis-0.1.0/src/extremis/storage/chroma.py +237 -0
  43. extremis-0.1.0/src/extremis/storage/kg.py +250 -0
  44. extremis-0.1.0/src/extremis/storage/log.py +87 -0
  45. extremis-0.1.0/src/extremis/storage/pinecone_store.py +192 -0
  46. extremis-0.1.0/src/extremis/storage/postgres.py +254 -0
  47. extremis-0.1.0/src/extremis/storage/recall_reason.py +56 -0
  48. extremis-0.1.0/src/extremis/storage/score_index.py +56 -0
  49. extremis-0.1.0/src/extremis/storage/sqlite.py +251 -0
  50. extremis-0.1.0/src/extremis/types.py +145 -0
  51. extremis-0.1.0/tests/__init__.py +0 -0
  52. extremis-0.1.0/tests/conftest.py +80 -0
  53. extremis-0.1.0/tests/test_api.py +115 -0
  54. extremis-0.1.0/tests/test_attention.py +132 -0
  55. extremis-0.1.0/tests/test_chroma.py +101 -0
  56. extremis-0.1.0/tests/test_consolidator.py +166 -0
  57. extremis-0.1.0/tests/test_core.py +148 -0
  58. extremis-0.1.0/tests/test_hosted_client.py +81 -0
  59. extremis-0.1.0/tests/test_kg.py +179 -0
  60. extremis-0.1.0/tests/test_mcp.py +87 -0
  61. extremis-0.1.0/tests/test_migration.py +124 -0
  62. extremis-0.1.0/tests/test_namespace.py +138 -0
  63. extremis-0.1.0/tests/test_observer.py +155 -0
  64. extremis-0.1.0/tests/test_openai_embedder.py +65 -0
  65. extremis-0.1.0/tests/test_server.py +240 -0
@@ -0,0 +1,72 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_call: # allows publish.yml to reuse this job
9
+
10
+ jobs:
11
+ lint:
12
+ name: Lint (ruff)
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.11"
19
+ - run: pip install ruff
20
+ - run: ruff check src/ tests/
21
+ - run: ruff format --check src/ tests/
22
+
23
+ typecheck:
24
+ name: Type check (mypy)
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.11"
31
+ - name: Install with dev deps
32
+ run: pip install -e ".[dev]"
33
+ - run: mypy src/extremis --ignore-missing-imports
34
+
35
+ test:
36
+ name: Tests (Python ${{ matrix.python-version }})
37
+ runs-on: ubuntu-latest
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ python-version: ["3.11", "3.12"]
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: actions/setup-python@v5
45
+ with:
46
+ python-version: ${{ matrix.python-version }}
47
+ - name: Install with dev deps
48
+ run: pip install -e ".[dev]"
49
+ - name: Run tests with coverage
50
+ run: |
51
+ pytest tests/ -v --tb=short \
52
+ --cov=extremis \
53
+ --cov-report=term-missing \
54
+ --cov-fail-under=65
55
+ - name: Upload coverage
56
+ if: matrix.python-version == '3.11'
57
+ uses: actions/upload-artifact@v4
58
+ with:
59
+ name: coverage-report
60
+ path: .coverage
61
+
62
+ build:
63
+ name: Build check
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - uses: actions/setup-python@v5
68
+ with:
69
+ python-version: "3.11"
70
+ - run: pip install build twine
71
+ - run: python -m build
72
+ - run: twine check dist/*
@@ -0,0 +1,44 @@
1
+ name: Publish to PyPI
2
+
3
+ # Triggers on a git tag like v0.1.0
4
+ # CI must pass first — the `needs: ci` gate enforces this.
5
+ on:
6
+ push:
7
+ tags:
8
+ - "v*"
9
+
10
+ jobs:
11
+ ci:
12
+ uses: ./.github/workflows/ci.yml # reuse the full CI job
13
+
14
+ publish:
15
+ name: Build and publish
16
+ needs: ci # only runs if CI is green
17
+ runs-on: ubuntu-latest
18
+ environment: pypi # requires a "pypi" environment in repo settings
19
+ permissions:
20
+ id-token: write # required for PyPI trusted publisher (no API key needed)
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.11"
28
+
29
+ - name: Install build tools
30
+ run: pip install build
31
+
32
+ - name: Build wheel and sdist
33
+ run: python -m build
34
+
35
+ - name: Verify the build
36
+ run: |
37
+ pip install twine
38
+ twine check dist/*
39
+ echo "--- dist contents ---"
40
+ ls -lh dist/
41
+
42
+ - name: Publish to PyPI
43
+ uses: pypa/gh-action-pypi-publish@release/v1
44
+ # No API token needed — uses OIDC trusted publisher
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ venv/
9
+ .env
10
+ *.db
11
+ *.jsonl
12
+ ~/.friday/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,71 @@
1
+ # Contributing
2
+
3
+ Thanks for taking the time to contribute.
4
+
5
+ ## Getting started
6
+
7
+ ```bash
8
+ git clone https://github.com/ashwanijha04/extremis
9
+ cd extremis
10
+ python -m venv .venv && source .venv/bin/activate
11
+ pip install -e ".[dev]"
12
+ ```
13
+
14
+ Run the tests:
15
+ ```bash
16
+ pytest tests/ -v
17
+ ```
18
+
19
+ Run lint and type checks:
20
+ ```bash
21
+ ruff check src/ tests/
22
+ mypy src/extremis --ignore-missing-imports
23
+ ```
24
+
25
+ ## What we're looking for
26
+
27
+ **Good contributions:**
28
+ - Bug fixes with a test that would have caught the bug
29
+ - New storage backends (e.g. Redis, DynamoDB) that implement `MemoryStore`
30
+ - New embedder implementations (e.g. OpenAI, Cohere) that implement `Embedder`
31
+ - Performance improvements to the SQLite cosine search
32
+ - Documentation improvements
33
+
34
+ **Please discuss first (open an issue):**
35
+ - New memory layers or significant changes to `types.py`
36
+ - Changes to the consolidation prompt strategy
37
+ - Anything that changes the public API surface
38
+
39
+ ## How to add a new storage backend
40
+
41
+ Implement the `MemoryStore` protocol from `extremis.interfaces`:
42
+
43
+ ```python
44
+ from extremis.interfaces import MemoryStore
45
+ from extremis.types import Memory, MemoryLayer, RecallResult
46
+
47
+ class MyStore:
48
+ def store(self, memory: Memory) -> Memory: ...
49
+ def get(self, memory_id: UUID) -> Optional[Memory]: ...
50
+ def search(self, query_embedding, layers=None, limit=10, min_score=0.0) -> list[RecallResult]: ...
51
+ def update_score(self, memory_id: UUID, delta: float) -> None: ...
52
+ def supersede(self, old_id: UUID, new_memory: Memory) -> None: ...
53
+ def list_recent(self, layer=None, limit=50) -> list[Memory]: ...
54
+ ```
55
+
56
+ Add tests in `tests/test_<backend>.py`. Use the existing `test_core.py` as a reference.
57
+
58
+ ## Pull request checklist
59
+
60
+ - [ ] Tests pass (`pytest tests/ -v`)
61
+ - [ ] Lint passes (`ruff check src/ tests/`)
62
+ - [ ] New behaviour has test coverage
63
+ - [ ] No secrets or personal data in code or tests
64
+
65
+ ## Reporting bugs
66
+
67
+ Open an issue with:
68
+ 1. Python version
69
+ 2. OS
70
+ 3. Minimal reproduction script
71
+ 4. Expected vs actual behaviour
@@ -0,0 +1,25 @@
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # system deps for psycopg2
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ libpq-dev gcc \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ COPY pyproject.toml README.md LICENSE ./
11
+ COPY src/ src/
12
+
13
+ RUN pip install --no-cache-dir ".[server,postgres,openai]"
14
+
15
+ # pre-download the default embedding model so first request isn't slow
16
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" || true
17
+
18
+ ENV EXTREMIS_SERVER_HOME=/data/server
19
+ ENV EXTREMIS_STORE=sqlite
20
+ ENV EXTREMIS_HOME=/data
21
+
22
+ VOLUME ["/data"]
23
+ EXPOSE 8000
24
+
25
+ CMD ["extremis-server", "serve", "--host", "0.0.0.0", "--port", "8000"]
extremis-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ashwani Jha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.