Chapter 11 of 18

Seeing the app while you build it

Freddy writes the app with a coding agent beside him. Both of them need to see what they built: Freddy in the window, the agent through a server of its own. In a debug build the app shows itself to both.

Agents that know the framework

The agent writing Freddy's code does not have to guess at Tauri's or Laravel's API:

rata ai:install       # guidelines, skills, and the dev MCP server
rata ai:update        # refresh them after upgrading rata

ai:install writes the framework's guidelines as a block in AGENTS.md, and in CLAUDE.md unless it imports AGENTS.md; six skills in .agents/skills and .claude/skills, loaded only when they apply, for commands, models and migrations, resources, live queries, the Laravel backend and screens built from @elyra/ui; and an elyra-framework server in .mcp.json next to the servers already there. Only its own block and skills are rewritten, so Freddy's notes in AGENTS.md survive.

That server is rata mcp dev, and it tells the coding agent what the app is: every command with its abilities and middleware, the models, the database schema, the migrations applied or pending, the newest error in the app's log, and the guides for this version, searched. Those tools only read: a SQLite database is opened read-only, and the code is read with syn, so they need no build. While the app runs in a debug build, under rata dev, the same server also sees it: the agent lists the windows, reads one as its accessibility tree, takes a screenshot, clicks and types in it, and reads the calls it made, so it looks at what it built instead of asking. The guide has the whole list.

The difference between the two servers is worth keeping straight. The app's own MCP server, from chapter 10, is the app's commands for an agent using the app. rata mcp dev is the project for an agent writing it.

The inspector

The coding agent looks at the running app through rata mcp dev; Freddy looks at it through the inspector, a drawer in every debug build. He opens it with ⌘⌥E (Ctrl+Alt+E elsewhere). It shows what a page can't: the window's live queries, with how often each ran again and how often its result actually changed; the window's last 200 calls, with their outcome and the ability a refused one needed; and every ability the app knows, each with a switch.

The switches are the useful part. Freddy turns off notes.delete, and the window behaves as it would for a user without it: the shell refuses the command, and $can hides the button. It only takes away; nothing in the inspector can give the app more than it has. None of it is in a release build: the routes are not compiled in.

One screen in several states at once

A screen has to work in dark and light, with more contrast, for a user who may not delete, and in a narrow window. Freddy presses ⌘⌥⇧E, and the screen opens in frames side by side, one per state. Each frame is a real window of the app, so its abilities are really missing and its look is really applied, and they all follow the code through Vite and the route:

App::new().matrix(|m| {
    m.frame("As it is");
    m.frame("Light").light();
    m.frame("Can't delete").deny_abilities(["*.delete"]);
    m.frame("Narrow").size(380.0, 720.0);
})

Without App::matrix the app gets four: as it is, light, more contrast, and without abilities. A write in a frame is real, the data being the app's, so a frame that must not write is one without the abilities to. The coding agent sees them too: rata mcp dev's matrix_screenshot is a picture per frame.

Pointing at what to change

Freddy sees a button that should be red and sit to the right of Save. Instead of describing where it is, he holds ⌘⌥ and drags over it, types what should change, and presses Enter. The shell makes a UI task of it: his note, the window and route, the elements he pointed at with the Svelte file and line that drew each, the live queries the window shows, and pictures of the selection and the window. It goes on the clipboard, into .elyra/tasks/ (which rata new keeps out of git), and to rata mcp dev's ui_tasks, so the agent picks it up. When the agent calls ui_task_done, the window shows what it did. While he points, the page gets no clicks, so pointing never presses a button.

The app, checked as a whole

Each piece can be right and the whole still wrong: a command that needs an ability the app grants nowhere, so it is refused everywhere; bindings.ts older than the commands; a command that writes and needs no ability, so any script in the page can call it. rata check runs the app once in a check mode, with no window, reads the frontend's sources, and says what's wrong between the pieces, each finding with how to fix it:

On the project rata new made in chapter 2, before Freddy changed anything, it says:

$ rata check
warning  app_info needs no ability and isn't a live query, so it may write: any page script can call it.
         Give it #[command(can = "…")] and grant that ability, or allow it in elyra.toml's [check] with the reason.
warning  greet needs no ability and isn't a live query, so it may write: any page script can call it.
         Give it #[command(can = "…")] and grant that ability, or allow it in elyra.toml's [check] with the reason.
info     app_info isn't called by the frontend, and the assistant and MCP can't reach it.
         Remove it if nothing needs it, or allow it with the reason (Rust code may call it).

0 errors, 2 warnings, 1 note.

Errors make it exit with 1, and --strict counts warnings too, so it belongs in CI; chapter 18 puts it there. Freddy's greet is harmless, so he says no to that finding in elyra.toml, with the reason, and removes app_info:

[check]
allow = [
  { check = "write-without-ability", command = "greet", why = "harmless, no data" },
]

The coding agent runs the same check as rata mcp dev's app_check.

The look, checked as it's made

Chapter 2 changed the accent in app.css by hand. The inspector's Theme does it while Freddy watches: every token as a colour picker, the radius, spacing and font as sliders, and every window, the matrix's frames included, follows as he drags. Every pair that has to be readable, text on each surface, the accent's text on the accent, the focus ring, is checked against WCAG's ratio as he goes, and one that falls short offers the nearest colour that would do. Copy as CSS puts only what changed on the clipboard, for the end of app.css.

The guides are the inspector, Coding agents and the CLI page for rata check.

What you learned

  • rata ai:install gives the coding agent the framework's guidelines, skills and rata mcp dev, which reads the project and, in a debug build, sees and acts in the running app.
  • The inspector shows a window's live queries and calls, and takes an ability away to try a screen without it.
  • The matrix opens one screen in several states at once, each a real window.
  • Pointing at part of a window makes a UI task the agent picks up, with the Svelte lines that drew it.
  • rata check finds what's wrong between the pieces, for CI and the agent; the Theme Studio checks the look as it's made.
  • None of it is in a release build.
Next: in Chapter 12 Freddy connects the app to his Laravel backend.