Skip to content

About

Web-development purpose AI-agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

192 Commits

Folders and files

Repository files navigation

@u2ai/webdev

AI web developer: it plans a web project, collects the context of the design, writes the markup, the code and the styles, draws the vector graphics, picks the icons, reviews the result and remembers the lessons.

  • Graphical CLI as ai-webdev; the internal process is ai-webdev-worker.
  • Config in ~/.ai-webdev/config.json.
  • Node.js 26+, ESM, no SDK (plain fetch).
  • Only the Responses API; every role answers with a strict JSON of its own schema.
  • The JSON of a model is read as JSON5: single quotes, trailing commas, comments and unquoted keys are what models actually write, and a strict parser threw the whole call away.
  • Repository: https://github.com/u2re-space/u2ai-webdev.

The package was split out of the ai monolith: the web work lives here, with its own configuration, its own stages, its own roles and its own tests. The monolith commands ai gen and the web part of ai run are bridges that forward to this CLI and return its exit code.

Install

npm install -g @u2ai/webdev

From a checkout:

npm install
npm link        # puts `ai-webdev` into PATH

The runtime dependencies are the MCP client (@modelcontextprotocol/node) and the terminal UI (terminal-kit); the rest is built into Node.js.

Quick start

export AI_WEBDEV_API_KEY=sk-...      # or put the key into ~/.ai-webdev/config.json

ai-webdev config init                # write ~/.ai-webdev/config.json
ai-webdev "make a landing page for a coffee shop"
ai-webdev plan "make a landing page for a coffee shop"     # only the plan
ai-webdev stages                                           # the stages of the pipeline

The task is the whole input: an unknown command is a task, so ai-webdev "make a landing" is the same as ai-webdev run "make a landing".

The CLI architecture

ai-webdev has two processes:

  • ai-webdev is the graphical shell. In a terminal it opens a full-screen dashboard with the stages and the live worker log. The lower block above the operator input contains the progress bar and the status row with the current model, stage, role, effort, mode, plan step and state. The rows above them hold the stream of the model: the tail of its thinking while it thinks and the tail of its answer while it writes. The thought is wrapped at the width of the screen, so no row outgrows the terminal and the rows of the dashboard never shift. Every current command is available through this shell.
  • ai-webdev-worker is the internal worker. It owns the CLI, the pipeline and the ordinary stdout/stderr. A versioned IPC protocol carries the pipeline events, the questions of the operator and the commands of the shell.

The operator line has the same vocabulary as the classic CLI: ordinary text steers the next role turn, /skip [stage-or-step] skips a stage or a plan step, /help shows the controls and /quit stops on the next safe boundary. A question raised by ask_user takes the next typed line.

Pipes, redirects, --json, --quiet and --headless start the worker without the dashboard. This keeps the machine contract stable: --json still prints one JSON object per line on stdout, and the exit codes remain 0, 1, 2 and 130.

Commands

Command What it does
run <task> Take the task through the whole pipeline of the stages.
plan <task> Plan the work and show the plan.
sight [task] Look at the page and let the styler fix the styles.
stages Show the stages of the pipeline.
component [publish|list|search|show|rm|path] The local registry of the components.
install <tag>[@version] Install a component as a local file: package.
config [init|show|path] The configuration of the home.
jobs [list|show|cancel|rm|prune|run] The background jobs.
memory [list|search|add|rm|tasks] The permanent memory of the project.
skills [list|search|show|path|rm] The skill packs of the project, of the home and of the package.

ai-webdev --help prints the same list with every flag of the run.

The pipeline

A run is a sequence of stages. Every stage reads the result of the ones before it, writes its own report into the directory of the run and hands the result to the next one.

Stage What it does
collect Read the inputs of the project, the map of the project, the registry of the components, the skill packs and the memory.
scan Read the project itself: what it is, which files matter, its conventions and its risks.
plan Break the task into steps, each with its role, its files and its check.
architect Decide the structure of the project: the files, the modules and the order.
setup Prepare the environment: the scaffold, the dependencies and the entry points.
vector Draw the vector graphics as code: the SVG of the ornaments and the illustrations.
pictures Prepare the crops of the reference that are pictures: the chess piece, the board, the badge.
markup Write the markup of the pages.
assets Place the assets: the prepared pictures and the drawn graphics get their final paths and their final format.
pre-coding Write the skeleton of the code: the modules, the states of the interface, the data, the behaviour — out of the markup and the brief of the architect. It takes the steps of the coder that do not wait for the styles: a step the plan puts after the styles belongs to the full work of the code.
pre-styling Write the contract of the styles: the tokens, the names of the classes, the rules of the components and the states — dressed over the skeleton of the code.
styling Look over the styles once more: what the code needs, the fine tuning.
animation Write the motion of the result: the transitions, the entrances, the reduced motion.
coding Look over the code once more: the logic, the errors, the fine tuning.
iconify Choose the icons of the interface and check that every one of them is on the disk.
build Connect the styles: the entry point, the compilation, the links of the markup.
sight Open the page in a browser, shoot it, and let the styler compare the picture with the reference and fix the styles.
review Review the result: the markup, the code, the styles and the accessibility — and repair what it finds.
audit Audit the project: the dead code, the duplicates, the unused assets.
learn Write the lessons of the run into the permanent memory.

The skeleton of the project is written by the code, not by the model: a project without a manifest gets package.json, the config of the bundler and the rules of the stack, with the stack of the architect. The versions of the tools of the stack are pinned there (vite ^7.0.0, sass ^1.80.0), so the install of the project is repeatable. The installer then adds what is missing — the dependencies, the scripts, the files — and the stage checks the readiness of the project and says what is not there.

The role of a step is the role that does it. Five roles take the steps of the plan: markup writes the markup, coder writes the scripts and the modules, styler writes the styles, editor draws the vector graphics, iconifier chooses the icons. The other roles work once for the whole run — the plan, the architecture, the environment, the review, the audit and the lessons are stages, not steps. A plan that names another role is a promise the run cannot keep, so the harness does not keep it silently: the role is guessed by the files of the step (index.html → markup, styles.scss → styler, assets/badge.svg → editor), and a step whose role cannot be guessed leaves the plan with a warning that says what happened. The files of the environment (package.json, vite.config.js, .gitignore) are not guessed: the stage setup prepares them for the whole run, and a step that asks a role to write them is dropped. The planner is told the five roles in its prompt and in the schema of its answer, so the plan of a model that listens names them from the start.

The plan decides the order of the stages that do its steps. The registry has an order of its own (markup, styling, coding), but the plan knows more: a step that depends on another step is done after it. The harness reads the dependencies of the plan and moves the stages of the steps accordingly — the scripts come after the styles when the plan says so. The order of the registry breaks the tie, so a plan that says nothing about the order of two stages changes nothing. A circle in the graph of the stages is broken by the order of the registry, and the run says so in its warnings: the rest of the plan keeps its order. The stages that do not work on the steps of the plan keep their place: the build is after the styles and after the code, the review is after everything.

Three stages have a floor of their own. The stage of the markup stands before the phases of the styles and the code: the skeleton of the code grows out of the markup, and a phase that starts before it writes against an empty page. The plan may tie the markup to the icons or to anything else that comes after the code — the floor wins, and the markup is placed right before the first of the phases. The stage of the vector graphics stands before the markup: the page links the files of the editor, and a markup that waits for a picture nobody has drawn yet is a stage that never ends. The plan may put the vector somewhere else, but never in the middle — between the markup and the build the graphics would wait for the page and the page would wait for the graphics. The vector stands either before the markup or at the very end of the chain, after the build and the sight of the page. When the markup is already done and the run continues, the vector stands before the build: the build carries public/ into the bundle, and an asset drawn after it never reaches the distribution.

The styles and the code are written in four phases, and the order between them is not a choice — it is the same for every page:

Phase What it writes Model Effort
pre-coding The skeleton of the code: the modules, their exports, the states of the interface, the data, the behaviour — written out of the markup and the brief of the architect. head of the family (the Sol) xhigh
pre-styling The contract of the styles: the tokens, the names of the classes, the skeleton of the layout, the rules of the components, the rules of the states, the responsive behaviour — dressed over the skeleton of the code. head of the family (the Sol) xhigh
styling The second look at the same stylesheets: what the code needs, the fine tuning. tail of the family (the Terra) high
coding The second look at the same files: the logic, the errors, the fine tuning. tail of the family (the Terra) high

The phases exist because a role that waits for something that comes after it waits for ever. The coder without a skeleton does not know which modules the page will call, and invents its own; the styler without a skeleton does not know which states the page will show, and dresses none of them. The skeleton comes first: it grows out of the markup, which does not need the styles. The contract of the styles is written second, and it dresses exactly the states and the modules that the skeleton names — then each role does its work with the other one's result on the disk.

The contract is written whole, and by the better model. The full work is a second pass over the same file — and a second pass is where the money burns: the expensive model would pay twice for the same stylesheet. So the head of the family writes the contract, and the tail of the family polishes it. The contract is written at the deepest effort (xhigh), because an error in the foundation costs more than an error in the work on top of it.

The dial of the contract is its own: pace.contractQuality. It stands higher than the dial of the work by default (75 against 50), and it lifts the effort above the ceiling of the run — the ceiling is the budget of the run, and the dial of a stage is an explicit wish of the user. Lower it to contractQuality: 50 and the contract works at the ordinary depth.

A plan that asks for another order is told: the order of the phases is stronger than the plan, and the run says which edge of the plan it dropped.

Nothing to wait for

The old deadlock: the coder needed the styles to know the class names, the styler needed the code to know the states, and the run stood still. The phases fix the order — but an order alone does not help if the role, inside its own phase, decides that it is missing something.

So the two sides have a contract instead of a dependency: the tokens, the names of the classes, the states of the interface and the data that flows between the modules. The contract is written before either side works, both sides know it in advance, and each one writes against it — whether or not the other side's full work is on the disk yet.

The rule reaches the role in two places: in its instructions, and in every turn of the request. It says, in plain words, that there is nothing to wait for, and that a step which ends with a word is better than a step that never ends.

And the run watches: a role that says it is waiting — "the styles are not written yet, I will wait for them" — is told once to work against the contract, and the step says so in its warnings. The words are matched narrowly: "missing" or "later" on their own mean nothing, and only an explicit wait is one.

The phases of the contract are not fatal. If pre-styling fails, the run does not stop: the next phase writes against the contract anyway — from the brief of the architect, from the markup, from the names that are already on the disk. Stopping there would stop the run exactly where it stood before: with a role waiting for another role.

The skeleton of the code takes only the steps that do not wait for the styles. The plan says what a step waits for, and a step of the coder that depends on a step of the styler belongs to the full work of the code — it is written after the styles, and by then they are on the disk. Without this rule the skeleton took every step of the coder, including the ones the plan puts after the styles: those steps had nothing to stand on, the role wrote them and waited for styles that were not coming, and the stage spent its whole budget on the work of another stage.

A page with a state — an app, a PWA, a router — used to be the exception: it was drawn by the scripts, so without them the screen was empty, and the code was moved before the styles. That exception is gone. It was the very reason the coder stood still: it wrote without styles, and waited for styles that were never coming. Now the page with a state walks the same four phases as any other page.

The browser follows the same rule: on a page with a state the styles are written before the scripts, so the live page is empty while the styler works. The styler is told so — an empty page and a missing script are not defects of the styles — and the browser is started only when the code is there, for the stage sight.

The two passes of a role

A phase is not a new role and not a new step of the plan. It is the same role, the same step, the same files — a different task. The report of a pass lies next to the report of the step (style-base.styler.draft.json), and the report of the step is the report of the last pass: it looks at the file that is on the disk.

That is what makes the phases possible: the styler writes the contract of the styles into the stylesheet, and the contract of the code is written after it — into the same project, on the same disk. The second pass of the coder sees the styles of the first pass of the styler, and the second pass of the styler sees the code that grew out of the contracts.

A pass that is already done is not done again. A continued run reads the reports of the passes from the disk, and the work that is already there is not paid for twice.

The contract of the states

The styles and the scripts must not need each other to learn a name. The architect names the states of the interface once — is-loading, is-open, is-error, with the selector that carries each and what it means — and both roles are written against that list: the scripts put the states on the nodes, the styles dress them. Without the list the two roles read each other's files to find the names, and each of them waits for the other: the styles wait for the scripts, the scripts wait for the styles, and the run stands still. With the list, neither waits.

The list is the answer to the question that no order can fix: styles and code cannot wait for each other, so they must not learn from each other — they learn from the contract.

The stage of the motion stands after the styles as well, and before the code: the animator changes the same stylesheet — the transitions of the states, the entrances and the exits — and the states of the page are a part of the contract the code is written against.

