Tasks: Doctrine Delivery Activation Fast-Follow

Mission: doctrine-delivery-activation-01KYQVQK · Branch: feat/doctrine-delivery-activation Plan: plan.md · Grounding: pre-planning-ledger.md (D1–D19) Contracts: suggests-delivery-walk.md, drg-writer-discovery-gate.md

7 WPs / 3 lanes. Critical path WP01 → WP02 → WP03. WP04 branches off WP01; WP05/WP06/WP07 fully parallel (WP07 land-early to de-flake ATDD). All assertions on the profile channel (profile_channel_reachable), never resolve_context (D10). Baseline deferred set = 60 (D19).

Subtask Index (reference table — completion is event-sourced via mark-status)

TaskDescriptionWPParallel
T001Add Relation.SUGGESTS to PROFILE_CHANNEL_RELATIONS (reachability.py)WP01
T002Profile-channel when-projection reusing link_references(roots=seeds, …) (progressive_disclosure.py)WP01
T003Widen kind delivery + profile-render consumer beyond procedures (repository.py/context.py)WP01
T004Consume forward-API seed helpers cross-file (agent_profile_seed_urns, …)WP01
T005ATDD: profile channel delivers DDD/C4/refactoring with when; diamond dedup; action-channel isolationWP01
T006Family-A when backfill (architect/paula/randy → DDD) grounded in existing reasonWP02
T007Author C4 template:instantiates edge from action:documentation/designWP02
T008Author anti_pattern nodes for refactoring-* smells (grounded; defer un-attested)WP02
T009Author tactic --REJECTS--> anti_pattern edges; anti-pattern validator greenWP02
T010Update cardinality/histogram goldens + composition-ledger entriesWP02
T011ATDD: template reaches architect via C4 tactic refs (needs WP01); REJECTS validatorWP02
T012Re-measure via canonical helper; reconcile _PROFILE_UNREACHABLE/_PROFILE_RESCUES/_ACTION_UNREACHABLE_D2WP03
T013Wiring table deferred 60→lower + Family ledgers + reconcile stale 50/39 proseWP03
T014Final forward-API allowlist sweep (~2–3 wired) + _baselines.yaml; unwired stay notedWP03
T015Lightweight member-vs-ledger cross-check test; NFR-002 review-gate noteWP03
T016Extract reference-pointer helpers (+ module cache) → context_renderers/reference_pointers.pyWP04
T017Extract delivery-table helpers → context_renderers/delivery_table.py + re-export shim (3 test importers)WP04
T018Define ArtifactRepository Protocol; apply at 12 sites; remove # type: ignore (net-removal)WP04
T019ATDD: context.py consumer tests green (behaviour-preserving); mypy --strict greenWP04
T020Route all 3 document-emit sites through graph_document_to_dict (incl. pack_assembler)WP05[P]
T021Register all document writers in drg_writers/registry.pyWP05[P]
T022Author writer-discovery gate (dict-literal AND .model_dump() shapes; assert membership)WP05[P]
T023Self-mutation battery: both shapes red independently (NFR-006)WP05[P]
T024except DRGGraphSchemaError → ValidationIssue at both pack_validator sitesWP06[P]
T025Base _post_validate success hook (built-in + overlay); move AssetRepository _source_paths thereWP06[P]
T026Fix AgentProfileRepository twin; regression: project-layer validation-failure → source_path absentWP06[P]
T027Fixture excludes/resets context-state.json; first_load always TrueWP07[P]
T028Verify hermeticity across the test_every_load_delivery matrixWP07[P]

WP01 — Profile-channel suggests walk + when delivery (IC-01, IC-02-consume)

doctrine's applicability condition (links-not-bodies), so architect/implementer profiles receive the A/B/C/E linked doctrine. THE core delivery vector.

FR-006(consume); NFR-003 · Deps: none

the profile render path surfaces paradigm:domain-driven-design with its when — RED today (test_reachability.py:710), NEVER via resolve_context (D10). See contract suggests-delivery-walk.md.

re-walk (D11); projection lands in progressive_disclosure sibling, minimal context.py delta (R-M7).

  • Goal: Extend the profile channel to follow suggests and surface each edge's when as the delivered
  • Priority: P1 (critical path — WP02/WP03/WP04 depend on it) · Requirements: FR-001, FR-002, FR-003,
  • Independent test: profile_channel_reachable(graph, {agent_profile:architect-alphonso}) +
  • Subtasks: T001, T002, T003, T004, T005
  • Risks: when is on the inbound edge + seeds are stripped → reuse link_references(roots=seeds), no
  • Est. prompt size: ~420 lines

WP02 — DRG topology authoring: Family-A when + C4 template + anti-pattern REJECTS (IC-03, IC-04)

moves: Family-A when backfill, the C4 template:instantiates edge, anti-pattern nodes + REJECTS edges.

(needs WP01); each anti_pattern is a REJECTS-target with the anti-pattern validator green; all cardinality/histogram goldens green with matching ledger entries.

