flow-debug
Skill1 starsChanged 3 months agoMITView on GitHub
Diagnose a failing Flow program at the stage where it actually failed. Use for compile errors, parse failures, crashes, wrong numerical results, linker errors, silent no-ops, sanitizer reports, or any "it does not work".
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- flow-audioSkill
- flow-autodiffSkill
- flow-basicsSkill
- flow-compiler-devSkill
- flow-dynamicsSkill
- flow-effectsSkill
- flow-graphicsSkill
- flow-perfSkill
- flow-setupSkill
- flow-stdlibSkill
- flow-verifySkill
- flow-wasmSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Read the C as a diagnostic instrument.
- Very specific: line 52
If the C is wrong, the fix belongs in the generator, in compiler/src/ or src/flow/.
- Distinctive: line 85
Check a conserved quantity.
- Distinctive: line 89
Only then suspect the compiler, and prove it with a minimal reproduction.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Diagnose from the earliest wrong stage
A Flow program passes through parse, type check, C emission, C compile, link, and run. Find the first stage that went wrong and fix it there. Fixing a symptom three stages downstream produces a change that looks right and is not.
Stage 0: is it the host?
flowc emit failed (Stage-A subset?). Use FLOW_HOST=python for full language.
stage_a_driver_flow: parse failedThis is the most common Flow failure and it is not a bug in the program. The
default flowc host covers a subset. Anything with println, a flow block,
an effect, generics, or modules needs:
FLOW_HOST=python flow run program.flowTry this before reading a single line of the source.
Stage 1: parse and type check
FLOW_HOST=python flow compile program.flow --strict
FLOW_HOST=python flow explain program.flow--strict turns type warnings into failures. explain prints the compilation
plan for every declarative construct: what was considered, what was chosen, and
what each rejected candidate failed on. Use it when a construct compiled but
lowered to something you did not expect.
Stage 2: the generated C
FLOW_HOST=python flow compile program.flow
cat "$FLOW_HOME/build/program.c"Read the C as a diagnostic instrument. It tells you what a construct actually became. Never edit it. It is regenerated on every build, so a fix there disappears and, worse, appears to work first.
If the C is wrong, the fix belongs in the generator, in compiler/src/ or
src/flow/.
Stage 3: the C compiler and linker
| Message | Cause |
implicit declaration of function | An extern was declared in Flow but the C header was not included by the runtime |
undefined symbol | Declared and used but never linked. Check whether the mode you ran links that runtime |
clang: command not found | No C toolchain. See the flow-setup skill |
A parser-accepted extern is not proof that a symbol links. Run it.
Stage 4: runtime
FLOW_HOST=python flow run program.flow --sanitize=ub,asan
FLOW_HOST=python flow debug program.flow --break mainSanitizers catch out-of-bounds access, use after free, integer overflow, and
alignment faults. Reach for them the moment a crash is not obviously a logic
error, and for anything with ptr<T> or manual memory.
flow debug builds with debug info and can launch LLDB or GDB. --no-launch
builds without launching.
Stage 5: wrong numbers
The program ran and the answer is wrong. This is a model problem far more often than a compiler problem.
- Halve
dtand rerun. If the answer moves, the step size was the problem. - Check a conserved quantity. If energy drifts, the integration is wrong.
- Compare against a closed-form answer for a simplified case.
- Print the state at the first few steps and compare against a hand calculation.
- Only then suspect the compiler, and prove it with a minimal reproduction.
Silent failures
| Symptom | Cause |
| Effect operations do nothing, return zero | No handler installed. Run with FLOW_STRICT_EFFECTS=1 |
A when event fires late | Zero crossing is detected at step granularity, giving O(dt) error |
| A change had no effect | You edited generated C under build/, or the wrong host ran |
| The window never appears | Headless environment. Use flow record instead |
Minimal reproduction
Cut the program down until removing one more line makes the failure vanish. Report that file, the exact command with environment variables, and the real output. A ten-line reproduction is worth more than a paragraph of description.
Report
State which stage failed, what the evidence was, what you changed, and the command that now passes. If you fixed a symptom rather than a cause, say so plainly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

