Skip to content

serrrfirat/synapse-daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                                                                                                             
                                                                 ...:.  ::.::====:                           
                                         .    .              ..:::#-@+*=%%=%%@#@%=*+.:.                      
                                                                 :-:=:---:+-=-=====+*-:=:                    
                       #@=                               .:.::::-==-=:-:==::=-======+=- -:                   
                        =@+               .           =% %@#*@@-:-:+-==:=+:=::=:+=*%**-  .:                  
                        .-:                   .   .        :====--:==-::=--=-*+=*=-==+=- :-:                 
                                                          *=:==+:--=+=+=====--=:++:=##*+   :.                
                   :@.                                  :%:=:=:+::+=+==:==+-+===:=%::*..-. ::                
                                              .:.:.::::=##*==-=#==-====-.=:=--*+:++==.   -====               
                             +* :             -@@@-%+#*%%#@*-=::    ---:.:**    +::*= .=+**==.:              
                           .=::::::::.::*%%%%**==-=-. ::=-===#*+:.-     .:=-:*:.=:=:-=*#*=:                  
       %#              .      ..=%%=-=+=. :..::==-  . .+*---=*-     -.--.          .-:=+:.                   
       ::           . =..=+=:::=*%#%%==.::*%%**===+:. .=-=:+-:  ==-:                -=**-                    
                   .::+**:....@@%==   .:@@=.:::. :%#=::.+=+-**:.===:.=@@@@@@@-    :--**#=*@@:                
                 :**-=:::::+%%=:..:==+**++=+:=:%@%=-.  =:=-+=#**= +:.***#%@%*:.-      ===+*##                
               ::=%%:   .-=+++:-::.:-+@%+*: :**%%*-:  .===:===+**+*:.=.:-+===+****#**####* :                 
               *%+..    .**+:.:    #%=.     :%%**=    :*%=*:=:=+*+*++*+. :%*#*%##*##*+#*%#+::                
             . %@%==:==-+%@%=+-:.::*%=====*=+@@-.:--::=-*==========+-+=+=::=%#%%%#*****#@@*+--               
              .--+%%:   .*%*::...  %%+::..:=:#*=:=::==*+%=#=+-=++*=#*+*+@+===%%%%#**=****@@%=:.              
              .  =@@-   .=****++-. =+#@@=+===::%@%*=:: +==*==:=*@**+%#***%***=*+**=-=***##%##:.              
                   :%@#..:-:+=%%+  ==***==#%*. ==*%%==:+**==+:*=*+=@@*:-+= ::.-+*- -+=:: ..::                
                    . =%#:..    *@@:  .:@@%*#%%-::**@@#-*++#+=*+*+@@@@:::@ +:.  ==:         .                
                 :.    -%+%++=.  =.@@+=:-:%@@.@@=*@@==:+=*:*==::=@+@%:=+%:@=  =*****:-:    ::                
                              +*+=-..:::**:.:%%@@%*=@:@+*=*:=*=- . :**..:= :. :*%%@%*%+=                     
                           :       ##*+=  :-+@@- -%%*+-+:     .*+.*=:#*%::#= -+=#%#%***-=-.                  
                           ========-: .=%##**-=**#@@=:=#%@@=::-*++:#=*=%%*===--:=::  :                       
                         . .: :.:.....            ..%#=@@#==.:@@@#*@%--+==-=:=:  ..*=*+:..                   
                    . .        . .  .-::::-:: ..  .*=:=--=+=#*@@@**@@*%##++**=+++=--:::.                     
                           .:.::-:-:::.:.. ...:.:.  +-..-.==:-==+===**==-+=+*+#=*==.                         
      .      :.       .    ....:.:...  .. . ......       . :=:=*++-++*+*-+*=**@@#*%=*++-:                    
                                    :+=:.=+-::-:..:+=====:  =+=::.. :.:-==***#%@@@@@%@%%*=                   
                                                .            ..          ::++*@@@@@@*=**=:                   
             : : ..        -:=:=:-:-: : = -:-::-:-. ..:.: . :   .. : . ::+%:-++=+*====-:.                    
         :=-@:.   %@:: : . .. =.:.-=-+:*:=:-= =:*:+:=:-::: :...                                              
                                     .  . .     .  .   ..     +-                                             

                        ███████╗██╗   ██╗███╗   ██╗ █████╗ ██████╗ ███████╗███████╗
                        ██╔════╝╚██╗ ██╔╝████╗  ██║██╔══██╗██╔══██╗██╔════╝██╔════╝
                        ███████╗ ╚████╔╝ ██╔██╗ ██║███████║██████╔╝███████╗█████╗
                        ╚════██║  ╚██╔╝  ██║╚██╗██║██╔══██║██╔═══╝ ╚════██║██╔══╝
                        ███████║   ██║   ██║ ╚████║██║  ██║██║     ███████║███████╗
                        ╚══════╝   ╚═╝   ╚═╝  ╚═══╝╚═╝  ╚═╝╚═╝     ╚══════╝╚══════╝

                                Ambient intelligence for your desktop

