Inspiration
We were inspired to build Lucid after a teammate's grandfather developed a brain hematoma that almost cost him his life. The reason is how bleeds like his are found: only once the patient reaches a CT scanner, by which point the hours that matter may already be gone. That gap is what we heard again from a hospitalist we spoke with, who described how hard it is to triage the early signs of brain injury. So we built Lucid to move the check to where the patient is, so a bleed like his could be flagged on scene instead of at the hospital door.
What it does
Anyone can hold Lucid's handheld device to a patient's head and sweep it around, and the dashboard fills in a live map of where a bleed is likely. An AI agent then runs about 100 physics simulations of the head, each with a bleed of a different size and location, and ranks which ones best match what the device measured. It explains the result in plain language, asks the user to approve before stating it, and asks for a re-scan if any reading was weak. Once approved, Lucid texts the on-call neurosurgeon the bleed map and a pre-alert over iMessage. It answers their questions from the scan itself and records whether they accept or decline, so the hospital is ready before the patient arrives.
How we built it
Probe
A magnet-wire coil (about 3 MHz), an 800 nm NIR LED with an IR receiver, and an IMU, in a case lined with copper to form a Faraday cage that cuts interference. An Arduino Uno streams readings over USB to the laptop, where read_scan returns each spot's coil value (dB) and NIR value.
Agent
A LangChain deep agent (deepagents on LangGraph). The lead, Claude Sonnet 5, plans, saves the scan to its file system and writes 96 bleed hypotheses (3 types x 8 regions x 4 volumes). Four Claude Haiku 5.5 region subagents run in parallel: each simulates its hypotheses on a 2D pyEIT head model (forward_sim), scores them against the scan (fit_score) and refines the best. A skeptic subagent tries to break the leading finding. The decision rule is code (rank_fits).
Dashboard
A Next.js app streams the run: a likelihood map on a 3D cortex, live coil and NIR traces, and about 100 simulations ranked by fit. The agent pauses for human approval at up to three points through HumanInTheLoopMiddleware: a re-scan (only when a result is uncertain), the result, and the pre-alert.
Hand-off
After the last approval, send_prealert texts the on-call neurosurgeon the map and a pre-alert over iMessage (Photon 2.0 beta). A bridge polls Photon every 2 s and puts replies on the same scan thread, and the agent answers from the scan.

System architecture.
Sponsor Notes
🤖 Best Physical AI Hack
Lucid's sensor is a handheld probe wired into the agent: every number the agent reasons about is a per-spot probe reading, and its next move follows from those readings.
What the probe senses
- Coil. A magnet-wire coil at about 3 MHz reads tissue conductivity, and blood changes the reading (about twice as conductive as brain in our head model).
- NIR. An 800 nm LED and a 4x4 mm IR receiver on the front face. Blood absorbs near-infrared light near the surface, so coil plus NIR tell a bleed's type, not only its presence.
- IMU. A GY-521 checks the probe is still and placed correctly.
- Scan plan. Eight spots around the head, in left/right pairs plus midline front and back. Each gives a coil level (dB), an NIR value and a contact flag.
Signal chain
A signal generator drives the coil at about 3 MHz, the coil's response is conditioned and digitized, and an Arduino Uno streams the readings over USB serial to the laptop. The IMU shares the Uno's I2C bus.
Enclosure

