Artifact Schema Specification
Canonical YAML frontmatter schema and required fields for all artifact types in the Apothem source tree, with per-class templates and validation rules.
Per-class YAML frontmatter templates and required fields for all Apothem ecosystem artifacts.
Source of truth. The machine-readable, gate-enforced contract is the per-class JSON Schemas under
src/apothem/schemas/(agent.schema.json,command.schema.json,skill.schema.json, …). The skill and command schemas declareadditionalProperties: false, so they reject unknown keys; the agent, output-style, and plan schemas declareadditionalProperties: true. This page andfrontmatter-schema.mdxare the two human-readable projections of those schemas — this page carries the per-class templates and worked examples, frontmatter-schema the terse required-key index. Where a page disagrees with the JSON Schemas, the schemas win.
Overview
All artifacts in the Apothem source tree (under src/apothem/ and the
root configuration surface) must include a YAML frontmatter block
(between --- delimiters) with mandatory and optional fields specific
to their artifact type. This document defines the canonical schema for
each type.
Universal Rules:
- Frontmatter is YAML 1.2 compliant
- All string values use double quotes, and an empty string is written
"" - Field order: mandatory fields first, optional fields grouped by relevance
- Comments in frontmatter use
#with space:# comment - Path values must be relative (no leading
/) and use forward slashes (/) for cross-platform compatibility
Versioning Convention (versioned artifact classes — commands, helpers, skills, CLAUDE.md):
versionis semantic (MAJOR.MINOR.PATCH). Bump MAJOR for breaking schema or contract changes; MINOR for additive non-breaking changes (new optional fields, additional sections, additional anti-patterns); PATCH for a behavioral change that corrects an existing directive without breaking the contract.- Typo fixes, link fixes, formatting, and comment-only or documentation-only edits leave
versionunchanged. Only a behavioral change bumps it. updatedis the ISO 8601 date (YYYY-MM-DD) of the most recent edit. It must change with everyversionbump, and it changes on a non-version-bumping typo or link fix as well.- New artifacts seed at
v0.Y.Z. Promotion tovX.Y.Zindicates the artifact's contract is stable enough to be a public commitment. - Plan suites are outside this convention. A typo fix to a plan suite bumps the PATCH number of the suite's version (
vX.Y.ZtovX.Y.(Z+1)) and appends a Revision History row. The developer guide describes the plan-suite rule in its plan-suite revisions section.
Schema: Rules
Path pattern: src/apothem/rules/*.md
Purpose: Behavioral mandates and operational directives.
Mandatory Fields
---
name: "kebab-case-identifier"
description: "One-line description"
pathFilter: "**/*.py, **/*.toml"
alwaysApply: true | false
---| Field | Type | Purpose | Example |
|---|---|---|---|
name | string | Machine-readable identifier | "operational-mandates" |
description | string | One-line description for registries | "Operational mandates CM-1–10" |
pathFilter | string | Comma-separated glob list scoping a path-filtered rule; the empty string ("") on always-on rules | "**/*.py, **/*.toml" |
alwaysApply | boolean | true for always-on rules (loaded everywhere); false for path-filtered rules (loaded when pathFilter matches) | true |
Optional Fields
Rules carry no optional frontmatter fields, and — unlike other artifact classes — no version / updated / scope / portability fields either. The four mandatory fields above are the complete rule frontmatter contract enforced by frontmatter_grep.
Example
---
name: "operational-mandates"
description: "Behavioral definitions for CM-1 through CM-10: violation indicators and recovery actions"
pathFilter: ""
alwaysApply: true
---
# Rule: Operational Mandates
...Schema: Commands
Path pattern: src/apothem/commands/*.md
Purpose: Slash command definitions (/plan-execute, /freshify, etc.).
Mandatory Fields
---
name: "command-name"
version: "MAJOR.MINOR.PATCH"
updated: "YYYY-MM-DD"
description: "What this command does"
argument-hint: "[argument-pattern]"
disable-model-invocation: true | false
portability: "universal"
allowed-tools: "Read, Glob, Grep"
---| Field | Type | Purpose | Example |
|---|---|---|---|
name | string | Command name (without leading /) | "plan-execute" |
version | string | Semantic version | "X.Y.Z" |
updated | string (ISO 8601) | Last update date | "2026-04-20" |
description | string | Short description | "Executes a phase with quality gates" |
argument-hint | string | Usage pattern or "[args...]" if none | "[path/to/plan] [phase-id]" |
disable-model-invocation | boolean | If true, only the operator starts the command; the model never invokes it on its own | true |
portability | string | Portability classification across harness adapters | "universal" |
allowed-tools | string | Tools pre-approved while the command runs: read-only tools, plus side-effecting tools only as scoped rules such as Bash(git log *). The bare "*" wildcard is rejected | "Read, Glob, Grep" |
Optional Fields
Commands carry no optional frontmatter fields — the eight mandatory fields above are the complete command frontmatter contract enforced by command.schema.json (additionalProperties: false).
Example
---
name: "plan-execute"
version: "X.Y.Z"
updated: "2026-04-20"
description: "Executes a specific phase from a Master Plan Suite with conformity checking and quality gates"
argument-hint: "[path/to/plan-suite/] [phase-id] [--dry-run]"
disable-model-invocation: true
portability: "universal"
allowed-tools: "Read, Glob, Grep"
---
# /plan-execute — Execute a Specific Phase
...Schema: Helpers
Path pattern:
src/apothem/agents/*.mdPurpose: Persistent helper definitions (also called delegated workers) for parallel exploration, auditing, and quality gates.
Mandatory Fields
---
name: "agent-name"
version: "MAJOR.MINOR.PATCH"
updated: "YYYY-MM-DD"
description: "What this agent specializes in"
tools: "Tool1, Tool2, Tool3"
disallowedTools: "Write, Edit"
maxTurns: 20
effort: "high" | "medium" | "low"
---| Field | Type | Purpose | Example |
|---|---|---|---|
name | string | Helper identifier | "codebase-explorer" |
version | string | Semantic version | "X.Y.Z" |
updated | string (ISO 8601) | Last update date | "2026-04-20" |
description | string | Specialization description | "Deep codebase exploration" |
tools | string (comma-separated) | Allowed tools | "Read, Glob, Grep, Bash" |
disallowedTools | string (comma-separated) | Prohibited tools | "Write, Edit, TodoWrite" |
maxTurns | integer | Maximum conversation turns (typical 5–20; values above 20 require an inline rationale comment) | 20 |
effort | enum | Computational scope | "high" |
Optional Fields
permissionMode: "default" # Permission handling
memory: user | project | local # Persistent-memory scope; omit for none
pattern: "Research" | "Audit" | "Implementation" | "Quality" # Agent team pattern
portability: "universal"Example
---
name: "codebase-explorer"
version: "X.Y.Z"
updated: "2026-04-20"
description: "Deep codebase exploration — find patterns, trace dependencies, discover conventions, map architecture"
tools: "Read, Glob, Grep, Bash"
disallowedTools: "Write, Edit, TodoWrite"
maxTurns: 20
effort: "high"
permissionMode: "default"
portability: "universal"
---
You are a codebase exploration specialist...Schema: Skills
Path pattern: src/apothem/skills/*/SKILL.md
Purpose: Reusable technique definitions with detection signals and execution procedures.
Mandatory Fields
---
name: "skill-name"
version: "MAJOR.MINOR.PATCH"
updated: "YYYY-MM-DD"
description: "What this skill teaches"
archetype: "workflow-template"
userInvocable: true | false
disable-model-invocation: true | false
allowed-tools: "Read, Glob, Grep"
---| Field | Type | Purpose | Example |
|---|---|---|---|
name | string | Skill identifier | "plan-suite" |
version | string | Semantic version | "X.Y.Z" |
updated | string (ISO 8601) | Last update date | "2026-04-20" |
description | string | What the skill provides | "Master Plan Suite template" |
archetype | string | Shape class, a kebab-case <class>-template identifier | "workflow-template" |
userInvocable | boolean | If true, user can explicitly request this skill | false |
disable-model-invocation | boolean | If true, the skill is reached only by explicit invocation | true |
allowed-tools | string | Tools pre-approved while the skill runs: read-only tools, plus side-effecting tools only as scoped rules such as Bash(git log *). The bare "*" wildcard is rejected | "Read, Glob, Grep" |
Optional Fields
argument-hint: "[args...]" # Usage pattern if userInvocableExample
---
name: "ecosystem-audit"
version: "X.Y.Z"
updated: "2026-04-20"
description: "Comprehensive blind audit of the apothem ecosystem"
archetype: "audit-template"
userInvocable: true
disable-model-invocation: false
allowed-tools: "Read, Glob, Grep, Agent, TodoWrite"
argument-hint: "[--focus area] [--fix]"
---
## Purpose
...Schema: Hooks
Path pattern: settings.json hooks block plus the Python
implementations under src/apothem/hooks/.
Purpose: Declare event-triggered validators and state-management handlers that the host invokes at well-defined lifecycle points.
Settings-File Schema
The hooks top-level key maps event names to arrays of matcher blocks:
"hooks": {
"<EventName>": [
{
"matcher": "<pattern>",
"hooks": [
{
"type": "command",
"command": "${PYTHON_BIN}",
"args": ["${HARNESS_ROOT}/.apothem/support/hooks/dispatch.py", "<EventName>", "<message-name>"],
"timeout": <seconds>,
"statusMessage": "<short human-readable label>"
}
]
}
]
}The -m apothem.hooks.dispatch form is for development from a source checkout with PYTHONPATH=src.
| Field | Type | Purpose | Example |
|---|---|---|---|
matcher | string | Tool-name pattern (or "*" for tool-agnostic events) | "Write" |
hooks[].type | literal "command" | The only supported hook handler type today | "command" |
hooks[].command | string | Executable command; Apothem uses the ${PYTHON_BIN} placeholder, resolved at install | "${PYTHON_BIN}" |
hooks[].args | array of strings | Exec-form arguments: a script path under ${HARNESS_ROOT}/.apothem/support/, then its arguments | ["${HARNESS_ROOT}/.apothem/support/hooks/dispatch.py", "SessionStart"] |
hooks[].timeout | integer seconds | Maximum runtime before the host kills the hook | 30 |
hooks[].statusMessage | string | Short label surfaced in the host UI | "Session start" |
Required Events
The Claude Code template registers four events: SessionStart, PreToolUse, PostToolUse and Stop. scripts/dev/validate_hooks.py checks settings.json for the five events in the table below, a different set, and reports each one it does not find as a warning, not a failure. PostToolUse is registered but is not one of the five. PreCompact and PostCompact are among the five but are not registered on Claude Code (hooks reference), so the checker warns about both there.
Timeout values mirror the canonical hook-event budgets — the table below reproduces them for reader convenience; the canonical source governs.
| Event | Typical Timeout | Purpose |
|---|---|---|
SessionStart | 30 seconds | Read memory, check plan state, report readiness |
PreToolUse | 10 seconds | Validate writes for content-isolation policies + frontmatter |
PreCompact | 30 seconds | Verify state externalized before context compaction |
PostCompact | 30 seconds | Restore working state after context compaction |
Stop | 60 seconds | Session-end externalization — resumption state, outputs, decisions |
dispatch.py also accepts UserPromptSubmit and Notification on its event
whitelist for forward compatibility; neither is wired in the shipped
templates. Add a matcher block with the same exec-form pattern to enable.
Python Layer
Every hook command routes through the same Python dispatcher:
| File | Role |
|---|---|
src/apothem/hooks/dispatch.py | Routes SessionStart to session_start_bootstrap.main() and every other whitelisted event to emit_hook_context.main(). Always exits 0. |
src/apothem/hooks/session_start_bootstrap.py | Session-start hook script — emits memory and plan-suite summary context. |
src/apothem/hooks/emit_hook_context.py | Default hook emitter — writes a valid envelope carrying the registered --context-file payload. |
src/apothem/hooks/messages/*.md | Static context payload referenced by --context-file. |
Validation
scripts/dev/validate_hooks.py enforces the hook contract:
settings.jsonparses as JSON and declares each of the five events in the table; a missing event is a warning, not a failure.- All three Python scripts exist and parse as valid Python.
- All message files referenced by
--context-filearguments exist. - No hardcoded absolute user paths (
C:\Users\...etc.) appear insrc/apothem/hooks/**.py. - Shell artifacts under
src/apothem/hooks/andscripts/are limited to the approved locator / bootstrap stubs.
Schema: CLAUDE.md
Path: CLAUDE.md (root)
Purpose: Project-scoped Claude Code instructions.
Mandatory YAML Frontmatter
---
name: "CLAUDE"
version: "MAJOR.MINOR.PATCH"
updated: "YYYY-MM-DD"
description: "Project-scoped Claude Code instructions for the Apothem source repository"
scope: "project"
portability: "project-local"
---Sections
CLAUDE.md is authored in prose sections, described at CLAUDE.md. No validator requires a fixed section list: scripts/dev/validate_ecosystem.py checks the frontmatter keys above.
Validation Checklist
Every artifact must satisfy these checks:
Frontmatter Validation
- YAML is syntactically valid (no parsing errors)
- All mandatory fields present for artifact type
-
namefollows kebab-case convention -
versionis semantic (MAJOR.MINOR.PATCH) -
updatedis ISO 8601 date format (YYYY-MM-DD) -
descriptionis non-empty string, single line - Optional fields match expected enum values (if applicable)
- No typos in field names (use canonical names from schema)
- No extra whitespace or formatting issues
Content Validation
- Content begins on a new line after the closing
---; on Markdown-family files the canonical SPDX header line is the first content after it - No plan-internal references (CM-7 compliance)
- Cross-references resolve (if listing other artifacts)
- Links use relative paths with forward slashes
Portability Validation
- No hardcoded absolute paths (use relative)
- No Windows-specific syntax in universal-scope artifacts
- Path separators use forward slashes
- Environment variables use platform-agnostic format (
${VAR}or tool-native)
Notes
- Consistency as Security: Canonical frontmatter enables automated validation, tooling, and cross-artifact verification. Deviations compound quickly.
- Portability Declaration: Not all artifacts can be universal. Declare constraints explicitly — better to document a caveat than ship a silent bug.
- Kebab-case for Names: Easy to use in URLs, scripts, and command-line contexts. Avoid spaces, underscores, and camelCase for names.
- Version Bump Hygiene: Every behavior-changing edit must bump
versionandupdatedtogether. Typo fixes, link fixes, and formatting changes leave the version unchanged; new optional sections or anti-patterns bump MINOR; structural reorganization or contract changes bump MAJOR.
Commit Conventions
Establish commit message format, release tagging, human-only authorship discipline, and per-task cadence for git artifacts and version control.
Artifact Registries
Complete enumeration of Apothem ecosystem artifacts: commands, rules, delegated workers, hooks, skills, output styles, artifact evolution discipline, and empty-artifact-class declarations.