Skip to main content

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:

  1. WIP — Redis, scoped to (org, user, repo, file_path), 4h TTL. This is what synapse sync writes. Multiple repos at once is supported — entries don't collide on overlapping paths.
  2. Feature — Qdrant, scoped to feature/{branch}, 7-day TTL.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synapse_context_cli-0.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synapse_context_cli-0.1.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

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

Hashes for synapse_context_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c02ce41f13efba708f7ce0d827fc32e2199076c52e715260c9f12b17cd16349
MD5 fa2545f038cbbd613a7c21412aaa8768
BLAKE2b-256 61c9ceac6fff262842cdebea4e670edeba899991e56b158ce1ae78a817b57d37

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapse_context_cli-0.1.0.tar.gz:

Publisher: cli-release.yml on abhinav162/synapse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file synapse_context_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for synapse_context_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f07d4c6a09ee395e12066c31596cc419f171639fd72a4a49675592b129979347
MD5 e60e1c4a069e476044c9041474db47d1
BLAKE2b-256 63c076210d609e05ee0212f0d7e447773d183a8945d74ec4d5bb32ef5f51ad67

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page