/dogwood:authoring-action-schemafrom dogwood
Creates a Cedar ACTION schema (.cedarschema) for Dogwood deployments, defining entity types, actions per tool/operation, and context layout. Supports hand-writing or generating from an MCP tools/list manifest.
Ships in dogwood. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Your job: produce the action schema — a Cedar .cedarschema — that declares
the world a Dogwood deployment governs: its entity types (the principals and
resources), one action per tool/operation, and each action's context
laid out as input / output / system. This schema is the foundation every
policy scopes over, so it comes first in the lifecycle: an action schema is
required before you declare a service schema and before you write any policy.
This is a modeling task. The syntax is plain Cedar and fully documented (see
Ground truth) — the hard part is
deciding what your world looks like: which entities are principals vs
resources, what counts as one action, and which fields belong under input vs
output vs system. You also choose how to produce the file: hand-write it,
or generate it from an MCP tools/list manifest.
Do not invent Cedar schema syntax from memory, and do not return a
schema you have not checked with the dogwood CLI. Follow the loop below in
order:
.cedarschema (Step 2).dogwood schema action and fix until it exits 0; this
is mandatory (Step 3).The action schema is standard Cedar .cedarschema — Dogwood adds no schema
syntax, only a convention for the context record. Treat these docs as
authoritative; do not guess. Paths are relative to this skill directory
(.claude/skills/authoring-action-schema/); the guide lives in the
dogwood-docs crate:
../../../dogwood-docs/guide/02-policy-language.md — read the "The action
schema" section: the namespace, entity/type/action declarations, the
implicit Action segment (so action "Read" is named Ns::Action::"Read"),
action group hierarchies (in [...]), and the context.input /
context.output convention — what input vs output vs system mean and
why the grouping matters. This is the 100% reference for a hand-written schema.../../../dogwood-docs/guide/11-mcp-schema-generation.md — the MCP
generation path: the manifest format (a tools/list payload or array of
tools with inputSchema / outputSchema), the JSON→Cedar type mapping
(integer→Long, string→String, boolean→Bool, number +
format: decimal→decimal), and the Drupe template the generator
layers tools onto (principals, Gateway resource, SystemContext, and the
Mcp/CallTool action hierarchy). Read this before generating.../../../dogwood-docs/guide/12-cli.md — the CLI: the dogwood schema
group (action, mcp) and validate, their flags, --format human|json,
and the exit-code contract (0 ok, 1 usage/IO, 2 rejected). If a schema
construct is not in these docs, it does not exist — do not use it.Before writing anything, resolve the modeling questions below. These are the equivalent of policy disambiguation: a wrong answer here silently mis-shapes every policy that scopes over the schema. If you can infer an answer from a supplied MCP manifest or an obvious convention, state your assumption and proceed; otherwise ask the user, tying each question to how it changes the schema.
Which entities are principals vs resources? Principals are the actors
(a user, an agent, an IAM entity); resources are what they act on (a
gateway, a document, a tool endpoint). Declare each as an entity, with
attributes it carries (entity OAuthUser = { id: String }) and optional
tags. If the same noun could be either, ask — the choice fixes which scope
slot (principal vs resource) a policy uses.
What is one action? Model one action per tool or operation the
deployment exposes (Login, Read, SellShares). If two operations differ
only in arguments, they are still two actions. Resist collapsing distinct
tools into one.
Each action's scope. For every action, which principal type(s) may
perform it (principal: [OAuthUser]) and which resource type(s) does it act
on (resource: [Gateway])? Does it belong in a group hierarchy
(action "Login" in [Action::"CallTool"]) — the shape the MCP generator
produces and the corpus uses? Getting appliesTo wrong makes a valid policy
fail to type-check.
context: what goes in input vs output vs system? This is the
highest-value decision. Follow the convention exactly:
input: <Record> — the tool's arguments (read in a policy as
context.input.<field>). Name and type every field.output?: <Record> — the tool's result (context.output.<field>);
usually optional (output?) because it exists only after the action
resolves.system: SystemContext — the base context every action carries
({ now: datetime }; read as context.system.now).Put arguments under input, results under output. The grouping is not
decorative: it lets an action whose input and output both have a field x
keep them as two distinct leaves (input.x, output.x). Use Cedar common
types (type ReadInput = { … };) so each action references a named record.
Hand-write or generate from MCP? If the deployment already has an MCP
server (or you have its tools/list JSON), generate — it is faster,
applies the JSON→Cedar mapping for you, and layers tools onto the proven
Drupe template (principals, Gateway, SystemContext, CallTool
hierarchy). Hand-write when there is no manifest, when you need custom entity
types/attributes/tags the template does not have, or for a small bespoke set
of actions. Either way the output is a .cedarschema that goes through the
same Step 3 gate.
.cedarschemaSave the manifest (an MCP tools/list payload, or a JSON array of tools with
inputSchema / outputSchema) to tools.json, then run (the CLI must be
built with cargo build -p dogwood-cli --features mcp-schema):
dogwood schema mcp --manifest tools.json -o schema.cedarschema
This layers one Cedar action per tool onto the Drupe template, deriving
each action's context.input from the tool's inputSchema.properties and
context.output from its outputSchema, and placing tool actions
in [Action::"CallTool"]. -o writes the file (omit it to write stdout). See
the MCP doc for the exact manifest format and type mapping. After generating,
read the result — confirm the actions, their appliesTo principals/
resource, and the input/output records match your intent — then go straight
to the Step 3 gate.
Follow the "action schema" section of the policy-language doc. Declare the
namespace, the principal/resource entity types, the common type records
for each action's input/output, and one action … appliesTo { principal, resource, context } per operation. A minimal, correct shape (two tools sharing
a base context):
namespace Drupe {
type LoginInput = { user: String };
type ReadInput = { document: String, user: String };
type ReadOutput = { };
type SystemContext = { now: datetime };
entity Gateway;
entity OAuthUser = { id: String };
action "Login" appliesTo {
principal: [OAuthUser],
resource: [Gateway],
context: { input: LoginInput, system: SystemContext }
};
action "Read" appliesTo {
principal: [OAuthUser],
resource: [Gateway],
context: { input: ReadInput, output?: ReadOutput, system: SystemContext }
};
}
Match the corpus style in the guide. Keep input argument-only, output?
result-only and optional, and system for the base { now: datetime }.
Every action schema MUST be checked before you present it. Do not return a schema you have not run through the CLI — an unchecked schema is a guess, and a schema that does not resolve its own entity/action/type references will make every downstream policy fail in confusing ways. This is a hard gate.
dogwood schema actionThe dogwood CLI checks the schema in isolation — that it parses and every
type/entity/action reference resolves — with no policy or service schema needed:
dogwood schema action schema.cedarschema
0 with OK: action schema is valid. → the schema is
well-formed. Proceed.2 → the schema was rejected. The command prints each finding
as an underlined source snippet (e.g. failed to resolve types: Nope when an
appliesTo names an undeclared entity). Read it, fix, and re-run. Add
--format json for structured findings instead of rendered snippets.1 → a usage/IO problem (missing file, bad flag), not a schema
defect — fix the invocation.Iterate until dogwood schema action exits 0. Only then proceed.
schema action proves the schema is well-formed; it does not prove your
context.input paths are what a policy will actually read. To confirm that,
write a one-line probe policy that names a generated/authored action and touches
an input field, and run validate:
dogwood validate probe.dw --policy-schema schema.cedarschema
with, for example:
permit ( principal, action == Drupe::Action::"GetStockInfo", resource )
when { context.input.stock == "AMZN" };
A 0 exit proves the action name resolves and context.input.stock type-checks
against the scoped action; a 2 with attribute input.<x> … not found means the
field differs from what you assumed — fix the schema (or probe) and re-run. This
catches the mismatches schema action alone cannot.
If dogwood is not available (no built binary, no workspace), you MUST NOT
silently present the schema as correct. Instead:
appliesTo entity type and action
group parent is declared; every common type a context references exists;
input/output/system follow the convention; the implicit Action naming
is respected.dogwood schema action schema.cedarschema (and the
probe-policy dogwood validate) command so they can run the gate themselves.Treat "cannot check here" as a degraded path to flag loudly — not the norm.
Only after the gate passes (or the degraded path is explicitly flagged), present the result. Return, in this order:
output, whether you generated from MCP or hand-wrote) — called out
explicitly.dogwood schema action exited 0, and
whether you also ran the probe-policy validate..cedarschema file itself.context layout.Then point the user at the rest of the lifecycle:
Once the
.cedarschemavalidates, declare any custom event kinds or information providers with authoring-service-schema (only if you need a non-default service schema), then write policies against this schema with autoformalize-policies.
Keep the schema minimal and idiomatic — match the corpus examples in the guide. Do not add entities or actions the deployment does not have.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cedar, dogwood, action-schema, authorization-modeling, mcp-integration
npx claudepluginhub dogwood-policy/dogwood --plugin dogwood4 skills in this plugin
/authoring-service-schemaAuthor or edit a Dogwood SERVICE schema — the event schema (.dwschema: event kinds, decision vs history points, renamed/reserved fields, nested records, correlation pins) and/or information providers (providers.json + the Rhai `evaluate` implementation behind a computed guardrail fact). Use when a policy needs a non-default event model (a history-only event kind, a renamed principal field, a pin/correlation invariant) or a computed fact from a provider/guardrail. The service schema is OPTIONAL and defaults sensibly (default = request/response/error kinds with only `request` deciding, a universal principal pin giving key-local semantics, a 24h `max_window` cap, no providers, and a small standard macro library), so this also covers deciding whether one is even needed. Requires a Cedar action schema first — that is authoring-action-schema. NOT for the Cedar action schema itself (entities/actions/context) — that is authoring-action-schema. NOT for writing `.dw` policies — that is autoformalize-policies./autoformalize-policiesAutoformalize a natural-language authorization requirement into a validated Dogwood (.dw) policy. Use when a user describes access rules in prose ("only allow X if Y", "deny after Z", "no more than N per hour") and wants a compilable Dogwood policy. Disambiguates intent before formalizing, and always validates the generated policy with the `dogwood` CLI before returning it. This skill CREATES a policy from prose; it is not for running the `dogwood` CLI / validator on an existing `.dw` file (validation here is an internal step, not a standalone command — for CLI usage see the guide's command-line chapter)./dogwoodOrientation and router for authoring Dogwood authorization policies end to end. Run /dogwood when you are starting from scratch and are not sure which step you are on — it maps the lifecycle (action schema -> service schema, if needed -> policies -> validate/replay) and points you at the right task skill. This command only routes; it does not do the work itself. Not for a specific step — the three task skills (authoring-action-schema, authoring-service-schema, autoformalize-policies) each own their step.Other plugins' skills for the same job