|
1 | 1 | # SynapDrive-AI |
2 | 2 |
|
3 | | -**SynapDrive-AI** is a **simulation-first** reference implementation of an **intent → context → safety gate → actuation** pipeline inspired by autonomy + BCI workflows. |
| 3 | +SynapDrive-AI is a **simulation-first** reference pipeline for **intent → context → safety gate → actuation**, built to be runnable **without hardware**. |
4 | 4 |
|
5 | | -This repo makes **no medical/clinical claims**. It’s designed to be runnable without hardware, while still supporting **optional** real-world input pathways (BrainFlow / LSL). |
| 5 | +**No medical/clinical claims.** Optional integrations (BrainFlow / LSL) are supported, but not installed by default. |
6 | 6 |
|
7 | | ---- |
| 7 | +## Why it exists |
| 8 | +A clean, reproducible scaffold for teams that need: |
| 9 | +- **Safe-by-default gating** (block unknown/low-confidence intents) |
| 10 | +- **Stable telemetry contracts** (dashboards/tests don’t break on schema drift) |
| 11 | +- **Record/replay (JSONL)** for reproducible validation and regression checks |
8 | 12 |
|
9 | | -## What it does |
| 13 | +## What you can do |
| 14 | +- Run an end-to-end loop from text or simulated signals |
| 15 | +- Record runs to JSONL and replay deterministically |
| 16 | +- Use a local Flask dashboard to trigger actions and inspect telemetry |
| 17 | +- Plug in optional BrainFlow or LSL (pylsl) intent sources |
10 | 18 |
|
11 | | -- End-to-end loop: **intent → optimizer (memory + vision context) → safety gate → actuation → evaluation** |
12 | | -- **Safe-by-default:** unknown / low-confidence intents are blocked |
13 | | -- **Telemetry contract:** stable log schema for dashboards/tests |
14 | | -- **Reproducibility:** record/replay (JSONL) |
15 | | -- **Quality gates:** tests + CI + lint + type-check + coverage |
16 | | -- **Dashboard:** local Flask UI for quick inspection |
| 19 | +## Quickstart |
17 | 20 |
|
18 | | ---- |
19 | | - |
20 | | -## Architecture (canonical pipeline) |
21 | | - |
22 | | -```mermaid |
23 | | -flowchart LR |
24 | | - A[Input: decoded text / simulated signal / BrainFlow / LSL] --> B[Intent packet] |
25 | | - B --> C[Context optimizer: memory + vision] |
26 | | - C --> D{SafetyGate} |
27 | | - D -- safe --> E[DecisionRouter] |
28 | | - D -- blocked --> X[Blocked response] |
29 | | - E --> F[ActuationEngine (simulated)] |
30 | | - F --> G[EpisodicMemory] |
31 | | - F --> H[MetaEvaluator] |
32 | | - G --> C |
33 | | -
|
34 | | -Single source of truth wiring: synapdrive_ai/pipeline.py |
35 | | -
|
36 | | -Quickstart |
37 | | -Install |
| 21 | +### Install |
| 22 | +~~~bash |
38 | 23 | python -m venv .venv |
39 | 24 | source .venv/bin/activate |
40 | 25 | pip install -r requirements.txt |
41 | | -Run (decoded intent text) |
| 26 | +~~~ |
| 27 | + |
| 28 | +### Run (text intent) |
| 29 | +~~~bash |
42 | 30 | python -m synapdrive_ai --text "move left" --image road --no-delay |
43 | 31 | python -m synapdrive_ai --text "stop" --image hazard --no-delay |
44 | | -Run (simulated signal label) |
| 32 | +~~~ |
| 33 | + |
| 34 | +### Run (simulated signal label) |
| 35 | +~~~bash |
45 | 36 | python -m synapdrive_ai --signal walk --count 3 --interval 1 --no-delay |
46 | | -python -m synapdrive_ai --signal stop --no-delay |
47 | | -Tests |
| 37 | +~~~ |
| 38 | + |
| 39 | +### Test |
| 40 | +~~~bash |
48 | 41 | pip install -r requirements-dev.txt |
49 | 42 | pytest -q |
50 | | -Record & replay (reproducible runs) |
51 | | -
|
52 | | -Record a run to JSONL: |
| 43 | +~~~ |
53 | 44 |
|
| 45 | +## Record & replay (reproducible) |
| 46 | +~~~bash |
54 | 47 | python -m synapdrive_ai --text "move left" --image road --record runs.jsonl --no-delay |
55 | | -python -m synapdrive_ai --signal walk --count 3 --record runs.jsonl --no-delay |
56 | | -
|
57 | | -Replay later (deterministic, no-delay): |
58 | | -
|
59 | 48 | python -m synapdrive_ai --replay runs.jsonl |
60 | | -Dashboard (Flask) |
61 | | -
|
62 | | -Run: |
| 49 | +~~~ |
63 | 50 |
|
| 51 | +## Dashboard (Flask) |
| 52 | +~~~bash |
64 | 53 | python -m synapdrive_ai.interface.web_dashboard |
| 54 | +~~~ |
| 55 | +Open: http://127.0.0.1:5055 |
65 | 56 |
|
66 | | -Open: |
67 | | -
|
68 | | -http://127.0.0.1:5055 |
69 | | -
|
70 | | -Optional integrations (not installed by default) |
71 | | -BrainFlow (optional) |
72 | | -
|
73 | | -Install: |
| 57 | +## Optional integrations (not installed by default) |
74 | 58 |
|
| 59 | +### BrainFlow |
| 60 | +~~~bash |
75 | 61 | pip install -r requirements-brainflow.txt |
76 | | -
|
77 | | -Run (defaults to BrainFlow Synthetic board, id=0): |
78 | | -
|
79 | 62 | python -m synapdrive_ai --brainflow --bf-board-id 0 --bf-seconds 2 --no-delay |
80 | | -LSL / pylsl (optional) |
81 | | -
|
82 | | -Install: |
| 63 | +~~~ |
83 | 64 |
|
| 65 | +### LSL / pylsl |
| 66 | +~~~bash |
84 | 67 | pip install -r requirements-lsl.txt |
85 | | -
|
86 | | -Run (recommend specifying stream type or name): |
87 | | -
|
88 | 68 | python -m synapdrive_ai --lsl --lsl-type EEG --lsl-seconds 2 --no-delay |
89 | | -# or |
90 | | -python -m synapdrive_ai --lsl --lsl-name "MyEEGStream" --lsl-seconds 2 --no-delay |
91 | | -Repo map |
92 | | -
|
93 | | -synapdrive_ai/pipeline.py — canonical wiring (supports deterministic --no-delay) |
94 | | -
|
95 | | -synapdrive_ai/bci/intent_generator.py — conservative text → intent packet |
96 | | -
|
97 | | -synapdrive_ai/bci/signal_simulator.py — synthetic EEG-like signals |
98 | | -
|
99 | | -synapdrive_ai/agi/core_reasoning.py — RMS-based confidence from signal energy |
100 | | -
|
101 | | -synapdrive_ai/agi/cognitive_optimizer.py — memory + vision context injection |
102 | | -
|
103 | | -synapdrive_ai/safety/safety_guard.py — safety gating |
104 | | -
|
105 | | -synapdrive_ai/action/decision_router.py — normalized result packets |
106 | | -
|
107 | | -synapdrive_ai/control/actuation_engine.py — simulated actuation + telemetry schema |
108 | | -
|
109 | | -synapdrive_ai/replay/recording.py — JSONL record/replay utilities |
110 | | -
|
111 | | -synapdrive_ai/interface/web_dashboard.py — Flask dashboard |
112 | | -
|
113 | | -synapdrive_ai/tests/ — contract tests (pipeline shape, telemetry keys, dashboard API) |
114 | | -
|
115 | | -examples/ — reviewer quickcheck + golden runs generator |
116 | | -
|
117 | | -docs/ — architecture + safety model writeups |
118 | | -
|
119 | | -Reviewer validation pack |
120 | | -
|
121 | | -examples/REVIEWER_QUICKCHECK.md (2–5 minute checklist) |
122 | | -
|
123 | | -examples/generate_golden_runs.py → examples/golden_runs.jsonl |
124 | | -
|
125 | | -Generate & replay: |
126 | | -
|
127 | | -python examples/generate_golden_runs.py --out examples/golden_runs.jsonl |
128 | | -python -m synapdrive_ai --replay examples/golden_runs.jsonl |
129 | | -Safety stance (explicit) |
130 | | -
|
131 | | -Unknown or low-confidence intents are blocked |
132 | | -
|
133 | | -Stable response shapes (no crashing on drift) |
134 | | -
|
135 | | -Telemetry schema is a contract (UI/tests depend on it) |
136 | | -
|
137 | | -Non-goals: |
138 | | -
|
139 | | -clinical diagnosis |
140 | | -
|
141 | | -medical-device claims |
142 | | -
|
143 | | -real-world safety certification for actuation |
144 | | -
|
145 | | -License |
146 | | -
|
147 | | -Apache-2.0 (see LICENSE) |
| 69 | +~~~ |
| 70 | + |
| 71 | +## Key files |
| 72 | +- `synapdrive_ai/pipeline.py` — canonical wiring (intent → optimize → safety → route → evaluate) |
| 73 | +- `synapdrive_ai/safety/safety_guard.py` — conservative gating rules |
| 74 | +- `synapdrive_ai/control/actuation_engine.py` — simulated actuation + telemetry schema |
| 75 | +- `synapdrive_ai/replay/recording.py` — JSONL record/replay |
| 76 | +- `synapdrive_ai/interface/web_dashboard.py` — Flask UI + API |
| 77 | +- `synapdrive_ai/tests/` — contract tests + dashboard API tests |
| 78 | + |
| 79 | +## License |
| 80 | +Apache-2.0 (see `LICENSE`) |
0 commit comments