Backlog Tasks, Spikes, Priority Queue, and Roadmap Specification
This reference specification defines the declarative file structure, YAML frontmatter schema, Markdown Abstract Syntax Tree (AST) grammar, Definition of Ready (DoR) contract rules, sequential priority queue (PRIORITY.md), and milestone roadmap (ROADMAP.md) governing Area 5 of docs/project/backlog/ (ADR-0001, ADR-0005, ADR-0008, ADR-0022).
1. Directory Topology & Strict Worktree Isolation
All engineering backlog specifications and execution indexes live under docs/project/backlog/:
docs/project/backlog/
├── README.md # Backlog Management Guide & core invariants
├── PRIORITY.md # Strict sequential priority execution queue
├── ROADMAP.md # High-level milestone delivery horizons
├── proposed/ # Unrefined ideas, blocked items, and raw slices
│ ├── XXXX-<slug>.md # Proposed engineering task (TASK-XXXX)
│ └── XXXX-spike-<slug>.md # Proposed architectural spike (SPIKE-XXXX)
├── refined/ # DoR-verified tasks ready for or in active work
│ ├── XXXX-<slug>.md # Refined / Ready / In-Progress / Review task
│ └── XXXX-spike-<slug>.md # Active timeboxed architectural spike
└── complete/ # Integrated tasks and graduated spikes
├── XXXX-<slug>.md # Completed task with verified sign-off
└── XXXX-spike-<slug>.md # Graduated spike with synthesized ADR
Folder-Based Status Resolution (`parse_task`)
While task files declare a status key in YAML frontmatter, spec_ops.core.parser.parse_task enforces deterministic folder-based status resolution so filesystem location remains the primary source of truth:
| Parent Directory | Allowed Frontmatter status Overrides |
Effective Resolved Task.status |
|---|---|---|
complete/ |
Graduated (for spikes) |
"Graduated" if raw_status == "Graduated", otherwise "Complete" |
refined/ |
In-Progress, Review, Ready |
Preserves "In-Progress", "Review", or "Ready"; defaults all other values to "Refined" |
proposed/ |
Blocked* (any string starting with "Blocked") |
Preserves "Blocked..." status when present; defaults all other values to "Proposed" |
| (Other paths) | Any string | Uses str(raw_status or "Proposed") |
Strict Worktree Backlog Isolation (ADR-0005)
To guarantee zero merge conflicts when multiple autonomous workers execute concurrently across isolated git worktrees (.worktrees/ on branches task/ or feat/):
- Feature Branch Immutability: Autonomous workers and feature branches are strictly forbidden from modifying any file under
docs/project/backlog/(proposed/,refined/,complete/,PRIORITY.md, orROADMAP.md). - Synchronized Integration Transitions: Backlog state transitions (
proposed/$\rightarrow$refined/$\rightarrow$complete/) andPRIORITY.mdrank updates are executed exclusively onmainunder cross-process lock protection (BacklogLock/MERGE_LOCK) duringspec-ops refineorspec-ops queue complete.
2. File Naming & Canonical Identifiers
Every task and spike shares a monotonic 4-digit numeric sequence (XXXX) across proposed/, refined/, and complete/, audited for uniqueness by spec_ops.core.numbering.audit_numbering_uniqueness.
| Archetype | Filename Pattern | Canonical ID (Task.canonical_id) |
Frontmatter id Representation |
|---|---|---|---|
| Engineering Task | XXXX- (e.g., 0264-document-backlog-tasks.md) |
TASK-XXXX (e.g., TASK-0264) |
'0264' or 'TASK-0264' |
| Architectural Spike | XXXX-spike- (e.g., 0259-spike-project-document-areas.md) |
SPIKE-XXXX (e.g., SPIKE-0259) |
'SPIKE-0259' or '0259' |
- Canonical ID Normalization:
Task.canonical_idstrips leadingTASK-orSPIKE-prefixes and zero-pads the numeric identifier to 4 digits (TASK-0264orSPIKE-0259). - Slug Generation (
Task.slug): LowercasesTask.title, replaces non-alphanumeric characters with hyphens, truncates the title slug to 40 characters, and prepends the 4-digit numeric ID (f"{clean_id}-{clean[:40]}").
3. YAML Frontmatter Schema (`TaskFrontmatter` & `Task` Model)
Task and spike files begin with a YAML frontmatter block delimited by ---. Schema validation is enforced by TaskFrontmatter in src/spec_ops/core/schema_validator.py (SCHEMA_VERSION = "v2.0") and parsed into the Task domain model in src/spec_ops/core/models.py.
3.1 Core Identity & Scope Fields
| Field | Pydantic / Domain Type | Default | Required | Semantics |
|---|---|---|---|---|
id |
Any $\rightarrow$ str |
— | Yes | Numeric string ('0264') or prefixed canonical ID ('TASK-0264', 'SPIKE-0259'). |
title |
str |
— | Yes | Concise imperative summary of the vertical slice or spike. |
status |
str |
"Proposed" |
Yes | Lifecycle state (Proposed, Refined, Ready, In-Progress, Review, Blocked, Complete, Graduated). |
target_bc |
str |
"core" |
Yes (DoR) | Single target Bounded Context directory under src/spec_ops/ (e.g., core, backlog, docs). |
target_release |
str |
"" |
No | Target release or milestone version tag (parsed by parse_task, serialized by write_task_file). |
slice_type |
Optional[str] |
"feat" |
No | Conventional commit / slice category (feat, fix, refactor, docs, spike, chore). |
expected_lines |
int |
0 |
No | Estimated line diff; must be $\le 500$ lines to pass DoR single-responsibility scope checks (ADR-0002). |
allows_dependencies |
bool |
False |
No | Whether the task is permitted to introduce new third-party package dependencies in pyproject.toml. |
persona |
str |
"" |
No* | Target persona from PERSONAS.md (e.g., Alex (The Agentic Systems Architect)). *Required by DoR unless inherited from linked story/PRD. |
created |
Any |
None |
No | Creation date or ISO-8601 timestamp (TaskFrontmatter). |
timestamp |
str |
"" |
No | Event or state transition ISO-8601 timestamp (Task domain model / serializer). |
3.2 Relational Traceability Arrays
Tasks maintain bidirectional links across the PMaC relational graph (SpecOpsParser):
| Field | Type | Default | DoR Requirement | Graph Edge Relation |
|---|---|---|---|---|
dependencies |
list[str] |
[] |
Optional (TASK-XXXX / SPIKE-XXXX) |
task --depends_on--> task |
governing_adrs |
list[str] |
[] |
$\ge 1$ Accepted ADR (ADR-XXXX) |
task --governed_by--> adr |
governing_prds |
list[str] |
[] |
$\ge 1$ Accepted/Shipped PRD (PRD-XXXX) |
task --implements--> prd |
governing_stories |
list[str] |
[] |
$\ge 1$ Accepted Story (US-XXXX) (if body lacks Gherkin) |
task --implements--> story |
Deprecated Legacy Field Hints (`LEGACY_FIELD_HINTS`)
In Schema v2.0, singular or unprefixed traceability keys are rejected with a SchemaDiagnosticError pointing to the exact line and column, along with an upgrade hint (spec-ops schema migrate --in-place):
| Deprecated Legacy Key | Canonical Schema v2.0 Replacement |
|---|---|
governing_adr |
governing_adrs (e.g., ['ADR-0001']) |
governing_prd |
governing_prds (e.g., ['PRD-0005']) |
prd |
governing_prds (e.g., ['PRD-0005']) |
governing_story |
governing_stories (e.g., ['US-0017']) |
story |
governing_stories (e.g., ['US-0017']) |
stories |
governing_stories (e.g., ['US-0017']) |
dependency |
dependencies (e.g., ['TASK-0001']) |
3.3 Worker Execution, Lease Telemetry & Queue Pinning
| Field | Type | Default | Semantics | |
|---|---|---|---|---|
claimed_by |
Optional[str] |
None / "" |
Identifier of the active worker or human developer holding the task lease. Cleared upon completion. | |
claimed_at |
str |
"" |
ISO-8601 timestamp when the worker claimed the task. | |
branch |
Optional[str] |
None / "" |
Isolated git branch name (feat/TASK-XXXX or task/TASK-XXXX). Cleared upon completion. |
|
heartbeat |
str |
"" |
Worker liveness status or heartbeat token for stalled-lease reclamation (reclaim.py). |
|
heartbeat_at |
str |
"" |
ISO-8601 timestamp of the most recent worker lease heartbeat. | |
prs |
list[str] |
[] |
Linked pull request numbers or references. | |
pr_url |
Optional[str] |
None / "" |
Canonical URL to the pull request or review diff. | |
external_ref |
Optional[str] |
None / "" |
Bidirectional synchronization key for external issue trackers (GitHub Issues, Jira, Linear). | |
issue_url |
Optional[str] |
None |
External tracker URL alias (mapped to Task.external_ref by parse_task). |
|
priority_rank |
Optional[int] |
999999 |
Sequential integer rank derived from PRIORITY.md (1-indexed). |
|
pinned |
bool |
False |
Locks the task near the top of the ready queue during automated re-ranking (reranker.py). |
|
priority_pin |
`int \ | None` | None |
Explicit pinned rank position in the queue. |
unblocked |
bool |
False |
Flag set by UnblockingCascadeEngine when upstream dependencies complete. |
3.4 Architectural Spike Fields (`SPIKE-XXXX`)
Governed by spec-ops spike, architectural spikes use the same TaskFrontmatter contract with two specialized fields:
| Field | Type | Default | Semantics |
|---|---|---|---|
hypothesis |
Optional[str] |
None / "" |
Falsifiable architectural question or benchmark hypothesis under investigation. |
timebox |
Optional[str] |
None / "" |
Maximum allowed exploration duration (e.g., "2h", "4h", "1d"). |
When a spike concludes via spec-ops spike graduate SPIKE-XXXX --result proven|disproven, an ADR is synthesized in docs/project/adrs/ and the spike transitions to docs/project/backlog/complete/ with status: Graduated.
3.5 Cryptographic Provenance & Dual-Custody Review Gate (ADR-0016)
Before any task branch is integrated into main via spec-ops queue complete , SpecOps enforces cryptographic commit verification and human architectural sign-off:
| Field | Type | Default | Semantics |
|---|---|---|---|
signed_off_by |
Optional[str] |
None / "" |
Authorized human reviewer identity ("Name or key ID) recorded via spec-ops review sign. |
signed_off_at |
Optional[str] |
None / "" |
ISO-8601 UTC timestamp when human review sign-off was recorded. |
has_signed_commits |
Optional[bool] |
None |
true when all commits on the task branch carry valid cryptographic GPG/SSH signatures. |
commit_signature_status |
Optional[str] |
None / "" |
Verification status ("SIGNED", "UNSIGNED", "INVALID"). |
completed |
Any |
None |
Completion date or boolean flag (TaskFrontmatter). |
completed_at |
str |
"" |
ISO-8601 UTC timestamp recorded when complete_task_with_gate merges the task. |
3.6 Nested Sub-Schemas (`blocker`, `failure_history`, `mutation_scope`)
`blocker` (`BlockerInfo` Schema)
When a worker encounters an architectural ambiguity or missing dependency (spec-ops blocker raise), a nested blocker dictionary is serialized into frontmatter and hydrated into BlockerInfo:
blocker:
type: spike_needed # "unknown" | "spike_needed" | "external" | "dependency"
question: "Which parser..." # Specific blocking question requiring resolution
raised_by: worker-01 # Agent or human who raised the blocker
raised_at: '2026-10-15T12:00:00Z'
spike_id: SPIKE-0259 # Spawned architectural spike ID (if type == spike_needed)
resolution: "Adopted..." # Summary of how the blocker was resolved
resolved_at: '2026-10-15T14:00:00Z'
adr_id: ADR-0022 # Synthesized ADR resolving the blocker
`failure_history` (Anti-Loop Worktree Failure Memory)
Tracks prior preflight or worker execution failures so retry agents do not repeat failed approaches (TASK-0053):
failure_history:
- attempt: 1
timestamp: '2026-10-15T10:15:00Z'
stage: preflight_pytest
summary: "Failed blackbox test in test_dor_gate.py due to missing target_bc"
commit_sha: a1b2c3d
`mutation_scope`
Specifies target Python domain modules or packages for mutmut mutation testing (list[str] | str | None), e.g.:
mutation_scope:
- src/spec_ops/backlog/dor_gate.py
3.7 Strict `extra="forbid"` Policy: What Can and Cannot Be Tracked
TaskFrontmatter enforces model_config = ConfigDict(extra="forbid"):
- What CAN be tracked: Only the declared
TaskFrontmatterattributes (id,title,status,target_bc,dependencies,governing_adrs,governing_prds,governing_stories,created,completed,claimed_by,branch,prs,pr_url,priority_rank,allows_dependencies,hypothesis,timebox,signed_off_by,signed_off_at,has_signed_commits,commit_signature_status,blocker,slice_type,failure_history,external_ref,issue_url,mutation_scope). Note thattask_serializer.pyandparse_taskalso handle runtime/lifecycle fields (target_release,persona,completed_at,claimed_at,timestamp,heartbeat_at,heartbeat,unblocked,expected_lines,pinned,priority_pin). - What CANNOT be tracked: Arbitrary ad-hoc YAML keys, legacy singular keys (
governing_adr,story,prd,dependency), inline test results blobs, or unstructured agent scratchpads. Any unknown top-level key triggers aForbidden extra field 'error during' in schema v2.0 spec-ops schema check.
4. Markdown Body AST Grammar & Definition of Ready (DoR) Gate
Before a task can transition from proposed/ to refined/ (spec-ops refine or spec-ops dor check), audit_task_health in src/spec_ops/backlog/dor_gate.py audits 7 mandatory Definition of Ready rules (ALL_DOR_RULES in src/spec_ops/backlog/dor_rules.py), while DORSynthesizer (src/spec_ops/backlog/dor_synthesizer.py) synthesizes any missing sections.
4.1 The 7 DoR Audit Rules (`dor_gate.py`)
| # | Rule Constant (dor_rules.py) |
Rule Name | Verification Contract in audit_task_health |
|---|---|---|---|
| 1 | RULE_YAML_FRONTMATTER |
Complete YAML frontmatter |
id, title, and status must all be non-empty strings. |
| 2 | RULE_BOUNDED_CONTEXT |
Defined Target Bounded Context |
target_bc must be non-empty. |
| 3 | RULE_FILE_LIMIT_SCOPE |
Feasible File Limit Scope |
Must target a single bounded context (target_bcs_count == 1), expected_lines <= 500, and body text must not mention spanning multiple bounded contexts or >500 lines (ADR-0002). |
| 4 | RULE_GOVERNING_ADRS |
Cited Governing ADRs |
governing_adrs must cite $\ge 1$ ADR that exists in docs/project/adrs/accepted/ (or has status: Accepted). |
| 5 | RULE_PERSONA_PRD |
Linked Persona & PRD |
governing_prds must cite $\ge 1$ PRD in accepted/ or shipped/, and a valid persona from PERSONAS.md must appear in persona, task body, linked story, or linked PRD. |
| 6 | RULE_GHERKIN_SCENARIOS |
Executable Gherkin Scenarios |
Task body (or a linked governing_stories file) must contain executable Gherkin keywords (Given, When, Then) (ADR-0006). |
| 7 | RULE_MUTATION_SCOPE |
Mutation Testing Scope Defined |
Frontmatter mutation_scope must be set or body must specify mutmut / Mutation Testing Scope (ADR-0009). |
4.2 Canonical Markdown Heading Grammar
Refined engineering tasks follow a 7-section Markdown AST structure underneath the H1 title:
# TASK-XXXX: <Imperative Title>
## Summary
Concise 1–3 sentence overview of the vertical slice deliverable and its architectural boundaries.
## Problem Statement & Context
Background context, user pain points, and references to governing PRDs, stories, spikes, or ADRs.
## Definition of Done (Blackbox Frontdoor TDD)
1. Observable blackbox outcomes verified strictly via public CLI/module entrypoints (ADR-0003).
2. All unit, BDD, and property tests pass (`uv run pytest`).
3. Touched source files remain strictly under 500 lines (ADR-0002).
## Acceptance Criteria
Scenario:
## Mutation Testing Scope
- Target domain module: `src/spec_ops/<target_bc>/<module>.py`
- Minimum mutation kill score: >=80% under Mutmut (ADR-0009).
## Hypothesis Invariant Properties
- `@given(...)`: Generative property tests asserting domain invariants across randomized inputs without shrinking failures (ADR-0009).
## Scope & Architectural Invariants
- Target Bounded Context: `<target_bc>` (single bounded context)
- Estimated Implementation Diff: <400 lines
- File Length Limit: all touched source files strictly <500 lines (ADR-0002).
Note on Architectural Spikes (
SPIKE-XXXX): Spikes use# SPIKE-XXXX:followed by## Summary & Unanswered Question,## Timebox & Scope, and## Graduation Criteria.
5. Sequential Priority Queue (`docs/project/backlog/PRIORITY.md`)
docs/project/backlog/PRIORITY.md defines the strict sequential execution order for all backlog tasks and spikes. It does not use YAML frontmatter (is_specification_file explicitly excludes priority.md from frontmatter schema audits).
5.1 Line Entry Grammar
Every indexed task entry in PRIORITY.md conforms to the bulleted Markdown link grammar:
# Backlog Priority Index
Strict sequential order of execution for engineering tasks.
- **TASK-0001 (Complete)**: [`0001-initial-architecture-spike-and-setup`](complete/0001-initial-architecture-spike-and-setup.md)
- **TASK-0264 (Refined)**: [`0264-document-backlog-tasks-spikes-priority-queue-and-r`](refined/0264-document-backlog-tasks-spikes-priority-queue-and-r.md)
- **TASK-0270 (Proposed)**: [`0270-future-vertical-slice`](proposed/0270-future-vertical-slice.md)
- Rank Calculation (
parse_priority_ranks):src/spec_ops/core/parser.pyscansPRIORITY.mdtop-to-bottom usingr"TASK-0*(\d+)", assigning 1-indexed sequential integers (1, 2, 3, ...) to each unique canonical ID (TASK-XXXX). Tasks absent fromPRIORITY.mdreceive default rank999999. - Atomic Queue Synchronization (
BacklogQueue._sync_priority_file): Whenrefine_taskorcomplete_taskmoves a file between folders,_sync_priority_filerewrites both the parenthesized status tag(Refined)/(Complete)and the relative folder prefixrefined/.../complete/...atomically.
5.2 Health Synchronization Invariants (`check_priority_sync`)
HealthChecker.check_priority_sync in src/spec_ops/backlog/health.py (invoked by uv run spec-ops health) enforces bidirectional consistency between the filesystem (complete/, refined/, proposed/) and PRIORITY.md:
- Zero Unindexed Files: Every
.mdfile incomplete/,refined/, andproposed/matching^(?:(TASK|SPIKE)-)?(\d+)must have a matching-entry in( :) PRIORITY.md. Missing entries trigger:TASK-XXXX (.) exists in / on disk but is unindexed in PRIORITY.md - Folder-Link Parity: The
path segment in the Markdown link must match the actual directory on disk (/ complete,refined, orproposed), except when a task inrefined/carries an active(In-Progress)or(Review)status tag. Mismatches trigger:TASK-XXXX is in./ on disk but referenced as / in PRIORITY.md - JIT Buffer Health:
HealthChecker.run_checkcounts tasks inrefined/againstarchitecture.buffer_target(default~10) andarchitecture.buffer_warning_threshold, reportingOPTIMAL,UNDER_BUFFERED, orOVER_BUFFERED.
6. Delivery Roadmap (`ROADMAP.md`) & Backlog Guide (`README.md`)
6.1 `docs/project/backlog/ROADMAP.md`
ROADMAP.md provides an executive, milestone-oriented view of completed and active delivery horizons (is_specification_file excludes roadmap.md from frontmatter validation).
# Delivery Roadmap
## Milestone 1: Foundations (Complete)
- Initial architecture spike, configuration loader, and models (`TASK-0001`).
- Profile registry with core, bdd, ddd profiles and 7 baseline ADRs (`TASK-0002`).
## Milestone 2: Agent Ecosystem, Diataxis & Pages (Active)
- Autonomous git worktree worker execution engine (`TASK-0011`).
- Milestone completion date: 2026-09-29 (Horizon closed for PRD-0001 — SpecOps Autonomous Project Management Engine).
- Milestone Headers: H2 sections formatted as
## Milestonewhere: ( ) isComplete,Active, orPlanned. - Deliverable Checklists: Bulleted task summaries citing canonical task IDs in inline code (
(\TASK-XXXX\)), followed by milestone horizon closure lines when governing PRDs ship (rollover.py/milestone_studio_sync.py).
6.2 `docs/project/backlog/README.md`
docs/project/backlog/README.md serves as the human and agent orientation guide for the backlog directory, defining the three lifecycle directories (proposed/, refined/, complete/) and the three core backlog invariants:
- Just-In-Time (JIT) Refinement: Maintain a lean ready buffer of ~10 tasks in
refined/. - Backlog Isolation: Feature branches never modify
docs/project/backlog/to ensure zero-conflict parallel merges (ADR-0005). - Blackbox Frontdoor Verification: Test criteria verify observable outputs via public entrypoints with zero private backdoor manipulation (ADR-0003).