41 Commits
Author SHA1 Message Date
jimmyandClaude Sonnet 5.5 93e986b2cb chore: update led-driver and dmx-driver, refresh the graphify graph
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 00:46:11 +13:00
jimmyandClaude Sonnet 5.5 6e2d5ff80c chore: build with espressif/idf v6.1
Makefile and the bench-test doc use the v6.1 image. dependencies.lock came out of the build as idf 5.5.5 /
littlefs 2.0.0, which does not match the image: regenerate it with a v6.1 build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 00:46:11 +13:00
jimmyandClaude Opus 5.5 c4f8a51359 chore: point led-driver and led-tool at USB config for the ESP-IDF driver
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 22:34:43 +13:00
jimmyandClaude Haiku 5.5 50ca46fee6 feat: sequences v2, driver frame sync and submodule updates
- Sequences v2, bridges and sim-controller changes from the working tree.
- Records the led-driver, led-tool and led-simulator commits above.
- Includes dmx-driver/ and graphify-out/.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-11 14:10:56 +13:00
jimmyandClaude Haiku 5.5 3f8f67823b chore: point led-driver at the DDP test commit
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-11 13:01:21 +13:00
jimmyandClaude Sonnet 5.5 2543673bd8 feat: sequences v2, bridges, and sim-controller
Rework sequences (engine, seqplay, envelope, API, web UI), add bridge
support, add the host sim-controller and rig simulation tests, and
update docs, presets and project tooling config.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 17:47:27 +13:00
jimmyandClaude Opus 5.5 d664026ee5 feat: sequences can step on time; searchable group pickers
- Sequences: advance_mode "time" makes each step last its `seconds`
  (0.1–3600) instead of beats; editor gets a "Steps last" selector.
- UI: search box in the groups modal; searchable add pickers for zone
  groups and presets.
- Preset "try" sends only to the current zone's groups, never broadcast.
- led-driver: max_brightness ceiling from device config; follow a
  controller that restarted its beat counter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 12:05:31 +13:00
jimmyandClaude Sonnet 5.5 38162d4b89 feat: faster, correct preset editor; default presets use their own pattern
- Editing a preset can change its pattern (the dropdown was disabled).
- on, off and rainbow are built-in patterns and are always listed, so the
  editor no longer falls back to the first pattern (aurora) for them.
- The editor loads the pattern names once and only the selected pattern's
  definition (new GET /patterns/names and GET /patterns/<name>).
- A shared GET cache (fetch_cache.js) reuses profile, palette, zone, preset,
  group and pattern lookups; any write clears it and entries expire at 30 s.
- The seeded rainbow preset uses the rainbow pattern.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:46:11 +13:00
jimmyandClaude Sonnet 5.5 d4118072f6 feat: log how long each API request takes
Every request through the locked API handlers logs lock wait, handler
time, and the split into build, JSON print and send.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:46:05 +13:00
jimmyandClaude Sonnet 5.5 f85021d40d feat: Wi-Fi access point with a setting, password and boot button
The controller runs an AP (SSID = hostname, 192.168.5.1) next to ESP-NOW,
on by default. Network settings gain an on/off switch (ap_enabled) and an
optional WPA2 password (ap_password, 8-63 chars; empty is open). A button
on D7 (GPIO44) held at boot forces the AP on.

Wi-Fi now starts before Ethernet, and a missing W5500 no longer aborts the
boot: the web server and mDNS start anyway so the AP stays usable.

Network tuning found while testing over the AP: HTTP backlog 10 and 12 open
sockets (the default 5 dropped the 6th SYN, a 1 s stall on every page load),
larger TCP and Wi-Fi buffers, and IPv6 link-local addresses so mDNS answers
AAAA queries (browsers waited about a second for them).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:46:05 +13:00
jimmyandClaude Sonnet 5.5 9989dd3062 build: make runs build, flash and monitor; make flash only flashes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:45:59 +13:00
jimmyandClaude Opus 5.5 06953028ab feat(ui): driver settings and code updates over ESP-NOW
Settings gets a Driver tab (/settings/editor). It sends a driver its settings through PUT /devices/<id>, which now forwards name too, and runs the tools/driver_ota.py session from the browser. The firmware embeds the led-driver files and a manifest of their hashes, because crypto.subtle is unavailable over plain HTTP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 23:51:41 +13:00
jimmyandClaude Opus 5.5 2f0c26e9b8 feat: default IP, reset reason in /status, seeded default group
With no DHCP answer in 15 seconds the controller takes 192.168.4.1/24, for a cable straight to a PC with a static IP. /status reports why the board last restarted. First boot also seeds a default group that the default zone plays to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:25:22 +13:00
jimmyandClaude Opus 5.5 4372ba4105 fix: recover a collection cut off between remove and rename
store_save removes the old file before renaming the finished .tmp, so a restart between the two started that collection empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:25:22 +13:00
jimmyandClaude Opus 5.5 f47237696e fix: stop the first-boot seed overflowing the event task
The seed runs from the got-IP handler on sys_evt, whose 2304-byte stack overflowed on the flash writes. A store with no profile then crashed mid-save on every boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:25:22 +13:00
jimmyandClaude Opus 5.5 190c8bc982 feat: seed a default profile at first boot
A store with no profile gets a default one, using the seed POST /profiles already
creates plus a starter palette. db/ now holds those records instead of stored
data, and the unused db/presets/*.bin files are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:47:00 +13:00
jimmyandClaude Opus 5.5 b6aa0635ae build: refresh the build time on every build, default make ota host
A web-only change relinked without recompiling esp_app_desc.c, so the image kept
its old build time. make ota now uses led-controller.local unless HOST is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:47:00 +13:00
jimmyandClaude Opus 5.5 a560a1a72b feat(ui): Edit mode Menu on desktop, device groups and Identify
Sequences, Settings and Audio only show in Edit mode. On wide screens the Edit
mode actions and Run mode move into the Menu.

Edit device gets a Groups checklist. The Devices list and Edit device group
show names without addresses, and every device in Edit device group, in the
group or in the list to add from, gets an Identify button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:47:00 +13:00
jimmyandClaude Opus 5.5 24d3c1149d test(api): share one profile() fixture in conftest
Six test files each defined the same profile() fixture. It now lives once
in conftest.py, with test_profiles.py's 201 check on create.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 01:35:56 +13:00
jimmyandClaude Opus 5.5 16a3d3aa26 fix(ui): bring back v1's header and menu
The header is one row again: zone tabs on the left, then the BPM readout,
and on wide screens the Beat/Downbeat switch, brightness and the buttons.
Under 1000 px the buttons fold into the Menu, which opens with the mode
toggle and brightness, as in v1. Groups and the Beat/Downbeat switch from
main are kept; the Zones dropdown main used on narrow screens is gone,
since the zone tabs stay visible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:55:26 +13:00
jimmyandClaude Opus 5.5 011883a6a8 feat(ui): one-line header with every action in the Menu
Zone tabs, the BPM readout and the Menu share one line at every width.
The header buttons and the Beat/Downbeat switch move into the Menu (the
narrow-screen layout, now everywhere), and the brightness slider sits at
the bottom of the Menu, under its items.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:46:39 +13:00
jimmyandClaude Opus 5.5 b2cd242390 docs: describe the v2 controller's API, UI and tests
API.md now documents what the firmware serves: groups, combined
brightness, beat-driven sequences, import/export, /api/audio, patterns
over ESP-NOW, outputs, /ws, driver OTA, and how API calls become driver
messages and group commands. The user guide follows the current UI; the
in-app audio help describes the microphone instead of input devices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:42:03 +13:00
jimmyandClaude Opus 5.5 bfeeb958df feat: main's import/export, zones, audio API and web UI
Profiles, presets and sequences export and import as main's bundles.
Zones carry group_ids, preset_group_ids, sequence_ids, content_kind and
brightness; profiles seed rainbow as colour_cycle, and deleting a
profile also deletes its sequences. Groups, zones and sequences written
by older versions are migrated at boot.

/api/audio (status, event stream, start/stop, reset, anchor-bar,
devices) maps main's audio detector onto the mic's beat detector. Audio
start/stop picks whether mic beats or the BPM clock time sequences; the
clock's beats also go to the drivers while the mic is off.
/ws now greets from a post-handshake callback (httpd does not call the
handler for the upgrade).

The web UI is main's, plus v2's outputs editor, list search and
hostname/static IP settings; the bridge, Wi-Fi AP and led-tool parts
are gone. API tests follow main's behaviour (119 pass on the board).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:34:22 +13:00
jimmyandClaude Opus 5.5 04b56c6ef2 feat: device groups, combined brightness and beat-driven sequences from main
Groups (registry of driver MACs, optionally scoped to a profile) become
the drivers' group membership, alongside z<zone id> for zones that still
name drivers. Zones play to their group_ids. Group and device routes for
driver config, brightness (global x groups x device x zone) and identify.
The push path takes main's message shape: select as a list, groups as a
filter (one GROUP_CMD per group, or JSON when a preset has a background),
short keys so JSON fits a frame.

Sequences follow main: lanes of {preset_id, beats} steps played to each
lane's groups, advanced by the mic's beats or a clock at
audio_simulated_bpm; a switch waits for the next beat or downbeat; sync-
phase, stop (clears the zone's drivers) and status. This replaces the
time-based per-zone sequencer and scene playback, as in main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:09:42 +13:00
jimmyandClaude Opus 5.5 19fea0b0a1 feat: ping drivers and push groups from the devices modal
POST /devices/ping broadcasts an ESP-NOW PING_REQ, collects the drivers'
PING_RSP for timeout_s and registers or renames the ones that answer. A
reply also counts as the driver being heard, so group updates go to it
again. POST /devices/groups sends every ESP-NOW driver its groups and
reports the acks. The devices modal gets the Ping drivers and Update
groups buttons from main, with per-driver ping dots.

UI files are now served with Cache-Control: no-cache and the firmware
build hash as ETag, so a browser picks up a new UI right after an update
instead of a day later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:53:56 +13:00
jimmyandClaude Opus 5.5 e7f238aebc fix: stop group updates to silent drivers from starving zone play
Every acked unicast holds a pending slot for its whole retry run, so zone
and profile edits with drivers switched off filled the link and the next
zone play timed out (503). Group updates now go to a driver that has
failed three messages in a row at most once every 30 s; one that comes
back still gets its groups when it announces or resyncs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 10:38:51 +13:00
jimmyandClaude Opus 5.5 57182188ba feat: port the remaining v1 API to the v2 controller
Profiles seed presets, a default zone and a palette, and clone with their
own copies; deleting a profile removes what it owned. Zones get the v1
list shape, set-current, current, clone and content-fragment. Devices are
keyed by MAC with v1 validation and identify. Patterns: definitions, OTA
file and manifest, upload, driver, and send over ESP-NOW (the led-driver
pattern sources are embedded in the firmware). Pixel outputs get v1
validation and a DDP/Art-Net/sACN test pattern. Sequences, palettes and
settings follow v1 replies and validation, and /ws forwards browser
messages to the drivers.

The resource handlers move out of api.c into res_*.c, patterns.c and
outputs.c. cJSON now allocates from PSRAM: the store had grown enough to
starve internal RAM and abort the mic at boot. /status reports
free_internal.

The Wi-Fi AP and led-tool routes are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 09:58:17 +13:00
jimmyandClaude Opus 5.5 4b42391a46 test: port the v1 endpoint and browser tests to v2
HTTP tests against a running controller (make test-api HOST=ip). They
snapshot every collection through /db and restore it afterwards. v1
behaviour v2 does not have yet is marked as a strict xfail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:33:08 +13:00
jimmyandClaude Opus 5.5 9d628aa3c8 fix: run the W5500 SPI bus at 10 MHz
At 20 MHz the controller intermittently dropped every Ethernet frame
over about 900 bytes, while small packets got through. The web UI then
hung after the first chunk of a response. At 10 MHz, full-size pings
and repeated fetches of every UI file all succeed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:50:46 +13:00
jimmyandClaude Opus 5.5 32c0ecfa76 feat: update led-driver app files over ESP-NOW
tools/driver_ota.py (make ota-drivers) pushes the driver's .py files
through the controller, one file per POST /drivers/ota/file. Drivers
skip files they already have, and the rest are committed together.

- one target: acked unicast, two chunks in flight
- several targets: each file is broadcast once, then each driver is
  asked for its missing chunks and repaired by unicast
- rel: rel_send_seq, rel_wait and rel_send_wait, plus a callback for
  the drivers' 0x26 status replies
- commands are retried, because status replies are not acked
- broadcast chunks are paced 50 ms apart: faster broadcast left C3
  drivers unable to receive until reset
- bench results in docs/BENCH_TEST.md, endpoints in docs/API.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:45:38 +13:00
jimmyandClaude Opus 5.5 1c222771a5 refactor: move the v2 controller to the repository root
The ESP-IDF project, docs, tools, tests and web UI move from v2/ to the
root, and the Makefile, README, build scripts and test runner drop the
v2/ prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:44:58 +13:00
jimmyandClaude Sonnet 5.5 71bd320661 feat(v2): move web UI into v2, remove legacy MicroPython app
Move the web assets and templates under v2/web, drop the old src/, lib/
and scripts, and update firmware, tools, docs and db files. Add the audio
page, LED test scripts and VPN autoconnect script.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:30:02 +13:00
jimmyandClaude Sonnet 5.5 6c16998691 feat(v2): OTA firmware update over Ethernet
POST /ota writes the image to the idle app slot and reboots; GET /ota
reports the running slot. App rollback is enabled, and a new image confirms
itself after 10 s. Adds make ota HOST=<ip>, tools/ota.py and the led-tool
--ota update.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-01 00:22:55 +13:00
jimmyandClaude Sonnet 5.5 8d78af1246 docs(v2): bench guide results for the loss, beat, USB and C3 tests
Adds the audio endpoints, the Makefile pointer, the first-run results of
the lossy-link and beat tests, the USB and analyzer latency methods and the
ESP32-C3 comparison (delivery, latency, frame rate, Wi-Fi start-up order).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 22:30:26 +13:00
jimmyandClaude Sonnet 5.5 899d4f2418 build(v2): root Makefile for build, flash and monitor
make build / flash / monitor / flash-monitor / log / size / menuconfig /
erase / clean / test run ESP-IDF in Docker and handle rootless ownership.
Adds the helper scripts behind log and test, and a --settle option for
usb_latency.py (an ESP32-C3 driver resets when its port is opened).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 22:30:26 +13:00
jimmyandClaude Sonnet 5.5 f7ac4ab290 feat(v2): audio page, beat endpoints and an Audio menu button
Restores the live audio section from esp32-eth: /audio page, /audio.wav
stream, /beats event feed, POST /tap and /time, and the mic and beat state
in /status. The web build adds an Audio entry to the header menu and the
mobile dropdown for the v2 copy of index.html only, so the Pi UI is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 22:30:26 +13:00
jimmyandClaude Sonnet 5.5 d332d447aa fix(v2): do not wipe a driver's groups when it announces and is in no zone
The controller sent a GROUPS packet on every driver hello. For a driver in
no zone that was an empty list, which replaced the groups stored on the
driver. It is now sent at announce and resync only when the list is not
empty; explicit zone and device edits still send every list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 22:30:26 +13:00
jimmyandClaude Sonnet 5.5 a94d6a7de5 feat(v2): ESP32-S3 controller with Ethernet, I2S mic beat detection and ESP-NOW
New ESP-IDF project in v2/ that replaces the Pi and the UART bridge:

- W5500 Ethernet, INMP441 beat/tempo detector (from esp32-eth), ESP-NOW master
- LittleFS data store and a JSON API over the Pi's db/*.json collections,
  with /db import and export; web UI minified and gzipped at build time
- Zone play/stop as 0x4C GROUP_CMD, preset push/send as CMD (binary v2
  envelope, byte-identical to src/util/binary_envelope.py), sequencer and
  scenes, driver registration from the boot hello
- Reliable bulk link: acks with retransmit, fragments, state-version digest
  and resync; beat frames sent twice with a lead so drivers fire together
- Bench tooling: lossy-link mode, synthetic beats with echo measurement,
  USB and logic-analyzer latency scripts, and docs/BENCH_TEST.md

Needs the matching led-driver changes (p2p branch) to receive the link and
beat frames.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 17:15:28 +13:00
jimmyandClaude Sonnet 5.5 7336c7fb22 docs: document engine, outputs, sequences, brightness and search; update spec
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 02:02:13 +13:00
jimmyandClaude Opus 5.5 3a7723c586 feat(ui): add search filter to devices, zones and presets modals
Client-side filter that hides non-matching rows as you type, persists
across list re-renders, and clears when the modal is reopened or on Esc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 14:11:55 +13:00
jimmyandClaude Opus 5.5 a5a7fc575f feat(engine): Pi-side animation engine with protocol outputs and sequencer
Add src/engine, modelled on technicalkiwi/portal's player and sequence runner:

- Pixel generator: runs the unchanged led-driver patterns under CPython
  (utime shim + NeoPixel-like buffer) on a per-zone render thread and
  streams frames to pixel outputs, with keepalive for static frames.
- Output drivers: DDP, Art-Net (ArtDMX/ArtSync), sACN/E1.31, USB-DMX
  (Enttec Pro / Open DMX), plus an ESP32 preset output that reuses the
  existing preset + select delivery path. Registry in db/output.json,
  CRUD and test pattern at /outputs.
- Sequencer: timed preset chains per zone (portal step shape), deadline
  scheduling, loop/repeat, resume after restart; legacy sequence records
  are migrated. Zone play/stop, sequence and scene play/stop endpoints.
- CLI (python -m engine.cli), Outputs and Sequences modals, preset tiles
  drive pixel outputs, API/README docs, engine test suite.

ESP32 firmware is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:24:14 +13:00
979 changed files with 52171 additions and 18326 deletions

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# graphify
- **graphify** (`.claude/skills/graphify/SKILL.md`) - any input to knowledge graph. Trigger: `/graphify`
When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else.
@@ -0,0 +1 @@
0.9.101
+797
View File
@@ -0,0 +1,797 @@
---
name: graphify
description: "Use for any question about a codebase, its architecture, file relationships, or project content — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns any input (code, docs, papers, images, videos) into a persistent knowledge graph with god nodes, community detection, and query/path/explain tools."
---
# /graphify
Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPH_REPORT.md.
## Usage
```
/graphify # full pipeline on current directory (HTML viz; add --obsidian for a vault)
/graphify <path> # full pipeline on specific path
/graphify https://github.com/<owner>/<repo> # clone repo then run full pipeline on it
/graphify https://github.com/<owner>/<repo> --branch <branch> # clone a specific branch
/graphify <url1> <url2> ... # clone multiple repos, build each, merge into one cross-repo graph
/graphify <path> --mode deep # thorough extraction, richer INFERRED edges
/graphify <path> --update # incremental - re-extract only new/changed files
/graphify <path> --directed # build directed graph (preserves edge direction: source→target)
/graphify <path> --whisper-model medium # use a larger Whisper model for better transcription accuracy
/graphify <path> --cluster-only # rerun clustering on existing graph
/graphify <path> --no-viz # skip visualization, just report + JSON
/graphify <path> --html # (HTML is generated by default - this flag is a no-op)
/graphify <path> --svg # also export graph.svg (embeds in Notion, GitHub)
/graphify <path> --graphml # export graph.graphml (Gephi, yEd)
/graphify <path> --neo4j # generate graphify-out/cypher.txt for Neo4j
/graphify <path> --neo4j-push bolt://localhost:7687 # push directly to Neo4j
/graphify <path> --falkordb # generate graphify-out/cypher.txt for FalkorDB
/graphify <path> --falkordb-push falkordb://localhost:6379 # push directly to FalkorDB
/graphify <path> --mcp # start MCP stdio server for agent access
/graphify <path> --watch # watch folder, auto-rebuild on code changes (no LLM needed)
/graphify <path> --wiki # build agent-crawlable wiki (index.md + one article per community)
/graphify <path> --obsidian --obsidian-dir ~/vaults/my-project # write vault to custom path (e.g. existing vault)
/graphify add <url> # fetch URL, save to ./raw, update graph
/graphify add <url> --author "Name" # tag who wrote it
/graphify add <url> --contributor "Name" # tag who added it to the corpus
/graphify query "<question>" # BFS traversal - broad context
/graphify query "<question>" --dfs # DFS - trace a specific path
/graphify query "<question>" --budget 1500 # cap answer at N tokens
/graphify path "AuthModule" "Database" # shortest path between two concepts
/graphify explain "SwinTransformer" # plain-language explanation of a node
```
## What graphify is for
Drop any folder of code, docs, papers, images, or video into graphify and get a queryable knowledge graph. Persistent across sessions, honest audit trail (EXTRACTED/INFERRED/AMBIGUOUS), community detection surfaces cross-document connections you wouldn't think to ask about.
**When a graph is worth building:** this applies when you are choosing a tool yourself; if the user invoked `/graphify`, follow that request as asked. AST extraction of code is fast and free, but semantic extraction of docs, papers and images runs the model over every file, which can cost minutes and tens of thousands of tokens.
If a graph already exists, query it. With no graph, one targeted lookup ("where is X defined", "what calls Y" in an ordinary-sized codebase) is faster and free with a plain text search such as `grep` and `Read`: search directly instead of running the steps below, and mention that a graph can be built if the user wants one. Build one when you expect many questions against this corpus, the corpus is large or unfamiliar, the question needs links text search cannot see (doc to code, across documents), or it is structural (communities, bridges, import cycles).
## What You Must Do When Invoked
If the user invoked `/graphify --help` or `/graphify -h` (with no other arguments), print the contents of the `## Usage` section above verbatim and stop. Do not run any commands, do not detect files, do not default the path to `.`. Just print the Usage block and return.
**Fast path — existing graph:** Before doing anything else, check whether `graphify-out/graph.json` exists. The expected location is `graphify-out/graph.json` relative to the **current working directory** (i.e. the project root where you are running commands). If it exists AND the user's request is a natural-language question about the codebase (e.g. "How does X work?", "What calls Y?", "Trace the data flow through Z") and NOT an explicit rebuild command (`--update`, `--cluster-only`, or a bare path/URL that implies fresh extraction): **skip Steps 1–5 entirely and jump straight to `## For /graphify query`.** Run `graphify query "<question>"` immediately. Do not run detect. Do not check corpus size. Do not ask the user to narrow. The graph is already built — use it.
If no path was given, use `.` (current directory). Do not ask the user for a path.
If the path argument starts with `https://github.com/` or `http://github.com/`, treat it as a GitHub URL - run Step 0 before anything else, then continue with the resolved local path.
Follow these steps in order unless the fast path above applies.
### Step 0 - GitHub repos and multi-path merge (only if a URL or several paths)
Only when the path is one or more `https://github.com/...` URLs, or several local subfolders to merge. See `references/github-and-merge.md` for the clone, cross-repo merge, and monorepo flow, then continue with the resolved local path. A plain local path skips this step.
### Step 1 - Ensure graphify is installed
```bash
# Detect the correct Python interpreter (handles uv tool, pipx, venv, system installs)
PYTHON=""
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
# 1. uv tool installs — most reliable on modern Mac/Linux
if [ -z "$PYTHON" ] && command -v uv >/dev/null 2>&1; then
_UV_PY=$(uv tool run --from graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
fi
# 2. Read shebang from graphify binary (pipx and direct pip installs)
if [ -z "$PYTHON" ] && [ -n "$GRAPHIFY_BIN" ]; then
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
case "$_SHEBANG" in
*[!a-zA-Z0-9/_.@-]*) ;;
*) "$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG" ;;
esac
fi
# 3. Fall back to python3
if [ -z "$PYTHON" ]; then PYTHON="python3"; fi
if ! "$PYTHON" -c "import graphify" 2>/dev/null; then
if command -v uv >/dev/null 2>&1; then
uv tool install --upgrade graphifyy -q 2>&1 | tail -3
_UV_PY=$(uv tool run --from graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
else
"$PYTHON" -m pip install graphifyy -q 2>/dev/null \
|| "$PYTHON" -m pip install graphifyy -q --break-system-packages 2>&1 | tail -3
fi
fi
# Write interpreter path for all subsequent steps (persists across invocations)
mkdir -p graphify-out
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
# Save scan root so `graphify update` (no args) knows where to look next time.
# The scan path is passed through a quoted heredoc, never substituted into the
# command line itself: a bare `cd <path>` (or an unquoted heredoc, which
# still expands $()/backticks in its body) would let a malicious path execute
# as shell code the moment this line runs.
"$PYTHON" -c "import os, sys; out_path = os.path.abspath('graphify-out/.graphify_root'); os.chdir(sys.stdin.readline().rstrip('\n')); open(out_path, 'w', encoding='utf-8').write(os.getcwd())" <<'GRAPHIFY_ROOT_EOF'
INPUT_PATH
GRAPHIFY_ROOT_EOF
```
If the import succeeds, print nothing and move straight to Step 2.
**In every subsequent bash block, replace `python3` with `$(cat graphify-out/.graphify_python)` to use the correct interpreter.**
### Step 2 - Detect files
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.detect import detect
from pathlib import Path
from graphify.paths import out_path
from graphify.watch import _read_build_excludes, _read_build_gitignore
result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path()))
# Write the sidecar from Python, not a shell redirect, so the same block renders
# on PowerShell hosts without console-encoding drift (#2528).
Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\")
print(f'Detected {result[\"total_files\"]} files')
"
```
Replace INPUT_PATH with the actual path the user provided. Do NOT cat or print the JSON - read it silently and present a clean summary instead:
```
Corpus: X files · ~Y words
code: N files (.py .ts .go ...)
docs: N files (.md .txt ...)
papers: N files (.pdf ...)
images: N files
video: N files (.mp4 .mp3 ...)
```
Omit any category with 0 files from the summary.
Then act on it:
- If `total_files` is 0: stop with "No supported files found in [path]."
- If `skipped_sensitive` is non-empty: report the count and list the skipped file names, so a wrongly-flagged source or doc is visible and can be renamed or moved (#2106).
- If `total_words` > 2,000,000 OR `total_files` > 500: show the warning. Then compute the top 5 first-level subdirectories by file count:
- Read `scan_root` from the detect JSON (always an absolute path to the resolved INPUT_PATH).
- Concatenate all file lists across all types (`code`, `document`, `paper`, `image`, `video`).
- Filter out any path that starts with `scan_root + "/graphify-out/"` to exclude converted sidecars.
- For each file, strip the `scan_root` prefix and take the first path component. Files directly in `scan_root` with no subdirectory count as `(root)`.
- If all files are in `(root)` with no subdirectories, do not ask to narrow — no subfolders exist. Instead suggest `--no-cluster` to skip the expensive clustering step and proceed.
- Otherwise rank by count, show the top 5 with file counts, then ask which subfolder to run on. Wait for the user's answer before proceeding.
- Otherwise: proceed directly to Step 2.5 if video files were detected, or Step 3 if not.
### Step 2.5 - Video and audio (only if video files detected)
Skip this step entirely if `detect` returned zero `video` files. When the corpus has video or audio, see `references/transcribe.md` to transcribe them to text first, then treat the transcripts as doc files in Step 3.
### Step 3 - Extract entities and relationships
**Before starting:** note whether `--mode deep` was given. You must pass `DEEP_MODE=true` to every subagent in Step B2 if it was. Track this from the original invocation - do not lose it.
This step has two parts: **structural extraction** (deterministic, free) and **semantic extraction** (LLM, costs tokens).
> **graphify needs no API key. Never ask the user for one, and never block on one.** Code is extracted structurally (AST) with no LLM and no key at all — a code-only corpus (the common `/graphify .` on a repo) skips semantic extraction entirely, so it needs nothing here: go straight to Part A and skip Part B. Semantic extraction (only for docs, papers, and images) uses Gemini **only if** `GEMINI_API_KEY`/`GOOGLE_API_KEY` is already set; otherwise the host agent itself is the LLM. graphify does **not** read `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or any other provider key. If you catch yourself about to prompt for, wait on, or stop because of a missing API key, that is a misread of this skill — proceed without one.
**Before semantic extraction:** check whether `GEMINI_API_KEY` or `GOOGLE_API_KEY` is set. If neither is set, print this one-liner to the user:
> Tip: set `GEMINI_API_KEY` or `GOOGLE_API_KEY` to use Gemini for semantic extraction (`pip install 'graphifyy[gemini]'`).
Print it once, then continue — do not wait for the user to supply a key. If `GEMINI_API_KEY` or `GOOGLE_API_KEY` IS set, use `graphify.llm.extract_corpus_parallel(files, backend="gemini")` for semantic extraction instead of dispatching subagents. The default Gemini model is `gemini-3-flash-preview`; set `GRAPHIFY_GEMINI_MODEL` or pass `--model` in headless CLI flows to override it.
> **No other API keys are read.** When `GEMINI_API_KEY`/`GOOGLE_API_KEY` are unset, semantic extraction falls to the host agent itself — the running session is the LLM. On a host that dispatches subagents (e.g. Claude Code), dispatch them as written in Part B. On a host that runs the CLI directly in a terminal and cannot dispatch subagents, do not stall: a code-only corpus has no semantic work, so write the empty semantic file (Part B "Fast path") and continue to Part C; for a corpus with docs/papers/images, either set a Gemini key or extract those inline yourself, but in no case prompt for `ANTHROPIC_API_KEY` — that prompt is a misread of this skill.
**Run Part A (AST) and Part B (semantic) in parallel. Dispatch all semantic subagents AND start AST extraction in the same message. Both can run simultaneously since they operate on different file types. Merge results in Part C as before.**
Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is deterministic and fast; start it while subagents are processing docs/papers.
#### Part A - Structural extraction for code files
For any code files detected, run AST extraction in parallel with Part B subagents:
```bash
$(cat graphify-out/.graphify_python) -c "
import sys, json
from graphify.extract import collect_files, extract
from pathlib import Path
import json
code_files = []
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
for f in detect.get('files', {}).get('code', []):
code_files.extend(collect_files(Path(f)) if Path(f).is_dir() else [Path(f)])
if code_files:
# root= anchors node ids and source_file on the scan root; cache_root only says
# where graphify-out/cache lives. Pass both: without root= the anchor falls back
# to cache_root, so pointing the cache elsewhere would rename every node (#3727).
result = extract(code_files, cache_root=Path('INPUT_PATH'), root=Path('INPUT_PATH'))
Path('graphify-out/.graphify_ast.json').write_text(json.dumps(result, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'AST: {len(result[\"nodes\"])} nodes, {len(result[\"edges\"])} edges')
else:
Path('graphify-out/.graphify_ast.json').write_text(json.dumps({'nodes':[],'edges':[],'input_tokens':0,'output_tokens':0}, ensure_ascii=False), encoding=\"utf-8\")
print('No code files - skipping AST extraction')
"
```
#### Part B - Semantic extraction (parallel subagents)
**Fast path:** If detection found zero docs, papers, and images (code-only corpus), skip Part B entirely and go straight to Part C. AST handles code - there is nothing for semantic subagents to do. **First write an empty semantic file** so Part C's merge has its input (it reads `.graphify_semantic.json` unconditionally; without this a code-only run hits `FileNotFoundError`):
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
"
```
**MANDATORY: You MUST use the Agent tool here. Reading files yourself one-by-one is forbidden - it is 5-10x slower. If you do not use the Agent tool you are doing this wrong.**
Before dispatching subagents, print a timing estimate:
- Load `total_words` and file counts from `graphify-out/.graphify_detect.json`
- Estimate agents needed: `ceil(uncached_non_code_files / 22)` (chunk size is 20-25 files, capped at ~6000 total lines)
- Estimate time: ~45s per agent batch (they run in parallel, so total ≈ 45s × ceil(agents/parallel_limit))
- Print: "Semantic extraction: ~N files → X agents, estimated ~Ys"
**Step B0 - Check extraction cache first**
Before dispatching any subagents, check which files already have cached extraction results:
SPEC_PATH below is the **absolute** path of the `references/extraction-spec.md` that ships beside this SKILL.md — the same file Step B2 loads and hands to every subagent. It is the extraction prompt, so cache entries are attributed to it: when a graphify upgrade changes the prompt, entries produced by the old one are re-extracted instead of replayed, and unchanged prompts keep their entries (#1939). Substitute the real path in both Step B0 and Step B3 — pass the same one to each, and do not drop the argument.
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.cache import check_semantic_cache
from pathlib import Path
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
# Only content files go to semantic extraction. Code is already covered structurally
# by the AST pass (Part A); flattening every category here makes subagents re-read
# every source file (#1392). Video is transcribed to a document in Step 2.5 first.
all_files = [f for cat in ('document', 'paper', 'image') for f in detect['files'].get(cat, [])]
cached_nodes, cached_edges, cached_hyperedges, uncached = check_semantic_cache(all_files, root='INPUT_PATH', prompt_file='SPEC_PATH')
# Always (re)write the cache file: write hits, else DELETE any leftover from a prior
# run so Part C never merges a stale .graphify_cached.json (#1392).
if cached_nodes or cached_edges or cached_hyperedges:
Path('graphify-out/.graphify_cached.json').write_text(json.dumps({'nodes': cached_nodes, 'edges': cached_edges, 'hyperedges': cached_hyperedges}, ensure_ascii=False), encoding=\"utf-8\")
else:
Path('graphify-out/.graphify_cached.json').unlink(missing_ok=True)
Path('graphify-out/.graphify_uncached.txt').write_text('\n'.join(uncached), encoding=\"utf-8\")
# Nothing has been dispatched yet, so any chunk file on disk is a leftover from an
# interrupted run, and Step B3 merges every .graphify_chunk_*.json it finds.
for stale in Path('graphify-out').glob('.graphify_chunk_*.json'):
stale.unlink()
print(f'Cache: {len(all_files)-len(uncached)} files hit, {len(uncached)} files need extraction')
"
```
Only dispatch subagents for files listed in `graphify-out/.graphify_uncached.txt`. If all files are cached, skip Steps B1 and B2 but still run Step B3's commands: its merge is the only Part B step that writes `graphify-out/.graphify_semantic.json`, and Part C reads that file unconditionally. Do not write an empty `.graphify_semantic.json` instead, because that drops every cached node.
**Step B1 - Split into chunks**
Load files from `graphify-out/.graphify_uncached.txt`. Split into chunks bounded by BOTH limits: at most 20-25 files AND at most ~6000 total lines per chunk. A text file longer than 2000 lines gets a chunk to itself - that is past the Read tool's single-call cap, so sharing a chunk with other files guarantees it is only partly read. Each image gets its own chunk (vision needs separate context). When splitting, group files from the same directory together so related artifacts land in the same chunk and cross-file relationships are more likely to be extracted.
Both bounds matter. The line bound is not only about the 2000-line Read cap: a subagent holding 25 files splits its attention across all of them and skims the dense ones, and a 590-line plan can come back with zero nodes that way. Bounding content as well as file count is what keeps a chunk's coverage honest (#2225).
**Step B2 - Dispatch ALL subagents in a single message**
Call the Agent tool multiple times IN THE SAME RESPONSE - one call per chunk. This is the only way they run in parallel. If you make one Agent call, wait, then make another, you are doing it sequentially and defeating the purpose.
**IMPORTANT - subagent type:** Always use `subagent_type="general-purpose"`. Do NOT use `Explore` - it is read-only and cannot write chunk files to disk, which silently drops extraction results. General-purpose has Write and Bash access which the subagent needs.
Concrete example for 3 chunks:
```
[Agent tool call 1: files 1-15, subagent_type="general-purpose"]
[Agent tool call 2: files 16-30, subagent_type="general-purpose"]
[Agent tool call 3: files 31-45, subagent_type="general-purpose"]
```
All three in one message. Not three separate messages.
Each subagent receives this exact prompt (substitute FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE, and CHUNK_PATH).
CHUNK_PATH must be an **absolute** path — derive it before dispatching:
```bash
PROJECT_ROOT=$(pwd) # cwd — where Part C globs graphify-out/ (NOT .graphify_root/scan dir, #1392)
# Then for chunk N: CHUNK_PATH="${PROJECT_ROOT}/graphify-out/.graphify_chunk_0N.json"
```
Subagent prompt template:
See `references/extraction-spec.md` for the exact subagent prompt (JSON schema, node-ID rules, confidence rubric, frontmatter, hyperedge, and vision rules). Load it only here, only when at least one chunk holds a doc, paper, or image; a pure-code corpus has skipped Part B and never reads it. Pass each subagent that prompt verbatim with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE, and CHUNK_PATH substituted, and have it write the result to CHUNK_PATH.
**Step B3 - Collect, cache, and merge**
Wait for all subagents. For each result:
- Check that `graphify-out/.graphify_chunk_NN.json` exists on disk — this is the success signal
- If the file exists and contains valid JSON with `nodes` and `edges`, include it and save to cache
- If the file is missing, the subagent was likely dispatched as read-only (Explore type) — print a warning: "chunk N missing from disk — subagent may have been read-only. Re-run with general-purpose agent." Do not silently skip.
- If a subagent failed or returned invalid JSON, print a warning and skip that chunk - do not abort
If more than half the chunks failed or are missing, stop and tell the user to re-run and ensure `subagent_type="general-purpose"` is used.
**Step B3.5 - Verify each reported file was actually read to its end**
A subagent that only read the first Read call's worth of a long file still writes a well-formed chunk, so "chunk file exists and parses" is not evidence of coverage. Compare each file's self-reported `coverage` against its real length:
```bash
$(cat graphify-out/.graphify_python) -c "
import json, glob
from pathlib import Path
covered = {}
for c in sorted(glob.glob('graphify-out/.graphify_chunk_*.json')):
d = json.loads(Path(c).read_text(encoding=\"utf-8\"))
for src, n in (d.get('coverage') or {}).items():
covered[src] = max(covered.get(src, 0), int(n))
partial = []
for src, n in sorted(covered.items()):
p = Path(src)
if not p.is_absolute():
p = Path('INPUT_PATH') / src
if not p.is_file():
continue
total = sum(1 for _ in p.open(encoding='utf-8', errors='replace'))
if total and n < total:
partial.append((src, n, total))
Path('graphify-out/.graphify_partial.txt').write_text('\n'.join(s for s, _, _ in partial), encoding=\"utf-8\")
if partial:
print(f'WARNING: {len(partial)} file(s) were only partly read. They are cached as partial and retried on the next --update:')
for src, n, total in partial:
print(f' {src}: read {n} of {total} lines')
else:
print('Coverage OK - every file a subagent reported was read to its last line')
"
```
Tell the user which files came up short and what was lost (the line counts are printed above). The nodes already extracted for those files are kept - they are still true - but the file is cached as partial and left unstamped in the manifest below, so the next `--update` re-dispatches it and replace-on-re-extract swaps the partial node set for a complete one. This is the same mechanism the library path uses for a truncated LLM response (#933, #1950), so both paths now recover instead of silently keeping a half-read file forever. A file a subagent did not report at all is not counted as partial - there is nothing to compare against - which is why the prompt rule in `references/extraction-spec.md` asks for the count in the first place.
Merge all chunk files into `.graphify_semantic_new.json`. **After each Agent call completes, read the real token counts from the Agent tool result's `usage` field and write them back into the chunk JSON before merging** — the chunk JSON itself always has placeholder zeros. Then run:
```bash
$(cat graphify-out/.graphify_python) -c "
import json, glob
from pathlib import Path
chunks = sorted(glob.glob('graphify-out/.graphify_chunk_*.json'))
all_nodes, all_edges, all_hyperedges = [], [], []
total_in, total_out = 0, 0
for c in chunks:
d = json.loads(Path(c).read_text(encoding=\"utf-8\"))
all_nodes += d.get('nodes', [])
all_edges += d.get('edges', [])
all_hyperedges += d.get('hyperedges', [])
total_in += d.get('input_tokens', 0)
total_out += d.get('output_tokens', 0)
Path('graphify-out/.graphify_semantic_new.json').write_text(json.dumps({
'nodes': all_nodes, 'edges': all_edges, 'hyperedges': all_hyperedges,
'input_tokens': total_in, 'output_tokens': total_out,
}, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'Merged {len(chunks)} chunks: {total_in:,} in / {total_out:,} out tokens')
"
```
Save new results to cache. Pass the same SPEC_PATH as Step B0 — it stamps each entry with the prompt that produced it, and a write under a different prompt than the read lands where the next run won't look (#1939):
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.cache import save_semantic_cache
from pathlib import Path
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
uncached = [line for line in Path('graphify-out/.graphify_uncached.txt').read_text(encoding=\"utf-8\").splitlines() if line]
# A partly-read file is cached with partial: True, which load_cached treats as a MISS,
# so the next --update re-dispatches it instead of serving a truncated extraction forever
# (#2225). Same contract the library path uses for a truncated LLM response (#933/#1950).
partial = [line for line in Path('graphify-out/.graphify_partial.txt').read_text(encoding=\"utf-8\").splitlines() if line] if Path('graphify-out/.graphify_partial.txt').exists() else []
saved = save_semantic_cache(new.get('nodes', []), new.get('edges', []), new.get('hyperedges', []), root='INPUT_PATH', allowed_source_files=uncached, prompt_file='SPEC_PATH', partial_source_files=partial)
note = f' ({len(partial)} left partial for retry)' if partial else ''
print(f'Cached {saved} files' + note)
"
```
Merge cached + new results into `graphify-out/.graphify_semantic.json`:
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
cached = json.loads(Path('graphify-out/.graphify_cached.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_cached.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
all_nodes = cached['nodes'] + new.get('nodes', [])
all_edges = cached['edges'] + new.get('edges', [])
all_hyperedges = cached.get('hyperedges', []) + new.get('hyperedges', [])
seen = set()
deduped = []
for n in all_nodes:
if n['id'] not in seen:
seen.add(n['id'])
deduped.append(n)
merged = {
'nodes': deduped,
'edges': all_edges,
'hyperedges': all_hyperedges,
'input_tokens': new.get('input_tokens', 0),
'output_tokens': new.get('output_tokens', 0),
}
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'Extraction complete - {len(deduped)} nodes, {len(all_edges)} edges ({len(cached[\"nodes\"])} from cache, {len(new.get(\"nodes\",[]))} new)')
"
```
Clean up temp files: `rm -f graphify-out/.graphify_cached.json graphify-out/.graphify_uncached.txt graphify-out/.graphify_semantic_new.json`
#### Part C - Merge AST + semantic into final extraction
```bash
$(cat graphify-out/.graphify_python) -c "
import sys, json
from pathlib import Path
ast = json.loads(Path('graphify-out/.graphify_ast.json').read_text(encoding=\"utf-8\"))
sem = json.loads(Path('graphify-out/.graphify_semantic.json').read_text(encoding=\"utf-8\"))
# Stamp tier provenance on the semantic side. build._is_ast_tier reads
# _origin when present and otherwise guesses from the SHAPE of
# source_location ('L<line>' means AST). A subagent that writes 'L12' for a
# doc section therefore made that node read as AST, and the next
# graphify update deleted it along with the re-extracted code file it
# seemed to belong to (#2843). extract() stamps its own items 'ast'; the
# semantic side must say so explicitly.
for n in sem['nodes']:
n.setdefault('_origin', 'semantic')
for e in sem['edges']:
e.setdefault('_origin', 'semantic')
# Merge: AST nodes first, semantic nodes deduplicated by id
seen = {n['id'] for n in ast['nodes']}
merged_nodes = list(ast['nodes'])
for n in sem['nodes']:
if n['id'] not in seen:
merged_nodes.append(n)
seen.add(n['id'])
merged_edges = ast['edges'] + sem['edges']
merged_hyperedges = sem.get('hyperedges', [])
merged = {
'nodes': merged_nodes,
'edges': merged_edges,
'hyperedges': merged_hyperedges,
'input_tokens': sem.get('input_tokens', 0),
'output_tokens': sem.get('output_tokens', 0),
}
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
total = len(merged_nodes)
edges = len(merged_edges)
print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(sem[\"nodes\"])} semantic)')
"
```
### Step 4 - Build graph, cluster, analyze, generate outputs
**Before starting:** the code blocks below pass `directed=IS_DIRECTED` to `build_from_json()`. Replace `IS_DIRECTED` with `True` if `--directed` was given (builds a `DiGraph` preserving edge direction source→target), otherwise `False` (the default undirected `Graph`). Substitute it the same way you substitute `INPUT_PATH` — do not leave the literal `IS_DIRECTED` in the code.
```bash
mkdir -p graphify-out
$(cat graphify-out/.graphify_python) -c "
import sys, json
from graphify.build import build_from_json
from graphify.cluster import cluster, score_all
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
from graphify.report import generate
from graphify.export import to_json
from pathlib import Path
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
# root= mirrors the --update runbook (#1361): relativize source_file to the same
# base so the full build and incremental --update never drift apart on re-extract.
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
# Guard BEFORE any write: an empty extraction must not clobber a good graph.json /
# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392).
if G.number_of_nodes() == 0:
print('ERROR: Graph is empty - extraction produced no nodes.')
print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')
raise SystemExit(1)
communities = cluster(G)
cohesion = score_all(G, communities)
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
gods = god_nodes(G)
surprises = surprising_connections(G, communities)
labels = {cid: 'Community ' + str(cid) for cid in communities}
# Placeholder questions - regenerated with real labels in Step 5
questions = suggest_questions(G, communities, labels)
# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing
# nothing) when the new graph is smaller than the existing graph.json. Only write
# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so
# they never describe a graph that graph.json doesn't contain (#1392).
wrote = to_json(G, communities, 'graphify-out/graph.json')
if not wrote:
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
raise SystemExit(1)
report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
analysis = {
'communities': {str(k): v for k, v in communities.items()},
'cohesion': {str(k): v for k, v in cohesion.items()},
'gods': gods,
'surprises': surprises,
'questions': questions,
}
Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities')
"
```
If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization.
Replace INPUT_PATH with the actual path.
### Step 4.5 - Graph health check (read-only integrity gate)
A non-destructive diagnostic on the extraction, before labeling. It surfaces edge collapse, dangling/missing endpoints, and self-loops — the silent-corruption modes of incremental updates and AST/LLM id mismatches. Read-only; never aborts.
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
from graphify.diagnostics import diagnose_extraction, format_diagnostic_report
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
summary = diagnose_extraction(extraction, directed=IS_DIRECTED, root='INPUT_PATH')
print(format_diagnostic_report(summary))
flags = [f'{summary[k]} {label}' for k, label in (
('dangling_endpoint_edges', 'dangling-endpoint edges'),
('missing_endpoint_edges', 'missing-endpoint edges'),
('self_loop_edges', 'self-loop edges'),
('directed_same_endpoint_collapsed_edges', 'collapsed (directed) edges'),
('undirected_same_endpoint_collapsed_edges', 'collapsed (undirected) edges'),
) if summary.get(k, 0)]
print('GRAPH HEALTH WARNING: ' + '; '.join(flags) + ' - graph may be incomplete/corrupt.' if flags else 'Graph health: OK (no dangling/missing/collapsed edges).')
"
```
Substitute `IS_DIRECTED` and `INPUT_PATH` as in Step 4. If a `GRAPH HEALTH WARNING` prints, surface it in the final summary (do not abort — the graph is still usable, but the integrity issue must be visible, per the Honesty Rules).
### Step 5 - Label communities
Read `graphify-out/.graphify_analysis.json`. For each community key, look at its node labels and write a 2-5 word plain-language name (e.g. "Attention Mechanism", "Training Pipeline", "Data Loading").
Then regenerate the report and save the labels for the visualizer:
```bash
$(cat graphify-out/.graphify_python) -c "
import sys, json
from graphify.build import build_from_json
from graphify.cluster import score_all
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
from graphify.report import generate
from graphify.export import to_json
from pathlib import Path
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text(encoding=\"utf-8\"))
# root= as in Step 4 / the --update runbook (#1361) — same base for node-key parity.
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
communities = {int(k): v for k, v in analysis['communities'].items()}
cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
# LABELS - replace these with the names you chose above
labels = LABELS_DICT
# Regenerate questions with real community labels (labels affect question phrasing)
questions = suggest_questions(G, communities, labels)
report = generate(G, communities, cohesion, labels, analysis['gods'], analysis['surprises'], detection, tokens, 'INPUT_PATH', suggested_questions=questions)
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
Path('graphify-out/.graphify_labels.json').write_text(json.dumps({str(k): v for k, v in labels.items()}, ensure_ascii=False), encoding=\"utf-8\")
# Re-export so graph.json nodes carry the curated community_name (#2490).
# Same extraction as Step 4, so the #479 shrink-guard passes on node count;
# if it still refuses, surface the guard message - do not force past it.
wrote = to_json(G, communities, 'graphify-out/graph.json', community_labels=labels)
if not wrote:
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
print('Report updated with community labels')
"
```
Replace `LABELS_DICT` with the actual dict you constructed (e.g. `{0: "Attention Mechanism", 1: "Training Pipeline"}`).
Replace INPUT_PATH with the actual path.
### Step 6 - Generate Obsidian vault (opt-in) + HTML
**Generate HTML always** (unless `--no-viz`). **Obsidian vault only if `--obsidian` was explicitly given** — skip it otherwise, it generates one file per node.
If `--obsidian` was given:
- If `--obsidian-dir <path>` was also given, pass it via `--dir`. Otherwise defaults to `graphify-out/obsidian`.
```bash
graphify export obsidian
# or with custom dir: graphify export obsidian --dir ~/vaults/my-project
```
Generate the HTML graph (always, unless `--no-viz`):
```bash
graphify export html # auto-aggregates to community view if graph > 5000 nodes
# or: graphify export html --no-viz
```
### Steps 6b-8 - Wiki, Neo4j, FalkorDB, SVG, GraphML, MCP, benchmark (only on their flags)
These run only when their flag is present (`--wiki`, `--neo4j`/`--neo4j-push`, `--falkordb`/`--falkordb-push`, `--svg`, `--graphml`, `--mcp`) or, for the token-reduction benchmark, when `total_words` exceeds 5,000. A default run with no export flags skips all of them. See `references/exports.md` for each one. Run any `--wiki` export before Step 9 cleanup so `.graphify_labels.json` is still available.
---
### Step 9 - Save manifest, update cost tracker, clean up, and report
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
from datetime import datetime, timezone
from graphify.detect import save_manifest
# Save manifest for --update
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
# In --update mode, 'all_files' carries the full corpus; 'files' is the changed
# subset. Full-rebuild mode populates only 'files', so the fallback handles that.
# root= relativizes the manifest keys to the scan root (same base as the build),
# so the on-disk manifest is portable across clones/machines and a later --update
# matches cached files instead of missing every one (#1417).
#
# Only stamp semantic files (docs/papers/images) that ACTUALLY produced output:
# a detected file whose chunk failed or was omitted must stay unstamped so the
# next --update re-queues it, otherwise it is marked done and its content is lost
# forever (#2015). This mirrors the library extract path exactly
# (cli._stamped_manifest_files + clear_semantic + scan_corpus); do not stamp the
# raw corpus. Code files are always stamped (AST is deterministic); only semantic
# types are gated on output.
from graphify.cli import _stamped_manifest_files
_corpus = detect.get('all_files') or detect['files']
# A file a subagent only partly read DID produce output, so the stamp filter alone would
# keep it - but its node set covers just the head of the file, and stamping it means
# detect_incremental reads it as done and never re-queues it, leaving the truncated graph
# live forever. Name those files so they stay unstamped and are retried next run (#2225).
_pf = Path('graphify-out/.graphify_partial.txt')
_partial = {l.strip() for l in _pf.read_text(encoding=\"utf-8\").splitlines() if l.strip()} if _pf.exists() else set()
_manifest_files = _stamped_manifest_files(_corpus, extract, Path('INPUT_PATH'), partial_source_files=_partial)
# Files dispatched this run (the changed subset) but NOT stamped above still carry
# a stale semantic_hash from a prior run; clear it so detect_incremental re-queues
# them instead of reading them as unchanged (#1948).
_sem_types = ('document', 'paper', 'image')
_dispatched = {f for t, fl in detect['files'].items() if t in _sem_types for f in fl}
_stamped = {f for fl in _manifest_files.values() for f in fl}
_cleared = _dispatched - _stamped
# scan_corpus = the RAW full corpus (not the stamp-filtered subset) so in-root
# files newly excluded since last run are dropped rather than masquerading as
# deletions; untouched files' prior rows are still preserved (#1908).
_scan = {f for fl in _corpus.values() for f in fl}
save_manifest(_manifest_files, root='INPUT_PATH', scan_corpus=_scan, clear_semantic=_cleared or None)
# Update cumulative cost tracker
input_tok = extract.get('input_tokens', 0)
output_tok = extract.get('output_tokens', 0)
cost_path = Path('graphify-out/cost.json')
if cost_path.exists():
cost = json.loads(cost_path.read_text(encoding=\"utf-8\"))
else:
cost = {'runs': [], 'total_input_tokens': 0, 'total_output_tokens': 0}
cost['runs'].append({
'date': datetime.now(timezone.utc).isoformat(),
'input_tokens': input_tok,
'output_tokens': output_tok,
'files': detect.get('total_files', 0),
})
cost['total_input_tokens'] += input_tok
cost['total_output_tokens'] += output_tok
cost_path.write_text(json.dumps(cost, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
"
rm -f graphify-out/.graphify_detect.json graphify-out/.graphify_extract.json graphify-out/.graphify_ast.json graphify-out/.graphify_semantic.json graphify-out/.graphify_analysis.json graphify-out/.graphify_partial.txt
find graphify-out -maxdepth 1 -name '.graphify_chunk_*.json' -delete 2>/dev/null
rm -f graphify-out/.needs_update 2>/dev/null || true
```
Replace INPUT_PATH with the actual path (same value used in Steps 4-5) so the manifest is relativized to the scan root.
Tell the user (omit the obsidian line unless --obsidian was given):
```
Graph complete. Outputs in PATH_TO_DIR/graphify-out/
graph.html - interactive graph, open in browser
GRAPH_REPORT.md - audit report
graph.json - raw graph data
obsidian/ - Obsidian vault (only if --obsidian was given)
```
If graphify saved you time, consider supporting it: https://github.com/sponsors/safishamsi
Replace PATH_TO_DIR with the actual absolute path of the directory that was processed.
If PATH_TO_DIR is inside a git repository, add one line to the report: `graphify-out/` was written into the working tree, so unless the repository already ignores it, it will show in `git status`; the user can add `graphify-out/` to `.gitignore`, or commit only the outputs their team should share (see https://docs.graphify.com/guides/team-workflows).
Then paste these sections from GRAPH_REPORT.md directly into the chat:
- God Nodes
- Surprising Connections
- Suggested Questions
Do NOT paste the full report - just those three sections. Keep it concise.
Then immediately offer to explore. Pick the single most interesting suggested question from the report - the one that crosses the most community boundaries or has the most surprising bridge node - and ask:
> "The most interesting question this graph can answer: **[question]**. Want me to trace it?"
If the user says yes, run `/graphify query "[question]"` on the graph and walk them through the answer using the graph structure - which nodes connect, which community boundaries get crossed, what the path reveals. Keep going as long as they want to explore. Each answer should end with a natural follow-up ("this connects to X - want to go deeper?") so the session feels like navigation, not a one-shot report.
The graph is the map. Your job after the pipeline is to be the guide.
---
## Interpreter guard for subcommands
Before running any subcommand below (`--update`, `--cluster-only`, `query`, `path`, `explain`, `add`), check that `.graphify_python` exists. If it's missing (e.g. user deleted `graphify-out/`), re-resolve the interpreter first:
```bash
if [ ! -f graphify-out/.graphify_python ]; then
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
if [ -n "$GRAPHIFY_BIN" ]; then
PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
case "$PYTHON" in *[!a-zA-Z0-9/_.@-]*) PYTHON="python3" ;; esac
else
PYTHON="python3"
fi
mkdir -p graphify-out
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
fi
```
## For --update and --cluster-only
Both are non-default subcommands. `--update` re-extracts only new or changed files; `--cluster-only` reruns clustering on the existing graph. See `references/update.md` for both flows.
---
## For /graphify query
When `graphify-out/graph.json` already exists and the user asks a question about the corpus, answer from the graph rather than rebuilding it:
```bash
graphify query "<question>"
```
Before traversal, expand the question against the graph's own vocabulary so a wording mismatch does not collapse the answer to noise. If the `graphify query` CLI is unavailable, fall back to an inline NetworkX traversal of `graphify-out/graph.json`. Answer using only what the graph output contains, and quote `source_location` when citing a specific fact. For that vocab-expansion step, the BFS/DFS traversal modes, the `--budget` cap, the NetworkX fallback, `save-result` feedback, and the `/graphify path` and `/graphify explain` flows, see `references/query.md`.
---
## For /graphify add and --watch
Neither is part of the default build. When the user runs `/graphify add <url>` to fetch a URL into the corpus, or passes `--watch` to auto-rebuild on file changes, see `references/add-watch.md`.
---
## For the commit hook and native CLAUDE.md integration
When the user asks to install the post-commit auto-rebuild hook or wire graphify into a project's CLAUDE.md, see `references/hooks.md`.
---
## Honesty Rules
- Never invent an edge. If unsure, use AMBIGUOUS.
- Never skip the corpus check warning.
- Always show token cost in the report.
- Never hide cohesion scores behind symbols - show the raw number.
- Never run HTML viz on a graph with more than 5,000 nodes without warning the user.
@@ -0,0 +1,56 @@
# graphify reference: add a URL and watch a folder
Load this when the user ran `/graphify add <url>` or passed `--watch`. Neither is part of the default build.
## For /graphify add
Fetch a URL and add it to the corpus, then update the graph.
```bash
$(cat graphify-out/.graphify_python) -c "
import sys
from graphify.ingest import ingest
from pathlib import Path
try:
out = ingest('URL', Path('./raw'), author='AUTHOR', contributor='CONTRIBUTOR')
print(f'Saved to {out}')
except ValueError as e:
print(f'error: {e}', file=sys.stderr)
sys.exit(1)
except RuntimeError as e:
print(f'error: {e}', file=sys.stderr)
sys.exit(1)
"
```
Replace `URL` with the actual URL, `AUTHOR` with the user's name if provided, `CONTRIBUTOR` likewise. If the command exits with an error, tell the user what went wrong - do not silently continue. After a successful save, automatically run the `--update` pipeline on `./raw` to merge the new file into the existing graph.
Supported URL types (auto-detected):
- YouTube / any video URL → audio downloaded via yt-dlp, transcribed to `.txt` on next run (requires `pip install 'graphifyy[video]'`)
- Twitter/X → fetched via oEmbed, saved as `.md` with tweet text and author
- arXiv → abstract + metadata saved as `.md`
- PDF → downloaded as `.pdf`
- Images (.png/.jpg/.webp) → downloaded, Claude vision extracts on next run
- Any webpage → converted to markdown via html2text
---
## For --watch
Start a background watcher that monitors a folder and auto-updates the graph when files change.
```bash
$(cat graphify-out/.graphify_python) -m graphify.watch "$(cat graphify-out/.graphify_root)" --debounce 3
```
This watches the same folder graphify extracted, read from the trusted `graphify-out/.graphify_root` that Step 1 resolved - there is no path to substitute, so a scan root containing shell metacharacters can never be re-interpreted here. Behavior depends on what changed:
- **Code files only (.py, .ts, .go, etc.):** re-runs AST extraction + rebuild + cluster immediately, no LLM needed. `graph.json` and `GRAPH_REPORT.md` are updated automatically.
- **Docs, papers, or images:** writes a `graphify-out/needs_update` flag and prints a notification to run `/graphify --update` (LLM semantic re-extraction required).
Debounce (default 3s): waits until file activity stops before triggering, so a wave of parallel agent writes doesn't trigger a rebuild per file.
Press Ctrl+C to stop.
For agentic workflows: run `--watch` in a background terminal. Code changes from agent waves are picked up automatically between waves. If agents are also writing docs or notes, you'll need a manual `/graphify --update` after those waves.
@@ -0,0 +1,91 @@
# graphify reference: extra exports and benchmark
Load this when the user passed one of the export flags (`--wiki`, `--neo4j`, `--neo4j-push`, `--falkordb`, `--falkordb-push`, `--svg`, `--graphml`, `--mcp`), or when the corpus is large enough for the token-reduction benchmark. Each step runs only for its own flag.
### Step 6b - Wiki (only if --wiki flag)
**Only run this step if `--wiki` was explicitly given in the original command.**
Run this before Step 9 (cleanup) so `.graphify_labels.json` is still available.
```bash
graphify export wiki
```
### Step 7 - Neo4j export (only if --neo4j or --neo4j-push flag)
**If `--neo4j`** - generate a Cypher file for manual import:
```bash
graphify export neo4j
```
**If `--neo4j-push`** - push directly to Neo4j using the destination URI supplied with the original `/graphify` command. Only push when this flag was explicitly given.
Pass the exact URI from the original `/graphify` command as one argument. When constructing a shell command, quote the URI for the shell that will execute the command (use `shlex.quote` for POSIX shells), or use a structured argument interface. Keep the URI as data; never interpolate it unquoted or evaluate it as shell code. Never replace a supplied URI with localhost. If the user explicitly requested a push but supplied no URI, use the documented local default. Do not print the URI or credentials in status output or generated artifacts.
```bash
graphify export neo4j --push 'bolt://remote-host:7687' --user neo4j
```
Default URI is `bolt://localhost:7687`, default user is `neo4j`. Prefer the `NEO4J_PASSWORD` environment variable so the password is kept off argv; ask for credentials only when needed. Uses MERGE - safe to re-run without creating duplicates.
### Step 7a - FalkorDB export (only if --falkordb or --falkordb-push flag)
**If `--falkordb`** - generate a Cypher file. The statements are OpenCypher, but FalkorDB's `GRAPH.QUERY` runs one statement at a time (no bulk script import like Neo4j's `cypher-shell`), so prefer `--falkordb-push` to load a graph. Use this only when you want the portable `cypher.txt` artifact:
```bash
graphify export falkordb
```
**If `--falkordb-push`** - push directly to FalkorDB using the destination URI supplied with the original `/graphify` command. Only push when this flag was explicitly given.
Pass the exact URI from the original `/graphify` command as one argument. When constructing a shell command, quote the URI for the shell that will execute the command (use `shlex.quote` for POSIX shells), or use a structured argument interface. Keep the URI as data; never interpolate it unquoted or evaluate it as shell code. Never replace a supplied URI with localhost. If the user explicitly requested a push but supplied no URI, use the documented local default. Do not print the URI or credentials in status output or generated artifacts. Credentials are optional; ask only if the instance requires authentication, and use `FALKORDB_PASSWORD` for a password rather than printing it.
```bash
graphify export falkordb --push 'falkordb://remote-host:6379'
```
Default URI is `falkordb://localhost:6379` (the scheme is informational - `redis://` or a bare `host:port` work too), auth is optional, and the target graph defaults to `graphify`. Uses MERGE - safe to re-run without creating duplicates.
### Step 7b - SVG export (only if --svg flag)
```bash
graphify export svg
```
### Step 7c - GraphML export (only if --graphml flag)
```bash
graphify export graphml
```
### Step 7d - MCP server (only if --mcp flag)
```bash
$(cat graphify-out/.graphify_python) -m graphify.serve graphify-out/graph.json
```
This starts a stdio MCP server that exposes tools: `query_graph`, `get_node`, `get_neighbors`, `get_community`, `god_nodes`, `graph_stats`, `shortest_path`. Add to Claude Desktop or any MCP-compatible agent orchestrator so other agents can query the graph live.
To configure in Claude Desktop, add to `claude_desktop_config.json`. Claude Desktop can't run `$(...)`, and under `uv tool install` the system `python3` can't import graphify — so set `command` to the **absolute interpreter path** printed by `cat graphify-out/.graphify_python`:
```json
{
"mcpServers": {
"graphify": {
"command": "<absolute path from: cat graphify-out/.graphify_python>",
"args": ["-m", "graphify.serve", "/absolute/path/to/graphify-out/graph.json"]
}
}
}
```
### Step 8 - Token reduction benchmark (only if total_words > 5000)
If `total_words` from `graphify-out/.graphify_detect.json` is greater than 5,000, run:
```bash
graphify benchmark
```
Print the output directly in chat. If `total_words <= 5000`, skip silently - the graph value is structural clarity, not token compression, for small corpora.
@@ -0,0 +1,86 @@
# graphify reference: extraction subagent prompt
Load this in Step 3 Part B when the corpus has at least one doc, paper, or image chunk. A pure-code corpus skips Part B and never reads this file. Each semantic subagent receives the prompt below verbatim (substitute FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE, and CHUNK_PATH).
```
You are a graphify extraction subagent. Read the files listed and extract a knowledge graph fragment.
Output ONLY valid JSON matching the schema below - no explanation, no markdown fences, no preamble.
Files (chunk CHUNK_NUM of TOTAL_CHUNKS):
FILE_LIST
Read every file in this list COMPLETELY before extracting anything from it. The Read tool
returns at most 2000 lines per call and reports NO error and NO warning when it truncates, so a
long file silently yields a partial extraction. When a file is longer than one call, keep paging
with offset/limit until you have actually seen its last line - never assume the first call
returned the whole file. Never emit nodes for a file you have only partly read. A partial
extraction is worse than none: replace-on-re-extract first DROPS that file's existing nodes and
then re-adds only what you saw, so the unread tail disappears from the graph, and the file is then
recorded as successfully extracted and never retried (#2225).
Report the coverage you actually achieved, so a short read is caught instead of guessed at: add a
top-level "coverage" object mapping each FILE_LIST path you extracted to the number of lines you
read, e.g. {"coverage": {"docs/plan.md": 452}}. If you could not reach a file's last line, still
report the count you did read. A short count is recoverable - Step B3 warns, the entry is cached
as partial, and the next --update retries the file - whereas a missing entry is indistinguishable
from a complete read.
Rules:
- EXTRACTED: relationship explicit in source (import, call, citation, "see §3.2")
- INFERRED: reasonable inference (shared data structure, implied dependency)
- AMBIGUOUS: uncertain - flag for review, do not omit
Code files: focus on semantic edges AST cannot find (call relationships, shared data, arch patterns).
Do not re-extract imports - AST already has those.
Doc/paper files: extract named concepts, entities, citations. For rationale (WHY decisions were made, trade-offs, design intent): store as a `rationale` attribute on the relevant concept node — do NOT create a separate rationale node or fragment node. Only create a node for something that is itself a named entity or concept. Use `file_type:"rationale"` for concept-like nodes (ideas, principles, mechanisms, design patterns). `file_type` MUST be one of exactly these six values: `code`, `document`, `paper`, `image`, `rationale`, `concept`. Any other value is invalid and will be rejected.
Code files: when adding `calls` edges, source MUST be the caller (the function/class doing the calling), target MUST be the callee. Never reverse this direction. `calls` edges MUST stay within one language: a Python function cannot `calls` a JS/TS/Go/Rust/Java symbol and vice versa — cross-language call edges are phantom artifacts, never emit them.
Image files: use vision to understand what the image IS - do not just OCR.
UI screenshot: layout patterns, design decisions, key elements, purpose.
Chart: metric, trend/insight, data source.
Tweet/post: claim as node, author, concepts mentioned.
Diagram: components and connections.
Research figure: what it demonstrates, method, result.
Handwritten/whiteboard: ideas and arrows, mark uncertain readings AMBIGUOUS.
DEEP_MODE (if --mode deep was given): be aggressive with INFERRED edges - indirect deps,
shared assumptions, latent couplings. Mark uncertain ones AMBIGUOUS instead of omitting.
Semantic similarity: if two concepts in this chunk solve the same problem or represent the same idea without any structural link (no import, no call, no citation), add a `semantically_similar_to` edge marked INFERRED with a confidence_score reflecting how similar they are (0.6-0.95). Examples:
- Two functions that both validate user input but never call each other
- A class in code and a concept in a paper that describe the same algorithm
- Two error types that handle the same failure mode differently
Only add these when the similarity is genuinely non-obvious and cross-cutting. Do not add them for trivially similar things.
Hyperedges: if 3 or more nodes clearly participate together in a shared concept, flow, or pattern that is not captured by pairwise edges alone, add a hyperedge to a top-level `hyperedges` array. Examples:
- All classes that implement a common protocol or interface
- All functions in an authentication flow (even if they don't all call each other)
- All concepts from a paper section that form one coherent idea
Use sparingly — only when the group relationship adds information beyond the pairwise edges. Maximum 3 hyperedges per chunk.
If a file has YAML frontmatter (--- ... ---), copy source_url, captured_at, author,
contributor onto every node from that file.
confidence_score is REQUIRED on every edge - never omit it, never use 0.5 as a default:
- EXTRACTED edges: confidence_score = 1.0 always
- INFERRED edges: pick exactly ONE value from this set — never 0.5:
0.95 direct structural evidence (shared data structure, named cross-file reference).
0.85 strong inference (clear functional alignment, no direct symbol link).
0.75 reasonable inference (shared problem domain + similar shape, requires interpretation).
0.65 weak inference (thematically related, no shape evidence).
0.55 speculative but plausible (surface-level co-occurrence only).
Models follow discrete rubrics better than continuous ranges; the bimodal
distribution observed in production (>50% at 0.5, >40% at 0.85+) shows the
range guidance is being collapsed to a binary. If no value above fits, mark
the edge AMBIGUOUS rather than picking 0.4 or below.
- AMBIGUOUS edges: 0.1-0.3
Node ID format: lowercase, word characters only (`[^\W]` after casefolding — `[a-z0-9_]` for ASCII input, but non-ASCII letters and digits are kept as-is), no dots or slashes. Format: `{stem}_{entity}` where stem is the **full repo-relative path with the extension dropped**, every path segment kept and joined with `_` (each segment lowercased with non-alphanumeric chars replaced by `_`), and entity is the symbol name similarly normalized. Use every directory level, not just the immediate parent — this keeps same-named files in different directories distinct. Examples: `src/auth/session.py` + `ValidateToken` → `src_auth_session_validatetoken`; `lib/utils/helpers.py` + `parse_url` → `lib_utils_helpers_parse_url`; `tests/test_foo.py` + `_helper` → `tests_test_foo_helper`; `docs/v1/api/README.md` + `getUser` → `docs_v1_api_readme_getuser`. Top-level files (no parent dir, e.g. `setup.py`) use just the filename stem: `setup_my_func`. This must match the ID the AST extractor generates — using just the filename (e.g., `session_validatetoken`) or only the immediate parent (e.g., `auth_session_validatetoken`) will create orphan ghost-duplicate nodes. If you are re-extracting a project built under the old immediate-parent format, the user should run `graphify extract --force` to rebuild cleanly. CRITICAL: never append chunk numbers, sequence numbers, or any suffix to an ID (no `_c1`, `_c2`, `_chunk2`, etc.). IDs must be deterministic from the label alone — the same entity must always produce the same ID regardless of which chunk processes it.
Generate the extraction JSON matching this schema exactly:
{"nodes":[{"id":"auth_session_validatetoken","label":"Human Readable Name","file_type":"code|document|paper|image|rationale|concept","source_file":"<FILE_LIST path verbatim>","source_location":null,"source_url":null,"captured_at":null,"author":null,"contributor":null}],"edges":[{"source":"node_id","target":"node_id","relation":"calls|implements|references|cites|conceptually_related_to|shares_data_with|semantically_similar_to|rationale_for","confidence":"EXTRACTED|INFERRED|AMBIGUOUS","confidence_score":1.0,"source_file":"<FILE_LIST path verbatim>","source_location":null,"weight":1.0}],"hyperedges":[{"id":"snake_case_id","label":"Human Readable Label","nodes":["node_id1","node_id2","node_id3"],"relation":"participate_in|implement|form","confidence":"EXTRACTED|INFERRED","confidence_score":0.75,"source_file":"<FILE_LIST path verbatim>"}],"input_tokens":0,"output_tokens":0,"coverage":{"<FILE_LIST path verbatim>":0}}
source_file RULE (every node, edge, and hyperedge): set source_file to the path of the originating file EXACTLY as it appears in FILE_LIST — verbatim and absolute. Do NOT shorten to a basename, do NOT re-relativize, do NOT strip any directory prefix, and do NOT change separators (the engine canonicalizes separators and relativizes against the build root downstream). Copy the FILE_LIST entry character-for-character. This keeps the full build and incremental --update on the same base, so build_merge's replace-on-re-extract matches the existing node instead of accumulating a duplicate.
Then write the JSON to disk using the Write tool at this exact absolute path (no relative paths — Write resolves relative paths against an undefined cwd and the file will be silently lost):
CHUNK_PATH
```
@@ -0,0 +1,46 @@
# graphify reference: GitHub clone and cross-repo merge
Load this when the user passed one or more `https://github.com/...` URLs, or named several local subfolders to merge into one graph.
### Step 0 - Clone GitHub repo(s) (only if a GitHub URL was given)
**Single repo:**
```bash
LOCAL_PATH=$(graphify clone <github-url> [--branch <branch>])
# Use LOCAL_PATH as the target for all subsequent steps
```
**Multiple repos (cross-repo graph):**
```bash
# Clone each repo, run the full pipeline on each, then merge
graphify clone <url1> # → ~/.graphify/repos/<owner1>/<repo1>
graphify clone <url2> # → ~/.graphify/repos/<owner2>/<repo2>
# Run /graphify on each local path to produce their graph.json files
# Then merge:
graphify merge-graphs \
~/.graphify/repos/<owner1>/<repo1>/graphify-out/graph.json \
~/.graphify/repos/<owner2>/<repo2>/graphify-out/graph.json \
--out graphify-out/cross-repo-graph.json
```
Graphify clones into `~/.graphify/repos/<owner>/<repo>` and reuses existing clones on repeat runs. Each node in the merged graph carries a `repo` attribute so you can filter by origin.
**Multiple local subfolders (monorepo or multi-service layout):**
The skill pipeline writes all intermediate and final outputs to `graphify-out/` in the current working directory. Running the skill on each subfolder separately will clobber the same output dir. Instead, use the CLI directly for each subfolder — it places `graphify-out/` *inside* the scanned path:
```bash
graphify extract ./core/ # → ./core/graphify-out/graph.json
graphify extract ./service/ # → ./service/graphify-out/graph.json
graphify extract ./platform/ # → ./platform/graphify-out/graph.json
# Add --backend gemini|kimi|openai|deepseek|claude-cli depending on which API key you have set
# Then merge at the project root:
graphify merge-graphs \
./core/graphify-out/graph.json \
./service/graphify-out/graph.json \
./platform/graphify-out/graph.json \
--out graphify-out/graph.json
```
Once `graphify-out/graph.json` exists, the fast path above takes over: any codebase question runs `graphify query` directly on the merged graph — no re-extraction, no size gate.
@@ -0,0 +1,33 @@
# graphify reference: commit hook and native CLAUDE.md integration
Load this when the user asked to install the post-commit hook or wire graphify into a project's CLAUDE.md.
## For git commit hook
Install a post-commit hook that auto-rebuilds the graph after every commit. No background process needed - triggers once per commit, works with any editor.
```bash
graphify hook install # install
graphify hook uninstall # remove
graphify hook status # check
```
After every `git commit`, the hook detects which code files changed (via `git diff HEAD~1`), re-runs AST extraction on those files, and rebuilds `graph.json` and `GRAPH_REPORT.md`. Doc/image changes are ignored by the hook - run `/graphify --update` manually for those.
If a post-commit hook already exists, graphify appends to it rather than replacing it.
---
## For native CLAUDE.md integration
Run once per project to make graphify always-on in Claude Code sessions:
```bash
graphify claude install
```
This writes a `## graphify` section to the local `CLAUDE.md` that instructs Claude to check the graph before answering codebase questions and rebuild it after code changes. No manual `/graphify` needed in future sessions.
```bash
graphify claude uninstall # remove the section
```
+317
View File
@@ -0,0 +1,317 @@
# graphify reference: query, path, explain
Load this when the user asks a question against an existing graph, or runs `/graphify path` or `/graphify explain`. The core's query stub points here for the full traversal flow. These flows use the `graphify query` CLI when it is available and fall back to an inline NetworkX traversal otherwise.
Two traversal modes - choose based on the question:
| Mode | Flag | Best for |
|------|------|----------|
| BFS (default) | _(none)_ | "What is X connected to?" - broad context, nearest neighbors first |
| DFS | `--dfs` | "How does X reach Y?" - trace a specific chain or dependency path |
First check the graph exists:
```bash
$(cat graphify-out/.graphify_python) -c "
from pathlib import Path
if not Path('graphify-out/graph.json').exists():
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
raise SystemExit(1)
"
```
If it fails, stop and tell the user to run `/graphify <path>` first.
### Step 0 — Constrained query expansion (REQUIRED before traversal)
graphify's `query` CLI matches nodes via case-folded substring + IDF — there is **no stemming, no synonyms, no cross-language match** inside the binary, and the inline fallback below matches the same way. If the user's question uses different language or different domain vocabulary than the graph's labels (user says "обработчик" / graph says "handler"; user says "authentication" / graph says "Guardian"), the literal matcher returns 0 hits and the answer collapses to noise.
Fix this **without inventing tokens** by expanding the query against the actual graph vocabulary first:
1. Extract the token vocabulary from node labels:
```bash
$(cat graphify-out/.graphify_python) -c "
import json, re
from pathlib import Path
data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8'))
vocab = set()
for n in data['nodes']:
for c in re.findall(r'[^\W\d_]+', n.get('label','') or '', re.UNICODE):
parts = re.findall(r'[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+', c) or [c]
for p in parts:
t = p.lower()
if 3 <= len(t) <= 30:
vocab.add(t)
Path('graphify-out/.vocab.txt').write_text('\n'.join(sorted(vocab)), encoding='utf-8')
print(f'vocab: {len(vocab)} tokens')
"
```
2. Read `graphify-out/.vocab.txt`. Then for the user's question, select **up to 12 tokens from this exact list** that semantically match the query intent. Hard constraints:
- You MUST pick only tokens present in the vocabulary file. Do NOT invent tokens.
- If a query concept has no plausible token in the vocab, skip it — do not substitute a near-synonym from training memory.
- If **no** vocab tokens match the query at all, output an empty list and tell the user the corpus has no relevant vocabulary for this question. Do not fabricate a search.
- Translate cross-language: Russian "аутентификация" → look for `auth`, `credential`, `token`, `security` IFF present in vocab.
- Morphology: "handlers" maps to `handler` IFF present; "todos" maps to `todo` IFF present.
3. Print the selection explicitly to the user before running the query, so the expansion is auditable:
```
Query expanded to (from graph vocab, N tokens): [token1, token2, ...]
```
If the list is empty, say so plainly and stop — do not proceed to traversal.
### Step 1 — Traversal
Build the **expanded query string** by joining the selected tokens with spaces. Use this string as `QUESTION` below — NOT the original user question. (The original question is preserved only for `save-result` at the end.)
Prefer the CLI when it is installed:
```bash
graphify query "QUESTION"
# or: graphify query "QUESTION" --dfs --budget 3000
```
If the CLI is unavailable, load `graphify-out/graph.json` and run the traversal inline:
1. Find the 1-3 nodes whose label best matches the expanded tokens.
2. Run the appropriate traversal from each starting node.
3. Read the subgraph - node labels, edge relations, confidence tags, source locations.
4. Answer using **only** what the graph contains. Quote `source_location` when citing a specific fact.
5. If the graph lacks enough information, say so - do not hallucinate edges.
```bash
$(cat graphify-out/.graphify_python) -c "
import sys, json
from networkx.readwrite import json_graph
from pathlib import Path
data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8'))
G = json_graph.node_link_graph(data, edges='links')
question = 'QUESTION'
mode = 'MODE' # 'bfs' or 'dfs'
terms = [t.lower() for t in question.split() if len(t) >= 3] # match the vocab threshold; keeps api/jwt/ios (#1392)
# Find best-matching start nodes
scored = []
for nid, ndata in G.nodes(data=True):
label = ndata.get('label', '').lower()
score = sum(1 for t in terms if t in label)
if score > 0:
scored.append((score, nid))
scored.sort(reverse=True)
start_nodes = [nid for _, nid in scored[:3]]
if not start_nodes:
print('No matching nodes found for query terms:', terms)
sys.exit(0)
subgraph_nodes = set()
if mode == 'dfs':
# DFS: follow one path as deep as possible before backtracking.
# Depth-limited to 6 to avoid traversing the whole graph.
visited = set()
stack = [(n, 0) for n in reversed(start_nodes)]
while stack:
node, depth = stack.pop()
if node in visited or depth > 6:
continue
visited.add(node)
subgraph_nodes.add(node)
for neighbor in G.neighbors(node):
if neighbor not in visited:
stack.append((neighbor, depth + 1))
else:
# BFS: explore all neighbors layer by layer up to depth 3.
frontier = set(start_nodes)
subgraph_nodes = set(start_nodes)
for _ in range(3):
next_frontier = set()
for n in frontier:
for neighbor in G.neighbors(n):
if neighbor not in subgraph_nodes:
next_frontier.add(neighbor)
subgraph_nodes.update(next_frontier)
frontier = next_frontier
# Traversal chooses the nodes; collect relationships separately so seed edges,
# cycles, and cross-links are not lost just because both endpoints were visited.
# Taking the induced subgraph also keeps edges to nodes beyond the depth limit
# out of the result. data=True retains each edge's own attributes, including
# distinct parallel relationships in a MultiGraph.
subgraph_edges = [
(u, v, edge_data)
for u, v, edge_data in G.subgraph(subgraph_nodes).edges(data=True)
if u != v
]
# Token-budget aware output: rank by relevance, cut at budget (~4 chars/token)
token_budget = BUDGET # default 2000
char_budget = token_budget * 4
# Score each node by term overlap for ranked output
def relevance(nid):
label = G.nodes[nid].get('label', '').lower()
return sum(1 for t in terms if t in label)
ranked_nodes = sorted(subgraph_nodes, key=relevance, reverse=True)
lines = [f'Traversal: {mode.upper()} | Start: {[G.nodes[n].get(\"label\",n) for n in start_nodes]} | {len(subgraph_nodes)} nodes']
for nid in ranked_nodes:
d = G.nodes[nid]
lines.append(f' NODE {d.get(\"label\", nid)} [src={d.get(\"source_file\",\"\")} loc={d.get(\"source_location\",\"\")}]')
for u, v, edge_data in subgraph_edges:
if u in subgraph_nodes and v in subgraph_nodes:
lines.append(f' EDGE {G.nodes[u].get(\"label\",u)} --{edge_data.get(\"relation\",\"\")} [{edge_data.get(\"confidence\",\"\")}]--> {G.nodes[v].get(\"label\",v)}')
output = '\n'.join(lines)
if len(output) > char_budget:
output = output[:char_budget] + f'\n... (truncated at ~{token_budget} token budget - use --budget N for more)'
print(output)
"
```
Replace `QUESTION` with the **expanded** query string, `MODE` with `bfs` or `dfs`, and `BUDGET` with the token budget (default `2000`, or whatever `--budget N` specifies). Then answer based on the subgraph output above, using only what the graph contains.
After writing the answer, save it back into the graph so it improves future queries. Include the expanded tokens inside the `--answer` text (e.g. `"Expanded from original query via vocab: [tokens]. Then traversed..."`) so the next `--update` extracts the expansion history as a graph node:
```bash
$(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINAL_QUESTION" --answer "ANSWER" --type query --nodes NODE1 NODE2
```
Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph.
**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting):
- `useful` — the cited nodes answered the question well (they become *preferred sources*).
- `dead_end` — the question/path led nowhere; don't re-derive it next time.
- `corrected` — the saved answer was wrong; `--correction` records what was right.
At the **start** of graph work, refresh and read the lessons: run `graphify reflect --if-stale` (cheap, deterministic, no LLM; `--if-stale` makes it a no-op when `LESSONS.md` is already newer than every input, e.g. when the git hook just refreshed it), then read `graphify-out/reflections/LESSONS.md`. It lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. Running `reflect` yourself keeps the lessons current even without the git hook installed; if the post-commit hook *is* installed, `--if-stale` means your session-start run costs almost nothing.
---
## For /graphify path
Find the shortest path between two named concepts in the graph. Prefer the CLI when installed:
```bash
graphify path "NODE_A" "NODE_B"
```
If the CLI is unavailable, run it inline:
```bash
$(cat graphify-out/.graphify_python) -c "
import json, sys
import networkx as nx
from networkx.readwrite import json_graph
from pathlib import Path
data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8'))
G = json_graph.node_link_graph(data, edges='links')
a_term = 'NODE_A'
b_term = 'NODE_B'
def find_node(term):
term = term.lower()
scored = sorted(
[(sum(1 for w in term.split() if w in G.nodes[n].get('label','').lower()), n)
for n in G.nodes()],
reverse=True
)
return scored[0][1] if scored and scored[0][0] > 0 else None
src = find_node(a_term)
tgt = find_node(b_term)
if not src or not tgt:
print(f'Could not find nodes matching: {a_term!r} or {b_term!r}')
sys.exit(0)
try:
path = nx.shortest_path(G, src, tgt)
print(f'Shortest path ({len(path)-1} hops):')
for i, nid in enumerate(path):
label = G.nodes[nid].get('label', nid)
if i < len(path) - 1:
_raw = G[nid][path[i+1]]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
rel = edge.get('relation', '')
conf = edge.get('confidence', '')
print(f' {label} --{rel}--> [{conf}]')
else:
print(f' {label}')
except nx.NetworkXNoPath:
print(f'No path found between {a_term!r} and {b_term!r}')
except nx.NodeNotFound as e:
print(f'Node not found: {e}')
"
```
Replace `NODE_A` and `NODE_B` with the actual concept names from the user. Then explain the path in plain language - what each hop means, why it's significant.
After writing the explanation, save it back:
```bash
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Path from NODE_A to NODE_B" --answer "ANSWER" --type path_query --nodes NODE_A NODE_B
```
---
## For /graphify explain
Give a plain-language explanation of a single node - everything connected to it. Prefer the CLI when installed:
```bash
graphify explain "NODE_NAME"
```
If the CLI is unavailable, run it inline:
```bash
$(cat graphify-out/.graphify_python) -c "
import json, sys
import networkx as nx
from networkx.readwrite import json_graph
from pathlib import Path
data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8'))
G = json_graph.node_link_graph(data, edges='links')
term = 'NODE_NAME'
term_lower = term.lower()
# Find best matching node
scored = sorted(
[(sum(1 for w in term_lower.split() if w in G.nodes[n].get('label','').lower()), n)
for n in G.nodes()],
reverse=True
)
if not scored or scored[0][0] == 0:
print(f'No node matching {term!r}')
sys.exit(0)
nid = scored[0][1]
data_n = G.nodes[nid]
print(f'NODE: {data_n.get(\"label\", nid)}')
print(f' source: {data_n.get(\"source_file\",\"unknown\")}')
print(f' type: {data_n.get(\"file_type\",\"unknown\")}')
print(f' degree: {G.degree(nid)}')
print()
print('CONNECTIONS:')
for neighbor in G.neighbors(nid):
_raw = G[nid][neighbor]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
nlabel = G.nodes[neighbor].get('label', neighbor)
rel = edge.get('relation', '')
conf = edge.get('confidence', '')
src_file = G.nodes[neighbor].get('source_file', '')
print(f' --{rel}--> {nlabel} [{conf}] ({src_file})')
"
```
Replace `NODE_NAME` with the concept the user asked about. Then write a 3-5 sentence explanation of what this node is, what it connects to, and why those connections are significant. Use the source locations as citations.
After writing the explanation, save it back:
```bash
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Explain NODE_NAME" --answer "ANSWER" --type explain --nodes NODE_NAME
```
@@ -0,0 +1,52 @@
# graphify reference: transcribe video and audio
Load this only when `detect` reported one or more `video` files. A corpus with no video never reads this.
### Step 2.5 - Transcribe video / audio files (only if video files detected)
Skip this step entirely if `detect` returned zero `video` files.
Video and audio files cannot be read directly. Transcribe them to text first, then treat the transcripts as doc files in Step 3.
**Strategy:** Read the god nodes from `graphify-out/.graphify_detect.json` (or the analysis file if it exists from a previous run). You are already a language model — write a one-sentence domain hint yourself from those labels. Then pass it to Whisper as the initial prompt. No separate API call needed.
**However**, if the corpus has *only* video files and no other docs/code, use the generic fallback prompt: `"Use proper punctuation and paragraph breaks."`
**Step 1 - Write the Whisper prompt yourself.**
Read the top god node labels from detect output or analysis, then compose a short domain hint sentence, for example:
- Labels: `transformer, attention, encoder, decoder` → `"Machine learning research on transformer architectures and attention mechanisms. Use proper punctuation and paragraph breaks."`
- Labels: `kubernetes, deployment, pod, helm` → `"DevOps discussion about Kubernetes deployments and Helm charts. Use proper punctuation and paragraph breaks."`
**Export** it as `GRAPHIFY_WHISPER_PROMPT` (the exact name the transcriber reads — and it must be `export`ed so the child Python process sees it) for the next command.
**Step 2 - Transcribe:**
```bash
export GRAPHIFY_WHISPER_MODEL=base # or whatever --whisper-model the user passed (must be exported)
export GRAPHIFY_WHISPER_PROMPT="<the one-sentence domain hint you composed in Step 1>"
$(cat graphify-out/.graphify_python) -c "
import json, os, sys
from pathlib import Path
from graphify.transcribe import transcribe_all
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
video_files = detect.get('files', {}).get('video', [])
prompt = os.environ.get('GRAPHIFY_WHISPER_PROMPT', 'Use proper punctuation and paragraph breaks.')
transcript_paths = transcribe_all(video_files, initial_prompt=prompt)
# Write the JSON from Python (NOT a shell '>' redirect): transcribe_all/Whisper
# print progress to stdout, which would otherwise corrupt the JSON file (#1392).
Path('graphify-out/.graphify_transcripts.json').write_text(json.dumps(transcript_paths, ensure_ascii=False), encoding=\"utf-8\")
print(f'Transcribed {len(transcript_paths)} file(s)', file=sys.stderr)
"
```
After transcription:
- Read the transcript paths from `graphify-out/.graphify_transcripts.json`
- Add them to the docs list before dispatching semantic subagents in Step 3B
- Print how many transcripts were created: `Transcribed N video file(s) -> treating as docs`
- If transcription fails for a file, print a warning and continue with the rest
**Whisper model:** Default is `base`. If the user passed `--whisper-model <name>`, `export GRAPHIFY_WHISPER_MODEL=<name>` (it must be exported, not just assigned) before running the command above.
@@ -0,0 +1,221 @@
# graphify reference: incremental update and cluster-only
Load this only when the user passed `--update` or `--cluster-only`. A first-time full build never reads this file.
## For --update (incremental re-extraction)
Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
```bash
$(cat graphify-out/.graphify_python) -c "
import sys, json
from graphify.detect import detect_incremental, save_manifest
from pathlib import Path
from graphify.paths import out_path
from graphify.watch import _read_build_excludes, _read_build_gitignore
result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path()))
new_total = result.get('new_total', 0)
nf = result.get('new_files', {})
print(json.dumps({
'new_total': new_total,
'deleted': len(result.get('deleted_files', [])),
'new_by_type': {t: len(v) for t, v in nf.items()},
'total_files': result.get('total_files'),
'total_words': result.get('total_words'),
'skipped_sensitive': result.get('skipped_sensitive', []),
}, indent=2, ensure_ascii=False))
print('Full result: graphify-out/.graphify_incremental.json')
Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\")
deleted = list(result.get('deleted_files', []))
if new_total == 0 and not deleted:
print('No files changed since last run. Nothing to update.')
raise SystemExit(0)
if deleted:
print(f'{len(deleted)} deleted file(s) to prune.')
if new_total > 0:
print(f'{new_total} new/changed file(s) to re-extract.')
"
```
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (drives Step 3A AST + Step 3B0 cache check on only what changed); `all_files` carries the full corpus for any step that needs corpus-wide context:
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
'files': r.get('new_files', {}),
'all_files': r.get('files', {}),
'total_files': r.get('new_total', 0),
'total_words': r.get('total_words', 0),
'skipped_sensitive': r.get('skipped_sensitive', []),
'needs_graph': True,
}, ensure_ascii=False), encoding=\"utf-8\")
"
```
If new files exist, first check whether all changed files are code files:
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
result = json.loads(open('graphify-out/.graphify_incremental.json', encoding='utf-8').read()) if Path('graphify-out/.graphify_incremental.json').exists() else {}
code_exts = {'.py','.ts','.js','.go','.rs','.java','.cpp','.c','.rb','.swift','.kt','.cs','.scala','.php','.cc','.cxx','.hpp','.h','.kts','.lua','.toc','.f','.F','.f90','.F90','.f95','.F95','.f03','.F03','.f08','.F08'}
new_files = result.get('new_files', {})
all_changed = [f for files in new_files.values() for f in files]
code_only = all(Path(f).suffix.lower() in code_exts for f in all_changed)
print('code_only:', code_only)
"
```
If `code_only` is True: print `[graphify update] Code-only changes detected - skipping semantic extraction (no LLM needed)`, run Step 3A (AST) on the changed files, then follow only Part B's **Fast path** to overwrite `.graphify_semantic.json` with an empty result and run Part C to create `.graphify_extract.json` from the fresh AST result. Skip semantic cache checks/writes and subagents (Steps B0–B3); do not reuse semantic sidecars from a prior run. Continue to the incremental merge and Steps 4–8 only after Part C has completed.
If `code_only` is False (any changed file is a doc/paper/image/video): **first, if any changed file is in `new_files['video']`, run `references/transcribe.md` (Step 2.5) on those files, then rewrite `.graphify_detect.json` to move the resulting transcript paths into `files['document']` and drop `files['video']`** — otherwise raw `.mp4/.mp3` paths are fed to semantic subagents as unreadable media (#1392). Then run the full Steps 3A–3C pipeline as normal.
If no new files exist (only deletions), create an empty extraction so the merge step can prune:
```bash
if [ ! -f graphify-out/.graphify_extract.json ]; then
echo '[graphify update] Only deletions -- creating empty extraction for merge.'
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
Path('graphify-out/.graphify_extract.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
"
fi
```
Then:
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from pathlib import Path
from graphify.build import build_merge
from graphify.detect import save_manifest
# Load new extraction and incremental state
new_extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
incremental = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
deleted = list(incremental.get('deleted_files', []))
# prune_sources is ONLY for genuinely DELETED files. Changed/re-extracted files are
# handled by build_merge's replace-on-re-extract (#1344): every source_file in
# new_chunks is dropped from the base before merge, so old/stale nodes don't survive.
# Do NOT add changed here: with root= passed, prune_set relativizes to the same base
# as the freshly merged nodes and would DELETE the re-extracted content (#1178 is moot
# now that replace — not the dedup pass — reconciles changed files).
prune = list(deleted) or None
# Use build_merge() — reads graph.json directly without NetworkX round-trip
# so edge direction (calls, implements, imports) is always preserved (#801).
# Pass root= so prune_sources (absolute paths from detect_incremental) are
# relativized to match the graph's relative source_file values; without it
# nothing is pruned and stale nodes accumulate on every update (#1361).
# directed=IS_DIRECTED: replace IS_DIRECTED with True if --directed was given, else
# False. Without it a --directed --update silently rebuilds undirected and collapses
# reciprocal A<->B edges (#1392).
G = build_merge(
[new_extraction],
graph_path='graphify-out/graph.json',
prune_sources=prune,
root='INPUT_PATH',
directed=IS_DIRECTED,
)
print(f'[graphify update] Merged: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges')
# Write merged result back to .graphify_extract.json so Step 4 sees the full graph
merged_out = {
'nodes': [{'id': n, **d} for n, d in G.nodes(data=True)],
'edges': [
# Explicit source/target last so they win over any stale attrs in d.
{**{k: val for k, val in d.items() if k not in ('_src', '_tgt', 'source', 'target')},
'source': d.get('_src', u), 'target': d.get('_tgt', v)}
for u, v, d in G.edges(data=True)
],
# G.graph["hyperedges"] holds hyperedges from both existing graph.json
# and new_extraction (build_merge combines them). Falling back to
# new_extraction only would silently drop prior-run hyperedges (#801).
'hyperedges': list(G.graph.get('hyperedges', [])),
'input_tokens': new_extraction.get('input_tokens', 0),
'output_tokens': new_extraction.get('output_tokens', 0),
}
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged_out, ensure_ascii=False), encoding=\"utf-8\")
print(f'[graphify update] Merged extraction written ({len(merged_out[\"nodes\"])} nodes, {len(merged_out[\"edges\"])} edges)')
# Save manifest so next --update diffs against today's state, not the
# prior run's baseline (prevents ghost-node reports on subsequent updates).
# root= matches the build_merge call above so the manifest keys stay relative to
# the scan root — portable across clones/machines, so --update keeps matching
# cached files instead of missing every one after a move (#1417).
#
# Only stamp semantic files (docs/papers/images) that ACTUALLY produced output
# THIS run (new_extraction is this run's fresh extraction, read above before the
# merge overwrote the file): a changed doc whose chunk failed must stay unstamped
# so the next --update re-queues it, otherwise it is marked done and its content
# is lost forever (#2015). Mirrors the library extract path
# (cli._stamped_manifest_files + clear_semantic + scan_corpus).
from graphify.cli import _stamped_manifest_files
_manifest_files = _stamped_manifest_files(incremental['files'], new_extraction, Path('INPUT_PATH'))
# Changed semantic files dispatched this run but NOT stamped had their chunk fail
# or be omitted; clear any stale semantic_hash so they are re-queued (#1948).
_sem_types = ('document', 'paper', 'image')
_dispatched = {f for t, fl in incremental.get('new_files', {}).items() if t in _sem_types for f in fl}
_stamped = {f for fl in _manifest_files.values() for f in fl}
_cleared = _dispatched - _stamped
# scan_corpus = the RAW full corpus so in-root files newly excluded since last run
# are dropped rather than masquerading as deletions; untouched rows preserved (#1908).
_scan = {f for fl in incremental['files'].values() for f in fl}
save_manifest(_manifest_files, root='INPUT_PATH', scan_corpus=_scan, clear_semantic=_cleared or None)
print('[graphify update] Manifest saved.')
"
```
Then run Steps 4–8 on the merged graph as normal.
After Step 4, show the graph diff:
```bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.analyze import graph_diff
from graphify.build import build_from_json
from graphify.paths import load_node_link_graph
import networkx as nx
from pathlib import Path
# Load old graph (before update) from backup written before merge
old_data = json.loads(Path('graphify-out/.graphify_old.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_old.json').exists() else None
new_extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
G_new = build_from_json(new_extract, directed=IS_DIRECTED)
if old_data:
G_old = load_node_link_graph(old_data)
diff = graph_diff(G_old, G_new)
print(diff['summary'])
if diff['new_nodes']:
print('New nodes:', ', '.join(n['label'] for n in diff['new_nodes'][:5]))
if diff['new_edges']:
print('New edges:', len(diff['new_edges']))
"
```
Before the merge step, save the old graph: `cp graphify-out/graph.json graphify-out/.graphify_old.json`
Clean up after: `rm -f graphify-out/.graphify_old.json`
---
## For --cluster-only
Skip Steps 1–3. Re-run clustering on the existing graph:
```bash
graphify cluster-only .
```
`graphify cluster-only .` is **self-contained**: it re-clusters, names communities, and regenerates `GRAPH_REPORT.md`, `graph.json`, and `graph.html` from the existing graph. **Do not re-run Steps 5–9** — they read intermediate files (`.graphify_extract.json`, `.graphify_detect.json`, `.graphify_analysis.json`) that a prior build's cleanup (Step 9) already deleted, so they raise `FileNotFoundError` (#1392). When it finishes, present the refreshed `GRAPH_REPORT.md` summary as usual.
+5
View File
@@ -33,3 +33,8 @@ settings.json
*.sqlite
.pytest_cache/
.ropeproject/
build/
sdkconfig
sdkconfig.old
managed_components/
www_dist/
+10
View File
@@ -0,0 +1,10 @@
## graphify
This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.
Rules:
- When graphify-out/graph.json exists, run `graphify query "<question>"` before your first grep, search or source-file read for a codebase question, and put this rule in every subagent prompt that explores code. Read raw files only for lines the graph or an earlier read already located. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).
- A committed graphify-out/graph.json is rewritten whole on every build, so a large diff to it in a pull request is expected. Do not flag it as churn or suggest skipping the graph rebuild or its hooks.
+3
View File
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(led_controller)
+142
View File
@@ -0,0 +1,142 @@
# Build, flash and monitor the ESP32-S3 controller (ESP-IDF in Docker).
#
# make build, flash, then monitor (same as: make all)
# make help list the targets
# make build minify the web UI, then build the firmware
# make flash flash the last build to the S3 (does not build)
# make monitor serial console (Ctrl-] to quit)
# make flash-monitor
#
# Override on the command line, e.g. make flash PORT=/dev/ttyACM1
PORT ?= /dev/ttyACM0
IDF_IMAGE ?= espressif/idf:v6.1
SECS ?= 10
DOCKER_RUN = docker run --rm -v "$(CURDIR)":/project -w /project
DEVICE = --device=$(PORT)
# Interactive terminal only when there is one (monitor needs it, CI does not have it)
TTY := $(shell [ -t 0 ] && echo -it)
# Rootless Docker maps container root to you, so files must end up owned by uid 0 inside; with a
# normal daemon they must be owned by you.
OWNER := $(shell docker info --format '{{.SecurityOptions}}' 2>/dev/null | grep -q rootless && echo 0:0 || echo $$(id -u):$$(id -g))
FIX_OWNER = chown -R $(OWNER) /project
.PHONY: all help web build flash ota monitor flash-monitor log size menuconfig clean fullclean erase test test-driver test-envelope test-api test-browser sim-build sim sim-web test-sim
# Default target: build, flash, then open the console (run in order, so not with make -j)
all: build flash monitor
help:
@echo "LED controller (ESP32-S3):"
@echo " make [all] build, flash, then open the console"
@echo " make build minify + gzip the web UI, then build the firmware"
@echo " make flash flash the last build (firmware and web UI) to PORT ($(PORT)); does not build"
@echo " make ota [HOST=ip] build, then upload the firmware (web UI included) over Ethernet (no USB);"
@echo " HOST defaults to led-controller.local"
@echo " make monitor serial console on PORT (Ctrl-] to quit)"
@echo " make flash-monitor flash the last build, then open the console"
@echo " make log [SECS=10] print the console for SECS seconds and exit (no terminal needed)"
@echo " make web only rebuild the web UI (needs node/npx)"
@echo " make size memory use of the last build"
@echo " make menuconfig change the ESP-NOW channel, marker pin, W5500 pins, ..."
@echo " make erase erase the whole flash (loses the stored data)"
@echo " make clean remove the build directory (keeps sdkconfig)"
@echo " make fullclean also remove sdkconfig and the web UI output"
@echo " make test driver unit tests + C/Python envelope cross-check"
@echo " make test-api HOST=ip HTTP API tests against a running controller (data restored afterwards)"
@echo " make test-browser HOST=ip Selenium UI tests against a running controller (needs selenium + chromedriver)"
@echo "Simulated rig (no hardware): the controller built for linux + led-simulator's 16 drivers over a UDP bridge"
@echo " make sim-build build the controller for the host (sim-controller/build/led_controller_sim.elf)"
@echo " make sim build, then run the headless rig and the controller (http://localhost:8080/)"
@echo " make sim-web build, then run the browser rig (http://localhost:8765/) and the controller"
@echo " make test-sim rig tests (groups, field patterns, sequences) + the API tests against make sim"
@echo "variables: PORT=$(PORT) IDF_IMAGE=$(IDF_IMAGE)"
# --- web UI ---------------------------------------------------------------
web:
tools/build_web.sh
# --- firmware -------------------------------------------------------------
# The build time in the image comes from esp_app_desc.c, which nothing else recompiles (a web-only
# change just relinks), so drop its object and every build gets the current time.
APP_DESC_OBJ = build/esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj
build: web
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'rm -f $(APP_DESC_OBJ); idf.py build; rc=$$?; $(FIX_OWNER); exit $$rc'
flash:
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) bash -c 'idf.py -p $(PORT) flash; rc=$$?; $(FIX_OWNER); exit $$rc'
ota: HOST ?= led-controller.local
ota: build
python3 tools/ota.py $(HOST)
monitor:
$(DOCKER_RUN) $(TTY) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) monitor
flash-monitor: flash monitor
# Non-interactive: reset the board and print what it says for SECS seconds
log:
python3 tools/serial_log.py $(PORT) $(SECS)
size:
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'idf.py size; rc=$$?; $(FIX_OWNER); exit $$rc'
menuconfig:
$(DOCKER_RUN) -it $(IDF_IMAGE) bash -c 'idf.py menuconfig; rc=$$?; $(FIX_OWNER); exit $$rc'
erase:
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) erase-flash
clean:
rm -rf build
fullclean: clean
rm -rf sdkconfig sdkconfig.old www_dist
# --- tests ----------------------------------------------------------------
test: test-driver test-envelope
# Host-side unit tests for the driver's link layer and beat sync (pure Python)
test-driver:
python3 tools/run_driver_tests.py
# HTTP API tests (ported from v1) against a running controller; v1 features v2 lacks are xfail
test-api:
@test -n "$(HOST)" || { echo "usage: make test-api HOST=<controller ip>"; exit 1; }
python3 -m pytest test/api -q --host $(HOST)
# Selenium UI tests (ported from v1); they change the controller's data and do not restore it
test-browser:
@test -n "$(HOST)" || { echo "usage: make test-browser HOST=<controller ip>"; exit 1; }
LED_CONTROLLER_RUN_BROWSER_TESTS=1 LED_HOST=$(HOST) python3 -m pytest test/browser -q
# The C envelope packer must produce the same bytes as test/binary_envelope.py
test-envelope:
@tmp=$$(mktemp -d); \
(cd test && python3 env_check.py) > $$tmp/py.txt; \
docker run --rm -v "$(CURDIR)":/project -w /project/test $(IDF_IMAGE) bash -c \
'gcc -Wall -I/opt/esp/idf/components/json/cJSON env_host.c ../main/envelope.c /opt/esp/idf/components/json/cJSON/cJSON.c -o /tmp/t -lm && /tmp/t' 2>&1 | tail -4 | head -3 > $$tmp/c.txt; \
if diff -q $$tmp/py.txt $$tmp/c.txt >/dev/null; then echo "envelope: C and Python agree"; rm -rf $$tmp; \
else echo "envelope: MISMATCH"; diff $$tmp/py.txt $$tmp/c.txt; rm -rf $$tmp; exit 1; fi
# --- simulated rig --------------------------------------------------------
# The firmware built for ESP-IDF's linux target runs on this computer; its ESP-NOW frames go over UDP to
# led-simulator (bridge_sim.py headless, or server.py in the browser), whose drivers run led-driver/src.
SIM_DB ?= $(CURDIR)/sim-controller/data
SIM_RUN = mkdir -p $(SIM_DB) && LED_SIM_DB=$(SIM_DB) LED_SIM_BRIDGE=127.0.0.1:8766 sim-controller/build/led_controller_sim.elf
sim-build: web
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'cd sim-controller && idf.py build; rc=$$?; $(FIX_OWNER); exit $$rc'
sim: sim-build
@trap 'kill 0' INT TERM EXIT; python3 led-simulator/bridge_sim.py & $(SIM_RUN)
sim-web: sim-build
@trap 'kill 0' INT TERM EXIT; python3 led-simulator/server.py & $(SIM_RUN)
test-sim:
python3 -m pytest test/api -q --host localhost:8080
-30
View File
@@ -1,30 +0,0 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
mpremote = "*"
pyserial = "*"
esptool = "*"
pyjwt = "*"
watchfiles = "*"
requests = "*"
selenium = "*"
adafruit-ampy = "*"
microdot = "*"
websockets = "*"
[dev-packages]
pytest = "*"
[requires]
python_version = "3.11"
[scripts]
web = "python /home/pi/led-controller/tests/web.py"
watch = "python -m watchfiles 'python tests/web.py' src tests"
install = "pipenv install"
run = "sh -c 'cd src && python main.py'"
dev = "watchfiles \"sh -c 'cd src && python main.py'\" src"
help-pdf = "sh scripts/build_help_pdf.sh"
Generated
-1026
View File
File diff suppressed because it is too large. Load diff
+35 -28
View File
@@ -1,43 +1,50 @@
# led-controller
LED controller web app for managing profiles, **zones**, presets, and colour palettes, and sending commands to LED devices. Outbound paths include:
ESP32-S3 controller for LED drivers: W5500 Ethernet, web UI, I2S microphone beat detection and an ESP-NOW link to the drivers. The firmware is C (ESP-IDF) at the repository root; see [`docs/BENCH_TEST.md`](docs/BENCH_TEST.md) for the bench tests.
- **Serial → ESP-NOW bridge**: JSON lines over UART to an ESP32 that forwards ESP-NOW frames (configure `serial_port` and baud in `settings.json` / Settings model).
- **Wi-Fi LED drivers**: TCP JSON lines (default port **8765** on the Pi; drivers discover the controller via **UDP 8766** broadcast).
It keeps profiles, zones, presets, device groups, sequences, palettes, patterns and outputs in its flash, and serves the web UI and JSON API ([`docs/API.md`](docs/API.md)). Zones play to device groups. Sequences advance on the beats the microphone detects, or on a BPM clock while audio is stopped. Profiles, presets and sequences import and export as JSON bundles.
## Run
## Build and flash
- One-time setup for port 80 without root: `sudo scripts/setup-port80.sh`
- Start app: `pipenv run run` (override listen port with the **`PORT`** environment variable)
- Dev watcher (auto-restart on `src/` changes): `pipenv run dev`
- Regenerate **`docs/help.pdf`** from **`docs/help.md`**: `pipenv run help-pdf` (requires **pandoc** and **chromium** on the host)
```bash
make build # minify the web UI from web/, then build the firmware (ESP-IDF in Docker)
make flash # flash over USB
make ota [HOST=<ip>] # update firmware (web UI included) over Ethernet, no USB (POST /ota); HOST defaults to led-controller.local
make monitor # serial console
make test # driver unit tests and the C/Python envelope cross-check
make test-api HOST=<ip> # HTTP API tests against a running controller (its data is restored afterwards)
make test-browser HOST=<ip> # Selenium UI tests (needs selenium and chromedriver)
```
## UI modes
`make` lists every target. The web UI sources are in `web/` (`static/`, `templates/`, `audio.html`); `tools/build_web.sh` also packs the led-driver pattern files into the firmware, so the controller can send them to drivers.
- **Run mode**: focused control view. Select zones/presets and apply profiles. Editing actions are hidden.
- **Edit mode**: management view. Shows **Zones**, Presets, Patterns, Colour Palette, and Send Presets controls, plus per-tile preset edit/remove and drag-reorder.
## Other directories
## Profiles
- `led-driver/` (submodule): MicroPython firmware for the ESP32 LED drivers.
- `led-tool/` (submodule): `led-cli`, configures drivers over serial and updates the controller over Ethernet (`led-cli --ota HOST`).
- `led-simulator/` (submodule), `espnow-sender/`: test helpers.
- `db/`: the records a controller starts with (the `default` profile and group the firmware seeds at first boot, plus pattern metadata), importable with `PUT /db/<name>`.
- `test/api/`: the API tests (`test/api/README.md`); `test/browser/`: the UI tests.
- Applying a profile updates session scope and refreshes the active zone content.
- In **Run mode**, Profiles supports apply-only behaviour (no create/clone/delete).
- In **Edit mode**, Profiles supports create/clone/delete.
- Creating a profile always creates a populated `default` zone (starter presets).
- Optional **DJ zone** seeding creates:
- `dj` zone bound to device name `dj`
- starter DJ presets (rainbow, single colour, transition)
## Docs
## Preset colours and palette linking
- API reference: `docs/API.md`
- User guide: `docs/help.md` (`scripts/build_help_pdf.sh` regenerates `docs/help.pdf`)
- Specification: `docs/SPECIFICATION.md`
- In preset editor, selecting a colour picker value auto-adds it when the picker closes.
- Use **From Palette** to add a palette-linked preset colour.
- Linked colours are stored as palette references and shown with a `P` badge.
- When profile palette colours change, linked preset colours update across that profile.
## Network
## API docs
The controller advertises `<hostname>.local` over mDNS (default `led-controller`, plus an `_http._tcp` service). Both settings below come from `/settings` and apply on reboot.
- Main API reference: `docs/API.md`
`static_ips` is a list of networks to try, in order, each time the Ethernet link comes up. The first entry whose gateway answers ARP is used; if none does (or the list is empty) the controller uses DHCP. `netmask` defaults to `255.255.255.0`, `dns` to the gateway.
## Driver pattern modules
If DHCP gets no answer within 15 seconds, the controller takes `192.168.4.1/24`. For a cable straight from a PC, give the PC a static IP on that subnet, such as `192.168.4.2/24`, and open `http://192.168.4.1/`. The controller tries DHCP again only when the link next comes up.
Pattern **`.py`** sources live under **`led-driver/src/patterns`**. The Pi app resolves that path via `util.driver_patterns.driver_patterns_dir()`. If you deploy without that tree next to the app, set **`LED_CONTROLLER_PATTERNS_DIR`** to the directory that contains those files.
```bash
curl -X PUT http://led-controller.local/settings/settings -H 'Content-Type: application/json' -d '{
"hostname": "stage",
"static_ips": [
{"ip": "192.168.1.50", "netmask": "255.255.255.0", "gw": "192.168.1.1"},
{"ip": "10.0.0.50", "netmask": "255.255.255.0", "gw": "10.0.0.1"}
]}'
```
+6
View File
@@ -0,0 +1,6 @@
{
"enabled": true,
"device": "simulated",
"device_override": "",
"device_select": "simulated"
}
+16
View File
@@ -0,0 +1,16 @@
[
{
"id": "c9ab898d-740",
"label": "bridge1",
"transport": "ip",
"ip": "192.168.4.1",
"ws_port": 80
},
{
"id": "18d85e86-17b",
"label": "bridge2",
"transport": "serial",
"serial_port": "/dev/ttyUSB0",
"serial_baudrate": 115200
}
]
+1 -1
View File
@@ -1 +1 @@
{"188b0e1560a8": {"id": "188b0e1560a8", "name": "led-188b0e1560a8", "type": "led", "transport": "wifi", "address": "10.1.1.192", "default_pattern": null, "zones": []}, "f0f5bdfb9d30": {"id": "f0f5bdfb9d30", "name": "led-f0f5bdfb9d30", "type": "led", "transport": "wifi", "address": "10.1.1.232", "default_pattern": null, "zones": []}}
{}
+1 -1
View File
@@ -1 +1 @@
{"1": {"name": "Main Group", "devices": ["1", "2", "3"]}, "2": {"name": "Accent Group", "devices": ["4", "5"]}}
{"1": {"name": "default", "devices": [], "wifi_driver_display_name": null, "wifi_driver_num_leds": null, "wifi_color_order": null, "wifi_startup_mode": null, "output_brightness": 255, "bridge_id": null, "pattern": "on", "colors": ["000000", "FF0000"], "brightness": 100, "delay": 100, "step_offset": 0, "step_increment": 1, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "id": "1"}}
+1
View File
@@ -0,0 +1 @@
{}
+1 -1
View File
@@ -1 +1 @@
{"1": ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", "#FFFFFF", "#000000"], "2": [], "3": [], "4": [], "5": [], "6": [], "7": ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", "#FFFFFF", "#000000"], "8": [], "9": [], "10": [], "11": [], "12": ["#890b0b", "#0b8935"]}
{"1": ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", "#FFFFFF", "#000000"]}
+1 -1
View File
@@ -1 +1 @@
{"on": {"min_delay": 10, "max_delay": 10000, "max_colors": 1}, "off": {"min_delay": 10, "max_delay": 10000, "max_colors": 0}, "rainbow": {"n1": "Step Rate", "min_delay": 10, "max_delay": 10000, "max_colors": 0}, "colour_cycle": {"n1": "Step Rate", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "transition": {"min_delay": 10, "max_delay": 10000, "max_colors": 10}, "chase": {"n1": "Colour 1 Length", "n2": "Colour 2 Length", "n3": "Step 1", "n4": "Step 2", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "pulse": {"n1": "Attack", "n2": "Hold", "n3": "Decay", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "circle": {"n1": "Head Rate", "n2": "Max Length", "n3": "Tail Rate", "n4": "Min Length", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "blink": {"min_delay": 10, "max_delay": 10000, "max_colors": 10}, "flicker": {"n1": "Min brightness", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "flame": {"n1": "Min brightness", "n2": "Breath period (ms)", "n3": "Spark gap min (ms, 0=default 10\u201330 s, -1=off)", "n4": "Spark gap max (ms)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "twinkle": {"n1": "Twinkle activity (1\u2013255, higher = more changes)", "n2": "Density (0\u2013255, higher = more of the strip lit)", "n3": "Min adjacent LEDs per twinkle (same as max for fixed length)", "n4": "Max adjacent LEDs per twinkle (same as min for fixed length)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "radiate": {"n1": "Node spacing (LEDs)", "n2": "Out time (ms)", "n3": "In time (ms)", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "meteor_rain": {"n1": "Tail length", "n2": "Speed (LEDs per frame)", "n3": "Fade amount (1-255)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "scanner": {"n1": "Eye width", "n2": "End pause (frames)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "gradient_scroll": {"n1": "Scroll step rate", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "comet_dual": {"n1": "Tail length", "n2": "Speed", "n3": "Gap", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "sparkle_trail": {"n1": "Spark density", "n2": "Decay", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "wave": {"n1": "Wavelength", "n2": "Amplitude", "n3": "Drift speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "plasma": {"n1": "Scale", "n2": "Speed", "n3": "Contrast", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "segment_chase": {"n1": "Segment size", "n2": "Phase step", "n3": "Segment phase offset", "n4": "Gap per segment", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "bar_graph": {"n1": "Level percent", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "breathing_dual": {"n1": "Phase offset", "n2": "Ease", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "strobe_burst": {"n1": "Burst count", "n2": "Burst gap", "n3": "Cooldown", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "rain_drops": {"n1": "Drop rate", "n2": "Ripple width", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "fireflies": {"n1": "Count", "n2": "Twinkle speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "clock_sweep": {"n1": "Hand width", "n2": "Marker interval", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "marquee": {"n1": "On length", "n2": "Off length", "n3": "Step", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "aurora": {"n1": "Band count", "n2": "Shimmer", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "snowfall": {"n1": "Flake density", "n2": "Fall speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "heartbeat": {"n1": "Pulse 1 ms", "n2": "Pulse 2 ms", "n3": "Pause ms", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "orbit": {"n1": "Orbit count", "n2": "Base speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "palette_morph": {"n1": "Morph ms", "n2": "Warp rate", "n3": "Turbulence", "max_colors": 10, "min_delay": 10, "max_delay": 10000}}
{"on": {"min_delay": 10, "max_delay": 10000, "max_colors": 1}, "off": {"min_delay": 10, "max_delay": 10000, "max_colors": 0}, "rainbow": {"n1": "Step Rate", "min_delay": 10, "max_delay": 10000, "max_colors": 0}, "colour_cycle": {"n1": "Step Rate", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "transition": {"min_delay": 10, "max_delay": 10000, "max_colors": 10}, "chase": {"n1": "Colour 1 Length", "n2": "Colour 2 Length", "n3": "Step 1", "n4": "Step 2", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "pulse": {"n1": "Attack", "n2": "Hold", "n3": "Decay", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "circle": {"n1": "Head Rate", "n2": "Max Length", "n3": "Tail Rate", "n4": "Min Length", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "blink": {"min_delay": 10, "max_delay": 10000, "max_colors": 10}, "flicker": {"n1": "Min brightness", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "flame": {"n1": "Min brightness", "n2": "Breath period (ms)", "n3": "Spark gap min (ms, 0=default 10\u201330 s, -1=off)", "n4": "Spark gap max (ms)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "twinkle": {"n1": "Twinkle activity (1\u2013255, higher = more changes)", "n2": "Density (0\u2013255, higher = more of the strip lit)", "n3": "Min adjacent LEDs per twinkle (same as max for fixed length)", "n4": "Max adjacent LEDs per twinkle (same as min for fixed length)", "min_delay": 84, "max_delay": 10000, "max_colors": 10}, "radiate": {"n1": "Node spacing (LEDs)", "n2": "Out time (ms)", "n3": "In time (ms)", "min_delay": 10, "max_delay": 10000, "max_colors": 2}, "meteor_rain": {"n1": "Tail length", "n2": "Speed (LEDs per frame)", "n3": "Fade amount (1-255)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "scanner": {"n1": "Eye width", "n2": "End pause (frames)", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "gradient_scroll": {"n1": "Scroll step rate", "min_delay": 10, "max_delay": 10000, "max_colors": 10}, "comet_dual": {"n1": "Tail length", "n2": "Speed", "n3": "Gap", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "sparkle_trail": {"n1": "Spark density", "n2": "Decay", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "wave": {"n1": "Wavelength", "n2": "Amplitude", "n3": "Drift speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "plasma": {"n1": "Scale", "n2": "Speed", "n3": "Contrast", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "segment_chase": {"n1": "Segment size", "n2": "Phase step", "n3": "Segment phase offset", "n4": "Gap per segment", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "bar_graph": {"n1": "Level percent", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "breathing_dual": {"n1": "Phase offset", "n2": "Ease", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "strobe_burst": {"n1": "Burst count", "n2": "Burst gap", "n3": "Cooldown", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "rain_drops": {"n1": "Drop rate", "n2": "Ripple width", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "fireflies": {"n1": "Count", "n2": "Twinkle speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "clock_sweep": {"n1": "Hand width", "n2": "Marker interval", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "marquee": {"n1": "On length", "n2": "Off length", "n3": "Step", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "aurora": {"n1": "Band count", "n2": "Shimmer", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "snowfall": {"n1": "Flake density", "n2": "Fall speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "heartbeat": {"n1": "Pulse 1 ms", "n2": "Pulse 2 ms", "n3": "Pause ms", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "orbit": {"n1": "Orbit count", "n2": "Base speed", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "palette_morph": {"n1": "Morph ms", "n2": "Warp rate", "n3": "Turbulence", "max_colors": 10, "min_delay": 10, "max_delay": 10000}, "gradient_wipe": {"n1": "Start LED", "n2": "End LED", "min_delay": 10, "max_delay": 10000, "max_colors": 2}}
+1 -1
View File
@@ -1 +1 @@
{"1": {"name": "on", "pattern": "on", "colors": ["#FFFFFF"], "brightness": 255, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "2": {"name": "off", "pattern": "off", "colors": [], "brightness": 0, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "3": {"name": "rainbow", "pattern": "rainbow", "colors": [], "brightness": 255, "delay": 100, "auto": true, "n1": 2, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "4": {"name": "transition", "pattern": "transition", "colors": ["#FF0000", "#00FF00", "#0000FF", "#FFFFFF", "#0000FF", "#FFFF00"], "brightness": 255, "delay": 5000, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1", "palette_refs": [null, null, null, 6, 2, 3]}, "5": {"name": "chase", "pattern": "chase", "colors": ["#FF0000", "#0000FF"], "brightness": 255, "delay": 200, "auto": true, "n1": 5, "n2": 5, "n3": 1, "n4": 1, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "6": {"name": "pulse", "pattern": "pulse", "colors": ["#00FF00"], "brightness": 255, "delay": 500, "auto": true, "n1": 1000, "n2": 500, "n3": 1000, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "7": {"name": "circle", "pattern": "circle", "colors": ["#FFA500", "#800080"], "brightness": 255, "delay": 200, "auto": true, "n1": 2, "n2": 10, "n3": 2, "n4": 5, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "8": {"name": "blink", "pattern": "blink", "colors": ["#FF0000", "#00FF00", "#0000FF", "#FFFF00"], "brightness": 255, "delay": 1000, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "9": {"name": "warm white", "pattern": "on", "colors": ["#FFF5E6"], "brightness": 200, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "10": {"name": "cool white", "pattern": "on", "colors": ["#E6F2FF"], "brightness": 200, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "11": {"name": "red", "pattern": "on", "colors": ["#FF0000"], "brightness": 255, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "12": {"name": "blue", "pattern": "on", "colors": ["#0000FF"], "brightness": 255, "delay": 100, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "13": {"name": "rainbow slow", "pattern": "rainbow", "colors": [], "brightness": 255, "delay": 150, "auto": true, "n1": 1, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "14": {"name": "pulse slow", "pattern": "pulse", "colors": ["#FF6600"], "brightness": 255, "delay": 800, "auto": true, "n1": 2000, "n2": 1000, "n3": 2000, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "15": {"name": "blink red green", "pattern": "blink", "colors": ["#FF0000", "#00FF00"], "brightness": 255, "delay": 500, "auto": true, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1"}, "30": {"name": "rainbow slow", "pattern": "rainbow", "colors": [], "brightness": 255, "delay": 150, "auto": true, "n1": 1, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "31": {"name": "DJ Rainbow", "pattern": "rainbow", "colors": [], "brightness": 220, "delay": 60, "n1": 12, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "32": {"name": "DJ Single Color", "pattern": "on", "colors": ["#ff00ff"], "brightness": 220, "delay": 100, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "33": {"name": "DJ Transition", "pattern": "transition", "colors": ["#ff0000", "#00ff00", "#0000ff"], "brightness": 220, "delay": 250, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "34": {"name": "DJ Rainbow", "pattern": "rainbow", "colors": [], "brightness": 220, "delay": 60, "n1": 12, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "35": {"name": "DJ Single Color", "pattern": "on", "colors": ["#ff00ff"], "brightness": 220, "delay": 100, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "36": {"name": "DJ Transition", "pattern": "transition", "colors": ["#ff0000", "#00ff00", "#0000ff"], "brightness": 220, "delay": 250, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "2"}, "37": {"name": "tranistion2", "pattern": "transition", "colors": ["#FF0000", "#FFFF00", "#FF00FF"], "brightness": 128, "delay": 1000, "n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0, "n7": 0, "n8": 0, "profile_id": "1", "palette_refs": [0, 3, 4]}, "38": {"name": "Colour Cycle", "pattern": "cLine truncated
{"1":{"name":"on","pattern":"on","colors":["#FFFFFF"],"brightness":255,"delay":100,"n1":0,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"1"},"2":{"name":"off","pattern":"off","colors":[],"brightness":0,"delay":100,"n1":0,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"2"},"3":{"name":"rainbow","pattern":"rainbow","colors":[],"brightness":255,"delay":100,"n1":2,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"3"},"4":{"name":"Colour Cycle","pattern":"colour_cycle","colors":["#FF0000","#00FF00","#0000FF"],"brightness":255,"delay":100,"n1":1,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"4"},"5":{"name":"transition","pattern":"transition","colors":["#FF0000","#00FF00","#0000FF"],"brightness":255,"delay":500,"n1":0,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"5"},"6":{"name":"flicker","pattern":"flicker","colors":["#FFB84D"],"brightness":255,"delay":80,"n1":30,"n2":0,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"6"},"7":{"name":"flame","pattern":"flame","colors":[],"brightness":255,"delay":50,"n1":35,"n2":2600,"n3":0,"n4":0,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"7"},"8":{"name":"twinkle","pattern":"twinkle","colors":["#78C8FF","#508CFF","#B478FF","#64DCE8","#A0C8FF"],"brightness":255,"delay":55,"n1":72,"n2":140,"n3":2,"n4":6,"n5":0,"n6":0,"n7":0,"n8":0,"profile_id":"1","auto":true,"id":"8"}}
BIN
View File
Binary file not shown.
-3
View File
@@ -1,3 +0,0 @@
PRST1xœ%ÎÁ
Â0Ð_‘ñšCSµJîæ'D$¶«␍ÄÝ’¦ˆˆÿntOovæ²opxz‘´zޱ ¦P
e®µp={I’g¸ÖÇηÞãlpÍñ>¦¹mÓ ” ÎþrXŠÀ•¼�[¸Zq«l”­²S:e¯þLYn1Ñ%õ‹Ï ¥/ï
-2
View File
@@ -1,2 +0,0 @@
PRST1xњ%ОAВ …б»<·,J5\Е4␍К $84SX4Ж»‹eхеНlюШЅ B
‹+…„ЫОЬж#§,+м␍‡@ЖЏIб.сщ*Lk{ЊЖ(xJnѓХГ аjЙ°E*)°†m';ЗО©c:зОҐsЭY$‡�hЋѕuиЅ*Qлљ…В?†kJУчП=5Я
-1
View File
@@ -1 +0,0 @@
PRST1xœ%ÎA л|·, ŠÐK˜ÆP;* ␍……1Þ݉3›—ÿÿf>àø"̹ ÖØU–¢°Ä[É¥nì¬Ü8b2˜kz<Ó&Ãà½ÁB9¾œµ±·‚Ðj'vRñ ì•ƒâ•£rRÎÖZî)Ó5-ò‡Ã÷yÒ-€
-2
View File
@@ -1,2 +0,0 @@
PRST1xœEÎÁ
Â0Ð_‘9ç`«Qɯˆ”Ô®ˆ»e“RDüwsðô˜™Ë¼ÁñIИx”uS²¬p˜c­¤ü¬»J-ç‹Ã¨éþ¨LÅrï½ÃD9¾:¿uˆK„ª 9pg¥Ñ#ØÂ»Æ¾á‡Æ±qú1«ÜR¦!Mö¡Ãç ��1
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ=ÎÝ
!†á[‰¯StK[¼€½‰ˆ°v*ÁTü!"º÷Ü¤Žžá�9˜¼¹4bu™VÙ…¢)…’ÿåVÎÁ…”¡÷XO“RœãÀpJöz+žr[ R2ÌäÌzäœÁÔ KªÄàE;àKõ´èÓæß¶Ð ²£:»Îø%¦p±ŽŽvn? ¼?�¨2ú
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœUÎÁ
Â0ЙsM5Uò+"²µ«â¦lSDÄwiNž³3‡ý@èɈPJ2–fª•Uþn×’‹.ˆ§³Ã¨éþ¨Â‹å>‡‰3½}×9ÐZ bÕ•ÄÛÀè­‘]cß�¡qh7f-·”ù’&ûÁãûF9/.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœEÎÁ
Â0Ð_‘9ç`«Qɯˆ”Ô®ˆ»e“RDüwsðô˜™Ë¼ÁñIИx”uS²¬p˜c­¤ü¬»J-ç‹Ã¨éþ¨LÅrï½ÃD9¾:¿uˆK„ª 9pg¥Ñ#ØÂ»Æ¾á‡Æ±qú1«ÜR¦!Mö¡Çç �“1
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ%ͽÂ0 àW©Ž5C~•&VÆ
¡@�)uª4K…xwR<}ç»Á° —ks <DjÎ)¦ …É•B™ë–¸ž¯µža;l¼×Ú{Üž9 ïÂ4×Á­ÐSt l«kævÅ[a'ì…ƒpN¦œ|ˆô}ýmðý‡-‰
-1
View File
@@ -1 +0,0 @@
PRST1xœMÎ1! †á¿b¾[=5ÌNÎnÆô@I°\€Åÿ»Å.²<oÚ¼Aîéa±?,ŽÅQ�-f‚ÂìZó…xÓþÇ·œr©°' !h~<´î-Õg…k‰÷G#_ùØ­0ùä^Ü#7-a;FX ka6ÂVØý˜K1ùKœø_Ÿ/ÐM4y
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ%ͽÂ0 àW©Ž5C~•&VÆ
¡@�)uª4K…xwR<}ç»Á° —ks <DjÎ)¦ …É•B™ë–¸ž¯µža;l¼×Ú{Üž9 ïÂ4×Á­ÐSt l«kævÅ[a'ì…ƒpN¦œ|ˆô}ýmðý‡-‰
-1
View File
@@ -1 +0,0 @@
PRST1xœMÎ1! †á¿b¾[=5ÌNÎnÆô@I°\€Åÿ»Å.²<oÚ¼Aîéa±?,ŽÅQ�-f‚ÂìZó…xÓþÇ·œr©°' !h~<´î-Õg…k‰÷G#_ùØ­0ùä^Ü#7-a;FX ka6ÂVØý˜K1ùKœø_Ÿ/ÐM4y
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-3
View File
@@ -1,3 +0,0 @@
PRST1xœUÎÁ‚0„áw¯=¤jú*†�
[m\[²”ƒ1¾»…ž<}ÉÌåÿ ºÁÂsŸ$P˜]Î$ño'Y`¯88ÒÚ{ô
7 ÷GŽ´”£5Fa"voX£Üšl–•bÛè2ÆvãXé*¦rªœ+—�Y’LC˜JM³·1•ºAÈo5qeî¿?ªð9±
BIN
View File
Binary file not shown.
-4
View File
@@ -1,4 +0,0 @@
PRST1xśMÎÁ‚0„áwŻ=$ű*†�
[%Y[RÚ1ľ»…^<}ÉĚĺ˙Ŕ™7�`ĺPa51rpËäŇ␍tÇĹÚ©×�Â#,ĎWtĽĺŁŞ{…™Ĺě V+�=(†Ä
®5m¶՝ίk@×B[č
·B˛oáq™sMu¶ çş1°=z\ľ?µ¦8>
-2
View File
@@ -1,2 +0,0 @@
PRST1xśmŹÁ‚0 †ßĄ\wČ`ŮMQ^Â2ĄčâÜČ1ĆřînĚ‹‰—~í—?Mű#ďüC™›F 0IďŃ™w¶ÚşÄ˛š7Ľm�ËĺMęveýuUąo<v[şć:'§.Wop
Ć ¨ĺDN)ąx » �<H¤)B2r"˘Śá@–Ć*ˇNŕ+&gGĄ±WC8<_ßĐéŽńpłhMţ”îýŹ!I°
-2
View File
@@ -1,2 +0,0 @@
PRST1xњUЋ;В0птТєp>°WAQґђ5X2Nд8BЬ;©hv¤·SМЃ_BдЙq(,њ’Др·Эg?ЗtEЕЅЦЦж­ТZіf
·иПdНJcЊВ$ћЯ “ЮТ Jq…PѓЪј…t)ПР‚є] ЁАињњw,q¶ОЛи¦\Wп­^rнЕ–є°yЇКѕ?Эh>Ў
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœEÎM
Â0à«Ès›Eÿ¢’ôE$¶£â¤$Ó…ˆww0 góÁ{o1o°„ŠìÊì™)Ã`õ"”Y‹6§˜r�›°ÇFgƒk÷‡0-:k␍Šþ×7~“'y#ná¥Ó™ÒÃ逇Э*ÇÊéÇšÓ-Dº„Eiñù¹L2‡
-3
View File
@@ -1,3 +0,0 @@
PRST1xœ=ŽA‚0E¯B>Û.
*š€KC*ŒØ¤¶¤Æxw�Í{™7‹y!ØÁ€)s5';9
\å1Eï¡°XfJA~mø·1ú˜2ÌußkÙÕZo^ls\®ÉÍw”å¸mµÂDÞ>a:Q»r„á´’Bh¤ Z)aW°/8tÇ‚ÓKŠ7çip“üÙàý)<¡
-3
View File
@@ -1,3 +0,0 @@
PRST1xś-ÎÁ‚0Đ_!õ‡Šdo˝ô'Ś!Ş’”–”ĺ`Ś˙î<˝ÍĚö�čfű•‹!Íž‹qs
‹cö9J·Çý?RHy]QZkŚÖ’•Zc-n
÷<=_ý*“Zk…Ń÷µrşŤ�óćbę„T ␍¨N ŮĹóA{p9čv–śSđý4Ęcľ?6Đ
-2
View File
@@ -1,2 +0,0 @@
PRST1x�5־A‚0…ב«�ַ¶ @Dׂ- —0ֶT©�X[2ֶxwG׳ש&‎»˜‚yXh°M\₪�׀��‚ֹ8…�0[
’ור/חט#%ט=ֺ¾†q”·r\…¹כ�ƒMע¥©*…ֹzף„מd5 Gh¦ֵ*„Zz+6b-1l ¿´™m¦ֻל2‎ֺLסגה"7ֹy5�־ד:G
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ-ÎÁ Ð_1ã•ÔZŽúÆ´«’ 4°Õã¿»Š§7;sÙ¢»,˜
/îNP˜3å(í¿8¥�r�Ýa©õ¶ìŽÙ_®©ÈÐh­0RpOØN¢›9ÁržI!XÓˆ�ØËW„ö{­+]eSéL9�} ƒåƒ÷ªù0¿
-2
View File
@@ -1,2 +0,0 @@
PRST1x�=ЮA
Т0аЋШw�EZ5JаK�б�ZH��L"онС�Ћ7ќџѓFЄ�с!\e�е�`�I�KдќнRHЅТ�и�ЕЮсlp-ѓу)�ЋНЕzС;=i�/ee�иiІє:Sv�=МютЁсЧЦщG.щ>ОЬ�Овсѓ,�1И
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ5ÎA‚0Ы�϶‹‚ˆ¦è%Œ!F �–´ÃÂïîhu6o2ÿ/æ ïV‚Sâ"Ѹ’碟\"(lŽ™¢—ø—tÿ¤Kˆ æ‚ÒZ-#·ò£µ¸*Üâ<Nì)I¥ÖZa Å=`ZYÝΆãN
¾‚i„¦0RðMæ˜i3§ÌùËÃ}^¨›ù­Âë␍Çü8÷
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ5Î=Â0 †á«Tk†þQ�À%*T%Ô@¥’TŽ; ÄÝIáå±ôzðÞ¾å¨ET Ž ·JT,V•ŧšÃð·0‰ ‡Ë>¸8™OõS¨ËÒ`äÙ¾A]Zíª¤²²�¯@M¢ÎÉ7 v;÷-hã˜é2§Ìyg‘pŸf¦1ýTáû^
7˜
-3
View File
@@ -1,3 +0,0 @@
PRST1x�5ΞΝ
Β0ΰW)γ5‡ώh­Ήϊ"%ΪU5)›νAΔww5xϊ–™9μ Α=BI
v>Η%Α`q"ΔA»o<ώγK�#'Ψ#6‡²ο†'ƒ3ϋΫ]%-κ²4�hvOΨVO·J„^Ι T°M­Φ��ΐκ"l3»L›ΩgΊ Η«�iτ“ώSαύ��5%
-4
View File
@@ -1,4 +0,0 @@
PRST1xœMαÂ0 Ð_A×5CZ ´™Q~!¨ ‘BR%î€ÿŽE¦gÝÝà7¢{ ˜
ofŸiž
ÇL9JõŸÞRH¹ÀœÐX{Ô½–¬µµ£ÆYášýýÁ‘ŠL:­&
îÓËéVN0œWRˆ­dB3[Ä]e_é+‡ÊðcÉiö�.~’¿Z|¾¡ 61
-1
View File
@@ -1 +0,0 @@
PRST1xœ5ŽAƒ E¯b¾[¨U+WiŒ¡2¶¦ `š¦éÝ ’nxÌ›Y¼Œ|ùPÌÚÎ�¿ˆ60l2r&.?ýýlµuâ‚Rõ|àCt%Wuß5®n½Ýƒ!OjÎiùN¹ ÜN ¦‚¨¢35DÑ@¤é”Ñft}ÆùÀæì²jšVÓª#TSL�-)ËìZ³ôŒßQ•AÓ
-1
View File
@@ -1 +0,0 @@
PRST1xњEО1В0 Р« ПљЎiЎ ЂK „5)MЪФвоXНЂ—gщяБD72В‹lF—зВ ѓЙ‰pЋьoчR^@glOлаbpЛющ’И‹mУ ЬФлкЉ$ђдВС‚:ҐХљТЃ¬Іi/о+}еP9®L9=|а«ф‹пжg2д
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ=ÎÍ
Â0àW‘é5‡ô?ìM"} ‰vÕBMJ’D|wSž¾afû†5O!rˆ;³zç␍#{›úuu³ótDQi­”N]ÑÊ^␍Öö²•�“ÀÅO÷G´Òq%¥Àȳy�ºÍ(ú•l ª¨I“­AM¦Ít™>£~,Þݦ™ÏÓ˜þ+ñùÚ¦5ó
-3
View File
@@ -1,3 +0,0 @@
PRST1x°Mна
б0 ЮW▒вз╘SzTЯ%D╓╨L╣m├┬ЬНfКе\╬ДOЫ ╦'а┌)С"┤ЬЙ°ВP3╔ ⌡©П}LЖ└Й8≈dуNЖр²╝╘©?8P√⌠Zk┘√╪{ц6р╨▒#,╖▒┌≥Жb␍k└%Л4╜
КBSь╤3C┼]ОИр╥Р≈аВ┘┘6
-2
View File
@@ -1,2 +0,0 @@
PRST1xœMÎK
Â0…á½§ÜT£’tR$Ú«âMÉc âÞm�ˆ£þ39Oˆ»3,¦2Car¥p’¿rŽ!¦ {ÀЍï‰0(œ’¿ÞŠpž‡Î…‘ƒ{À"WK„-©²‚hXMK•î;Ëú—6° ¦±mìûSŠøèÇù’Æë␍»0Ø
-4
View File
@@ -1,4 +0,0 @@
PRST1xœMÎA‚0Ы˜ï¶‹RÉ€KcŠŒBR[Ò c¼»­l\½Éÿùɼáí“ANr˜ÙFÙ
V+ÂÑçê?½b␍8ö½éj�‹Â—Ç,žS.ŒÖ
;ûµù´›�Ä�|ªL½uŨ)_ƒ
ÍN»sÞé~¬1ÜÇ×eÊ/Uø|Æœ5
BIN
View File
Binary file not shown.
-3
View File
@@ -1,3 +0,0 @@
PRST1xœ5ŽA‚0E¯B>Û.
*š€KCªŒBRÚ¦ c¼»ÅÙ¼7óÿb>ðv"0Í\D눙Š)¤8@!ZÙ’—xOºò.¤抲mµŒÜJ­W϶:n
÷4¾ö4K¹ÖZ¡'gß0�¨]8ÀpZHÁW0ÕVðõÞô˜ÇŒSF“qθlˆ)<GGÝØË«¾?ð¹<
-3
View File
@@ -1,3 +0,0 @@
PRST1xœMŽ1Â0 Eïò»fp
�(K/�
­�H!©Òt@ˆ»cÈÂô¾Ÿ¿%¿�üƒá0†2F†Âìkå’þÕ˜c. ÜÝ0 ‘¸Î‘%œ.%Üî5ñ"•Þ…‰£J&RðkÍpµ¬¬�´HA§e•6mÜÂÉQ2p_¹kØ7Øæ’¯!ò9Lò–Æû¼Ã1ó
BIN
View File
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
PRST1xœ%ÎK
Ã0 Ы”éÖ‹$ýâ«”ÜFn Ž›PJï^ÇÖæI£Í|Áf&hlFæÃ6¹HPXLŒ$œãÀù|d…~àhË WxŠ{O‘iÍ�®iFòæÝî»I1@GI¤À-tޏ«œ*çÊ¥r­Ü*÷Â"Á:Oƒs�¶´ò”{␍Bv/ÃÉûþ÷½8ù
+1 -1
View File
@@ -1 +1 @@
{"1": {"name": "default", "type": "zones", "zones": ["1", "8"], "scenes": [], "palette_id": "1"}, "2": {"name": "test", "type": "zones", "zones": ["6", "7"], "scenes": [], "palette_id": "12"}}
{"1": {"name": "default", "type": "zones", "zones": ["1"], "scenes": [], "palette_id": "1", "id": "1"}}
+1 -22
View File
@@ -1,22 +1 @@
{
"1": {
"name": "Default Scene",
"sequences": [
"1"
],
"groups": [
"1"
]
},
"2": {
"name": "Party Mode",
"sequences": [
"1",
"2"
],
"groups": [
"1",
"2"
]
}
}
{}
+1 -1
View File
@@ -1 +1 @@
{"1": {"group_name": "Main Group", "presets": ["1", "2"], "sequence_duration": 3000, "sequence_transition": 500, "sequence_loop": true, "sequence_repeat_count": 0, "sequence_active": false, "sequence_index": 0, "sequence_start_time": 0}, "2": {"group_name": "Accent Group", "presets": ["2", "3"], "sequence_duration": 2000, "sequence_transition": 300, "sequence_loop": true, "sequence_repeat_count": 0, "sequence_active": false, "sequence_index": 0, "sequence_start_time": 0}}
{}
+1 -1
View File
@@ -1 +1 @@
{"1": {"name": "default", "names": ["led-188b0e1560a8", "led-f0f5bdfb9d30"], "presets": [["4", "2", "7"], ["3", "14", "5"], ["8", "9", "1"], ["6", "38", "42"], ["39", "40", "41"], ["43", "44", "45"], ["46", "47", "48"], ["49", "50", "51"], ["52", "53", "54"], ["55", "56", "57"], ["58", "59", "60"], ["61", "62"]], "presets_flat": ["4", "2", "7", "3", "14", "5", "8", "9", "1", "6", "38", "42", "39", "40", "41", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62"], "default_preset": "41"}, "2": {"name": "default", "names": ["1", "2", "3", "4", "5", "6", "7", "8", "0", "a"], "presets": [["16", "17", "18"], ["19", "20", "21"], ["22", "23", "24"], ["25", "26", "27"], ["28", "29", "30"]], "presets_flat": ["16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"]}, "3": {"name": "default", "names": ["1"], "presets": [], "default_preset": null}, "4": {"name": "default", "names": ["1"], "presets": [], "default_preset": null}, "5": {"name": "dj", "names": ["dj"], "presets": [["31", "32", "33"]], "default_preset": "31", "presets_flat": ["31", "32", "33"]}, "6": {"name": "default", "names": ["1"], "presets": [], "default_preset": null, "presets_flat": []}, "7": {"name": "dj", "names": ["dj"], "presets": [["34", "35", "36"]], "default_preset": "34", "presets_flat": ["34", "35", "36"]}, "8": {"name": "test", "names": ["led-188b0e1560a8"], "presets": [["1", "2", "3"], ["4", "5"]], "default_preset": "1", "presets_flat": ["1", "2", "3", "4", "5"]}}
{"1": {"name": "default", "names": ["1"], "presets": [["1", "2", "3", "4", "5", "6", "7", "8"]], "presets_flat": ["1", "2", "3", "4", "5", "6", "7", "8"], "default_preset": "1", "id": "1", "group_ids": ["1"], "preset_group_ids": {}, "sequence_ids": [], "content_kind": "presets"}}
+31
View File
@@ -0,0 +1,31 @@
dependencies:
espressif/mdns:
component_hash: ef0766474b37459f6ad22461e453a8713e780e831a7c993b16919d817988dff6
dependencies:
- name: idf
require: private
version: '>=5.0'
source:
registry_url: https://components.espressif.com/
type: service
version: 1.14.1
idf:
source:
type: idf
version: 5.5.5
joltwallet/littlefs:
component_hash: e1a0f4a6adf821759cb34703a91107bbdce5d7ff6f4728f40ab012bb87842974
dependencies:
- name: idf
require: private
version: '>=5.0'
source:
registry_url: https://components.espressif.com/
type: service
version: 1.23.1
direct_dependencies:
- espressif/mdns
- joltwallet/littlefs
manifest_hash: a5329d49f0154685d9701ccb399916a87107b77ddfe802c911aa2bb41ed5bab0
target: esp32s3
version: 2.0.0
Submodule
+1
Submodule dmx-driver added at d2ffcb1969.
+295 -295
View File
@@ -1,358 +1,358 @@
# LED Controller API
This document covers:
The controller is an ESP32-S3 on Ethernet (W5500). It serves the web UI and a JSON API on port 80, detects beats from its I2S microphone and talks to the LED drivers over ESP-NOW. This document covers:
1. **HTTP and WebSocket** exposed by the Raspberry Pi app (`src/main.py`) — profiles, zones, presets, transport send, pattern OTA helpers, and related resources.
2. **LED driver JSON** — the compact **v1** message format. It is sent over the **serial → ESP-NOW bridge** to ESP32 peers and as **single JSON text messages** over the **outbound WebSocket** to **Wi-Fi** drivers (same logical fields).
1. The HTTP and WebSocket API, by resource.
2. How the controller turns API calls into driver messages, and the message format.
Default HTTP listen address: `0.0.0.0`. Port defaults to **80**; override with the **`PORT`** environment variable (see `pipenv run run`).
Request and response bodies are JSON (`Content-Type: application/json`) unless noted. Errors come back as `{"error": "..."}` with a 4xx or 5xx status.
**Serial:** UART path and baud come from settings (defaults include `serial_port` such as `/dev/ttyS0` and `serial_baudrate`). **Wi-Fi drivers:** **UDP** on port **8766** is the **discovery** channel: each driver’s JSON hello (**`device_name`**, **MAC**, optional **`type`**) **creates or updates** that device in **`db/device.json`** (keyed by MAC); the Pi echoes the datagram. After a valid hello with **`v`:** **`"1"`**, the Pi also opens an **outbound WebSocket** to that IP (**`wifi_driver_ws_port`**, default **80**; **`wifi_driver_ws_path`**, default **`/ws`**) for v1 commands; presets are not pushed automatically on connect (use **Send Presets** / profile apply). The Pi may send periodic UDP **hello** nudges to known Wi‑Fi device IPs when the WebSocket is down (**`wifi_driver_hello_interval_s`** in settings).
## Data and scoping
All JSON APIs use `Content-Type: application/json` for bodies and responses unless noted.
- **Storage.** Each resource is a collection (`device`, `zone`, `preset`, `profile`, `palette`, `pattern`, `sequence`, `scene`, `group`, `output`, `settings`), stored as one JSON object of id → record on the flash filesystem. New records get the next numeric id (highest + 1), as a string. Devices are keyed by MAC (12 lowercase hex digits, no colons) and patterns by name.
- **Current profile.** `settings.current_profile_id`, set by `POST /profiles/<id>/apply`. When it is unset or names a missing profile, the first profile is current. It is global (the same for every browser).
- **Profile scoping.** Presets and sequences belong to a profile (`profile_id`). The list routes return only the current profile's records, and the single-record routes answer 404 for another profile's. Groups with a `profile_id` are visible only while that profile is current; groups without one are shared.
- **Current zone.** A `current_zone` cookie, set by `POST /zones/<id>/set-current`. Without it, the current profile's first zone.
- **Migration.** At boot, groups, zones and sequences written by older versions get the fields described below.
---
## UI behavior notes
The main UI has two modes controlled by the mode toggle:
- **Run mode**: optimized for operation (zone/preset selection and profile apply).
- **Edit mode**: shows editing/management controls (zones, presets, patterns, colour palette, send presets, profile management actions, **Devices** registry for LED driver names/MACs, and related tools).
Profiles are available in both modes, but behavior differs:
- **Run mode**: profile **apply** only.
- **Edit mode**: profile **create/clone/delete/apply**.
`POST /presets/send` is wired to the **Send Presets** UI action, which is exposed in Edit mode.
---
## Session and scoping
Several routes use **`@with_session`**: the server stores a **current profile** in the session (cookie). Endpoints that scope data to “the current profile” (notably **`/presets`**) only return or mutate presets whose `profile_id` matches that session value.
Profiles are selected with **`POST /profiles/<id>/apply`**, which sets `current_profile` in the session.
---
## Static pages and assets
## Pages and static files
| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Main UI (`templates/index.html`) |
| GET | `/settings/page` | Standalone settings page (`templates/settings.html`) |
| GET | `/favicon.ico` | Empty response (204) |
| GET | `/static/<path>` | Static files under `src/static/` |
| GET | `/` | Main UI |
| GET | `/settings/page` | Standalone settings page |
| GET | `/audio` | Live audio and beat page (level, tempo, bar position, tap) |
| GET | `/settings/editor` | Driver settings editor: sends a driver settings (`PUT /devices/<id>`) |
| GET | `/static/<path>` | UI scripts and styles |
| GET | `/favicon.ico` | 204 |
---
Pages and static files are built into the firmware (gzipped, sent with `Content-Encoding: gzip`). They carry `Cache-Control: no-cache` and an `ETag` of the firmware build, so a browser revalidates each load (304 until the next update).
## WebSocket: `/ws`
Connect to **`ws://<host>:<port>/ws`**.
- Send **JSON**: the object is forwarded through the **serial sender** (6-byte MAC prefix + payload to the ESP-NOW bridge). Optional key **`to`**: 12-character hex MAC address; if present it is removed from the object and the payload is sent to that peer; otherwise the default destination from settings is used.
- Send **non-JSON text**: forwarded as raw bytes with the default address.
- On send failure, the server may reply with `{"error": "Send failed"}`.
Wi-Fi devices are not targeted by `/ws` directly; use **`POST /presets/send`**, device routes, or **`POST /patterns/<name>/send`** as appropriate.
---
## HTTP API by resource
Below, `<id>` values are string identifiers used by the JSON stores (numeric strings in practice).
### Settings — `/settings`
## Controller
| Method | Path | Description |
|--------|------|-------------|
| GET | `/settings` | Full settings object (from `settings.json` / `Settings` model). |
| PUT | `/settings/settings` | Merge keys into settings and save. Returns `{"message": "Settings updated successfully"}`. |
| GET | `/settings/wifi/ap` | Saved Wi‑Fi AP fields: `saved_ssid`, `saved_password`, `saved_channel`, `active` (Pi: `active` is always false). |
| POST | `/settings/wifi/ap` | Body: `ssid` (required), `password`, `channel` (1–11). Persists AP-related settings. |
| GET | `/settings/page` | Serves `templates/settings.html`. |
| GET | `/status` | IP, `eth` (ip, mask, gw, up), `ap_ip`, `ap_clients` (`[{mac, ip}]` on the Wi-Fi access point), MAC, uptime, `free_heap`, `free_internal` (internal RAM), mic level, tempo and beat counts, ESP-NOW and link statistics |
| POST | `/reboot` | Replies `{"message":"rebooting"}`, then restarts after 0.5 s |
| GET | `/ota` | Running image: partition, version, build time, IDF version, sha |
| POST | `/ota` | Body: the raw firmware `.bin` (web UI included). Written to the idle slot, made the boot image, then the board reboots. A new image confirms itself after staying up a few seconds; one that crashes on start rolls back. `make ota HOST=<ip>` |
| GET | `/db/<collection>` | Export a whole collection |
| PUT | `/db/<collection>` | Replace a whole collection. Body: the object of id → record. Reply: `{"records": n}` |
### Devices — `/devices`
Registry in `db/device.json`: storage key **`<id>`** (string, e.g. `"1"`) maps to an object that always includes:
| Field | Description |
|-------|-------------|
| **`id`** | Same as the storage key (stable handle for URLs). |
| **`name`** | Shown in the UI and used in `select` keys. |
| **`type`** | `led` (only value today; extensible). |
| **`transport`** | `espnow` or `wifi`. |
| **`address`** | For **`espnow`**: optional 12-character lowercase hex MAC. For **`wifi`**: optional IP or hostname string. |
| **`default_pattern`**, **`zones`** | Optional. Legacy **`tabs`** may still appear in old files and is migrated away on load. |
Existing records without `type` / `transport` / `id` are backfilled on load (`led`, `espnow`, and `id` = key).
**Bench tests** (see `docs/BENCH_TEST.md`):
| Method | Path | Description |
|--------|------|-------------|
| GET | `/devices` | Map of device id → device object. |
| GET | `/devices/<id>` | One device, 404 if missing. |
| POST | `/devices` | Create. Body: **`name`** (required), **`type`** (default `led`), **`transport`** (default `espnow`), optional **`address`**, **`default_pattern`**, **`zones`**. Returns `{ "<id>": { ... } }`, 201. |
| PUT | `/devices/<id>` | Partial update. **`name`** cannot be cleared. **`id`** in the body is ignored. **`type`** / **`transport`** validated; **`address`** normalised for the resulting transport. |
| DELETE | `/devices/<id>` | Remove device. |
| GET, POST | `/test/loss` | Simulated ESP-NOW loss. Body `{"percent": 0–100, "beats": bool}` (whether beat frames are dropped too). Reply: the current setting |
| POST | `/test/beats` | Body `{"bpm": 30–300, "count": n}` (0 = until stopped): synthetic beats to the drivers, with delivery and latency measured from their echoes. The mic's beats are muted meanwhile |
| GET | `/test/beats` | Results so far |
| POST | `/test/beats/stop` | Stop the generator |
### Profiles — `/profiles`
## Settings — `/settings`
| Method | Path | Description |
|--------|------|-------------|
| GET | `/profiles` | `{"profiles": {...}, "current_profile_id": "<id>"}`. Ensures a default current profile when possible. |
| GET | `/profiles/current` | `{"id": "...", "profile": {...}}` |
| GET | `/profiles/<id>` | Single profile. If `<id>` is `current`, same as `/profiles/current`. |
| POST | `/profiles` | Create profile. Body may include `name` and other fields. Optional `seed_dj_zone` (request-only) seeds a DJ zone + presets. New profiles always get a populated `default` zone. Returns `{ "<id>": { ... } }` with status 201. |
| POST | `/profiles/<id>/apply` | Sets session current profile to `<id>`. |
| POST | `/profiles/<id>/clone` | Clone profile (zones, palettes, presets). Body may include `name`. |
| PUT | `/profiles/current` | Update the current profile (from session). |
| PUT | `/profiles/<id>` | Update profile by id. |
| DELETE | `/profiles/<id>` | Delete profile. |
| GET | `/settings` | The settings object |
| PUT | `/settings` or `/settings/settings` | Merge keys into the settings. Reply: `{"message": "Settings updated successfully"}` |
### Presets — `/presets`
Keys with meaning on the controller (others are stored as they are):
Scoped to **current profile** in session (see above).
| Key | Checked | Meaning |
|-----|---------|---------|
| `ap_enabled` | | Wi-Fi access point (open, SSID = hostname, `192.168.5.1`); default `true`; applies after a restart. Holding the D3 button at boot forces it on |
| `ap_password` | | AP password, 8-63 characters (WPA2); empty (default) is an open network; applies after a restart |
| `bridge` | string under 64 characters | `host:port` (UDP, default port 8766) of led-simulator: every ESP-NOW frame goes there as `dst_mac + packet` instead of over the radio, and frames from it (`src_mac + packet`) count as received. Empty or missing: the radio. Applies after a restart. The host build (`sim-controller/`) always uses a bridge (`LED_SIM_BRIDGE`, default `127.0.0.1:8766`) |
| `hostname` | | mDNS name (`<hostname>.local`, default `led-controller`); applies after a restart |
| `static_ips` | | List of `{ip, netmask?, gw, dns?}` tried in order when the Ethernet link comes up; the first whose gateway answers ARP is used, else DHCP, else `192.168.4.1/24` for a direct PC cable. Applies after a restart |
| `global_brightness` | integer 0–255 | Global factor of each driver's brightness (see Groups). Stored only: the UI pushes each driver its combined value |
| `wifi_channel` | integer 1–11 | Stored for reference. The controller's ESP-NOW channel is set at build time (`make menuconfig`) |
| `audio_simulated_bpm` | clamped to 60–200 | Tempo of the beat clock (default 120) |
| `sequence_switch_wait` | `beat` or `downbeat` | When a newly started sequence takes over from the playing one |
| `audio_beat_phase_ms` | integer 0–500 | Stored for the UI |
| `audio_input_volume` | integer 0–200 | Stored for the UI |
| `current_profile_id` | | Set by profile apply and import |
| `audio_timing` | | Set by `/api/audio/start` and `/stop` |
Defaults filled at boot: `wifi_channel` (the build's ESP-NOW channel) and `global_brightness` (255).
## Profiles — `/profiles`
A profile is `{name, type: "zones", zones: [zone ids], scenes, palette_id}`.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/presets` | Map of preset id → preset object for the current profile only. |
| GET | `/presets/<id>` | One preset, 404 if missing or wrong profile. |
| POST | `/presets` | Create preset; server assigns id and sets `profile_id`. Body fields stored on the preset. Returns `{ "<id>": { ... } }`, 201. |
| PUT | `/presets/<id>` | Update preset (must belong to current profile). |
| DELETE | `/presets/<id>` | Delete preset. |
| POST | `/presets/send` | Push presets to the LED driver over the configured transport (see below). |
| GET | `/profiles` | `{"profiles": {...}, "current_profile_id": "<id>"}` |
| GET | `/profiles/current` | `{"id": "<id>", "profile": {...}}`; 404 when there are no profiles |
| GET | `/profiles/<id>` | One profile (`current` works as an id) |
| POST | `/profiles` | Create. Body: `name` and any other fields; optional `seed_dj_zone`. Reply `{"<id>": profile}`, 201. See below |
| PUT | `/profiles/<id>`, `/profiles/current` | Merge fields |
| POST | `/profiles/<id>/apply` | Make it current. Reply `{"message": "Profile applied", "id": "<id>"}` |
| POST | `/profiles/<id>/clone` | Copy with its own palette, zones and presets (preset references in the zones point at the copies). Body: optional `name`. 201 |
| DELETE | `/profiles/<id>` | Delete it with its presets and sequences, and its zones and palette unless another profile lists them |
| GET | `/profiles/<id>/export` | Profile bundle (see Import and export) |
| POST | `/profiles/import` | Body: `{"bundle": {...}, "name"?, "apply"? (default true)}` or the bundle itself. Reply `{"<id>": profile, "id": "<id>"}`, 201 |
**`POST /presets/send` body:**
A store with no profile gets one at boot, `default`, with the same seed, a starter palette and an empty `default` group that its zone plays to. A new profile gets an empty palette, eight presets (`on`, `off`, `rainbow`, `Colour Cycle`, `transition`, `flicker`, `flame`, `twinkle`) and a zone `default` that lists them and names driver `1`. With `seed_dj_zone` it also gets three `DJ …` presets in a zone `dj` naming driver `dj`.
```json
{
"preset_ids": ["1", "2"],
"save": true,
"default": "1",
"destination_mac": "aabbccddeeff"
}
```
## Presets — `/presets`
- **`preset_ids`** (or **`ids`**): non-empty list of preset ids to include.
- **`save`**: if true, the outgoing message includes `"save": true` so the driver may persist presets (default true).
- **`default`**: optional preset id string; forwarded as top-level `"default"` in the driver message (startup selection on device).
- **`destination_mac`** (or **`to`**): optional 12-character hex MAC for unicast; omitted uses the transport default (e.g. broadcast).
A preset has `name`, `pattern`, `colors` (`#RRGGBB`), `brightness`, `delay`, `n1`–`n8`, `profile_id`, and optionally `auto`, `palette_refs` (palette index per colour slot), `background` / `background_palette_ref`, `mode` (sent as `n6`), `manual_beat_n`, `fade` (0–10000 ms: crossfade from what the strip showed when the preset is selected) and `beat_time` (`true`: the delay and timing parameters of patterns that support it count quarter beats, so the preset follows the tempo). New presets start with every field set and belong to the current profile.
Response on success includes `presets_sent`, `messages_sent` (chunking splits payloads so each JSON string stays ≤ 240 bytes).
Stored preset records can include:
- `colors`: resolved hex colours for editor/display.
- `palette_refs`: optional array of palette indexes parallel to `colors`. If a slot contains an integer index, the colour is linked to the current profile palette at that index.
### Zones — `/zones`
**Animation patterns** (driver patterns, labels in `/patterns`). Each plays once with `auto: false` and holds its end state; with `auto: true` it repeats.
- One-shots: `hit` (flash with attack, hold and decay), `keyframes` (ramp through the colours with easing).
- Field patterns, which span the whole rig using each driver's place from `/devices/layout`: `sweep`, `ripple`, `spin`, `grow`, `field_wave`.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/zones` | `zones` (map of zone id → zone object), `zone_order`, `current_zone_id`, `profile_id` for the session-backed profile. |
| GET | `/zones/current` | Current zone from cookie/session. |
| POST | `/zones` | Create zone; optional JSON `name`, `names`, `presets`; can append to current profile’s zone list. |
| GET | `/zones/<id>` | Zone JSON. |
| PUT | `/zones/<id>` | Update zone. |
| DELETE | `/zones/<id>` | Delete zone; can delete `current` to remove the active zone; updates profile zone list. |
| POST | `/zones/<id>/set-current` | Sets `current_zone` cookie. |
| POST | `/zones/<id>/clone` | Clone zone into current profile. |
| GET | `/presets` | The current profile's presets |
| GET | `/presets/<id>` | One preset (404 for another profile's) |
| POST | `/presets` | Create in the current profile. Reply `{"<id>": preset}`, 201 |
| PUT | `/presets/<id>` | Merge fields |
| DELETE | `/presets/<id>` | Delete |
| POST | `/presets/push` | Send driver messages. Body: `{"sequence": [message, ...]}` or `{"payload": message}`, optional `targets` (MACs: acked unicast to each). Without targets, broadcast. Reply `{"message": "Delivered"}`. See Driver messages |
| POST | `/presets/send` | Send stored presets. Body: `preset_ids` (or `ids`), `save` (default true), `default` (startup preset id), `targets` or `destination_mac`. Reply `{"message": "Presets sent", "presets_sent": n}` |
| GET | `/presets/<id>/export` | Preset bundle |
| POST | `/presets/import` | Body: a preset bundle (or `{"bundle": ...}`). New id in the current profile, 201 |
### Palettes — `/palettes`
## Zones — `/zones`
A zone has `name`, `names` (driver names, the older way to target drivers), `group_ids` (groups it plays to), `presets` (rows of preset ids), `presets_flat`, `default_preset`, `preset_group_ids`, `sequence_ids`, `animation_ids` (animations shown as one-shot tiles), `content_kind` (`presets` or `sequences`) and `brightness` (0–255, the zone slider).
| Method | Path | Description |
|--------|------|-------------|
| GET | `/palettes` | Map of id → colour list. |
| GET | `/zones` | `{"zones": {...all zones}, "zone_order": [current profile's zone ids], "current_zone_id", "profile_id"}` |
| GET | `/zones/current` | `{"zone": {...}, "zone_id": "<id>"}`, or 404 `{"error", "zone": null, "zone_id": null}` |
| GET | `/zones/<id>` | One zone |
| POST | `/zones` | Create (body: `name` required, `names` or `ids`, `group_ids`, `presets`, `content_kind`, ...). Added to the current profile's zone list. 201 |
| PUT | `/zones/<id>` | Merge fields |
| DELETE | `/zones/<id>` | Delete (`current` works as an id) and remove it from every profile. Clears the cookie if it was current |
| POST | `/zones/<id>/set-current` | Set the `current_zone` cookie |
| POST | `/zones/<id>/clone` | Copy into the current profile. Body: optional `name` (default `<name> Copy`). 201 |
| GET | `/zones/<id>/content-fragment` | With `HX-Request`: the zone's tab content (HTML); otherwise the main page |
| POST | `/zones/<id>/play` | Body `{"preset_id", "drivers"?}`: upload the preset to the zone's groups and select it (`drivers: false` skips sending). 404 for an unknown zone or preset |
| POST | `/zones/<id>/stop` | Select `off` on the zone's groups. `{"stopped": bool}` |
| GET | `/zones/engine/status` | Sequence playback status (as `/sequences/status`) |
## Groups — `/groups`
A group lists drivers by MAC (`devices`) and carries `output_brightness` (0–255), driver defaults (`wifi_driver_display_name`, `wifi_driver_num_leds`, `wifi_color_order`, `wifi_startup_mode`) and pattern fields. MACs are normalised to 12 lowercase hex digits. A driver's group membership is every group listing its MAC (see Driver groups), sent to it whenever groups, zones or devices change.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/groups` | Groups visible in the current profile |
| GET | `/groups/<id>` | One group (404 when scoped to another profile) |
| POST | `/groups` | Create with defaults; `profile_scoped: true` ties it to the current profile, `profile_id` may only name the current profile or be null. Reply: the group, 201 |
| PUT | `/groups/<id>` | Merge fields |
| DELETE | `/groups/<id>` | Delete |
| POST | `/groups/<id>/brightness` | Each member gets its combined brightness, saved on the driver. `{"message", "sent", "errors": [{mac, error}]}` |
| POST | `/groups/<id>/driver-config` | Each member gets `device_config` from the group's driver defaults (body fields override for this send). 400 when none is set |
| POST | `/groups/<id>/identify` | All members blink red together for 2 s, then go off. 400 when the group has no devices |
**Combined brightness** for a driver: `round(255 × global/255 × g₁/255 × … × device/255 [× zone/255])`, with one factor per group listing it (`output_brightness`), the device's `output_brightness` and, when given, the zone slider.
## Devices — `/devices`
A device is `{id: MAC, name, type: "led", transport: "espnow" | "wifi", address, default_pattern, zones, output_brightness?}`. ESP-NOW drivers register themselves when they boot (announce) and when they answer a ping. For ESP-NOW devices `address` is the MAC. The controller has no Wi-Fi driver transport: Wi-Fi records are kept, but nothing is sent to them.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/devices` | All devices, each with `connected` (`null` for ESP-NOW, `false` for Wi-Fi) |
| GET | `/devices/<id>` | One device (the id may be written with colons) |
| POST | `/devices` | Create. `name` required; `mac` (or, for ESP-NOW, a MAC in `address`); `transport` `espnow` (default) or `wifi`. Reply `{"<mac>": device}`, 201; 409 for a MAC already registered |
| PUT | `/devices/<id>` | Merge fields. `name` cannot be blank, the MAC cannot change, `output_brightness` 0–255. Changing `name`, `max_brightness`, `num_leds`, `color_order`, `startup_mode` or `reversed` also sends them to the driver as `device_config` |
| DELETE | `/devices/<id>` | Delete |
| GET | `/devices/status` | Per driver: `{"last_ack_ms_ago": ms or -1, "failed_messages": n}` from the acked link |
| POST | `/devices/ping` | Body `{"timeout_s": 0.5–30, "broadcast": bool}` (timeout default 3). Sends the ping as an acked unicast to each known device and collects replies; `"broadcast": true`, or no known devices, broadcasts it instead so new drivers are found: `{"ok", "ping_id", "timeout_s", "responses": {mac: {mac, name, rtt_ms}}, "registered": n}`. Drivers that answer are added or renamed |
| POST | `/devices/layout` | Body `{"placements": {mac: {x0, y0, x1, y1} \| null}, "center"?: {x, y}}`: where each bar sits, in any units with y up, and the rig's centre (kept in `settings.rig_center`; without one, the layout's bounding-box centre). `x0,y0` is LED 1, the data-in end; `null` removes a bar. Saved as the device's `placement`. Then every placed ESP-NOW driver gets `device_config.place`: its ends relative to the centre, scaled so the furthest end is 1 from it. Reply `{"updated", "sent", "failed"}`; 400 without `placements` |
| POST | `/devices/groups` | Send every ESP-NOW driver its groups and wait for the acks: `{"ok", "total", "sent", "failed"}` (503 when any failed, 400 with no ESP-NOW devices) |
| POST | `/devices/resolve-brightness` | Body `{"macs": [...], "zone_brightness"?}` → `{"values": {mac: brightness}}` |
| POST | `/devices/<id>/brightness` | Body `{"zone_brightness"?}`: send the combined brightness, saved on the driver. `{"message", "brightness"}` |
| POST | `/devices/<id>/driver-config` | Body: any of `name`, `num_leds` (1–2048), `color_order`, `startup_mode` (`default`, `last`, `off`) |
| POST | `/devices/<id>/identify` | Red 10 Hz blink for 2 s, then off |
## Sequences — `/sequences`
A sequence is `{name, profile_id, kind?, targets?, lanes: [[step, ...], ...], lane_opts?, lanes_group_ids: [[group ids], ...], group_ids, loop (default true), advance_mode: "beats" | "time", steps, step_duration_ms, sequence_transition}`. Every field marked `?` is optional; a sequence without them plays as it always has.
- `kind`: `"sequence"` (default) or `"animation"`: a clip that is fired once over whatever runs (see Animations). Both are stored here.
- `targets`: the drivers the sequence plays to, in order (up to 32): `[{name, group_ids: [group ids], devices: [MACs]}]`. A target reaches every driver in its groups plus each listed driver (by its own group `d<mac>`, see Driver groups). Lanes and steps name targets by index.
- `lane_opts`: one object per lane (same index as `lanes`):
- `mode`: `"beats"` or `"time"`, overriding `advance_mode` for this lane, so beat lanes and time lanes run side by side.
- `offset`: beats (or seconds, time lanes) before the lane starts, on the first pass only. With a copy of a lane this gives a canon or ripple.
- `rate`: 0.25–4, speed multiplier. A 1-beat step at rate 2 lasts half a beat.
- `targets`: indexes into `targets` the lane plays to. Without them the lane's groups come from the older fields: `lanes_group_ids[lane]`, else `group_ids`, else (single lane) the step's `group_ids`, else the zone's groups.
- `chase`: `{order: "forward" | "reverse" | "bounce" | "random", width (default 1), others: "off" (default) | "hold"}`. Each step moves the lit position along the lane's targets (in the order listed in the lane's `targets`). The step's preset goes to `width` targets from there, and the rest go off or keep what they show.
- A step is `{preset_id, beats (default 1, from 0.25), seconds (default 3, 0.1–3600), targets?, others?, rest?, animation_id?, length?, group_ids?}`:
- `beats` / `seconds`: how long it lasts, by its lane's mode.
- `targets`: indexes of the lane's targets this step lights (default: all of the lane's, or the chase position).
- `others: "off"`: the lane's other targets go off for this step.
- `rest: true`: nothing lit; the lane's targets go off.
- `animation_id`: fire that animation instead of a preset. With `length: "animation"` the step lasts as long as the animation (at the current tempo).
| Method | Path | Description |
|--------|------|-------------|
| GET | `/sequences` | The current profile's sequences |
| GET | `/sequences/<id>` | One sequence |
| POST | `/sequences` | Create in the current profile. A non-empty `steps` without lanes becomes lane 0. Reply `{"<id>": sequence}`, 201 |
| PUT | `/sequences/<id>` | Merge fields; stops it when it is playing |
| DELETE | `/sequences/<id>` | Delete; stops it when it is playing |
| POST | `/sequences/<id>/play` | Body `{"zone_id"}` (required). Reply `{"ok": true, "pending": bool, ...}`. 400 for a missing zone, a sequence without steps or one from another profile |
| POST | `/sequences/stop` | Stop playback (and any animation) and clear the presets on the zone's groups. `{"ok": true}` |
| POST | `/sequences/<id>/fire` | Play it once as an animation over whatever runs. Body `{"zone_id"?, "wait"?: "now" (default) \| "beat" \| "downbeat"}`; without `zone_id`, the playing sequence's zone. Reply `{"ok": true, "wait"}`. 404 for another profile's, 400 without a zone or steps |
| POST | `/sequences/overlay/stop` | End the animation now; its drivers go back (as when it ends). `{"ok": true}` |
| POST | `/sequences/sync-phase` | Body `{"mode": "step" | "pass"}`: `step` restarts the current step's beat count, `pass` restarts the sequence. Also makes this beat bar beat 1. 409 when nothing plays |
| GET | `/sequences/status` | Playback status (below) |
| GET | `/sequences/<id>/export` | Sequence bundle (the sequence and its presets) |
| POST | `/sequences/import` | Body: a sequence bundle. The presets are copied into the current profile and the steps point at the copies. 201 |
**Playback.** One sequence plays at a time, in one zone.
- **Start.** Each lane's first preset is uploaded to the lane's groups and selected, then the lane's other presets are uploaded, and every driver in the zone gets its combined brightness with the zone slider.
- **Advancing.** A time lane moves on when its step's `seconds` are up, whatever the beat. When lane 0 is a time lane, the status has `lane0_step_elapsed_ms` and `lane0_step_duration_ms` and `beat_readout` is empty. A beat lane counts quarter beats (the controller ticks between beats from the last beat interval) towards its step's `beats` ÷ `rate`, then moves on. Each step's preset is uploaded to all of the lane's targets (unless already there), then selected on the targets the step lights.
- **End.** Without `loop` the sequence ends after one pass. Its presets are cleared from the zone's groups, and the readout keeps `n/n`.
- **Switching.** Starting another sequence while one plays waits for the next beat. It waits for the next downbeat only when `sequence_switch_wait` is `downbeat` and the mic is timing. The current sequence holds meanwhile.
- **Animations.** `/sequences/<id>/fire` (or a step's `animation_id`) plays a sequence once in a second player over the running one. An animation loops only with `loop: true`.
- While it plays, the sequence keeps time, but its sends leave out the drivers the animation's lanes reach: groups are split into those drivers' own groups.
- When it ends (or `/sequences/overlay/stop`), those drivers get the sequence's current step again. With no sequence playing they get the zone's last played preset, else off.
- Firing another animation replaces the one playing. Drivers the new one doesn't reach go back.
- A sequence that ends while an animation plays clears the zone once the animation is over.
- **Beat source.** Beats come from the mic's beat detector while audio timing is on (`/api/audio/start`) and it has a tempo lock. Otherwise they come from a clock at `audio_simulated_bpm`, whose beats also go to the drivers. Beats closer than 0.3 s (200 BPM) are dropped.
Status: `{"active": false, "beat_readout": "", overlay}` when idle, else `{active, advance_mode, sequence_id, zone_id, num_lanes, total_sequence_steps, lane0_current_step, lane0_lane_length, lane0_beat_in_step, lane0_beats_per_step, lane0_preset_id, lane0_preset_name, sequence_beat_at, sequence_beats_per_pass, sequence_loop_beat, beat_readout, lanes, overlay}`.
- `lanes`: one entry per playing lane, `{step (0-based), steps, mode, started, done, pos? (chase: the target index lit first), beat_in_step and beats_in_step (beat lanes) or elapsed_ms and duration_ms (time lanes)}`.
- `overlay`: `{active, pending, pending_id?}`, plus `{sequence_id, zone_id, drivers, progress (0–1), lanes}` while an animation plays.
## Audio — `/api/audio`
| Method | Path | Description |
|--------|------|-------------|
| GET | `/api/audio/status` | `{"status": {...}}`, see below |
| GET | `/api/audio/events` | Server-sent events, `data: {"type": "status" | "beat", "status": {...}}`: a status event first, one on every detected beat, and a status heartbeat every 0.5 s |
| POST | `/api/audio/start` | Mic beats time sequences and go to the drivers. Saved. `{"ok": true, "status"}` |
| POST | `/api/audio/stop` | The beat clock times sequences instead; the mic's beats stop going to the drivers. Saved |
| POST | `/api/audio/reset` | Forget the tempo and bar position and track again (409 while stopped) |
| POST | `/api/audio/anchor-bar` | Make the last beat bar beat 1 (409 while stopped) |
| GET | `/api/audio/devices` | The single input: `{"devices": [{"id": "i2s", "name", "display_name", "is_default": true}], "diagnostics": {}}` |
| PUT | `/api/audio/device` | Body `{"device_select"}`: stored only (there is one microphone) |
Status fields: `running` (audio timing on), `bpm` (locked tempo, `null` without a lock, the clock's tempo while stopped), `bpm_simulated`, `beat_seq`, `bar_beat`, `beats_per_bar`, `is_downbeat`, `bar_phase_readout`, `phase_confidence`, `input_level`, `last_beat_ts`, `sequence` (playback status), `sequence_pending`, `beat_readout`, `sequence_switch_wait` (in effect) and `sequence_switch_wait_saved`, `audio_simulated_bpm`, `simulated_beat_tick`, `audio_run`, `beat_phase_ms`, `input_volume`.
The `/audio` page uses its own routes:
| Method | Path | Description |
|--------|------|-------------|
| GET | `/audio.wav` | Live microphone audio (16 kHz mono WAV stream; one listener at a time) |
| GET | `/beats` | Server-sent events: `beat` (`bpm`, `n`, `bar`, `meter`, `sure`, `us`), `onset`, and `tempo` every second |
| POST | `/tap` | The user tapped bar beat 1 now |
| GET | `/time` | Board clock (`{"us": ...}`) for the page to line its clock up with |
## Patterns — `/patterns`
Pattern metadata is the `pattern` collection, keyed by name. Pattern sources are the led-driver `src/patterns/*.py` files built into the firmware, plus uploads (stored on the controller, and they take precedence). `on` and `off` are built into the driver and have no file.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/patterns`, `/patterns/definitions` | Metadata, plus `{}` for every pattern file without metadata |
| GET | `/patterns/<name>` | Metadata record |
| POST | `/patterns` | Body `{name, data: {...}, ...}`: `data` and the other keys become the record under `name`. Reply: the record, 201 |
| PUT, DELETE | `/patterns/<name>` | Merge, delete (the file stays) |
| GET | `/patterns/ota/manifest` | `{"files": [{"name": "x.py", "url": "http://<Host>/patterns/ota/file/x.py"}]}` |
| GET | `/patterns/ota/file/<name>.py` | The source (`text/plain`); 400 for `on`/`off`, 404 when missing |
| POST | `/patterns/upload` | Body `{name, code, overwrite?}`: store a source. 409 when it exists and `overwrite` is false. 201 |
| POST | `/patterns/driver` | Body `{name, code, overwrite?, min_delay?, max_delay?, max_colors?, n1?..n8?}`: store the source and its metadata (`n1`–`n8` are parameter labels). The name must be an identifier. 201 |
| POST | `/devices/<id>/patterns/push` | 400: not supported for ESP-NOW devices |
## Palettes — `/palettes`
A palette is a list of colours.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/palettes` | `{id: [colours]}` |
| GET | `/palettes/<id>` | `{"colors": [...], "id": "<id>"}` |
| POST | `/palettes` | Body may include `colors`. Returns palette object with `id`, 201. |
| PUT | `/palettes/<id>` | Update colours (`name` ignored). |
| DELETE | `/palettes/<id>` | Delete palette. |
| POST | `/palettes` | Body `{"colors"}`. Reply `{"id", "colors"}`, 201 |
| PUT | `/palettes/<id>` | Body `{"colors"}`: replaces the list |
| DELETE | `/palettes/<id>` | Delete |
### Groups — `/groups`
## Scenes — `/scenes`
Plain records: GET (list, one), POST (201), PUT (merge), DELETE. Scenes do not play.
## Outputs — `/outputs`
Network pixel fixtures. An output is `{id, name, protocol: "ddp" | "artnet" | "sacn" | "dmx_serial", host, port, universe, channel, serial_port, dmx_mode, pixel_count, pixel_offset, color_order, reverse, brightness, fps, enabled}` with defaults filled in. The checks:
- `ddp` needs a `host`. `dmx_serial` needs a `serial_port`, and its pixels must fit one DMX universe.
- Number ranges: `port` 1–65535, `universe` 0–32767 (sACN 1–63999), `channel` 1–512, `brightness` 0–255, `fps` 1–120.
- `color_order` is one of `rgb rbg grb gbr brg bgr`.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/groups` | All groups. |
| GET | `/groups/<id>` | One group. |
| POST | `/groups` | Create; optional `name` and fields. |
| PUT | `/groups/<id>` | Update. |
| DELETE | `/groups/<id>` | Delete. |
| GET | `/outputs`, `/outputs/<id>` | List, one |
| POST | `/outputs` | Create (400 with the failed check). Reply: the output, 201 |
| PUT | `/outputs/<id>` | Merge and check again |
| DELETE | `/outputs/<id>` | Delete |
| POST | `/outputs/<id>/test` | Body `{"step_s": 0.1–5}` (default 1): solid red, green, blue and white for `step_s` each at `fps`, then black. `{"message", "status": {name, protocol, kind, pixel_count, frames, packets, bytes, errors, last_error}}`. 503 for `dmx_serial` (no USB-DMX adapter on this board) |
### Scenes — `/scenes`
Zones do not render to outputs: only the test pattern is sent.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/scenes` | All scenes. |
| GET | `/scenes/<id>` | One scene. |
| POST | `/scenes` | Create (body JSON stored on scene). |
| PUT | `/scenes/<id>` | Update. |
| DELETE | `/scenes/<id>` | Delete. |
## WebSocket — `/ws`
### Sequences — `/sequences`
| Method | Path | Description |
|--------|------|-------------|
| GET | `/sequences` | All sequences. |
| GET | `/sequences/<id>` | One sequence. |
| POST | `/sequences` | Create; may use `group_name`, `presets` in body. |
| PUT | `/sequences/<id>` | Update. |
| DELETE | `/sequences/<id>` | Delete. |
### Patterns — `/patterns`
Pattern metadata lives in **`db/pattern.json`**; driver source files live under **`led-driver/src/patterns/`**. Several routes expose a **runtime map** (metadata merged with on-disk `.py` names so new files appear in menus).
| Method | Path | Description |
|--------|------|-------------|
| GET | `/patterns` | Runtime pattern map (object keyed by pattern id). |
| GET | `/patterns/definitions` | Same runtime map (intended for UI “definitions” clients). |
| GET | `/patterns/ota/manifest` | JSON `{"files":[{"name":"blink.py","url":"http://<Host>/patterns/ota/file/blink.py"},...]}` for OTA pulls. Requires **`Host`** header. |
| GET | `/patterns/ota/file/<name>` | Raw **`.py`** source for one driver pattern (`name` must be a safe filename, e.g. `rainbow.py`). |
| POST | `/patterns/<name>/send` | Push a **manifest** JSON line to **Wi-Fi** devices so they pull one pattern file over HTTP. Body may include **`device_id`** to target one device; otherwise all Wi-Fi devices with an **`address`** are tried. **`<name>`** may be with or without `.py`. |
| POST | `/patterns/upload` | Body JSON: **`name`**, **`code`**, optional **`overwrite`** (default true). Writes **`led-driver/src/patterns/<name>.py`**. |
| POST | `/patterns/driver` | Body JSON: **`name`** (identifier), **`code`**, optional metadata (`min_delay`, `max_delay`, `max_colors`, `n1`…`n8`, **`overwrite`**). Creates/updates both the **`.py`** file and **`db/pattern.json`** via the Pattern model. |
| GET | `/patterns/<id>` | One pattern record from the Pattern model (metadata only). |
| POST | `/patterns` | Create (`name`, optional `data`). |
| PUT | `/patterns/<id>` | Update. |
| DELETE | `/patterns/<id>` | Delete. |
**Devices — pattern OTA push**
| Method | Path | Description |
|--------|------|-------------|
| POST | `/devices/<id>/patterns/push` | Wi-Fi only. Asks the driver at **`address`** to pull pattern files from this server. Optional body **`manifest`**: either a **URL string** pointing at a manifest JSON document, or a **manifest object** (same shape as in driver messages). If omitted, a default manifest is built from the request **`Host`** header. |
On connect the controller sends `{"type": "device_tcp_snapshot", "connected_ips": []}` (there are no Wi-Fi driver sessions). Each text frame is a driver message (JSON object), sent as `/presets/push` would send it: an optional `to` (MAC) addresses one driver, otherwise it is broadcast. A frame that is not a JSON object, or a failed send, gets `{"error": ...}` back. A plain GET gets 426.
---
## LED driver message format (transport / ESP-NOW / Wi-Fi)
## Driver messages
Messages are JSON objects. The Pi **`build_message()`** helper (`src/util/espnow_message.py`) produces the same shape sent over serial and forwarded by the ESP32 bridge, and the same logical object can be sent as a **single JSON text message** to a Wi-Fi driver over the **WebSocket**.
The UI, `/presets/push`, `/ws` and the controller itself send drivers **v1 messages**: JSON objects with `"v": "1"`. The controller does not send them as they are:
- **Binary envelope.** A message that only carries presets, a select, brightness, `save` and `groups` goes out as a compact binary envelope (`main/envelope.c`, mirrored by `test/binary_envelope.py`).
- Version 2 is the usual frame.
- A frame whose presets use `fade` or `beat_time` is version 3: each preset record is followed by `[ext_len][key, len, value]…`, with key 1 the fade ms (u16) and key 2 the beat timing (u8).
- Drivers skip keys they don't know. Drivers without v3 support ignore v3 frames, so they miss only presets that use the new fields.
- **JSON.** Any other message goes as JSON with short keys, split across several messages when it does not fit one ESP-NOW frame. A preset with a background colour (`bg`) is one of these: the envelope has no field for it.
- **Delivery.** Broadcasts are never acked (envelopes go out twice, JSON once); drivers that miss a state change notice from the state digest and ask to be brought up to date. Messages with `targets` are unicast to each MAC, acked and retried.
### Top-level fields
### Fields
| Long key | Short | Meaning |
|----------|-------|---------|
| `presets` | `p` | Map of preset id → preset |
| `select` | `s` | `["preset_id"]` or `["preset_id", step]` for every driver addressed; or a map of driver name → that list |
| `groups` | `g` | Only drivers in one of these groups apply the message |
| `set_groups` | `sg` | With `groups`: replace the driver's group list |
| `save` | `sv` | Persist presets, brightness or config on the driver |
| `default` | `df` | Startup preset id |
| `device_config` | `dc` | `name`, `num_leds`, `color_order`, `startup_mode`, `max_brightness`, `reversed`, `place` ([x0, y0, x1, y1] in rig coordinates, see `/devices/layout`; `null` clears it), `usb_log` (per-beat USB log; on reboot). Drivers print nothing over USB unless their `debug` or `usb_log` setting is on: on the ESP32-C3, unread USB output blocks the driver |
| `clear_presets` | `cp` | Drop stored presets |
| `manifest` | `mf` | Pattern files to fetch (Wi-Fi drivers) |
| `b` | | Driver brightness 0–255 |
Preset fields: `p`/`pattern`, `c`/`colors` (`#RRGGBB`), `d`/`delay` (ms, default 100), `b`/`brightness` (0–255), `a`/`auto` (`true` runs freely, `false` steps once per beat), `bg`/`background`, `n1`–`n6` (pattern parameters; `n5` is reverse, `n6` the style mode), `f`/`fade`, `tb`/`beat_time`. Other fields (`name`, `manual_beat_n`, …) are dropped on the way out.
Sending `select` again with the same preset is a beat for that preset. Selecting `off` resets the step, so the next select starts every driver at step 0 unless a step is given.
### Driver groups
A driver keeps a list of group ids and applies a group command (or a message with `groups`) only when it holds one of them. The controller sends each ESP-NOW driver its list whenever groups, zones or devices change, when the driver boots, and when it asks to be brought up to date. A driver that has failed three messages in a row gets these updates at most every 30 s until it answers again. The list holds:
- every group (`group` collection) whose `devices` lists the driver's MAC, by group id;
- `z<zone id>` for every zone whose `names` lists the driver's name (zones from before groups);
- its own group `d<mac>` (12 lowercase hex digits), always first, so a sequence target can name a single driver. It doesn't change any other membership.
A zone plays to its `group_ids` and, when it names drivers, to `z<zone id>`. A message with `groups` that fits the envelope goes out as one group command per group.
### Example
```json
{
"v": "1",
"presets": { },
"select": { },
"save": true,
"default": "preset_id",
"b": 255
}
```
- **`v`** (required): Must be `"1"` or the driver ignores the message.
- **`presets`**: Map of **preset id** (string) → preset object (see below). Optional **`name`** field on each value is accepted for display; the driver keys presets by map key.
- **`select`**: Map of **device name** (as in device settings) → `[ "preset_id" ]` or `[ "preset_id", step ]`.
- **`save`**: If present (e.g. true), the driver may persist presets to flash after applying.
- **`default`**: Preset id string to use as startup default on the device.
- **`b`**: Optional **global** brightness 0–255 (driver applies this in addition to per-preset brightness).
### Preset object (wire / driver keys)
On the wire, presets use **short keys** (saves space in the ≤240-byte chunks):
| Key | Meaning | Notes |
|-----|---------|--------|
| `p` | Pattern id | `off`, `on`, `blink`, `rainbow`, `pulse`, `transition`, `chase`, `circle` |
| `c` | Colours | Array of `"#RRGGBB"` hex strings; converted to RGB on device |
| `d` | Delay ms | Default 100 |
| `b` | Preset brightness | 0–255; combined with global `b` on the device |
| `a` | Auto | `true`: run continuously; `false`: one step/cycle per “beat” |
| `n1`–`n6` | Pattern parameters | See below |
The HTTP app’s **`POST /presets/send`** path builds this from stored presets via **`build_preset_dict()`** (long names like `pattern` / `colors` in the DB are translated to `p` / `c` / …).
### Pattern-specific parameters (`n1`–`n6`)
#### Rainbow
- **`n1`**: Step increment on the colour wheel per update (default 1).
#### Pulse
- **`n1`**: Attack (fade in) ms
- **`n2`**: Hold ms
- **`n3`**: Decay (fade out) ms
- **`d`**: Off time between pulses ms
#### Transition
- **`d`**: Transition duration ms
#### Chase
- **`n1`**: LEDs with first colour
- **`n2`**: LEDs with second colour
- **`n3`**: Movement on even steps (may be negative)
- **`n4`**: Movement on odd steps (may be negative)
#### Circle
- **`n1`**: Head speed (LEDs/s)
- **`n2`**: Max length
- **`n3`**: Tail speed (LEDs/s)
- **`n4`**: Min length
### Select messages
```json
{
"select": {
"device_name": ["preset_id"],
"other_device": ["preset_id", 10]
}
}
```
- One element: select preset; step behavior follows driver rules (reset on `off`, etc.).
- Two elements: explicit **step** for sync.
### Beat and sync behavior
- Sending **`select`** again with the **same** preset name acts as a **beat** (advances manual patterns / restarts generators per driver logic).
- Choosing **`off`** resets step as a sync point; then selecting a pattern aligns step 0 across devices unless a step is passed explicitly.
### Example (compact preset map)
```json
{
"v": "1",
"save": true,
"presets": {
"1": {
"name": "Red blink",
"p": "blink",
"c": ["#FF0000"],
"d": 200,
"b": 255,
"a": true,
"n1": 0, "n2": 0, "n3": 0, "n4": 0, "n5": 0, "n6": 0
}
"12": {"pattern": "chase", "colors": ["#ff0000", "#0000ff"], "delay": 80, "brightness": 255, "auto": true, "n1": 4, "n2": 4}
},
"select": {
"living-room": ["1"]
}
"select": ["12"],
"groups": ["3"],
"save": true
}
```
---
## Processing summary (driver)
1. Reject if `v != "1"`.
2. Apply optional top-level **`b`** (global brightness).
3. For each entry in **`presets`**, normalize colours and upsert preset by id.
4. If this device’s **`name`** appears in **`select`**, run selection (optional step).
5. If **`default`** is set, store startup preset id.
6. If **`save`** is set, persist presets.
---
## Error handling (HTTP)
Controllers typically return JSON with an **`error`** string and 4xx/5xx status codes. Invalid JSON bodies often yield `{"error": "Invalid JSON"}`.
---
## Notes
- **Human-readable preset fields** (`pattern`, `colors`, `delay`, …) are fine in the **web app / database**; the **send path** converts them to **`p` / `c` / `d`** for the driver.
- For a copy of the older long-key reference, see **`led-driver/docs/API.md`** in this repo (conceptually the same behavior; wire format prefers short keys).
Pattern parameters are documented in the led-driver repository.
+295
View File
@@ -0,0 +1,295 @@
# Bench test: one S3 controller and one LED driver
This walks one ESP32-S3 controller (W5500 Ethernet, INMP441 mic) and one `led-driver` unit through flashing, a smoke test, a lossy-link test and a beat latency measurement. Nothing here has been run on hardware yet, so treat the expected numbers as targets to check, not results.
## 0. What you need
- Controller: XIAO ESP32-S3 with a W5500 module wired as in `main/Kconfig.projbuild` (SCLK 7, MISO 8, MOSI 9, CS 2, INT 3, RST 1), Ethernet cable to a DHCP network. The mic is optional for this test; the bench generator makes its own beats.
- Driver: one `led-driver` unit (MicroPython, the `p2p` ESP-NOW branch) with a few LEDs. It needs no Wi-Fi network.
- A PC on the same network. Docker with `espressif/idf:v6.1` for building.
- For the true latency measurement: a logic analyzer or scope with two channels and a common ground. Optional: the software echo numbers need nothing extra.
**Channel rule.** ESP-NOW only works when both radios use the same channel. The p2p driver uses its `wifi_channel` setting (default 5); the controller's default is now 5 as well (`CONFIG_ESPNOW_CHANNEL` in `sdkconfig.defaults`). If your driver uses another channel, change the controller before building:
```bash
docker run --rm -v "$PWD":/project -w /project espressif/idf:v6.1 idf.py menuconfig
```
then *ESP-NOW config → Wi-Fi channel*. Alternatively set `CONFIG_ESPNOW_CHANNEL=<n>` in `sdkconfig.defaults` (delete `sdkconfig` after, so it is regenerated). To use the beat marker pin, also set `CONFIG_BEAT_TEST_GPIO` (for example 44) in the same menu.
## 1. Build and flash the controller
The repository root has a Makefile that wraps all of this: `make build`, `make flash`, `make monitor` (Ctrl-] to quit), `make log` (console for 10 s, no terminal needed), `make test`, and `make help` for the rest; `PORT=/dev/ttyACM1` selects another port. The manual commands below do the same thing.
```bash
tools/build_web.sh
docker run --rm -v "$PWD":/project -w /project espressif/idf:v6.1 idf.py build
```
Expect `Project build complete`, the app well under its 2 MB slot, with the web UI embedded (`www_dist/www.pack`). Fix ownership if Docker left it root-owned: `docker run --rm -v "$PWD":/project espressif/idf:v6.1 chown -R 0:0 /project`.
Flash with the S3 on USB (check which port it is; `ls /dev/ttyACM*`):
```bash
docker run --rm --device=/dev/ttyACM0 -v "$PWD":/project -w /project espressif/idf:v6.1 idf.py -p /dev/ttyACM0 flash
```
This writes the bootloader, partition table and app (the web UI is part of the app). Watch the log:
```bash
docker run --rm -it --device=/dev/ttyACM0 -v "$PWD":/project -w /project espressif/idf:v6.1 idf.py -p /dev/ttyACM0 monitor
```
Look for, in order: `store: ... records` lines, `espnow_tx: ESP-NOW up on channel N`, `rel: reliable link up`, `Ethernet Link Up`, `Got IP: x.x.x.x`, `HTTP server started`.
## 2. First checks (replace `$S3` with the IP)
```bash
export S3=192.168.1.50
curl -s http://$S3/status
```
Expect JSON with `uptime_s`, `reset_reason` (why the board last restarted, such as `panic`, `task_watchdog` or `brownout`; opening the USB serial port resets the board and replaces it with `usb`, so read it first), `bpm`, an `espnow` block and a `link` block (`ver` nonzero, `digests` increasing by one about every 1.5 s). If the mic hears music, `bpm` and `beats_sent` move too, which means beats are already being broadcast. Open `http://$S3/` in a browser: the UI should load, and the dev tools network tab should show `Content-Encoding: gzip` on `/static/*.js`.
```bash
curl -s -D - -o /dev/null -H 'Accept-Encoding: gzip' http://$S3/static/presets.js | grep -i -E 'content-encoding|content-type'
```
**Audio and beats.** `http://$S3/audio` is the mic page: live levels, tempo and bar position, a tap button to correct beat 1, and a Listen button for the 16 kHz mono stream. The underlying endpoints are `/audio.wav` (one listener at a time), `/beats` (server-sent events: `beat`, `onset`, `tempo`), `POST /tap` and `/time`. `/status` carries the mic levels (`mic_rms_dbfs`, `mic_spl_db`) and the beat state (`bpm`, `beat_locked`, `meter`, `bar_beat`, `bar_sure`).
## 3. Load data and add a test zone
Import the Pi database (the files hold your real zones and presets, so use a copy if you want a smaller test):
```bash
for n in device zone preset profile palette pattern sequence scene; do
curl -s -X PUT --data-binary @../db/$n.json http://$S3/db/$n; echo " $n"
done
```
The driver registers itself: it broadcasts a hello at boot, the controller adds it to the device list under its MAC and sends it its group list. Check with `curl -s http://$S3/devices/<mac>` once the driver is running (step 4). Zones are the drivers' groups: a zone's `names` must contain the driver's **name** exactly (`led-<mac>` by default, see its `settings.json`).
```bash
curl -s -X POST -d '{"name":"bench","names":["led-aabbccddeeff"]}' http://$S3/zones
curl -s -X POST -d '{"name":"bench red","pattern":"on","colors":["#ff0000"],"delay":100,"brightness":255,"auto":true}' http://$S3/presets
```
Note the returned ids (`<zone>` and `<preset>` below). Creating or changing a zone re-sends group lists to every registered ESP-NOW driver.
## 4. Prepare the driver
The driver runs the `p2p` branch of `led-driver` plus these files from this work: `src/beat_sync.py`, `src/espnow_rx.py`, and changed `src/main.py` and `src/presets.py`. Back up the device's own copies first (`mpremote fs cp :main.py ./main.py.bak`), then copy the new ones (`mpremote fs cp src/main.py :main.py` and so on) and reset.
Optional keys in the driver's `settings.json` for the later tests:
| key | value | meaning |
|---|---|---|
| `bench` | `true` | echo every fired beat to the controller and print stats every 50 beats |
| `beat_pin` | e.g. `5` | GPIO toggled on every fired beat, for the logic analyzer |
| `espnow_loss` | `0` | percent of received frames the driver discards (set later) |
After boot, the controller's `/devices` list should contain the driver's MAC and `/status` should show `link.acked` rising (the group list was acknowledged). `mpremote` interrupts the running program, so reset the driver after using it.
## 5. Smoke test
```bash
curl -s -X POST -d '{"preset_id":"<preset>"}' http://$S3/zones/<zone>/play
```
The driver's console should log the preset and select it received (once each, although the controller sends every state frame twice), and the LEDs should go red within a fraction of a second. Then:
```bash
curl -s -X POST http://$S3/zones/<zone>/stop # LEDs off
curl -s http://$S3/devices/status # last_ack_ms_ago / failed_messages per registered driver
```
Zone play is a group broadcast, so `devices/status` only changes for acked (unicast) traffic. Trigger one with a targeted push:
```bash
curl -s -X POST -d '{"sequence":[{"v":"1","select":{"led-aabbccddeeff":["<preset>"]}}],"targets":["aabbccddeeff"]}' http://$S3/presets/push
curl -s http://$S3/devices/status
```
Expected: `last_ack_ms_ago` is small (tens of ms) and `failed_messages` is 0. `/status` shows `link.acked` increased.
## 6. Lossy-link test
The loss mode discards a percentage of frames before the radio on the controller (all outgoing frames, and incoming acks and echoes). The driver can discard received frames too. This makes the retry, fragment and resync layers do real work without moving antennas.
```bash
# controller: 40% loss, beats included
curl -s -X POST -d '{"percent":40,"beats":true}' http://$S3/test/loss
curl -s http://$S3/status # sim_dropped counts dropped frames
```
Run these and compare with the table:
| test | how | expected |
|---|---|---|
| Acked unicast under loss | repeat the targeted push from step 5 twenty times at 40% (give each a different select step so you can tell them apart on the driver console) | all reach the driver; `link.retransmits` rises. A message needs its data and its ack to both survive, and there are 5 sends in total, so about 1 in 10 is reported as timed out even though the driver usually has it |
| Give up and report | set `percent` to 100, push once, wait 2 s | `link.ack_timeouts` +1 and `devices/status` shows `failed_messages: 1` |
| Lost broadcast, digest recovery | `percent` 100, play a different preset on the zone, then set `percent` 0 | the LEDs do not change at first, then within about 1.5 to 5 s the driver sends a resync and shows the new preset; `link.resyncs` +1 |
| Driver-side loss | set `"espnow_loss": 40` in the driver's `settings.json` (restore it afterwards), controller loss 0, push twenty times | every push is processed once on the driver (retransmissions are de-duplicated); `link.retransmits` rises. Lost acks are covered by the controller-side loss rows above, because that setting also drops incoming acks |
| Multi-message send | `POST /presets/send` with 10+ preset ids, `save: false` and `targets` | the controller packs the presets into a few binary messages (14 presets took 2); all arrive under loss, with retransmits. `save: true` makes the driver write its `presets.json`, so restore that file afterwards. Frame-level fragmentation exists in the link but nothing in the current API produces a message over one frame, so it is only covered by the driver's unit tests |
Set loss back to 0 when done: `curl -s -X POST -d '{"percent":0}' http://$S3/test/loss`.
Reading the numbers: the controller drops a reply with the same probability as a request, so under loss an unicast message needs both the data and the ack to survive. Resync requests are also subject to loss and to the driver's 3 s minimum gap, so recovery may take a few digests.
### Results of the first run (S3 to one p2p driver, channel 5)
| test | result |
|---|---|
| 20 acked pushes, controller loss 40% | 20 of 20 reached the driver; 19 acked, 1 reported timed out (its ack was lost); 19 retransmits; 34 frames dropped by the test mode |
| 1 push, loss 100% | gave up after 2.0 s with 4 retransmits; `failed_messages` 1; driver heard nothing |
| zone play during a 100% outage, then loss back to 0 | driver was untouched during the outage; 1.5 s after the link returned it received its groups, the preset and the select, one resync, and the new state |
| 20 acked pushes, driver-side loss 40% | 20 of 20 processed exactly once; 14 retransmits; 0 timeouts |
| `/presets/send` of 14 presets at driver loss 40% | 2 messages (209 and 217 bytes), both acked, 1 retransmit |
## 7. Beat latency and delivery
### Software numbers (no equipment)
Start synthetic beats with the driver in `bench` mode:
```bash
curl -s -X POST -d '{"bpm":120,"count":200}' http://$S3/test/beats
sleep 105
curl -s http://$S3/test/beats
```
Results include:
- `beats_sent`, `echoes` and `hit_pct_total`: the share of beats each driver fired on and reported. With no loss expect 100%.
- `rtt_minus_lead_min/avg/max_us`: time from the first beat copy going out to the driver's echo coming back, minus the 30 ms the driver deliberately waits (`CONFIG_BEAT_LEAD_MS`). This is out-airtime plus the driver's MicroPython work plus return airtime, so it overstates one-way delay. Expect roughly 2 to 15 ms; the maximum shows the worst case you will see on the LEDs.
- `spread_avg_us` and `spread_max_us`: only meaningful with two or more drivers; shows how far apart they fire for the same beat.
On the driver's serial console every 50 beats you get the true driver-side counts, for example `beat {'fires': 100, 'dups': 100, 'late': 0, 'freerun': 0}`:
- `fires`: beats it acted on.
- `dups`: second copies dropped (with the double send this should be close to `fires`).
- `freerun`: beats it generated itself because both copies were missed. Zero without loss.
- `late`: frames rejected as too soon or old.
### Delivery under loss
Repeat the run with loss on:
```bash
curl -s -X POST -d '{"percent":30,"beats":true}' http://$S3/test/loss
curl -s -X POST -d '{"bpm":120,"count":200}' http://$S3/test/beats
```
Judge delivery from the driver's own `fires` and `freerun` counts: with two copies the chance of missing both is about 9% at 30% loss, and the free-run covers those, so `fires` should stay near `beats_sent` with `freerun` around 9% of it. The controller's `hit_pct_total` is lower because echoes are dropped by the same loss setting; it is a lower bound, roughly `(1 - loss) × delivery`.
### Latency over USB (no extra equipment)
Both boards are on USB, so the PC can timestamp one event line from each and compare them. Settings already applied for this: the driver has `"usb_log": true` in `settings.json`. The controller prints `BT <beat> <microseconds>` for every synthetic beat; the driver prints `FIRE <beat> <ticks_us>` when it fires.
```bash
python3 tools/usb_latency.py --ctrl-port /dev/ttyACM0 --drv-port /dev/ttyACM1 --url http://$S3 --beats 200
```
The script starts the generator, reads both ports, and maps each board's clock onto the PC's by using the fastest USB deliveries per 5 s window (this also removes crystal drift). USB serial delivers in bursts, so single lines arrive up to about 50 ms late; the fastest ones are close to on time, which is what the mapping relies on. The remaining error is the difference between the two ports' fastest delivery, roughly 1 ms, so read results to about a millisecond. The script prints the delivery jitter so you can see how noisy the ports were. The driver's `FIRE` time is when the beat triggers the pattern step; the LED data follows within the same loop pass, and a 119-LED strip takes about 3.6 ms to clock out.
Close any serial monitor first (only one program can hold a port). Do not run long `mpremote exec` commands on the driver during the capture (see Troubleshooting).
### True latency with a logic analyzer
For a measurement that does not depend on USB. Marker pins are set up already: the controller toggles **GPIO44 (D7)** when the first copy of each beat goes out (`CONFIG_BEAT_TEST_GPIO=44`, in `sdkconfig.defaults`) and the driver toggles **GPIO44 (D7)** when it fires (`"beat_pin": 44` in its `settings.json`). Both are XIAO ESP32S3 boards, where D7 is free.
Wiring (3.3 V logic, any 2 or 3 channel analyzer):
| analyzer | connect to |
|---|---|
| GND | GND on the controller **and** GND on the driver (one common ground) |
| channel 0 | controller **D7** |
| channel 1 | driver **D7** |
| channel 2 (optional) | driver **D10** (GPIO9, the LED data line) to see when the LEDs really update |
Steps:
1. Make sure the driver runs a preset that changes on every beat if you use channel 2, for example a `chase` preset with `auto` off, selected on the zone. With the plain `on` preset the LED data line stays quiet.
2. Start a capture: sample rate at least 1 MS/s, length at least 60 s (edges only; it stays small), trigger on any edge of channel 0.
3. Start the beats: `curl -s -X POST -d '{"bpm":120,"count":100}' http://$S3/test/beats`. Both markers toggle on every beat, so you will see edges 500 ms apart.
4. Stop the capture when the generator finishes (about 52 s) and export the digital data as CSV (time in seconds, one column per channel).
5. Analyze: `python3 tools/analyze_edges.py capture.csv --ctrl 0 --drv 1 --time-unit s`. Use `--lead-ms` if you changed `CONFIG_BEAT_LEAD_MS`. It pairs each controller edge with the next driver edge and prints the delay beyond the 30 ms lead, with min, mean, median, p95, max and jitter, plus the count of unmatched beats. On the scope, channel 2 shows the true light delay: the first data burst after the driver edge.
Targets from the plan: under about 10 ms from the controller edge to the driver edge (after subtracting the lead).
Return to normal use by deleting `beat_pin` and `usb_log` from the driver's `settings.json` and setting `CONFIG_BEAT_TEST_GPIO=-1` (the marker pin otherwise toggles on every beat, including live mic beats).
### Results of the first run (software numbers, one driver, channel 5)
Synthetic beats at 120 BPM, 160 beats per run, mic beats muted while the generator runs, driver in `bench` mode.
| | no loss | 30% loss (beats included) |
|---|---|---|
| beats the driver acted on, per beat sent | 1.00 | 1.00 |
| beats the driver invented itself (free-run) | 0% | 11% (theory for two independent copies: 9%) |
| second copies dropped as duplicates | 100% | 47% (theory: 49%) |
| echoes the controller received | 162 of 162 | 96 of 161 (echoes are lost at 30% too, and invented beats do not echo) |
| round trip minus the 30 ms lead, min / avg / max | 9.8 / 15.0 / 25.7 ms | 3.4 / 16.2 / 26.0 ms |
Reading it: the double send plus free-run gave the driver a beat every time, even with 30% of frames lost. The round-trip figure includes the driver's loop and the echo's trip back, so it is an upper bound on the delay the LEDs see; it is not the controller-to-LED latency. The USB and logic analyzer measurements below give the real figure.
Latency over USB (200 beats at 120 BPM, one driver, 119 LEDs): delay beyond the 30 ms lead min 0.49, mean 2.07, median 1.77, p95 4.41, max 7.95 ms (std 1.3 ms; accuracy about 1 ms). 197 of 200 beats matched. Both clocks drifted by 60 to 80 ppm against the PC, and individual USB lines arrived up to 54 ms late, which is why the script uses the fastest deliveries. This is the time from the controller sending a beat to the driver firing, beyond the built-in lead. The logic analyzer run has not been done.
### ESP32-C3 driver compared with the S3 driver
Driver: XIAO ESP32-C3 (MAC 58:8c:81:a3:74:58), MicroPython v1.22.1 stock (no ws2812-dma patch), 160 MHz, about 128 KB free heap, 119 LEDs on pin 10. Same tests as above, same controller.
| | S3 driver, no loss | C3 driver, no loss |
|---|---|---|
| echoes the controller received | 162 of 162 | 160 of 160 |
| round trip minus the 30 ms lead, min / avg / max | 9.8 / 15.0 / 25.7 ms | 2.6 / 4.5 / 17.8 ms |
C3 with 30% loss (160 beats): every beat produced exactly one pattern step, 15 of the 160 (9%, theory 9%) came from free-run, and 68 second copies were dropped as duplicates; the controller got 99 of 160 echoes. That matches the S3 result in the table above.
Reading the free-run counter: after the generator stops, the driver keeps stepping for up to 4 more beats on its last period. A stats window that runs past the end of the test therefore shows 4 extra "free-run" fires even with no loss. They are not missed beats. (My first read of the C3's no-loss run said otherwise; that was wrong.)
Latency over USB, same settings on both boards (`usb_log` only), 200 beats at 120 BPM, delay beyond the 30 ms lead, accuracy about 1 ms:
| | matched | min | mean | median | p95 | max | std |
|---|---|---|---|---|---|---|---|
| S3 driver (240 MHz) | 200 / 200 | -2.4 | 2.15 | 2.03 | 6.03 | 12.3 | 2.5 ms |
| C3 driver (160 MHz) | 200 / 200 | 0.2 | 3.36 | 3.06 | 7.47 | 19.7 | 2.3 ms |
The C3 is about 1.2 ms slower on average and has a longer tail (maximum 19.7 ms against 12.3 ms). With the method's 1 ms accuracy, the mean difference is small and the tail difference is the more telling one. Both are well inside a 120 BPM beat. The echo round trip disagrees with this (S3 15 ms mean, C3 4.5 ms). The S3 echo runs had `usb_log` and a marker pin switched on and the C3 runs did not, and I did not rerun the S3 echo test with identical settings, so treat the echo figures as unexplained and prefer the USB ones.
Pattern frame rate (strip writes per second, 119 LEDs, delay 1 ms, 2 s each; only patterns that wrote anything are shown):
| pattern | C3 (160 MHz, 115 KB free) | S3 (240 MHz, 8 MB free) |
|---|---|---|
| flame | 22 | 33 |
| palette_morph | 21 | 32 |
| circle | 150 | 170 |
The CPU-heavy patterns run about 1.5 times faster on the S3, which is the clock ratio; a light pattern is limited by the strip write and differs by about 13%. `aurora` and `chase` wrote nothing with the parameters I used, so they are not measured.
Groups: the controller sends a driver its group list when the driver announces itself, but now only if the driver is in at least one zone. A driver in no zone keeps the groups it already has (an empty list from the controller used to wipe them). An explicit zone or device edit still re-sends every list, including empty ones.
**Wi-Fi start-up order on the C3.** With the extra link code loaded before Wi-Fi start-up, the C3 failed with `Wifi Unknown Error 0x0101` on about every other cold boot (2 of 4). Starting ESP-NOW before the pattern library and the LED driver claim memory fixed it (6 of 6 boots). `led-driver/src/main.py` now does this.
## 8. Troubleshooting
- **A board on a USB-serial/JTAG port (C3, and the S3 controller) resets whenever a program opens its port,** and a C3 can land in ROM download mode (`wait usb download`). The old apt `mpremote` 0.4.0 hangs on this. Use the newer one in `~/projects/micropython/micropython/tools/mpremote/mpremote.py`, or `led-tool`, and note that `fs cp -r` fails on drivers that print timestamps (copy named files instead).
- **Only one program can use a board's serial port at a time.** A serial logger left running while `led-cli` uploads corrupts the transfer silently: `led-cli` reports the files uploaded, but the old ones stay on the driver.
- **Running a long `mpremote exec` on the driver resets it:** the driver's watchdog (10 s) keeps running after `mpremote` interrupts `main.py`, so keep REPL experiments under about 8 s and reset the driver afterwards.
- **Driver never reacts, no acks:** channel mismatch. Check `CONFIG_ESPNOW_CHANNEL` against the driver's `wifi_channel`. Neighbouring channels can still work at bench range, so a working link does not prove they match.
- **Zone play logs nothing on the driver:** the driver is not in the zone's group (silent). Check the zone's `names` against the driver's `name`.
- **Devices show `last_ack_ms_ago: -1`:** the device record has no usable 12-character MAC in `address` or as its key.
- **`beats_sent` rises but `echoes` stays 0:** the driver is not in `bench` mode, or it has not yet heard a controller frame (it learns the controller's MAC from the first data or digest frame; wait a few seconds).
- **Resync never triggers:** the driver ignores a digest equal to its own version; confirm with `/status` that `link.ver` changed after the missed play.
- **Web UI is blank:** the web UI was not packed before the build; run `tools/build_web.sh` and build again (`make build` does this).
## 9. Cleanup
```bash
curl -s -X POST -d '{"percent":0}' http://$S3/test/loss
curl -s -X POST http://$S3/test/beats/stop
```
Set the driver's `bench` and `espnow_loss` back to off for normal use.
+42 -7
View File
@@ -1,13 +1,14 @@
# LED Driver System - Specification Document
**Version:** 1.0
**Date:** December 2025
**Version:** 1.1
**Date:** October 2026
**Status:** Draft
## Table of Contents
1. [Overview](#overview)
2. [System Architecture](#system-architecture)
- [Raspberry Pi Controller and Animation Engine](#raspberry-pi-controller-and-animation-engine)
3. [User Interface Specifications](#user-interface-specifications)
4. [Feature Specifications](#feature-specifications)
5. [Preset System](#preset-system)
@@ -54,6 +55,11 @@ The LED Driver system is a MicroPython-based application for controlling LED str
- Persistent settings storage (usqlite database)
- Web-based configuration interface (Microdot web server)
- SQLite database for presets and event logging
- **Raspberry Pi controller** (`src/`): Microdot web app with JSON-file storage (`db/*.json`) managing profiles, zones, presets, palettes, scenes, sequences and outputs
- **Pi-side animation engine** (`src/engine/`): renders the unchanged driver patterns on the Pi and streams pixels over DDP, Art-Net, sACN (E1.31) or USB-DMX
- **Preset sequencer**: timed preset chains per zone, resumed after restart
- Server-wide global brightness (0-255) pushed to drivers, including on Wi-Fi reconnect
- Search filter in the Devices, Zones and Presets lists
---
@@ -225,6 +231,29 @@ The LED Driver system uses a master/slave architecture where one device acts as
---
## Raspberry Pi Controller and Animation Engine
The current deployment adds a Raspberry Pi running the web app (`src/main.py`, Microdot on CPython). It is the authoritative store and UI host; ESP32 firmware is unchanged. Full route detail is in `docs/API.md`.
**Outbound paths**
- Serial → ESP-NOW bridge (JSON lines over UART).
- Wi-Fi drivers: TCP JSON lines (port 8765 on the Pi; drivers discover the Pi via UDP 8766 broadcast).
- Pixel outputs rendered by the Pi engine (below).
**Data model (`db/*.json`):** profile, zone, preset, palette, pattern, device, scene, sequence, output. A zone's `names` list holds ESP32 device names and/or output names.
### Animation Engine (`src/engine/`)
- **Pixel generator:** loads `led-driver/src/patterns/*.py` unmodified under CPython (`utime` shim plus a NeoPixel-like buffer) and runs one render thread per zone from the same preset JSON the drivers receive. Static frames are re-sent as keepalive.
- **Output drivers:** DDP (UDP 4048), Art-Net (ArtDMX/ArtSync, UDP 6454), sACN/E1.31 (UDP 5568, multicast or unicast), USB-DMX (Enttec DMX USB Pro or Open DMX). 170 RGB pixels per universe, consecutive universes for longer strips. A preset output for our ESP32 drivers (`outputs/driver.py`) reuses the existing preset + `select` path.
- **Output record** (`db/output.json`): `name`, `protocol`, `host`, `port`, `universe`, `serial_port`, `dmx_mode`, `channel`, `pixel_count`, `pixel_offset`, `color_order`, `reverse`, `brightness` (0-255, multiplied by global brightness), `fps` (default 40), `enabled`. CRUD and a test pattern (R, G, B, W, off) at `/outputs`.
- **Zone playback:** `POST /zones/<id>/play` renders a preset on every target and sends `select` to ESP32 drivers; `POST /zones/<id>/stop` blanks pixel outputs. `GET /zones/engine/status` reports per-zone and per-output counters.
- **Sequencer:** a sequence is `{name, zone_id, loop, repeat_count, steps: [{preset_id, duration_s}], active}`. `duration_s` is clamped to 0.5-600 s (default 5); steps are hard cuts; `repeat_count` of 0 loops forever. Deadline-based scheduling, `active` sequences resume after restart, manual preset selection on a zone stops its sequence. Legacy records (`group_name`, `presets`, `sequence_duration` ms) are migrated on load. Scenes start/stop the sequences they list (`/scenes/<id>/play`, `/stop`).
- **CLI:** `python -m engine.cli --output "ddp://host?pixels=300" --test | --preset N | --pattern NAME` (terminal preview when no output is given).
- **UI:** Outputs and Sequences modals (edit mode), preset tiles drive pixel outputs, header brightness slider, list search filters.
---
## User Interface Specifications
### 1. Dashboard (Main Control Panel)
@@ -1575,11 +1604,13 @@ peak_mem = usqlite.mem_peak()
### Flow 8: Sequence Between Presets
1. Scene activated with group having multiple presets
2. Master applies first preset to itself (if in group), sends to slaves
3. After duration expires, master transitions to next preset with fade effect
4. Process repeats for all presets, loops if enabled
5. Continues until scene changes or manual stop
*(Implemented by the Pi-side sequencer; see Animation Engine.)*
1. User plays a sequence (or a scene that lists it) on a zone
2. Pi applies the first step: renders it to the zone's pixel outputs and sends the preset + `select` to its ESP32 drivers
3. After `duration_s` expires, the sequencer hard-cuts to the next step
4. Process repeats for all steps; loops forever or for `repeat_count` passes
5. Continues until stopped, the zone is played manually, or the app restarts (active sequences then resume)
---
@@ -1649,6 +1680,10 @@ peak_mem = usqlite.mem_peak()
- Any length (1-1000 LEDs supported)
- 5V power supply (external)
**Raspberry Pi (controller):**
- Python 3.x, runs the web app and animation engine
- Optional: Wi-Fi/Ethernet to DDP, Art-Net or sACN fixtures; USB-DMX adapter (Enttec DMX USB Pro / Open DMX)
**Host Computer:**
- Python 3.x
- pipenv for dependency management
+61 -57
View File
@@ -1,8 +1,8 @@
# LED controller — user guide
This page describes the **main web UI** served from the Raspberry Pi app: profiles, **zones**, presets, colour palettes, and sending commands to LED devices. Traffic may go over the **serial → ESP-NOW bridge** or **Wi-Fi** (TCP to drivers on the LAN), depending on each device’s transport.
This page describes the web UI served by the controller (an ESP32-S3 on Ethernet). It covers profiles, zones, presets, device groups, sequences and audio. The controller reaches the LED drivers over ESP-NOW itself, so there is no bridge to set up.
For HTTP routes and the wire format the driver expects, see **[API.md](API.md)**. For running the app locally, see the project **README**.
For HTTP routes and the driver message format, see **[API.md](API.md)**. For building and flashing, see the project **README**.
Figures below are **schematic** (layout and ideas), not pixel-perfect screenshots.
@@ -10,105 +10,109 @@ Figures below are **schematic** (layout and ideas), not pixel-perfect screenshot
## Run mode and Edit mode
The header has a mode toggle (desktop and mobile menu). The **label on the button is the mode you switch to** when you press it.
**Edit mode** is in the header and **Run mode** is in the **Menu** (on narrow screens, both are in the Menu). The **label on the button is the mode you switch to**.
![Schematic: zone buttons on the left; Profiles, Zones, Presets, Patterns, and the mode toggle on the right (example shows Edit mode with “Run mode” on the button).](images/help/header-toolbar.svg)
*The active zone is highlighted. Extra management buttons appear only in Edit mode.*
![Schematic: zone buttons on the left; Profiles, Help and Menu on the right.](images/help/header-toolbar.svg)
| Mode | Purpose |
|------|--------|
| **Run mode** | Day-to-day control: choose a zone, tap presets, apply profiles. Management buttons are hidden. |
| **Edit mode** | Full setup: zones, presets, patterns, colour palette, **Send Presets**, profile create/clone/delete, preset reordering, and per-tile **Edit** on the strip. |
| **Run mode** | Day-to-day control: choose a zone, tap presets, apply profiles. The setup actions are hidden. |
| **Edit mode** | Full setup from the **Menu**: devices, groups, outputs, sequences, zones, presets, patterns, colour palette, audio and settings, plus per-tile **Edit** on the strip. |
**Profiles** is available in both modes: in Run mode you can only **apply** a profile; in Edit mode you can also **create**, **clone**, and **delete** profiles.
On narrow screens, **Menu** also holds the header actions, so it is there in Run mode too.
---
## Zones
- **Select a zone**: click its button in the top bar. The main area shows that zone’s preset strip and controls.
- **Edit mode — open zone settings**: **right-click** a zone button to change its name, **device IDs** (comma-separated), and which presets appear on the zone. Device identifiers are matched to each device’s **name** when the app builds `select` messages for the driver.
- **Zones modal** (Edit mode): create new zones from the header **Zones** button. New zones need a name and device ID list (defaults to `1` if you leave a simple placeholder).
- **Brightness slider** (per zone): adjusts **global** brightness sent to devices (`b` in the driver message), with a short debounce so small drags do not flood the link.
- **Select a zone**: click its button in the top bar. The main area shows the zone's preset strip.
- **Zones** (Edit mode): create and manage zones. A zone lists **device groups**, presets and sequences; presets and sequences can share a zone. **Right-click** a zone button for its settings.
- A zone plays to its device groups. Zones made before groups list drivers by **name** instead, and still work.
- **Brightness slider**: sets the brightness for the current zone. Each driver gets one value: global × its groups × the device × the zone.
- **Search**: the Devices, Zones and Presets lists have a search box that hides rows that do not match as you type.
![Schematic: zone title, brightness slider, and a row of preset tiles; Edit mode adds an Edit control and drag handles.](images/help/tab-preset-strip.svg)
Click the coloured part of a preset tile to select that preset on every driver in the zone. In Edit mode, drag tiles to reorder them, and use **Edit** and **Remove** on each tile.
---
## Presets on the zone strip
## Presets
- **Run and Edit mode**: click the **main part** of a preset tile to **select** that preset on all devices assigned to the current zone (same logical action as a `select` in the driver API).
- **Edit mode only**:
- **Edit** beside a tile opens the preset editor for that preset, scoped to the current zone (so you can **Remove from zone** without deleting the preset from the profile).
- **Drag and drop** tiles to reorder them; order is saved for that zone.
![Schematic: zone title, brightness slider, and a row of preset tiles; Edit mode adds an Edit control and drag handles for reordering.](images/help/zone-preset-strip.svg)
*The slider controls global brightness for the zone’s devices. Click the coloured area of a tile to select that preset.*
The **Presets** header button (Edit mode) opens a **profile-wide** list: **Add** new presets, **Edit**, **Send** (push definition over the transport), and **Delete** (removes the preset from the profile entirely).
---
## Preset editor
- **Pattern**: chosen from the dropdown; optional **n1–n8** fields depend on the pattern (see **Pattern-specific parameters** in [API.md](API.md)).
- **Colours**: choosing a value in the colour picker **adds** a swatch when the picker closes. Swatches can be **reordered** by dragging. Changing a swatch with the picker **clears** palette linkage for that slot.
- **From Palette**: inserts a colour **linked** to the current profile’s palette. Linked slots show a **P** badge; if you change that palette entry later, presets using it update.
- **Brightness (0–255)** and **Delay (ms)**: stored on the preset and sent with the compact preset payload.
- **Try**: sends the current form values to devices on the **current zone**, then selects that preset — **without** `save` on the device (good for auditioning).
- **Default**: updates the zone’s **default preset** and sends a **default** hint for those devices; it does not force the same live selection behaviour as clicking a tile.
- **Save & Send**: writes the preset to the server, then pushes definitions with **save** so devices may persist them. It does **not** auto-select the preset on devices (use the strip or **Try** if you want that).
- **Remove from zone** (when you opened the editor from a zone): removes the preset from **this zone’s list only**; the preset remains in the profile for other zones.
The **Presets** button (Edit mode) opens the profile's presets: **Add**, **Edit**, **Send**, **Delete**, plus **Import** and **Export** (a preset as a JSON file).
![Schematic: preset editor with name, pattern, colour swatches (one with a P badge for palette-linked), and action buttons.](images/help/preset-editor.svg)
*Try previews without persisting on the device; **Save & Send** stores the preset and pushes definitions with save.*
The preset editor:
- **Pattern** and its **n1–n8** parameters, colours, background, brightness and delay.
- **Manual** presets step once per beat instead of running freely.
- **From Palette** inserts a colour linked to the profile's palette (badge **P**). It follows the palette when the palette changes.
- **Try** previews on the current zone without saving on the drivers.
- **Save** stores the preset on the controller; **Send** pushes it to the drivers with save.
- **Remove from zone** (when opened from a zone) removes it from that zone only.
---
## Profiles
- **Apply**: sets the **current profile** in your session. Zones and presets you see are scoped to that profile.
- **Edit mode — Create**: new profiles always get a populated **default** zone. Optionally tick **DJ zone** to also create a `dj` zone (device name `dj`) with starter DJ-oriented presets.
- **Clone** / **Delete**: available in Edit mode from the profile list.
- **Apply** makes a profile current. Zones, presets and sequences you see belong to it.
- **Create** (Edit mode) gives a new profile a palette and a **default** zone with starter presets. Optionally tick **DJ zone** for a starter `dj` zone.
- **Clone** copies a profile with its own zones, presets and palette. **Delete** removes it with its presets and sequences.
- **Export** saves a profile with its zones, presets, sequences and palette as a JSON file. **Import** loads one as a new profile and applies it.
---
## Send Presets (Edit mode)
## Devices and groups
**Send Presets** walks **every zone** in the **current profile**, collects each zone’s preset IDs, and calls **`POST /presets/send`** per zone (including each zone’s **default** preset when set). Use this to bulk-push definitions to hardware after editing, without clicking **Send** on every preset individually.
- **Devices** (Edit mode) lists the LED drivers by name; **Edit** shows a driver's MAC. Drivers appear by themselves when they boot or answer a ping; you can also add them by hand.
- **Ping drivers** checks which drivers answer (green dot with the round-trip time) and adds new ones.
- **Identify** blinks a driver red for two seconds.
- **Update groups** sends every driver its group membership.
- **Edit** a device for its name, brightness, driver settings (LED count, colour order, power-on pattern) and the groups it is in.
- **Groups** (Edit mode): put drivers in a group, set the group's brightness and driver defaults once, then attach the group to zones and sequence lanes.
- Groups are shared by every profile unless you tick **this profile only**.
- **Identify** on a device, in the group or in the list to add from, blinks just that driver; **Identify devices in group** blinks all members together.
---
## Patterns
## Sequences
The **Patterns** dialog (Edit mode) lists pattern names and typical **delay** ranges from the pattern definitions. Choosing a pattern still happens inside the preset editor.
**Wi-Fi drivers** can install new pattern modules over HTTP: the REST API exposes **`/patterns/ota/*`**, **`POST /patterns/<name>/send`**, **`POST /patterns/upload`**, and **`POST /patterns/driver`** (see [API.md](API.md)). ESP-NOW devices follow the bridge/serial path you configure for preset traffic.
**Sequences** (Edit mode) are shows of presets in one or more **lanes**. Each lane plays to its own device group.
- **Steps.** A step is a preset and a number of beats. When a step's beats have passed, the lane moves to its next step. A sequence loops unless you turn looping off.
- **Playing.** Attach a sequence to a zone in the zone editor, then play it from the zone. One sequence plays at a time. Stopping a sequence clears its presets from the zone's drivers.
- **Switching.** Starting another sequence waits for the next beat, or the next downbeat when the header toggle says **Downbeat** and the microphone is timing.
- **Syncing.** Press **S** (or the BPM button) on a downbeat to line the sequence up with the music.
---
## Colour palette
## Audio
**Colour Palette** (Edit mode) edits the **current profile’s** palette swatches. Those colours are reused by **From Palette** in the preset editor and stay in sync while the **P** link remains.
- The controller listens through its microphone and detects the tempo and the bar.
- **Audio** is in the Menu in Edit mode. While it is started, the microphone's beats time sequences and go to the drivers, so manual presets step on the music.
- While it is stopped, a clock at the **simulated BPM** does both instead.
- **Reset detector** forgets a stuck tempo. The **/audio** page has a full readout, a tap for beat 1 and a live listen.
---
## Patterns, outputs and palette
- **Patterns** (Edit mode) lists the patterns and their typical delays. **Send** pushes a pattern file to the drivers over ESP-NOW; they reset to load it. **Create pattern** uploads your own pattern file.
- **Outputs** (Edit mode) lists network pixel fixtures (DDP, Art-Net, sACN). **Test** flashes red, green, blue and white, then black. Zones do not drive outputs on this controller.
- **Colour Palette** (Edit mode) edits the current profile's swatches. Preset colours linked with **From Palette** update with it.
![Schematic: palette modal with a row of swatches for the current profile.](images/help/colour-palette.svg)
*Add or change swatches here; linked preset colours update automatically.*
---
## Mobile layout
## Settings
On narrow screens, use **Menu** to reach the same actions as the desktop header (Profiles, Zones, Presets, Help, mode toggle, etc.).
**Settings** (Edit mode) holds the controller's name, the ESP-NOW channel (for reference: the controller's channel is set at build time), a **Wi-Fi access point** switch (on by default; network named after the hostname, with an optional WPA2 password, controller at `192.168.5.1`; holding the button on D3 at boot forces it on), its mDNS **hostname** and the **static IPs** it tries on the Ethernet link (DHCP when none answers). With no DHCP server, as on a cable straight to a PC, the controller is at `192.168.4.1`; give the PC a static IP such as `192.168.4.2`. Network changes apply after a restart. **Driver** in Settings sends a driver its name, LED count, colour order, startup mode, maximum brightness and direction over ESP-NOW, with no cable. **Update code** there sends a driver, or all of them, the led-driver code built into the controller. `led-cli` on a computer edits a driver's whole `settings.json` over USB.
![Schematic: narrow layout with Menu and the same header actions in a dropdown.](images/help/mobile-menu.svg)
*Preset tiles behave the same once a zone is selected.*
---
## Further reading
- **[API.md](API.md)** — REST routes, session scoping, WebSocket `/ws`, and LED driver JSON (`presets`, `select`, `save`, `default`, pattern keys, pattern **manifest**).
- **README** — `pipenv run run`, port 80 setup, and high-level behaviour.
- **[API.md](API.md)**: HTTP routes, the WebSocket `/ws`, and the driver message format.
- **README**: building, flashing and updating the controller and drivers.
+4 -8
View File
@@ -13,12 +13,8 @@
<rect x="380" y="40" width="72" height="30" rx="3" fill="#3d3d3d" stroke="#555" stroke-width="1"/>
<text x="396" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Profiles</text>
<rect x="458" y="40" width="52" height="30" rx="3" fill="#3d3d3d" stroke="#555" stroke-width="1"/>
<text x="470" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Tabs</text>
<rect x="516" y="40" width="64" height="30" rx="3" fill="#3d3d3d" stroke="#555" stroke-width="1"/>
<text x="524" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Presets</text>
<rect x="586" y="40" width="78" height="30" rx="3" fill="#3d3d3d" stroke="#555" stroke-width="1"/>
<text x="598" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Patterns</text>
<rect x="670" y="40" width="134" height="30" rx="3" fill="#4a4a6a" stroke="#7a7aaf" stroke-width="1"/>
<text x="688" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Run mode</text>
<text x="16" y="98" fill="#aaa" font-family="sans-serif" font-size="10">Active tab highlighted. Mode button shows the mode you switch to next.</text>
<text x="470" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Help</text>
<rect x="516" y="40" width="60" height="30" rx="3" fill="#3d3d3d" stroke="#555" stroke-width="1"/>
<text x="530" y="59" fill="#e0e0e0" font-family="sans-serif" font-size="11">Menu</text>
<text x="16" y="98" fill="#aaa" font-family="sans-serif" font-size="10">Active tab highlighted. Run mode is in the Menu.</text>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

+1
View File
@@ -0,0 +1 @@
{"ambiguous_scale": "", "code_only": false, "epoch": "v0.9.101-s36-g1339418af9f9", "excludes": [], "follow_symlinks": false, "full_clean": true, "gitignore": true, "graph_mtime_ns": 1794396558448981640, "graph_size": 3355638, "html_present": true, "no_cluster": false, "rcfile": "", "scan_digest": "9eaa77f8bb2f8dbadf43cb5d942b4c65", "scan_root": "/home/jimmy/projects/led-controller", "viz_node_limit": ""}
+92
View File
@@ -0,0 +1,92 @@
{
"1": "htmx Library",
"3": "Browser Tests & Mockup Images",
"4": "Audio UI (JS)",
"5": "ESP-NOW TX & DMX Pulse",
"7": "led-tool Device CLI",
"10": "Spec: Pi Animation Engine",
"12": "Presets UI (JS)",
"13": "Zones UI (JS)",
"16": "Sequences UI (JS)",
"19": "led_strip Component Docs",
"20": "Art-Net Output",
"28": "Devices UI (JS)",
"30": "Colour Picker Mockups",
"36": "API Docs: Outputs & Audio",
"39": "Beat Detection DSP (C)",
"47": "USB Latency Tools",
"48": "Colour Picker JS",
"49": "Chromium Colour Picker JS",
"51": "API Tests: Devices",
"53": "mpremote Transport",
"54": "Outputs Config (C)",
"60": "mpremote Serial Transport",
"61": "API Test Fixtures & Audio",
"62": "Microdot Request (dmx)",
"63": "Help: Zones & Palette",
"70": "Index Page Modals",
"73": "Microdot WebSocket (dmx)",
"76": "Controller Overview & OTA Docs",
"79": "Audio Monitor Page",
"80": "Art-Net DMX Tests",
"81": "DMX Output Manager",
"85": "ESP-NOW Sender Bridge",
"87": "Microdot Async IO (dmx)",
"88": "DMX Settings",
"91": "Microdot Routing (dmx)",
"92": "Bench Test Plan",
"95": "Microdot Auth (dmx)",
"96": "Serial DMX & WiFi",
"97": "DMX Pattern Player",
"98": "DMX Preset Model",
"101": "Groups UI (JS)",
"103": "Help: Mobile Menu Image",
"104": "Pattern Selector Mockup Image",
"105": "Driver Pattern Docs",
"109": "Driver Message API Docs",
"111": "led_strip Manifest",
"113": "Outputs UI (JS)",
"114": "DMX Driver Docs",
"115": "Help PDF: Overview",
"116": "Mockups Index Image",
"118": "Help: Header Toolbar Image",
"119": "Help: Preset Editor Image",
"120": "Dashboard Mockup Image",
"121": "Device Management Mockup Image",
"122": "Presets Mockup Image",
"123": "Pattern Contract",
"127": "Numpad Shortcuts (JS)",
"129": "Colour Picker Demo Image",
"130": "Settings Mockup Image",
"134": "API Tests: Settings",
"138": "Help: Colour Palette Image",
"140": "LED Driver README",
"142": "SPI Example Manifest",
"145": "Help PDF: Modes",
"146": "Help: Tab Preset Strip Image",
"156": "RMT Example Manifest",
"157": "Help Tab JS",
"158": "Settings Page Template",
"171": "List Search (JS)",
"172": "DMX Solid Pattern",
"173": "led-test Manifest",
"174": "VPN Autoconnect Script",
"175": "Zone Devices Panel",
"176": "graphify Instructions",
"180": "Device Mockup Modals",
"181": "bulk.sh Script",
"182": "deploy.sh Script",
"183": "Driver install.sh",
"185": "led-tool install.sh",
"186": "Help PDF Build Script",
"187": "Web Build Script",
"188": "Patterns UI (JS)",
"189": "DMX Patterns Init",
"190": "Mockup Tab Switch",
"191": "Spec: Pattern Selector UI",
"192": "mpremote Package",
"193": "Bundle Import/Export (JS)",
"194": "Colour Palette (JS)",
"195": "Profiles UI (JS)",
"196": "Zone Palette (JS)"
}
+1
View File
@@ -0,0 +1 @@
{"0": "5a6fe369b1e9eab9", "1": "2d791c43bb8436ec", "2": "b549e617825efc45", "3": "658093cbc50e95df", "4": "7221607390cbf8f4", "5": "b441bdea17ad6297", "6": "f3e3f8fa8f323411", "7": "f1cd30037a4aa8fa", "8": "c7753eeed86c8002", "9": "5e6bedc1d8578bcb", "10": "ba809033c2ac79db", "11": "1cdb300036b95f18", "12": "cd9a1302e31a16be", "13": "38e3459e42de82ae", "14": "907a7a5a980e7ee9", "15": "55f791413a3c65b8", "16": "7dd1b08d3601a3f4", "17": "b4be1705befe2c85", "18": "be98f7b72ea43b2c", "19": "36e64b70bd3252ce", "20": "8fef51c59e728cbb", "21": "f3f303832b603793", "22": "b25a5c67c6b80682", "23": "afa2c3d7d54293f1", "24": "90c916e427b5ebfd", "25": "9521502a76e3926d", "26": "08c17760b6a78441", "27": "27e4c3eb54733fed", "28": "f55b318ce2ea37bf", "29": "a5cce0735423723c", "30": "8c465f3df9b2ddbd", "31": "b63da06d6ca05666", "32": "0a565e66eafdd7eb", "33": "944011bf47895ae9", "34": "3f0d61a8871fc63a", "35": "4f79d9f75a50cf01", "36": "503896ae7591c77b", "37": "2edd892aa6e5eaa8", "38": "312ff5e741d2a39f", "39": "d0ff09e1589219cc", "40": "0cbacf6eb12d6315", "41": "64b6c5772748a82d", "42": "01dfdff7dbabb88c", "43": "56a6f4b36b77038f", "44": "bf21d11ea6c4fadf", "45": "5be380e898e13324", "46": "471f838c9f9faeb9", "47": "d5845e875703cccd", "48": "46b84e04c8a769a1", "49": "01bb51d3946bc98b", "50": "dbf9e50467c11779", "51": "fc3745c70cad6065", "52": "7e5187509e0145be", "53": "141393a45638779c", "54": "b761f45a82eacec9", "55": "5e6521bb93696132", "56": "8a68d6ebf88e07ea", "57": "b17e4e22dfe31a3d", "58": "973ac14a32bd0435", "59": "8ae951b21941381b", "60": "4899a61ba741a2f8", "61": "3a757a4e17e2cc29", "62": "88ecf3d949c8bbdc", "63": "3f32204f50610f42", "64": "6852de7c708dba55", "65": "81c20c6e0d0187d4", "66": "dc8e43fa499882ac", "67": "bd20a78a99f60228", "68": "e1fe5116ee8ce485", "69": "aef962d800518446", "70": "9affb95b7a8926f7", "71": "551d7508ae9dc04a", "72": "375c9adb2b24179c", "73": "298efcf42a95f405", "74": "9dd9fa4b945a0f59", "75": "6f7f2eba3df89704", "76": "6e5f52cb9e7a3080", "77": "689536a1995dc379", "78": "f2f70696e107cc5c", "79": "0aadcaffca2fec2f", "80": "b44b759b294e7fb1", "81": "2a44adbbdb7b2cc2", "82": "d48cec59dd722fd4", "83": "dd61dba571aab679", "84": "238401c059f27744", "85": "67e8988d64ef02c3", "86": "c7a4d2e3858a9eeb", "87": "186dd13162172b05", "88": "281e8bde953022f8", "89": "b2ccf867707890e2", "90": "6f2dd301866c484e", "91": "8726692dfc1a3d69", "92": "fe3f7fa17b6e9140", "93": "1c9c389e7ea7dd32", "94": "a9147a14f38d1bad", "95": "84c30b82ce45e85f", "96": "f71d81296b66decd", "97": "1ff181597dc9980c", "98": "7f4284e17bf23520", "99": "3d6b7edec8e513d8", "100": "50b0e31410e284e6", "101": "e8c3d507c7523478", "102": "729a2de1ab6b12b5", "103": "89850ee47c9ca738", "104": "6b44fd779534127a", "105": "98b16b4bcf978a30", "106": "aeb73082ae7eab1a", "107": "f4f2630b6fbd48ca", "108": "50ea206ca32f8368", "109": "62dfdb23b2c54d82", "110": "7d5b56eb98869909", "111": "66b50b0357357d62", "112": "f07f0a842de7350e", "113": "66e63867ee9ac604", "114": "b87bf40ea7db9bd2", "115": "f3b1e77b5ff745de", "116": "2d5d657b0cb526af", "117": "9a63ee4db57902d7", "118": "4b507a629ac7f04f", "119": "c394c3d1e26256c8", "120": "8059a64174d9729b", "121": "b77edb57c9058871", "122": "9b758d47bd1a6c69", "123": "3757904e987193d1", "127": "682784ef7eb6ab79", "129": "93fc8b4ad7c9ca62", "130": "8363eed2536a6846", "131": "fe6e422923b8d6ef", "134": "692d38c636992a64", "135": "a7796e8a95a7935c", "138": "513f0c5816361dda", "140": "7f4e0effc09d9671", "141": "ab64084e0052dd1b", "142": "01c470ad572a2a84", "143": "9767524947f5d239", "144": "a7a26633381cc935", "145": "8fc084b6564c04cd", "146": "cb4b693c8a2db3d0", "149": "79da6ef18a0fc9bb", "150": "e7d4ba7c2a13b959", "155": "59ee4fee36503aee", "156": "f7b8f6a932f020e1", "157": "2baed17a20d35d4e", "158": "1496a7273bd8cbf0", "159": "70c38a287cac17ff", "166": "884b25ce5534ca30", "167": "8c903324815075bf", "170": "ca0193e69e1cf4c6", "171": "c8052f332c3d2369", "172": "ffa84e66ab7f2c83", "173": "9bcf4d1a57c0ba2a", "174": "6ca582b7df7276a1", "175": "de377ed03b71265f", "176": "1fb6d892ae8678c7", "180": "5ae949a86bd02dd3", "181": "040c831fbc62df23", "182": "09fe188418c42b7a", "183": "90b339bb352b5f47", "185": "ced44d681e2ec183", "186": "ff963270b8878129", "187": "bb41b7312f4e3083", "188": "a08753a73e0ca7d5", "189": "0cadf82de76cac0c", "190": "f40e0095eef0a2a1", "191": "2427a73600db473c", "192": "ae89d1eb8e024c9a", "193": "25a3de734ba30abf", "194": "6d34a1978e2935a7", "195": "8ae29623c3cfc6a6", "196": "32051c55a4723b9c", "197": "227d5082400af4ff", "199": "37b8871950bf5c3b", "201": "d2369c4cd0208ca6", "204": "54defa1f3d2a9a86", "209": "5fd8f1c618642991", "210": "363020d929127998", "211": "24c2db367e0711da", "214": "d651aa39cd803275", "227": "cc359b28b621fe98", "229": "83c733c01acff1c0", "231": "92b69d5dfa1439e0", "235": "dbe9ebef6953c86b", "236": "2b8491e23b3448a8", "237": "97756402288d8dbd"}
@@ -0,0 +1,96 @@
{
"0": "IdfDevice",
"2": "machine.py",
"6": "audio.c",
"8": "ab",
"9": "Compiler",
"11": "led-driver/main/ota.c",
"14": "patterns.c",
"15": "new_id",
"17": "server.py",
"18": "main/main.c",
"21": "main/main.c",
"22": "esp_log",
"23": "engine.c",
"24": "ws.c",
"25": "Microdot",
"26": "led_strip_rmt_dev.c",
"27": "seqplay.c",
"29": "binary_envelope.py",
"31": "PyboardCommand",
"32": "beat.c",
"33": "web.cpp",
"34": "test_sequences.py",
"35": "microdot.py",
"37": "led_strip_spi_dev.c",
"38": "store_save",
"40": "audio_api.c",
"41": "sim_stubs.c",
"42": "run_all",
"43": "ws_client.cpp",
"44": "time",
"45": "test_presets.py",
"46": "BridgeSim",
"50": "WS2812",
"52": "Transport",
"55": "patterns.cpp",
"56": "test_routes.py",
"57": "ESPNow",
"58": "test_outputs.py",
"59": "microdot.py",
"64": "ddp_test.py",
"65": "test_audio.py",
"66": "esp_timer_get_time",
"67": "os",
"68": "build_app",
"69": "main/ota.c",
"71": "NeoPixel",
"72": "_simlink.py",
"74": "store_lock",
"75": "json",
"77": "usb_cfg.cpp",
"78": "urandom.py",
"82": "bridge_sim.py",
"83": "LedSimulatorApp",
"84": "unique",
"86": "net.cpp",
"89": "Rig",
"90": "packet",
"93": "envelope.c",
"94": "api_call_t",
"99": "status_get_handler",
"100": "ddp.cpp",
"102": "rig_seed.py",
"106": "._loop_main",
"107": "find_devices",
"108": "esp_timer_get_time",
"110": "engine_init",
"112": "ws_slot_t",
"117": "read_serial",
"131": "sim_demo.py",
"135": "store_coll",
"141": "machine.py",
"143": "test_rig_sim.py",
"144": "settings_editor.js",
"149": "res_device.c",
"150": "api_error",
"155": "app.js",
"159": "led-driver/web/app.js",
"166": "sequences_route",
"167": "api_id",
"170": "dependencies",
"197": "presets.cpp",
"199": "res_group.c",
"201": "_simlink_web.py",
"204": "_simlink_proc.py",
"209": "WLAN",
"210": "fetch_cache.js",
"211": "NoCaseDict",
"214": "SimRing",
"227": "dependencies",
"229": "examples/blink.py",
"231": "led_driver_sim_hook.py",
"235": "driver-worker.js",
"236": "layout.js",
"237": "README.md"
}
+1
View File
@@ -0,0 +1 @@
/home/jimmy/.local/share/pipx/venvs/graphifyy/bin/python
+1
View File
@@ -0,0 +1 @@
.
@@ -0,0 +1,162 @@
{
"1": "htmx Library",
"3": "Browser Tests & Mockup Images",
"4": "Audio UI (JS)",
"5": "ESP-NOW TX & DMX Pulse",
"6": "Driver OTA over ESP-NOW",
"7": "led-tool Device CLI",
"10": "Spec: Pi Animation Engine",
"11": "Beat Sync on Driver",
"12": "Presets UI (JS)",
"13": "Zones UI (JS)",
"14": "Pattern Store & Web (C)",
"15": "ESP-NOW Receive Tests",
"16": "Sequences UI (JS)",
"17": "Driver Controller Messages",
"18": "ESP-IDF System Deps",
"19": "led_strip Component Docs",
"20": "Art-Net Output",
"21": "Reliable ESP-NOW Link (C)",
"22": "led-test RMT Example",
"23": "Driver Presets Store",
"25": "Microdot App (dmx)",
"26": "Microdot App (led)",
"28": "Devices UI (JS)",
"29": "DMX Driver HTTP App",
"30": "Colour Picker Mockups",
"31": "ESP-NOW Wire & Transport",
"32": "Audio Capture (C)",
"33": "Driver OTA Broadcast (C)",
"34": "API Tests: Sequences & Bundles",
"35": "Binary Envelope (test)",
"36": "API Docs: Outputs & Audio",
"37": "mpremote Commands",
"38": "Driver WiFi & Background Tasks",
"39": "Beat Detection DSP (C)",
"43": "Driver Test Runner",
"44": "Microdot Helpers",
"45": "Bridge WebSocket Blink Test",
"47": "USB Latency Tools",
"48": "Colour Picker JS",
"49": "Chromium Colour Picker JS",
"51": "API Tests: Devices",
"52": "Presets & Settings Mockups",
"53": "mpremote Transport",
"54": "Outputs Config (C)",
"55": "Microdot Handlers (dmx)",
"56": "MultiDict (dmx)",
"58": "Microdot Handlers (led)",
"59": "MultiDict (led)",
"60": "mpremote Serial Transport",
"61": "API Test Fixtures & Audio",
"62": "Microdot Request (dmx)",
"63": "Help: Zones & Palette",
"64": "Network & WebSocket (C)",
"65": "Driver OTA Tool",
"68": "API Tests: Zones",
"69": "API Tests: Outputs & Routes",
"70": "Index Page Modals",
"71": "Microdot Templates (led)",
"72": "Microdot Templates (dmx)",
"73": "Microdot WebSocket (dmx)",
"74": "Microdot WebSocket (led)",
"76": "Controller Overview & OTA Docs",
"78": "Driver Hello Discovery",
"79": "Audio Monitor Page",
"80": "Art-Net DMX Tests",
"81": "DMX Output Manager",
"83": "Microdot Sessions (led)",
"84": "API Tests: Groups",
"85": "ESP-NOW Sender Bridge",
"86": "Firmware OTA (C)",
"87": "Microdot Async IO (dmx)",
"88": "DMX Settings",
"89": "Microdot Async IO (led)",
"90": "API Tests: Presets",
"91": "Microdot Routing (dmx)",
"92": "Bench Test Plan",
"93": "Microdot Routing (led)",
"94": "Flame Pattern",
"95": "Microdot Auth (dmx)",
"96": "Serial DMX & WiFi",
"97": "DMX Pattern Player",
"98": "DMX Preset Model",
"99": "Twinkle Pattern",
"100": "Driver Settings",
"101": "Groups UI (JS)",
"102": "Microdot Auth (led)",
"103": "Help: Mobile Menu Image",
"104": "Pattern Selector Mockup Image",
"105": "Driver Pattern Docs",
"106": "Driver Preset Model",
"108": "Microdot JWT Session",
"109": "Driver Message API Docs",
"110": "Driver Binary Envelope",
"111": "led_strip Manifest",
"112": "API Tests: Patterns",
"113": "Outputs UI (JS)",
"114": "DMX Driver Docs",
"115": "Help PDF: Overview",
"116": "Mockups Index Image",
"118": "Help: Header Toolbar Image",
"119": "Help: Preset Editor Image",
"120": "Dashboard Mockup Image",
"121": "Device Management Mockup Image",
"122": "Presets Mockup Image",
"123": "Pattern Contract",
"124": "Microdot SessionDict",
"125": "Meteor Pattern",
"127": "Numpad Shortcuts (JS)",
"128": "Blink Pattern Test",
"129": "Colour Picker Demo Image",
"130": "Settings Mockup Image",
"131": "Aurora Pattern",
"132": "Colour Cycle Pattern",
"133": "Sparkle Pattern",
"134": "API Tests: Settings",
"137": "HTTPException (dmx)",
"138": "Help: Colour Palette Image",
"139": "HTTPException (led)",
"140": "LED Driver README",
"141": "Palette Morph Pattern",
"142": "SPI Example Manifest",
"145": "Help PDF: Modes",
"146": "Help: Tab Preset Strip Image",
"147": "Blink Pattern",
"148": "Circle Pattern",
"151": "Plasma Pattern",
"152": "Radiate Pattern",
"153": "Transition Pattern",
"154": "Driver Runtime State",
"156": "RMT Example Manifest",
"157": "Help Tab JS",
"158": "Settings Page Template",
"168": "Rime Pattern",
"170": "Controller Component Deps",
"171": "List Search (JS)",
"172": "DMX Solid Pattern",
"173": "led-test Manifest",
"174": "VPN Autoconnect Script",
"175": "Zone Devices Panel",
"176": "graphify Instructions",
"177": "Microdot Package (dmx)",
"178": "Microdot Package (led)",
"179": "Env Check",
"180": "Device Mockup Modals",
"181": "bulk.sh Script",
"182": "deploy.sh Script",
"183": "Driver install.sh",
"184": "Pattern Package Init",
"185": "led-tool install.sh",
"186": "Help PDF Build Script",
"187": "Web Build Script",
"188": "Patterns UI (JS)",
"189": "DMX Patterns Init",
"190": "Mockup Tab Switch",
"191": "Spec: Pattern Selector UI",
"192": "mpremote Package",
"193": "Bundle Import/Export (JS)",
"194": "Colour Palette (JS)",
"195": "Profiles UI (JS)",
"196": "Zone Palette (JS)"
}
+736
View File
@@ -0,0 +1,736 @@
# Graph Report - led-controller (2026-11-04)
## Corpus Check
- 299 files · ~205,335 words
- Verdict: corpus is large enough that graph structure adds value.
- Unclassified: 43 file(s) not represented in the graph (top: (none) 23, .mdc 6, .lock 4)
## Summary
- 3436 nodes · 7652 edges · 203 communities (113 shown, 90 thin omitted)
- Extraction: 88% EXTRACTED · 12% INFERRED · 0% AMBIGUOUS · INFERRED: 923 edges (avg confidence: 0.86)
- Token cost: 0 input · 0 output
## Graph Freshness
- Built from commit: `24d3c114`
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost).
## Community Hubs (Navigation)
- store_coll
- htmx Library
- run_tick
- Browser Tests & Mockup Images
- Audio UI (JS)
- ESP-NOW TX & DMX Pulse
- Driver OTA over ESP-NOW
- led-tool Device CLI
- style_mode
- Compiler
- Spec: Pi Animation Engine
- Beat Sync on Driver
- Presets UI (JS)
- Zones UI (JS)
- Pattern Store & Web (C)
- ESP-NOW Receive Tests
- Sequences UI (JS)
- Driver Controller Messages
- ESP-IDF System Deps
- led_strip Component Docs
- Art-Net Output
- Reliable ESP-NOW Link (C)
- led-test RMT Example
- Driver Presets Store
- serial
- Microdot App (dmx)
- Microdot App (led)
- engine.c
- Devices UI (JS)
- DMX Driver HTTP App
- Colour Picker Mockups
- ESP-NOW Wire & Transport
- Audio Capture (C)
- Driver OTA Broadcast (C)
- API Tests: Sequences & Bundles
- Binary Envelope (test)
- API Docs: Outputs & Audio
- mpremote Commands
- Driver WiFi & Background Tasks
- Beat Detection DSP (C)
- tests/patterns/bar_graph.py
- Compiler
- presets.py
- Driver Test Runner
- Microdot Helpers
- Bridge WebSocket Blink Test
- find_id_by_field
- USB Latency Tools
- Colour Picker JS
- Chromium Colour Picker JS
- led_strip_rmt_encoder.c
- API Tests: Devices
- Presets & Settings Mockups
- mpremote Transport
- Outputs Config (C)
- Microdot Handlers (dmx)
- MultiDict (dmx)
- led_strip_spi_dev.c
- Microdot Handlers (led)
- MultiDict (led)
- mpremote Serial Transport
- API Test Fixtures & Audio
- Microdot Request (dmx)
- Help: Zones & Palette
- Network & WebSocket (C)
- Driver OTA Tool
- api_error
- SerialIntercept
- API Tests: Zones
- API Tests: Outputs & Routes
- Index Page Modals
- Microdot Templates (led)
- Microdot Templates (dmx)
- Microdot WebSocket (dmx)
- Microdot WebSocket (led)
- board.py
- Controller Overview & OTA Docs
- DMX
- Driver Hello Discovery
- Audio Monitor Page
- Art-Net DMX Tests
- DMX Output Manager
- machine
- Microdot Sessions (led)
- API Tests: Groups
- ESP-NOW Sender Bridge
- Firmware OTA (C)
- Microdot Async IO (dmx)
- DMX Settings
- Microdot Async IO (led)
- API Tests: Presets
- Microdot Routing (dmx)
- Bench Test Plan
- Microdot Routing (led)
- Flame Pattern
- Microdot Auth (dmx)
- Serial DMX & WiFi
- DMX Pattern Player
- DMX Preset Model
- Twinkle Pattern
- Driver Settings
- Groups UI (JS)
- Microdot Auth (led)
- Help: Mobile Menu Image
- Pattern Selector Mockup Image
- Driver Pattern Docs
- Driver Preset Model
- Blizzard
- Microdot JWT Session
- Driver Message API Docs
- Driver Binary Envelope
- led_strip Manifest
- API Tests: Patterns
- Outputs UI (JS)
- DMX Driver Docs
- Help PDF: Overview
- Mockups Index Image
- api_json
- Help: Header Toolbar Image
- Help: Preset Editor Image
- Dashboard Mockup Image
- Device Management Mockup Image
- Presets Mockup Image
- Pattern Contract
- Microdot SessionDict
- Meteor Pattern
- ._feed_wdt
- Numpad Shortcuts (JS)
- Blink Pattern Test
- Colour Picker Demo Image
- Settings Mockup Image
- Aurora Pattern
- Colour Cycle Pattern
- Sparkle Pattern
- api_set
- tests/patterns/clock_sweep.py
- HTTPException (dmx)
- Help: Colour Palette Image
- HTTPException (led)
- LED Driver README
- Palette Morph Pattern
- SPI Example Manifest
- tests/patterns/aurora.py
- marquee.py
- Help PDF: Modes
- Help: Tab Preset Strip Image
- Blink Pattern
- Circle Pattern
- utime
- heartbeat.py
- Plasma Pattern
- Radiate Pattern
- Transition Pattern
- Driver Runtime State
- tests/patterns/plasma.py
- RMT Example Manifest
- Help Tab JS
- Settings Page Template
- groups_route
- web.c
- sequences_route
- tests/patterns/pulse.py
- store_save
- breathing_dual.py
- Flicker
- tests/patterns/strobe_burst.py
- tests/patterns/palette_morph.py
- Rime Pattern
- Particles
- Controller Component Deps
- List Search (JS)
- DMX Solid Pattern
- led-test Manifest
- VPN Autoconnect Script
- graphify Instructions
- bulk.sh Script
- deploy.sh Script
- Driver install.sh
- led-tool install.sh
- Help PDF Build Script
- Web Build Script
- Spec: Pattern Selector UI
- tests/patterns/circle.py
- BarGraph
- candle_glow.py
- Orbit
- src/patterns/rain_drops.py
- Pulse
## God Nodes (most connected - your core abstractions)
1. `Presets` - 67 edges
2. `store_coll()` - 64 edges
3. `api_error()` - 50 edges
4. `api_json()` - 43 edges
5. `unique()` - 37 edges
6. `api_set()` - 35 edges
7. `store_save()` - 35 edges
8. `new_id()` - 35 edges
9. `run_tick()` - 33 edges
10. `api_id()` - 28 edges
## Surprising Connections (you probably didn't know these)
- `Preset editor modal` --semantically_similar_to--> `Preset fields (pattern, colors, delay, brightness, auto, n1-n6)` [INFERRED] [semantically similar]
web/templates/index.html → led-driver/docs/API.md
- `led-driver-style pattern engine (Preset object)` --semantically_similar_to--> `led-driver MicroPython firmware (submodule)` [INFERRED] [semantically similar]
dmx-driver/README.md → README.md
- `espnow-sender Microdot WebSocket receiver` --semantically_similar_to--> `WebSocket /ws driver message relay` [INFERRED] [semantically similar]
espnow-sender/README.md → docs/API.md
- `Art-Net output (UDP 6454)` --semantically_similar_to--> `Outputs (DDP, Art-Net, sACN, DMX serial pixel fixtures)` [INFERRED] [semantically similar]
dmx-driver/README.md → docs/API.md
- `POST /patterns/upload (led-driver parity)` --semantically_similar_to--> `Patterns resource /patterns` [INFERRED] [semantically similar]
dmx-driver/README.md → docs/API.md
## Import Cycles
- None detected.
## Hyperedges (group relationships)
- **Audio page live endpoints** — web_audio_status, web_audio_beats, web_audio_audio_wav, web_audio_time, web_audio_tap_ep [EXTRACTED 1.00]
- **Beat latency measurement methods** — docs_api_bench_endpoints, docs_bench_test_usb_latency, docs_bench_test_logic_analyzer, docs_bench_test_beat_lead [EXTRACTED 1.00]
- **Combined brightness factors** — docs_api_combined_brightness, docs_api_settings, docs_api_groups, docs_api_devices, docs_api_zones [EXTRACTED 1.00]
- **Color picker feature set** — docs_mockups_images_color_picker_demo_hsb_color_model, docs_mockups_images_color_picker_demo_hex_rgb_input, docs_mockups_images_color_picker_demo_keyboard_accessibility, docs_mockups_images_color_picker_demo_cross_platform_consistency [EXTRACTED 1.00]
- **Edit-mode-only management features** — docs_help_edit_mode, docs_help_zones_modal, docs_help_send_presets, docs_help_patterns_dialog, docs_help_colour_palette, docs_help_presets_list [EXTRACTED 1.00]
- **Preset editor actions (Try, Default, Save & Send, Remove from zone)** — docs_help_try_action, docs_help_default_preset, docs_help_save_and_send, docs_help_remove_from_zone [EXTRACTED 1.00]
- **Header actions aggregated in mobile Menu** — docs_images_help_mobile_menu_run_mode, docs_images_help_mobile_menu_profiles, docs_images_help_mobile_menu_tabs, docs_images_help_mobile_menu_presets, docs_images_help_mobile_menu_help [EXTRACTED 1.00]
- **Device/Group Modal Flow** — docs_mockups_device_management_showadddevicemodal, docs_mockups_device_management_showaddgroupmodal, docs_mockups_device_management_closemodal, docs_mockups_device_management_savedevice [EXTRACTED 1.00]
- **LED Driver UI Mockup Set** — docs_mockups_images_index_dashboard_mockup, docs_mockups_images_index_pattern_selector_mockup, docs_mockups_images_index_device_management_mockup, docs_mockups_images_index_settings_mockup, docs_mockups_images_index_presets_mockup [EXTRACTED 1.00]
- **Selectable LED Patterns** — docs_mockups_images_pattern_selector_on, docs_mockups_images_pattern_selector_off, docs_mockups_images_pattern_selector_blink, docs_mockups_images_pattern_selector_chase, docs_mockups_images_pattern_selector_circle, docs_mockups_images_pattern_selector_pulse, docs_mockups_images_pattern_selector_rainbow, docs_mockups_images_pattern_selector_transition [EXTRACTED 1.00]
- **Preset/pattern configuration schema (pattern, colors, delay, step increment, N1-N8)** — docs_mockups_presets_led_patterns, docs_mockups_presets_delay, docs_mockups_presets_step_increment, docs_mockups_presets_n_parameters, docs_mockups_presets_step_offset [EXTRACTED 1.00]
- **Device settings sections** — docs_mockups_settings_basic_settings, docs_mockups_settings_pattern_settings, docs_mockups_settings_advanced_settings, docs_mockups_settings_network_settings [EXTRACTED 1.00]
- **LED Driver UI Mockup Suite** — docs_mockups_index, docs_mockups_dashboard, docs_mockups_pattern_selector, docs_mockups_device_management, docs_mockups_readme_settings_mockup, docs_mockups_color_picker_readme_presets_mockup [EXTRACTED 1.00]
- **Pi-to-ESP32 Command Paths** — docs_specification_serial_espnow_bridge, docs_specification_wifi_driver_tcp, docs_specification_espnow, docs_specification_pi_controller [EXTRACTED 1.00]
- **led_strip backend choice (RMT vs SPI, DMA)** — scripts_led_test_managed_components_espressif__led_strip_readme_rmt_backend, scripts_led_test_managed_components_espressif__led_strip_readme_spi_backend, scripts_led_test_managed_components_espressif__led_strip_readme_dma_support, scripts_led_test_managed_components_espressif__led_strip_readme_backend_selection_flowchart [EXTRACTED 1.00]
- **led_strip pixel write and flush flow** — scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel_hsv, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel_rgbw, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_refresh, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_clear [EXTRACTED 1.00]
- **Dynamic pattern contract** — led_driver_docs_pattern_contract_class_shape, led_driver_docs_pattern_contract_run_generator_rules, led_driver_docs_pattern_contract_drawing_brightness, led_driver_docs_pattern_contract_step_semantics, led_driver_docs_pattern_contract_error_handling [EXTRACTED 1.00]
- **Pi Animation Engine Output Pipeline** — docs_specification_pixel_generator, docs_specification_output_drivers, docs_specification_output_record, docs_specification_zone_playback, docs_specification_sequencer [EXTRACTED 1.00]
- **Beat-Driven Scene Activation** — docs_specification_beat_detection_device, docs_specification_bpm_sync, docs_specification_beat_counter_phases, docs_specification_scene_queue [INFERRED 0.85]
- **Fields defining an LED preset (name, pattern, colours, parameters)** — docs_images_help_preset_editor_preset_name_field, docs_images_help_preset_editor_pattern_selector, docs_images_help_preset_editor_palette_linked_colour, docs_images_help_preset_editor_preset_parameters [INFERRED 0.85]
- **Pattern settings composed and applied to devices** — docs_mockups_images_dashboard_pattern_selection, docs_mockups_images_dashboard_brightness_speed, docs_mockups_images_dashboard_colors, docs_mockups_images_dashboard_apply_settings [INFERRED 0.85]
- **Preset lifecycle actions (create, apply, sync)** — docs_mockups_images_presets_create_preset, docs_mockups_images_presets_apply_preset, docs_mockups_images_presets_sync_presets_to_all_devices [INFERRED 0.85]
- **ESP-NOW driver delivery layers** — docs_api_binary_envelope, docs_api_delivery_digest, docs_bench_test_reliable_link, docs_bench_test_beat_double_send [INFERRED 0.85]
- **v1 message handling on driver** — led_driver_docs_api_v1_message, led_driver_docs_patterns_process_data_flow, led_driver_docs_patterns_pattern_registry, led_driver_docs_patterns_preset_short_keys, led_driver_docs_api_select_message [INFERRED 0.85]
## Communities (203 total, 90 thin omitted)
### Community 0 - "store_coll"
Cohesion: 0.19
Nodes (33): api_register(), api_settings_defaults(), engine_groups_changed(), api_migrate_zones(), api_preset_defaults(), api_seed_defaults(), clone_profile(), clone_zone() (+25 more)
### Community 1 - "htmx Library"
Cohesion: 0.08
Nodes (101): a(), Ae(), an(), at(), B(), be(), bn(), bt() (+93 more)
### Community 2 - "run_tick"
Cohesion: 0.06
Nodes (22): run_tick(), main(), run_for(), main(), run_for(), main(), run_for(), main() (+14 more)
### Community 3 - "Browser Tests & Mockup Images"
Cohesion: 0.06
Nodes (17): generate_image(), generate_with_html2image(), generate_with_playwright(), generate_with_selenium(), main(), browser(), _browser_sleep(), BrowserTest (+9 more)
### Community 4 - "Audio UI (JS)"
Cohesion: 0.11
Nodes (58): applyAudioStatus(), applyServerAudioUiFields(), audioRunPreferredDeviceId(), beatSyncButtonTitle(), bind(), clampLiveBpm(), clampSimulatedBpm(), clearBeatPhaseTimers() (+50 more)
### Community 5 - "ESP-NOW TX & DMX Pulse"
Cohesion: 0.07
Nodes (19): beat_set_callback(), bench_on_beat_tx(), bench_on_echo(), bench_running(), bench_start(), bench_stop(), gen_cb(), gpio_mark() (+11 more)
### Community 6 - "Driver OTA over ESP-NOW"
Cohesion: 0.10
Nodes (30): handle(), _makedirs(), Ota, _remove(), safe_path(), _hash_file(), load(), _normalize_path() (+22 more)
### Community 7 - "led-tool Device CLI"
Cohesion: 0.08
Nodes (15): download_presets(), download_settings(), _get_ordered_actions(), main(), resolve_flash_binary(), upload_presets(), upload_settings(), copy_file() (+7 more)
### Community 9 - "Compiler"
Cohesion: 0.13
Nodes (4): Loader, Loader, Compiler, Loader
### Community 10 - "Spec: Pi Animation Engine"
Cohesion: 0.07
Nodes (46): Pi Animation Engine (src/engine), docs/API.md, Beat Counter and Phases, Beat Detection Device, Binary Message Protocol, BPM Sync, Dashboard UI (dashboard.html), usqlite Database Schema (presets, profiles, scenes, scene_groups) (+38 more)
### Community 11 - "Beat Sync on Driver"
Cohesion: 0.07
Nodes (37): BeatSync, _diff(), _due(), LinkRx, send(), frame(), run(), test_bad_frames() (+29 more)
### Community 12 - "Presets UI (JS)"
Cohesion: 0.09
Nodes (42): arrayToGrid(), coerceManualBeatN(), coercePresetAuto(), coercePresetBackground(), coercePresetInt(), createPresetButton(), deviceNamesForPresetOnCurrentZone(), editPresetFromTab() (+34 more)
### Community 13 - "Zones UI (JS)"
Cohesion: 0.10
Nodes (42): applyBrightnessSliders(), applyZoneContentKindEditModal(), clamp255(), computeZoneNamesTargets(), computeZonePresetUnionTargets(), computeZoneTargets(), createZone(), effectiveGroupIdsForZonePreset() (+34 more)
### Community 14 - "Pattern Store & Web (C)"
Cohesion: 0.25
Nodes (17): add_name(), base_name(), builtin(), create_driver_pattern(), create_pattern(), exists(), file_names(), file_path() (+9 more)
### Community 15 - "ESP-NOW Receive Tests"
Cohesion: 0.12
Nodes (14): get_wdt(), main(), MockESPNow, run_main_loop_iterations(), test_beat_functionality(), test_color_conversion(), test_full_message(), test_preset_creation() (+6 more)
### Community 16 - "Sequences UI (JS)"
Cohesion: 0.11
Nodes (33): addSequenceToTab(), appendZoneSequenceTiles(), applySequenceSwitchWaitFromServer(), buildLaneGroupIdsForEditor(), collectLanesFromEditor(), createSequenceTileRow(), deleteCurrentSequence(), fetchGroupsMapSeq() (+25 more)
### Community 17 - "Driver Controller Messages"
Cohesion: 0.09
Nodes (26): apply_brightness(), apply_clear_presets(), apply_default(), apply_device_config(), apply_patterns_ota(), apply_presets(), apply_select(), _config_flag() (+18 more)
### Community 18 - "ESP-IDF System Deps"
Cohesion: 0.07
Nodes (15): audio_api_register(), app_main(), eth_event_handler(), gateway_answers(), got_ip_event_handler(), have_static_ips(), parse_static(), settings_str() (+7 more)
### Community 19 - "led_strip Component Docs"
Cohesion: 0.10
Nodes (36): led_test ESP-IDF project, led_test main component (main.c), led_strip API Reference, led_model_t (WS2812/SK6812), led_pixel_format_t (GRB/GRBW), led_strip_clear(), led_strip_config_t, led_strip_del() (+28 more)
### Community 20 - "Art-Net Output"
Cohesion: 0.10
Nodes (9): ArtNet, as_channels(), build_artdmx(), _ip_bytes(), _pad(), port_lo(), ticks_diff(), ticks_ms() (+1 more)
### Community 21 - "Reliable ESP-NOW Link (C)"
Cohesion: 0.09
Nodes (21): skip_unresponsive(), espnow_tx_stats(), status_get_handler(), mic_get_level(), full_mask(), handle_rx(), peer_get(), record_done() (+13 more)
### Community 22 - "led-test RMT Example"
Cohesion: 0.13
Nodes (19): app_main(), app_main(), configure_led(), app_main(), configure_led(), led_strip_rmt_config_t, led_model_t, led_pixel_format_t (+11 more)
### Community 25 - "Microdot App (dmx)"
Cohesion: 0.07
Nodes (4): Microdot, mro(), _mro(), print_exception()
### Community 26 - "Microdot App (led)"
Cohesion: 0.07
Nodes (4): Microdot, mro(), _mro(), print_exception()
### Community 27 - "engine.c"
Cohesion: 0.05
Nodes (103): audio_handler(), audio_run(), events(), events_task(), ok_with_status(), send_all(), send_event(), send_json() (+95 more)
### Community 28 - "Devices UI (JS)"
Cohesion: 0.11
Nodes (30): applyEspnowPingAggregateToDots(), applyEspnowPingToDeviceRows(), applyTcpSnapshot(), applyTransportVisibility(), collectDeviceEditPayload(), createDeviceFromModal(), createDeviceIdentifyButton(), DEVICE_DOT_CLASSES (+22 more)
### Community 29 - "DMX Driver HTTP App"
Cohesion: 0.09
Nodes (9): _expand(), _preset_from_map(), process_data(), _select_entries(), _targets_for_key(), create_app(), serial_ports(), ws_handler() (+1 more)
### Community 30 - "Colour Picker Mockups"
Cohesion: 0.11
Nodes (25): Chromium-style Color Picker Demo, ColorPickerChromium Component, updateColors() (Chromium demo), Custom Color Picker Demo, updateColors() (standard demo), Custom Colour Picker README, POST /api/colors (example), ColorPicker Component (+17 more)
### Community 31 - "ESP-NOW Wire & Transport"
Cohesion: 0.14
Nodes (21): make_sender(), _dlog(), espnow_receive_loop(), _handle_packet(), init_espnow(), _schedule_ping_rsp(), send_boot_announce(), _send_ping_rsp() (+13 more)
### Community 32 - "Audio Capture (C)"
Cohesion: 0.07
Nodes (26): Pulse, audio_get_handler(), audio_register(), audio_stream_task(), beats_get_handler(), beats_stream_task(), send_all(), tap_post_handler() (+18 more)
### Community 33 - "Driver OTA Broadcast (C)"
Cohesion: 0.19
Nodes (18): broadcast_chunks(), chunk_done(), command(), data_pkt(), drain_status(), drv_ota_register(), drv_ota_send(), finish() (+10 more)
### Community 34 - "API Tests: Sequences & Bundles"
Cohesion: 0.13
Nodes (15): unique(), test_clone(), test_delete(), test_put(), test_put_current(), clock(), presets(), test_editing_stops_playback() (+7 more)
### Community 35 - "Binary Envelope (test)"
Cohesion: 0.15
Nodes (17): brightness_0_255_from_wire(), brightness_wire_from_0_255(), _clamp_i16(), _colors_to_rgb_list(), _decode_default_blob(), _decode_preset_record(), _decode_presets_blob(), _decode_select_blob() (+9 more)
### Community 36 - "API Docs: Outputs & Audio"
Cohesion: 0.14
Nodes (23): Art-Net output (UDP 6454), Audio API /api/audio and /audio page routes, Profile/preset/sequence JSON bundles (import/export), Combined brightness (global x groups x device x zone), /db collection export and replace, Devices resource /devices, Driver group membership lists (group ids, z<zone id>), Device groups resource /groups (+15 more)
### Community 38 - "Driver WiFi & Background Tasks"
Cohesion: 0.12
Nodes (10): presets_loop(), apply_startup_pattern(), print_mem(), snapshot(), initialize_runtime(), boot_sta(), connect_until_up(), _one_association_campaign() (+2 more)
### Community 39 - "Beat Detection DSP (C)"
Cohesion: 0.27
Nodes (16): beat_feed(), analyse_beat(), bar_cue(), bar_decide(), beat_dsp_feed(), beat_dsp_init(), beat_dsp_tap(), best_phase() (+8 more)
### Community 40 - "tests/patterns/bar_graph.py"
Cohesion: 0.29
Nodes (4): main(), run_for(), main(), run_for()
### Community 41 - "Compiler"
Cohesion: 0.13
Nodes (4): Loader, Loader, Compiler, Loader
### Community 42 - "presets.py"
Cohesion: 0.24
Nodes (4): is_reversed(), led_i(), signed(), convert_and_reorder_colors()
### Community 43 - "Driver Test Runner"
Cohesion: 0.18
Nodes (17): _bootstrap_import_path(), _pattern_loaded(), _process_message(), run_all(), _smoke_preset(), test_colour_conversion_and_transition(), test_default_requires_existing_preset(), test_default_targets_gate_by_device_name() (+9 more)
### Community 44 - "Microdot Helpers"
Cohesion: 0.11
Nodes (4): Request, G, urldecode_bytes(), urldecode_str()
### Community 45 - "Bridge WebSocket Blink Test"
Cohesion: 0.11
Nodes (10): build_blink_envelope(), _format_mac(), _load_bridge_url(), main(), _send(), print_settings(), _default_image(), _info() (+2 more)
### Community 46 - "find_id_by_field"
Cohesion: 0.33
Nodes (4): find_id_by_field(), test_scenes(), test_crud(), test_crud()
### Community 47 - "USB Latency Tools"
Cohesion: 0.15
Nodes (10): analyze(), edges(), main(), pct(), read(), fit_clock(), main(), pct() (+2 more)
### Community 50 - "led_strip_rmt_encoder.c"
Cohesion: 0.15
Nodes (10): led_strip_rmt_clear(), led_strip_rmt_del(), led_strip_rmt_refresh(), led_strip_rmt_set_pixel(), led_strip_rmt_set_pixel_rgbw(), led_strip_encoder_config_t, rmt_del_led_strip_encoder(), rmt_encode_led_strip() (+2 more)
### Community 52 - "Presets & Settings Mockups"
Cohesion: 0.14
Nodes (3): _convert_filesystem_error(), stdout_write_bytes(), Transport
### Community 53 - "mpremote Transport"
Cohesion: 0.12
Nodes (20): Presets Mockup Page, addColorPicker() / initializeColorPickers(), ColorPicker component (color-picker.js / color-picker.css), Preset Delay (animation speed, 10-1000 ms), ESPNow preset distribution, filterPresets() / sortPresets() search, filter and sort, LED Patterns (on, off, blink, chase, circle, pulse, rainbow, transition), Pattern Parameters N1-N8 (+12 more)
### Community 54 - "Outputs Config (C)"
Cohesion: 0.23
Nodes (16): defaults(), fail(), fill(), int_field(), num(), one_of(), put16(), resolve() (+8 more)
### Community 55 - "Microdot Handlers (dmx)"
Cohesion: 0.11
Nodes (5): invoke_handler(), iscoroutine(), Response, aclose(), __anext__()
### Community 57 - "led_strip_spi_dev.c"
Cohesion: 0.15
Nodes (13): led_strip_spi_config_t, led_strip_rmt_clear(), led_strip_rmt_del(), led_strip_rmt_refresh(), led_strip_rmt_set_pixel(), ws2812_rmt_adapter(), led_strip_new_spi_device(), __led_strip_spi_bit() (+5 more)
### Community 58 - "Microdot Handlers (led)"
Cohesion: 0.11
Nodes (5): invoke_handler(), iscoroutine(), Response, aclose(), __anext__()
### Community 60 - "mpremote Serial Transport"
Cohesion: 0.18
Nodes (3): SerialTransport, TransportError, TransportExecError
### Community 61 - "API Test Fixtures & Audio"
Cohesion: 0.17
Nodes (5): base_url(), c(), Client, profile(), restore_db()
### Community 62 - "Microdot Request (dmx)"
Cohesion: 0.13
Nodes (4): Request, G, urldecode_bytes(), urldecode_str()
### Community 63 - "Help: Zones & Palette"
Cohesion: 0.13
Nodes (18): Colour Palette (per profile), Zone default preset (default hint), DJ zone starter option, From Palette linked colours, LED driver JSON (presets, select, save, default, manifest), Patterns dialog, POST /presets/send, Preset editor (Try, Save, Send, Manual) (+10 more)
### Community 64 - "Network & WebSocket (C)"
Cohesion: 0.44
Nodes (5): forward(), on_open(), send_text(), ws_handler(), ws_register()
### Community 65 - "Driver OTA Tool"
Cohesion: 0.09
Nodes (9): Controller, file_set(), walk(), main(), norm_mac(), push(), wait_back(), info() (+1 more)
### Community 66 - "api_error"
Cohesion: 0.19
Nodes (22): api_body(), api_error(), api_json(), api_merge(), api_message(), api_preset_in_profile(), api_result(), api_split() (+14 more)
### Community 68 - "API Tests: Zones"
Cohesion: 0.10
Nodes (10): new_id(), test_preset_round_trip(), test_profile_round_trip(), test_sequence_round_trip(), test_clone(), test_clone_default_name(), test_delete_removes_from_profile(), test_play_and_stop() (+2 more)
### Community 70 - "Index Page Modals"
Cohesion: 0.11
Nodes (19): Audio Beat Detection modal, Header BPM / beat sync indicator, Colour Palette modal, Devices modal, Edit device modal, Edit Zone modal, Device groups modal, Header global brightness slider (+11 more)
### Community 75 - "board.py"
Cohesion: 0.20
Nodes (5): apply_cpu_freq(), default_led_pin(), mcu(), upload_pattern(), _safe_pattern_filename()
### Community 76 - "Controller Overview & OTA Docs"
Cohesion: 0.17
Nodes (16): led_controller ESP-IDF project, POST /patterns/upload (led-driver parity), Driver app update /drivers/ota (staged files, sha, commit/abort), Firmware OTA /ota (idle slot, rollback), Patterns resource /patterns, Driver app update over ESP-NOW test (tools/driver_ota.py), led-simulator, led-tool / led-cli serial device CLI (+8 more)
### Community 78 - "Driver Hello Discovery"
Cohesion: 0.17
Nodes (8): broadcast_hello_udp(), discover_controller_udp(), ipv4_broadcast(), pack_hello_bytes(), pack_hello_dict(), pack_hello_line(), udp_discovery_targets(), _udp_discovery_targets_single()
### Community 79 - "Audio Monitor Page"
Cohesion: 0.16
Nodes (16): /audio.wav live PCM stream, bar() bar-position renderer, /beats SSE event stream, draw() timeline canvas, Listen button (WAV stream playback via AudioContext), median(), Audio and beats page (/audio), stats() tap vs computer agreement (+8 more)
### Community 80 - "Art-Net DMX Tests"
Cohesion: 0.23
Nodes (9): parse(), _assert_eq(), main(), test_artnet_send_loopback(), test_build_artdmx(), test_fixture_patch(), test_pattern_blink_and_select(), test_pattern_upload() (+1 more)
### Community 81 - "DMX Output Manager"
Cohesion: 0.18
Nodes (3): main(), output_tick(), OutputManager
### Community 82 - "machine"
Cohesion: 0.12
Nodes (14): Blink, _mac_hex(), run_diag(), recv_loop(), _set_channel(), _add_peer(), send_once(), _set_channel() (+6 more)
### Community 84 - "API Tests: Groups"
Cohesion: 0.14
Nodes (4): device(), group(), test_group_identify_needs_devices(), test_profile_scoped_group()
### Community 85 - "ESP-NOW Sender Bridge"
Cohesion: 0.24
Nodes (9): _broadcast_ws(), _espnow_receive_loop(), _init_espnow(), main(), _send_espnow(), _validate_envelope(), ws(), format_mac() (+1 more)
### Community 86 - "Firmware OTA (C)"
Cohesion: 0.19
Nodes (5): fail(), ota_get_handler(), ota_post_handler(), ota_register(), reboot_post_handler()
### Community 90 - "API Tests: Presets"
Cohesion: 0.15
Nodes (4): preset(), test_create_belongs_to_current_profile(), test_create_fills_defaults(), test_presets_scoped_to_profile()
### Community 92 - "Bench Test Plan"
Cohesion: 0.23
Nodes (9): Bench endpoints /test/loss and /test/beats, 30 ms beat lead (CONFIG_BEAT_LEAD_MS), Bench test: S3 controller and one LED driver, ESP32-C3 vs S3 driver comparison, Logic analyzer latency (marker GPIO, tools/analyze_edges.py), Lossy-link test (simulated loss, retries, resync), Reliable link (rel: acked unicast, retransmits, ack timeouts), Bench troubleshooting (serial ports, channel mismatch, blank UI) (+1 more)
### Community 94 - "Flame Pattern"
Cohesion: 0.26
Nodes (6): _clamp(), Flame, _lerp_chan(), _lerp_rgb(), _palette_sample(), _triangle_255()
### Community 95 - "Microdot Auth (dmx)"
Cohesion: 0.20
Nodes (3): websocket_upgrade(), websocket_wrapper(), with_websocket()
### Community 96 - "Serial DMX & WiFi"
Cohesion: 0.19
Nodes (4): sleep_ms(), SerialDMX, sleep(), ap()
### Community 99 - "Twinkle Pattern"
Cohesion: 0.23
Nodes (6): Twinkle, cluster_base_index(), cluster_len_bounds(), dark_adjacent(), light_adjacent(), random_cluster_len()
### Community 101 - "Groups UI (JS)"
Cohesion: 0.29
Nodes (9): fetchDevicesMapForGroups(), fetchGroupsMap(), identifyGroupById(), loadGroupsModal(), loadWifiFieldsFromGroup(), openEditGroupModal(), renderGroupDevicesEditor(), renderGroupsList() (+1 more)
### Community 102 - "Microdot Auth (led)"
Cohesion: 0.22
Nodes (3): websocket_upgrade(), websocket_wrapper(), with_websocket()
### Community 103 - "Help: Mobile Menu Image"
Cohesion: 0.24
Nodes (10): Mobile Menu Help Illustration (narrow screen), Content Area (preset buttons), Menu Dropdown (Run mode, Profiles, Tabs, Presets, Help), Header Tab Buttons, Help, Menu Button (header dropdown trigger), Presets, Profiles (+2 more)
### Community 104 - "Pattern Selector Mockup Image"
Cohesion: 0.20
Nodes (11): Pattern Selector Mockup (Select LED Pattern), Apply Pattern / Cancel Actions, Blink Pattern, Chase Pattern, Circle Pattern, Off Pattern, On Pattern (solid color), Pattern Card Grid Layout (+3 more)
### Community 105 - "Driver Pattern Docs"
Cohesion: 0.24
Nodes (11): Message processing order (version, presets upsert, colour, selection), Auto vs manual (a) and manual chase flush, Built-in off / on patterns, Patterns and presets on the LED driver, MAX_PRESETS = 32, Pattern OTA via manifest / POST /patterns/upload, Pattern registry (Presets.reload_patterns), Preset short keys (p, c, d, b, a, bg, n1-n6) (+3 more)
### Community 109 - "Driver Message API Docs"
Cohesion: 0.38
Nodes (10): Auto vs manual mode, Beat (re-select same preset restarts generator), Hex colour conversion and colour-order reordering, LED Driver API (message format), Pattern-specific parameters (rainbow, pulse, transition, chase, circle), Preset fields (pattern, colors, delay, brightness, auto, n1-n6), Select message (device -> [preset, step]), Step synchronization (+2 more)
### Community 110 - "Driver Binary Envelope"
Cohesion: 0.38
Nodes (8): _brightness_0_255_from_wire(), _decode_default_blob(), _decode_preset_record(), _decode_presets_blob(), _decode_select_blob(), parse_binary_envelope(), parse_binary_envelope_v1(), parse_binary_envelope_v2()
### Community 111 - "led_strip Manifest"
Cohesion: 0.20
Nodes (9): dependencies, idf, description, repository, repository_info, commit_sha, path, url (+1 more)
### Community 113 - "Outputs UI (JS)"
Cohesion: 0.33
Nodes (8): fetchOutputs(), loadOutputsModal(), openOutputEditor(), OUTPUT_PROTOCOL_LABELS, outputSummary(), renderOutputsList(), setOutputField(), syncOutputProtocolFields()
### Community 114 - "DMX Driver Docs"
Cohesion: 0.25
Nodes (9): Controller WebSocket /ws (v1 presets/select), DMX Driver Art-Net and serial gateway, DMX fixture (output, start channel, role map; parcan/mover profiles), led-driver-style pattern engine (Preset object), Serial DMX512 output (250000 8N2), Binary envelope (main/envelope.c, test/binary_envelope.py), v1 driver messages (long/short keys), WebSocket /ws driver message relay (+1 more)
### Community 115 - "Help PDF: Overview"
Cohesion: 0.25
Nodes (9): API.md, LED controller user guide, Main web UI (Raspberry Pi app), Pattern OTA install over HTTP (/patterns/ota, upload, driver, send), Pattern parameters n1-n8, README, Serial to ESP-NOW bridge transport, WebSocket /ws (+1 more)
### Community 116 - "Mockups Index Image"
Cohesion: 0.31
Nodes (9): LED Driver UI Mockups Index (screenshot), Dashboard Mockup, Device Groups, Device Management Mockup, LED Patterns (On, Off, Blink, Chase, Circle, Pulse, Rainbow, Transition), N1-N8 Pattern Parameters, Pattern Selector Mockup, Presets Mockup (+1 more)
### Community 117 - "api_json"
Cohesion: 0.19
Nodes (27): api_body_opt(), api_effective_brightness(), api_identify_group(), clamp255(), create_device(), device_brightness(), device_config_from(), device_driver_config() (+19 more)
### Community 118 - "Help: Header Toolbar Image"
Cohesion: 0.29
Nodes (8): Header Toolbar Help Image, Edit Mode Action Bar, Run/Edit Mode Toggle Button, Patterns Action, Presets Action, Profiles Action, Header Tab Buttons, Tabs Action
### Community 119 - "Help: Preset Editor Image"
Cohesion: 0.29
Nodes (5): Default Action, Preset Pattern Selector, Preset Editor Modal (help illustration), Preset Name Field, Brightness, Delay and n1-n8 Parameters (0-255)
### Community 120 - "Dashboard Mockup Image"
Cohesion: 0.32
Nodes (8): LED Driver Control Panel Dashboard Mockup, Apply Settings Action, Brightness & Speed Card (Brightness % and Delay ms sliders), Colors Card (color swatches palette, Add Color), Connected Devices Card (devices with group and online status), Device Groups, Pattern Selection Card (On, Off, Blink, Chase, Circle, Pulse, Rainbow, Transition), Save to Device Action
### Community 121 - "Device Management Mockup Image"
Cohesion: 0.32
Nodes (8): + Add Device Button, Connected Devices List, Device Group, Device & Group Management Screen (mockup), Device Row Actions (edit, settings, stop), Online/Offline Status Badge, Devices / Groups Tab Switcher, LED Device (MAC, group, pattern)
### Community 122 - "Presets Mockup Image"
Cohesion: 0.32
Nodes (8): Preset Management UI Mockup, Apply Preset Action, Create Preset Action, LED Pattern Types (Rainbow, Pulse, Chase, Circle, Blink, Transition), Preset Card (name, pattern badge, color swatches, delay, n1, apply/edit/delete), Preset Search/Filter/Sort Toolbar (pattern filter, sort by name, grid/list toggle), Preset Parameters (colors, delay ms, n1), Sync Presets to All Devices
### Community 123 - "Pattern Contract"
Cohesion: 0.29
Nodes (6): Pattern Contract, Drawing via driver.n and apply_brightness, Pattern error handling (Presets.tick catches), Presets._load_dynamic_patterns(), Shared driver.step semantics, Global vs per-preset brightness
### Community 128 - "Blink Pattern Test"
Cohesion: 0.33
Nodes (3): _bootstrap_import_path(), main(), _run_ms()
### Community 129 - "Colour Picker Demo Image"
Cohesion: 0.33
Nodes (6): Custom Color Picker Demo (screenshot), Hex and RGB input support, HSB (Hue, Saturation, Brightness) color model, Keyboard accessible, customizable styling, Multiple Color Pickers for LED Patterns, Single Color Picker
### Community 130 - "Settings Mockup Image"
Cohesion: 0.33
Nodes (7): Advanced Settings (Step Counter, Step Increment, Device ID, Debug Mode), Basic Settings (Device Name, LED Pin, Number of LEDs), Color Order Selector (RGB/RBG/GRB/GBR/BRG/BGR), Device Settings Page Mockup, Network Settings (Access Point Name, Password, Enable AP), Pattern Parameters N1-N6, Pattern Settings (Pattern, Brightness, Delay)
### Community 135 - "api_set"
Cohesion: 0.27
Nodes (21): api_add(), api_id(), api_set(), add_ref(), bundle(), bundle_of(), bundles_route(), export_profile() (+13 more)
### Community 138 - "Help: Colour Palette Image"
Cohesion: 0.40
Nodes (6): Colour Palette modal mockup (help image), Add Swatch (+) Button, Colour Palette Modal, Palette Colour Swatches, Preset Editor 'From Palette', Profile (palette owner)
### Community 140 - "LED Driver README"
Cohesion: 0.47
Nodes (6): dev.py deploy/sync script, LED Driver README (MicroPython ESP32), Optional HTTP polling (http_poll.py), Wi-Fi TCP transport to Pi (port 8765), transport_type setting (wifi / espnow), UDP discovery (port 8766)
### Community 142 - "SPI Example Manifest"
Cohesion: 0.33
Nodes (5): dependencies, espressif/led_strip, idf, override_path, version
### Community 145 - "Help PDF: Modes"
Cohesion: 0.40
Nodes (4): Edit mode, Mobile layout Menu, Run mode, Zones modal
### Community 146 - "Help: Tab Preset Strip Image"
Cohesion: 0.60
Nodes (5): Help image: Main area brightness and preset tiles, Edit Mode: drag tiles to reorder, Global Brightness Slider, Preset Tile (gradient swatch, click to select on tab devices), Tab (e.g. lounge)
### Community 149 - "utime"
Cohesion: 0.06
Nodes (16): ClockSweep, Icicles, StrobeBurst, _timestamped_print(), main(), run_for(), main(), main() (+8 more)
### Community 156 - "RMT Example Manifest"
Cohesion: 0.40
Nodes (4): dependencies, espressif/led_strip, override_path, version
### Community 158 - "Settings Page Template"
Cohesion: 0.50
Nodes (4): Settings modal (device, network), loadEspnowChannel(), Device Settings page (ESP-NOW channel), wifi_channel setting (1-11)
### Community 159 - "groups_route"
Cohesion: 0.31
Nodes (15): add_error(), api_driver_config(), api_mac(), api_migrate_groups(), brightness(), driver_config(), find(), groups_route() (+7 more)
### Community 160 - "web.c"
Cohesion: 0.26
Nodes (12): audio_page_handler(), etag(), favicon_handler(), find_file(), index_handler(), mime_for(), send_gz(), static_handler() (+4 more)
### Community 161 - "sequences_route"
Cohesion: 0.26
Nodes (13): api_current_profile(), api_migrate_sequences(), api_sequence_defaults(), apply_update(), colors_from(), has_steps(), in_profile(), migrate_seq() (+5 more)
### Community 163 - "store_save"
Cohesion: 0.22
Nodes (7): index_of(), load_file(), mount(), store_init(), store_known(), store_next_id(), store_replace()
### Community 170 - "Controller Component Deps"
Cohesion: 0.50
Nodes (3): dependencies, espressif/mdns, joltwallet/littlefs
### Community 171 - "List Search (JS)"
Cohesion: 0.83
Nodes (3): applyListSearch(), initListSearch(), rowSearchText()
## Knowledge Gaps
- **97 isolated node(s):** `Design Guidelines`, `Device Management UI`, `Engine CLI`, `Output Drivers (DDP, Art-Net, sACN, USB-DMX)`, `Pixel Generator` (+92 more)
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 1030 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
- **90 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **Why does `unique()` connect `API Tests: Sequences & Bundles` to `API Tests: Zones`, `find_id_by_field`, `API Tests: Patterns`, `API Tests: Groups`, `API Tests: Presets`, `API Test Fixtures & Audio`?**
_High betweenness centrality (0.022) - this node is a cross-community bridge._
- **Are the 41 inferred relationships involving `Presets` (e.g. with `test_save_and_load_roundtrip()` and `_TestContext`) actually correct?**
_`Presets` has 41 INFERRED edges - model-reasoned connections that need verification._
- **What connects `Design Guidelines`, `Device Management UI`, `Engine CLI` to the rest of the system?**
_97 weakly-connected nodes found - possible documentation gaps or missing edges._
- **Should `htmx Library` be split into smaller, more focused modules?**
_Cohesion score 0.07897684839432412 - nodes in this community are weakly interconnected._
- **Why does `Microdot` connect `Microdot App (dmx)` to `HTTPException (dmx)`, `Microdot Routing (dmx)`, `Microdot Request (dmx)`?**
_High betweenness centrality (0.017) - this node is a cross-community bridge._
- **Are the 59 inferred relationships involving `store_coll()` (e.g. with `api_add()` and `api_current_profile()`) actually correct?**
_`store_coll()` has 59 INFERRED edges - model-reasoned connections that need verification._
- **Should `run_tick` be split into smaller, more focused modules?**
_Cohesion score 0.05782312925170068 - nodes in this community are weakly interconnected._
+12
View File
@@ -0,0 +1,12 @@
{
"runs": [
{
"date": "2026-11-03T12:13:15.159050+00:00",
"input_tokens": 1267015,
"output_tokens": 0,
"files": 332
}
],
"total_input_tokens": 1267015,
"total_output_tokens": 0
}
+1
View File
@@ -0,0 +1 @@
{"directed":false,"multigraph":false,"graph":{"hyperedges":[{"id":"audio_page_endpoints","label":"Audio page live endpoints","nodes":["web_audio_status","web_audio_beats","web_audio_audio_wav","web_audio_time","web_audio_tap_ep"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"web/audio.html"},{"id":"beat_latency_measurement","label":"Beat latency measurement methods","nodes":["docs_api_bench_endpoints","docs_bench_test_usb_latency","docs_bench_test_logic_analyzer","docs_bench_test_beat_lead"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/BENCH_TEST.md"},{"id":"brightness_combination","label":"Combined brightness factors","nodes":["docs_api_combined_brightness","docs_api_settings","docs_api_groups","docs_api_devices","docs_api_zones"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/API.md"},{"id":"color_picker_feature_set","label":"Color picker feature set","nodes":["docs_mockups_images_color_picker_demo_hsb_color_model","docs_mockups_images_color_picker_demo_hex_rgb_input","docs_mockups_images_color_picker_demo_keyboard_accessibility","docs_mockups_images_color_picker_demo_cross_platform_consistency"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/color-picker-demo.png"},{"id":"docs_help_edit_mode_management","label":"Edit-mode-only management features","nodes":["docs_help_edit_mode","docs_help_zones_modal","docs_help_send_presets","docs_help_patterns_dialog","docs_help_colour_palette","docs_help_presets_list"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/help.pdf"},{"id":"docs_help_preset_editor_actions","label":"Preset editor actions (Try, Default, Save & Send, Remove from zone)","nodes":["docs_help_try_action","docs_help_default_preset","docs_help_save_and_send","docs_help_remove_from_zone"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/help.pdf"},{"id":"docs_images_help_mobile_menu_header_actions","label":"Header actions aggregated in mobile Menu","nodes":["docs_images_help_mobile_menu_run_mode","docs_images_help_mobile_menu_profiles","docs_images_help_mobile_menu_tabs","docs_images_help_mobile_menu_presets","docs_images_help_mobile_menu_help"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/images/help/mobile-menu.svg"},{"id":"docs_mockups_device_modal_flow","label":"Device/Group Modal Flow","nodes":["docs_mockups_device_management_showadddevicemodal","docs_mockups_device_management_showaddgroupmodal","docs_mockups_device_management_closemodal","docs_mockups_device_management_savedevice"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/device-management.html"},{"id":"docs_mockups_images_index_ui_mockup_set","label":"LED Driver UI Mockup Set","nodes":["docs_mockups_images_index_dashboard_mockup","docs_mockups_images_index_pattern_selector_mockup","docs_mockups_images_index_device_management_mockup","docs_mockups_images_index_settings_mockup","docs_mockups_images_index_presets_mockup"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/index.png"},{"id":"docs_mockups_images_pattern_selector_led_patterns","label":"Selectable LED Patterns","nodes":["docs_mockups_images_pattern_selector_on","docs_mockups_images_pattern_selector_off","docs_mockups_images_pattern_selector_blink","docs_mockups_images_pattern_selector_chase","docs_mockups_images_pattern_selector_circle","docs_mockups_images_pattern_selector_pulse","docs_mockups_images_pattern_selector_rainbow","docs_mockups_images_pattern_selector_transition"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/pattern-selector.png"},{"id":"docs_mockups_preset_schema","label":"Preset/pattern configuration schema (pattern, colors, delay, step increment, N1-N8)","nodes":["docs_mockups_presets_led_patterns","docs_mockups_presets_delay","docs_mockups_presets_step_increment","docs_mockups_presets_n_parameters","docs_mockups_presets_step_offset"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/presets.html"},{"id":"docs_mockups_settings_sections","label":"Device settings sections","nodes":["docs_mockups_settings_basic_settings","docs_mockups_settings_pattern_settings","docs_mockups_settings_advanced_settings","docs_mockups_settings_network_settings"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/settings.html"},{"id":"docs_mockups_ui_mockup_suite","label":"LED Driver UI Mockup Suite","nodes":["docs_mockups_index","docs_mockups_dashboard","docs_mockups_pattern_selector","docs_mockups_device_management","docs_mockups_readme_settings_mockup","docs_mockups_color_picker_readme_presets_mockup"],"relation":"foLine truncated
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,160 @@
{
"1": "htmx Library",
"3": "Browser Tests & Mockup Images",
"4": "Audio UI (JS)",
"5": "ESP-NOW TX & DMX Pulse",
"6": "Driver OTA over ESP-NOW",
"7": "led-tool Device CLI",
"10": "Spec: Pi Animation Engine",
"11": "Beat Sync on Driver",
"12": "Presets UI (JS)",
"13": "Zones UI (JS)",
"14": "Pattern Store & Web (C)",
"15": "ESP-NOW Receive Tests",
"16": "Sequences UI (JS)",
"17": "Driver Controller Messages",
"19": "led_strip Component Docs",
"20": "Art-Net Output",
"21": "Reliable ESP-NOW Link (C)",
"22": "led-test RMT Example",
"23": "Driver Presets Store",
"25": "Microdot App (dmx)",
"26": "Microdot App (led)",
"28": "Devices UI (JS)",
"29": "DMX Driver HTTP App",
"30": "Colour Picker Mockups",
"31": "ESP-NOW Wire & Transport",
"32": "Audio Capture (C)",
"33": "Driver OTA Broadcast (C)",
"34": "API Tests: Sequences & Bundles",
"35": "Binary Envelope (test)",
"36": "API Docs: Outputs & Audio",
"37": "mpremote Commands",
"38": "Driver WiFi & Background Tasks",
"39": "Beat Detection DSP (C)",
"43": "Driver Test Runner",
"44": "Microdot Helpers",
"45": "Bridge WebSocket Blink Test",
"47": "USB Latency Tools",
"48": "Colour Picker JS",
"49": "Chromium Colour Picker JS",
"51": "API Tests: Devices",
"52": "Presets & Settings Mockups",
"53": "mpremote Transport",
"54": "Outputs Config (C)",
"55": "Microdot Handlers (dmx)",
"56": "MultiDict (dmx)",
"58": "Microdot Handlers (led)",
"59": "MultiDict (led)",
"60": "mpremote Serial Transport",
"61": "API Test Fixtures & Audio",
"62": "Microdot Request (dmx)",
"63": "Help: Zones & Palette",
"65": "Driver OTA Tool",
"68": "API Tests: Zones",
"69": "API Tests: Outputs & Routes",
"70": "Index Page Modals",
"71": "Microdot Templates (led)",
"72": "Microdot Templates (dmx)",
"73": "Microdot WebSocket (dmx)",
"74": "Microdot WebSocket (led)",
"76": "Controller Overview & OTA Docs",
"78": "Driver Hello Discovery",
"79": "Audio Monitor Page",
"80": "Art-Net DMX Tests",
"81": "DMX Output Manager",
"83": "Microdot Sessions (led)",
"84": "API Tests: Groups",
"85": "ESP-NOW Sender Bridge",
"86": "Firmware OTA (C)",
"87": "Microdot Async IO (dmx)",
"88": "DMX Settings",
"89": "Microdot Async IO (led)",
"90": "API Tests: Presets",
"91": "Microdot Routing (dmx)",
"92": "Bench Test Plan",
"93": "Microdot Routing (led)",
"94": "Flame Pattern",
"95": "Microdot Auth (dmx)",
"96": "Serial DMX & WiFi",
"97": "DMX Pattern Player",
"98": "DMX Preset Model",
"99": "Twinkle Pattern",
"100": "Driver Settings",
"101": "Groups UI (JS)",
"102": "Microdot Auth (led)",
"103": "Help: Mobile Menu Image",
"104": "Pattern Selector Mockup Image",
"105": "Driver Pattern Docs",
"106": "Driver Preset Model",
"108": "Microdot JWT Session",
"109": "Driver Message API Docs",
"110": "Driver Binary Envelope",
"111": "led_strip Manifest",
"112": "API Tests: Patterns",
"113": "Outputs UI (JS)",
"114": "DMX Driver Docs",
"115": "Help PDF: Overview",
"116": "Mockups Index Image",
"118": "Help: Header Toolbar Image",
"119": "Help: Preset Editor Image",
"120": "Dashboard Mockup Image",
"121": "Device Management Mockup Image",
"122": "Presets Mockup Image",
"123": "Pattern Contract",
"124": "Microdot SessionDict",
"125": "Meteor Pattern",
"127": "Numpad Shortcuts (JS)",
"128": "Blink Pattern Test",
"129": "Colour Picker Demo Image",
"130": "Settings Mockup Image",
"131": "Aurora Pattern",
"132": "Colour Cycle Pattern",
"133": "Sparkle Pattern",
"134": "API Tests: Settings",
"137": "HTTPException (dmx)",
"138": "Help: Colour Palette Image",
"139": "HTTPException (led)",
"140": "LED Driver README",
"141": "Palette Morph Pattern",
"142": "SPI Example Manifest",
"145": "Help PDF: Modes",
"146": "Help: Tab Preset Strip Image",
"147": "Blink Pattern",
"148": "Circle Pattern",
"151": "Plasma Pattern",
"152": "Radiate Pattern",
"153": "Transition Pattern",
"154": "Driver Runtime State",
"156": "RMT Example Manifest",
"157": "Help Tab JS",
"158": "Settings Page Template",
"168": "Rime Pattern",
"170": "Controller Component Deps",
"171": "List Search (JS)",
"172": "DMX Solid Pattern",
"173": "led-test Manifest",
"174": "VPN Autoconnect Script",
"175": "Zone Devices Panel",
"176": "graphify Instructions",
"177": "Microdot Package (dmx)",
"178": "Microdot Package (led)",
"179": "Env Check",
"180": "Device Mockup Modals",
"181": "bulk.sh Script",
"182": "deploy.sh Script",
"183": "Driver install.sh",
"184": "Pattern Package Init",
"185": "led-tool install.sh",
"186": "Help PDF Build Script",
"187": "Web Build Script",
"188": "Patterns UI (JS)",
"189": "DMX Patterns Init",
"190": "Mockup Tab Switch",
"191": "Spec: Pattern Selector UI",
"192": "mpremote Package",
"193": "Bundle Import/Export (JS)",
"194": "Colour Palette (JS)",
"195": "Profiles UI (JS)",
"196": "Zone Palette (JS)"
}
+763
View File
@@ -0,0 +1,763 @@
# Graph Report - led-controller (2026-11-09)
## Corpus Check
- 300 files · ~208,091 words
- Verdict: corpus is large enough that graph structure adds value.
- Unclassified: 43 file(s) not represented in the graph (top: (none) 23, .mdc 6, .lock 4)
## Summary
- 3458 nodes · 7695 edges · 203 communities (120 shown, 83 thin omitted)
- Extraction: 88% EXTRACTED · 12% INFERRED · 0% AMBIGUOUS · INFERRED: 931 edges (avg confidence: 0.86)
- Token cost: 0 input · 0 output
## Graph Freshness
- Built from commit: `06953028`
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost).
## Community Hubs (Navigation)
- store_coll
- htmx Library
- machine
- Browser Tests & Mockup Images
- Audio UI (JS)
- ESP-NOW TX & DMX Pulse
- Driver OTA over ESP-NOW
- led-tool Device CLI
- utime
- Compiler
- Spec: Pi Animation Engine
- Beat Sync on Driver
- Presets UI (JS)
- Zones UI (JS)
- Pattern Store & Web (C)
- ESP-NOW Receive Tests
- Sequences UI (JS)
- Driver Controller Messages
- led_strip Component Docs
- Art-Net Output
- Reliable ESP-NOW Link (C)
- led-test RMT Example
- Driver Presets Store
- serial
- Microdot App (dmx)
- Microdot App (led)
- engine.c
- Devices UI (JS)
- DMX Driver HTTP App
- Colour Picker Mockups
- ESP-NOW Wire & Transport
- Audio Capture (C)
- Driver OTA Broadcast (C)
- API Tests: Sequences & Bundles
- Binary Envelope (test)
- API Docs: Outputs & Audio
- mpremote Commands
- Driver WiFi & Background Tasks
- Beat Detection DSP (C)
- main/main.c
- test_espnow_ota.py
- presets.py
- Driver Test Runner
- Microdot Helpers
- Bridge WebSocket Blink Test
- find_id_by_field
- USB Latency Tools
- Colour Picker JS
- Chromium Colour Picker JS
- led_strip_spi_dev.c
- API Tests: Devices
- Presets & Settings Mockups
- mpremote Transport
- Outputs Config (C)
- Microdot Handlers (dmx)
- MultiDict (dmx)
- led_strip_rmt_dev.c
- Microdot Handlers (led)
- MultiDict (led)
- mpremote Serial Transport
- API Test Fixtures & Audio
- Microdot Request (dmx)
- Help: Zones & Palette
- test_espnow_rx.py
- Driver OTA Tool
- api_error
- SerialIntercept
- API Tests: Zones
- API Tests: Outputs & Routes
- Index Page Modals
- Microdot Templates (led)
- Microdot Templates (dmx)
- Microdot WebSocket (dmx)
- Microdot WebSocket (led)
- board.py
- Controller Overview & OTA Docs
- DMX
- Driver Hello Discovery
- Audio Monitor Page
- Art-Net DMX Tests
- DMX Output Manager
- network
- Microdot Sessions (led)
- API Tests: Groups
- ESP-NOW Sender Bridge
- Firmware OTA (C)
- Microdot Async IO (dmx)
- DMX Settings
- Microdot Async IO (led)
- API Tests: Presets
- Microdot Routing (dmx)
- Bench Test Plan
- Microdot Routing (led)
- Flame Pattern
- Microdot Auth (dmx)
- Serial DMX & WiFi
- DMX Pattern Player
- DMX Preset Model
- Twinkle Pattern
- Driver Settings
- Groups UI (JS)
- Microdot Auth (led)
- Help: Mobile Menu Image
- Pattern Selector Mockup Image
- Driver Pattern Docs
- Driver Preset Model
- Blizzard
- Microdot JWT Session
- Driver Message API Docs
- Driver Binary Envelope
- led_strip Manifest
- API Tests: Patterns
- Outputs UI (JS)
- DMX Driver Docs
- Help PDF: Overview
- Mockups Index Image
- api_json
- Help: Header Toolbar Image
- Help: Preset Editor Image
- Dashboard Mockup Image
- Device Management Mockup Image
- Presets Mockup Image
- Pattern Contract
- Microdot SessionDict
- Meteor Pattern
- store_save
- Numpad Shortcuts (JS)
- Blink Pattern Test
- Colour Picker Demo Image
- Settings Mockup Image
- Aurora Pattern
- Colour Cycle Pattern
- Sparkle Pattern
- api_set
- LinkRx
- HTTPException (dmx)
- Help: Colour Palette Image
- HTTPException (led)
- LED Driver README
- Palette Morph Pattern
- SPI Example Manifest
- unique
- settings_editor.js
- Help PDF: Modes
- Help: Tab Preset Strip Image
- Blink Pattern
- Circle Pattern
- test_mdns.py
- wave.py
- Plasma Pattern
- Radiate Pattern
- Transition Pattern
- Driver Runtime State
- tests/patterns/orbit.py
- RMT Example Manifest
- Help Tab JS
- Settings Page Template
- groups_route
- web.c
- sequences_route
- tests/patterns/circle.py
- web.py
- test_wifi.py
- Flicker
- tests/patterns/aurora.py
- snowfall.py
- Rime Pattern
- Orbit
- Controller Component Deps
- List Search (JS)
- DMX Solid Pattern
- led-test Manifest
- VPN Autoconnect Script
- graphify Instructions
- bulk.sh Script
- deploy.sh Script
- Driver install.sh
- led-tool install.sh
- Help PDF Build Script
- Web Build Script
- Spec: Pattern Selector UI
- StrobeBurst
- BarGraph
- asyncio
- udp_client.py
- Icicles
- gradient_scroll.py
## God Nodes (most connected - your core abstractions)
1. `Presets` - 67 edges
2. `store_coll()` - 64 edges
3. `api_error()` - 50 edges
4. `api_json()` - 43 edges
5. `api_set()` - 37 edges
6. `store_save()` - 37 edges
7. `unique()` - 37 edges
8. `new_id()` - 35 edges
9. `run_tick()` - 33 edges
10. `api_id()` - 28 edges
## Surprising Connections (you probably didn't know these)
- `Preset editor modal` --semantically_similar_to--> `Preset fields (pattern, colors, delay, brightness, auto, n1-n6)` [INFERRED] [semantically similar]
web/templates/index.html → led-driver/docs/API.md
- `led-driver-style pattern engine (Preset object)` --semantically_similar_to--> `led-driver MicroPython firmware (submodule)` [INFERRED] [semantically similar]
dmx-driver/README.md → README.md
- `espnow-sender Microdot WebSocket receiver` --semantically_similar_to--> `WebSocket /ws driver message relay` [INFERRED] [semantically similar]
espnow-sender/README.md → docs/API.md
- `Art-Net output (UDP 6454)` --semantically_similar_to--> `Outputs (DDP, Art-Net, sACN, DMX serial pixel fixtures)` [INFERRED] [semantically similar]
dmx-driver/README.md → docs/API.md
- `POST /patterns/upload (led-driver parity)` --semantically_similar_to--> `Patterns resource /patterns` [INFERRED] [semantically similar]
dmx-driver/README.md → docs/API.md
## Import Cycles
- None detected.
## Hyperedges (group relationships)
- **Audio page live endpoints** — web_audio_status, web_audio_beats, web_audio_audio_wav, web_audio_time, web_audio_tap_ep [EXTRACTED 1.00]
- **Beat latency measurement methods** — docs_api_bench_endpoints, docs_bench_test_usb_latency, docs_bench_test_logic_analyzer, docs_bench_test_beat_lead [EXTRACTED 1.00]
- **Combined brightness factors** — docs_api_combined_brightness, docs_api_settings, docs_api_groups, docs_api_devices, docs_api_zones [EXTRACTED 1.00]
- **Color picker feature set** — docs_mockups_images_color_picker_demo_hsb_color_model, docs_mockups_images_color_picker_demo_hex_rgb_input, docs_mockups_images_color_picker_demo_keyboard_accessibility, docs_mockups_images_color_picker_demo_cross_platform_consistency [EXTRACTED 1.00]
- **Edit-mode-only management features** — docs_help_edit_mode, docs_help_zones_modal, docs_help_send_presets, docs_help_patterns_dialog, docs_help_colour_palette, docs_help_presets_list [EXTRACTED 1.00]
- **Preset editor actions (Try, Default, Save & Send, Remove from zone)** — docs_help_try_action, docs_help_default_preset, docs_help_save_and_send, docs_help_remove_from_zone [EXTRACTED 1.00]
- **Header actions aggregated in mobile Menu** — docs_images_help_mobile_menu_run_mode, docs_images_help_mobile_menu_profiles, docs_images_help_mobile_menu_tabs, docs_images_help_mobile_menu_presets, docs_images_help_mobile_menu_help [EXTRACTED 1.00]
- **Device/Group Modal Flow** — docs_mockups_device_management_showadddevicemodal, docs_mockups_device_management_showaddgroupmodal, docs_mockups_device_management_closemodal, docs_mockups_device_management_savedevice [EXTRACTED 1.00]
- **LED Driver UI Mockup Set** — docs_mockups_images_index_dashboard_mockup, docs_mockups_images_index_pattern_selector_mockup, docs_mockups_images_index_device_management_mockup, docs_mockups_images_index_settings_mockup, docs_mockups_images_index_presets_mockup [EXTRACTED 1.00]
- **Selectable LED Patterns** — docs_mockups_images_pattern_selector_on, docs_mockups_images_pattern_selector_off, docs_mockups_images_pattern_selector_blink, docs_mockups_images_pattern_selector_chase, docs_mockups_images_pattern_selector_circle, docs_mockups_images_pattern_selector_pulse, docs_mockups_images_pattern_selector_rainbow, docs_mockups_images_pattern_selector_transition [EXTRACTED 1.00]
- **Preset/pattern configuration schema (pattern, colors, delay, step increment, N1-N8)** — docs_mockups_presets_led_patterns, docs_mockups_presets_delay, docs_mockups_presets_step_increment, docs_mockups_presets_n_parameters, docs_mockups_presets_step_offset [EXTRACTED 1.00]
- **Device settings sections** — docs_mockups_settings_basic_settings, docs_mockups_settings_pattern_settings, docs_mockups_settings_advanced_settings, docs_mockups_settings_network_settings [EXTRACTED 1.00]
- **LED Driver UI Mockup Suite** — docs_mockups_index, docs_mockups_dashboard, docs_mockups_pattern_selector, docs_mockups_device_management, docs_mockups_readme_settings_mockup, docs_mockups_color_picker_readme_presets_mockup [EXTRACTED 1.00]
- **Pi-to-ESP32 Command Paths** — docs_specification_serial_espnow_bridge, docs_specification_wifi_driver_tcp, docs_specification_espnow, docs_specification_pi_controller [EXTRACTED 1.00]
- **led_strip backend choice (RMT vs SPI, DMA)** — scripts_led_test_managed_components_espressif__led_strip_readme_rmt_backend, scripts_led_test_managed_components_espressif__led_strip_readme_spi_backend, scripts_led_test_managed_components_espressif__led_strip_readme_dma_support, scripts_led_test_managed_components_espressif__led_strip_readme_backend_selection_flowchart [EXTRACTED 1.00]
- **led_strip pixel write and flush flow** — scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel_hsv, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_set_pixel_rgbw, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_refresh, scripts_led_test_managed_components_espressif__led_strip_api_led_strip_clear [EXTRACTED 1.00]
- **Dynamic pattern contract** — led_driver_docs_pattern_contract_class_shape, led_driver_docs_pattern_contract_run_generator_rules, led_driver_docs_pattern_contract_drawing_brightness, led_driver_docs_pattern_contract_step_semantics, led_driver_docs_pattern_contract_error_handling [EXTRACTED 1.00]
- **Pi Animation Engine Output Pipeline** — docs_specification_pixel_generator, docs_specification_output_drivers, docs_specification_output_record, docs_specification_zone_playback, docs_specification_sequencer [EXTRACTED 1.00]
- **Beat-Driven Scene Activation** — docs_specification_beat_detection_device, docs_specification_bpm_sync, docs_specification_beat_counter_phases, docs_specification_scene_queue [INFERRED 0.85]
- **Fields defining an LED preset (name, pattern, colours, parameters)** — docs_images_help_preset_editor_preset_name_field, docs_images_help_preset_editor_pattern_selector, docs_images_help_preset_editor_palette_linked_colour, docs_images_help_preset_editor_preset_parameters [INFERRED 0.85]
- **Pattern settings composed and applied to devices** — docs_mockups_images_dashboard_pattern_selection, docs_mockups_images_dashboard_brightness_speed, docs_mockups_images_dashboard_colors, docs_mockups_images_dashboard_apply_settings [INFERRED 0.85]
- **Preset lifecycle actions (create, apply, sync)** — docs_mockups_images_presets_create_preset, docs_mockups_images_presets_apply_preset, docs_mockups_images_presets_sync_presets_to_all_devices [INFERRED 0.85]
- **ESP-NOW driver delivery layers** — docs_api_binary_envelope, docs_api_delivery_digest, docs_bench_test_reliable_link, docs_bench_test_beat_double_send [INFERRED 0.85]
- **v1 message handling on driver** — led_driver_docs_api_v1_message, led_driver_docs_patterns_process_data_flow, led_driver_docs_patterns_pattern_registry, led_driver_docs_patterns_preset_short_keys, led_driver_docs_api_select_message [INFERRED 0.85]
## Communities (203 total, 83 thin omitted)
### Community 0 - "store_coll"
Cohesion: 0.26
Nodes (25): engine_groups_changed(), api_migrate_zones(), api_preset_defaults(), clone_profile(), clone_zone(), content_fragment(), create_profile(), create_zone() (+17 more)
### Community 1 - "htmx Library"
Cohesion: 0.08
Nodes (101): a(), Ae(), an(), at(), B(), be(), bn(), bt() (+93 more)
### Community 2 - "machine"
Cohesion: 0.05
Nodes (33): run_tick(), recv_loop(), _set_channel(), main(), run_for(), main(), run_for(), main() (+25 more)
### Community 3 - "Browser Tests & Mockup Images"
Cohesion: 0.06
Nodes (17): generate_image(), generate_with_html2image(), generate_with_playwright(), generate_with_selenium(), main(), browser(), _browser_sleep(), BrowserTest (+9 more)
### Community 4 - "Audio UI (JS)"
Cohesion: 0.11
Nodes (58): applyAudioStatus(), applyServerAudioUiFields(), audioRunPreferredDeviceId(), beatSyncButtonTitle(), bind(), clampLiveBpm(), clampSimulatedBpm(), clearBeatPhaseTimers() (+50 more)
### Community 5 - "ESP-NOW TX & DMX Pulse"
Cohesion: 0.07
Nodes (19): bench_on_beat_tx(), bench_on_echo(), bench_results(), bench_running(), bench_start(), bench_stop(), gen_cb(), gpio_mark() (+11 more)
### Community 6 - "Driver OTA over ESP-NOW"
Cohesion: 0.14
Nodes (11): handle(), _makedirs(), Ota, _remove(), safe_path(), _hash_file(), load(), _normalize_path() (+3 more)
### Community 7 - "led-tool Device CLI"
Cohesion: 0.08
Nodes (13): download_presets(), download_settings(), _get_ordered_actions(), main(), print_settings(), resolve_flash_binary(), upload_presets(), upload_settings() (+5 more)
### Community 8 - "utime"
Cohesion: 0.06
Nodes (12): _drain(), CandleGlow, Chase, ClockSweep, Particles, style_mode(), Pulse, RainDrops (+4 more)
### Community 9 - "Compiler"
Cohesion: 0.06
Nodes (8): Loader, Loader, Compiler, Loader, Loader, Loader, Compiler, Loader
### Community 10 - "Spec: Pi Animation Engine"
Cohesion: 0.07
Nodes (46): Pi Animation Engine (src/engine), docs/API.md, Beat Counter and Phases, Beat Detection Device, Binary Message Protocol, BPM Sync, Dashboard UI (dashboard.html), usqlite Database Schema (presets, profiles, scenes, scene_groups) (+38 more)
### Community 11 - "Beat Sync on Driver"
Cohesion: 0.15
Nodes (16): BeatSync, _diff(), frame(), run(), test_bad_frames(), test_both_copies(), test_controller_restart_is_followed(), test_free_run_covers_missed_beat() (+8 more)
### Community 12 - "Presets UI (JS)"
Cohesion: 0.09
Nodes (42): arrayToGrid(), coerceManualBeatN(), coercePresetAuto(), coercePresetBackground(), coercePresetInt(), createPresetButton(), deviceNamesForPresetOnCurrentZone(), editPresetFromTab() (+34 more)
### Community 13 - "Zones UI (JS)"
Cohesion: 0.10
Nodes (42): applyBrightnessSliders(), applyZoneContentKindEditModal(), clamp255(), computeZoneNamesTargets(), computeZonePresetUnionTargets(), computeZoneTargets(), createZone(), effectiveGroupIdsForZonePreset() (+34 more)
### Community 14 - "Pattern Store & Web (C)"
Cohesion: 0.22
Nodes (18): add_name(), base_name(), builtin(), create_driver_pattern(), create_pattern(), exists(), file_names(), file_path() (+10 more)
### Community 15 - "ESP-NOW Receive Tests"
Cohesion: 0.12
Nodes (14): get_wdt(), main(), MockESPNow, run_main_loop_iterations(), test_beat_functionality(), test_color_conversion(), test_full_message(), test_preset_creation() (+6 more)
### Community 16 - "Sequences UI (JS)"
Cohesion: 0.11
Nodes (33): addSequenceToTab(), appendZoneSequenceTiles(), applySequenceSwitchWaitFromServer(), buildLaneGroupIdsForEditor(), collectLanesFromEditor(), createSequenceTileRow(), deleteCurrentSequence(), fetchGroupsMapSeq() (+25 more)
### Community 17 - "Driver Controller Messages"
Cohesion: 0.08
Nodes (28): apply_brightness(), apply_clear_presets(), apply_default(), apply_device_config(), apply_patterns_ota(), apply_presets(), apply_select(), _config_flag() (+20 more)
### Community 19 - "led_strip Component Docs"
Cohesion: 0.10
Nodes (36): led_test ESP-IDF project, led_test main component (main.c), led_strip API Reference, led_model_t (WS2812/SK6812), led_pixel_format_t (GRB/GRBW), led_strip_clear(), led_strip_config_t, led_strip_del() (+28 more)
### Community 20 - "Art-Net Output"
Cohesion: 0.10
Nodes (9): ArtNet, as_channels(), build_artdmx(), _ip_bytes(), _pad(), port_lo(), ticks_diff(), ticks_ms() (+1 more)
### Community 21 - "Reliable ESP-NOW Link (C)"
Cohesion: 0.16
Nodes (16): skip_unresponsive(), espnow_tx_send(), full_mask(), handle_rx(), peer_get(), record_done(), rel_peer_status(), rel_send() (+8 more)
### Community 22 - "led-test RMT Example"
Cohesion: 0.33
Nodes (12): app_main(), app_main(), configure_led(), app_main(), configure_led(), led_strip_handle_t, led_strip_clear(), led_strip_del() (+4 more)
### Community 23 - "Driver Presets Store"
Cohesion: 0.08
Nodes (3): Presets, main(), run_for()
### Community 25 - "Microdot App (dmx)"
Cohesion: 0.07
Nodes (4): Microdot, mro(), _mro(), print_exception()
### Community 26 - "Microdot App (led)"
Cohesion: 0.07
Nodes (4): Microdot, mro(), _mro(), print_exception()
### Community 27 - "engine.c"
Cohesion: 0.05
Nodes (101): audio_handler(), audio_run(), events(), ok_with_status(), send_json(), setting_int(), status_payload(), beat_get_info() (+93 more)
### Community 28 - "Devices UI (JS)"
Cohesion: 0.11
Nodes (30): applyEspnowPingAggregateToDots(), applyEspnowPingToDeviceRows(), applyTcpSnapshot(), applyTransportVisibility(), collectDeviceEditPayload(), createDeviceFromModal(), createDeviceIdentifyButton(), DEVICE_DOT_CLASSES (+22 more)
### Community 29 - "DMX Driver HTTP App"
Cohesion: 0.09
Nodes (9): _expand(), _preset_from_map(), process_data(), _select_entries(), _targets_for_key(), create_app(), serial_ports(), ws_handler() (+1 more)
### Community 30 - "Colour Picker Mockups"
Cohesion: 0.11
Nodes (25): Chromium-style Color Picker Demo, ColorPickerChromium Component, updateColors() (Chromium demo), Custom Color Picker Demo, updateColors() (standard demo), Custom Colour Picker README, POST /api/colors (example), ColorPicker Component (+17 more)
### Community 31 - "ESP-NOW Wire & Transport"
Cohesion: 0.15
Nodes (20): make_sender(), _dlog(), espnow_receive_loop(), _handle_packet(), init_espnow(), _schedule_ping_rsp(), send_boot_announce(), _send_ping_rsp() (+12 more)
### Community 32 - "Audio Capture (C)"
Cohesion: 0.07
Nodes (28): events_task(), send_all(), send_event(), audio_get_handler(), audio_register(), audio_stream_task(), beats_get_handler(), beats_stream_task() (+20 more)
### Community 33 - "Driver OTA Broadcast (C)"
Cohesion: 0.20
Nodes (18): broadcast_chunks(), chunk_done(), command(), data_pkt(), drain_status(), drv_ota_register(), drv_ota_send(), finish() (+10 more)
### Community 34 - "API Tests: Sequences & Bundles"
Cohesion: 0.14
Nodes (15): new_id(), test_preset_round_trip(), test_profile_round_trip(), test_sequence_round_trip(), clock(), presets(), test_crud(), test_editing_stops_playback() (+7 more)
### Community 35 - "Binary Envelope (test)"
Cohesion: 0.15
Nodes (17): brightness_0_255_from_wire(), brightness_wire_from_0_255(), _clamp_i16(), _colors_to_rgb_list(), _decode_default_blob(), _decode_preset_record(), _decode_presets_blob(), _decode_select_blob() (+9 more)
### Community 36 - "API Docs: Outputs & Audio"
Cohesion: 0.14
Nodes (23): Art-Net output (UDP 6454), Audio API /api/audio and /audio page routes, Profile/preset/sequence JSON bundles (import/export), Combined brightness (global x groups x device x zone), /db collection export and replace, Devices resource /devices, Driver group membership lists (group ids, z<zone id>), Device groups resource /groups (+15 more)
### Community 38 - "Driver WiFi & Background Tasks"
Cohesion: 0.12
Nodes (10): presets_loop(), apply_startup_pattern(), print_mem(), snapshot(), initialize_runtime(), boot_sta(), connect_until_up(), _one_association_campaign() (+2 more)
### Community 39 - "Beat Detection DSP (C)"
Cohesion: 0.27
Nodes (16): beat_feed(), analyse_beat(), bar_cue(), bar_decide(), beat_dsp_feed(), beat_dsp_init(), beat_dsp_tap(), best_phase() (+8 more)
### Community 40 - "main/main.c"
Cohesion: 0.06
Nodes (24): audio_api_register(), espnow_tx_stats(), ap_button_held(), app_main(), dhcp_settled(), eth_event_handler(), gateway_answers(), got_ip_event_handler() (+16 more)
### Community 41 - "test_espnow_ota.py"
Cohesion: 0.14
Nodes (21): begin(), chunk(), cmd(), in_tmp(), nchunks(), Rig, test_abort_removes_staged(), test_bad_hash_is_not_staged() (+13 more)
### Community 42 - "presets.py"
Cohesion: 0.24
Nodes (4): is_reversed(), led_i(), signed(), convert_and_reorder_colors()
### Community 43 - "Driver Test Runner"
Cohesion: 0.17
Nodes (17): _bootstrap_import_path(), _pattern_loaded(), _process_message(), run_all(), _smoke_preset(), test_colour_conversion_and_transition(), test_default_requires_existing_preset(), test_default_targets_gate_by_device_name() (+9 more)
### Community 44 - "Microdot Helpers"
Cohesion: 0.11
Nodes (4): Request, G, urldecode_bytes(), urldecode_str()
### Community 45 - "Bridge WebSocket Blink Test"
Cohesion: 0.12
Nodes (9): build_blink_envelope(), _format_mac(), _load_bridge_url(), main(), _send(), _default_image(), _info(), ota_update() (+1 more)
### Community 46 - "find_id_by_field"
Cohesion: 0.24
Nodes (4): find_id_by_field(), missing(), test_scenes(), test_crud()
### Community 47 - "USB Latency Tools"
Cohesion: 0.15
Nodes (10): analyze(), edges(), main(), pct(), read(), fit_clock(), main(), pct() (+2 more)
### Community 50 - "led_strip_spi_dev.c"
Cohesion: 0.32
Nodes (7): led_strip_new_spi_device(), __led_strip_spi_bit(), led_strip_spi_clear(), led_strip_spi_del(), led_strip_spi_refresh(), led_strip_spi_set_pixel(), led_strip_spi_set_pixel_rgbw()
### Community 52 - "Presets & Settings Mockups"
Cohesion: 0.13
Nodes (4): _convert_filesystem_error(), stdout_write_bytes(), Transport, TransportExecError
### Community 53 - "mpremote Transport"
Cohesion: 0.12
Nodes (20): Presets Mockup Page, addColorPicker() / initializeColorPickers(), ColorPicker component (color-picker.js / color-picker.css), Preset Delay (animation speed, 10-1000 ms), ESPNow preset distribution, filterPresets() / sortPresets() search, filter and sort, LED Patterns (on, off, blink, chase, circle, pulse, rainbow, transition), Pattern Parameters N1-N8 (+12 more)
### Community 54 - "Outputs Config (C)"
Cohesion: 0.20
Nodes (17): defaults(), fail(), fill(), int_field(), num(), one_of(), put16(), resolve() (+9 more)
### Community 55 - "Microdot Handlers (dmx)"
Cohesion: 0.11
Nodes (5): invoke_handler(), iscoroutine(), Response, aclose(), __anext__()
### Community 57 - "led_strip_rmt_dev.c"
Cohesion: 0.07
Nodes (24): led_strip_rmt_config_t, led_strip_spi_config_t, led_model_t, led_pixel_format_t, led_strip_config_t, led_strip_t, led_strip_t, led_strip_new_rmt_device() (+16 more)
### Community 58 - "Microdot Handlers (led)"
Cohesion: 0.11
Nodes (5): invoke_handler(), iscoroutine(), Response, aclose(), __anext__()
### Community 61 - "API Test Fixtures & Audio"
Cohesion: 0.16
Nodes (5): base_url(), c(), Client, profile(), restore_db()
### Community 62 - "Microdot Request (dmx)"
Cohesion: 0.13
Nodes (4): Request, G, urldecode_bytes(), urldecode_str()
### Community 63 - "Help: Zones & Palette"
Cohesion: 0.13
Nodes (18): Colour Palette (per profile), Zone default preset (default hint), DJ zone starter option, From Palette linked colours, LED driver JSON (presets, select, save, default, manifest), Patterns dialog, POST /presets/send, Preset editor (Try, Save, Send, Manual) (+10 more)
### Community 64 - "test_espnow_rx.py"
Cohesion: 0.32
Nodes (18): data(), digest(), feed(), make(), test_commit_sets_version_only_when_complete(), test_digest_match_no_resync(), test_digest_mismatch_requests_resync_after_jitter_and_rate_limits(), test_digest_zero_ignored() (+10 more)
### Community 65 - "Driver OTA Tool"
Cohesion: 0.08
Nodes (11): Blink, Pulse, Controller, file_set(), walk(), main(), norm_mac(), push() (+3 more)
### Community 66 - "api_error"
Cohesion: 0.24
Nodes (21): api_body(), api_error(), api_json(), api_merge(), api_message(), api_preset_in_profile(), api_result(), api_split() (+13 more)
### Community 68 - "API Tests: Zones"
Cohesion: 0.11
Nodes (6): test_clone(), test_clone_default_name(), test_delete_removes_from_profile(), test_play_and_stop(), test_zone_with_groups(), zone()
### Community 70 - "Index Page Modals"
Cohesion: 0.11
Nodes (19): Audio Beat Detection modal, Header BPM / beat sync indicator, Colour Palette modal, Devices modal, Edit device modal, Edit Zone modal, Device groups modal, Header global brightness slider (+11 more)
### Community 75 - "board.py"
Cohesion: 0.38
Nodes (3): apply_cpu_freq(), default_led_pin(), mcu()
### Community 76 - "Controller Overview & OTA Docs"
Cohesion: 0.17
Nodes (16): led_controller ESP-IDF project, POST /patterns/upload (led-driver parity), Driver app update /drivers/ota (staged files, sha, commit/abort), Firmware OTA /ota (idle slot, rollback), Patterns resource /patterns, Driver app update over ESP-NOW test (tools/driver_ota.py), led-simulator, led-tool / led-cli serial device CLI (+8 more)
### Community 77 - "DMX"
Cohesion: 0.22
Nodes (3): DMX, main(), run_for()
### Community 78 - "Driver Hello Discovery"
Cohesion: 0.18
Nodes (8): broadcast_hello_udp(), discover_controller_udp(), ipv4_broadcast(), pack_hello_bytes(), pack_hello_dict(), pack_hello_line(), udp_discovery_targets(), _udp_discovery_targets_single()
### Community 79 - "Audio Monitor Page"
Cohesion: 0.16
Nodes (16): /audio.wav live PCM stream, bar() bar-position renderer, /beats SSE event stream, draw() timeline canvas, Listen button (WAV stream playback via AudioContext), median(), Audio and beats page (/audio), stats() tap vs computer agreement (+8 more)
### Community 80 - "Art-Net DMX Tests"
Cohesion: 0.23
Nodes (9): parse(), _assert_eq(), main(), test_artnet_send_loopback(), test_build_artdmx(), test_fixture_patch(), test_pattern_blink_and_select(), test_pattern_upload() (+1 more)
### Community 82 - "network"
Cohesion: 0.23
Nodes (6): _mac_hex(), run_diag(), _add_peer(), send_once(), _set_channel(), main()
### Community 84 - "API Tests: Groups"
Cohesion: 0.14
Nodes (4): device(), group(), test_group_identify_needs_devices(), test_profile_scoped_group()
### Community 85 - "ESP-NOW Sender Bridge"
Cohesion: 0.24
Nodes (9): _broadcast_ws(), _espnow_receive_loop(), _init_espnow(), main(), _send_espnow(), _validate_envelope(), ws(), format_mac() (+1 more)
### Community 86 - "Firmware OTA (C)"
Cohesion: 0.14
Nodes (10): fail(), ota_get_handler(), ota_post_handler(), ota_register(), reboot_post_handler(), forward(), on_open(), send_text() (+2 more)
### Community 90 - "API Tests: Presets"
Cohesion: 0.15
Nodes (4): preset(), test_create_belongs_to_current_profile(), test_create_fills_defaults(), test_presets_scoped_to_profile()
### Community 92 - "Bench Test Plan"
Cohesion: 0.23
Nodes (9): Bench endpoints /test/loss and /test/beats, 30 ms beat lead (CONFIG_BEAT_LEAD_MS), Bench test: S3 controller and one LED driver, ESP32-C3 vs S3 driver comparison, Logic analyzer latency (marker GPIO, tools/analyze_edges.py), Lossy-link test (simulated loss, retries, resync), Reliable link (rel: acked unicast, retransmits, ack timeouts), Bench troubleshooting (serial ports, channel mismatch, blank UI) (+1 more)
### Community 94 - "Flame Pattern"
Cohesion: 0.26
Nodes (6): _clamp(), Flame, _lerp_chan(), _lerp_rgb(), _palette_sample(), _triangle_255()
### Community 95 - "Microdot Auth (dmx)"
Cohesion: 0.20
Nodes (3): websocket_upgrade(), websocket_wrapper(), with_websocket()
### Community 96 - "Serial DMX & WiFi"
Cohesion: 0.20
Nodes (4): sleep_ms(), SerialDMX, sleep(), ap()
### Community 99 - "Twinkle Pattern"
Cohesion: 0.26
Nodes (6): Twinkle, cluster_base_index(), cluster_len_bounds(), dark_adjacent(), light_adjacent(), random_cluster_len()
### Community 101 - "Groups UI (JS)"
Cohesion: 0.29
Nodes (9): fetchDevicesMapForGroups(), fetchGroupsMap(), identifyGroupById(), loadGroupsModal(), loadWifiFieldsFromGroup(), openEditGroupModal(), renderGroupDevicesEditor(), renderGroupsList() (+1 more)
### Community 102 - "Microdot Auth (led)"
Cohesion: 0.22
Nodes (3): websocket_upgrade(), websocket_wrapper(), with_websocket()
### Community 103 - "Help: Mobile Menu Image"
Cohesion: 0.24
Nodes (10): Mobile Menu Help Illustration (narrow screen), Content Area (preset buttons), Menu Dropdown (Run mode, Profiles, Tabs, Presets, Help), Header Tab Buttons, Help, Menu Button (header dropdown trigger), Presets, Profiles (+2 more)
### Community 104 - "Pattern Selector Mockup Image"
Cohesion: 0.20
Nodes (11): Pattern Selector Mockup (Select LED Pattern), Apply Pattern / Cancel Actions, Blink Pattern, Chase Pattern, Circle Pattern, Off Pattern, On Pattern (solid color), Pattern Card Grid Layout (+3 more)
### Community 105 - "Driver Pattern Docs"
Cohesion: 0.24
Nodes (11): Message processing order (version, presets upsert, colour, selection), Auto vs manual (a) and manual chase flush, Built-in off / on patterns, Patterns and presets on the LED driver, MAX_PRESETS = 32, Pattern OTA via manifest / POST /patterns/upload, Pattern registry (Presets.reload_patterns), Preset short keys (p, c, d, b, a, bg, n1-n6) (+3 more)
### Community 109 - "Driver Message API Docs"
Cohesion: 0.38
Nodes (10): Auto vs manual mode, Beat (re-select same preset restarts generator), Hex colour conversion and colour-order reordering, LED Driver API (message format), Pattern-specific parameters (rainbow, pulse, transition, chase, circle), Preset fields (pattern, colors, delay, brightness, auto, n1-n6), Select message (device -> [preset, step]), Step synchronization (+2 more)
### Community 110 - "Driver Binary Envelope"
Cohesion: 0.38
Nodes (8): _brightness_0_255_from_wire(), _decode_default_blob(), _decode_preset_record(), _decode_presets_blob(), _decode_select_blob(), parse_binary_envelope(), parse_binary_envelope_v1(), parse_binary_envelope_v2()
### Community 111 - "led_strip Manifest"
Cohesion: 0.20
Nodes (9): dependencies, idf, description, repository, repository_info, commit_sha, path, url (+1 more)
### Community 113 - "Outputs UI (JS)"
Cohesion: 0.33
Nodes (8): fetchOutputs(), loadOutputsModal(), openOutputEditor(), OUTPUT_PROTOCOL_LABELS, outputSummary(), renderOutputsList(), setOutputField(), syncOutputProtocolFields()
### Community 114 - "DMX Driver Docs"
Cohesion: 0.25
Nodes (9): Controller WebSocket /ws (v1 presets/select), DMX Driver Art-Net and serial gateway, DMX fixture (output, start channel, role map; parcan/mover profiles), led-driver-style pattern engine (Preset object), Serial DMX512 output (250000 8N2), Binary envelope (main/envelope.c, test/binary_envelope.py), v1 driver messages (long/short keys), WebSocket /ws driver message relay (+1 more)
### Community 115 - "Help PDF: Overview"
Cohesion: 0.25
Nodes (9): API.md, LED controller user guide, Main web UI (Raspberry Pi app), Pattern OTA install over HTTP (/patterns/ota, upload, driver, send), Pattern parameters n1-n8, README, Serial to ESP-NOW bridge transport, WebSocket /ws (+1 more)
### Community 116 - "Mockups Index Image"
Cohesion: 0.31
Nodes (9): LED Driver UI Mockups Index (screenshot), Dashboard Mockup, Device Groups, Device Management Mockup, LED Patterns (On, Off, Blink, Chase, Circle, Pulse, Rainbow, Transition), N1-N8 Pattern Parameters, Pattern Selector Mockup, Presets Mockup (+1 more)
### Community 117 - "api_json"
Cohesion: 0.19
Nodes (27): api_body_opt(), api_effective_brightness(), api_identify_group(), clamp255(), create_device(), device_brightness(), device_config_from(), device_driver_config() (+19 more)
### Community 118 - "Help: Header Toolbar Image"
Cohesion: 0.29
Nodes (8): Header Toolbar Help Image, Edit Mode Action Bar, Run/Edit Mode Toggle Button, Patterns Action, Presets Action, Profiles Action, Header Tab Buttons, Tabs Action
### Community 119 - "Help: Preset Editor Image"
Cohesion: 0.29
Nodes (5): Default Action, Preset Pattern Selector, Preset Editor Modal (help illustration), Preset Name Field, Brightness, Delay and n1-n8 Parameters (0-255)
### Community 120 - "Dashboard Mockup Image"
Cohesion: 0.32
Nodes (8): LED Driver Control Panel Dashboard Mockup, Apply Settings Action, Brightness & Speed Card (Brightness % and Delay ms sliders), Colors Card (color swatches palette, Add Color), Connected Devices Card (devices with group and online status), Device Groups, Pattern Selection Card (On, Off, Blink, Chase, Circle, Pulse, Rainbow, Transition), Save to Device Action
### Community 121 - "Device Management Mockup Image"
Cohesion: 0.32
Nodes (8): + Add Device Button, Connected Devices List, Device Group, Device & Group Management Screen (mockup), Device Row Actions (edit, settings, stop), Online/Offline Status Badge, Devices / Groups Tab Switcher, LED Device (MAC, group, pattern)
### Community 122 - "Presets Mockup Image"
Cohesion: 0.32
Nodes (8): Preset Management UI Mockup, Apply Preset Action, Create Preset Action, LED Pattern Types (Rainbow, Pulse, Chase, Circle, Blink, Transition), Preset Card (name, pattern badge, color swatches, delay, n1, apply/edit/delete), Preset Search/Filter/Sort Toolbar (pattern filter, sort by name, grid/list toggle), Preset Parameters (colors, delay ms, n1), Sync Presets to All Devices
### Community 123 - "Pattern Contract"
Cohesion: 0.29
Nodes (6): Pattern Contract, Drawing via driver.n and apply_brightness, Pattern error handling (Presets.tick catches), Presets._load_dynamic_patterns(), Shared driver.step semantics, Global vs per-preset brightness
### Community 126 - "store_save"
Cohesion: 0.23
Nodes (10): api_register(), api_settings_defaults(), index_of(), load_file(), mount(), store_init(), store_known(), store_replace() (+2 more)
### Community 128 - "Blink Pattern Test"
Cohesion: 0.33
Nodes (3): _bootstrap_import_path(), main(), _run_ms()
### Community 129 - "Colour Picker Demo Image"
Cohesion: 0.33
Nodes (6): Custom Color Picker Demo (screenshot), Hex and RGB input support, HSB (Hue, Saturation, Brightness) color model, Keyboard accessible, customizable styling, Multiple Color Pickers for LED Patterns, Single Color Picker
### Community 130 - "Settings Mockup Image"
Cohesion: 0.33
Nodes (7): Advanced Settings (Step Counter, Step Increment, Device ID, Debug Mode), Basic Settings (Device Name, LED Pin, Number of LEDs), Color Order Selector (RGB/RBG/GRB/GBR/BRG/BGR), Device Settings Page Mockup, Network Settings (Access Point Name, Password, Enable AP), Pattern Parameters N1-N6, Pattern Settings (Pattern, Brightness, Delay)
### Community 135 - "api_set"
Cohesion: 0.20
Nodes (25): api_add(), api_id(), api_set(), add_ref(), bundle(), bundle_of(), bundles_route(), export_profile() (+17 more)
### Community 136 - "LinkRx"
Cohesion: 0.18
Nodes (3): _due(), LinkRx, send()
### Community 138 - "Help: Colour Palette Image"
Cohesion: 0.40
Nodes (6): Colour Palette modal mockup (help image), Add Swatch (+) Button, Colour Palette Modal, Palette Colour Swatches, Preset Editor 'From Palette', Profile (palette owner)
### Community 140 - "LED Driver README"
Cohesion: 0.47
Nodes (6): dev.py deploy/sync script, LED Driver README (MicroPython ESP32), Optional HTTP polling (http_poll.py), Wi-Fi TCP transport to Pi (port 8765), transport_type setting (wifi / espnow), UDP discovery (port 8766)
### Community 142 - "SPI Example Manifest"
Cohesion: 0.33
Nodes (5): dependencies, espressif/led_strip, idf, override_path, version
### Community 143 - "unique"
Cohesion: 0.25
Nodes (5): unique(), test_clone(), test_delete(), test_put(), test_put_current()
### Community 144 - "settings_editor.js"
Cohesion: 0.27
Nodes (7): loadEspnowDevices(), otaDriver(), otaFile(), otaRequest(), otaWaitBack(), showEspnowDevice(), showOtaTargets()
### Community 145 - "Help PDF: Modes"
Cohesion: 0.40
Nodes (4): Edit mode, Mobile layout Menu, Run mode, Zones modal
### Community 146 - "Help: Tab Preset Strip Image"
Cohesion: 0.60
Nodes (5): Help image: Main area brightness and preset tiles, Edit Mode: drag tiles to reorder, Global Brightness Slider, Preset Tile (gradient swatch, click to select on tab devices), Tab (e.g. lounge)
### Community 149 - "test_mdns.py"
Cohesion: 0.27
Nodes (6): _dbg(), main(), _set_hostname(), _sta_ip(), _try_resolve_local(), _wait_wifi()
### Community 156 - "RMT Example Manifest"
Cohesion: 0.40
Nodes (4): dependencies, espressif/led_strip, override_path, version
### Community 157 - "Help Tab JS"
Cohesion: 0.38
Nodes (3): addStaticIpRow(), loadDeviceSettings(), setApToggle()
### Community 158 - "Settings Page Template"
Cohesion: 0.50
Nodes (4): Settings modal (device, network), loadEspnowChannel(), Device Settings page (ESP-NOW channel), wifi_channel setting (1-11)
### Community 159 - "groups_route"
Cohesion: 0.31
Nodes (15): add_error(), api_driver_config(), api_mac(), api_migrate_groups(), brightness(), driver_config(), find(), groups_route() (+7 more)
### Community 160 - "web.c"
Cohesion: 0.26
Nodes (12): audio_page_handler(), etag(), favicon_handler(), find_file(), index_handler(), mime_for(), send_gz(), static_handler() (+4 more)
### Community 161 - "sequences_route"
Cohesion: 0.26
Nodes (13): api_current_profile(), api_migrate_sequences(), api_sequence_defaults(), apply_update(), colors_from(), has_steps(), in_profile(), migrate_seq() (+5 more)
### Community 162 - "tests/patterns/circle.py"
Cohesion: 0.22
Nodes (4): main(), run_for(), main(), run_for()
### Community 163 - "web.py"
Cohesion: 0.27
Nodes (4): download_settings(), handle_action(), index(), parse_settings_from_form()
### Community 164 - "test_wifi.py"
Cohesion: 0.47
Nodes (3): connect_wifi_with_wdt(), main(), _wifi_status_label()
### Community 170 - "Controller Component Deps"
Cohesion: 0.50
Nodes (3): dependencies, espressif/mdns, joltwallet/littlefs
### Community 171 - "List Search (JS)"
Cohesion: 0.83
Nodes (3): applyListSearch(), initListSearch(), rowSearchText()
## Knowledge Gaps
- **97 isolated node(s):** `Design Guidelines`, `Device Management UI`, `Engine CLI`, `Output Drivers (DDP, Art-Net, sACN, USB-DMX)`, `Pixel Generator` (+92 more)
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 1036 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
- **83 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **Why does `Microdot` connect `Microdot App (dmx)` to `HTTPException (dmx)`, `Microdot Routing (dmx)`, `Microdot Request (dmx)`?**
_High betweenness centrality (0.017) - this node is a cross-community bridge._
- **Are the 41 inferred relationships involving `Presets` (e.g. with `test_save_and_load_roundtrip()` and `_TestContext`) actually correct?**
_`Presets` has 41 INFERRED edges - model-reasoned connections that need verification._
- **What connects `Design Guidelines`, `Device Management UI`, `Engine CLI` to the rest of the system?**
_97 weakly-connected nodes found - possible documentation gaps or missing edges._
- **Should `htmx Library` be split into smaller, more focused modules?**
_Cohesion score 0.07897684839432412 - nodes in this community are weakly interconnected._
- **Why does `unique()` connect `unique` to `API Tests: Sequences & Bundles`, `API Tests: Zones`, `find_id_by_field`, `API Tests: Patterns`, `API Tests: Groups`, `API Tests: Presets`, `API Test Fixtures & Audio`?**
_High betweenness centrality (0.017) - this node is a cross-community bridge._
- **Are the 59 inferred relationships involving `store_coll()` (e.g. with `api_add()` and `api_current_profile()`) actually correct?**
_`store_coll()` has 59 INFERRED edges - model-reasoned connections that need verification._
- **Should `machine` be split into smaller, more focused modules?**
_Cohesion score 0.047619047619047616 - nodes in this community are weakly interconnected._
+12
View File
@@ -0,0 +1,12 @@
{
"runs": [
{
"date": "2026-11-03T12:13:15.159050+00:00",
"input_tokens": 1267015,
"output_tokens": 0,
"files": 332
}
],
"total_input_tokens": 1267015,
"total_output_tokens": 0
}
+1
View File
@@ -0,0 +1 @@
{"directed":false,"multigraph":false,"graph":{"hyperedges":[{"id":"audio_page_endpoints","label":"Audio page live endpoints","nodes":["web_audio_status","web_audio_beats","web_audio_audio_wav","web_audio_time","web_audio_tap_ep"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"web/audio.html"},{"id":"beat_latency_measurement","label":"Beat latency measurement methods","nodes":["docs_api_bench_endpoints","docs_bench_test_usb_latency","docs_bench_test_logic_analyzer","docs_bench_test_beat_lead"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/BENCH_TEST.md"},{"id":"brightness_combination","label":"Combined brightness factors","nodes":["docs_api_combined_brightness","docs_api_settings","docs_api_groups","docs_api_devices","docs_api_zones"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/API.md"},{"id":"color_picker_feature_set","label":"Color picker feature set","nodes":["docs_mockups_images_color_picker_demo_hsb_color_model","docs_mockups_images_color_picker_demo_hex_rgb_input","docs_mockups_images_color_picker_demo_keyboard_accessibility","docs_mockups_images_color_picker_demo_cross_platform_consistency"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/color-picker-demo.png"},{"id":"docs_help_edit_mode_management","label":"Edit-mode-only management features","nodes":["docs_help_edit_mode","docs_help_zones_modal","docs_help_send_presets","docs_help_patterns_dialog","docs_help_colour_palette","docs_help_presets_list"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/help.pdf"},{"id":"docs_help_preset_editor_actions","label":"Preset editor actions (Try, Default, Save & Send, Remove from zone)","nodes":["docs_help_try_action","docs_help_default_preset","docs_help_save_and_send","docs_help_remove_from_zone"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/help.pdf"},{"id":"docs_images_help_mobile_menu_header_actions","label":"Header actions aggregated in mobile Menu","nodes":["docs_images_help_mobile_menu_run_mode","docs_images_help_mobile_menu_profiles","docs_images_help_mobile_menu_tabs","docs_images_help_mobile_menu_presets","docs_images_help_mobile_menu_help"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/images/help/mobile-menu.svg"},{"id":"docs_mockups_device_modal_flow","label":"Device/Group Modal Flow","nodes":["docs_mockups_device_management_showadddevicemodal","docs_mockups_device_management_showaddgroupmodal","docs_mockups_device_management_closemodal","docs_mockups_device_management_savedevice"],"relation":"participate_in","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/device-management.html"},{"id":"docs_mockups_images_index_ui_mockup_set","label":"LED Driver UI Mockup Set","nodes":["docs_mockups_images_index_dashboard_mockup","docs_mockups_images_index_pattern_selector_mockup","docs_mockups_images_index_device_management_mockup","docs_mockups_images_index_settings_mockup","docs_mockups_images_index_presets_mockup"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/index.png"},{"id":"docs_mockups_images_pattern_selector_led_patterns","label":"Selectable LED Patterns","nodes":["docs_mockups_images_pattern_selector_on","docs_mockups_images_pattern_selector_off","docs_mockups_images_pattern_selector_blink","docs_mockups_images_pattern_selector_chase","docs_mockups_images_pattern_selector_circle","docs_mockups_images_pattern_selector_pulse","docs_mockups_images_pattern_selector_rainbow","docs_mockups_images_pattern_selector_transition"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/images/pattern-selector.png"},{"id":"docs_mockups_preset_schema","label":"Preset/pattern configuration schema (pattern, colors, delay, step increment, N1-N8)","nodes":["docs_mockups_presets_led_patterns","docs_mockups_presets_delay","docs_mockups_presets_step_increment","docs_mockups_presets_n_parameters","docs_mockups_presets_step_offset"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/presets.html"},{"id":"docs_mockups_settings_sections","label":"Device settings sections","nodes":["docs_mockups_settings_basic_settings","docs_mockups_settings_pattern_settings","docs_mockups_settings_advanced_settings","docs_mockups_settings_network_settings"],"relation":"form","confidence":"EXTRACTED","confidence_score":1.0,"source_file":"docs/mockups/settings.html"},{"id":"docs_mockups_ui_mockup_suite","label":"LED Driver UI Mockup Suite","nodes":["docs_mockups_index","docs_mockups_dashboard","docs_mockups_pattern_selector","docs_mockups_device_management","docs_mockups_readme_settings_mockup","docs_mockups_color_picker_readme_presets_mockup"],"relation":"foLine truncated
Loaded 100 of 979 files, more files were not shown because too many files have changed in this diff. Show more