synapse-recall 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.
- synapse_recall-0.1.0/.dockerignore +9 -0
- synapse_recall-0.1.0/.env.example +19 -0
- synapse_recall-0.1.0/.github/copilot-instructions.md +16 -0
- synapse_recall-0.1.0/.github/workflows/publish.yml +46 -0
- synapse_recall-0.1.0/.gitignore +14 -0
- synapse_recall-0.1.0/.vscode/mcp.json +9 -0
- synapse_recall-0.1.0/LICENSE +21 -0
- synapse_recall-0.1.0/Makefile +42 -0
- synapse_recall-0.1.0/PKG-INFO +539 -0
- synapse_recall-0.1.0/README.md +507 -0
- synapse_recall-0.1.0/alembic.ini +38 -0
- synapse_recall-0.1.0/apps/web/.gitignore +24 -0
- synapse_recall-0.1.0/apps/web/eslint.config.js +22 -0
- synapse_recall-0.1.0/apps/web/index.html +13 -0
- synapse_recall-0.1.0/apps/web/package-lock.json +3045 -0
- synapse_recall-0.1.0/apps/web/package.json +34 -0
- synapse_recall-0.1.0/apps/web/public/favicon.svg +1 -0
- synapse_recall-0.1.0/apps/web/src/App.css +224 -0
- synapse_recall-0.1.0/apps/web/src/App.tsx +798 -0
- synapse_recall-0.1.0/apps/web/src/index.css +6 -0
- synapse_recall-0.1.0/apps/web/src/main.tsx +10 -0
- synapse_recall-0.1.0/apps/web/tsconfig.app.json +26 -0
- synapse_recall-0.1.0/apps/web/tsconfig.json +7 -0
- synapse_recall-0.1.0/apps/web/tsconfig.node.json +23 -0
- synapse_recall-0.1.0/apps/web/vite.config.ts +7 -0
- synapse_recall-0.1.0/compose.yaml +99 -0
- synapse_recall-0.1.0/docker/backend.Dockerfile +25 -0
- synapse_recall-0.1.0/docker/nginx.conf +16 -0
- synapse_recall-0.1.0/docker/web.Dockerfile +11 -0
- synapse_recall-0.1.0/migrations/env.py +32 -0
- synapse_recall-0.1.0/migrations/script.py.mako +24 -0
- synapse_recall-0.1.0/migrations/versions/0001_initial.py +91 -0
- synapse_recall-0.1.0/migrations/versions/0002_semantic_graph.py +163 -0
- synapse_recall-0.1.0/migrations/versions/0003_external_enrichment.py +45 -0
- synapse_recall-0.1.0/migrations/versions/0004_procedural_memory.py +89 -0
- synapse_recall-0.1.0/migrations/versions/0005_group_id_tenancy.py +141 -0
- synapse_recall-0.1.0/migrations/versions/0006_relationship_validity.py +47 -0
- synapse_recall-0.1.0/pyproject.toml +74 -0
- synapse_recall-0.1.0/scripts/cactus-host.sh +17 -0
- synapse_recall-0.1.0/src/synapse/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/api/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/api/main.py +377 -0
- synapse_recall-0.1.0/src/synapse/config.py +61 -0
- synapse_recall-0.1.0/src/synapse/consolidation/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/consolidation/extractor.py +111 -0
- synapse_recall-0.1.0/src/synapse/consolidation/llm_extractor.py +227 -0
- synapse_recall-0.1.0/src/synapse/consolidation/models.py +62 -0
- synapse_recall-0.1.0/src/synapse/consolidation/service.py +374 -0
- synapse_recall-0.1.0/src/synapse/db/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/db/base.py +5 -0
- synapse_recall-0.1.0/src/synapse/db/models.py +412 -0
- synapse_recall-0.1.0/src/synapse/db/session.py +13 -0
- synapse_recall-0.1.0/src/synapse/domain/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/domain/models.py +70 -0
- synapse_recall-0.1.0/src/synapse/enrichment/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/enrichment/crustdata.py +105 -0
- synapse_recall-0.1.0/src/synapse/enrichment/models.py +11 -0
- synapse_recall-0.1.0/src/synapse/episodic/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/episodic/service.py +87 -0
- synapse_recall-0.1.0/src/synapse/inference/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/inference/assertions.py +190 -0
- synapse_recall-0.1.0/src/synapse/inference/chat.py +210 -0
- synapse_recall-0.1.0/src/synapse/mcp/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/mcp/server.py +86 -0
- synapse_recall-0.1.0/src/synapse/memory/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/memory/mem0_store.py +114 -0
- synapse_recall-0.1.0/src/synapse/procedural/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/procedural/models.py +64 -0
- synapse_recall-0.1.0/src/synapse/procedural/service.py +300 -0
- synapse_recall-0.1.0/src/synapse/procedural/templates.py +87 -0
- synapse_recall-0.1.0/src/synapse/recall/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/recall/answerability.py +98 -0
- synapse_recall-0.1.0/src/synapse/recall/models.py +39 -0
- synapse_recall-0.1.0/src/synapse/recall/service.py +268 -0
- synapse_recall-0.1.0/src/synapse/semantic/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/semantic/repository.py +194 -0
- synapse_recall-0.1.0/src/synapse/sources/__init__.py +1 -0
- synapse_recall-0.1.0/src/synapse/sources/mock.py +631 -0
- synapse_recall-0.1.0/src/synapse/sources/slack_export.py +357 -0
- synapse_recall-0.1.0/src/synapse/sources/slack_import.py +105 -0
- synapse_recall-0.1.0/src/synapse/worker.py +21 -0
- synapse_recall-0.1.0/tests/conftest.py +104 -0
- synapse_recall-0.1.0/tests/test_assertions.py +13 -0
- synapse_recall-0.1.0/tests/test_consolidation.py +156 -0
- synapse_recall-0.1.0/tests/test_enrichment.py +35 -0
- synapse_recall-0.1.0/tests/test_health.py +16 -0
- synapse_recall-0.1.0/tests/test_inference_endpoint.py +154 -0
- synapse_recall-0.1.0/tests/test_mock_data.py +67 -0
- synapse_recall-0.1.0/tests/test_procedural.py +26 -0
- synapse_recall-0.1.0/tests/test_reasoning_budget.py +159 -0
- synapse_recall-0.1.0/tests/test_recall.py +74 -0
- synapse_recall-0.1.0/tests/test_slack_export.py +119 -0
- synapse_recall-0.1.0/tests/test_system_one.py +97 -0
- synapse_recall-0.1.0/tests/test_temporal_validity.py +229 -0
- synapse_recall-0.1.0/tests/test_tenancy.py +332 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
SYNAPSE_WEB_PORT=3000
|
|
2
|
+
SYNAPSE_API_PORT=8000
|
|
3
|
+
# Chat and embeddings are two OpenAI-compatible endpoints. The defaults below
|
|
4
|
+
# are a local Cactus serving Gemma for both; point them at a hosted gateway and
|
|
5
|
+
# set the matching key to run inference remotely instead.
|
|
6
|
+
CHAT_BASE_URL=http://host.docker.internal:8080/v1
|
|
7
|
+
EMBEDDING_BASE_URL=http://host.docker.internal:8080/v1
|
|
8
|
+
CHAT_MODEL=google/gemma-4-E2B-it
|
|
9
|
+
EMBEDDING_MODEL=google/gemma-4-E2B-it
|
|
10
|
+
# Ignored by a local Cactus; required by anything hosted.
|
|
11
|
+
CHAT_API_KEY=cactus-local
|
|
12
|
+
EMBEDDING_API_KEY=cactus-local
|
|
13
|
+
# Extra completion budget for a model that reasons before answering, which
|
|
14
|
+
# would otherwise spend a call's whole budget thinking and return nothing.
|
|
15
|
+
# Gemma answers directly, so it needs none; set a few thousand for one that
|
|
16
|
+
# doesn't.
|
|
17
|
+
CHAT_REASONING_TOKENS=0
|
|
18
|
+
INFERENCE_MODE=auto
|
|
19
|
+
CRUSTDATA_API_KEY=
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Synapse Memory
|
|
2
|
+
|
|
3
|
+
- Use the `synapse-memory` MCP server's `recall` tool whenever a task depends on company
|
|
4
|
+
decisions, systems, owners, blockers, project context, or prior organizational work.
|
|
5
|
+
- Treat `recall` as the mandatory retrieval path. Do not bypass it with direct database or
|
|
6
|
+
graph queries because semantic fallback must create a retrieval episode for future use.
|
|
7
|
+
- Use `get_episode` only to inspect an episode cited by `recall`.
|
|
8
|
+
- Call `list_skill_specs` before a multi-step company research, architecture, or project
|
|
9
|
+
briefing task. If an approved workflow applies, fetch it with `get_skill_spec` and follow
|
|
10
|
+
its recall queries, steps, output contract, and guardrails.
|
|
11
|
+
- Never assume a candidate or rejected procedural skill is available; MCP exposes approved
|
|
12
|
+
versions only.
|
|
13
|
+
- Synapse MCP tools are read-only. Repository inspection, edits, commands, and validation
|
|
14
|
+
remain the responsibility of the VS Code agent and require the normal user approval flow.
|
|
15
|
+
- The server uses the stable MCP Python SDK v1 (`mcp>=1.27,<2`). SDK documentation:
|
|
16
|
+
https://github.com/modelcontextprotocol/python-sdk/tree/v1.x
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Publish to PyPI when a GitHub release is published.
|
|
2
|
+
#
|
|
3
|
+
# No API token exists anywhere: PyPI is configured to trust this specific
|
|
4
|
+
# workflow in this specific repository, and the upload is authenticated by a
|
|
5
|
+
# short-lived OIDC token GitHub mints for the job. That is why `id-token: write`
|
|
6
|
+
# is granted here and nowhere else, and why the job is otherwise given nothing.
|
|
7
|
+
#
|
|
8
|
+
# Building and publishing are separate jobs so the artifact is produced by a job
|
|
9
|
+
# with no credentials at all, and the job that can publish only ever downloads
|
|
10
|
+
# it.
|
|
11
|
+
|
|
12
|
+
name: Publish
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
release:
|
|
16
|
+
types: [published]
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- run: pip install build
|
|
27
|
+
- run: python -m build
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish:
|
|
34
|
+
needs: build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
# Named on PyPI's side too, so a trusted publish can only come from a run
|
|
37
|
+
# that entered this environment.
|
|
38
|
+
environment: pypi
|
|
39
|
+
permissions:
|
|
40
|
+
id-token: write
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/download-artifact@v4
|
|
43
|
+
with:
|
|
44
|
+
name: dist
|
|
45
|
+
path: dist/
|
|
46
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.env
|
|
2
|
+
.DS_Store
|
|
3
|
+
.pytest_cache/
|
|
4
|
+
.mypy_cache/
|
|
5
|
+
.ruff_cache/
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.pyc
|
|
8
|
+
apps/web/node_modules/
|
|
9
|
+
apps/web/dist/
|
|
10
|
+
# Python build artifacts, produced by `python -m build` before a release.
|
|
11
|
+
/dist/
|
|
12
|
+
test-results/
|
|
13
|
+
playwright-report/
|
|
14
|
+
slack-exports/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abhi Jain
|
|
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.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.PHONY: up down build logs replay slack-preview slack-import test lint reset cactus
|
|
2
|
+
|
|
3
|
+
up:
|
|
4
|
+
docker compose up -d --build --wait
|
|
5
|
+
|
|
6
|
+
down:
|
|
7
|
+
docker compose down
|
|
8
|
+
|
|
9
|
+
build:
|
|
10
|
+
docker compose build
|
|
11
|
+
|
|
12
|
+
logs:
|
|
13
|
+
docker compose logs -f api worker web
|
|
14
|
+
|
|
15
|
+
replay:
|
|
16
|
+
@test -n "$${SYNAPSE_GROUP_ID}" || (echo "Set SYNAPSE_GROUP_ID to the account to replay into" && exit 1)
|
|
17
|
+
curl --fail --request POST "http://localhost:$${SYNAPSE_WEB_PORT:-3000}/api/demo/replay?group_id=$${SYNAPSE_GROUP_ID}"
|
|
18
|
+
|
|
19
|
+
slack-preview:
|
|
20
|
+
@test -n "$${SLACK_EXPORT_DIR}" || (echo "Set SLACK_EXPORT_DIR to the extracted Slack export directory" && exit 1)
|
|
21
|
+
docker compose run --rm -T -v "$${SLACK_EXPORT_DIR}:/data/slack-export:ro" api python -m synapse.sources.slack_import --export-root /data/slack-export --channel all-docwise --channel scribe-iteration --max-events 40 --max-per-channel 30 --min-score 4 --dry-run
|
|
22
|
+
|
|
23
|
+
slack-import:
|
|
24
|
+
@test -n "$${SLACK_EXPORT_DIR}" || (echo "Set SLACK_EXPORT_DIR to the extracted Slack export directory" && exit 1)
|
|
25
|
+
@test -n "$${SYNAPSE_GROUP_ID}" || (echo "Set SYNAPSE_GROUP_ID to the account this export belongs to" && exit 1)
|
|
26
|
+
docker compose run --rm -T -v "$${SLACK_EXPORT_DIR}:/data/slack-export:ro" api python -m synapse.sources.slack_import --export-root /data/slack-export --group-id "$${SYNAPSE_GROUP_ID}" --channel all-docwise --channel scribe-iteration --max-events 40 --max-per-channel 30 --min-score 4
|
|
27
|
+
|
|
28
|
+
test:
|
|
29
|
+
docker compose run --rm --build test
|
|
30
|
+
npm --prefix apps/web run lint
|
|
31
|
+
npm --prefix apps/web run build
|
|
32
|
+
|
|
33
|
+
lint:
|
|
34
|
+
docker compose run --rm api ruff check src tests migrations
|
|
35
|
+
docker compose run --rm api mypy src
|
|
36
|
+
npm --prefix apps/web run lint
|
|
37
|
+
|
|
38
|
+
reset:
|
|
39
|
+
docker compose down --volumes
|
|
40
|
+
|
|
41
|
+
cactus:
|
|
42
|
+
sh scripts/cactus-host.sh
|