Skip to content

166. Descriptor-driven planning workloads ​

Date: 2026-11-30

Status ​

Accepted

Context ​

Epic Creator decomposes approved strategies into implementation epics. 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 under the skill directory are at once stage procedure and workload policy — the review prompt carries the whole scoring rubric in prose, the decompose prompt the triage and Directed Acyclic Graph (DAG) construction rules; and 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, and any per-workload fork replicates each fix across copies.

The peer creators (RFE Creator, Strategy Creator) are separate pipelines that share configuration vocabulary, not code: each pipeline evaluates its own gates, and the shared vocabulary carries no executable gate interface — a consumer does not inherit a producer's gates.

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, as shipped for the RHAI Initiative workload:

yaml
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'
  description_fallback: false
  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: true
  • source defines intake: where strategies live, how a valid source key is recognized (id_pattern), where strategy content comes from (attachment_template, with description_fallback configurable per workload — an attachment-only workload skips a source whose attachment is missing), which labels evidence approval (ready_labels), how a processed source is recognized (skip_policy: processed-label checks the processed label, child-epics checks for existing child epics), which handoff identity fields the source carries (identity_fields), and the upstream handoff type (handoff_type).
  • submission defines the tracker destination (project, issue type), the relation each generated epic carries to its source (parent, or a link relation), the dependency link type between generated epics, and the stable label slots used for idempotent writes: created, investigation, implementation and AI-implementation prefixes, and needs-component.
  • planning binds 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, and zero_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 never loads executable plugins.

Policies ​

Stage policy lives in documents under workloads/policies/, referenced by registry-relative path from the descriptor and constrained by the workload schema's path pattern: markdown procedures and templates for decomposition, review, revision and artifact bodies, and a machine-readable scoring.yaml validated against workloads/_schema/scoring.schema.json. A policy family may carry generation directories (policies/rhai/v1/, a future v2/, …) so a new policy generation can be added without rewriting documents other descriptors still reference; the generation segment is a naming convention — the schema constrains the path shape, and what a run binds is the content digest of each referenced document, so a policy edit rejects resume exactly like a descriptor edit. Policies are referenced, not inlined, so workloads that share a policy family share the same documents. The two shipped workloads (rhaistrat-strategy, rhai-initiative) differ only in their source blocks and share policies/rhai/v1/ — the concrete demonstration that adding a workload is a source contract plus policy references, not new stage code.

Cross-stage handoff ​

The source block is the consuming side of the upstream station's published handoff. 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, where RFE Creator artifacts carry type, tracker_ref, and local_id. The upstream station records what this pipeline reads — project, issue type, approval labels, id pattern, attachment pattern, strategy headings, High Level Requirements (HLR) priorities — as a data fixture and tests its types against it without importing this repository; in the descriptor architecture that contract splits naturally, the intake fields landing in source and the content-structure expectations in the planning policy documents. The descriptor vocabulary is copied between stations, not imported — the same rule the creators follow. The upstream design also publishes an inputs: block as carried data — the stations import nothing from each other — which stays lint-check vocabulary there and is not an executable gate interface here.

Registry validation ​

Validation runs before any pipeline work and rejects missing fields, duplicate IDs, unknown schema versions, unsafe path declarations, and references to policies that are not in the registry. A run never starts against an invalid registry.

Selection and binding ​

Descriptor selection resolves once at entry: explicitly with --workload ID, where omission preserves the legacy single-workload invocation unchanged. Opt-in Jira intake instead resolves the descriptor from the source issue's (project, issue_type) binding, then validates the source key against id_pattern and the approval labels. A source whose identity conflicts with the selected workload, or an unknown workload ID, fails before decomposition or any Jira write. The original source identity is preserved throughout — the source issue is never cloned or re-keyed, and hand-made child issues do not block intake.

The selection persists in pipeline state. Generated artifacts and state bind the workload ID and version, the canonical descriptor digest, the digests of the referenced policy content, and the source provenance. Stage boundaries validate these bindings — including ordered review scores against the selected gate — and a changed descriptor, changed policy content, or a bound source revision rejects resume: typed artifacts require a fresh fetch and a new planning run.

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. 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 strategy 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 consuming repository. The implementation is tracked in #9966.

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 already 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.
  • Gate evaluation stays in the consuming pipeline; the descriptor is data, not an executable gate interface.
  • 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.

Open questions ​

  • Whether this pipeline's descriptor adopts the upstream inputs: vocabulary (carried data, lint-check only there) for cross-stage handoff, versioned so stations evolve without lockstep releases.
  • Production discovery configuration (JQL selection) stays with the caller; whether it moves into the descriptor is undecided.