Browse the docs · Apps
docs / interface

Apps

An app is a view over one kind of record. A launch plan, a poll, a calendar event: each record is a document with a type and fields. People use an app by clicking it; agents use it by writing its records. An agent can also write a new app when your team needs one, and everyone uses it the same afternoon.

How it works

An app owns one record type, its dataType. Or it owns none and opens the file types it says it edits, which is what an editor is. Its records are documents, so they sync, merge and keep their history like any other, and every surface that shows them stays in step. See shared data types.

An app's view is a single page built from your source. It runs sandboxed, with no network, so everything it needs is bundled into the page. It talks to Mod through a bridge that refuses anything the app did not declare: the reads and writes in its manifest name the record types it may use, and nothing else gets through.

An app's source is documents too. When you push an app, its source files go into the project beside it, so a person or an agent can change them there like any page, and the next build can start from that copy. A push will not silently overwrite an edit someone made in the project.

An app ships with a skill: a SKILL.md beside its package.json that tells an agent how to use it. An app can also give agents tools that change its records with no view open. These run on your machine from any surface, and are declared in the manifest, so reading what a tool does never means running the package's code.

An app is installed in one project or in your whole World. When two apps can open the same type, you choose which one does, in Settings under Open with.

Using it as you build

Scaffold an app, then build and push it to a project:

mod-next app init launchplan --dataType launchplan
mod-next app push <projectId> --dir launchplan

Add --world to install it for every project. Pull the project's copy of the source back to disk with mod-next app pull, or build straight from it with app push --from-project. Publish to the registry with mod-next app publish, and start from someone else's published source with mod-next app fork <lineageId> --dir <folder>.

The app is described by the mod field of its package.json:

"mod": {
  "name": "Launch plan",
  "description": "A launch and who owns it.",
  "dataType": "launchplan",
  "presentation": "document",
  "fields": { "work": "What is launching", "owner": "Who owns it" },
  "reads": ["tasks"],
  "writes": ["tasks"],
  "entry": "dist/index.html"
}

handles lists the file types an editor opens, icon sets its tile, and worker declares its package tools, the tools it gives agents (see tools). You decide the view, the shape of your record, and the skill that tells an agent how to use it.

Agents work with apps through tools: list_apps and read_app to find an app and read what it declares, update_app to fix its registration in place, run_app_tool to run a tool an app offers, and run_action to run an app's actions (see hands, and make your app work with agents). mod-next apps list <projectId> lists a project's apps from the terminal.

Limits

  • An app's dataType cannot be changed after it is registered: it is the identity of every record of that type.
  • One app owns a type in a project. Pushing a second app on the same type is refused; adopt the existing one instead.
  • An app's view has no network access and no readable console. Bundle everything into the page.