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

flow-wasm

Skill1 starsChanged 3 months agoMITView on GitHub

Compile a Flow program to WebAssembly and run it in a browser. Use for web demos, shareable graphics, embedding a simulation in a page, or any request to put Flow output online.

The file

Files
SKILL.md

WebAssembly

Flow compiles to WebAssembly through the C backend and emits a runnable page alongside the module.

Requires FLOW_HOST=python and Emscripten on the path.

Build

FLOW_HOST=python flow wasm program.flow --backend=c --out build/wasm
FlagDoes
--backend=c|mlirCodegen path; C is the default
--out DIRWhere the module and page land
--preload DIR@/MOUNTBake a directory into the virtual filesystem
--link PATHExtra object or library to link
--threadsEnable threading
--fs memfs|idbfsFilesystem backend; idbfs persists in the browser

Serve the output directory over HTTP. Opening the page from file:// fails on module fetch.

cd build/wasm && python3 -m http.server 8000

Graphics in the browser

stdlib/gfx.flow targets canvas on the web, so a gfx program builds for the browser without changes. gfx_time_ms becomes performance.now() and gfx_wait_frame becomes a no-op, because gfx_present already waits on requestAnimationFrame. Pace the loop with gfx_wait_frame anyway so the same source behaves correctly in a native window.

Read first

ls examples/wasm/
ls scripts/ | grep wasm
cat docs/demos/wasm.md

scripts/build_wasm.sh, scripts/build_all_wasm.sh, and scripts/build_wasm_gallery.py are the pipelines the project uses for the published gallery. Follow them rather than inventing a build.

Verify

A WebAssembly build is only done when the page runs. Check:

  • the module loads with no console error;
  • the program produces the same output it produced natively, for at least one input;
  • the frame loop advances rather than rendering once and stopping.

scripts/verify_browser_interp.py exists for this. Say which check you ran. Do not report a working demo you have not loaded.

Pitfalls

  • Emscripten missing produces a confusing failure early. Check emcc --version first.
  • Files a program opens must be preloaded with --preload; there is no host filesystem.
  • Threads need cross-origin isolation headers, which a plain http.server does not send.
  • Size grows quickly with linked runtimes. Report the module size.

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.