agentleFS
flooooooooooowflooooooooooow/flow-skills/skills/flow-debug/SKILL.md

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".

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
  1. Distinctive:

    Read the C as a diagnostic instrument.

    line 48
  2. Very specific:

    If the C is wrong, the fix belongs in the generator, in compiler/src/ or src/flow/.

    line 52
  3. Distinctive:

    Check a conserved quantity.

    line 85
  4. Distinctive:

    Only then suspect the compiler, and prove it with a minimal reproduction.

    line 89

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 failed

This 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.flow

Try 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

MessageCause
implicit declaration of functionAn extern was declared in Flow but the C header was not included by the runtime
undefined symbolDeclared and used but never linked. Check whether the mode you ran links that runtime
clang: command not foundNo 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 main

Sanitizers 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.

  1. Halve dt and rerun. If the answer moves, the step size was the problem.
  2. Check a conserved quantity. If energy drifts, the integration is wrong.
  3. Compare against a closed-form answer for a simplified case.
  4. Print the state at the first few steps and compare against a hand calculation.
  5. Only then suspect the compiler, and prove it with a minimal reproduction.

Silent failures

SymptomCause
Effect operations do nothing, return zeroNo handler installed. Run with FLOW_STRICT_EFFECTS=1
A when event fires lateZero crossing is detected at step granularity, giving O(dt) error
A change had no effectYou edited generated C under build/, or the wrong host ran
The window never appearsHeadless 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.