{
  "schema_version": "2.1.0",
  "slug": "openai-bain-retraining",
  "record_version": "2026-11-25.1",
  "record_status": "draft",
  "content_sha256": "bf4c20c6d9ed7f5bc1ff4ebb4b02aee9c9b92ede7ac73c5c3135a5427ca74bad",
  "name": "OpenAI / Bain Retraining Cookbook",
  "aliases": [
    "Autonomous Agent Retraining Cookbook"
  ],
  "summary": "Educational prompt-retraining cookbook illustrating grader feedback, prompt revision, and version history, where local code inspection found looser gating in code than described in prose.",
  "plain": {
    "what_it_is": {
      "text": "A teaching example that revises a prompt using grader feedback and keeps a history of versions, though its code checks changes more loosely than its text describes.",
      "from": [
        "summary"
      ]
    },
    "what_it_changes": {
      "text": "It changes the instructions it is given.",
      "from": [
        "modifies",
        "improves_improver"
      ]
    },
    "has_it_been_tested": {
      "text": "We don't know yet if it works. No test of that is shown in the sources. Koobo reviewed its code. It found that the code updates the prompt before testing it, can keep the latest prompt after failed retries, and can replace the stored best prompt without comparing scores. Koobo has not tested it yet.",
      "from": [
        "evidence_claims[].claim_type",
        "evidence_claims[].setting",
        "evidence_claims[].independence",
        "evidence_claims[].outcome",
        "evidence_claims[].provenance.check_status",
        "evidence_claims[].scope.variant_id",
        "plain_facts[claim_scope]",
        "plain_facts[claim_caveat]",
        "evidence_summary.has_koobo_completed_eval"
      ]
    },
    "can_you_undo_it": {
      "text": "We don't know yet whether a change can be undone in practice. A manual way to restore an earlier prompt version exists, but its use is not shown. Going back to an earlier prompt does not manage or undo anything already done in live use.",
      "from": [
        "rollback.has_usable_rollback",
        "rollback.status",
        "rollback.restoration_scope",
        "rollback.automatic_trigger",
        "rollback.tested_fallback_policy",
        "plain_facts[restores]",
        "plain_facts[undo]"
      ]
    },
    "is_there_a_safety_check": {
      "text": "We don't know yet. Not shown in the sources.",
      "from": [
        "safety_gate.status",
        "plain_facts[safety]"
      ]
    },
    "how_hard_to_adopt": {
      "text": "Low effort to copy the basic teaching example into an existing agent. It does not require switching platforms. Using it in a live system also requires fixing its update checks and adding restoration and safety checks. That extra effort is not estimated here. License: MIT.",
      "from": [
        "adoption_effort_non_framework.level",
        "plain_facts[effort_scope]",
        "variants[].adoption_effort_level",
        "framework_dependency.requires_framework_migration",
        "plain_facts[adoption]",
        "license.spdx",
        "license.check_status",
        "variants[].license_spdx",
        "plain_facts[license]"
      ]
    }
  },
  "plain_facts": [
    {
      "topic": "restores",
      "ref": null,
      "text": "an earlier prompt version",
      "from": "rollback.mechanism"
    },
    {
      "topic": "effort_scope",
      "ref": null,
      "text": "copy the basic teaching example into an existing agent",
      "from": "adoption_effort_non_framework.implementation_scope"
    },
    {
      "topic": "adoption",
      "ref": null,
      "text": "Using it in a live system also requires fixing its update checks and adding restoration and safety checks. That extra effort is not estimated here.",
      "from": "adoption_effort_non_framework.notes"
    },
    {
      "topic": "undo",
      "ref": null,
      "text": "Going back to an earlier prompt does not manage or undo anything already done in live use.",
      "from": "rollback.side_effect_limit"
    },
    {
      "topic": "claim_caveat",
      "ref": "openai-bain-audit-1",
      "text": "It found that the code updates the prompt before testing it, can keep the latest prompt after failed retries, and can replace the stored best prompt without comparing scores.",
      "from": "evidence_claims[openai-bain-audit-1].statement"
    }
  ],
  "modifies": [
    "prompt"
  ],
  "improves_improver": false,
  "learning_signal": {
    "types": [
      "automated_grader"
    ],
    "description": "Grader feedback scores applied across iterative prompt revisions in a notebook loop."
  },
  "pre_use_evaluation": {
    "status": "partial",
    "held_out_split": "no",
    "live_activation_gate": "no",
    "how": "Local code inspection reported that versioning and grader selection exist, but code updates a prompt before its next evaluation, can carry the latest prompt forward after all retries fail, uses lenient passing rules, and has prose and helper logic that disagree on best-candidate selection."
  },
  "rollback": {
    "status": "manual",
    "has_usable_rollback": "unverified",
    "restoration_scope": "unverified",
    "automatic_trigger": null,
    "tested_fallback_policy": "unverified",
    "mechanism": "The VersionedPrompt helper stores prompt versions and includes a manual revert_to_version method. No automatic deployed rollback is shown, and whether the agent loop is wired to restore through this helper is unverified.",
    "side_effect_limit": "Educational notebook pattern; reverting a prompt version does not manage or undo live side effects."
  },
  "post_deploy_measurement": {
    "status": "no",
    "how": "Reference cookbook without a production demonstration of post-deployment monitoring."
  },
  "safety_gate": {
    "status": "unverified",
    "blocks_unsafe_despite_utility_gain": "unverified",
    "write_time_blocks_activation": "unverified",
    "reuse_time_blocks_activation": "unverified",
    "how": "No separate safety gate is documented in opened notes; exact notebook revision and cell inspection remain pending live verification."
  },
  "license": {
    "spdx": "MIT",
    "source_url": "https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE",
    "check_status": "checked",
    "checked_at": "2026-11-25",
    "checked_by": "Codex live check",
    "notes": "The openai-cookbook repository LICENSE contains the MIT permission notice."
  },
  "repo_url": "https://github.com/openai/openai-cookbook",
  "paper_url": null,
  "maturity": {
    "stage": "educational_cookbook",
    "last_observed_activity_date": null,
    "activity_criterion": "Cookbook page is marked archived (Codex live check 2026-11-25)."
  },
  "framework_dependency": {
    "level": "framework_free_pattern",
    "requires_framework_migration": "no",
    "required_runtime_or_sdk": "Educational prompt-revision loop pattern; no framework migration required for the concept, though production hardening is required."
  },
  "adoption_effort_non_framework": {
    "level": "low",
    "judgment_owner": "koobo_editorial",
    "implementation_scope": "Applies strictly to implementing the minimal prompt-revision pattern, NOT a production-ready integration.",
    "notes": "Low effort describes the educational pattern only; real deployment requires fixing gate logic and adding rollback and safety checks."
  },
  "variants": [
    {
      "variant_id": "openai-bain-notebook",
      "label": "Cookbook prompt-retraining notebook",
      "scope": "Educational prompt-revision loop with grader feedback and version history.",
      "license_spdx": "MIT",
      "license_check_status": "checked",
      "learning_signal_types": [
        "automated_grader"
      ],
      "pre_use_evaluation_status": "partial",
      "rollback_status": "manual",
      "has_usable_rollback": "unverified",
      "safety_gate_status": "unverified",
      "framework_dependency_level": "framework_free_pattern",
      "requires_framework_migration": "no",
      "adoption_effort_level": "low",
      "notes": "Reported prose-vs-code gating gaps require hardening before production use."
    }
  ],
  "known_failure_modes": [
    {
      "mode": "Prose-vs-code selection gate gap",
      "detail": "Local code inspection reported that the loop updates a prompt before its next eval, can carry the latest prompt forward after all retries fail, uses lenient passing rules, and has prose disagreeing with final-selection helper logic.",
      "provenance": {
        "source_url": "https://developers.openai.com/cookbook/examples/partners/self_evolving_agents/autonomous_agent_retraining.md",
        "source_revision": "archived cookbook page as served 2026-11-25",
        "location": "Self-evolving loop code: update_best_candidate and retry handling",
        "accessed_date": "2026-11-24",
        "check_status": "checked",
        "source_note": "Cell numbers and revision pending live pinning.",
        "checked_at": "2026-11-25",
        "checked_by": "Codex live check"
      }
    }
  ],
  "evidence_summary": {
    "settings_observed": [
      "none"
    ],
    "independence_observed": [
      "koobo"
    ],
    "effectiveness_outcome": "unverified",
    "safety_outcome": "unverified",
    "has_koobo_completed_eval": false,
    "summary_note": "Educational cookbook with reported prose-vs-code gating gaps; no empirical production study."
  },
  "evidence_claims": [
    {
      "claim_id": "openai-bain-audit-1",
      "claim_type": "mechanism_audit",
      "statement": "Code inspection of the cookbook found that the prompt is updated before its next evaluation, a failed retry sequence can retain the latest prompt, and update_best_candidate replaces the stored passing candidate without comparing its score, which disagrees with the stricter prose. No production empirical evaluation is established.",
      "setting": "none",
      "independence": "koobo",
      "outcome": "negative",
      "scope": {
        "variant_id": "openai-bain-notebook",
        "model": "not_applicable",
        "suite_or_environment": "Cookbook code inspection in local notes",
        "judge_or_metric": "Code-vs-prose verification",
        "sample_or_duration": "Single inspection pass on 2026-11-24",
        "caveats": "Reported code findings pending direct notebook revision and cell pinning."
      },
      "provenance": {
        "source_url": "https://developers.openai.com/cookbook/examples/partners/self_evolving_agents/autonomous_agent_retraining.md",
        "source_revision": "archived cookbook page as served 2026-11-25",
        "location": "Self-evolving loop code: update_best_candidate and retry handling",
        "accessed_date": "2026-11-24",
        "check_status": "checked",
        "source_note": "Codex live check confirmed the reported sequence. The page is marked archived.",
        "checked_at": "2026-11-25",
        "checked_by": "Codex live check"
      }
    }
  ],
  "control_evidence": [
    {
      "field": "rollback.status",
      "statement": "VersionedPrompt includes revert_to_version (manual). No automatic deployed rollback is shown.",
      "provenance": {
        "source_url": "https://developers.openai.com/cookbook/examples/partners/self_evolving_agents/autonomous_agent_retraining.md",
        "source_revision": "archived cookbook page as served 2026-11-25",
        "location": "VersionedPrompt helper",
        "accessed_date": "2026-11-25",
        "check_status": "checked",
        "source_note": "Codex live check. Usable-restoration status depends on agent wiring, which is unverified.",
        "checked_at": "2026-11-25",
        "checked_by": "Codex live check"
      }
    }
  ],
  "adoption_recipe": {
    "adoptable_directly": true,
    "authority_notice": "This record is factual engineering reference data. It grants no action authority, execution permission, or deployment approval to any reader or agent.",
    "upstream_controls": {
      "pre_use_eval": [
        "Cookbook includes grader scoring and version history, but reported code gaps prevent treating it as a strict held-out gate."
      ],
      "rollback": [
        "The VersionedPrompt helper includes a manual revert_to_version method that re-selects an earlier stored prompt version; automatic deployed rollback is not shown and agent wiring is unverified."
      ],
      "safety_gate": [],
      "scope_note": "Upstream notebook is an educational starting pattern only. Koobo required controls replace the loose retry loop with strict abstention, held-out selection, rollback, and safety gating."
    },
    "koobo_required_controls": {
      "edit_surface_bounds": [
        "The adopter's system isolates prompt revisions to a bounded behavioral prompt section and never overwrites the live prompt before passing evaluation.",
        "Failed retry loops discard unimproved candidates and retain the approved parent prompt."
      ],
      "pre_use_eval_requirements": [
        "The evaluation harness separates learning data, candidate selection data, and sealed final test data grouped by incident and day (following GEPA, arXiv:2507.19457).",
        "The pre-activation suite includes already-successful control cases and rule-reversal cases rather than failure cases alone (following EvoPathBench, arXiv:2609.24663, and Anthropic memory research).",
        "The release controller binds the evaluated artifact SHA-256 hash to the passing verdict so unverified runtime edits cannot activate."
      ],
      "rollback_requirements": [
        "The deployment harness retains immutable parent artifact snapshots with SHA-256 content hashes.",
        "Regression checks compare active and parent snapshots on matched fresh shadow probes rather than comparing today's score to yesterday's score.",
        "Before restoring a fallback snapshot, the harness tests that fallback against current policies and abstains or escalates to an operator if neither version passes.",
        "Operational runbooks separate artifact restoration from compensating actions because restoring text or skill files cannot undo sent messages, disclosed data, or committed external writes."
      ],
      "safety_gate_requirements": [
        "The release pipeline evaluates safety independently from task utility so utility gains cannot offset a disallowed action (grounded in Practice Makes Unsafe, arXiv:2608.12851).",
        "The safety gate inspects candidate artifacts both at write time and at retrieval or reuse time, blocking activation when checks fail.",
        "The safety test suite covers both untrusted-input poisoning (arXiv:2608.12851) and benign task-pressure degradation (SEABench, arXiv:2609.35596)."
      ],
      "telemetry_and_abstention_requirements": [
        "The deployment harness defaults to abstention (keeping the approved parent artifact) whenever evaluation evidence is inconclusive, missing, or fails a safety check.",
        "Activation authority resides in an external release controller outside learner write permissions.",
        "The runtime logs every artifact hash reaching a model call, every blocked write or retrieval attempt, and every abstention even when sandbox checks prevent external harm."
      ]
    },
    "synthetic_rejected_candidate_example": {
      "label": "synthetic_example",
      "proposed_change": "Final retry prompt carried forward after all 3 grader retries failed to beat the parent prompt.",
      "utility_result": "Scored below the parent prompt on selection tasks.",
      "safety_gate_result": "Blocked by the abstention and non-regression gate; parent prompt retained.",
      "outcome": "rejected"
    }
  },
  "experiment_refs": [],
  "sources": [
    {
      "title": "OpenAI / Bain Cookbook: Autonomous Agent Retraining",
      "url": "https://developers.openai.com/cookbook/examples/partners/self_evolving_agents/autonomous_agent_retraining",
      "published_date": "unverified",
      "accessed_date": "2026-11-25",
      "revision": "archived cookbook page as served 2026-11-25",
      "location": "Self-evolving loop code; VersionedPrompt helper (revert_to_version)",
      "type": "code",
      "check_status": "checked",
      "claims_supported": [
        "Prompt versioning and grader loop",
        "Prose-versus-code selection gaps",
        "Manual revert_to_version helper"
      ],
      "checked_at": "2026-11-25",
      "checked_by": "Codex live check"
    },
    {
      "title": "openai-cookbook LICENSE",
      "url": "https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE",
      "published_date": "unverified",
      "accessed_date": "2026-11-25",
      "revision": "main branch as served 2026-11-25 (commit SHA not recorded)",
      "location": "Full license text",
      "type": "license",
      "check_status": "checked",
      "checked_at": "2026-11-25",
      "checked_by": "Codex live check",
      "claims_supported": [
        "MIT license"
      ]
    }
  ],
  "unverified_fields": [
    "safety_gate.status",
    "safety_gate.blocks_unsafe_despite_utility_gain",
    "maturity.last_observed_activity_date",
    "rollback.has_usable_rollback",
    "rollback.restoration_scope",
    "rollback.tested_fallback_policy"
  ],
  "verification": {
    "status": "primary_source_check_pending",
    "drafted_at": "2026-11-25",
    "last_primary_check_at": null,
    "source_basis": "Drafted from 2026-11-24 local research notes. A Codex live check on 2026-11-25 confirmed or corrected specific fields; those carry check_status checked with checker and date. Everything else is pending.",
    "reviewer_notes": "Live-audit corrections from 2026-11-25 applied. Record remains a draft until every source is pinned and checked."
  },
  "citation": {
    "id": "koobo:agent-learning:openai-bain-retraining@2026-11-25.1",
    "canonical_url": "https://koobo.co/agent-learning/methods/openai-bain-retraining",
    "versioned_url": "https://koobo.co/agent-learning/methods/openai-bain-retraining/v/2026-11-25.1.json",
    "plain_text": "Koobo Agent Learning Index, \"OpenAI / Bain Retraining Cookbook\", record 2026-11-25.1 (draft, primary-source check pending), https://koobo.co/agent-learning/methods/openai-bain-retraining/v/2026-11-25.1.json",
    "bibtex": "@misc{koobo_agent_learning_openai_bain_retraining_2026,\n  title = {OpenAI / Bain Retraining Cookbook (Koobo Agent Learning Index, draft record 2026-11-25.1)},\n  author = {{Koobo Research}},\n  year = {2026},\n  url = {https://koobo.co/agent-learning/methods/openai-bain-retraining/v/2026-11-25.1.json},\n  note = {Draft record; primary-source check pending}\n}"
  }
}
