Skip to content

Frontmatter Schemas

Every Contextia artifact is a Markdown file with YAML frontmatter. The frontmatter provides structured metadata that Contextia uses for indexing, linking, validation, and context assembly. This reference documents the complete schema for each artifact type.

  • Frontmatter uses YAML 1.2 syntax, parsed with ruamel.yaml.
  • Required fields cause a validation error if missing. The error includes the field name, file path, and expected type.
  • Optional fields default to null (not missing keys) when not provided.
  • All id fields must be unique within their artifact type.
  • All paths fields use paths relative to the project root and support glob patterns.
  • List fields accept empty lists [] but not null when they are required.

Schema for behavioral specification files in .contextia/system/specs/.

---
id: SPEC-001 # Required. Unique identifier. Pattern: SPEC-\d+
title: User authentication # Required. Short descriptive title.
description: >- # Optional. One-line summary for indexes and search.
JWT-based login, token refresh, and session validation.
status: approved # Required. One of: draft, approved, implemented, deprecated.
decisions: # Optional. List of decision IDs this spec depends on.
- DEC-001
- DEC-002
norms: # Optional. List of norm IDs this spec must comply with.
- NORM-SEC-001
paths: # Optional. Source file paths implementing this spec.
- src/auth/router.py
- src/auth/service.py
tags: # Optional. Free-form tags for search and filtering.
- authentication
- security
---
FieldTypeRequiredDefaultDescription
idstringYesUnique identifier matching pattern SPEC-\d+.
titlestringYesHuman-readable title, used in indexes and context output.
descriptionstringNonullOne-line summary. Appears in search results and --depth meta output.
statusstringYesLifecycle state. Valid values: draft, approved, implemented, deprecated.
decisionslist[string]No[]IDs of decisions this spec references. Used for link-following in context assembly.
normslist[string]No[]IDs of norms this spec must comply with. Loaded alongside the spec in context.
pathslist[string]No[]Source file paths or glob patterns. Creates top-down links from spec to code.
tagslist[string]No[]Free-form labels for categorization and search.
draft --> approved --> implemented --> deprecated
  • draft: Under discussion, may change. Agents flag draft specs during implementation.
  • approved: Reviewed and accepted as a contract.
  • implemented: Code satisfying all behaviors exists and is annotated.
  • deprecated: No longer active. Retained for historical reference.

Schema for architectural decision records in .contextia/system/rationale/.

---
id: DEC-001 # Required. Unique identifier. Pattern: DEC-\d+
title: JWT for session tokens # Required. Short descriptive title.
status: accepted # Required. One of: proposed, accepted, superseded, deprecated.
date: 2026-01-15 # Optional. Date the decision was made. ISO 8601 format.
superseded_by: DEC-015 # Optional. ID of the decision that replaces this one.
specs: # Optional. List of spec IDs this decision supports.
- SPEC-001
tags: # Optional. Free-form tags for search.
- security
- authentication
---
FieldTypeRequiredDefaultDescription
idstringYesUnique identifier matching pattern DEC-\d+.
titlestringYesConcise description of the decision.
statusstringYesCurrent state. Valid values: proposed, accepted, superseded, deprecated.
datestringNonullISO 8601 date when the decision was made (e.g., 2026-01-15).
superseded_bystringNonullID of a newer decision that replaces this one. Set when status changes to superseded.
specslist[string]No[]IDs of specs this decision relates to. Provides back-references for navigation.
tagslist[string]No[]Free-form labels for search.
proposed --> accepted --> superseded
--> deprecated
  • proposed: Under consideration, alternatives being evaluated.
  • accepted: Team has agreed on this approach. Implementation proceeds.
  • superseded: Replaced by a newer decision. The superseded_by field links to the replacement.
  • deprecated: No longer relevant (e.g., the feature was removed).

Schema for project norms (conventions, standards, rules) in .contextia/system/norms/.

