Plugin System

Headmaster plugins extend the agent runtime with commands, hooks, tools, dashboard surfaces, and policy checks without changing core agent code.

Plugin architecture

Manifest

Each plugin declares name, version, owner, permissions, slash commands, lifecycle hooks, dashboard contributions, and distribution metadata.

plugin:
  name: weekly-review
  version: 0.1.0
  owner: ops
  permissions:
    - runs:read
    - reports:write
  commands:
    - name: /weekly-review
      route: handlers.weekly_review
  hooks:
    - event: session:start
      handler: hooks.seed_context
    - event: tool:pre-call
      handler: hooks.policy_check
    - event: tool:result
      handler: hooks.redact_result
  dashboard:
    - tab: Weekly Review
      component: dashboard.weekly_review

Runtime hooks

HookFires whenArgumentsCan modify
session:startA run session beginsworkspace, run, agentSeed context or attach metadata
tool:pre-callBefore a tool executestool, arguments, runVeto, rewrite arguments, or require approval
tool:resultAfter a tool returnstool, result, correlation_idTransform, redact, or annotate results
approval:requestA gated output is queuedapproval, output, policyRoute or enrich approval requests
run:completeA run finishesrun, output, costsEmit summaries or archive evidence

Hook examples

export async function policy_check({ tool, arguments, run }) {
  if (tool.name === "send_email" && !run.approval_id) {
    return { veto: true, reason: "Email requires approval" };
  }
  return { allow: true, correlation_id: run.id };
}

export async function redact_result({ result }) {
  return { result: redactSecrets(result) };
}

Commands

Slash commands register in the manifest, route to a handler, and pass the invocation text, user, channel, workspace, and correlation ID to the agent runtime. Handlers can create a run, attach context, request approval, or return an immediate response.

Permission boundary

Plugins receive only the scopes declared in their manifest and can be blocked by workspace policy before activation. Test plugins in a sandbox workspace first, confirm their audit events, then promote them to production after approval.

Distribution

Private marketplace

Organizations can maintain an internal plugin catalog with approved versions, owner metadata, changelog, required scopes, and rollback instructions.