is topology completion, delivery rides WP01 (D13); anti_patterns validation-tier, never delivered (D14); owns the shared goldens so parallel-WP golden collision is avoided (R-M1).

  • Goal: Author the DRG-edge/node topology this mission adds AND own every cardinality/histogram golden it
  • Priority: P1 · Requirements: FR-007, FR-008; C-004, C-005; NFR-002(cardinality goldens) · Deps: WP01
  • Independent test: templates reach the architect via IC-01's suggests-walk to the C4 tactic's references
  • Subtasks: T006, T007, T008, T009, T010, T011
  • Risks: no invented smells (C-004) — defer un-attested; instantiates walked by no channel → the edge
  • Est. prompt size: ~480 lines

WP03 — Reachability reconciliation (terminal) (IC-05)

goldens (pins + wiring table + final allowlist sweep). Owns ONLY reachability goldens, NOT cardinality (WP02).

measured set; wiring-table deferred set drops below 60; test_no_dead_symbols green after the ~2–3 sweep; every moved golden has a ledger row.

measure ONLY via the helper (C-001); "50"/"39" are stale, baseline 60 (D19).

  • Goal: Re-measure the profile-reachable set via the canonical helper and reconcile the reachability
  • Priority: P1 (terminal) · Requirements: FR-004, FR-005, FR-006(final); NFR-002, NFR-004 · Deps: WP01, WP02
  • Independent test: _PROFILE_UNREACHABLE/_PROFILE_RESCUES/_ACTION_UNREACHABLE_D2 reconciled to the
  • Subtasks: T012, T013, T014, T015
  • Risks: NFR-002 pins are REVIEW-gated not CI-gated (D18) — per-member ledger-vs-diff is the sole gate;
  • Est. prompt size: ~360 lines

WP04 — context.py extraction + ArtifactRepository Protocol typing (IC-08, IC-06b)

(behaviour-preserving) and replace object-typed repository surfaces with an ArtifactRepository Protocol, net-removing the 12 # type: ignore.

green with the 12 ignores removed and none added.

3 external test importers (re-export shim); Refs #2532 slice, NOT Closes (D8); the 2 progressive_ disclosure.py ignores are a documented out-of-map type-only edit (WP01 owns that file).

  • Goal: Extract the reference-pointer + delivery-table helpers to context_renderers/ siblings
  • Priority: P2 · Requirements: FR-012, FR-010(typing half); NFR-001, NFR-005 · Deps: WP01
  • Independent test: all context.py consumer tests stay green (byte-identical payloads); mypy --strict
  • Subtasks: T016, T017, T018, T019
  • Risks: reference slice couples to _REFERENCE_SOURCE_INDEX_CACHE (move together); delivery slice has
  • Est. prompt size: ~380 lines

WP05 — DRG writer registry unify + discovery gate (IC-06a, #3075/#2977)

graph_document_to_dict, register each, and author a non-vacuous discovery gate.

self-mutation battery reds independently for a dict-literal AND a .model_dump()-shaped unregistered writer.

fail-open by design. #3075 closes only if WP04's typing half also lands (C-007).

  • Goal: Route ALL three document-emit sites (incl. pack_assembler) through the canonical
  • Priority: P2 (parallel) · Requirements: FR-010(writer half); NFR-006 · Deps: none
  • Independent test: a hypothetical new top-level DRGGraph field emits at all 3 sites; the discovery-gate
  • Subtasks: T020, T021, T022, T023
  • Risks: NFR-006 non-vacuity — BOTH shapes proven (D-M5); bound the "closes the class" claim; registry is
  • Est. prompt size: ~360 lines

WP06 — DRGGraphSchemaError UX + asset source-path (IC-07, #3062)

asset _source_paths split-brain via a base _post_validate hook and fix the AgentProfileRepository twin.

project-layer asset that fails validation → source_path(id) absent.

change other repos' success-path behaviour.

  • Goal: Surface DRGGraphSchemaError as a structured ValidationIssue during doctrine validate; fix the
  • Priority: P2 (parallel) · Requirements: FR-011 · Deps: none
  • Independent test: a pack with a stray top-level graph key → structured issue (not traceback); a
  • Subtasks: T024, T025, T026
  • Risks: _post_validate must fire at BOTH load paths (built-in + overlay, D-M8); base-hook must not
  • Est. prompt size: ~300 lines

WP07 — Hermetic delivery-test fixture (IC-09)

always True unless the test sets it — eliminate the local-only false-red.

  • Goal: Make test_every_load_delivery::project exclude/reset context-state.json so first_load is
  • Priority: P2 (parallel, land early to de-flake WP01/WP04 ATDD) · Requirements: FR-009 · Deps: none
  • Independent test: the suite is green even with an ambient context-state.json recording implement.
  • Subtasks: T027, T028
  • Risks: minimal — ignore_patterns("context-state.json") or unlink-after-copy.
  • Est. prompt size: ~160 lines

MVP scope

WP01 alone (with WP07 landed first to de-flake) is the demonstrable MVP: the profile channel delivers the inert A/B/C/E doctrine with when. WP02→WP03 complete the topology + reconciliation; WP04–WP06 are the hygiene closures.

Requirement coverage

FR-001/002/003 → WP01 · FR-004/005 → WP03 · FR-006 → WP01(consume)+WP03(sweep) · FR-007/008 → WP02 · FR-009 → WP07 · FR-010 → WP05(writer)+WP04(typing) · FR-011 → WP06 · FR-012 → WP04. NFR-001 → WP04 · NFR-002 → WP02+WP03 · NFR-003 → WP01 · NFR-004 → WP03 · NFR-005 → WP04+WP05 · NFR-006 → WP05.