thought-mcp 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.
- thought_mcp-0.1.0/.dockerignore +22 -0
- thought_mcp-0.1.0/.github/workflows/ci.yml +87 -0
- thought_mcp-0.1.0/.github/workflows/docker.yml +61 -0
- thought_mcp-0.1.0/.github/workflows/release.yml +51 -0
- thought_mcp-0.1.0/.gitignore +47 -0
- thought_mcp-0.1.0/Dockerfile +34 -0
- thought_mcp-0.1.0/LICENSE +21 -0
- thought_mcp-0.1.0/PKG-INFO +643 -0
- thought_mcp-0.1.0/README.md +571 -0
- thought_mcp-0.1.0/docs/ablation.md +10 -0
- thought_mcp-0.1.0/docs/comparison.md +52 -0
- thought_mcp-0.1.0/plan.md +234 -0
- thought_mcp-0.1.0/pyproject.toml +117 -0
- thought_mcp-0.1.0/src/thought/__init__.py +7 -0
- thought_mcp-0.1.0/src/thought/cli.py +718 -0
- thought_mcp-0.1.0/src/thought/clients.py +197 -0
- thought_mcp-0.1.0/src/thought/config.py +96 -0
- thought_mcp-0.1.0/src/thought/consolidation/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/consolidation/engine.py +244 -0
- thought_mcp-0.1.0/src/thought/embeddings/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/embeddings/base.py +32 -0
- thought_mcp-0.1.0/src/thought/embeddings/deterministic.py +62 -0
- thought_mcp-0.1.0/src/thought/embeddings/sentence_transformer.py +112 -0
- thought_mcp-0.1.0/src/thought/ingest/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/ingest/entities.py +106 -0
- thought_mcp-0.1.0/src/thought/ingest/pipeline.py +300 -0
- thought_mcp-0.1.0/src/thought/layers/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/layers/graph.py +295 -0
- thought_mcp-0.1.0/src/thought/layers/temporal.py +40 -0
- thought_mcp-0.1.0/src/thought/layers/vector.py +258 -0
- thought_mcp-0.1.0/src/thought/llm/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/memory.py +308 -0
- thought_mcp-0.1.0/src/thought/models.py +173 -0
- thought_mcp-0.1.0/src/thought/router/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/router/classifier.py +62 -0
- thought_mcp-0.1.0/src/thought/router/dispatcher.py +263 -0
- thought_mcp-0.1.0/src/thought/router/rules.yaml +46 -0
- thought_mcp-0.1.0/src/thought/server.py +86 -0
- thought_mcp-0.1.0/src/thought/storage/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/storage/base.py +84 -0
- thought_mcp-0.1.0/src/thought/storage/postgres/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/storage/sqlite/__init__.py +0 -0
- thought_mcp-0.1.0/src/thought/storage/sqlite/backend.py +706 -0
- thought_mcp-0.1.0/src/thought/storage/sqlite/migrations/0001_initial.sql +116 -0
- thought_mcp-0.1.0/tests/__init__.py +0 -0
- thought_mcp-0.1.0/tests/comparison/__init__.py +0 -0
- thought_mcp-0.1.0/tests/comparison/ablation.py +235 -0
- thought_mcp-0.1.0/tests/comparison/karpathy_simulator.py +59 -0
- thought_mcp-0.1.0/tests/comparison/ob1_simulator.py +70 -0
- thought_mcp-0.1.0/tests/comparison/run.py +261 -0
- thought_mcp-0.1.0/tests/comparison/workload.py +163 -0
- thought_mcp-0.1.0/tests/integration/__init__.py +0 -0
- thought_mcp-0.1.0/tests/perf/__init__.py +0 -0
- thought_mcp-0.1.0/tests/perf/test_scale_invariance.py +106 -0
- thought_mcp-0.1.0/tests/unit/__init__.py +0 -0
- thought_mcp-0.1.0/tests/unit/test_clients.py +67 -0
- thought_mcp-0.1.0/tests/unit/test_consolidation.py +111 -0
- thought_mcp-0.1.0/tests/unit/test_embeddings.py +42 -0
- thought_mcp-0.1.0/tests/unit/test_graph_layer.py +168 -0
- thought_mcp-0.1.0/tests/unit/test_ingest.py +105 -0
- thought_mcp-0.1.0/tests/unit/test_memory_facade.py +82 -0
- thought_mcp-0.1.0/tests/unit/test_router.py +128 -0
- thought_mcp-0.1.0/tests/unit/test_server.py +51 -0
- thought_mcp-0.1.0/tests/unit/test_storage_sqlite.py +171 -0
- thought_mcp-0.1.0/tests/unit/test_temporal_layer.py +138 -0
- thought_mcp-0.1.0/tests/unit/test_vector_layer.py +139 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.mypy_cache/
|
|
7
|
+
.ruff_cache/
|
|
8
|
+
.coverage
|
|
9
|
+
htmlcov/
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
*.db
|
|
14
|
+
*.db-journal
|
|
15
|
+
.thought/
|
|
16
|
+
.cache/
|
|
17
|
+
models/
|
|
18
|
+
.git/
|
|
19
|
+
.github/
|
|
20
|
+
docs/
|
|
21
|
+
tests/perf/.tmp/
|
|
22
|
+
plan.md
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: ${{ matrix.os }} / py${{ matrix.python }}
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
21
|
+
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
22
|
+
exclude:
|
|
23
|
+
# 3.13 wheels for scipy + sqlite-vec are uneven at the time of
|
|
24
|
+
# writing; pin to the matrix entries we actually support.
|
|
25
|
+
- os: windows-latest
|
|
26
|
+
python: "3.13"
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Set up Python ${{ matrix.python }}
|
|
32
|
+
uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python }}
|
|
35
|
+
cache: pip
|
|
36
|
+
cache-dependency-path: pyproject.toml
|
|
37
|
+
|
|
38
|
+
- name: Install
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install --upgrade pip
|
|
41
|
+
pip install -e ".[dev,mcp]"
|
|
42
|
+
|
|
43
|
+
- name: Lint
|
|
44
|
+
run: |
|
|
45
|
+
ruff check src tests
|
|
46
|
+
|
|
47
|
+
- name: Type check
|
|
48
|
+
# mypy on src only; tests use heavy fixtures, gate later.
|
|
49
|
+
run: |
|
|
50
|
+
python -m mypy src --ignore-missing-imports || true
|
|
51
|
+
|
|
52
|
+
- name: Unit + integration tests
|
|
53
|
+
run: |
|
|
54
|
+
pytest tests/unit tests/comparison -q --cov=thought --cov-report=xml
|
|
55
|
+
|
|
56
|
+
- name: Upload coverage
|
|
57
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
|
|
58
|
+
uses: codecov/codecov-action@v4
|
|
59
|
+
with:
|
|
60
|
+
files: ./coverage.xml
|
|
61
|
+
fail_ci_if_error: false
|
|
62
|
+
|
|
63
|
+
perf:
|
|
64
|
+
name: Performance benchmarks
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
needs: test
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v4
|
|
69
|
+
- uses: actions/setup-python@v5
|
|
70
|
+
with:
|
|
71
|
+
python-version: "3.12"
|
|
72
|
+
cache: pip
|
|
73
|
+
- name: Install
|
|
74
|
+
run: |
|
|
75
|
+
python -m pip install --upgrade pip
|
|
76
|
+
pip install -e ".[dev,mcp]"
|
|
77
|
+
- name: Run perf suite
|
|
78
|
+
run: pytest tests/perf -q -m perf
|
|
79
|
+
- name: Comparison harness
|
|
80
|
+
run: python -m tests.comparison.run
|
|
81
|
+
- name: Ablation study
|
|
82
|
+
run: python -m tests.comparison.ablation
|
|
83
|
+
- name: Upload artifacts
|
|
84
|
+
uses: actions/upload-artifact@v4
|
|
85
|
+
with:
|
|
86
|
+
name: perf-results
|
|
87
|
+
path: docs/*.md
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Docker image
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
packages: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Docker Buildx
|
|
21
|
+
uses: docker/setup-buildx-action@v3
|
|
22
|
+
|
|
23
|
+
- name: Set up QEMU (multi-arch)
|
|
24
|
+
uses: docker/setup-qemu-action@v3
|
|
25
|
+
|
|
26
|
+
- name: Log in to GHCR
|
|
27
|
+
uses: docker/login-action@v3
|
|
28
|
+
with:
|
|
29
|
+
registry: ghcr.io
|
|
30
|
+
username: ${{ github.actor }}
|
|
31
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
+
|
|
33
|
+
- name: Extract metadata
|
|
34
|
+
id: meta
|
|
35
|
+
uses: docker/metadata-action@v5
|
|
36
|
+
with:
|
|
37
|
+
images: ghcr.io/${{ github.repository }}
|
|
38
|
+
tags: |
|
|
39
|
+
type=ref,event=branch
|
|
40
|
+
type=semver,pattern={{version}}
|
|
41
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
42
|
+
type=semver,pattern={{major}}
|
|
43
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
|
44
|
+
|
|
45
|
+
- name: Build & push
|
|
46
|
+
uses: docker/build-push-action@v6
|
|
47
|
+
with:
|
|
48
|
+
context: .
|
|
49
|
+
platforms: linux/amd64,linux/arm64
|
|
50
|
+
push: true
|
|
51
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
52
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
53
|
+
cache-from: type=gha
|
|
54
|
+
cache-to: type=gha,mode=max
|
|
55
|
+
|
|
56
|
+
- name: Image summary
|
|
57
|
+
run: |
|
|
58
|
+
echo "### Pushed images" >> $GITHUB_STEP_SUMMARY
|
|
59
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
60
|
+
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
|
|
61
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build sdist + wheel
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- name: Install build deps
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install --upgrade pip
|
|
23
|
+
pip install build twine
|
|
24
|
+
- name: Build
|
|
25
|
+
run: python -m build
|
|
26
|
+
- name: Validate metadata
|
|
27
|
+
run: twine check dist/*
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish:
|
|
34
|
+
name: Publish to PyPI (trusted publishing)
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
needs: build
|
|
37
|
+
environment:
|
|
38
|
+
name: pypi
|
|
39
|
+
url: https://pypi.org/p/thought-mcp
|
|
40
|
+
permissions:
|
|
41
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
42
|
+
id-token: write
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/download-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: dist
|
|
47
|
+
path: dist/
|
|
48
|
+
- name: Publish
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
50
|
+
with:
|
|
51
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Build artifacts
|
|
2
|
+
build/
|
|
3
|
+
dist/
|
|
4
|
+
*.egg-info/
|
|
5
|
+
*.egg
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
coverage.xml
|
|
15
|
+
.tox/
|
|
16
|
+
.nox/
|
|
17
|
+
|
|
18
|
+
# Virtual envs
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
env/
|
|
22
|
+
|
|
23
|
+
# IDE
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
*.swp
|
|
27
|
+
*.swo
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|
|
32
|
+
desktop.ini
|
|
33
|
+
|
|
34
|
+
# THOUGHT runtime
|
|
35
|
+
*.db
|
|
36
|
+
*.db-journal
|
|
37
|
+
*.db-wal
|
|
38
|
+
*.db-shm
|
|
39
|
+
.thought/
|
|
40
|
+
thought.toml.local
|
|
41
|
+
|
|
42
|
+
# Benchmark baselines (committed manually)
|
|
43
|
+
tests/perf/.tmp/
|
|
44
|
+
|
|
45
|
+
# Model cache (downloads)
|
|
46
|
+
.cache/
|
|
47
|
+
models/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
ARG PYTHON_VERSION=3.12
|
|
2
|
+
|
|
3
|
+
# ---- build stage ---------------------------------------------------------
|
|
4
|
+
FROM python:${PYTHON_VERSION}-slim AS build
|
|
5
|
+
WORKDIR /src
|
|
6
|
+
RUN pip install --no-cache-dir --upgrade pip build
|
|
7
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
8
|
+
COPY src ./src
|
|
9
|
+
RUN python -m build --wheel --outdir /wheels
|
|
10
|
+
|
|
11
|
+
# ---- runtime stage -------------------------------------------------------
|
|
12
|
+
FROM python:${PYTHON_VERSION}-slim AS runtime
|
|
13
|
+
|
|
14
|
+
# Non-root user
|
|
15
|
+
RUN groupadd -r thought && useradd -r -g thought -d /app -s /bin/bash thought
|
|
16
|
+
WORKDIR /app
|
|
17
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
18
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
19
|
+
PIP_NO_CACHE_DIR=1 \
|
|
20
|
+
THOUGHT_DB_PATH=/data/thought.db
|
|
21
|
+
|
|
22
|
+
COPY --from=build /wheels /wheels
|
|
23
|
+
RUN pip install --no-cache-dir /wheels/*.whl 'thought-mcp[mcp,sqlite-vec]' \
|
|
24
|
+
&& rm -rf /wheels
|
|
25
|
+
|
|
26
|
+
RUN mkdir -p /data && chown -R thought:thought /data /app
|
|
27
|
+
USER thought
|
|
28
|
+
|
|
29
|
+
EXPOSE 8765
|
|
30
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
31
|
+
CMD python -c "import sqlite3, os; sqlite3.connect(os.environ.get('THOUGHT_DB_PATH','/data/thought.db')).execute('SELECT 1')" || exit 1
|
|
32
|
+
|
|
33
|
+
ENTRYPOINT ["thought"]
|
|
34
|
+
CMD ["serve", "--host", "0.0.0.0", "--port", "8765"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Richard Barrett and THOUGHT contributors
|
|
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.
|