Enclosure: side view, top view with the boards to scale, front face and the head profile.
The case is a printed cylinder, 210 mm long and 100 mm across, split lengthwise into two half-shells with a 149 x 88 x 18.1 mm electronics tray inside. The sensing head is the front face: a 70 mm coil head, about 10 mm deep, with the coil wire in a 68 mm groove between two flanges, facing the patient. The IR receiver sits above the seam and the LED below it, and a wire notch at the top of the head lets the coil lead into the case. Grip grooves run along the rear half, and a USB-B opening sits at the rear. Fasteners are nylon, so no metal sits near the coil. A copper shield floor sits behind the coil, and the full interior is lined with copper tape or foil, a Faraday cage that shields the 3 MHz coil signal from nearby electronics and mains noise.
How the AI is part of the hardware loop
The agent reaches the probe through one function, read_scan, which returns each spot as {coil_db, nir, quality}. Everything downstream, from the simulations to the hand-off, reads the probe through this one call.
- Contact. A weak-contact spot counts at 30% weight in every fit. If the result is uncertain, the agent asks the medic to re-scan exactly those spots (once per scan) and the search reruns.
- Search. It scores about 100 bleed hypotheses (type, region, volume), each simulated on a 2D head model.
- Simulation to measurement.
forward_simsolves a hypothesis with pyEIT and returns the readings the probe would give at the same spots.fit_scorecompares them with the real ones (0 to 1), and a rule in code calls a bleed likely only at 0.80 or above and clear of every rival. The pattern across spots is the fingerprint: an epidural is a narrow, strong drop at one spot, a subdural spreads over two or three, and a deep bleed moves the coil with little NIR change. - Baseline. The first approved scan is stored per patient, and a re-scan is compared with it by region and volume.
🏥 Peri Forward Deployed Challenge
We think that showing is better than telling, so we made a portfolio for y'all to check out! https://canva.link/uvhmjfjlomeqn8l
Six conversations shaped Lucid. Names marked NDA are withheld due to confidentiality.
- Medical director, national referral hospital (NDA), before the event. "Even the patients don't know that they are having stroke symptoms," and the gap includes transport. The design question became how a field result gets the patient to care, and the pre-alert now carries the transport unit and ETA.
- Academic neurosurgeon, US teaching hospital (NDA), before the event. A tool "doesn't necessarily mean the accuracy is perfect, but it should help get the right person to the right place." A result now ends in a destination and a receiving clinician, on the clinician's own phone with no app.
- Hospital research reviewer (NDA), before the event. "I think you need to see earlier symptoms for your software." Our technical lead argued for the full symptom spectrum: "By getting the full spectrum, we're able to get something accurate."
- Clinical research lead, national referral hospital (NDA), before the event. Described protocol and draft MOU review, and raising the work with the Ministry of Health. Our next step is finalising protocol and agreements before a field trial.
- Yangbo Du, SDG implementer, during the event. Think about global contexts. Low cost and accessibility became design goals.
- Toni Hadjiev, hospitalist, Concord Hospital, NH, Saturday morning, Nov 14, 2026. Early signs of brain injury and bleeding are the hard part of triage. Lucid became screening support with a clear next action: the medic approves before anything is sent.
Real need
The people who handle these patients described the same gap from three angles: symptoms missed before the hospital, no clear path from a field result to the right clinician, and transport that is part of the problem. A bleed needs a CT quickly, and Lucid gives responders the ability to screen and triage in the field.
Immediate use
We went through a real-world demo with our hardware and software. A real demo case went through: after detecting a bleed, the bleed map, the pre-alert and a repeat-scan update reached a teammate's phone through Photon, and no app was needed to receive them. The medic approves the result and the recipient first, and an accept, a decline or no reply stays visible to them.
Completeness
Lucid runs as one chain from the first scan to the surgeon's reply: the probe takes the readings, the agent finds and checks the bleed, the medic approves, and the on-call clinician gets the map and answers in their own thread. The path past the demo comes from our clinical research lead interview: finalise the protocol and draft MOU, then run a field trial.
Evidence

Peri team: Check out the portfolio we made!
🔗 LangChain: Best use of deepagents
Lucid's brain is one create_deep_agent graph (deepagents 0.7.38, LangGraph 1.2) that turns noisy scan readings into a ranked, checked, human-approved bleed finding, then runs the hand-off conversation with a neurosurgeon. It needs a deep agent because the job is long-horizon (read, plan, search, rank, challenge, up to three approvals, a text conversation) and the search is wide: about 100 hypotheses scored against a pyEIT simulator, more than one context should carry.

The deep agent: lead, parallel region subagents, files, skeptic, approval gates, store and skills.
Agents and files
The lead (claude-sonnet-5, TodoListMiddleware with five to-dos) writes 96 hypotheses to a file and starts four region subagents in parallel: frontal, temporal, parietal, occipital. Each owns 24, scores them, then decides alone whether to refine with up to 8 finer volumes. A fifth, the skeptic, starts in a fresh context, sees only the files, and tests up to 8 rival explanations that join the same score pool, so a real rival changes the outcome. All five run claude-haiku-5-5 with forward_sim, fit_score and file tools, and a custom ActivityLog middleware streams their steps to the dashboard.
The file system is how they cooperate: a CompositeBackend with StateBackend per scan thread, FilesystemBackend for /skills/, and StoreBackend on a SQLite LangGraph Store for /patients/ and /clinicians/. The tools check the files, so no step can be skipped: rank_fits refuses until all four /sims/<region>.json exist, submit_result refuses without the skeptic's /review.md, and send_prealert refuses without /report.md. Four skills (head-model, explain-to-medic, safety-wording, text-a-clinician) put only their descriptions in the prompt, and the lead opens one when needed.
Gates and the rule
interrupt_on pauses request_rescan, submit_result and send_prealert. Each has a when predicate and a card built from state, such as "Mark this scan Bleed likely?"; the re-scan card appears only when a result is uncertain and some spots had weak contact. The dashboard resumes with approve, or reject plus a typed reason, which reaches the lead as the tool result; it records nothing, does not retry, and offers a re-scan.
The decision rule is code (decision.py): No bleed seen at a no-bleed fit of 0.80 or more beating every bleed by 0.05; Uncertain, re-scan below 0.80 or within 0.05 of a different region; otherwise Bleed likely. The agent may be more cautious than the rule, never less: a stronger proposal fails check_result and never reaches the medic.
Speed and tracing
Thinking is off on every model (it added 5 to 8 s per step), independent tool calls run in one turn, and Haiku does the mechanical region work: Run scan to the first approval card takes 34 to 38 s. The dashboard reads the LangGraph server with useStream, and every run is traced in LangSmith.
What the demo shows
- Sweep the probe around the head and press Run scan: the readings arrive, the to-do list ticks and about 100 simulation cards fill four parallel lanes; click one to see its solver output.
- After about 35 s, "Mark this scan Bleed likely?" appears (an uncertain result asks for a re-scan first); approve it and a second card names the clinician who gets the pre-alert.
- The surgeon's phone gets the map, asks a question, gets an answer from the scan and replies ACCEPT; a later re-scan texts the change against the stored baseline.
📦 Amazon: Best Practical AI Innovation
Lucid is an agent that reasons from physics, plans its own work, and acts only where a person has said yes.

