vernac / architecture, expressed.
Browse documentation

Work with AI coding agents

Vernac is designed for AI-assisted development. A typed model puts business rules, use cases, permissions, ports, views and scenarios under names the agent can search. The compiler can answer questions about those names and their relationships directly. An agent can inspect a small part of a bounded context, make a focused change, and get a typed diagnostic or a scenario result in the same working session.

Give the agent a small starting context

Start with the AI language quick reference, a short task with observable acceptance criteria, and the application’s Vernac version. Name the application root, namespace or declared module, and give the exact usecase, aggregate or scenario when you know it. Say which Spring fixture or test profile actually exercises the outcome.

The agent has… Give it…
Shell access, such as Pi The quick reference and the installed matching vernac CLI. The agent can query the saved model and run warm tests without MCP.
A local MCP client The workspace and profile in the server configuration. Start the agent at vernac://docs/ai-language-reference.md, then have it query symbols or use search_docs for one exact question.
Neither tool The quick reference and the affected declaration and scenario if you know them. Ask it to open the matching task page on demand and use the project build for verification.

Add at most the one task page that resolves a syntax or workflow question. Give the tools reference only for a command or lifecycle detail the agent needs. Keep the detailed reference, full single-file bundle, unrelated example applications and generated Java out of the initial context. If a discrepancy remains, use a compiler diagnostic to choose one matching contract section or ask the application owner about the domain rule.

A harness can assign a Vernac MCP role when it launches each agent. Use a policy file to map your own role names to write areas and a tool allowlist. The agent receives a smaller tool list and immediate feedback on edits outside its assignment. Keep working-tree gates in the harness. See the role configuration.

Copy this prompt into your agent

Work in <application root>. The POM pins Vernac 0.7.0. The relevant namespace
or declared module is <name>. Implement <change>. Acceptance: <business outcome>
and <failure or boundary case>. Use profile <domain|mvc|postgres> and
<fully qualified scenario ID, if known>.

Start with the Vernac AI Quick Reference supplied here or its MCP resource.
Inspect the saved model first with vernac model list/describe/relationships
or MCP list_symbols/describe_symbol/find_relationships. Scope the query to
the actual declaration or namespace. Open only the reported source and the
closest scenario. If syntax is unclear, read one relevant task page or exact
contract section, then make a small edit and use compiler feedback. Skip the
full reference, broad example searches and generated Java for this task.

Keep business rules in the Vernac model when supported. Use the existing
project conventions, native keyword messages and a Vernac scenario where
they fit. Preserve existing Java delegates and Spring fixture/provider wiring.
Run a warm check and the named scenario, then affected cases when the change
crosses declarations. Use the configured build for Java, persistence or
packaging checks. Report the commands, profile and actual outcomes.

Replace each placeholder. Specify explicitly when another person or the IDE already owns an unsaved buffer, or when the expected result requires PostgreSQL, an authorization fixture or an external adapter.

Inspect, edit and verify

  1. Find the smallest relevant model slice. Use a bounded search with --namespace or --module, --kind and --limit. Describe the returned ID and follow direct relationships only as the task requires. An adapter, repository or scenario is often one reference away. Read the indicated source when you need the body, comments or wiring that the structured contract does not expose.
  2. Make one checkable change. With a shell agent, edit the saved .vernac source and its scenario. With MCP, use a private overlay for a trial across multiple files. Open it from the session’s saved revision, pass its client and revision to each request, and submit an atomic batch with apply_checked. The aggregate and value-field preview tools produce edits for their specific operations. General source edit batches can express other changes. Validate and test the overlay, then persist the intended changes through the agent’s file editor when they should be part of the checkout. Overlay changes live in memory.
  3. Get fast feedback. For saved sources, run vernac check --warm and vernac test --warm --scenario <qualified-scenario-id>. The MCP equivalents are check_shared_saved and test_shared_scenario. In a private overlay use check_overlay and test_scenario with its revision. Read MCP structuredContent, including scenario outcomes. Keep the workspace, profile, JDK and optional fixture classpath consistent.
  4. Verify the complete impact. Run vernac test --warm or test_shared_affected for affected saved scenarios. The first affected run establishes a baseline by running the configured profile. Refresh compiled fixtures after Java changes and use --opaque-change for other untracked inputs. Use the project’s full build and relevant integration profile when touching dependencies, Spring wiring, database migrations or packaging. Record skipped cases and test failures in the handoff.

A focused example starts from DeleteDocument and its scenarios. For syntax, see native behavior and validation. For transport, revisions, exit codes and build tools, see the AI tools reference.