@happyvertical/smrt-playbooks
Layered playbook definitions, app and tenant overrides, and plan resolution for agents: a named sequence of steps every agent surface follows.
What it gives you
Layered playbook definitions, app and tenant overrides, and plan resolution for agents: a named sequence of steps every agent surface follows.
- 01Resolution layers: code default, config override, stored app override, stored tenant override, runtime override
- 02A playbook is a script, never a call: resolution returns a plan and nothing here executes a step
- 03Step lists are never editable; enablement and plane lists only narrow
Define and resolve
definePlaybook registers code defaults in a global process registry, so a package ships its own playbooks. resolvePlaybook merges the layers and returns a plan or fails closed with a specific reason: unknown-playbook, disabled, plane-not-declared, intent-registry-unavailable, or unknown-intent. A TTL cache keyed by key and tenant is invalidated on override save or delete.
Two kinds of step
An operation step names a qualified model and action, never a generated tool name. An intent step names a declared view intent and is valid only where a surface is mounted. Steps never classify themselves; classification is inherited from the referenced operation and undeclared operations resolve to destructive.
Preflight predicts, never grants
preflightPlaybook resolves through the caller’s own layer chain and returns a per-step verdict of allow, deny, or unknown plus an aggregate. Every step re-enforces authorization at execution.
Package UI
No UI layer to carry
This package stays focused on models, runtime behavior, or tooling. Build its interface with smrt-ui, or use a related domain package that exposes a /svelte entry point.
Intentionally headless
Package previews
No playground module yet
This package does not currently export a ./playground module. Its component names and import path remain available in the Components tab.
Intentionally not registered
Generated interface
REST
The exact route set comes from each model's @smrt({ api }) policy
and the application manifest—not from a second controller definition.
GET /api/playbook-overrides
GET /api/playbook-overrides/:id
POST /api/playbook-overrides
PATCH /api/playbook-overrides/:idWhat stays consistent
- Tenant scope and operation permissions run before model access.
- OpenAPI and generated clients use the same manifest fields.
- Packages can expose read-only or custom action sets.
Generated interface
MCP
AI tools are generated from the methods you explicitly include. Their inputs are validated against the same model metadata used by REST and CLI.
playbook-overrides_list({ where, limit, orderBy })
playbook-overrides_get({ id })
playbook-overrides_create({ data })
playbook-overrides_update({ id, data })Agent-safe by construction
- Tool availability can be narrower than the HTTP API.
- Principal execution intersects RBAC, agent ceilings, and persona tools.
- Descriptions and schemas are emitted from source metadata.
Browser-native agent interface
WebMCP
The generated web definitions carry the same tool names, descriptions, and JSON Schema
inputs as MCP. smrt-web registers them with document.modelContext.
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
import { registerWebMcpTools } from '@happyvertical/smrt-web';
// Omitting an exposure policy registers read-only tools only.
const dispose = registerWebMcpTools(webMcpToolDefinitions);The page keeps its security boundary
- Tools execute through generated REST fetchers as the signed-in page user.
- Authentication, tenant gates, permissions, and field policy stay server-side.
- Feature detection makes registration a safe no-op outside supported browsers.
Generated interface
CLI
The app CLI turns manifest resources into predictable operator commands while keeping package-specific actions close to their models.
smrt playbook-overrides list --limit 25 --order-by created_at:desc
smrt playbook-overrides get <id>
smrt playbook-overrides create --from-file ./record.jsonMade for automation
- Machine-readable output and file-based input.
- The same include/exclude policy as other surfaces.
- Migration, introspection, dispatch, and knowledge commands stay in smrt-cli.