Files
proffesor-for-testing__agen…/docs/implementation/PROMOTION-PATH-INVENTORY.md
Dragan Spiridonov 0a8254f7a9 feat(learning): ADR-117..122 learning-integrity cluster (frozen anchor, two-gate judge, gate-reexecute, provenance tiers, receipt-gated flywheel, DoE)
Adopts the receipt-gated self-improvement discipline from the 2026-07 cross-repo
analysis of ruflo (flywheel), MetaHarness (gateReExecutes), and retort (two-gate
spec conformance + DoE). All DI'd and unit-tested (178 tests); run end-to-end on
real qe_patterns; every limitation honestly scoped.

- ADR-117 frozen oracle anchor: hash-pinned, constant-denominator eval set that
  no promotion may regress; loader throws on drift (verification/anchors/qe-anchor-v1.json).
- ADR-118 receipt-gated QE-policy flywheel: generational loop over qe_patterns,
  conjunctive frozen accept(), Ed25519-signed receipts + compounding lineage,
  durable persistence (flywheel_receipts), corpus + semantic-retriever coupling.
- ADR-119 two-gate quality verdicts: mechanical gate + frontier judge, three-valued
  (pass/fail/inconclusive) with preflight; new `aqe quality-gate` CLI + `qe/quality/gate` MCP tool.
- ADR-120 gateReExecutes: re-execute a versioned frozen rule on sealed inputs;
  catches the A8-EXT forged-promote class; retrofit onto pattern-promote + dream-apply.
- ADR-121 provenance tiers: only oracle:test-exec evidence changes fleet behavior;
  additive, conservative-backfill migration.
- ADR-122 DoE screen: model x prompt x retrieval x scaffold, run on real data
  (25/27 cells, $1.25) — scaffolding (esp. reflexion) and retrieval degrade
  reliability (the retort `beads` signature); simplest+cheapest stack wins.
- safe-db: AQE_DISABLE_WAL / AQE_JOURNAL_MODE env-gate (macOS virtiofs bind-mount
  WAL corruption mitigation; default behavior unchanged).

Honest nulls documented: the flywheel lift is on a self-supervised proxy with the
anchor held flat; making the coupled anchor move needs harder items + a relevant
corpus (an ADR-117 re-freeze), not a retriever change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 10:26:54 +00:00

3.3 KiB

Promotion-Path Inventory (ADR-120 first implementation task)

Date: 2026-07-07 · Author: AQE Core · Scope: every code path that changes fleet behavior by promoting/applying a learning artifact. Feeds ADR-120 (gateReExecutes), ADR-121 (provenance tiers), ADR-118 (flywheel accept).

Verified against agentic-qe@3.11.5, working-july, live .agentic-qe/memory.db (158 qe_patterns rows).

Paths

# Path Decision site Write site Sealed today? Tier-gated today?
P1 Pattern promotion (short-term → long-term) src/learning/pattern-lifecycle.ts:524 checkPromotion() → :551 shouldPromote :565 promotePattern() → UPDATE qe_patterns SET tier='long-term', promotion_date=… (:572) No No — reward/occurrence/success-rate/activity only; no provenance_tier check
P2 Dream-insight apply (A8-EXT home) src/coordination/mincut/dream-integration.ts insight loop :1405 applied: flag on dream_insights No No — this is the fake-applied-counter class ADR-120 targets
P3 GOAP action promotion no dedicated promot* site found; promotion is implicit in the GOAP executor dispatch (ADR-014/GOAP A14) executor apply No No
P4 Distillation promotion (ADR-121/ruflo ADR-174 analogue) not yet present in AQE — — — (net-new with ADR-121)
P5 Flywheel accept() net-new (ADR-118) net-new Will seal via ADR-116 Will gate on tier (ADR-121)

Edge/overclaim surfaces (ADR-121 §3 overclaim guard)

concept_edges, pattern_relationships, hypergraph_edges — inferred relations that must be written proxy:structural, low confidence, promoted=false, and never labelled with a stronger relation type than evidence supports (ruflo's causal_edges → cooccurrence lesson).

Schema facts (live DB)

  • qe_patterns already has tier (lifecycle: short-term/long-term), confidence, promotion_date, consecutive_failures — but no provenance_tier. ADR-121 adds a distinct provenance_tier column (do NOT overload the lifecycle tier).
  • PatternLifecycleManager.ensureSchema (:255-275) already uses the idempotent in-code SELECT col … catch → ALTER TABLE ADD COLUMN idiom — the safe additive migration pattern ADR-121 §5 mandates. Reuse it verbatim for provenance_tier.

Retrofit order (implementation)

  1. P1 — add provenance_tier column + gate shouldPromote on oracle:test-exec (ADR-121), then wrap promotePattern write with sealed-input re-execute (ADR-120). Highest-traffic, best-understood path → do first.
  2. P2 — dream apply: seal + re-execute (closes A8-EXT structurally), tier the insight.
  3. P5 — flywheel accept() is built sealed + gated from the start (ADR-118).
  4. P3/P4 — GOAP + distillation once the shared reExecuteGate primitive exists.

Shared primitive to build first

src/validation/gate-reexecute.ts — reExecuteGate(ruleVersion, sealedInputs) → verdict + gateUnchanged fingerprint check, conforming to @metaharness/flywheel verifyReplayBundle semantics (/workspaces/agent-harness-generator/packages/flywheel/src/replay.ts:66-90). Composes with src/integrations/ruvector/proof-gate.ts HashChainGate (ADR-116) for sealing. Every path above consumes it.