What is Synapse?

Synapse passively watches your screen activity via Screenpipe, detects repetitive workflows using Claude, and generates actionable automations plus insight feeds for AI agents.

Like synapses in your brain that strengthen with repeated use, Synapse learns which patterns fire together and turns that into reusable leverage.


What You Get

  • daemon (synapse-daemon) and CLI (synapse)
  • bridge API server for agent integrations
  • OpenClaw plugin source + installer assets
  • prompts and local data pipeline

How It Works

Screenpipe (captures OCR activity)
        ->
Synapse Daemon (analysis + storage in ~/.synapse/db.sqlite)
        ->
Synapse Bridge API (local/remote)
        ->
Agent Runtime (OpenClaw first)

OpenClaw-First Agent Flow

  1. Screenpipe records local activity.
  2. Synapse daemon analyzes and stores insights/patterns.
  3. OpenClaw plugin reads bridge config and registers tools/commands.
  4. In push mode, plugin sends digest notifications; in pull mode, agent queries on demand.

See docs/bridge-flow.md for full integration internals.


Install (Recommended)

brew install serrrfirat/synapse/synapse
synapse onboarding

What this does:

  • installs synapse + synapse-daemon
  • installs screenpipe as a Homebrew dependency
  • runs guided setup (default: OpenClaw-first + personal mode)

Existing users can upgrade with:

brew upgrade serrrfirat/synapse/synapse

From Source (Developers)

Prerequisites

  1. Claude Code CLI
npm install -g @anthropic-ai/claude-code
claude login
  1. Bun
curl -fsSL https://bun.sh/install | bash
bun --version
  1. Screenpipe
brew install screenpipe

Quick Start

git clone https://github.com/serrrfirat/synapse-daemon.git
cd synapse-daemon
bun install
bun run src/index.ts onboarding

Optional manual checks:

bun run src/index.ts bridge status
bun run src/index.ts bridge doctor
bun run src/index.ts daemon --watch --mode personal --interval 4

If you installed release binaries, use synapse ... instead of bun run src/index.ts ....


Commands

Core

Command Description
synapse onboarding Guided setup (default: OpenClaw-only + personal mode, with optional advanced path)
synapse analyze [--hours N] [--mode MODE] Analyze recent activity and detect patterns
synapse digest Review pending automations and provide feedback
synapse status Show daemon status and recent analysis information
synapse preview [--hours N] Preview activity context before Claude analysis
synapse insights [--all] [--dedupe] View insights with optional deduplication

Daemon

Command Description
synapse daemon --install Install as launchd background service
synapse daemon --status Check daemon state (launchd + process + API checks)
synapse daemon --stop Stop daemon service/process
synapse daemon --logs Show recent daemon logs
synapse daemon --uninstall Remove launchd service
synapse daemon --watch Run daemon in foreground
synapse daemon --force Force an analysis cycle now

Bridge (OpenClaw First)

Command Description
synapse bridge setup Interactive wizard for bridge + agent config
synapse bridge status Show bridge configuration and runtime health
synapse bridge doctor Run OpenClaw shipping readiness checks
synapse bridge install-openclaw Install bundled OpenClaw plugin
synapse bridge disable Disable all bridge integrations

OpenClaw Integration Details

OpenClaw plugin registers:

  • tools: synapse_list_insights, synapse_get_insight, synapse_act_on_insight, synapse_feedback, synapse_everything, synapse_current_activity
  • commands: /synapse-status, /synapse-insights
  • service polling for new insights (when enabled)

Notify Modes

  • push: periodic digest notifications are sent when new insights are available
  • pull: no proactive notify; agent fetches when asked

Both modes keep tools available.


Configuration

Synapse config files:

  • ~/.synapse/config.json (analysis + daemon behavior)
  • ~/.synapse/bridge.json (bridge + agent integration)

Key Settings

