CLI for Synapse — push uncommitted code to the WIP cache so MCP-aware AI tools see your live editor state.
Project description
synapse-cli
synapse is the developer CLI for the Synapse Universal Memory Layer. It pushes
your uncommitted, work-in-progress code into the Synapse WIP cache so MCP-aware
AI tools (Claude Code, Cursor, etc.) get the current state of your editor —
not just whatever was on main last night.
Install
pip install synapse-context-cli
# or, from a clone: pip install -e .
The distribution name on PyPI is synapse-context-cli. The console-script
it installs is still synapse — type synapse sync, not synapse-context-cli sync.
Authenticate
Two options. Use device-flow login on developer machines, tokens on CI/headless.
Device-flow login (recommended)
synapse login
Walks the GitHub device-authorization flow against the Synapse GitHub App,
exchanges the resulting access token for a Synapse syn_live_* API token,
and saves it to ~/.synapse/credentials.json. One-time setup per machine.
Make sure you've installed the Synapse GitHub App on your org first — the device-flow exchange checks org membership.
To log out: synapse logout.
Token mode (CI/headless)
export SYNAPSE_TOKEN=syn_live_...
export SYNAPSE_API_ENDPOINT=https://synapse.abhinavaditya.com # optional, default
Generate the token from the dashboard at Settings → API Tokens.
Verify
synapse status # ping /health, show auth state
synapse status -v # also list live WIP entries with TTL countdown
You should see API Status: Connected.
Usage
One-shot diff sync
synapse sync
Walks git diff (staged + unstaged + untracked, deletes excluded), secret-
scans every file, and POSTs the clean ones to /wip/sync. WIP entries live
for 4 hours unless re-synced.
Full repo sync (first-time index from CLI)
synapse sync --full
Walks the entire working tree (respecting .gitignore) and syncs every
tracked / untracked-not-ignored file. Mirrors the initial-install index that
the GitHub App webhook would do — useful for a fresh clone before the
webhook fires.
Watch mode (daily driver)
synapse sync --watch
Runs an initial sync, then watches the repo. Saves are debounced 1.5s and
filtered against .gitignore and _IGNORED_DIRS (.git, node_modules,
build outputs, IDE caches). Stop with Ctrl-C. Tune the debounce window
with --debounce 0.8.
Want it to survive reboots? synapse install-service (see below).
Dry-run
synapse sync --dry-run
Shows what would sync (including secret-scan rejections) without uploading. Useful for sanity-checking before wiring up an automated hook.
Pre-commit hook
synapse sync --pre-commit
Scan-only mode: walks staged files, exits non-zero if any contain secrets.
Doesn't upload anything (commits go through the GitHub-webhook → Temporal
pipeline anyway). Wire into .pre-commit-config.yaml:
- repo: local
hooks:
- id: synapse-secret-scan
name: synapse secret scan
entry: synapse sync --pre-commit
language: system
pass_filenames: false
Background service
synapse install-service # current dir, default label "dev.synapse.watch"
synapse install-service --repo ~/code/my-project --label dev.synapse.api
synapse uninstall-service --label dev.synapse.api
macOS → drops a launchd plist in ~/Library/LaunchAgents/ and launchctl load.
Linux → drops a systemd user unit in ~/.config/systemd/user/ and
systemctl --user enable --now. Logs land in /tmp/<label>.log.
Status
synapse status # auth + /health
synapse status -v # also list live WIP entries (file, TTL, repo, branch)
How it interacts with MCP
When an MCP client (Claude Code, etc.) queries Synapse, the server merges results from three tiers in priority order:
- WIP — Redis, scoped to
(org, user, repo, file_path), 4h TTL. This is whatsynapse syncwrites. Multiple repos at once is supported — entries don't collide on overlapping paths. - Feature — Qdrant, scoped to
feature/{branch}, 7-day TTL. - Global — Qdrant, scoped to
global(=main), no TTL.
Higher tiers win on file_path collisions, so your in-flight edits
override whatever's in main.
Troubleshooting
| Symptom | Likely cause |
|---|---|
Not logged in. |
Run synapse login, or export SYNAPSE_TOKEN. |
API Status: Unreachable |
Wrong endpoint, or token revoked. Check synapse status. |
⚠ Secret detected … skipped |
Secret scanner found a credential. Remove it; file syncs next time. |
Pre-commit failed: N file(s) contain secrets. |
Same — but blocking your commit by design. |
| MCP tool returns stale code | Run synapse sync manually to confirm upload succeeds. Then check synapse status -v to see TTL. |
| Watcher fires constantly during builds | Build dirs (dist/, target/, .next/) are already skipped, but if your tool writes to a custom output dir, add it to .gitignore — the watcher honours it. |
Development
make test # unit tests (no infra)
make test-integration # requires SYNAPSE_INTEGRATION=1 + live stack
make benchmark # KPI: 10-file diff sync < 2s
make lint typecheck # ruff + mypy --strict
make check # lint + typecheck + unit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synapse_context_cli-0.1.0.tar.gz.
File metadata
- Download URL: synapse_context_cli-0.1.0.tar.gz
- Upload date:
- Size: 28.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c02ce41f13efba708f7ce0d827fc32e2199076c52e715260c9f12b17cd16349
|
|
| MD5 |
fa2545f038cbbd613a7c21412aaa8768
|
|
| BLAKE2b-256 |
61c9ceac6fff262842cdebea4e670edeba899991e56b158ce1ae78a817b57d37
|
Provenance
The following attestation bundles were made for synapse_context_cli-0.1.0.tar.gz:
Publisher:
cli-release.yml on abhinav162/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synapse_context_cli-0.1.0.tar.gz -
Subject digest:
8c02ce41f13efba708f7ce0d827fc32e2199076c52e715260c9f12b17cd16349 - Sigstore transparency entry: 1428886675
- Sigstore integration time:
-
Permalink:
abhinav162/synapse@8bbe53990b14cdeab910abd5c012fa0e377dc0be -
Branch / Tag:
refs/tags/cli-v0.1.0 - Owner: https://github.com/abhinav162
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cli-release.yml@8bbe53990b14cdeab910abd5c012fa0e377dc0be -
Trigger Event:
push
-
Statement type:
File details
Details for the file synapse_context_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synapse_context_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f07d4c6a09ee395e12066c31596cc419f171639fd72a4a49675592b129979347
|
|
| MD5 |
e60e1c4a069e476044c9041474db47d1
|
|
| BLAKE2b-256 |
63c076210d609e05ee0212f0d7e447773d183a8945d74ec4d5bb32ef5f51ad67
|
Provenance
The following attestation bundles were made for synapse_context_cli-0.1.0-py3-none-any.whl:
Publisher:
cli-release.yml on abhinav162/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synapse_context_cli-0.1.0-py3-none-any.whl -
Subject digest:
f07d4c6a09ee395e12066c31596cc419f171639fd72a4a49675592b129979347 - Sigstore transparency entry: 1428886678
- Sigstore integration time:
-
Permalink:
abhinav162/synapse@8bbe53990b14cdeab910abd5c012fa0e377dc0be -
Branch / Tag:
refs/tags/cli-v0.1.0 - Owner: https://github.com/abhinav162
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cli-release.yml@8bbe53990b14cdeab910abd5c012fa0e377dc0be -
Trigger Event:
push
-
Statement type: