Compiled behavioral description shared by Agents and Skills.
Agent and Skill DSL modules compile their declarations once and expose one immutable definition. Runtime code uses this module to resolve scoped rules, policies, prompt roots, protections, hooks, and mounted Skill configuration without flattening away ownership.
Summary
Functions
Returns every Agent and mounted-Skill action hook after logical binding.
Returns the Agent's pre-execution action guards after logical binding.
Lowers a compiled Agent or Skill module into its portable canonical IR.
Returns the canonical Definition or raises with its stable lowering reason.
Returns the compiled definition exposed by a DSL module.
Returns a definition or raises an ArgumentError with a stable reason.
Resolves the definition active for a route scope.
Returns the definition for a scope or raises an ArgumentError.
Returns Agent injections followed by the active Skill injections.
Composes the compiled source into a sealed Definition Manifest V2.
Composes a compiled Definition Manifest or raises.
Returns the mount for a scope when it exists.
Builds a normalized compiled definition.
Resolves a policy reference to its definition and owning scope.
Returns the local policy name from a scoped reference.
Returns a stable policy reference for a scope.
Returns the scope carried by a policy reference.
Resolves an owning module's prompt root within an Agent composition.
Returns every protection visible to an Agent with Skill action bindings and scoped policy references applied.
Returns every rule visible to an Agent with mount ownership materialized.
Types
@type kind() :: :agent | :skill
@type scope() :: :agent | {:skill, term()}
@type t() :: %Spectre.Definition{ after_actions: [map()], before_actions: [map()], change_surface: Spectre.Morph.Surface.t() | nil, config: keyword(), extensions: [Spectre.Extension.Mount.t()], id: term(), injections: [term()], kind: kind(), owner: module(), policies: map(), prompt_root: String.t(), protections: [map()], requirements: [map()], router: keyword(), rules: [map()], skills: [Spectre.Skill.Mount.t()], stack: module() | nil, stack_refs: [Spectre.Stack.Ref.t()], version: pos_integer() }
Functions
Returns every Agent and mounted-Skill action hook after logical binding.
Returns the Agent's pre-execution action guards after logical binding.
Guards are Agent-owned infrastructure: Skills cannot contribute them.
@spec canonical( module(), keyword() ) :: {:ok, Spectre.Definition.Canonical.t()} | {:error, term()}
Lowers a compiled Agent or Skill module into its portable canonical IR.
This snapshots governed prompt assets, replaces executable callbacks with compiled code references, and returns the content-addressable Definition envelope used by projections.
@spec canonical!( module(), keyword() ) :: Spectre.Definition.Canonical.t()
Returns the canonical Definition or raises with its stable lowering reason.
Returns the compiled definition exposed by a DSL module.
Legacy Agent modules that only expose the original metadata callbacks are normalized into a definition so runtime callers have one access path.
Returns a definition or raises an ArgumentError with a stable reason.
Resolves the definition active for a route scope.
Returns the definition for a scope or raises an ArgumentError.
Returns Agent injections followed by the active Skill injections.
Scope-specific ordering is handled later by Spectre.Prompt.Plan; this
function only selects definitions participating in the current route.
@spec manifest( module(), keyword() ) :: {:ok, Spectre.Definition.Manifest.t()} | {:error, term()}
Composes the compiled source into a sealed Definition Manifest V2.
Stack V1 declarations are treated as requests and intersected with the
trusted :authority_ceiling. Omitting that ceiling produces no grants.
@spec manifest!( module(), keyword() ) :: Spectre.Definition.Manifest.t()
Composes a compiled Definition Manifest or raises.
@spec mount(module(), scope()) :: Spectre.Skill.Mount.t() | nil
Returns the mount for a scope when it exists.
Builds a normalized compiled definition.
Resolves a policy reference to its definition and owning scope.
Legacy atom references resolve in Agent scope. Skill policy references are
represented as {{:skill, mount_id}, policy_name}.
Returns the local policy name from a scoped reference.
Returns a stable policy reference for a scope.
Returns the scope carried by a policy reference.
Resolves an owning module's prompt root within an Agent composition.
Returns every protection visible to an Agent with Skill action bindings and scoped policy references applied.
Returns every rule visible to an Agent with mount ownership materialized.