---
id: NORM-SEC-001 # Required. Unique identifier. Pattern: NORM-[A-Z]+-\d+
title: Password handling # Required. Short descriptive title.
status: active # Required. One of: draft, active, deprecated.
paths: # Optional. Scope: which source paths this norm applies to.
- src/auth/**
- src/core/security.py
tags: # Optional. Free-form tags.
- security
- passwords
---
FieldTypeRequiredDefaultDescription
idstringYesUnique identifier. Convention: NORM-{CATEGORY}-\d+ where category is a short label like SEC, API, UI, A11Y.
titlestringYesDescriptive title of the norm.
statusstringYesCurrent state. Valid values: draft, active, deprecated.
pathslist[string]No[]Source paths this norm applies to. When empty, the norm applies project-wide. When specified, contextia check only validates compliance within these paths. Supports glob patterns.
tagslist[string]No[]Free-form labels for search.

The paths field scopes where a norm applies:

# Applies only to API source code
paths:
- packages/api/src/**
# Applies to all source code (same as omitting paths)
paths: []
# Applies to specific files
paths:
- src/core/security.py
- src/auth/password.py

When an agent loads context for a task, norms are included based on whether their paths overlap with the spec’s paths. A norm with paths: [src/auth/**] is included when the task’s spec references files in src/auth/.

Schema for task (work order) files in .contextia/work/tasks/.

---
id: TASK-001 # Required. Unique identifier. Pattern: TASK-\d+
title: Implement login endpoint # Required. Short descriptive title.
description: >- # Optional. Detailed description of the work.
Implement the POST /auth/login endpoint per SPEC-001.
status: open # Required. One of: open, active, blocked, completed, cancelled.
kind: feature # Required. One of: feature, bugfix, refactor, chore, spike.
priority: high # Optional. One of: critical, high, medium, low.
specs: # Optional. List of spec IDs this task implements or modifies.
- SPEC-001
depends_on: # Optional. List of task IDs that must complete before this one.
- TASK-000
tags: # Optional. Free-form tags.
- auth
- mvp
---
FieldTypeRequiredDefaultDescription
idstringYesUnique identifier matching pattern TASK-\d+.
titlestringYesShort description of the work item.
descriptionstringNonullLonger description with implementation details or requirements.
statusstringYesCurrent state. Valid values: open, active, blocked, completed, cancelled.
kindstringYesType of work. Valid values: feature, bugfix, refactor, chore, spike.
prioritystringNonullPriority level. Valid values: critical, high, medium, low.
specslist[string]No[]IDs of specs this task relates to. The primary link for context assembly.
depends_onlist[string]No[]IDs of tasks that must be completed before this task can start.
tagslist[string]No[]Free-form labels for search and filtering.
open --> active --> completed
--> blocked --> active
--> cancelled
  • open: Ready to be picked up. Not yet started.
  • active: Currently being worked on. Has an active working directory in work/active/.
  • blocked: Cannot proceed due to a dependency or unresolved question.
  • completed: Work is done and verified. Working directory archived.
  • cancelled: Task was abandoned. Not implemented.

Schema for session log entries in .contextia/work/active/{task-id}/logs/.

---
task_id: TASK-001 # Required. ID of the associated task.
session_id: ses-20260302-1430 # Required. Unique session identifier.
started_at: 2026-03-02T14:30:00Z # Required. ISO 8601 timestamp.
ended_at: 2026-03-02T16:45:00Z # Optional. Set when session is closed.
agent: claude-opus-4-6 # Optional. Identifier of the AI agent.
status: closed # Required. One of: active, closed.
---
FieldTypeRequiredDefaultDescription
task_idstringYesID of the task this session log belongs to.
session_idstringYesUnique identifier for the session. Convention: ses-{date}-{time}.
started_atstringYesISO 8601 timestamp when the session began.
ended_atstringNonullISO 8601 timestamp when the session ended. Set by close: true.
agentstringNonullIdentifier of the AI agent or tool that created the log.
statusstringYesSession state. Valid values: active, closed.

The body of a session log contains timestamped entries:

## Entries
- **14:30** [progress] Started implementing login endpoint per SPEC-001.
- **14:45** [decision] Used `python-jose` library for JWT operations based on DEC-001.
- **15:20** [progress] Completed authentication service with bcrypt password hashing.
- **15:30** [blocker] SPEC-001 does not specify behavior for locked accounts. Need clarification.
- **16:00** [progress] Added rate limiting per NORM-SEC-001 rule 5.
- **16:45** [summary] Implemented login endpoint. Pending: locked account behavior.

Entry types: progress, decision, blocker, summary, note.