The pattern-driven AI Software Factory
Agents build by copying what already works. Claude Code by default; any coding CLI as a setting.
English | Português (Brasil)
Origin · What it gives you · Sr. PE · Gates · Run it · Dashboard · Docs · Contribute
Experimental. PatternFlow runs coding agents unattended. Its formats may still change (stability) and its guards are best effort: run it in a disposable environment (security).
PatternFlow turns a backlog into committed code through pipelines of single-purpose agents, supervised or unattended. It is built to spend few tokens: each agent gets a small context, copies an existing pattern instead of inventing one, and answers briefly.
I built PatternFlow for myself. I was still exploring coding agents, on a tight budget of one Claude Pro subscription, so saving tokens came first. When I kept hitting the weekly limit by midweek, I moved to Max, and saving tokens stopped being the point. What I wanted was to stay in control and take part in the work alongside the AI: to help it keep its reasoning focused on the task, rather than letting it think freely, make assumptions and decide on its own until the workflow became an endless chat of summaries and detail nobody asked for. So the kit sets a clear goal and saves the heavy reasoning for what really matters, instead of burning tokens on routine work such as plans, specs and screens built from scratch with no limits.
PatternFlow grew with every project I built with it: every rule, guard and gate is there because a real task needed it. This release is that same harness, now standalone, so that experienced developers can use it, put it to the test and make it better.
If you are newer to development, or not yet at home in English, note that the kit talks to the AI in English on purpose. Part of the reason is personal: I learned to program in the 2000s from books and documentation in English, and I have written my code in English ever since. The bigger reason is the models. They are trained mostly on English, a language with a lean grammar: most English verbs have four or five forms ("to be" has eight), while a regular Portuguese verb has more than fifty. The same prompt in Portuguese, even a simple one, takes more words, and that costs performance and, without doubt, tokens.
To learn more, and to write in your own language while the agents work in English, see Languages.
Status: v0.1.0, the first public release.
| Part | What it does |
|---|---|
| Pattern registry | One index of the implementation patterns in your code (exemplars, instances, files, slots, verify). Tasks are built by copying an exemplar and applying a delta. |
| Lanes | Every task runs as mechanical, pattern or novel. The lane sets the model, the effort and the gates. |
| Gates | Points where the loop waits for a person. Every novel task is held at the lane gate until the owner confirms it. |
| Agents | Five core agents (task-orchestrator, feature-spec, e2e-verifier, diff-reviewer, docs-scribe), six block agents that build and review the blocks of the packs (layout-builder, crud-builder, form-builder, api-integrator, backend-builder, backend-reviewer), and the builders you define from a template. |
| Pipelines | Skills that run a task phase by phase, one agent per phase, with gates. |
| Loop driver | Runs the backlog unattended: one fresh session of the coding CLI per task (Claude Code by default, any CLI as a setting), a planning session that picks the lane, task branches, resume after usage limits, hooks that keep sessions inside their scope. |
| Translation | Write the backlog and product docs in your own language; they are translated to English and condensed once, so every session reads fewer tokens. Optional, experimental (docs/languages.md). |
| Dashboard and API | A web page and an HTTP API over runs, live events, tasks, lane gates, the registry and tool-call metrics per agent. |
Sr. PE stands for Senior Principal Engineer.
- What it was. When I first designed the kit, I wanted one agent above
task-orchestrator: the one with authority over technical decisions, but outside the workflow, never changing code or running anything. Its only job was to analyse, write the spec, plan, and hand the work to the orchestrator. Its persona was a senior principal engineer, with the skills to manage the work and the power to make the decisions that shape the result, and it enforced the product vision and the decision policy. - What it became. As the kit grew, it stopped being an agent and became
part of the loop itself: one planning session that lives across tasks. It
reads the backlog,
PRODUCT-VISIONandDECISION-POLICY, plans each task, proposes its lane and hands it totask-orchestrator. The name stayed. - Why it matters. It is the one place where decisions are made. Every other session carries out a contract; a question nobody anticipated goes to the Sr. PE, which answers from the decision policy or parks the task for you. Keeping decisions in one role, away from the hands that build, is what lets the rest of the loop run without guessing, and its lane proposals are what the lane gate, and Jev, learn to check.
- Give it a name.
patternflow initnames it after a character of José de Alencar, the novelist from Fortaleza: Iracema, Peri, Ubirajara, Ceci and others from his novels of Ceará and Brazil. Change it withpatternflow srpe name <name>; journals, gate reports anddoctorthen call it by that name, and the session is told its name too.
Unattended does not mean unsupervised. The loop stops and waits for the owner at the points where a wrong guess costs the most:
- The lane gate holds every
noveltask. A task isnovelwhen part of it has no pattern or analogue in the code, so it is the work most likely to go wrong and the most expensive to run. By default the loop does not start it: it writes a report with the proposed lane, the reasons, the units and the registry lookup, and waits. The owner confirms the lane or chooses another one with a reason, from the dashboard or withpatternflow gate-answer.patternandmechanicaltasks run without waiting. - Milestones stop the loop until the owner approves them.
- Decisions nobody anticipated are never guessed by a task session. They go to the planning session, which decides by the project's decision policy or parks the task for the owner.
Each answer at the lane gate is recorded as a case, and the Sr. PE sees your
last answers in its next plans. The gate holds novel tasks by default
(decisions.laneRouter.humanGate), and you cannot turn it off before 100
labelled cases (minCasesToClose).
Running novel work unattended needs a second, independent reading of the
lane, and that is the optional decision module: Jev, a decision model by
TypeSafe. Jev reads the same evidence as the Sr. PE
without seeing its conclusion, and it is calibrated on your gate answers.
Its reading shows at the gate from your 10th answer, so you can watch it
learn before it decides anything. After 100 answers you may turn the gate
off, and a novel task then runs unattended when Jev confirms the Sr. PE's
lane. A project may set a lower minimum, as a benchmark does, knowing Jev is
less calibrated there.
The module is off by default. patternflow init explains it and asks whether
to turn it on; patternflow decisions shows the same text later, and
patternflow decisions on or off changes it. It needs a TypeSafe API key.
Without the module every novel task waits for you, whatever the gate
setting. How the loop earns that autonomy, how milestones group many tasks
into one approval, and what real runs showed:
docs/unattended.md.
- Node.js 20.12 or later
- A coding CLI on PATH: Claude Code (
claude) by default, or another one set as the provider - git
The kit itself has no required dependencies. Two are optional: yaml (only if
you keep config or the registry as .yml) and @typesafe-ai/sdk (only for the
optional lane-router decision module; version 0.7 needs Node.js 22 or later,
and compresses its requests on Node.js 22.15 or later).
git clone https://github.com/neimatos/patternflow && cd patternflow && npm run demoA throwaway project with a backlog, three picked blocks and one generated run,
on the dashboard at http://127.0.0.1:4390/?t=demo. No model is called;
Ctrl+C deletes it.
npm install -g @patternflow/cliThe package is @patternflow/cli; the command it installs is patternflow.
With Bun: bun add -g @patternflow/cli (the command still runs on Node.js).
To run it without installing: npx @patternflow/cli or bunx @patternflow/cli.
From the repository instead of the registry: npm install -g github:neimatos/patternflow.
Then, in the root of your project:
patternflow initpatternflow doctorpatternflow run --onceclaude plugin marketplace add neimatos/patternflowclaude plugin install patternflow@patternflowThe plugin adds the patternflow command to the session and three skills:
/patternflow:init, /patternflow:run-loop and /patternflow:dashboard.
patternflow init --vendorThis copies the engine into .patternflow-ai-factory/kit/ and the kit skills into
.claude/skills/. Commit both and any session that opens the repository can
run the kit with node .patternflow-ai-factory/kit/bin/patternflow.mjs.
It also installs the patternflow-dashboard skill, which shows the dashboard
from a cloud session as a private Artifact
(docs/running.md).
patternflow serveIt prints a link that carries an access token. One dashboard serves several projects; switch between them in the header. For each project it shows:
- Box: a card per block of the packs, previewed with the project's own design tokens, with each block's state in the project, its options and its layers, a live preview of layout options (sidebar side and mode, top bar, one or two columns, ltr or rtl), and the project's stack (or the suggestion while it is not chosen);
- Runs: every loop run, from this checkout and from every branch of the repository, so runs made on another machine or in a cloud session appear once fetched;
- Timing: minutes per task for the last tasks, as columns stacked by phase so the height is the task's total, and a Gantt chart of the phases of a run, to see which task and which phase took the time;
- Live: the event stream of the run in progress;
- Sessions: every Claude Code session opened on the project on this machine, as a tree of its subagents with commands, file reads and writes, errors and timing;
- Tasks, Gates, Patterns, Tool calls: the backlog, pending lane gates with an answer form, the pattern registry, and tool-call metrics by agent, tool and session;
- Docs: the kit's documents by topic, read inside the dashboard. A
?at the right of the tabs opens the ones about the page you are on, and the globe icon in the header switches them between English and Portuguese.
It can start a run and pause, resume or stop one. The theme is dark by
default, with a light option. The dashboard and the command line are in
English; only the Docs page has a Portuguese version. The default port is
4321 (--port). See docs/web-api.md.
serve is for a local run or a container. In a provider's cloud session no
browser reaches it: there patternflow serve --snapshot <file> writes the
same dashboard as one self-contained page that only shows, and the
patternflow-dashboard skill publishes it as a private Artifact (Claude Code
for now; docs/running.md).
Projects: several repositories in one place ![]() |
Patterns: the registry and the state of each pattern ![]() |
Sessions: a session as a tree of its subagents ![]() |
Tool calls: by agent, tool and session, with failures ![]() |
Box: the blocks a project starts from, previewed with its own design tokens
Timing: where the time went, per task and per phase
The screenshots show demonstration data.
.patternflow-ai-factory/
factory.config.json lanes, router, verify commands, conventions
agents/ agent definitions (source of truth)
docs/00-product/ product vision and decision policy
docs/10-architecture/ boundaries
docs/20-tasks/ TODO.md, DONE.md, task template, plans, active files, archive/
docs/30-api/ API contract
docs/40-ux/ your UX documents (empty)
docs/50-standards/ your standards, plus the kit protocols
templates/features.json the pattern registry
design/tokens.json style choices: colours, text, borders, lines, icons
checklists/ context-packs/ e2e/
loop/ loop.config.json, journals, lane stats, gates, run state
state/ live events and control commands (not tracked by git)
.claude/agents/ runtime copy of the agents (not tracked by git)
.claude/skills/ the pipelines
You then write the product vision, the decision policy, your standards, the verify commands and the backlog. The kit does not invent them.
| Command | Purpose |
|---|---|
init |
Scaffold the kit in a repository, then explain the decision module and ask whether to turn it on |
migrate |
From the old kit (.ai-factory/): a fresh scaffold, with the project's documents, task records, pattern registry and loop records carried over (docs/stability.md) |
repair |
Fix a broken install, or bring a project to the installed version after an upgrade: missing kit files written again, the kit's own files replaced, yours left alone (docs/stability.md) |
decisions [on|off] |
What the decision module (Jev) does and whether it is on; on or off changes it |
srpe [name <name>] |
Show the Sr. PE's name, or give it a new one |
doctor |
Preflight checks |
status |
Driver, pending gates, last run |
run |
Run the unattended loop (run --help lists its flags) |
control <cmd> |
Pause, resume, kill, skip, retry, approve, start a task |
gate-answer |
Answer a pending lane gate |
serve |
Dashboard and HTTP API |
projects |
List, add or remove the projects the dashboard serves |
sync-agents |
Write .claude/agents from .patternflow-ai-factory/agents, with absolute paths for this machine |
signing |
Who signs what, which keys were found; provider-key creates the provider's key (docs/signing.md) |
commit --kind task|spec|kit |
A commit outside the loop with the kind's author, key and message line |
new-agent <name> |
Create an agent from the template |
validate-registry |
Check the pattern registry |
ci |
In the project's CI: the pull request's tier, raised by the diff, and its commands (docs/ci.md) |
translate |
With the translation module on: put your TODO entries and docs into English, condensed, keeping your originals |
packs |
List, check or show the blocks a project starts from |
lint-new <repo> |
Lint only the lines a task branch changed |
benchmark |
Numbers to publish about the project's runs: tasks per lane, cost, time, tokens, gates; task names left out (docs/unattended.md) |
verify-records |
Check that each run's journal and event ledger are unchanged since the run ended (docs/security.md) |
history <T-ID> or --module <name> |
The DONE entries of a task or a module, from DONE.md and its archive |
| Folder | Contents | Guide |
|---|---|---|
engine/ |
Loop driver, hooks, libraries, prompts, decision modules | engine/README.md |
bin/ |
The patternflow command line |
bin/README.md |
server/ |
Web dashboard and HTTP API | server/README.md |
skills/ |
Skills of the Claude Code plugin | skills/README.md |
cloud-skills/ |
Skills for a provider's cloud session, installed by init --vendor |
cloud-skills/README.md |
template/ |
What init copies into a repository |
template/README.md |
packs/ |
Block catalogs a project starts from | packs/README.md |
docs/ |
Architecture, configuration, running, API | docs/README.md |
test/ |
Tests of the CLI operations |
- docs/architecture.md: how the parts fit, and the loop step by step
- docs/configuration.md: both config files, key by key
- docs/running.md: local, plugin and cloud use
- docs/signing.md: who authors and signs each commit, and where the keys come from
- docs/ci.md: CI tiers planned by the Sr. PE, raised by the diff, full suites only on promotion
- docs/unattended.md: what runs without you, earning unattended
novelwork, milestones, evidence from real runs - docs/providers.md: Claude Code or another coding CLI; model tiers
- docs/security.md: threat model, isolation, credentials, restore
- docs/stability.md: what is stable, versions, migrations, concurrency
- docs/web-api.md: the HTTP API
- docs/prompts.md: the prompts and agent instructions, who hands work to whom, the writing rules
- docs/languages.md: why the agents read English, the token cost of other languages, the translation module
- docs/faq.md and docs/troubleshooting.md
- schemas/: JSON Schemas of the config files, events, control commands and registry entries
- CONTRIBUTING.md, SECURITY.md and CHANGELOG.md
- Em português (Brasil): README.pt-BR.md and docs/pt-BR
- The protocols a project runs under, in template/docs/50-standards: LANES.md, UNATTENDED-L3.md, EVENT-SCHEMA.md and CONTROL-PROTOCOL.md
Planned next, and good places to start contributing:
- Capture every session with hooks, not only the ones the loop starts, so the dashboard is live for any Claude Code session on a project.
- Parallel tasks in the loop: one git worktree per task, for tasks whose plans touch different files.
- Parallel agents in the dashboard: one lane per agent on a time chart.
- Live transport from cloud sessions: an optional relay, beside the records branch.
- Decision module: a loud availability check, labels from task outcomes instead of opinions, fitted weights, and a second provider.
- Picking blocks on the Box page: choose a project's first blocks and its stack there, edit its style tokens, and turn the picks into seed entries and backlog tasks.
- More providers, tested: working
providersettings for other coding CLIs, and their hooks where a CLI offers them. - More unit tests for the driver modules in
engine/run/, beside the end-to-end runs that cover them. - Windows in CI.
Contributions of every size are welcome: a bug report, a clearer sentence in a prompt, a starter pack for your stack, or one of the roadmap items.
- Read CONTRIBUTING.md for the setup, the tests, the few rules that keep the kit small, and a list of good first contributions.
- Open an issue before a large change, so the design is agreed first.
- Send a pull request against
mainwith tests for what you changed.
Everyone taking part is expected to follow the Code of Conduct.
Thanks to everyone who has contributed. The full list is on the contributors page.
The unattended loop starts coding sessions with permission prompts disabled.
With Claude Code, hooks confine what a session reads and writes, deny git push and keep the kit read-only. With another CLI nothing is checked before
a command runs: a push and a change to the kit are found after the session,
and what a session reads is not limited at all. Either way the guards are a
best effort, not a sandbox. Run the loop in a
container or another disposable environment, on a repository you can restore,
and review the branches before you push them. Threat model, credentials and
restore steps: docs/security.md. Report a vulnerability
privately: SECURITY.md.
Apache-2.0. See LICENSE and NOTICE.
Made in Fortaleza, Ceará - Brazil (Terra da Luz
e Capital da Rapadura
)






