Create an MView with an AI agent
Self-contained instructions for an AI model to create a complete MView package from real source data.
Create an MView with an AI agent
Give this URL to an AI agent together with your request and the path to the source file or directory. No skill installation is required.
Example prompt:
Create an MView for ./sales.csv that shows monthly sales and top clients.
Use https://carmenlabs.com/v1/createThe agent needs access to the source data and permission to create files in your workspace. The instructions below are the complete creation workflow; linked specification pages remain the authority for exact contracts and current schema values.
Instructions for the model
Treat this page as an instruction to create the MView now, not as background material to summarize. Use your filesystem and development tools to inspect the real source, create the package, and validate it. Do not stop after explaining the format, proposing code, or producing a standalone HTML mockup.
Required result
Create one directory whose name ends in .mview. It must contain, at minimum:
<descriptive-name>.mview/
├── mview.json
├── <parser module>
└── <component file>mview.json, the parser, and the component are three separate artifacts with different responsibilities. An HTML file can be the component when runtime.renderer is "html", but HTML by itself is not an MView. Add resources/ only when the component needs local assets.
If you can write to the workspace, create these files there instead of merely printing them. If you cannot write files, return every artifact in full, clearly labeled by its relative path, with no omitted sections. Do not claim completion until all required artifacts exist.
Required workflow
- Locate and inspect the real source. Find the file named by the user, or the exact files selected from a directory. Inspect enough data to determine its actual columns, structure, encoding, missing values, and useful visual treatment. Never invent source fields or sample data. If the source or directory selection is unavailable or ambiguous, ask for its path or a representative sample before generating artifacts.
- Choose a package location. Prefer
<source-name>.mview/directly beside a file source. A centralized<workspace>/.mviews/<name>.mview/package is also valid. Follow the official directory and discovery rules. Every path stored in the manifest must be relative to the MView directory. - Choose a Source Adapter and capability. Inspect the original source, select an adapter that can interpret it, and declare it in
source.adapters(orsource.files[].adaptersfor a directory). Then selectacceptsfor the normalized input the parser actually consumes, not just the file extension. Common choices are CSV/XLSX →["table"], Markdown →["markdown", "document"], JSON/YAML/XML →["tree", "structured"], logs →["log", "text"], and source code →["code", "text"]. Confirm against the real source that the adapter and normalization yield the information the user asked to view. - Create
mview.json. Read the Schema Reference and fetch the canonical JSON Schema before writing the manifest. The schema is authoritative for required properties, enums, patterns, andadditionalProperties. Preserve the user's original creation request inprompt; do not replace it with a summary. - Create the parser. Read the Parser Contract. Default-export an async function that transforms normalized
inputinto the JSON-serializable model needed by the component. It must be deterministic, use real source fields, handle expected missing or malformed values, and perform no filesystem reads or arbitrary network access. - Create the component. Read the Component Contract. Render only the parser's returned
dataplus the suppliedsettings,source, andresources. Do not read or parse the source in the component. Inspect the workspace and preserve the user's existing visual language, design system, and styles; also prioritize any explicit visual direction in the request. MView examples are references for structure and contracts, not visual templates: do not copy their HTML, CSS, typography, colors, spacing, composition, or browser-default styles. If no visual direction exists, deliberately design a presentation appropriate for the content and distinct from the examples' appearance. Prefer the simplest renderer supported by the target runtime and sufficient for the requested experience: usuallyhtmlfor a portable zero-dependency view, and React or another framework only when justified. - Validate the complete package. Validate
mview.jsonagainst the canonical schema. Confirm that every declared file exists, all manifest paths resolve relative to the package, the Source Adapter runs against the original source, parser output matches what the component consumes, and no source I/O leaked into the parser or component. Run the adapter and parser with the real normalized input and inspect the resulting data model. - Report the result. State the package path, list the files created, name the chosen capability and renderer, and report the validation performed. Clearly disclose anything you could not validate.
Minimal manifest shape
Use this only as structural orientation. Fetch the canonical schema and adapt values and filenames to the real source and requested view:
{
"$schema": "https://schemas.carmenlabs.com/mview/v1/schema.json",
"id": "sales-dashboard",
"name": "Sales Dashboard",
"version": "1.0.0",
"prompt": "Create an MView for ./sales.csv that shows monthly sales and top clients.",
"runtime": {
"environment": "web",
"renderer": "html"
},
"accepts": ["table"],
"source": {
"path": "../sales.csv",
"adapters": ["csv-table"]
},
"entry": {
"parser": "./parser.js",
"component": "./view.html"
}
}For a static HTML component, the runtime injects { data, settings, source, resources } as window.mview before inline scripts execute. The component must read window.mview.data; it must not embed invented data or fetch the source. For React or Solid, the component receives the same object as props.
Directory sources
A directory is not implicit filesystem access. Set source.kind to "directory", set the MView-level accepts to include "filesystem", and freeze a non-empty explicit selection in source.files. Each selected path is relative to source.path, unique, and declares its own ordered adapters and accepts. The parser receives the already normalized collection and must not open directory files itself. Do not add content hashes unless you calculate them using the canonical procedure in the Schema Reference.
Non-negotiable rules
- Never modify the source file or files.
- Never deliver only a standalone visualization or HTML mockup.
- Never invent columns, records, filenames, or directory membership.
- Never use absolute paths in
mview.json. - Never add manifest properties absent from the current schema.
- Never let the parser or component bypass the runtime to read source files.
- Never let a directory MView consume files outside its explicit
source.filesselection. - Never use
metadatato control rendering; runtime configuration belongs insettings. - Never claim schema conformance if the canonical schema could not be fetched or validation was not run.
- Never declare a capability because normalization succeeds mechanically; declare it only when the normalized result carries the information the user asked to view.
- Never treat an example's design as part of the MView contract or transfer it to the user's component.
Definition of done
- A
*.mview/directory exists in a valid location. -
mview.jsonexists and validates against the canonical JSON Schema. - The parser exists and consumes the normalized shape declared by
accepts. - The normalized input under the declared
acceptswas confirmed to carry the information the view presents. - The component exists and renders exactly the parser's data model.
- Every
entry,source, icon, and resource path is relative and resolves correctly. - The original user request is preserved in
prompt. - The source remains unchanged.
- The final response reports created paths and actual validation results.
If any required item is missing, the MView is not complete. Fix it before finishing.
Canonical references
- Overview: conceptual model and invariants
- Schema Reference: manifest fields and directory hashes
- Canonical JSON Schema: machine-readable validation authority
- Capabilities: accepted values and normalized input shapes
- Parser Contract: parser signature and constraints
- Component Contract: renderer-specific delivery and constraints
- Directory Layout: package placement and discovery
- Security Model: permissions, sandboxing, and regeneration
- Versioning: schema and artifact versions
Complete example
See the Sales Dashboard example for a real source CSV, manifest, parser, component, and resulting file tree. It is a technical reference, not a substitute for inspecting the user's source or a visual template for the user's design.