Setting File Key Default
API host bridge.json apiHost 127.0.0.1
API port bridge.json apiPort 44827
OpenClaw notify mode bridge.json openclawNotifyMode pull
OpenClaw polling interval bridge.json openclawPollingIntervalMs 30000
Gateway auth token bridge.json gatewayAuthToken unset
Analysis window config.json analysisWindowHours 4
Candidate window config.json candidateWindowHours 72
Blocked apps config.json blockedApps []
Analysis provider config.json analysisProvider auto
Memory personalization config.json memoryEnabled true
Memory backend config.json memoryBackend auto
OpenClaw memory agent config.json memoryAgentId main
qmd collection config.json qmdCollection synapse-memory
Insight bias mode config.json insightBias balanced
Screenpipe safe mode config.json screenpipeSafeMode false
Update notifications config.json updateCheckEnabled true
Update check interval config.json updateCheckIntervalHours 24

Environment Overrides

SYNAPSE_API_PORT, SYNAPSE_API_HOST, SYNAPSE_API_URL, SYNAPSE_SCREENPIPE_SAFE_MODE, SYNAPSE_UPDATE_CHECK_ENABLED, SYNAPSE_UPDATE_CHECK_INTERVAL_HOURS, SYNAPSE_MIN_ANALYSIS_COOLDOWN_MINUTES, GATEWAY_AUTH_TOKEN, IRONCLAW_URL, IRONCLAW_TOKEN

The daemon can notify users when a newer Homebrew release is available. It is enabled by default and checks once every 24 hours.

SYNAPSE_MIN_ANALYSIS_COOLDOWN_MINUTES sets a hard minimum delay between model reasoning calls in daemon mode (default: 60). Values below 60 are clamped to 60 to prevent runaway token spend from tight retry/scheduling loops.

analysisProvider=auto routes to OpenClaw when bridge OpenClaw integration is enabled; otherwise it uses Claude Code.

Memory personalization uses long-term memory search to improve insight relevance. In auto backend mode, Synapse tries OpenClaw memory first and falls back to qmd when available.

synapse config --memory on
synapse config --memory-backend auto
synapse config --insight-bias novelty

insightBias controls how aggressively Synapse explores new topics:

  • balanced (default): mix of familiar and new topics
  • novelty: bias toward fresh topics when insights feel repetitive
  • consistency: bias toward known high-signal recurring topics

/api/everything uses per-table pagination: limit/offset are applied independently to each included table. For single-table paging, prefer dedicated endpoints such as /api/insights or /api/jobs.


Screenpipe Reliability

The daemon now handles Screenpipe lifecycle for you:

  • starts Screenpipe if it is not running
  • restarts Screenpipe when capture is stale/unhealthy
  • retries before skipping analysis

Enable conservative launch flags if needed:

synapse config --screenpipe-safe on
# or
SYNAPSE_SCREENPIPE_SAFE_MODE=on synapse daemon --watch

First-run troubleshooting:

open -a Screenpipe
synapse daemon --install --mode personal --interval 4
synapse doctor
synapse bridge doctor

Remote Connectivity (Laptop <-> VPS)

For remote OpenClaw hosts:

On the Synapse machine:

{
  "apiHost": "0.0.0.0",
  "gatewayAuthToken": "your-secret-token"
}

On the OpenClaw side:

{
  "apiBaseUrl": "http://<synapse-host>:44827",
  "gatewayAuthToken": "your-secret-token"
}

Do not expose network host binding without gatewayAuthToken.


Build and Release

./scripts/build-cli.sh --release

Release artifacts:

  • build/synapse-<version>-darwin-arm64.tar.gz
  • build/synapse-<version>-darwin-x64.tar.gz

Each tarball contains:

  • bin/synapse
  • bin/synapse-daemon
  • share/synapse/prompts/*
  • share/synapse/openclaw/*

Homebrew formula template: Formula/synapse.rb

After tag creation:

./scripts/update-formula.sh <version>

Architecture Snapshot

src/
  index.ts                CLI entrypoint
  scripts/daemon.ts       background analysis + bridge runtime
  api-server.ts           HTTP API server
  bridge/                 OpenClaw integration layer
  db.ts                   Screenpipe query layer
  synapse-db.ts           Synapse state DB
  brain.ts                Claude analysis prompt construction
  skill-detector.ts       skill usage + domain extraction

Cost and Privacy

  • uses Claude Code with your existing subscription
  • activity storage remains local (SQLite)
  • generated automations/plugin artifacts are local files

License

MIT - see LICENSE.

About

Synapse core with Agent bridge

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages