ContextSynapse

A local-first Bayesian prompt orchestration engine that treats prompting as cognition — with lighthouse anchors, context-rot scoring, and a raven named Edgar who watches you drift.

research-grade · built by and for a neurodivergent developer · not a product
the referee & the lighthouse

Edgar renders on every query. His state is the system's state.

ContextSynapse picks up the slack where the prefrontal cortex drops the ball. Set a lighthouse — your primary goal, on your explicit choice, never inferred — and every query is measured against it. As your context rots, the storm rises and Edgar stirs: the friend who calls you out when you're drifting, and still has your back.

edgar & the lighthouse — live rot simulation
a real session
$ contextsynapse --lighthouse "ship the v0.3 bedrock release"
⚓ Lighthouse set: "ship the v0.3 bedrock release"
edgar is watching.

$ contextsynapse "refactor the decay math" --app Zed
⚓ Lighthouse: ship the v0.3 bedrock release — saliency 100% — last touched 0min ago
[Concise] [Create] [Work]: refactor the decay math

⚓ ship the v0.3 bedrock release  rot [░░░░░░░░░░░░░░░░░░░░] 0%  clean

$ contextsynapse --referee abrasive   # opt-in friction. your call, always.
referee mode set: abrasive
the math

Synapses decay. Rot compounds. Lighthouses hold the floor.

Every weight, prior, and similarity score is plain JSON on your disk. Nothing hidden, nothing hosted. The whole engine is these four equations:

// utility — recency-weighted success
U(s,t)       = Σ successᵢ · e^(−μ(t−tᵢ)) / Σ e^(−μ(t−tᵢ))

// decay — connected synapses decay slower, rotting ones faster
λ(s)         = λ_base · (1 − conn) · (1 + rot·amplifier)
W_decay(s,t) = W_base · e^(−λ(s)·Δt) · U(s,t)

// rot — semantic distance × drift time × velocity
RotScore(s)  = D(content, lighthouse) · tanh(T_drift/T_thresh) · V

// the floor — your primary goal is always findable
W_final(s,t) = max(floor(s), W_decay · (1 − α·RotScore))
design constraints

Non-negotiables, not features

Consent-gated anchors

Lighthouses are set on confirmed user choice only — never via automatic inference. ADR-001 is permanent.

Local-first

Zero required network calls. Zero dependencies — pure Swift stdlib. State lives in ~/Library/Application Support, readable as JSON.

Interpretability first

Beta priors, decay weights, cosine similarity matrices — every number the engine uses is inspectable and exportable.

Fragility is intentional

Fault injection is a first-class feature. Controlled weak points expose assumptions — a calibration suite measures how the system degrades.

Edgar, the referee

Silent by default. Abrasive only if you ask (--referee abrasive) — and only on distraction, with a cooldown. Never on collapse.

Σ

Prompting as cognition

Prompt assembly encodes intent, environment, and history under Bayesian weights that converge on your feedback. Not string concatenation.

■ HARD STOP — what this will never do

ContextSynapse does not model cognitive, emotional, or collapse states. Operational context inference about the human is permanently out of scope — an ethical and privacy boundary, not a roadmap gap. The referee reacts to what you're working on, never to how you're doing.

install

macOS 13+ · Swift 5.8+ · no dependencies

zsh
$ git clone https://github.com/mazze93/context-synapse
$ cd context-synapse
$ swift build -c release
$ .build/release/contextsynapse --lighthouse "your primary goal"
# edgar is watching.