User journey, from first touch to a ready team. The result and pre-alert approvals are in orange; a re-scan approval comes first when a result is uncertain.
Creativity
The agent reasons with a simulated head, not a guess. It scores about 100 bleed hypotheses (3 types x 8 regions x 4 volumes) on a 2D head model solved with pyEIT; each predicts what the scan spots would read. Four region agents search in parallel, and a skeptic with a fresh context tries to break the leading finding with rival bleeds. Click any simulation card for three views: the solver's head model with the bleed, the simulated reading against the real scan, and a live log of that card's agent.
Usefulness
The user is whoever is first on scene with a head injury and no CT scanner. The decision is whether to treat it as a likely bleed and alert a hospital now, or re-scan first. Instead of a raw signal they get a plain-language result and a one-tap hand-off: with their approval, the on-call neurosurgeon is texted the bleed map and a pre-alert over iMessage, can ask questions, and replies ACCEPT or DECLINE. No app, no login. The receiving team has the map before the patient arrives.
Technical build
A lead agent on create_deep_agent (LangChain deepagents, LangGraph, LangSmith) writes a five-item to-do list, reads the scan, plans the sweep and delegates the search (depth in the LangChain section). rank_fits decides by threshold in code: a best fit of at least 0.80 that beats every rival and the no-bleed model by 0.05 is "Bleed likely", otherwise "Uncertain, re-scan", and the agent asks for a re-scan of weak-contact spots. Three tools (request_rescan, submit_result, send_prealert) pause for approval; the re-scan pause happens only when a result is uncertain. Models: claude-sonnet-5 (lead), claude-haiku-5-5 (subagents).
UX
- One screen: Scan and Simulations tabs on the left, live signal charts above the agent panel on the right.
- The verdict is the biggest text on screen: "Bleed likely", "Uncertain, re-scan" or "No bleed seen", each with an icon and a label so colour is never the only signal.
- Approval cards appear inline with Approve and Reject; the agent panel shows "Step n of m" and expands to the plan.
- A Dashboard / Agent trace switch redraws the same run as an n8n-style node canvas.
- Plain words, fixed safety wording: the
explain-to-medicandsafety-wordingskills require three or four short sentences and "Screening aid, not a diagnosis. Confirm with CT."
⚡ Photon: the surgeon is one text away
Vision
A hand-off fails at the receiving end: the surgeon has no account in our system and will not install an app for a stranger's device. Lucid is the third person in the hand-off. The on-call neurosurgeon texts "On call" to one iMessage number, then installs nothing and logs in to nothing: the map, the pre-alert, their questions and their decision all live in the thread they already carry.
Craft

Sequence of the hand-off. The result and pre-alert approvals are in orange; a re-scan approval comes first when a result is uncertain.
- Approval first. The card names the recipient from the on-call roster, checked again just before the send. Nothing leaves until the medic approves.
- Map, then text. The tool uploads the bleed map as an attachment, then sends the pre-alert on the clinician's own thread. The map shows the cortex from above and both sides in true proportions.
- Replies reach the scan. A bridge polls Photon every 2 s and puts each text on the scan's LangGraph thread as
[Receiving clinician, iMessage] .... The lead answers from that scan's fit scores and the answer is texted back. - A re-scan sends the change. After the medic approves it, the clinician who accepted gets what changed, not a second alert.
The medic sees all of it: LiveBridge.tsx reads the hand-off's Store record every 2 s and joins the bridge's runs, showing the surgeon's question, Lucid's answer, and a status row moving from Sent to Delivered to Accepted or Declined, with the time.
On the surgeon's phone. The pre-alert arrives with the bleed map, then the finding, the volume, the fit, the transport unit and ETA, and the safety line, and invites ACCEPT, DECLINE or a question about the scan.

