flowctl
AGENTS.md1 starsChanged 5 days agoApache-2.0View on GitHub
flowctl lets coding agents (Claude Code, Codex) verify frontend flows fast and deterministically: a fast "System 1" model drives the browser, the agent only steps in when it escalates, and the verdict comes from deterministic assertions plus a Playwright trace. Recorded flows replay without any model. - Vocabulary: CONTEXT.md · Decisions: docs/adr/README.md - Status: phase 1 (model-free replay + CLI), phase 2a (exploration engine: System 1 client, snapshot, recorder, explore loop, save, heal) and the MCP server with its agent…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- debug-runSkill
- extend-engineSkill
- review-prSkill
- seeded-bugSkill
- ship-prSkill
- stackSkill
- write-adrSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Read this before changing anything structural.
- Very specific: line 76
Never use bun --bun or bun test: Playwright under the Bun runtime is flaky (ADR 0018).
- Very specific: line 93
Run bun run check after each change and bun run verify before reporting completion.
- Very specific: line 130
No inline comments: context goes in JSDoc with tags (@throws, @example, @see, @remarks).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md — flowctl
flowctl lets coding agents (Claude Code, Codex) verify frontend flows fast and deterministically: a fast "System 1" model drives the browser, the agent only steps in when it escalates, and the verdict comes from deterministic assertions plus a Playwright trace. Recorded flows replay without any model.
- Vocabulary: CONTEXT.md · Decisions: docs/adr/README.md
- Status: phase 1 (model-free replay + CLI), phase 2a (exploration engine: System 1 client, snapshot,
recorder, explore loop, save, heal) and the MCP server with its agent playbook (
packages/mcp, ADR 0027) done; early preview.
High-level design
Read this before changing anything structural. (CLAUDE.md imports this file, so Claude Code sees it too.) Vocabulary: CONTEXT.md. Decisions: docs/adr/.
What flowctl is. A verification engine for web flows. A flow is a YAML file. A run executes it in Playwright and returns a verdict that comes only from deterministic assertions (network, text, URL, field value, console errors). A model never decides pass or fail.
Two layers today.
- Replay (model-free):
flow/parses YAML,browser/executes steps with strict locators,run/owns the run (RunSession: contexts per profile, evidence,run.json),verifierchecks assertions. - Exploration (System 1): a fast model (TypeSafe Jev) picks the next operation and control from a page snapshot
(
system1/,explore/). The coding agent (System 2, you) only handles escalations. A recording becomes a flow only after a model-free confirming replay passes (save.ts).replay --healasks System 1 to fix one broken locator, never an assertion.
Where it is going:
target.yaml (URL, credential references, scope) → Observe (deterministic crawler → AppMap) + SpecProvider
(business operations from markdown or a spec plugin) → Derive (join them into test cases; every
assertion carries a sourceRef to spec text or a deterministic observation, never model-invented; human review gate)
→ Execute (existing replay and exploration, System 1 behind a pluggable Driver) → Reconcile (match failures
to code and issues; classify product bug, spec drift, stale test, environment; issues are drafted, never auto-filed).
Rules that shape new code.
- The invariants in
AGENTS.mdhold for every new module; the verdict rule (ADR 0004) is the one most likely to be broken by generation features. - The core stays free of app-specific code. Adapters for one company or app live in plugins (
packages/plugin-*or another repo);scripts/check-arch.mjsforbids core, cli and mcp from importing a plugin. - Credentials are referenced by name and never reach a model, a prompt, a log or evidence.
- Packages:
core(engine),cli(flowctl),mcp(flowctl-mcp, the agent entry),fixture-app(test app with seeded bugs; the accuracy ground truth). New capability goes intocorebehind anindex.tsinterface first, CLI and MCP are thin callers.
Repo map
| Package | Owns | Interface | May depend on |
packages/core (@flowctl/core) | config, flow format, RunSession, evidence, verifier, executor, snapshot + recorder, System 1 client, exploration, save, heal, replay, login, observe (read-only crawler, AppMap, free checks) | src/index.ts | npm deps only |
packages/cli (@flowctl/cli, bin flowctl) | flowctl replay, flowctl login, flowctl cleanup, flowctl observe, flowctl reconcile, flowctl trust | src/index.ts (main, formatSummary), src/bin.ts | core |
packages/mcp (@flowctl/mcp, bin flowctl-mcp) | MCP stdio server: flow_run, flow_step, flow_wait, flow_save, flow_replay, each guarded; agent playbook in skill/ | src/index.ts (createServer), src/bin.ts | core |
packages/fixture-app | two-role test app, 12 seeded bugs, sample flows | src/index.ts | nothing (tests only) |
Inside core: flow/ (schema, steps, templates, store), run/ (RunSession, outcome, evidence,
verifier, hooks), browser/ (locator, executor, snapshot, recorder), system1/ (protocol, prompts,
client), explore/ (Exploration, run view, policy, act, heal). save.ts writes recordings. Each
folder exports through its index.ts.
Commands
Node 22.22.2 is the runtime; Bun is only the package manager and script runner (ADR 0018).
Agent shells start fresh: prefix commands with . ~/.nvm/nvm.sh && nvm use >/dev/null &&.
| Task | Command |
| Setup | nvm use && bun install && bunx playwright install chromium |
| Setup on Apple Silicon with an x86_64 Bun | bun install --frozen-lockfile --cpu=arm64 --os=darwin, or install the native arm64 Bun (see README "Install") |
| After every change | bun run check (Node guard, architecture gate scripts/check-arch.mjs, harness tests, lint, format, typecheck, the runtime load check scripts/check-bundle-plugins.mjs (about 4 s alone), unit tests; measured 1 to 3 minutes on a loaded laptop, of which the harness tests, mostly the bundle-check ones (about 55 s alone), are the bulk) |
| Before saying "done" / before push | bun run verify (check + browser + accuracy tiers; about 10 min locally, the same as CI; ADR 0028) |
| One tier | bun run test:unit · bun run test:browser · bun run test:accuracy |
| One file | bun run test -- packages/core/test/flow.test.ts |
| Build | bun run build (tsc -b; emits packages/*/dist) |
| Run the CLI | node packages/cli/dist/bin.js replay --config <path> |
| Fix formatting | bun run fmt |
| Real System 1 (billed, opt-in) | set -a; . spike/.env; set +a; bun run test:contract |
Never use bun --bun or bun test: Playwright under the Bun runtime is flaky (ADR 0018).
Invariants (never break)
- A verdict comes only from deterministic assertions; a model's
DONEis a stop signal, never a verdict (ADR 0004). - Replay never calls a model unless heal is explicitly on (
--heal); replay locators must match exactly one element (ADR 0008, 0009). networkassertions only see fetch/xhr; assertions poll up toassertTimeout; evidence starts before a context's first navigation (ADR 0010).- Secret values never reach a model: secret inputs go as key names, their values become
***; other inputs send a preview (ADR 0006). - System 1 (exploration and heal) runs only in
system1.allowedEnvs; secret input values never reach it (ADR 0005, 0006). - Everything about browser contexts of a run goes through
RunSession.
Workflow
- New feature or structural change: brainstorm → spec → plan. Per-feature specs and plans are internal working
docs: keep them out of git and never link them from committed files. Lasting decisions go to
docs/adr/. - Language: English for everything committed; Vietnamese only as product data (UI labels, fixture pages, test strings).
- Code: test first (TDD). Browser behaviour is tested against
fixture-app, never with Playwright mocks. - Run
bun run checkafter each change andbun run verifybefore reporting completion. - Commits: Conventional Commits; no
Co-Authored-Byor "Generated with" lines. Hooks runcheckon commit, the message format oncommit-msg, andverifyon push; do not pass--no-verifyunless the user asks. - A new design decision gets a new ADR in
docs/adr/; anactiveADR is never edited, it is superseded. - PRs follow
.github/pull_request_template.md; label them from.github/labels.tsv(type:*,area:*,phase:*). CI runs the sameverifyon every PR, plus gitleaks (blocks) andbun audit(report only).
Skills (procedures)
Claude Code loads these automatically; other agents read the file when the task matches.
| Skill | Use when |
| extend-engine | adding a step/assertion kind, System 1 op, config key, CLI command, MCP tool, public export |
| seeded-bug | adding an assertion kind or proving a defect class is caught |
| debug-run | a run failed, escalated, errored or is flaky |
| write-adr | a design decision is made or reversed |
| ship-pr | before pushing or opening a PR |
| stack | stacked branches: create, update, merge bottom-up |
| review-pr | reviewing someone's PR: CI, local verify, reviewer subagent, draft for approval |
Review: the flowctl-reviewer subagent (.claude/agents/flowctl-reviewer.md) checks a diff against the
invariants and ADRs; use it after each task, separate from the agent that wrote the code.
Where to change what
Package-specific recipes and gotchas live next to the code: packages/core/AGENTS.md, packages/fixture-app/AGENTS.md, packages/cli/README.md.
| Change | Touch |
| New CLI command | COMMANDS in core/src/trust/commands.ts (with guarded) + cli/src/main.ts + a row in cli/test/guard.test.ts + cli/test/cli.browser.test.ts |
| New package | packages/<name> with package.json + tsconfig.json (composite), README.md, and AGENTS.md + CLAUDE.md (@AGENTS.md) if it has its own rules; add to root tsconfig.json references and tsconfig.tests.json paths / vitest.config.ts alias if tests import it by name; add it to PACKAGE_DEPS and PACKAGE_NAMES in scripts/check-arch.mjs; write an ADR. Only a test-only, source-only package (fixture-app) skips the tsconfig and build, see its AGENTS.md |
Code conventions
TypeScript strict with noUncheckedIndexedAccess; no any; avoid as (as const is fine); ?? over ||;
relative imports with .js inside a package, package names across packages, never deep imports;
files under 250 lines (300 max); a folder only when it holds ≥ 3 files; dates only via dayjs.
No inline comments: context goes in JSDoc with tags (@throws, @example, @see, @remarks);
exceptions are the oxlint-disable and dup-ok directives.
Details live in path-scoped rules (.claude/rules/, loaded by Claude Code when matching files are touched;
other agents read them directly): architecture, typescript, comments, testing, performance,
reliability, security, system1, cli, ci, docs, flows.
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.

