A model is a TypeScript module that automates resource lifecycle operations.
Models declare arguments, output specifications, and methods. Each method
receives a context object with access to data repositories, vault secrets, and
output writers. The file lives in extensions/models/ and exports a model
object.
For the YAML definition layer that configures model instances, see
Model Definitions.
Export Shape
import{ z }from"npm:zod@4";exportconst model ={
type:"@mycollective/my-model",
version:"2026.05.14.1",
globalArguments: z.object({
region: z.string().describe("Target region"),}),
resources:{
instance:{
description:"Managed instance",
schema: z.object({
id: z.string(),
status: z.string(),}),
lifetime:"infinite",
garbageCollection:3,},},
methods:{
create:{
description:"Create a new instance",
arguments: z.object({
name: z.string(),}),asyncexecute(args, context){// implementation},},},};
Top-Level Fields
Field
Type
Required
Description
type
string
Yes
Unique identifier in @collective/name format.
version
string
Yes
CalVer format: YYYY.MM.DD.MICRO.
globalArguments
z.ZodTypeAny
No
Zod schema for arguments shared across all methods.
resources
Record<string, ResourceOutputSpec>
No
Named resource output specifications.
files
Record<string, FileOutputSpec>
No
Named file output specifications.
methods
Record<string, MethodDefinition>
Yes
Named methods the model exposes.
checks
Record<string, CheckDefinition>
No
Pre-flight checks that run before methods.
reports
string[]
No
Report names to run by default after method execution.
upgrades
VersionUpgrade[]
No
Version migration chain for schema changes.
MethodDefinition
Each method defines its arguments and an execute function.