Agent / Expose, do not reimplement
What an agent may see: context and resources
The contract's context is a foldkit-surface Surface or Projection. This is
usually the best place to reuse an existing feature boundary:
ts
context: OverviewThat gives the agent a coherent read model without giving it the root Model. The same projection can also be rendered by a view, inspected by tooling, or used by another Foldkit Plus package.
This matters because an agent does not need access to state merely because the application has it. Treat context like an API response: include the information required to reason about the task and leave everything else out.
For additional named reads, use resources:
ts
resources: [
Agent.resource('counts', {
description: 'How many todos are active and completed',
schema: Schema.Struct({
total: Schema.Number,
active: Schema.Number,
completed: Schema.Number,
}),
read: model => counts(model),
}),
]A useful distinction is:
context = the default read model for this agent
resource = an additional named, read-only piece of information
message = a capability that may change the application