behaviour.write
Since next
[editor or disk] Write a TypeScript behaviour to scenes/behaviors/<name>.ts beside the scene, landed only if the build's type checker passes it; else NOTHING is written and the answer has the diagnostics.
attach_to attaches it and runs the critic. Imports: types from "@argus/api", helpers from "@argus/gameplay", the project's files by relative path; nothing else. example.behaviour gives one that compiles. path instead of name: a ui/ file, checked for its kind. Change an existing file with edits, not source.
| Title | Write a behaviour |
| Mode | |
| Token cost | about 548 tokens (in the default list, paid on every call) |
| Toolset | core |
Arguments
| Argument | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|
agent | string | no | The name of the agent making the call, when several agents share one connection: each named agent is its own actor and plays its own game. Leave it out when there is one agent. | ||
attach_to | string | no | An entity id; one undo step | ||
delete | boolean | no | Remove name or path (a ui/, scene, model or data file); revert undoes; refused while referenced | ||
dryRun | boolean | no | With run: diff only | ||
edits | object[] | no | [{old, new, replaceAll?}] on an existing file: old exact, unique unless replaceAll; in order, all or none, then checked | ||
files | object[] | no | Up to 32 {name|path, source|edits|delete: true, attach_to?, props?, overwrite?}; deletes after writes; a result each | ||
name | string | no | No path or extension; the module is behaviors/<name> | ||
onEdited | no | With run: keep or overwrite hand-edited owned entities (else refused); or {id: …} | |||
overwrite | boolean | no | false | ||
path | string | no | Instead of name: ui/{screens/.tsx, styles/.css, theme/.css, locales/<locale>.json, scenarios/.json}, authoring/<name>.ts (builds entities from data), data/**.json|csv, selftest/<name>.json | ||
props | object | no | Its settings, with attach_to | ||
run | boolean | string | no | Run the authoring script written (true) or named; it replaces its <name>:* entities as one change | ||
scene | string | no | The scene file to act on. The open scene when absent. | ||
source | string | no | A new file's whole module, at most 256 KiB, default-exporting a Behavior |
Example
An MCP tools/call with the required arguments (placeholders in angle brackets).
{
"name": "behaviour.write",
"arguments": {}
}