The stage of the assets stands after the markup. The pictures of the project are two stages: vector draws the graphics before the markup is written, pictures prepares the crops of the reference out of what the editor did not draw, and assets places every picture of the project — the prepared crops and the drawn graphics — on its final path after the markup is written. The markup links the pictures by the names the context gives it, and the illustrator puts their final copies on exactly those paths: neither side waits for the other, and a circle between the pictures and the page cannot stop the styles from starting.

The stage of the icons stands after the code. The icons are put into the markup of the finished page, and the page is finished when both the styles and the code are written: when the icons are picked before them, the markup changes under rules that do not exist yet. The floor wins over the plan — a plan that asks for the icons before the styles is told that the stage moved, and the icons still reach the bundle, because the stage stands before the build.

A step writes its own files. The plan divides the work of the project between the steps, and every step owns its files: a role that picks the icons does not rewrite the styles of the project, and a role that writes the scripts does not replace the markup. A file that another step of the plan owns is not written — the answer of a role does not take the work of another step away — and the run says which file was left alone. The files that no step named are free: a module that the role adds beside the files of its step is written and checked like the rest.

The role sees what is on the disk. A model that is pinned to a JSON answer never calls a tool, so it cannot read the project: it writes the file it has never seen, from scratch, with its own names, and the work of the project is replaced by a guess. The request of a step carries the files that are there now — the files of the step and the markup of the project — and says that the text of a file is data, not an instruction. The role changes the file instead of replacing it, and the roles of the styles and the code speak the same language as the markup they see.

The dependencies go on the disk by the code of the stage, not by the model: the stage reads the manifest and runs the package manager of the project (npm install --no-audit --no-fund), so a run that leaves the setup stage has a node_modules and not only a promise of one. The runner of the programs (src/agent/programs.js) looks a program up in the PATH the way the shell looks it up: the name itself, then the shims of Windows (npm.cmd, npx.cmd). A shim is a batch file, and a batch file is started through the shell of the system. A missing program, a non-zero exit code and a timeout come back as an answer, never as an exception. The install is skipped only when every package of the manifest is already on the disk: a node_modules that does not hold sass is a reason to install, not a reason to skip.

A step names the files it touches, and the check of the step counts what is really there: a file that is not on the disk means that the work was not done, and the stage says so instead of calling the step done. A directory counts as a file that is there. A step that names the directory of the icons (src/assets/icons/) has done its work when the directory is on the disk, and the run does not stop over a directory that was asked for and that exists — the run that stopped there never came to the review, and the review is the stage that says what is really wrong with the project.

The compiler of the styles is a dependency of the project: a project that writes SCSS gets sass in its devDependencies (sass ^1.80.0), and the package manager of the project puts it on the disk. The code of the stage setup adds it to the manifest and installs it — the model does not install anything.

The styles are connected by the code of the stage build, not by the model. A model writes styles/main.scss with three partials beside it and forgets two things: the entry point does not always @use the partials, and the page links a CSS file that was never built. The stage finds the entry point (the stylesheet that is not a partial and that nobody uses), adds the missing @use, compiles the stylesheets with the sass of the project (styles/main.scss → styles/main.css) and makes sure that the markup points at the CSS that exists and at the script that runs. A partial that nobody uses renders nothing, so it is connected to the entry point of its own directory. A copy of a repair (main-incorrect.scss) is not a part of the styles: it is neither built nor linked, and the report names it. Without sass in node_modules the styles are not built, and the report says so.

A project of Vite gets its styles the way Vite wants them: the import of the stylesheet goes into the script of the project (import './styles/main.scss'), the bundler compiles the SCSS itself, and the link of the markup to the built CSS is removed — that file is an artifact of the bundler, and a link to it breaks the build. The stage does this by the code as well: the import is added when it is missing, and the report names the specifier of the import. The styles are still checked: the compiler of the project compiles the entry point into a temporary file, so a stylesheet that does not compile is named in the report instead of breaking the build of the user later.

The files that a stylesheet uses are checked too, and the check does not need the compiler: a model that writes an entry point with @use "tokens" and writes no tokens leaves a page without styles. The stage names the missing file (Стиль не найден: scss/main.scss → tokens (scss/tokens.scss)) and the run fails — the same check runs in the stage of the step, so the role is told about the missing file and writes it.

The styles of a project have one name, and the house names it. The plan names the file that the styler writes (src/styles.scss); the architecture keeps that name, and its brief tells every role that touches the styles: the stylesheet of the project, the CSS the page loads, and the rule that the compiled CSS is the artifact of the build and nobody writes it by hand. When the architecture names a language that does not match the file of the plan, the file wins and the run says so. Without that one name, the roles each invented their own: the markup wrote styles.css into the page while the styler wrote src/styles.scss, and the build had to clean up the disagreement afterwards. The language of the house is SCSS, and the scaffold of a new project writes src/styles.scss — the name of the plan follows it.

The one name is not enough: the styles have to reach the page somehow, and the way depends on the project. A project with a bundler takes them by the import — the script of the project imports the source, the bundler compiles it, and the markup does not link a stylesheet at all. A project without a bundler takes them by the link — the page loads the compiled CSS that the build writes next to the source, and the script does not import the stylesheet, because a browser cannot read SCSS. The manifest of the project decides which way it is; the stack of the architecture is only the fallback, because the project is created after the architecture.

The contract of the styles says that to every role that touches them: the markup links the compiled CSS or links nothing, the coder imports the source (with the path relative to the script) or imports nothing, the styler writes the source, and the reviewer does not demand the other way round. Without that, the roles disagreed with each other and with the build: the markup linked the .scss source that a browser cannot read, the coder imported the artifact of the build that goes stale, and the reviewer demanded a link that breaks a bundled project. The build stage fixes what the roles got wrong: the link to the source goes away, the import of the source goes away where it does not belong, and the import of the artifact goes away where the bundler compiles the source itself.

--route <stages> chooses the stages the run goes through (the stages they need are added automatically), --stop-after <stage> (or --stop-after=<stage>) pauses the run on the border of a stage, and --resume <id> continues it later. The name of the stage of the pause is not case sensitive, and it is checked against the stages of the run: a stage that is out of the route or switched off is a usage error, not a pause that never comes.

The review repairs what it finds. The issues are grouped by the file they name, and the role that wrote the file is asked to fix it: the role of the styles fixes the styles, the role of the code fixes the code. The repaired files are compiled, and the steps that were repaired are reviewed again — the verdict of the run has to say what the project looks like now. What the first repair did not close is named again and repaired again: stages.review.repairRounds (two passes by default) says how many passes the repair gets, and the second pass says to the role that the last repair did not close the defect. "repair": false turns the repair off, and the review then only reports. The findings go to the disk before the repair starts, so a repair that runs out of time does not take the findings with it.

The repair has the budget of its stage, not the whole run. When the budget of the stage is over, the repair is cancelled and the review reports the findings it did not manage to fix: the run ends with the verdict of the review instead of a timeout. The budget of a stage stops the work of the stage too — the calls that are in flight are cancelled, so nothing is written after the failure and no tokens are spent on a stage that is already dead.

The markup and the styles have to speak the same language, and the review checks it. A class that the markup uses and that no rule describes is an element without a shape; a class that the styles describe and that the markup does not use is a rule that nobody gets. The check reads the names of both sides: the classes of the markup and the classes of the selectors of the styles, with the nested selectors of SCSS resolved (&__title inside .card is .card__title). A class of the markup without a rule is a defect of the styles, and the styler is asked to write the rule. A class that the styles describe and that disappeared from the markup while the repair was running is a renamed class: the repair rewrote the markup and changed the names on the way, so the markup is asked to bring the old names back — the styles are not rewritten to fit the new names. The names of the classes are a contract, and the request of the repair says so to every role. "checkStyles": false turns the check off, and the stage styling warns about the same mismatch while the styles are still being written.

The audit sees the project as it is. The auditor gets the fresh listing of the files of the project, the report of the build of the stage and the design of the task as the text it is — not as a flag that says "there is a design". An auditor that sees nothing but the task describes a project that does not exist: it calls a missing package.json a defect of a project that has one. The auditor is told to read the project and to run the build before it gives the verdict, and a model that answered without a single call is asked once more, with the schema in the channel of the tools. A model that is pinned to a JSON answer (schemaChannel: format) never calls a tool: for it the truth is the context, and the report of the audit says how many files were on the disk and how many calls the auditor made.

The eye of the run

The styles of a page cannot be judged by the code that writes them. A rule that compiles may still break the layout: the type is enormous, the columns run out of the screen, the picture is stretched. The stage sight closes that gap — it opens the page of the project in a real browser, takes a screenshot of it and gives the picture to the styler together with the reference of the design, so the role sees what it has written and what it has to reach. The styles it fixes land on the disk, and the page is shot again: the loop is bounded by browser.stylingVisionRounds.

The stage runs after the stage build, because the page has to be assembled before it can be looked at: the SCSS is compiled and the markup is wired to the stylesheet there. A page that cannot be opened — no browser, no entry point, a broken build — is reported and the run goes on: the styles are written either way, they are simply not checked by the eye.

The page it looks at. Two engines are supported. Headless Chrome/Edge takes the snapshot by default: it is read-only — it opens a page and takes a picture of it — and it is on every desktop. Ego Lite (ego) is the engine of the house with the window and the interaction; it is used when it is asked for explicitly (browser.engine: "ego"), because the ego lite hands the page to the session that is already open and gives nothing back to a caller that waits for a snapshot.

