Skip to content
Press / to search

Tutorial 4: Close the improvement loop

Apply the candidate improvement profile to turn an operator correction into an evidence-bound Insight, Strategy rule, and release-gated promotion.

TutorialLast reviewed: Edit on GitHub
At a glance

In Tutorial 3 the runtime emitted a typed DecisionRecord. Now we apply the candidate improvement profile: an operator correction lands in the Feedback Store, the Insight Synthesizer clusters it, the Strategy Compiler proposes a reusable StrategyRule, and the proposal goes through the same release gate as a pack change. Nothing auto-applies. FeedbackRecord, Insight, and StrategyRule are locally versioned illustrative records here, not published ContextOS schemas or exported canonical types.

What we are building

cluster of 23 similar scorecard deltas OK regression DecisionRecordstatus=ESCALATEDFeedbackStoreInsightSynthesizerInsight ins_a17StrategyCompilerStrategyRule str_b03status=proposedRelease Gate / Criticreplayreleasedrejected
ESCALATED DecisionRecord feeds Insight, Strategy, Release Gate
1
Capture the correction

The operator overrides a refund decision and records why. A deployment adopting this profile writes a locally validated feedback entry with provenance.

{
  "feedback_id": "fb_2026_05_04_c19",
  "kind": "correction",
  "context": { "decision_record_id": "dr_2026_05_04_a17", "intent": "support.refund" },
  "operator": "user_finance_lead_77",
  "correction": "Refund eligibility should consider prior corrections within 90 days",
  "applied_to_record": "dr_2026_05_04_a17",
  "evidence_refs": ["dr_2026_05_04_a17"],
  "captured_at": "2026-05-04T09:32:00Z"
}

The same correction also writes a correction-class memory record. It outranks prior records on the same key. See Memory.

2
Cluster into an Insight

The Insight Synthesizer scans the trace store and the corrections feed. When a pattern crosses a minimum-occurrence threshold, it emits a candidate Insight under the deployment’s local schema.

{
  "insight_id": "ins_2026_05_04_a17",
  "kind": "failure_cluster",
  "intent": "support.refund",
  "pattern": "policy.eval denial after order_lookup when refund_amount > 800 INR",
  "occurrences": 23,
  "first_seen": "2026-04-21T09:14:00Z",
  "last_seen": "2026-05-04T08:01:00Z",
  "evidence_refs": ["dr_2026_04_21_x12", "dr_2026_05_03_q88"],
  "confidence": 0.91,
  "status": "proposed"
}

status: "proposed" means no independent promotion authority has triaged it yet.

3
Compile a Strategy rule

The Strategy Compiler converts the validated insight into a locally versioned candidate StrategyRule at the right runtime layer (prompt / planner / retrieval / tool_selection / memory_recall / budget_allocation).

{
  "strategy_rule_id": "str_2026_05_04_b03",
  "applies_to": { "intent": "support.refund" },
  "trigger": { "from_insight": "ins_2026_05_04_a17" },
  "adjustment": {
    "layer": "planner",
    "type": "tool_preference",
    "value": { "prefer_tool": "adp_policy.eval_with_promotion", "over": "adp_policy.eval" }
  },
  "release_gate_target": "support.refund",
  "status": "proposed"
}
4
Release-gate the proposal

The proposal does not auto-apply. The Evaluation Engine replays deterministic fixtures and evaluates model-dependent outcomes with declared properties or scorecards against the current baseline. The release gate’s verdict is one of:

  • passpolicy >= 1.0, safety >= 1.0, utility non-regressive within tolerance, economics improved or non-regressive.
  • block — any guardrail metric regressed; proposal stays proposed with the failing metrics surfaced.

The independent principal authorized by policy approves the gate; the rule transitions proposed → reviewed → approved → released.

5
Pin and roll out

A released StrategyRule is bound to the next published pack version. Replay against the prior pack version is unaffected. The proposal lifecycle is uniform across all six improvement primitives — Insight Synthesizer, Strategy Compiler, Feedback Store, Chief-of-Staff, Research Queue, Autotune.

proposed → reviewed → approved → released → (retired | superseded)
                  ↘ rejected

Where to next

You have completed a guided flow spanning the canonical execution contract and a candidate improvement profile: pack → compile → plan → execute (with a policy-selected gate) → record → proposed improvement. From here: