m4Mindset docs

Demos / Form copilot · Plinth

Add a new employee

An HR admin screen with six sections and a dozen rules. Tell the copilot about the new hire and it fills the form field by field, catches a salary outside its pay band, explains it, and leaves Save to you.

Plinth is a made-up HR and payroll product, and Fernway Studio is the made-up company using it. You are its admin, on the screen every HR team knows: Add a new employee. Six sections, twenty fields, and rules that live in someone's head: the salary has to sit inside the pay band for the level and the location, the payroll state follows the office, benefits start on the first of the next month. Beside the form sits a copilot.

The signature moment

Ask it to set up Maya Okafor as a Senior Product Designer in Austin at 132k. The copilot reads Fernway's pay bands, then fills the form in one go: her name and work email, the title, Design, her manager, level L4, Austin, the band, the salary, a biweekly pay schedule, Texas payroll, the equipment Design gets. Each field it sets flashes once. Then the band check catches what a busy admin would miss: L4 in Austin is band L4-T2, $112,000 to $128,000, and $132,000 is above it. The copilot says so in a sentence and proposes $128,000. Say yes and give a start date, and the problems list in the summary shrinks to nothing and Save enables. Pressing Save stays your job.

Page tools are the only way in

The agent never writes to the form directly. It calls three page tools, registered on the <mindset-agent> element with configure({ pageTools }):

  • set_field(section, field, value) sets one field. It first checks its arguments, because a model chose them: an unknown field, an option that does not exist or a date that is not YYYY-MM-DD is refused, and nothing changes. A value it can read is set even when it breaks a rule, the way a person typing it would see it, and the rule comes back as the tool's result: "Problem: $132,000 is above the band maximum."
  • focus_section(section) scrolls the form to a section and makes it current.
  • check_form() marks every empty required field and lists what is left.

Situational awareness

With every turn the page calls setSituationalAwareness() with the form's state: the current section, every filled field, the required fields still empty, each current problem and the completion percent. When you edit a field yourself, the next turn already knows it, so asking "what is still missing?" never needs a search.

The function

plinth-pay-bands holds Fernway's bands as literal data, keyed by level and location tier, with the default pay schedule and the benefits rule. It reads a level or a location in plain words ("Senior", "Austin") and returns the band code, its minimum and maximum. The page holds the same table for its own check, and a test keeps the two in step.

The strip

The strip above the stage lights only when a page tool really changed the form, and counts the fields the agent filled. A refused call, or any other tool, leaves it unlit. The Under the hood tab shows every call with its arguments and the validation result the agent got back.