The map and pre-alert as they arrive, and a question Lucid answers from what the device actually measures.
Questions are answered from the scan itself: asked whether the bleed could be subdural, Lucid replies that a subdural in the same place fits at 0.82 against 0.97 for epidural, and why. The decision is recorded only when the surgeon writes the word.

A question answered from the scan's fit scores, then ACCEPT recorded for the medic.
Depth
Built directly on Photon 2.0 beta's HTTP API (attachments, message status, received-message listing, idempotency keys), with the edge cases handled in code:
- Idempotency. Each send is keyed by its cause (
prealert:<thread>:<tool call>:image|text) and the upload boundary comes from the file's hash, so a retry is byte-identical and never texts twice. - Queued is not delivered. Photon answers a send with 202; the record says "queued" until the message status reads delivered, and a failure is flagged to the medic.
- Only the word counts.
record_replystores ACCEPT or DECLINE only when the message says one, un-negated; "ok" gets a request for the word. - Silence is visible. 60 s without a reply after the pre-alert is flagged to the medic.
- One bridge, one cursor. The inbox cursor lives in the LangGraph Store and re-reads a minute back because Photon's list is eventually consistent. A restart neither replays nor skips a text, and one sender's texts are handled in order.
- Built for the shared line. The human texts first, so the roster comes from received texts ("On call", "Off"), and a sender with no open hand-off gets one fixed line and no case content.
Traction
A real demo case went through end to end on live iMessage: the bleed map, the pre-alert and a repeat-scan update reached a teammate's phone, and the teammate's replies were answered from the scan. Tomorrow's user is an on-call clinician like Toni Hadjiev, the Concord Hospital hospitalist who named early signs of brain injury and bleeding as the triage gap: they need only the phone they already carry, and joining the roster takes one text, "On call".
👨🏻💻 MLH
- Gemini: Once the agent has a result, Gemini writes a four-line hand-off brief on the Scan tab (finding, where, quality, next step) and answers the medic's questions about the scan. It's given only the dashboard's own numbers and is told to say when a result is proposed but not yet approved.
- MongoDB Atlas: Every approved scan, whether bleed, clear or uncertain, is archived to Atlas (lucid.scans) with the patient, the thread, the result and the 8-spot reading. The write runs in the background, so the agent never waits on it.
- GoDaddy: We registered doesmybrain.work for Lucid.
Challenges we ran into
Speed and safety pulled in opposite directions. Claude's newer models think by default, which added 5 to 8 seconds to every agent step, so we turned thinking off, batched independent tool calls and gave the mechanical work to Haiku subagents to bring the first approval card down to about 35 seconds. The agent framework added its own surprises: tool calls that need approval run together with the others in the same turn, so anything the medic must see before approving has to be produced a turn earlier. Photon's beta shaped the hand-off too, with a shared line where the surgeon has to text first, a list that is only eventually consistent, and no webhooks without public HTTPS, so we built a polling bridge with idempotency keys. On the hardware side, a 3 MHz coil picks up everything nearby, which is why the case is lined with copper to form a Faraday cage.
Accomplishments that we're proud of
We built the whole chain in a weekend, from the probe's first reading to a surgeon's reply on their own phone: a handheld sensor, an agent that runs about 100 physics simulations and checks its own best answer, a dashboard the medic can actually follow, and a real iMessage hand-off that needs no app on the receiving end. We are proudest that safety lives in code, not in prompts. The decision rule is a function, the agent can be more cautious than it but never less, and its tools refuse to run until the checks before them have been done. We also spoke with six clinicians and health-system leaders along the way, and their input changed the design: the pre-alert carries a transport unit and ETA, and every result ends in a destination and a receiving clinician.
What we learned
Files work better than context for an agent that has to do a lot of work: parallel subagents sharing results through a file system kept the lead agent's context small and made every step checkable. We learned that a latency budget is a design decision, since model choice, thinking and turn count each cost seconds a medic does not have. We learned to meet clinicians where they already are, because an iMessage thread removed every reason for a surgeon to say no to a new tool. And we learned that the people who handle these patients described the problem differently from how engineers frame it: the gap runs from missed symptoms to transport to knowing where to send the patient, not only to detection.
What's next for Lucid
The next step is validation and a hospital partner. We will check the sensing against phantoms before any clinical data, replace the coarse 2D head model with a validated one, and measure the real cost of the device to confirm the low-cost goal we set after speaking with our global-health advisor. In parallel, we will follow the path our clinical research lead interview laid out: finalise the protocol and draft MOU, take it through hospital review and the Ministry of Health process, and run a field trial with responders. Along the way we want to connect Lucid to a hospital's real on-call roster, so a pre-alert goes to whoever is on call tonight.


