166. Descriptor-driven planning workloads
Date: 2026-11-30
Status
Accepted
Context
Epic Creator decomposes approved strategies into implementation epics. A strategy is a document Strategy Creator attaches to a Jira ticket; today the pipeline reads it only from a RHAISTRAT Feature. This decision adds the RHAISTRAT Initiative as a second carrier: a signed-off Initiative's attached strategy is decomposed into epics parented to that Initiative.
Today, its shared discovery, decomposition, review, revision, and Jira submission stages hard-code one workload's planning behavior, fused in three places. The pipeline driver binds the workload identity into its orchestration: RHAISTRAT IDs and Jira Query Language (JQL). The per-stage agent prompts are at once stage procedure and workload policy. The review prompt carries the whole scoring rubric in prose. The decompose prompt carries the triage and Directed Acyclic Graph (DAG) construction rules. The scripts carry the rest as module-level constants: the submission target project, the processed label, the component-cache path, and the intake attachment pattern. Adding a new source of work means editing every one of these. Any per-workload fork replicates each fix across copies.
This ADR aims to make workload behavior a validated, versioned data contract, so a consuming pipeline takes on new planning workloads by configuration instead of per-workload code, while preserving the existing single-workload behavior as a compatibility path.
Options
- Fork per workload — rejected: every fix and policy change must be replicated across forks.
- Branch on workload in shared code — rejected: scattering
if workload == ...dispatch through the stages keeps workload-specific logic embedded in shared code; every new workload touches every stage. - Wait for a shared planning engine — rejected: the peer creators stay separate pipelines and the descriptor contract is the agreed integration point; deferring blocks new workloads now.
Decision
We adopt a descriptor-driven consuming architecture: one pipeline whose stages resolve workload behavior from a validated, versioned descriptor selected once at entry.
The workload descriptor
A workload is a YAML document in an in-repo registry (workloads/), validated against workloads/_schema/workload.schema.json. The full shape, for the RHAI Initiative workload:
schema_version: 1
id: rhai-initiative # unique registry ID
version: 1 # descriptor version
source: # intake contract
project: RHAISTRAT
issue_type: Initiative
id_pattern: '^RHAISTRAT-\d+$'
attachment_template: '{key}-strategy.md' # strategy: this attachment
description_fallback: false # never read the description
ready_labels: [strat-creator-human-sign-off, strat-creator-rubric-pass]
skip_policy: processed-label # or: child-epics
processed_label: epic-creator-auto-decomposed
handoff_type: initiative-strategy
identity_fields: [strat_id, jira_key, source_initiative]
submission: # typed submission contract
project: RHAI
issue_type: Epic
parent: {relation: parent}
dependency_link_type: Blocks
labels:
created: epic-creator-auto-created
investigation: epic-creator-investigation
implementation_prefix: epic-creator-impl-
ai_prefix: epic-creator-ai-impl-
needs_component: epic-creator-needs-component
planning: # planning and review contract
artifact_template: workloads/policies/rhai/v1/artifacts.md
scoring: workloads/policies/rhai/v1/scoring.yaml
decompose: workloads/policies/rhai/v1/decompose.md
review: workloads/policies/rhai/v1/review.md
revise: workloads/policies/rhai/v1/revise.md
components: {project: RHAI, file: .context/rhai-components.txt}
review_gate:
criteria: [HLR Coverage, DAG Coherence, Epic Boundaries,
Type Correctness, AI Implementability Scoring,
Acceptance Criteria Quality, Completeness]
points_per_criterion: 2
pass_score: 10
zero_fails: truesourcedefines intake:- where source work items live (project, issue type), and how a valid source key is recognized (
id_pattern); - where the planning content comes from — for the two initial workloads, a strategy document (
attachment_template).description_fallbackis configurable per workload, and the setting reflects what the ticket's description holds. For the Feature workload the description is itself strategy content, so it is a valid fallback. For the Initiative workload the description is the Initiative's own intake text and the strategy exists only as the attachment, so a missing attachment means skip. When several revisions of the attachment exist, the newest is used — one strategy per source, latest revision; - which labels evidence approval (
ready_labels) — approval is bound to the current revision of the strategy content. The pipeline trusts that Strategy Creator removes or invalidates the labels whenever that content changes, so a replaced attachment that was never re-approved does not pass intake; - how a processed source is recognized (
skip_policy):processed-labelchecks the processed label — the reliable signal, since only the pipeline sets it;child-epicschecks for existing child epics — a heuristic retained for the Feature workload's compatibility path, where any child epic blocks intake regardless of origin; - which handoff identity fields the source carries (
identity_fields), and the handoff type it receives (handoff_type).
- where source work items live (project, issue type), and how a valid source key is recognized (
submissiondefines the tracker destination (project,issue_type), the relation each generated epic carries to its source (parent, or a link relation), thedependency_link_typebetween generated epics, and thelabelsused for idempotent writes:created,investigation,implementation_prefix,ai_prefix, andneeds_component.planningbinds the policy set by path (see Policies below) plus the component vocabulary — the tracker project and the component cache file the typed writes validate against — and the review gate: named criteria, points per criterion, a pass score, andzero_fails(a zero on any criterion fails the gate regardless of the total).
An intake-only descriptor (source alone) is valid. Planning requires planning. Typed submission requires both planning and submission.
The descriptor is data. It loads no executable plugins.
Fields with derivable values are optional with defaults — for example, id_pattern derives from project, and attachment_template defaults to {key}-strategy.md.
Together, a workload's source block is the complete list of prerequisites a ticket must satisfy: right project, right issue type, right key format, approval labels, and strategy content — the attachment, or the description when the descriptor allows the fallback. The pipeline rejects any ticket that fails a prerequisite before starting work, and processes only tickets that a registered workload claims.
Where a concept already exists in the shared vocabulary used by RFE Creator and Strategy Creator (types/<name>/type.yaml, types/_schema/type.schema.json), this descriptor adopts the same names:
source.{project, issue_type, id_pattern}→inputs[].jira.{project, issue_type, key_prefixes}handoff_type→from_typeready_labels→gate.labels_allattachment_template/description_fallback→body_source.{attachment, fallback}skip_policy: processed-label+processed_label→skip_if.labels_any/label_on_inputsubmission.parent+dependency_link_type→relationsubmission.labels.*→conventions.labels.*
skip_policy: child-epics and the planning block have no counterpart and remain Epic Creator-specific.
The registry's initial content is two descriptors. The other, rhaistrat-strategy, is today's production workload — the Feature path the pipeline has always run. It differs from the example above only in its id and its source block:
source:
project: RHAISTRAT
issue_type: Feature
id_pattern: '^RHAISTRAT-\d+$'
attachment_template: '{key}-strategy.md'
description_fallback: true
ready_labels: [strat-creator-human-sign-off, strat-creator-rubric-pass]
skip_policy: child-epics
processed_label: epic-creator-auto-decomposed
handoff_type: rfe-strategy
identity_fields: [strat_id, jira_key]Its submission and planning blocks are the same as the Initiative descriptor's, shared verbatim. The two workloads differ in their id and in that one source block: a different issue type, a description fallback instead of attachment-only, the Feature path's skip heuristic instead of the processed label, a different handoff type, and one fewer identity field.
Policies
Stage policy is the instructions the stage agents read and follow at runtime — the workload's judgment, kept out of both the shared prompts and the descriptor. It lives in documents under workloads/policies/, each referenced by repository-root-relative path from the descriptor's planning block and constrained by the workload schema's path pattern:
decompose.md— the decomposition procedure: triage rules, the epic-boundary and DAG-construction rules, requirement-to-epic mappingreview.md— the review procedure: the named criteria of the review gate, what counts as critical or major, how to score each criterionrevise.md— how review corrections are applied to a decompositionartifacts.md— the body templates for generated epic and summary filesscoring.yaml— the machine-readable counterpart: the thresholds the deterministic layer enforces (AI-implementability routing), validated againstworkloads/_schema/scoring.schema.json
These documents come in two kinds. The four markdown files are procedures: at runtime the stage's language-model agent follows the bound POLICY_FILE (see Stage resolution) the way code follows a program. The fifth, scoring.yaml, involves no model — deterministic code enforces its thresholds.
Policies are referenced by path, not inlined. The family — the middle segment of the path (policies/rhai/v1/ names the rhai family) — names a policy set, not a group of workloads: any descriptor may reference any family. The two initial workloads are different work with different source contracts, yet both reference policies/rhai/v1/ because they decompose and review identically — one edit to the shared set serves both, and adding a workload is a source contract plus policy references, not new stage code.
A family may carry generation directories (policies/rhai/v1/, a future v2/), so a new generation can be added without rewriting the documents other descriptors still point at. The generation number is just a name; what a run binds is each document's content digest, so editing a policy rejects resume exactly like editing the descriptor.
Handoff from Strategy Creator
This handoff is not between Epic Creator's own internal steps — it is the work entering from the previous pipeline in the chain (RFE Creator → Strategy Creator → Epic Creator). The source block is this pipeline's record of that inbound handoff from Strategy Creator. Its identity fields are station-specific and must not be extrapolated between stations. The Strategy Creator handoff carries strat_id, jira_key, and source_rfe or source_initiative. RFE Creator artifacts carry type, tracker_ref, and local_id.
Strategy Creator records what this pipeline reads: project, issue type, approval labels, id pattern, attachment pattern, strategy headings, and High Level Requirements (HLR) priorities. It keeps that list as a data fixture and tests its types against it without importing this repository. In the descriptor architecture the contract splits naturally. The intake fields land in source. The content-structure expectations land in the planning policy documents.
The descriptor vocabulary is copied between stations, not imported. Strategy Creator's design also publishes an inputs: block as carried data; the stations import nothing from each other. That block stays lint-check vocabulary there. It is not an executable gate interface here.
Registry validation
The registry is the workloads/ directory — the set of workload descriptors this installation knows about, nothing more than a folder of YAML files next to their schemas and policies. At the start of every run it is loaded whole, and loading rejects missing fields, duplicate IDs, duplicate intake bindings — two descriptors claiming the same (project, issue_type), so automatic selection is never ambiguous — unknown schema versions, unsafe path declarations, and references to policies that are not in the registry. A run never starts against a registry that fails to load.
Selection and binding
A run picks its workload once, at entry, one of three ways. Explicitly: --workload ID, the pipeline's own command-line and skill interface, not a fullsend flag. By omission: this keeps today's single-workload invocation unchanged. That compatibility path is a flow guarantee, not a code freeze. The restructure moves the Feature workload's rules from fused prompts and script constants into descriptor and policy documents, the same values and the same words. A run without the flag takes the same steps and submits to the same destination with the same labels as before. Or through opt-in Jira intake: the source issue's (project, issue_type) names the workload bound to it.
Before any work starts, intake checks the door: the source key must match id_pattern, the approval labels must be present, and the source's identity must agree with the selected workload. A mismatch or an unknown workload ID stops the run before decomposition or any Jira write. The source issue itself is never cloned or re-keyed, and, under the processed-label policy, hand-made child issues do not block intake.
The choice is written into pipeline state together with the workload version, the descriptor's digest, the digest of every referenced policy document, and the source revision. Every stage boundary re-checks these bindings; a failing review is not a binding failure — it routes the plan into revise, and passing scores are required only when a plan is admitted to submission. If the descriptor, a policy document, or the bound source changed since the run started, resume is refused: typed artifacts require a fresh fetch and a new planning run. A half-done plan is never finished under rules it was not built with.
Discovery
Discovery belongs to the workload: each descriptor carries its own discovery query — which sources it picks up, including the filters the caller maintains today (project, issue type, approval labels, and the Feature path's Target Version gate) — so adding a workload wires up how it finds work without touching shared code or deployment configuration. This is decided but not yet implemented: today the caller still supplies the query, and moving it into the descriptor is follow-up work.
Stage resolution
Every stage — fetch, decompose, review, revise, submit — resolves its behavior from the selected descriptor. Shared stage code keeps only the stage procedure, artifact locations, and safety and validation instructions; it holds no workload-specific policy. Cross-station document parsing — strategy title headings spanning the peer stations' key prefixes — and artifact filename conventions stay in shared code: they are station mechanics, not workload policy. Concretely, each stage's agent prompt is a shell: the policy path and artifact template are injected as bound values from pipeline state (POLICY_FILE, ARTIFACT_TEMPLATE), the stage reads and follows them, and it never chooses a workload or policy itself. The producer contract for generated artifacts is exposed per workload through the frontmatter CLI (schema TYPE --workload ID), including the exact rubric criterion names and canonical component names, so typed epic writes reject unknown components and a reviewed component cannot be silently dropped from a submitted plan.
Submission and recovery
Submission is a separate explicit command per workload. A credential-free dry run validates local artifacts without any HTTP. A real run validates the full artifact set, review scores, components and the dependency graph before the first Jira write, then rechecks live source approval and content freshness. Main and conditional plans are both validated before anything is created; conditional plans stay attachments on a main investigation rather than separate issues, and a main epic's gated_by must name a main investigation included in its dependencies.
Writes go through stable identity labels and reviewed-plan fingerprints, backed by an atomically persisted, locally locked intent journal:
- Intent is saved before creation.
- Reruns recover known effects and reconcile missing relationships, labels and content-addressed evidence.
- Create and upload requests are never blindly retried after ambiguous outcomes; an unresolved prior create stops for later reconciliation.
- The source is marked processed only after all phases succeed.
The descriptors and registry live in the repository of the pipeline that consumes them — Epic Creator's today — not in a central store; a second consumer would decide with the maintainers whether they move.
Forge scope
Forge-neutral. Workload descriptors configure Jira-backed planning — projects, issue types, labels, relationships — and the pipeline reads source content through the same generic fetch mechanics it uses. Nothing in this decision depends on GitHub, GitLab or Forgejo specifics.
Consequences
- Adding a workload means adding a validated descriptor and its policies, not forking the pipeline or editing shared stages.
- The existing single-workload discovery, artifact, DAG, review and submission behavior is preserved as a compatibility path — the restructure changes how the code is organized, not what a run without the flag does.
- Strategy Creator's published approval is a precondition this pipeline trusts and does not re-run; how Strategy Creator reaches it is Strategy Creator's business. The local gate is this pipeline's own: the descriptor configures it — criteria, points, pass score — the pipeline's code enforces it, and a workload cannot ship executable checks or switch it off.
- Recovery depends on retaining the artifact directory and journal; a lost journal plus an invisible or unindexed source issue cannot guarantee duplicate prevention.
- Changes to planning prompts and policies require model-quality evaluation against the existing corpus, in addition to deterministic orchestration tests.
