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/):

  1. Feature Branch Immutability: Autonomous workers and feature branches are strictly forbidden from modifying any file under docs/project/backlog/ (proposed/, refined/, complete/, PRIORITY.md, or ROADMAP.md).
  2. Synchronized Integration Transitions: Backlog state transitions (proposed/ $\rightarrow$ refined/ $\rightarrow$ complete/) and PRIORITY.md rank updates are executed exclusively on main under cross-process lock protection (BacklogLock / MERGE_LOCK) during spec-ops refine or spec-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-.md (e.g., 0264-document-backlog-tasks.md) TASK-XXXX (e.g., TASK-0264) '0264' or 'TASK-0264'
Architectural Spike XXXX-spike-.md (e.g., 0259-spike-project-document-areas.md) SPIKE-XXXX (e.g., SPIKE-0259) 'SPIKE-0259' or '0259'

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"):


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: Given When Then



## 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: </code> followed by <code>## Summary & Unanswered Question</code>, <code>## Timebox & Scope</code>, and <code>## Graduation Criteria</code>.</p> </blockquote> <hr /> <h2>5. Sequential Priority Queue (`docs/project/backlog/PRIORITY.md`)</h2> <p><code>docs/project/backlog/PRIORITY.md</code> defines the strict sequential execution order for all backlog tasks and spikes. It does <strong>not</strong> use YAML frontmatter (<code>is_specification_file</code> explicitly excludes <code>priority.md</code> from frontmatter schema audits).</p> <h3>5.1 Line Entry Grammar</h3> <p>Every indexed task entry in <code>PRIORITY.md</code> conforms to the bulleted Markdown link grammar:</p> <pre><code class="language-markdown"> # 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) </code></pre> <ul> <li><strong>Rank Calculation (<code>parse_priority_ranks</code>)</strong>: <code>src/spec_ops/core/parser.py</code> scans <code>PRIORITY.md</code> top-to-bottom using <code>r"TASK-0*(\d+)"</code>, assigning 1-indexed sequential integers (<code>1, 2, 3, ...</code>) to each unique canonical ID (<code>TASK-XXXX</code>). Tasks absent from <code>PRIORITY.md</code> receive default rank <code>999999</code>.</li> <li><strong>Atomic Queue Synchronization (<code>BacklogQueue._sync_priority_file</code>)</strong>: When <code>refine_task</code> or <code>complete_task</code> moves a file between folders, <code>_sync_priority_file</code> rewrites both the parenthesized status tag <code>(Refined)</code> / <code>(Complete)</code> and the relative folder prefix <code>refined/...</code> / <code>complete/...</code> atomically.</li> </ul> <h3>5.2 Health Synchronization Invariants (`check_priority_sync`)</h3> <p><code>HealthChecker.check_priority_sync</code> in <code>src/spec_ops/backlog/health.py</code> (invoked by <code>uv run spec-ops health</code>) enforces bidirectional consistency between the filesystem (<code>complete/</code>, <code>refined/</code>, <code>proposed/</code>) and <code>PRIORITY.md</code>:</p> <ol> <li><strong>Zero Unindexed Files</strong>: Every <code>.md</code> file in <code>complete/</code>, <code>refined/</code>, and <code>proposed/</code> matching <code>^(?:(TASK|SPIKE)-)?(\d+)</code> must have a matching <code>- <strong><CID> (<Status>)</strong>: <a href="<folder>/<filename>"><stem></a></code> entry in <code>PRIORITY.md</code>. Missing entries trigger: <code>TASK-XXXX (<filename>) exists in <folder>/ on disk but is unindexed in PRIORITY.md</code>.</li> <li><strong>Folder-Link Parity</strong>: The <code><folder>/</code> path segment in the Markdown link must match the actual directory on disk (<code>complete</code>, <code>refined</code>, or <code>proposed</code>), except when a task in <code>refined/</code> carries an active <code>(In-Progress)</code> or <code>(Review)</code> status tag. Mismatches trigger: <code>TASK-XXXX is in <folder>/ on disk but referenced as <found_folder>/ in PRIORITY.md</code>.</li> <li><strong>JIT Buffer Health</strong>: <code>HealthChecker.run_check</code> counts tasks in <code>refined/</code> against <code>architecture.buffer_target</code> (default <code>~10</code>) and <code>architecture.buffer_warning_threshold</code>, reporting <code>OPTIMAL</code>, <code>UNDER_BUFFERED</code>, or <code>OVER_BUFFERED</code>.</li> </ol> <hr /> <h2>6. Delivery Roadmap (`ROADMAP.md`) & Backlog Guide (`README.md`)</h2> <h3>6.1 `docs/project/backlog/ROADMAP.md`</h3> <p><code>ROADMAP.md</code> provides an executive, milestone-oriented view of completed and active delivery horizons (<code>is_specification_file</code> excludes <code>roadmap.md</code> from frontmatter validation).</p> <pre><code class="language-markdown"> # 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). </code></pre> <ul> <li><strong>Milestone Headers</strong>: H2 sections formatted as <code>## Milestone <N>: <Title> (<Status>)</code> where <code><Status></code> is <code>Complete</code>, <code>Active</code>, or <code>Planned</code>.</li> <li><strong>Deliverable Checklists</strong>: Bulleted task summaries citing canonical task IDs in inline code (<code>(\</code>TASK-XXXX\<code>)</code>), followed by milestone horizon closure lines when governing PRDs ship (<code>rollover.py</code> / <code>milestone_studio_sync.py</code>).</li> </ul> <h3>6.2 `docs/project/backlog/README.md`</h3> <p><code>docs/project/backlog/README.md</code> serves as the human and agent orientation guide for the backlog directory, defining the three lifecycle directories (<code>proposed/</code>, <code>refined/</code>, <code>complete/</code>) and the three core backlog invariants:</p> <ol> <li><strong>Just-In-Time (JIT) Refinement</strong>: Maintain a lean ready buffer of ~10 tasks in <code>refined/</code>.</li> <li><strong>Backlog Isolation</strong>: Feature branches never modify <code>docs/project/backlog/</code> to ensure zero-conflict parallel merges (<a href="../../project/adrs/accepted/adr-0005-worktree-concurrency-and-backlog-isolation.html">ADR-0005</a>).</li> <li><strong>Blackbox Frontdoor Verification</strong>: Test criteria verify observable outputs via public entrypoints with zero private backdoor manipulation (<a href="../../project/adrs/accepted/adr-0003-blackbox-frontdoor-verification.html">ADR-0003</a>).</li> </ol> </main> <script type="module"> const mermaidNodes = document.querySelectorAll('.mermaid, pre code.language-mermaid'); if (mermaidNodes.length > 0) { document.querySelectorAll('pre code.language-mermaid').forEach(code => { const pre = code.parentElement; if (pre && pre.tagName.toLowerCase() === 'pre') { pre.className = 'mermaid'; pre.textContent = code.textContent; } }); try { const { default: mermaid } = await import('https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs'); mermaid.initialize({ startOnLoad: false, theme: 'dark', securityLevel: 'loose', }); await mermaid.run(); } catch (err) { console.error('Failed to load or render Mermaid diagrams:', err); } } </script> </body> </html>