The live page of the project is preferred: the dev server of Vite (npm run dev → http://localhost:5173/) shows the styles as they are now, compiled by the bundler, so the next picture shows the fix right away. A server that already runs is used as it is; a server that is not running is started by the run and stopped by it afterwards. The project on Vite keeps its styles inside the script (import './styles.scss'), so the page of the root has no styles at all — the build (dist/) is what shows something when there is no live server.

The words of the page. A picture says how the page looks; the console says why it does not work. The run speaks to the browser over the Chrome DevTools Protocol and collects the console, the exceptions and the failed requests while the page loads; the log of the bundler comes with them. The role that fixes the page reads both: a failed request names the file that is missing, an exception names the line that broke, a warning of the bundler names the import that cannot be resolved.

The memory of the reference. The notes of the role — what the reference looks like and what still differs from it — go into the context of the run. The stages after the styles read them, so they know what the page is and what it is not, without seeing the picture.

{
  "browser": {
    "engine": "auto",
    "executable": null,
    "timeoutMs": 45000,
    "viewport": { "width": 1440, "height": 900 },
    "url": "",
    "devServer": "auto",
    "devTimeoutMs": 60000,
    "stylingVision": "auto",
    "stylingVisionRounds": 2,
    "compare": "auto",
    "compareDprs": [1, 1.5, 2, 3],
    "compareAtDesignWidth": true
  }
}

browser.engine is auto (prefer Ego Lite), ego (demand it) or chrome (demand a headless Chromium). browser.url is the live address of the page; empty means that the run serves the project itself. browser.devServer is off (never start it), auto (start it when the project has a dev script and nothing answers) or always. browser.stylingVision is off (never shoot), auto (shoot when the reference of the design is there — there is nothing to compare with otherwise) or always.

The same eye is available to the roles as the tool screenshot: it shoots a page of the project and answers with the file of the picture and with what the page says about itself. The styler and the editor may call it, so a role can look at the page in the middle of the work, not only when the stage asks it to.

The reviewer sees the same pictures and the same words: the screenshots of the stage sight travel with the review, next to the reference of the design, so the verdict is about the page and not only about the code.

The comparison with the reference

Two pictures of different sizes cannot be compared: the difference between them is the difference of the sizes, not the difference of the page. The house therefore measures the difference at one size — and the size of the reference is a question of the PPI, because a picture of the design is a picture of a page, and a page is measured in CSS pixels while the picture is measured in pixels of the picture.

The PPI is tried. The possible captures are 1x, 1.5x, 2x and 3x (browser.compareDprs): a picture of 2880 pixels is a page of 1440 pixels at 2x, and a picture of 1024 pixels is a page of 1024 pixels at 1x. The candidate whose width of the design is the width the page is built for wins — the width decides, because a rescale washes the differences out and the numbers alone cannot tell 1x from 2x. Every candidate is measured anyway, and the report says what each of them gave.

The page is shot at the size of the design. With browser.compareAtDesignWidth the page is opened at the size of the design — 1024×768 CSS pixels for a picture of 1024×768 at 1x — so the picture of the page and the picture of the reference are the same size and the comparison is a comparison of the page and not of the sizes. The height matters as much as the width: a page that centers its content in the window looks different when the window is taller. On the Hubfolio project the same page measured 81% at 1024×768 and 73% at 1024×900 — the same page, the same reference, only the height of the window was different.

The numbers. ImageMagick measures the difference: the root mean square error (RMSE), the structural similarity (SSIM), the correlation (NCC) and the peak signal to noise ratio (PSNR). The similarity in percent is what the role reads: 100 is the same picture.

The picture of the difference. The comparison writes it into .ai/shots/diff-<reference>-<picture>.png and it travels with the request to the role: the red places are the places where the page does not match the reference — that is where the styles are wrong — and the white places already match. The name carries the picture of the page, so a later comparison never replaces the picture that the role is looking at now.

The run shows it. The console says what was compared and what came out of it:

сверка с референсом landing.png: PPI 1x, ширина дизайна 1024x768 CSS px
  сходство 81%, RMSE 0.1873, SSIM 0.1389
  картинка различий: .ai/shots/diff-landing-page-mwk42tj5.png

The engine of the comparison. Two backends, the same answers: the native ImageMagick (magick in the PATH, or the install of the machine) and the wasm one (@imagemagick/magick-wasm, an optional dependency of the package). The native one is used when it is there; the wasm one is the fallback for the machines that have nothing installed. The numbers of the two backends agree to the fourth decimal.

The tool. The roles that look at the design may call compare_images with the reference and the picture of the page: the answer names the PPI, the numbers and the file of the picture of the difference.

{
  "browser": {
    "compare": "auto",
    "compareDprs": [1, 1.5, 2, 3],
    "compareAtDesignWidth": true
  }
}

browser.compare is off (never compare), auto (compare when the reference and ImageMagick are there) or always.

The browser that answers

The house has two eyes on the page. The first one takes a picture of it — the tool screenshot — and reads the console. That eye is enough to look at a page and not enough to use one: a menu that does not open, a form that does not submit, a script that throws on a click — none of it is visible in a picture.

The second eye is the Chrome DevTools MCP server of Google (chrome-devtools-mcp): it drives the real Chrome over the DevTools protocol and gives the roles the tree of the page, the clicks, the keys, the window, the script, the console, the requests, the picture and the styles that won. The house starts it itself:

{
  "browser": {
    "devtools": "auto",
    "devtoolsPackage": "chrome-devtools-mcp@1.13.0",
    "devtoolsTools": ["take_snapshot", "click", "get_css_styles"],
    "devtoolsTimeoutMs": 120000
  }
}

browser.devtools is off (never start it), auto (start it when the machine has Chrome and the package) or always. The server is started by the house with the flags the house needs: --headless (no window), --isolated (the profile of the user is never touched), the --viewport of the design, the Chrome the house has found (--executablePath), and no statistics (--no-usage-statistics, --no-performance-crux).

The program comes first. The installed chrome-devtools-mcp is used as it is; npx is the way out when nothing is installed — it fetches the package and starts it, which takes a minute on the first run. The global install is the fast path:

npm i chrome-devtools-mcp@latest -g

The list of the tools is short on purpose. The server knows sixty of them, and every tool is a schema that travels with every request of every turn. The house exposes eleven: take_snapshot, click, fill, press_key, navigate_page, resize_page, evaluate_script, list_console_messages, list_network_requests, take_screenshot and get_css_styles. browser.devtoolsTools replaces the list; an empty list is the list of the house.

The page is the house's business. The tools of the server name the page they work on. The house asks for the list of the pages once, when it connects, and puts the number into every call — a role never spends a turn on it. When the page is gone, the house asks again and repeats the call.

The pictures come back as pictures. The screenshot of the server is written into .ai/shots/ and named in the answer, and the loop of the role puts it back into the conversation: the role sees what the browser saw.

The roles that get the tools. styler, coder, editor and reviewer. The marker mcp:chrome-devtools in the list of the tools of a role is what gives it the tools of that server — the names of the tools of a server are not known before the server is connected.

What the DevTools give the roles that the picture cannot:

  • get_css_styles — which rule won, in which line of which file, and what the value really is. The cascade stops being a matter of opinion;
  • take_snapshot — the tree of the page with the identifier of every element: the base of every click and every filling;
  • click, fill, press_key — the behaviour, not the appearance;
  • resize_page, evaluate_script — the layout at another width, and the state of the page as the browser sees it;
  • list_console_messages, list_network_requests — the cause of what the picture shows.

The command sight

ai-webdev sight looks at the page of a project that is already there and fixes the styles. It does not plan, does not write the markup and does not start the whole pipeline: the work that is on the disk stays, and only the styles are touched.

ai-webdev sight "Make the landing like the reference" --model google/gemini-4-hydrogen

The command finds the reference of the design the way a run finds it, shoots the page of the project, gives the picture and the words of the page to the styler and writes the styles it fixed. The files of the project that are not styles are not touched.

The reference is the target when it is there. When it is not, the task of the operator is the target: the picture of the page and the words of the task are enough to fix the styles, so the command runs without a picture of the design.

ai-webdev sight "сделай заголовок крупнее, а колонки уже"

The styler answers with the model of the house for the styles — the head of its ladder — so the fix of the styles is the work of the best model of the family, not of the model of the run.

The run that was interrupted is continued by its id: ai-webdev run --resume <id>. The stages that are done are skipped, and the stage that fell is done again.

The JSON of a model

A model writes JSON the way a person writes it: single quotes, a trailing comma, a comment between the fields, a key without quotes. A strict parser calls that broken and throws the whole call away — the turn is spent for nothing, and the role is told that its own arguments are malformed.

So the JSON of a model is read as JSON5: the arguments of a tool call, the answer of a role against its schema, the plan-update block in a report, the list of the names of an icon set. All of it parses the way a model writes it. The files of the package itself — the plan, the manifest, the journal, the config — are read as strict JSON: they are ours, and a broken file of ours is a defect to be found, not a spelling to be forgiven.

The difference is not cosmetic. A call that was parsed is a call that runs; a call that was thrown away is a turn that is gone.

The hand-over between the roles

A role that meets work of another kind does not do it herself and does not describe it either: she hands it over. The markup that does not fit the design goes to the styler, the styler who finds the class names broken goes to the markup, the coder who needs a picture of the page goes to the role that can take one.

The work goes to a sub-agent: a separate thread of this process, with a clean conversation, her own instructions and her own budget of turns. The conversation of the caller is not continued — a session that has already spent its context on the wrong problem is the wrong place to solve the right one. What comes back is the report of the sub-agent and the list of the files it wrote; the disk keeps the truth.

A sub-agent carries no role of its own. Everything it is comes from this process: the role it inherits (the instructions of that role and the tools of that role), the goal of the work, the files it may touch, and the rights it has inside the project. The sub-agent never touches a file by itself — it asks this process to run a tool, and this process runs it with its own executor, its own rules and its own map of the run. So the skills, the memory, the context and the tools are the ones of the run, and the files the sub-agent writes are written the same way the files of the parent are written.

The sub-agent is a thread and not a process: it shares the project, the skills and the memory with the run, and it dies with it.

The roles that may be inherited are markup, styler, coder, editor and iconifier. The roles of the whole run — the planner, the architect, the reviewer — are not among them: they work once for the whole run, and a step does not send them a piece of work. The hand-over is one level deep: a sub-agent never gets the hand-over tool itself, so there is no chain of threads that nobody reads. A role may not hand work to itself.

The run shows the sub-agents: the dashboard gets a row per thread with the role it inherited and what it is doing, and the log of the run says when a thread starts and how it ended.

The markup is the one role with a closed door: on the stage markup it may not hand the work to styler, coder or editor — not even around the corner through another role. The styles and the scripts are the work of their own stages, and those stages have not started yet. The door opens when the stages coding and styling have started: then the markup may hand a piece of their work over. The role is told about the closed door in its instructions, so it does not spend a turn on a hand-over that is refused.

The coder has a door of its own. The styles are written before the code, and the code is written against them: the class names and the tokens are the contract of the page, so the coder may not hand the work to the styler or to the iconifier while the code is written — the repair of the styles under the written code belongs to the review. The door opens when the stage after the code has started.

{
  "tools": { "delegate": true }
}

The pictures of the reference

The sheet of the measurements names the crops of the reference: the chess piece, the wooden board, the badge. A crop is a rectangle of the screenshot, so the page around the object is still in the picture. The stage pictures gives those crops to the sibling CLI ai-image, which cuts the object out, and puts the result into assets/import/. The roles get the path of the prepared picture in the context of the run.

The stage comes after the stage plan: the plan is what measures the reference, and the crops of a reference that was not measured yet do not exist. The sheet of the measurements is read again there, so the stages after it work with the numbers that are really on the disk.

The sheet is not the only source of the crops. The measurer cuts the fragments before it writes the sheet, and a run that died in the middle leaves the fragments cut and no sheet at all. When the sheet names no crops, the fragments that are on the disk are taken: the list of the measurer (<delivery>/stages/crops.json) and, when there is no list, the files of the crops themselves (<delivery>/crops/*.png). The measurer says asset for a fragment that is worth reusing and detail for a fragment that is worth reading closely: an asset is a picture of this package, a detail is a piece of the screenshot and stays as it is.

{
  "pictures": {
    "kinds": ["image", "illustration", "artwork", "photo", "ornament"],
    "command": "background",
    "alphaMode": "auto",
    "subject": "{name}",
    "dir": "assets/import",
    "max": 6
  }
}

The kinds say which crops of the sheet are pictures. The command is the one of ai-image: background, alpha, trim or edit; the section commands names another command for a kind, and the section prompts names the prompt of the command edit.

The section model names the model that prepares the pictures: it is passed to ai-image as --image-model. Without it the model of the configuration of ai-image is used — the seedream of ByteDance by default, which cuts the subject out with a native alpha and keeps the frame of the crop.

Every model of the list is asked. One model and one attempt is a lottery: the seedream cuts the edge tight most of the time, and the sunburst of OpenAI draws the same object smoother the other time — and a chewed edge is visible on the page. The house asks the models of the list (pictures.models, and the models of the house by default: the seedream and the sunburst) and keeps the better cut-out. The better one is the one that is a real cut-out at all, then the one with the tighter edge, then the one whose background is really gone — the facts are the ones the picture CLI measures every time it cuts a picture out.

The tier of the quality goes with the request. The field is quality in the body of the request, and the models of OpenAI take it: high is the tier of the model itself, xhigh is the step above it. The models that know no such field (the seedream, the riverflow) never see it — the field stays out of their body.

{
  "pictures": {
    "model": null,
    "models": ["bytedance-seed/seedream-5-5", "openai/gpt-image-2.6-sunburst"],
    "quality": "high"
  }
}

Every model on the list is a paid call for every crop, so the list is short on purpose.

The subject is what the cut-out has to keep: {name} is the name of the item in the sheet, {use} is its use, {kind} is its kind. It is passed to ai-image as --subject, so the model knows that the piece of the board that fell into the cut of the bishop, and the piece of the bishop that fell into the cut of the board, are not part of the object and go away.

The stage answers with the pictures, with the sheet of the measurements and with the path of that sheet (sheetFile). The path is not called files: in the answer of a stage files is the list of the paths that were written, and the pipeline walks that list. A stage that answers in an unexpected shape does not kill the run: the run says what happened, writes the progress and stops on that stage.

The stage never stops the run: a crop that cannot be prepared is reported, and the crop stays as it was. A picture that is already in the directory is not prepared again — the model is not asked for the same cut twice.

The prepared picture is the asset, and it is not drawn again. The object is cut out of the reference, so a new drawing of the same object is an approximation of what is already on the disk: the badge becomes a filled disc instead of a ring, and the monogram becomes a letter. The plan does not ask for such a drawing — an element of the measurements whose kind is an asset is taken as it is — and the stage vector does not draw an SVG whose name is the name of a prepared picture: the step that would draw it is not done, and the report says why. The roles that write the markup and the code take the prepared file as it is.

A vector graphic comes into being in one of two ways. The role writes the SVG itself — it is code, and the code is checked locally — or it asks the sibling CLI for the document:

# the tracing of a raster picture: the same shapes as a document
ai-image vectorize logo.png --out assets/logo.svg

# the drawing of a new one: the picture never existed
ai-image generate "a fox badge" --format svg --out assets/fox.svg

The bridge picks the vector model of the house by itself (openai/gpt-image-2.6-sunburst), so the role names no model. Every path of the call stays inside the project, and the file of the result lands in a directory the stage opened for writing. The SVG that comes back goes through the same pipe as the one written by hand: it is validated, tidied and reported.

The roles

Every stage is done by a role: a prompt, a schema of the answer, a list of tools and a limit of turns.

Role What it does
scanner Read the project before the plan and report what is there.
planner Break the task into steps.
architect Design the structure of the project.
director Lead the steps of the plan and keep the whole in one state.
coder Write the code.
markup Write the markup.
styler Write the styles.
animator Write the motion of the result: the transitions, the entrances, the reduced motion.
illustrator Place the pictures of the project: the final path of every asset and its final format.
iconifier Pick the icons.
installer Set the environment up.
editor Edit the vector graphics and the decorations.
reviewer Review the result.
learner Write the lessons.

Seven of them take the steps of the plan: markup, coder, styler, animator, editor, illustrator and iconifier. The other seven work once for the whole run, and a step of the plan may not name them.

The motion is a work of its own: the styles are written by the styler, and the animator changes the same stylesheet — the transitions of the states, the entrances and the exits, the reduced motion. The stage animation stands between the styles and the code: the code is written against the contract of the styles, and the states of the page are part of that contract.

The pictures of the project are two stages. The stage pictures cuts the crops of the reference out of the screenshot and prepares them with the sibling CLI ai-image; it stands before the vector stage, because the editor does not draw a picture that is already prepared. The stage assets comes after the vector stage: when the vector is drawn, the whole set of the pictures is known, and the role illustrator gives every one of them its final path and its final format — and the markup links the files that are final.

The roles keep out of each other's work. The environment — the manifest, the lock file, the config of the bundler and the installed dependencies — belongs to the installer and to the stage setup, which writes it before the markup; a plan step that names only those files is dropped from the plan, whoever the role is. The stylesheets belong to the styler: the coder reads them and follows the names they give, but never changes them, and the class names are a contract between the two roles. The production build belongs to the stage build, which runs after the styles and after the code, so the coder does not chase a build that fails because the styles are not there yet. The hand-over knows the same boundaries: the markup may not hand the work to the coder, the styler or the editor before their stages have started, and the coder may not hand the work to the styler or the iconifier while the code is written. The coder never hands the work to the markup at all: the markup is written before the code, and a change of it after the code breaks what the code stands on.

The boundaries of a step hold for the tools of the role too, not only for its answer: a role that writes a file of another step with its own tool is refused, and the file of the styler stays the file of the styler. A coder that edits the stylesheet of the project changes the contract the code was written against — and the run that lets it through is how a working page becomes a broken one.

The vector editor has no shell: the graphics are text, and the stage itself parses and tidies every SVG the editor writes. A command line there would only let the role hunt for a validator it does not need — and wait for it.

The parts of the instructions

A prompt that is carried whole is noise: half of the rules do not concern what the role is doing right now, and a model with a short context forgets the important ones among them by the time it needs them. So the instructions of a role are cut into parts, and every part comes in its own moment.

Part When it comes What it holds
The spine always, in the prompt of the role Who the role is, the step, the files, the criteria, the boundaries of the work.
The rules of reading with the first turn How to read the project, and what not to do while reading: a path that was not seen does not exist, the same range is not read twice, the inputs of the run are not read again.
The rules of writing at the write gate (write_ready), right before the write How to write a file: the tools of the house, the boundaries of the step, and the permission to do the work — writing the ordinary files of the project is the work, it needs no approval and is not a forbidden action.
The craft of the files with the rules of writing The rules of the kind of the file the step writes: the styles, the markup, the code, the SVG, the picture. The craft follows the file, not the role: a step that writes a stylesheet gets the rules of the stylesheet.
The rules of the end after the first write The files are on the disk: fix a place only if a tool reported an error, and finish with the report.

The write gate is the hinge: until the role calls write_ready, it has only the read tools, and the craft of the files has not arrived yet. The gate opens, the craft comes as the last thing the model reads, and the model writes.

The gate opens on the call itself, even when the model calls it together with its reads: a gate that opens only on a lonely call makes the model repeat the same turn until the turns run out. The writes of the turn of the gate wait for the next turn — that turn is the turn of the inspection, and its budget is the reduced one — and the answer says so instead of blaming the model.

The gate may also carry an estimate: write_ready takes an optional outputTokens — how many output tokens the write of the step is expected to take. The estimate sizes the budget of the write turn, and the run clamps it into the band between the half of the write cap and the write cap itself. A missing estimate, an estimate that is not a number, and an estimate that is not positive all mean the same thing: the model did not say how big the work is, so the write turn gets the whole cap. A model that says 0 or -5 is saying "I do not know", not "write nothing" — it gets the whole cap too, and never nothing.

The estimate is a wish, not a fact, and the clamp is what makes it safe to take: a model that underestimates cannot starve its own write, and a model that overestimates cannot buy more than the cap. The answer turn and the polish of what is already on the disk keep the full cap — the answer is not the write.

The writing of several files

A step often owns more than one file, and a role writes them in one turn: several write_file calls together, or one batch call with the writes of the step. The host is asked for the calls in parallel explicitly, and a gateway that refuses the field gets the request without it.

The disk is the truth for the files a role wrote with its tools — one by one, in a batch, or with a patch. The answer of the role may carry an older text of the same file (the text before the patch, the text of the first draft), and putting that text over the disk would undo the work of the role. The stage therefore skips the files the tools of the role have written.

The result is a shorter prompt and the same knowledge at the right time. The always-on prompt of the styler is about a third shorter than before, and the rules of the stylesheet arrive whole — but only when the stylesheet is about to be written.

A refusal is treated as a misreading, not as a fact: the role is told once that the files of the project are ordinary files of a project that is being built, and it goes on with the work. A refusal that ends the step is a step with nothing in it.

The survey of the project

The stage scan runs right after the collection of the inputs and before the plan. The role scanner reads the project — the listing, the manifest, the entry points, the rules of the project and the files the task names — and answers with a survey:

  • what the project is and what state it is in;
  • the stack the project uses now, read from the disk and not from the wishes of the house;
  • the files that matter for the task: edit for the files the task has to change, read for the files it has to read, keep for the files it leaves alone;
  • the conventions of the project and where each rule comes from;
  • the risks: a missing file, a broken config, a dependency that is not installed;
  • the questions the project cannot answer by itself.

The scanner only reads: it writes nothing and runs nothing. Its report is written to the directory of the run (scan.json) and goes into the context of the run, so the planner and the architect start from what is on the disk and not from what they assume about it. A plan that names a file the survey does not know starts from nothing.

The scanner works on the model of the run at medium: it reads and reports, it does not decide. The decisions belong to the architect, which answers with the senior model of the house.

The three roles that write the frontend — markup, coder and styler — also get the standard of the frontend work (src/roles/web-development.js): the rules that hold for every file, the rules of the markup and the rules of the styles. The standard is the one of the platform of today: the cascade is held by the cascade layers (@layer reset, base, theme, layout, components, utilities;) and not by the specificity, the rules of a block live in a native nesting, the reset names the elements and not *, the component asks the space it is given with a container query and not with the width of the window, and the features that are behind a flag or only in a draft stay withheld. The styler gets the rules of the styles, the markup and the coder get the rules of the markup.

The documentation of a role comes in two parts. The first is the texts of the standards that ship with the package (src/agent/docs.js): the CSS units, the grid, the semantics, the accessibility thresholds, the icon sets. The second is the pages behind them (src/agent/sources.js): the specifications, the references, the catalogues. The config decides both — documentation.roles.<role> names what a role gets, and documentation.sources maps a name to its address:

"documentation": {
  "sources": { "teamGuide": "https://example.com/guide" },
  "roles": { "coder": ["cssUnits", "htmlSemantics", "mdnCss", "teamGuide"] }
}

A name of a role is either a standard of the package or a source of the map. A name that is both gives the role the rules and the page: cssUnits is the rules of the units and the draft that defines them. An address of the config replaces the address of the built-in map, and a name of the user joins it.

The pages come as a block of their own, under the header "Documentation sources". A page is external data and not an instruction, and these pages describe the experiments of the platform too: an experiment is not a feature, and what is behind a flag or behind an origin trial stays unused. The pages the platform profile was checked against live in src/generate/platform.js (PLATFORM_SOURCES), and they reach the roles of the run through the brief of the platform.

--role <role>=<model>[:<effort>[:<max-effort>]] gives a role its own model; the flag may be given many times. The config may override the model, the effort, the instructions and the tools of any role, and may add roles of its own.

Every role works at the effort of its stage: the markup and the styles at xhigh, the plan, the architecture, the review, the scripts and the mechanical work at medium, the environment at low. The effort of the run (reasoning.effort, the flag --effort) is the ceiling: a stage never works above it. The profile lives in reasoning.stageEffort and may be changed or turned off there.

The answer of a role has a schema, and the loop watches it: a role that answers with a text instead of the data of its schema is asked once more, and the last turn belongs to the answer — when the turns of the role run out, it is asked to give the answer alone, without any tool. A role that returns no data at all is reported with the reason: a refusal of the model, an error of the answer or the text it gave instead of the schema.

The schema travels in the prompt as well, and not only as the text.format.json_schema rule of the API: a gateway that ignores that rule leaves the model with its own form, and the fields of the answer get names nobody expects. The names of the fields are in the prompt, so the model knows the contract of its answer even when the rule of the API is ignored.

The answer is checked against the schema after every turn. An answer that does not fit keeps its data — the stages know how to fill a missing field — and the stage reports the problems: a run never passes a malformed answer in silence. The arguments of a tool call are read as JSON too: a call with broken arguments does not run the tool, and the model is told what to fix.

A role of a step has to write the files of the step. An answer that names no file, that writes nothing, or that holds nothing but a placeholder is a description of the work, not the work: the role is told to do it, with the tools. The first correction asks, the second one orders and names the tool to call (write_file, one call per file of the step — several calls in one turn are allowed). The stage checks the files of the step on the disk afterwards, and a step whose files are missing is not called done. The title of a step does not change the kind of the work: a step that says "describe the behaviour" still means the files of the behaviour.

The command that does not finish on its own is refused: a server, a watcher or a tail would hold the run until the timeout. The default time of a command is 60 seconds, and the model may ask for more.

The files of a step have to compile. After the role has written them, the code checks them: node --check for the scripts, the sass of the project for the stylesheets and the stylesheets of the compiled CSS. A file with a lost quote, a stray backslash or a rule that is not closed is found by the compiler, not by the reader of the code — and the role is told what the compiler said, so it can repair the file. A step whose files still do not compile is not called done. A project without sass in node_modules has its stylesheets unchecked, and the report says so. The names of the files that a stylesheet uses are checked without the compiler: a stylesheet that @uses a file that was never written is broken even when there is no sass on the machine, and the role is told the name of the missing file.

A partial of Sass is a file whose name starts with an underscore, and a stylesheet names it without the underscore (@use 'variables' looks for src/_variables.scss). A model that writes an entry point of four @uses and none of the four files leaves the project without styles, and the build of Vite falls with "Can't find stylesheet to import". The stage finds the missing files on its own, names them with the path they have to be written under, and calls the role of the styles again: the role writes the partials or drops the @use lines that name them. A partial that a later step of the plan writes is not a failure of the current step — the file is on the disk when the run comes to that step, and the step says so in its report. A partial that nobody writes is a failure of the step, and the report names the file that is missing.

The installer does not do the steps of the plan. The stage of the setup gives it the plan and the list of the files the plan names — the environment has to be ready for them — but not a step to work on: the markup, the code and the styles are written by the roles of the steps.

The plan of the planner has to hold the work itself: a plan without steps is a plan of intentions ("first I will study the project"), and the stages of the run have nothing to do. The planner is asked once more when its answer holds no steps, and the stage fails when the second answer holds none either. The second question goes to the tool channel: the model works with the tools of the role — it measures the picture of the reference and reads the project — and submits the plan as a call of the plan tool. A model that is pinned to a JSON answer describes the work instead of doing it, and its plan is the skeleton of the schema.

The review does not only report: it repairs. The reviewer names the file, the defect and the change that is asked for, and the role that owns that file — the role of the step of the plan that wrote it — is asked to make the change and write the file back. The step is reviewed again afterwards, so the verdict of the run says what the project looks like now. What the first repair did not close is named again and repaired again: stages.review.repairRounds (two rounds by default) says how many rounds the repair gets. The repair can be turned off in the config:

{
  "stages": {
    "review": { "repair": false }
  }
}

The frame of the page

A reference may be an upscale of a narrower page: a picture of 2000 pixels may show a page of 1440 pixels, and the model cannot tell from the picture alone — the API resizes the picture before the model sees it. The page therefore carries its own width, and the size of the reference in pixels travels to the roles that look at it (readReferences reads the header of the file; src/inputs/assets.js keeps the helper, and src/generate/references.js re-exports it).

  • The body is the container of the width of the page: container-type: inline-size; on the body, with min-block-size: 100dvh;. The body is not a scroller of its own — the document scrolls, and the scrollbar of the window is the only scrollbar of the page. A body with overflow-y: auto; inside the scrolling document gives the page two scrollbars.
  • The canvas of the page is the element with the class page inside the body: container-type: inline-size; and inline-size: var(--real-page-width, 1024px);. The content of the page is laid out in the width of the design, not in the width of the window.
  • The canvas is scaled into the window: --zoom: calc(100cqi / var(--real-page-width, 1024px)); in the theme layer, and zoom: var(--zoom, 1); on the canvas. The 100cqi is the inline size of the body — the nearest container of the canvas — and it is already free of the scrollbar of the window, so the canvas takes the whole width of the window without a horizontal scrollbar, and the proportions of the design are kept.
  • --real-page-width is the width the design really has, in CSS pixels, and it is a token of the theme layer. The architect decides it: the width of the picture is not that width — the same design comes at 1152 pixels and at 2304 pixels. The width comes from the text: the body text of a page is 16..18 CSS pixels, the measurements of the reference give its size in the pixels of the picture, and the width of the picture divided by that number gives the width of the design.
  • The narrow screen is not scaled: under the breakpoint of the narrow layout — the mobile one, not the width of the design — the canvas becomes fluid (inline-size: 100%; zoom: 1;) and the layout of the narrow screen takes over.

The markup writes the canvas and the class, the styles give it the width and the scale, and src/roles/page-frame.js holds the rules of both. The background of the page belongs to the canvas: the body is at least as tall as the viewport, and the canvas is as tall as the content. The scrollbars are not hidden on the picture of the page: a second scrollbar of the page is a defect the roles have to see, and a hidden scrollbar cannot be seen.

The inputs of a run

A run reads the direction of the design from the project itself:

Input What it gives
--input <file> The essence of the task: the notes of the author of the task.
--image <file> The picture of the task: it is staged in the project and becomes a reference.
DESIGN.md The intent of the design: the pages, the blocks, the tone.
measurements.json The measurements of the reference: the frames, the gaps, the sizes.
palette.json The colors of the design.
tokens.css The tokens of the design: the variables of the stylesheet.
AGENTS.md, CLAUDE.md The instructions of the project.
.ai/refs/, .ai/assets/ The pictures: the references, the crops, the assets.
the reference itself The screenshot of the design, attached to the request of the roles.

Every path of the table is a list of candidates: the root of the project comes first, and the directory of the measurer comes second. The measurer writes its delivery into measurements/ — measurements.json, palette.json, tokens.css, DESIGN.md — and the run finds it there. Without that, the run would measure the same picture again. The run asks the contract of the project first (.ai/manifest.json says where every system put its work) and only then the paths of the config, so a delivery that moved is still found. The paths live in the config (inputs.designMd, inputs.measurements, inputs.palette, inputs.tokens), and a path may be a list of candidates of its own:

{
  "inputs": {
    "measurements": ["measurements.json", "measurements/measurements.json"]
  }
}

The values of tokens.css win over the document and over the palette. A conflict between the sources is reported, never resolved silently.

The inputs are collected before the run and put into the context of every role, so a role does not read them again: the sheet of the measurements is big, and reading it twice costs the context of the run and brings nothing new. The tool read_file keeps the files the role has already read: the second read of a file that did not change answers with a short note instead of the whole file.

The essence of the task is the file of the flag --input: it goes into the context of every role as the block # The essence of the task, before the design and the measurements, because it says what the result has to be. The flag may be given many times, and the paths are relative to the root of the project. A file that is not there is a warning, not an error.

A file of the essence may be a template: the placeholder {{message}} is replaced with the task of the run, so the notes and the task live in one file and the file is not written twice.

{{message}}

# What needs

The board is the inset of the hero, the badge is a sunburst.

The picture of the task is the file of the flag --image: it is staged in .ai/refs/ (a file outside the project is copied there, a file of the project keeps its path) and becomes a reference of the design. The roles that look at the design see it.

The reference of the design is found by the name: a picture the task names (landing.png), a picture whose name says that it is a reference (landing, reference, screenshot, mockup, design), or a picture of .ai/refs/. inputs.reference in the config names it outright — a path or a list of paths. The same picture in two formats is one picture: the better format wins. The architect, the roles of the steps and the reviewer see that picture, so the markup and the styles follow the image and not only the numbers of the measurements.

The bridges to the sibling CLIs add more: ai-decompose splits a reference into screens, ai-measure measures a reference, and ai-image makes the pictures that the project needs.

The measurer is not only a bridge in the config: the planner, the architect and the styler have the tool call_ai_measure and may measure the reference themselves when the measurements of the project are missing or thin — ["measure", "landing.png"] for the sizes and the positions and ["palette", "landing.png"] for the colours. The tool is switched off with tools.external_measure: false in the config.

The direction of the design is not measured. The measurer writes it into its own working directory, where nobody reads it; the tokens of the reference live in measurements/DESIGN.md, and the roles take the styles upon themselves. A call of ["design", …] is refused with an answer that says where the tokens are — the measurer is not started.

The tool looks at the disk before it calls the measurer. A sheet that is already there answers the question as well as a new run: the tool answers with the path of the sheet and the number of its elements and regions, and the measurer is not started. The sheet has to belong to the picture — the field source says which one — and it has to be newer than the picture itself, so a changed picture is measured again. The fact goes into the context of the run, and the roles after that one know that the picture is measured.

Configuration

The configuration lives in ~/.ai-webdev/config.json (AI_WEBDEV_HOME moves the whole home directory). The file is optional: the CLI works on the defaults until the file appears. ai-webdev config init writes the starter file once — only the fields a user is expected to edit, everything else stays on the defaults.

{
  "model": "family:gpt",
  "reasoning": { "effort": "xhigh", "summary": "auto" },
  "backends": [
    { "baseURL": "https://routerai.ru/api/v1", "env": "ROUTERAI_API_KEY" },
    { "baseURL": "https://api.proxyapi.ru/v1", "env": "PROXYAPI_API_KEY" }
  ],
  "stack": {
    "frontendFramework": "vanilla",
    "markupLanguage": "html",
    "styleLanguage": "scss",
    "scriptLanguage": "javascript",
    "iconSet": "auto"
  },
  "agent": { "fidelity": 70, "creativity": 30, "platform": "chromium", "approve": "write", "extract": "auto" },
  "pace": { "mode": "auto", "speed": 50, "quality": 50 },
  "stages": {
    "plan": { "enabled": true, "maxTurns": 12 },
    "collect": { "enabled": true, "maxTurns": 8 },
    "animation": { "enabled": true, "maxTurns": 14 },
    "assets": { "enabled": true, "maxTurns": 10 },
    "review": { "enabled": true, "repair": true, "repairRounds": 2, "timeoutMs": 3600000 }
  },
  "bridges": {
    "decompose": { "enabled": true, "log": true },
    "measure": { "enabled": true, "log": true },
    "image": { "enabled": true, "log": true }
  }
}

The precedence is: defaults → ~/.ai-webdev/config.json → --config <file> → AI_WEBDEV_* environment → the flags of the command.

The models section holds the profile of a model: the window, the output cap, the ceiling of the effort and the channel of the schema.

{
  "models": {
    "moonshotai/kimi-k3.1-pro": { "schemaChannel": "auto" }
  }
}

The built-in profiles of the text models of the house are tuned by the live answers of the gateway (RouterAI, November 2026):

Model Context Output Ceiling Ladder
minimax/minimax-m3.1-flash 1M tokens (4 MiB) 524K xhigh low, medium, high, xhigh
google/gemini-4-hydrogen 1M tokens (4 MiB) 64K xhigh low, medium, high, xhigh
moonshotai/kimi-k3.1-pro 1M tokens (4 MiB) 944K high none, low, medium, high
openai/gpt-6.1-sol 1M tokens (4 MiB) 32K xhigh low, medium, high, xhigh
openai/gpt-6.1-terra 512K tokens (2 MiB) 16K high low, medium, high
openai/gpt-6-luna 272K tokens 128K xhigh low, medium, high, xhigh

MiniMax refuses to work without reasoning ("Reasoning is mandatory for this endpoint and cannot be disabled"), so a request for none is raised to low instead of being refused. Kimi takes the reasoning off without a refusal and answers in a fraction of the time (about 0.8 s against about 31 s at medium on the same question), so none stays on its ladder — ai-webdev run "<task>" --effort none --model moonshotai/kimi-k3.1-pro is the fast run.

Gemini 4 Hydrogen is the alternative to the Kimi: it takes the effort up to xhigh and its answer is cut at 64K tokens. The card of the vendor names the four levels of its effort (low, medium, high, xhigh) and has no none, so the reasoning off is raised to low there as well. The Kimi stays the fallback model of the house: the fallback.models chain of the configuration names it for the Gemini and for every other model.

{
  "fallback": {
    "enabled": true,
    "models": {
      "google/gemini-4-hydrogen": ["moonshotai/kimi-k3.1-pro"],
      "*": ["moonshotai/kimi-k3.1-pro"]
    }
  }
}

The models of the house

The model of the run is a family of models: the house answers with the cheapest member of the family that takes the effort of the run. The roles follow the model of the run, and a role that has its own model in the house (house.models) does not.

The chain of the model of a role is: the pin of the role (roles.styler.model or the flag --role styler=<model>), then the model of the house for the role (house.models), then the pin of the default role (roles.default.model), then the model of the run. The pin of the role wins over everything, so a run that wants another model for a role says so:

ai-webdev run "<task>" --role coder=google/gemini-4-hydrogen

The map of the house is a part of the configuration, so every name of it may be changed. A role that is named with null has no model of the house and answers on the model of the run:

{
  "house": {
    "models": {
      "styler": "family:gpt",
      "architect": "family:gpt",
      "coder": null
    }
  }
}

Two roles have a model of the house of their own. The styler writes the styles with the best model of the family, and the architect decides the structure of the project with the same model: the files, the modules and the order are the most expensive thing to change later, so the architect does not answer on the model of the run — even when the run answers on a cheap one. A pin of the role (--role architect=<model>) still wins over the model of the house.

The vector editor has one too. The graphics are geometry and letters: a cheap model draws a floppy disk well and a wordmark whose letters do not spell anything. The editor answers with the best model of the family, and its prompt says what a wordmark is — spelled text, either a <text> element with the font of the project or the paths of a real font, never a pixel font invented out of rectangles.

The animator has one as well. The motion is a matter of properties, durations and the reduced motion: a wrong easing is noticed by everybody.

The illustrator works on the tail of the family — the junior model, the Terra. Putting a picture on its place and checking it once is cheap work, and the senior model burns minutes on it: it draws, looks, draws again, and the run pays for every attempt. The place of a picture and its format are cheap to redo, so they are done by the cheap model; the motion and the vector graphics — where a wrong decision is seen by everybody — stay on the head.

The Kimi has no levels of the effort above medium — the answer of the same question costs the same seconds there — so a role that answers on it works on medium however deep the profile of the stages asks. The role also answers with its tools instead of a pinned JSON answer: a model that is pinned to a JSON answer never calls a tool, it describes the work instead of doing it.

The families of models

A family is a named list of interchangeable models, from the cheapest to the most expensive. The house knows three of them:

{
  "modelFamilies": {
    "gpt": ["openai/gpt-6.1-terra", "openai/gpt-6.2-sol"],
    "gemini": ["google/gemini-4-hydrogen", "google/gemini-4-neon"],
    "claude": ["anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5"]
  }
}

A family is named where a model is expected with the prefix family: — in the model of the run (--model family:gpt), in the pin of a role (--role coder=family:gpt) or in the model of the house (house.models.coder). The run answers with the cheapest member of the family that takes the effort the role asks for, and the rest of the list is the ladder of the budget: when the model of the family refuses, the next member answers in its place.

The list of a family is a part of the configuration, so the ladder of the budget of the house is whatever the config says.

The ranks of the house

The list of a family is also a ranking. A path of the ranks says where in its family a role answers: the role takes the first place of the path and steps down to the next one when its work is done.

The styler is the case of the house: the styles are written by the best model of the family and polished by the next one. The path [1, 0] of the family of the GPT is the Sol for the styles and the Terra for the polishing of them:

{
  "house": {
    "models": { "styler": "family:gpt" },
    "ranks": {
      "roles": { "styler": [1, 0] }
    }
  }
}

The architect has a path of its own: [1], the head of the family. It only answers, so there is nothing for it to polish — the whole session of the architect is the work of the model of the house.

{
  "house": {
    "models": { "architect": "family:gpt" },
    "ranks": {
      "roles": { "architect": [1] }
    }
  }
}

The vector editor stands on the head of the family as well: the editor draws the geometry and the letters of the graphics, and a wordmark whose letters do not spell the name is not a drawing. The animator stands there too: a wrong easing costs more than the seconds of the thinking that prevented it. The illustrator stands on the tail: the place of a picture and its format are cheap to redo, so the junior model does them.

The ladder belongs to the role. A stage of the house never lowers the model of the work on its own — with one exception, and it is the point of the ladder: the fix of the styles after the stage styling is the polish of the styler, and the polish goes with the tail of the ladder. The styles are written by the Sol, and the fixes of them — the eye of the run (sight) and the repair of the review — are the work of the Terra, the junior model of the family. The code and the markup are still repaired by the head of the ladder.

The step down is a phase of the work, not a one-way road:

  • the role works with the head of the ladder — it thinks with the model of the house;
  • when its files are on the disk, the polish of them goes with the tail of the ladder;
  • when it has to write again, the head answers again.

The model of a turn is recomputed every time, so an earlier call never takes the model of the house away for good. The hand-over follows the same rule: the work of the sub-agent is the work of the caller, so the sub-agent answers with the model of the role it inherits.

The groups of small models

A group is a named list of models of one kind — the small and the budget models of the house. The members of a group are peers: the one that fits the work answers. The house knows one group of them:

{
  "modelGroups": {
    "small": [
      { "model": "openai/gpt-6-luna" },
      { "model": "anthropic/claude-haiku-5.5", "maxContext": 100000 },
      { "model": "google/gemini-3.8-flash" },
      { "model": "minimax/minimax-m3.1-flash" },
      { "model": "z-ai/glm-5.3-flashx" }
    ]
  }
}

A group is named where a model is expected with the prefix group::

{
  "roles": { "iconifier": { "model": "group:small" } }
}

The member that answers is the first one that takes the effort of the role and fits its context. The limit of a member (maxContext, in tokens) says how much context the model is trusted with: the member is not asked when the context of the role (roles.<role>.context) is bigger than the limit. The Haiku of the group is a model of a small context, so it answers the roles with a small context and stays out of the way of the roles with a big one.

The other members of the group are the peers of the one that answered: when the model of the group refuses, the next member of the group answers in its place.

The effort of a run is not one number for everybody. reasoning.effort is the ceiling of the run, and reasoning.stageEffort says what every stage asks for:

{
  "reasoning": {
    "effort": "xhigh",
    "stageEffort": {
      "markup": "xhigh",
      "styler": "xhigh",
      "planner": "high",
      "architect": "high",
      "director": "high",
      "coder": "high",
      "iconifier": "high",
      "installer": "high",
      "editor": "high",
      "reviewer": "high",
      "auditor": "high",
      "learner": "high"
    }
  }
}

The markup and the styles carry the look of the reference: they get the deepest reasoning (xhigh). Every other stage works on high: the code, the icons, the setup, the review and the audit answer on a model that thinks long enough to be right, and the stages that only decide — the plan, the architecture — pay for the seconds of the thinking on a plan that may be thrown away. A stage never works above the ceiling of the run, and the effort of a role set in roles.<role>.effort wins over the profile. "stageEffort": null turns the profile off and leaves every role with the effort of the run.

A thinking model works for minutes without a word. The roles ask for a stream, so the thinking of the model comes as it happens, and the run says that it waits (· thinking (60s)) — the silence of the terminal is never a hang. A failed request is shown, with its retry. The request itself may stay silent for timeoutMs (fifteen minutes by default, half an hour at the most): a shorter timeout does not make the model faster, it throws the whole reasoning away and asks the same question again. A host that says nothing is not asked again — the next host of the chain answers, and the budget of the stage ends the stage if none of them does.

The stream is a couple of rows, not a wall of lines. The pieces of the thinking are gathered and written as a block (· thinking: …), and the graphical shell shows the tail of the stream in two rows that are wrapped at the width of the screen — the live log keeps the events of the run, not every token of the model. The shell redraws its frame by the difference: it writes only the rows that changed and never clears the screen, and it repaints a few times a second, not ten — a frame that changes faster than the eye reads it is only noise. The heartbeat belongs to the silence: while the model streams, the run says so with the stream itself, and · thinking (60s) appears only when the host says nothing at all.

The channel of the schema says how the answer of a role reaches the code: tool makes the schema a function the model calls, format pins the text of the answer to it, auto picks tool when the role has other tools and format otherwise. The channel matters because a model that is pinned to a JSON answer never calls a tool: it describes the work instead of doing it. auto is the channel of a model that calls its tools well, format is the channel of a model that needs the pin. The role moves the schema into the tool channel by itself when the role has to write and only describes the work.

The stage of the plan does the same when the planner answers with a plan without steps: the planner is asked again with the schema in the tool channel, so the model may measure the picture of the reference and read the project before it decides what the steps are. A plan without steps is an error with an action, not a dead run: the report names the model of the config and the ai-webdev plan <task> command, which shows the plan on its own.

The sections of the file:

Section What it holds
model, baseURL, apiKey, backends, modelsBackends, fallback The API: the model, the hosts, the pool of the fallbacks.
reasoning, limits, models The effort, the profile of the stages, the summaries, the budgets of the run and the ceilings of the models.
tools The tools the roles may call.
browser The eye of the run: the engine (auto, ego, chrome), the path of the browser, the timeout, the frame of the picture, and the eye of the styles (stylingVision, stylingVisionRounds).
stack The stack the generator writes for: the framework (vanilla, react, vue, svelte, next, astro, vite, lure, ssre), the markup, the styles, the script, the icons.
agent The knobs of the run: fidelity, creativity, platform, kind, approve, extract.
pace The dials of the team: speed, quality and the per-stage dials.
stages Every stage: enabled, maxTurns and timeoutMs (the budget of the stage; it wins over limits.stageTimeoutMs). The stage review also has repair and repairRounds.
output Where the artifacts go: dir (.ai/), work (.ai/tmp/) and assets (.ai/assets/).
inputs The names of the input files: the design, the measurements, the palette, the tokens, the files of the essence (extra) and the reference.
pictures The crops of the reference that are prepared: the kinds, the command of ai-image, the subject, the model, the directory, the limit.
memory The permanent memory: the file, the scope, the limit, the summaries of the files, the finished tasks.
context The context of the run: enabled, cache and maxBriefChars. It lives in <output.work>/<id>/context/ and dies with the run.
map The map of the run: enabled, depth, maxFiles, maxFileBytes, maxLines. It lives in <output.work>/<id>/map.json and dies with the run.
components The local registry: the directory, the index, the vendor directory.
bridges The sibling CLIs: decompose, measure, image — each may be switched off, and each may keep its log to itself (log).
roles, customRoles The roles: the model, the effort, the instructions, the tools.
documentation The documentation of a role: sources (the map of the addresses) and roles (what every role gets: the standards of the package and the pages behind them).
mcp The external tool servers.
skills The directory of the skill packs.

The home directory holds:

~/.ai-webdev/
  config.json      the configuration
  skills/          the skill packs
  components/      the sources of the local registry
  components.db    the index of the registry (SQLite)
  memory.db        the permanent memory (SQLite)
  jobs/            the background jobs

Environment

Variable Meaning
AI_WEBDEV_HOME The home directory of the CLI (~/.ai-webdev by default).
AI_WEBDEV_CONFIG The path of the configuration file.
AI_WEBDEV_API_KEY The key of the API (OPENAI_API_KEY also works).
AI_WEBDEV_BASE_URL The endpoint of the API (OPENAI_BASE_URL also works).
AI_WEBDEV_MODEL The model of the roles (AI_MODEL also works).
AI_WEBDEV_BACKENDS The JSON list of the backends.
AI_WEBDEV_EFFORT The ceiling of the reasoning effort of the run.
AI_WEBDEV_FRAMEWORK, AI_WEBDEV_MARKUP, AI_WEBDEV_STYLE, AI_WEBDEV_SCRIPT, AI_WEBDEV_ICON_SET The stack of the generator.
AI_WEBDEV_FIDELITY, AI_WEBDEV_CREATIVITY, AI_WEBDEV_KIND The knobs of the generation.
AI_WEBDEV_SPEED, AI_WEBDEV_QUALITY, AI_WEBDEV_PACE The dials of the team.
AI_WEBDEV_STAGE_<STAGE> 0 or false switches one stage off.
AI_WEBDEV_BRIDGE_<BRIDGE> 0 or false switches one bridge off.
AI_WEBDEV_BRIDGES_LOG 0 or false silences the live log of every bridge.
AI_WEBDEV_RETRIES, AI_WEBDEV_TIMEOUT_MS, AI_WEBDEV_MAX_TURNS The limits of one request.
AI_WEBDEV_LOG_DIR The directory of the log of the API calls; the name of the directory turns the log on.

The messages of the configuration validator are in Russian, as in the sibling packages @u2ai/images and @u2ai/decomposer; every other message of the CLI is in English.

The log of the API calls

A run that fails says only "failed" — unless the log is on. The log is a witness: one JSON file per request, with the body that went out, the chain of the hosts, the time of every attempt, the answer that came back and the error that broke it.

{
  "at": "2026-11-15T03:41:02.113Z",
  "path": "responses",
  "model": "moonshotai/kimi-k3.1-pro",
  "attempts": [
    { "backend": "https://routerai.ru/api/v1", "ok": true, "durationMs": 181_233 }
  ],
  "durationMs": 181_233,
  "response": { "output": [ … ] }
}

The pictures are not written into the record: the body of an image is megabytes of base64, and it is the same picture every time. The record says how big it was. The log is off by default — turn it on with the directory:

{ "logging": { "enabled": true, "dir": ".ai/logs/api" } }

or with AI_WEBDEV_LOG_DIR=.ai/logs/api.

The house of the project

Every project has one directory of its own: .ai/. Everything a run makes that is not the product itself lives there, and nowhere else.

.ai/
  tmp/<run-id>/     the state of the run: the plan, the progress, the context, the map
  assets/           the assets of the house: the pictures, the decorations, the crops
  logs/api/         the log of the API calls
  manifest.json     the contract of the project: what every system made and where it lies

The state of a run dies with the run: a new run never reads the state of the old one, and the old one never gets in the way of the new one. The output.work of the config may move the state elsewhere, but there is only one path, and it is computed in one place — the house.

The product stays where the user expects it. The site is in the root of the project, the delivery of the measurer is in measurements/, the delivery of the decomposer is in decomposition/. The house keeps the state, the assets and the contract, and it does not move the product.

The contract is how the systems of the house find each other. Every system signs its own part of .ai/manifest.json and never touches the part of another one:

{
  "manifestVersion": 1,
  "updatedAt": "2026-11-15T03:41:02.113Z",
  "systems": {
    "measurer": {
      "delivery": "measurements/",
      "artifacts": {
        "measurements": "measurements/measurements.json",
        "palette": "measurements/palette.json",
        "tokens": "measurements/tokens.css"
      },
      "updatedAt": "2026-11-15T03:40:58.002Z"
    },
    "webdev": {
      "delivery": ".",
      "artifacts": { "site": "." },
      "updatedAt": "2026-11-15T03:52:11.417Z"
    }
  }
}

The paths are relative to the project and with forward slashes: the contract is read on another machine and another system, and the path has to mean the same thing there. A run reads the contract first and only then the old paths of the config, so a project made before the contract still works.

The files of the house are written whole: the bytes go to a file next to the target and the target is replaced by a rename. A reader never sees half of a file, and a run that dies in the middle leaves the old file and not a broken one. The same is true of the JSON of the house: the manifest, the state of a run, the plan, the map, the record of a job, the config and the package.json of the project are written whole. A crash in the middle of a write leaves the old file and not a half-written JSON that no one can read.

The write policy

Two fields decide whether a run touches the project:

  • agent.extract — off (nothing is written, the files stay in the report), auto and always (the files of the answers are written; the two behave the same in this package).
  • agent.approve — the level of the confirmations: ask and read write nothing, write writes the files of the answers, all writes the files too.

So a run writes only when extract is not off and approve is write or all. The flags --extract and --approve change the two fields for one run only. A file that already exists is never overwritten, and package.json is never written by a run.

The local registry of the components

A component is a reusable piece of the interface: a tag, a version, a framework, a summary and the sources. The project declares it in .ai/component.json; the registry keeps a copy of the sources, so the project stays free to change.

ai-webdev component publish            # publish the component of this project
ai-webdev component list
ai-webdev component search "form"
ai-webdev component show button@1.0.0
ai-webdev install button@1.0.0         # a local file: package in vendor/components/button

The registry is personal and needs no network: it lives in the home of the CLI. The collect stage puts the cards of the registry into the context of the run, so the roles reuse a component that is already written instead of writing it again.

The permanent memory

The memory is a SQLite database with a full-text index: the lessons of the runs, the summaries of the files and the finished tasks. The lessons are the ones the learn stage writes at the end of a run; the next run reads them and starts from what the earlier one has learned.

ai-webdev memory add "The project uses Vite and SCSS" --as convention
ai-webdev memory list
ai-webdev memory search "vite"
ai-webdev memory rm 12
ai-webdev memory tasks

The kinds of a record: fact, convention, decision, preference, pitfall, summary, note. The scopes: global (every project) and project (this directory).

The context of the run

The permanent memory is for the project. The context of the run is for the run: what this run did, what it decided and the answers its tools already gave. The context lives in the work directory of the run — <output.work>/<id>/context/ — and dies with it.

.ai/tmp/<id>/context/
  journal.ndjson   что происходило, по одной записи на строку, в порядке событий
  state.json       что прогон знает сейчас: картинки, стадии, факты
  cache/           ответы, которые инструменты уже давали, чтобы не спрашивать дважды
  notes.md         дайджест, который читает человек

A new run starts with a clean head: the context of the earlier run never gets in the way of the new one, and nothing leaks out of it into the permanent memory except the lessons the learn stage writes on purpose.

The roles read the context before they work. The brief of the context names the exact paths of the pictures of the run, the stages that are done and the files that were written, so a model does not go looking for what the run already knows:

# The context of this run

The pictures of this run — these paths are exact, do not look for them anywhere else:
- `.ai/refs/landing.png` — the original picture

The stages of this run:
- plan: done — 3 steps.
- markup: done — index.html written.

And the roles write into it: their answers, their decisions, the plan and the lessons of the run all land in the journal and in the state. The next stage starts from that instead of asking the model the same thing again.

The economy of the run

The tokens of a run are the money of the run, and the same work can cost ten times more or ten times less. The house keeps the price down with four tools that the roles markup, styler and coder have:

Tool What it does What it saves
read_file with startLine / endLine reads a range of a file, and the answer says which lines it is (строки 2-4 из 9) the rest of the file
find_line finds the number of the lines that hold a piece of text (or a shape, with regex: true) the search of the model, and the read that follows it
patch_file changes the lines by their numbers: the patch carries the new text of the lines that change, the rest of the file is neither sent nor rewritten the whole file in the request and in the answer
batch runs a list of actions (reads, searches, patches) in one call and answers with the answer of every action, in order the turns of the run

The line is the address of a place. A role that has to change one rule finds the place with find_line, reads that range alone, and patches that range alone:

find_line  src/styles.scss  "grid-template-columns"   →  8|   grid-template-columns: 362px 1fr 158px;
read_file  src/styles.scss  6..9                      →  the four lines around it
patch_file src/styles.scss  [{8, 8, "  grid-template-columns: 1fr;"}]

The patch is applied from the bottom of the file up, so the numbers of the lines that were not touched stay the numbers they had. A patch that names a line that is not there changes nothing: the file is checked before anything is written, and the old version goes to the backup.

The moment of the read is a fact of the context of the run: the file, the range of the lines, the time of every read and the time of the first one. A file that is read in several pieces keeps the pieces it was read in — the second read does not wipe the first one. A write says that what was read is not what is on the disk any more, so the fact never lies about the file.

The data URLs of a message

A message that carries a picture as text carries it twice: once as the base64 and once as the words around it. Nobody reads the base64 — the model sees a wall of characters, the request grows by a third of the picture for nothing, and some gateways refuse such a message altogether.

So the house cuts every data URL out of the text and puts the payload into the request as what it is:

What was in the text What goes into the request
data:image/png;base64,… an image part (input_image) — the model sees the picture
data:application/pdf;base64,… a file part (input_file, file_data in base64)
data:text/plain,… a text part (input_text)

The name of the caller is a claim, the bytes are the fact. The house looks at the payload before it decides: a picture that came as application/octet-stream is a picture, a JSON that came as a blob is text, and a binary that came as text/plain is a file. The house knows PNG, JPEG, GIF, WebP, BMP, ICO, TIFF, QOI, AVIF, HEIC, PDF, ZIP, GZIP, 7-Zip, RAR, ELF, EXE, WASM, OGG, WAV, AVI and MP4 by their first bytes, and it reads a text as a text when there is no zero byte and no control character in it. A payload that claims to be base64 but does not survive the round trip is read as the text it is.

In the text itself a short note takes the place of the data URL — and when the name of the caller and the content differ, both are named:

The picture of the reference: [picture attached: application/octet-stream → image/png, 317.8 KB]

The cut happens in three places, and the third one is the safety net:

  1. the answer of a tool (function_call_output) — the payload goes into the request right after the answer, as the part it is;
  2. the items of the conversation — the same, and the assets are appended at the end;
  3. the builder of the request — every text that leaves the house is cut there, whatever path it took: the prompt of a stage, the message of a client, the answer of a tool.

The words of a message without a data URL are not touched: the house cuts the data URLs and nothing else.

The map of the run

The map of a run is the index of the files of the working directory: their lines, their symbols, their size and the moment they changed. It lives in <output.work>/<id>/map.json and dies with the run.

The tools read through the map: list_files answers from it, read_file is served from the lines it holds, and search_files searches them. A file that changed since the map was built is read from the disk again — the map never serves a stale file.

The search knows three scopes: path looks at the names of the files, content at their text, symbol at the names the code declares, all at everything.

The map does not read everything: it skips .ai, node_modules, .git and the files with secrets, it holds at most 2000 files, and a file longer than 400 lines or bigger than 32 KiB is marked partial — for such a file the search goes to the disk.

The skill packs

A skill pack is a directory with a SKILL.md inside: the markdown that teaches a role something the model does not know. The packs are looked for in the project (.agents/skills/, .koda/skills/, .claude/skills/, .rules/skills/), in the home (~/.agents/skills/) and in the package itself. The copy of the project wins over the copy of the home, and the copy of the home wins over the one of the package.

The CLIs of the house are not packs: ai-image, ai-measure, ai-decompose and ai-memory are tools — call_ai_image, call_ai_measure, call_ai_decompose and call_ai_memory. A role that asks for a skill with such a name gets a pointer to the tool instead of a refusal, and a role that asks for an unknown name gets the list of the packs that are installed.

ai-webdev skills list                # every pack: the name, the source, the description
ai-webdev skills search dialog       # the packs that mention the words
ai-webdev skills show modern-web-guidance
ai-webdev skills path modern-web-guidance
ai-webdev skills rm demo             # only the packs of the project

The design and anti-slop workflows can be installed globally and are then available to both ai-webdev and u2ai-webdev:

npx skills add heydamir/unslop -g
npx skills add felipebasurto/unslop-ui -g
npx skills add oil-oil/oil-ui -g
npx skills add GoogleChrome/modern-web-guidance -g
npx modern-web-guidance@latest install

The pack of the package is modern-web-guidance: 209 guides of the modern web platform (the dialogs, the forms, the layout, the animation, the accessibility, the performance) by the Chrome, Edge, Firefox and MDN teams, under Apache-2.0. The roles that write or judge the interface read it with the tool web_guidance:

Call What it does
web_guidance with query The search: the ids and the summaries of the guides that fit the words.
web_guidance with ids The retrieve: the whole text of the guides, by their ids.

The words of the search may come as a list as well: a model that passes ["navbar", "accessibility"] gets the guides of the navbar and of the accessibility, not the catalog of all the guides.

The guides are read from the disk of the package: no network, no npm, no waiting. The CLI of the upstream (npx modern-web-guidance@latest search|retrieve) is the fallback — for the guide that is newer than the bundle, and for the caller that asks for the CLI (source: "cli").

The second pack of the package is file-search (Netresearch DTT GmbH, MIT and CC-BY-SA-4.0): the decision procedure of a search — start narrow, count first, exclude the noise, batch the queries. Its tables speak about the command line tools (rg, fd, ast-grep, rga, tokei, scc, semgrep); the note at the top of the pack says which of the tools of this run answers each of them. The references of the pack are files of the pack, and the role reads them by their path inside it:

{ "name": "file-search", "file": "references/ripgrep-patterns.md" }

The search of the run is the tool search_files, and it answers more than the text of the matches:

Argument What it does
scope path (the names of the files), content (their text), symbol (the names the code declares), all.
glob The files the search looks at: *.scss or src/**/*.js.
exclude The files the search drops: dist/**, *.min.js.
context The lines around a hit. The line of the hit is path:line: text, the lines around it are path:line- text.
caseSensitive The plain text match respects the case.
maxResults How many lines the answer holds.

The map of the run answers the search first, and the disk answers when the map is silent: the map does not know every file of the project, and a search that finds nothing is not the end of the search.

The process of a run

A run may be paused and continued: the plan, the progress and the reports live on the disk, in the directory of the run (.ai/tmp/<id>/ by default, the id is the time).

ai-webdev run "make a landing" --stop-after plan     # pause after the plan
ai-webdev run --resume 20261113-142530                # continue it
ai-webdev jobs run -- npm run build                    # a background job of the project
ai-webdev jobs list

A run that was interrupted keeps its progress: the next run with --resume <id> continues at the stage it has not finished.

The run names itself before the first stage — Run 20261113-142530 — and a run that falls prints the command of its continuation, with everything the run needs (the config, the essence, the picture, the kind and the model):

Run 20261113-142530
…
Продолжить: ai-webdev run --resume 20261113-142530 --config .webdev.config.json --input what-needs.md --image landing.png --kind landing

The state of the run lives on the disk with it:

File What it holds
progress.json The stages of the run, their state and the task of the run.
inputs.json The collected inputs: the design, the measurements, the palette, the tokens.
pictures.json The prepared pictures and their paths.
plan.json The plan of the work.
architecture.json, setup.json The structure of the project and the environment of it.
steps/<id>.json The report of every step of the plan: the files it wrote, the checks it passed.

A continued run reads those files back: the stages that are skipped would otherwise leave the later ones with nothing. The task belongs to the run, so --resume <id> without a task of its own works on the task of the earlier run. A run whose inputs.json is missing collects the inputs again — the collection is deterministic, and the later stages need what it finds.

The reports of the steps (steps/<id>.json) are read back too: the review judges the work of the steps of the plan, and a continued run that reaches the review without those reports has nothing to judge.

A stage that is named in --route is asked for: it runs even when the progress of the earlier run says that it is done. The stages that the route adds are only the way to it, and they are skipped when their work is still on the disk. So a review that found defects and repaired them can be run again over the same project:

ai-webdev run --resume 20261113-142530 --route review

A step of the plan that is already done is not done again: its report is on the disk and its files are still there, so the run continues with the work that exists. A file that was deleted after the step means the work is gone, and the step is done again. A file that is there, but holds something else than the answer of the role, means the answer was lost — the step is done again too. The run never asks a model to write the same file twice.

A stage of a continued run is skipped only when its work is still on the disk: the progress says that the stage ran, but the answer of the role may have been lost, and a stage whose files are gone is done again. A file that was changed after the report of the step belongs to a later stage, and the run does not undo it.

The screenshot of the reference goes to the roles that copy the look — the markup, the styles and the vector graphics. The scripts, the icons and the other mechanical work get the numbers, the palette and the tokens, and no picture: a picture they do not need is uploaded, read and paid for on every turn of the role.

The log of a run names what every call touches: the path of the file that is read or written, the program that runs, the words of the search. The answer of a tool is a line under the call when it is short — the content of a file is never a line of the log.

· read_file src/main.js
· write_file index.html
· run_command npm run build
  → Записан index.html (9346 байт)

A program that runs through run_command has to finish on its own: a server or a watcher is refused before it starts, and the program never waits for the input — the input is closed at once, so a program that reads it (the console of node) ends instead of holding the run until the timeout. The dev server of vite is refused in every form (vite, npx vite, vite dev); the build of vite (vite build) is not.

The answer of a role is the work of the step: a file that is on the disk and differs from the answer is written, and the old file goes to the backup. A file that the role wrote with its own tool is left alone — the file on the disk is the truth there. A file that could not be written fails the step: a step that is not on the disk is not done.

The roles of a step read the project in one order: the entry point of the page (index.html), then the script of the entry point and the modules it imports, then the stylesheet and the partials it @uses. The paths come from list_files and search_files: a path that was not seen on the disk does not exist. The roles that write code check their work with the command of the project (npm run build, the test script) — the compiler sees the errors that the eye does not.

The search is a grep and a find at the same time. By default it greps the text of the files and answers path:line: text; inContent=0 matches the paths of the files and answers the paths themselves, and glob limits the files by their name (*.scss, src/**/*.js) before they are read. regex reads the query as a regular expression. A role that looks for a module of the script finds it by its name, and a role that looks for a rule of the styles finds it by its text.

· search_files "card" src/styles
· search_files "main" inContent=0 glob=*.scss

The icons

The icons come from the sets of the CDN: Phosphor and Lucide. The sets are big — Lucide has more than a thousand icons, Phosphor has more than a thousand five hundred — so a role that picks the icons by memory picks the wrong ones. The catalogue of a set is read from the CDN and cached: the role searches the names with search_icons and takes the ones that are really there.

· search_icons lucide "scan square"
  → Иконки набора lucide: scan-square, scan, square, scan-barcode, …
· download_icons lucide icons=["scan-square","earth","mail"] path=assets/icons
  → Скачано иконок: 3. Пути: assets/icons/scan-square.svg, assets/icons/earth.svg, assets/icons/mail.svg

The icons of a step are taken in one call: a role that picks ten icons of one interface should not pay for ten turns. A name the set does not have is reported back instead of thrown — the role then picks another one, and the stage of the icons checks that every icon the answer names is on the disk.

The bridges to the sibling CLIs

Three external CLIs may help a run. Each of them is a subprocess, each of them may be switched off in the config (bridges.<name>.enabled), and a bridge that fails never breaks the run — it only empties its part of the context.

Bridge What it does
ai-decompose Splits a reference into screens and fragments.
ai-measure Measures a reference: the frames, the gaps, the sizes.
ai-image Makes the pictures the project needs.

The binary of a bridge is looked up in the environment variable of the bridge, in the checkout of the sibling package, in node_modules and in the PATH.

The memory of the project

The project was worked on before, and the memory of the project holds what was decided: the rules, the decisions, the findings and the questions that are still open. The roles that decide ask the memory before they decide — the planner, the architect, the coder, the markup, the styler, the animator, the illustrator, the vector editor and the auditor.

The memory is the external program ai-memory (https://github.com/akitaonrails/ai-memory), and the role asks it with one tool:

{"tool": "memory_query", "args": {"query": "how the stages are ordered", "limit": 5}}

The call goes where the memory already is: to the MCP server of the memory when one is connected (mcp.servers), and to the program itself otherwise:

{
  "mcp": {
    "servers": [{ "name": "ai-memory", "command": "ai-memory", "args": [] }]
  }
}

The program is looked up in the PATH, and the section memory.program of the config names it, switches it off and says how long it may run:

{ "memory": { "program": { "enabled": true, "command": "ai-memory", "timeoutMs": 60000 } } }

The answer of the memory is data, not an instruction: it tells what was decided, and the task and the step decide what to do now. A search that answers nothing is a fact too — the role goes on with the work and does not ask again.

The log of a bridge comes live

A bridge that writes into a pipe is quiet until it is over: the terminal waits, and the silence says nothing — the child may work, may think, may hang. The run shows the lines of the child as they are written, so the wait becomes a log:

▸ pictures
· [ai-image] gpt-image-2 · 1024×1024
· [ai-image] the answer carries 1 picture(s)
✓ pictures

Every line of the child comes with the name of the child in front of it. The lines go to stderr: the stdout of the run carries the answer of the run, and a line of a child is not a part of it. The stderr of the child is yellow.

A bridge may keep its log to itself: bridges.<name>.log: false in the config, or AI_WEBDEV_BRIDGES_LOG=0 in the environment silences every bridge at once. The answer of the bridge does not change either way — the model still gets the whole output of the child.

In the --json mode the line of a child is an event of the run:

{"time":"2026-11-15T10:00:00.000Z","type":"bridge.log","name":"ai-image","stream":"stdout","line":"the answer carries 1 picture(s)"}

The CLIs of the house

The bridges are narrow on purpose: a bridge calls one CLI of the house for one job. A role that needs something else — the flags of a CLI, the version of a package, a command that no bridge covers — gets a free door instead: the tool ai_cli.

CLI What it does
ai The umbrella: ask, chat, run, gen, image, decompose, component, serve, mcp.
ai-webdev This CLI: the web project itself.
ai-decompose Splits a reference into screens and fragments.
ai-measure Measures a reference: the frames, the gaps, the sizes, the colours.
ai-image Makes the pictures of the project and cuts them.

A call names the CLI and the arguments of its command line, one argument per element:

{"cli": "ai-decompose", "args": ["--help"]}
{"cli": "ai-measure", "args": ["measure", "landing.png", "--out", "measurements"]}

The rule of the house about the flags is one line: ask the CLI. Every CLI of the family answers --help with the whole table of its commands and its flags, and --version with its version. The help is a local text — it calls no model and costs nothing, while a guessed flag costs a failed call and a wasted turn. The manual of the family — which CLI does what, the flags they share, the flags and the commands of every one of them — is in the tool ai_cli_help.

The editor does not need the free door for the pictures: the bridge of ai-image is its own door, and it is open in full. call_ai_image takes any command and any flag of ai-image, and its table of the commands and the flags is one call away — call_ai_image with the args ["--help"]. The stage of the vector keeps that door and the tools of the patch (find_line, patch_file), and it does not open the whole family: ai, ai-webdev and the other CLIs of the house stay out of it.

ImageMagick is the tool of the pictures, and the editor has it as its own tool magick: the arguments are the arguments of ImageMagick, one element per argument, and every path of the command stays inside the working directory.

{"args": ["convert", "assets/hero.png", "-resize", "800x", "assets/hero.webp"]}
{"args": ["identify", "-format", "%wx%h", "assets/hero.png"]}

The rules of a free call are the rules of every tool of the house:

  • the command is started without a shell, so the arguments are exact;
  • it runs in the working directory of the run;
  • every path of the command stays inside the working directory;
  • the file that is written lands in a directory the stage opened for writing;
  • a command that does not finish on its own is refused (a server, a watcher);
  • the config of the CLI may be named: the config of the home lives outside the working directory and is always allowed.

The binary of a CLI is looked up in the environment variable of the CLI (AI_BIN, AI_WEBDEV_BIN, AI_DECOMPOSE_BIN, AI_MEASURE_BIN, AI_IMAGE_BIN), in the checkout of the sibling package, in node_modules and in the PATH. The switch tools.external_cli turns both tools off.

Examples

# a landing page with a strict fidelity to the reference
ai-webdev run landing "repeat the mockup" --fidelity 90 --creativity 10

# a React project with TypeScript and Lucide
ai-webdev run "a small app" --frontend-framework react --frontend-script-language typescript --icon-set lucide

# the fest-live stack: the reactive DOM of @fest-lib/lure on the client
ai-webdev run "a dashboard" --frontend-framework lure

# the fest-live stack on the server: @fest-lib/ssre renders the pages, Fastify serves them
ai-webdev run "a shop with a cart" --frontend-framework ssre --kind backend

# only the plan and the architecture
ai-webdev plan "a shop with a cart" --route plan,architect

# pause after the markup, look at the files, then continue
ai-webdev run "a shop with a cart" --stop-after markup

# the machine-readable run: one json object per line
ai-webdev run "a shop with a cart" --json

# what the pipeline is
ai-webdev stages --json

Exit codes

Code Meaning
0 The run succeeded.
1 The run failed: the network, the model, the file.
2 The arguments were wrong; nothing was tried.
130 The run was interrupted.

Library API

import { main, loadConfig, STAGES, ROLES } from '@u2ai/webdev';

const exitCode = await main(['run', 'make a landing page', '--route', 'plan']);

main is the headless programmatic CLI: it runs a command without opening the terminal dashboard. loadConfig returns the merged configuration, STAGES is the registry of the stages, and runPipeline (from src/pipeline.js) runs the pipeline without the CLI. The graphical entry is mainTui from src/tui/cli.js.

The access layer

src/access is the door between the model and the machine: the files and the commands under one root. Both halves work through a backend, so the same rules hold on a native disk, in the memory, or over a remote one.

import { createAccess } from './src/access/index.js';

const access = createAccess({ root: process.cwd() });

await access.fs.writeText('notes/todo.md', '# todo');
const read = await access.fs.readText('notes/todo.md');
const found = await access.fs.search({ query: 'todo' });

const listing = await access.fs.listFiles('src', { depth: 2, limit: 400 });
const copied = await access.fs.copy('src/app.js', 'lib/app.js');

const answer = await access.exec.run('node', ['--version']);

The rules of the paths live in one place and are never optional: a path may not leave the root — neither through .. nor through a symbolic link — the secret files and the secret directories are never accessible, and the read-only directories may be read, but never written. The words of the refusals belong to the package: src/agent/paths.js keeps them Russian and borrows the rules from src/access/paths.js.

listFiles returns the tree of a path as the model reads it: the noisy folders are marked and not opened, the dot-files are hidden unless they are asked for, the sizes are in the text, and a path that does not exist yet answers with the nearest existing parent. copy copies a file or a tree under the same rules: no secret, no symbolic link, no directory into itself, and the destination must not exist unless overwrite is asked for.

An error of the filesystem is not hidden as a missing file: only ENOENT and ENOTDIR mean "there is nothing here", and every other failure — a denied permission, a broken device — travels to the caller. A run that meets such a failure says what happened instead of reporting an empty directory or a file that is not there.

Limits

  • The package writes the files of the answers, but never overwrites a file that exists and never writes package.json.
  • The icons are downloaded as files: a missing icon is a warning of the iconify stage, not a broken page.
  • The vector graphics are SVG documents: they are written and checked as text, not redrawn.
  • There is no image generator in this package: the pictures are the work of the ai-image bridge.
  • A run that is interrupted keeps its progress on the disk and can be continued with --resume.
  • A stage that does not come back in limits.stageTimeoutMs (15 minutes by default) fails with the name of the stage: a run that hangs says so instead of waiting for ever. A stage that needs more time asks for it: stages.<id>.timeoutMs wins over the budget of the run. The vector graphics ask for half an hour: a drawing is a long turn.
  • A turn has a limit of its own — an eighth of the budget of the step. A host that says nothing longer than that loses the turn, and the stage names the turn: one hung turn does not eat the whole stage.
  • The budget of a stage is divided among its steps: eight steps of one role do not each get the budget of the stage. Without the division, eight steps of twelve turns each stand for hours, and the run burns every budget without reaching the next stage.
  • The budget of the stage is a real budget: the abort of the stage reaches the request of the role. A stage that runs out of time cancels the call it is waiting for, instead of leaving it to burn tokens on a stage that is already dead.
  • The skip of the operator reaches the turn that is running: /skip stops a role that waits for a host that says nothing. The role ends as skipped, not as failed, and the run goes on.
  • A refused request is not asked again. 400 means the request is wrong, 401 and 403 mean the access is closed: the same request stays just as wrong on the next host, and repeating it only burns minutes of silence. The refusal is named at once — the status, the message, the host.
  • A host that answers nothing is not silence of a thinking model: the role that waited for the answer says that the host did not answer, and the step ends with that reason instead of hanging until the budget is over.
  • A stopped run says where it stood: the stage, the step, the turn and the tool. «It hung» is not an answer — the step and the turn are.
  • A stage with many steps gets a budget for all of them: the budget of a stage is multiplied by the number of its steps (up to three). The styles of a whole landing are three steps, and fifteen minutes for all three is not enough — the last step of a stage never starts, and the run stands still.
  • A file that is not on the disk is not a broken file: node --check says «Cannot find module» about a file that was never written, and the step says that the file is missing instead of calling the role to repair a file that does not exist.
  • The words of a role are her prose, not the code she wrote: await in a module is not an expectation of the work of another role, and a role that wrote honest code is not told to write it again.
  • A stage that fails does not always stop the run. The stages of the page itself — the markup, the styles, the code, the build — stop it: the rest of the chain would work against a page that does not exist. The decorations — the crops of the reference, the vector graphics, the assets, the motion, the icons, the look at the page — do not: the files that landed on the disk stay, the run goes on, and the review says what is missing. The run ends as partial.
  • The motion of the page is the work of the role animator, not of the styler: a step that names the transition, the entrance or the reduced motion belongs to the animator, and it goes to the stage animation with its own budget. The styler writes the layout, the tokens and the states; the animator changes the same stylesheet — but it is a separate job.
  • The vector graphics are drawn one graphic per step: a step with three drawings is a turn longer than the budget of the stage, and the budget kills the stage after the pictures are already on the disk.
  • The files a role wrote with its own tool are checked like the files of its answer: they are on the disk, and a file that does not compile is a broken file whatever wrote it.
  • The production build is not the work of a role: npm run build and vite build are refused, because the build is the work of the stage build — it runs after the styles and after the code, and a build that fails because the styles are not there yet says nothing about the code. A loop of build-and-fix over the whole project is how a run turns a working page into a broken one.
  • A picture is checked like a script: the bytes of the file must be the format of its name. An SVG written into a .webp is not a picture the browser shows, and the check of the step says so by name. The tool write_file refuses such a write at all and tells the role how to make a real picture (magick file.svg file.webp).
  • The bytes of a picture are not lines: read_file will not show what a picture looks like. A role that reads it as text gets noise, decides the file is broken and redraws it — for ever. The binary is looked at with magick (identify), and the text of a file that is not text is refused with that answer.
  • A refusal of ImageMagick is named in full: the message of the program says which primitive or which file it refused. «Code 1» without the text leaves the role guessing, and guessing is what a run does for fifteen minutes. The drawings that work are the plain ones — xc:#101828 for a background, rectangle 0,0 100,100 for a shape, text 10,60 "label" for a label, gradient:#a-#b for a gradient — and the old push defs syntax is not one of them.
  • A call repeated twice in a row is a loop, not work, and the role is told so: the same arguments twice mean that the previous answer did not satisfy it, and repeating it will not. A file the role comes back to three times in a row is the same thing: take the best of what you have, say what is not right in the report, and answer.
  • A step owns its files: the step of the illustrator that also names index.html gives the markup back to the markup, and the plan says so.
  • The assets do not wait for the markup: a plan that ties them into a circle (the pictures wait for the markup, the styles wait for the pictures) leaves the styles with no way to start. The assets stage comes before the markup, and the circle is broken.
  • A crash outside the command — an unhandled rejection, an uncaught exception — is printed and leaves the exit code of the failure: a silent death is the hardest kind of failure to read.

Development

npm test          # the whole suite, offline
npm run check     # node --check over every file of the package
npm pack --dry-run

The suite needs no network and no key: the calls of the API are made by a fake client. The suite is also guarded: test/offline-guard.js refuses every address outside the machine, so a test that reaches the outside fails fast instead of spending money.

License

MIT

About

Web-development purpose AI-agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages