The agent loop
Let an agent write, check, render, look at, and repair a template over the CLI, hosted MCP, or the hosted assistant, all on the same files.
The product is a tight loop an agent can run on its own: write, check, render, look, repair. Every agent gets the same loop over the same files. A developer's agent uses the CLI, the hosted assistant in the dashboard uses its own tools, and any other agent uses MCP.
| Step | Developer's agent (CLI) | Hosted assistant | MCP |
|---|---|---|---|
| Read the project | Files on disk | inspect_project, read_file | templates_open_workspace |
| Edit | Its own editor | patch_files | templates_patch_workspace |
| Check | samva templates check | check_project | templates_check_workspace |
| Render a fixture | samva templates render --fixture no-tracking | render_fixture | templates_render_fixture |
| Look at it | samva templates snapshot | screenshot_fixture | templates_snapshot_fixture |
| Save | git commit, git push | save_workspace, after you approve | templates_save_workspace |
| Publish | samva templates publish | You publish | templates_publish |
What each step returns
- Check compiles every template and validates every fixture, then returns
diagnostics: a code, a location, and a fix for each finding.
--jsonadds the range and severity in a form a tool can apply. - Render returns the subject, preheader, HTML, and plain text for one named fixture. On the CLI,
--localeand--time-zonerender for a specific reader. A build that failed returns no render beside the findings that explain it. - Look returns screenshots of one fixture. The CLI writes desktop and mobile PNG files, in light
and dark, to
.samva/snapshots; the MCP tool and the hosted assistant return desktop and mobile images. - Save appends one Git commit after validating every template and fixture. Publish needs a clean, pushed commit.
A typical repair
- The agent runs
samva templates check --jsonand reads the findings. - It fixes the location a finding names, such as guarding
input.trackingUrlwithinput.trackingUrl && .... - It renders the fixture that exercises the change, for example
samva templates render order-shipped --fixture no-tracking. - It takes a snapshot and looks at the mobile and dark variants.
- It commits when the check is clean.
What agents can read
- The hosted MCP server publishes the template guide, the full reference, and a machine-readable
contract as resources:
samva://guide/template-editor,samva://reference/sml, andsamva://reference/contract. The contract lists the components with their props, the forms of the static profile, the formatters, and the diagnostic codes, generated from the compiler so it does not drift. See Connect an agent over MCP. - The
@samva/markuppackage ships the same contract as@samva/markup/contract.json, a readablegenerated/reference.md, and thesmlskill, so an agent working in a clone has everything without a connection. - The
samvaAgent Skill routes an agent to the template authoring reference. - This documentation is available as Markdown, and
llms.txtlists every page.
Two edits, one meaning
The canvas, the assistant, and a developer's push all land as revisions of the same file. When two revisions touch the same lines, the conflict surfaces for explicit resolution instead of one edit silently winning.