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.
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.
$ 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
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))
Lighthouses are set on confirmed user choice only — never via automatic
inference. ADR-001 is permanent.
Zero required network calls. Zero dependencies — pure Swift stdlib.
State lives in ~/Library/Application Support, readable as JSON.
Beta priors, decay weights, cosine similarity matrices — every number the engine uses is inspectable and exportable.
Fault injection is a first-class feature. Controlled weak points expose assumptions — a calibration suite measures how the system degrades.
Silent by default. Abrasive only if you ask (--referee abrasive) —
and only on distraction, with a cooldown. Never on collapse.
Prompt assembly encodes intent, environment, and history under Bayesian weights that converge on your feedback. Not string concatenation.
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.
$ 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.