Skip to content

feat: "Bring Your Own Likelihood (BYOL)" mode — the second published prompt gets its guided door #40

Closed

Description

@Jammy2211

Overview

The start-here mode (#39) catches the first published prompt. The second published prompt — Bring Your Own Likelihood, on the PyAutoFit README, the RTD Quick Start and this README's "Your own project" P2 — has no mode of its own and lands in inferred assistant mode. This adds BYOL mode (modes/byol.md), named to play on BYOB: you bring the likelihood, the assistant brings the inference. The mode follows the prompt's own contract one stage per turn — overview of the project and likelihood function → compose and explain a model → wrap and validate → recommend a search → stop until the go-ahead → run, then explain how results are written to disk and how to inspect them — with the ask-anything / teacher-mode footer on every stage. Every surface carrying the prompt retitles its section "Bring Your Own Likelihood (BYOL)" and says the prompt launches BYOL mode; prompt text stays byte-identical.

Plan

  • Add modes/byol.md mirroring modes/start_here.md's shape; the engine is skills/af_wrap_likelihood.md plus af_compose_model, af_configure_search, af_run_search, af_load_results, af_plot_fit, start-new-project — the mode sequences them, it does not restate them.
  • Register BYOL in AGENTS.md "Modes" and the selection rule beside start here.
  • Retitle the section on the three surfaces to "Bring Your Own Likelihood (BYOL)" and add one sentence linking the prompt to BYOL mode (assistant README, PyAutoFit README, RTD Quick Start); one phrase on the Natural Language page's "for your own project" pointer.
  • Dry-run stages 1–6 in the worktree on a scratch stand-in for a user's project (a flat-ΛCDM likelihood module over dataset/sne_cosmology/), so the validation numbers and result table quoted in the mode are real.
Detailed implementation plan

Deliverables

A. autofit_assistant/modes/byol.md (new)

Mirror modes/start_here.md's shape (## What changes / ## What stays the same /
## Composition / ## What triggers inference, then the stages, ## Teacher mode and questions, ## Hand-off, ## Rules). Title: Bring Your Own Likelihood (BYOL) mode with the
BYOB line once ("you bring the likelihood, the assistant brings the inference").

  • Trigger: the published BYOL prompt (quoted verbatim), or "byol" / "BYOL" / "bring your own
    likelihood" / "wrap my likelihood" with a path or link. Outranks opening-request inference;
    .maintainer outranks it. If both start-here and BYOL prompts appear, BYOL wins when code is
    pointed at.
  • Posture: their code is the source of the likelihood — never re-parametrised, guarded or
    "fixed" (AGENTS.md invariant); nothing is fitted before an explicit go-ahead; one stage per
    turn with the same ask-anything / teacher-mode footer as start here; assistant-mode concision
    otherwise (this user has code, so default depth is "PyAutoFit newcomer", not inference
    newcomer — _style.md Adaptive depth).
  • Stages (one per turn, each: do → show → the footer → stop):
    1. Overview. Read the pointed-at code (GitHub link → clone into gitignored sources/, per
      AGENTS.md source-of-truth rule; local dir → read in place). Restate in a paragraph: what the
      function scores, its signature and calling convention, log-likelihood vs chi-squared, which
      arguments are free parameters vs fixed config, what data it needs and how it is loaded
      (af_wrap_likelihood "Ask"). Ask the user to correct it.
    2. Model. Compose af.Model/af.Collection mirroring the function's free arguments,
      priors chosen with the user (each prior a scientific statement); show model.info
      (af_compose_model).
    3. Wrap and validate. The Analysis wrapper importing their code (never copying it);
      the three validation checks (finite, equals their function, bad instance scores worse);
      the data-inspection gate on their real data (plot, path, one pathology question). Script
      saved in workspace style (af_wrap_likelihood "Branch").
    4. Search. Recommend with the reason: evidence needed → nested; posterior only → MCMC;
      best fit → optimiser; JAX-pure → gradient-based; per-call cost measured during validation
      sets the budget (af_configure_search, the JAX triage question once).
    5. Go-ahead checkpoint. Summarise model + priors + likelihood + search + expected runtime
      in a short table and stop; run nothing until the user says go.
    6. Run, then results on disk. af_run_search; the output-folder tour while it runs
      (_style.md "Output folder announcement"); then how to inspect and interpret: parameter
      table, af_plot_fit model-vs-data + corner, af_load_results reload without re-running,
      residuals as the check because real data has no truth.
  • Hand-off: start-new-project, af_ingest_paper for domain context, the RTD Scientific
    Workflow / Statistical Methods pages; record the wrap in wiki/project/profile.md
    "Likelihood & model code" (default-yes per the skill's Combine).
  • Rules: prompt byte-identical to the three surfaces; never fabricate output; code gate; the
    likelihood-code-is-the-user's invariant restated; generated Python → scripts/ (their project)
    in workspace style.
    Aim ≤ 300 lines: it points at the skills rather than restating them.

B. autofit_assistant/AGENTS.md "Modes"

Fourth bullet BYOL (Bring Your Own Likelihood: the user points at existing likelihood code;
overview → model → wrap + validate → search → go-ahead → run and inspect). Selection rule: the
published BYOL prompt, or "byol" / "bring your own likelihood" with code pointed at, joins the
start-here trigger at the front of the chain. Minimal diff.

C. Surfaces that carry the prompt

  • autofit_assistant/README.md: in "Your own project" P2, retitle the embedded heading-less
    paragraph as a sub-heading Bring Your Own Likelihood (BYOL), keep the prompt block
    byte-identical, add one sentence: this prompt launches BYOL mode (link modes/byol.md) —
    "bring your own likelihood; the assistant brings the inference". Also the "Setting up" step 3
    parenthesis names BYOL mode. Getting Started's "what happens when you type it" paragraph gets
    a half-sentence: if you already have likelihood code, the BYOL prompt is the other door.
  • PyAutoFit/README.md: heading → ## Bring Your Own Likelihood (BYOL); after the prompt block,
    one sentence that the assistant answers it with its BYOL mode (link modes/byol.md).
  • PyAutoFit/docs/overview/quick_start.md: heading → ## Bring Your Own Likelihood (BYOL); same
    one sentence after the nl-prompt container. Check docs/index.md / any toctree or in-page
    anchor referencing the old heading text and update the link text.
  • autofit_assistant/docs/setup/{claude_code,codex_cli}.md: if they mention the BYOL prompt,
    name BYOL mode; otherwise no change.
  • PyAutoFit/docs/overview/natural_language.md: the "For your own project, you can instead ask"
    pointer gains "(BYOL mode)" after the prompt — one phrase, no prompt change.

D. Dry run (required, numbers in the mode must be real)

In the worktree, simulate a user's project: a small standalone module in
scripts/scratch/byol_demo/ (NOT committed) — e.g. sne_likelihood.py with a flat-ΛCDM
log_likelihood(params: dict, z, mu, sigma) over dataset/sne_cosmology/ — then run stages 1–6
on it exactly as the mode prescribes: overview paragraph, model.info, wrapper + the three
validation checks (equality with the user's function asserted), Dynesty or Nautilus with a short
budget, output-folder tour, reload. Quote the real validation numbers and the result table in the
mode as its worked example. Nothing from the dry run is committed except the mode text; no
wiki/project/ files written.

Execution (delegated, one Opus subagent per leg; both legs in parallel — different repos)

  1. start_library (this session): worktree ~/Code/PyAutoLabs-wt/byol-mode/ on
    feature/byol-mode for both repos; /create_issue on autofit_assistant; register in
    active.md (library-dev).
  2. Opus feat: birth autofit_assistant — the generic inference assistant #1 — PyAutoFit docs leg (C's PyAutoFit items). Heading renames + link sentences;
    sphinx build warning count vs baseline (30).
  3. Opus feat: assistant build phases 1-3 — workspace pairing, statistics wiki, domain adaptation #2 — assistant leg (A, B, C's assistant items, D).
  4. Ship: Heart gate (YELLOW ack if unchanged reasons — ask once), PyAutoFit PR first, assistant PR
    second, cross-referenced, pending-release labelled; then /prm on the human's word.

Verification

  • The BYOL prompt block is byte-identical across PyAutoFit/README.md, quick_start.md,
    autofit_assistant/README.md and modes/byol.md (diff the extracted blocks).
  • grep -n "Bring Your Own Likelihood (BYOL)" hits the three section headings.
  • Fresh session in the worktree: paste the BYOL prompt with a path to the demo module; the reply
    states BYOL mode, gives the overview paragraph, and ends by asking the user to correct it — no
    fit launched. Later "go" runs the fit.
  • Dry-run validation: wrapper value == user's function value at a hand-built instance; bad
    instance scores lower; fit recovers the dataset README's Ωm ≈ 0.344, H0 ≈ 73.14.
  • python autoassistant/audit_skill_apis.py --check-version exit 0; git status in the
    assistant worktree shows only modes/byol.md, AGENTS.md, README.md, and (if touched) the
    two setup docs; PyAutoFit diff touches only README.md and docs/overview/*.md.

Out of scope

Branch Survey

Repository Current Branch Dirty?
./autofit_assistant main clean
./PyAutoFit main clean

Suggested branch: feature/byol-mode — worktree ~/Code/PyAutoLabs-wt/byol-mode/; worktree_check_conflict byol-mode autofit_assistant PyAutoFit → clear.

Original Prompt

Click to expand starting prompt

autofit_assistant: a "Bring Your Own Likelihood (BYOL)" mode analogous to start here

Type: feature
Target: autofit_assistant
Repos:

  • autofit_assistant
  • PyAutoFit
    Themes:
  • assistants
  • docs
    Difficulty: small
    Autonomy: safe
    Priority: high
    Consequence: notify
    Witness: modes/byol.md exists and AGENTS.md mode selection routes the published Bring Your Own Likelihood prompt ("Set up PyAutoFit with my existing science project …") to it; the mode runs the prompt's own contract — overview of the project and likelihood function → compose and explain a model → recommend a search → stop until the go-ahead → run → explain how results are written to disk and how to inspect them — one stage per turn with the ask-anything / teacher-mode footer; every surface that carries the prompt (PyAutoFit README, RTD Quick Start, assistant README) titles the section "Bring Your Own Likelihood (BYOL)" and says the prompt launches BYOL mode.
    Filed: 2026-09-10
    Parent: complete/2026/09/start-here-mode.md

Original request (verbatim)

Now add an analogous mode for these natural language prompts on the README.md and throughout the docs, maknig sure to put BYOL in the title in brackets and calling it byol mode or something so we can ply on BYOB Bring Your Own Likelihood
Already have a likelihood function for your science problem? Point the assistant at your existing code and it can set it up with PyAutoFit — defining the model, choosing priors with you, configuring a search and organising the results:

Set up PyAutoFit with my existing science project. An example likelihood function can be found at [GitHub link or local directory].

First, give me an overview of my project and likelihood function. Compose an appropriate model, explain it to me, and recommend a non-linear search (for example MCMC, nested sampling or maximum-likelihood estimation).

Do not begin inference until we have discussed the setup and I give you the go-ahead.

Once inference is running, explain how the results are written to disk and show me how to inspect and interpret them with PyAutoFit.

Your existing science code remains the source of the likelihood. With PyAutoFit built around it, you can perform inference through natural language while gaining access to features such as flexible priors and model composition, MCMC and nested sampling, automated result handling, model comparison and scalable workflows.

Context

The start-here mode (complete/2026/09/start-here-mode.md, autofit_assistant#39) catches the
published start-here prompt. The second published prompt — Bring Your Own Likelihood, on
@PyAutoFit/README.md, @PyAutoFit/docs/overview/quick_start.md and @autofit_assistant/README.md
("Your own project", P2) — has no mode of its own; it lands in inferred assistant mode. The
engine already exists: skills/af_wrap_likelihood.md (wrap + validate), with
af_compose_model, af_configure_search, af_run_search, af_load_results.

Scope

  • @autofit_assistant/modes/byol.md — the mode, mirroring modes/start_here.md's shape: trigger
    (the published BYOL prompt, or "byol" / "bring your own likelihood"), posture (their code is
    the source of the likelihood, never altered; nothing is fitted before the go-ahead), then the
    prompt's own contract as stages, one per turn: (1) overview of the project and the likelihood
    function (read the code, restate what it scores and its calling convention); (2) compose and
    explain a model with priors chosen with the user (model.info); (3) wrap into an Analysis
    and validate at hand-built instances against their function (af_wrap_likelihood), with the
    data-inspection gate; (4) recommend a search with the reason (af_configure_search); (5) the
    go-ahead checkpoint; (6) run, then explain how results are written to disk and how to inspect
    and interpret them (af_run_search, output-folder tour, af_load_results, af_plot_fit);
    hand-off to start-new-project and the scientific-workflow pages. The ask-anything /
    teacher-mode footer on every stage, as in start here.
  • @autofit_assistant/AGENTS.md — register BYOL in "Modes" and the selection rule beside
    start here.
  • @autofit_assistant/README.md, @PyAutoFit/README.md, @PyAutoFit/docs/overview/quick_start.md —
    retitle the section "Bring Your Own Likelihood (BYOL)", keep the prompt byte-identical, add one
    sentence that the prompt launches BYOL mode (link modes/byol.md), with the BYOB play
    ("bring your own likelihood — we supply the inference") where the register allows.
  • docs/setup/{claude_code,codex_cli}.md — mention BYOL beside the start-here line if they
    reference the BYOL prompt.

Activity

  1. Jammy2211 commented on Sep 10, 2026

    @Jammy2211
    ContributorAuthor

    Library PR created: PyAutoLabs/PyAutoFit#1604 (PyAutoFit docs, merges first)
    Assistant PR created: #41

    Both branches are feature/byol-mode in the byol-mode worktree. Merge via /prm in library-first order.

  2. Jammy2211 commented on Sep 10, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    • docs: Bring Your Own Likelihood (BYOL) headings and link to the assistant BYOL mode PyAutoFit#1604 (merged) — README and Quick Start sections retitled "Bring Your Own Likelihood (BYOL)" with one paragraph saying the assistant answers the prompt with its BYOL mode; the Natural Language page's "use my existing likelihood code" pointer names the mode. Prompt text unchanged.
    • feat: Bring Your Own Likelihood (BYOL) mode #41 (merged) — modes/byol.md: the published BYOL prompt run as six stages (overview → model → wrap + validate → search → go-ahead checkpoint → run and inspect), ask-anything / teacher-mode footer on every stage, real Pantheon+ worked example (Ωm 0.344, H0 73.11 in 11 s); AGENTS.md mode registration and selection rule; README.md "Bring Your Own Likelihood (BYOL)" sub-heading at the end of Your own project, with P2, Setup step 3 and Getting Started pointing at it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions