Repository navigation
Description
Problem
Epic #929 migrated several capabilities onto IOContract (rag.py, guardian.py, requirement_check — Phase 1, #1136–#1139, #1332), but only the output side of the contract actually got wired through. parse() is called from real code:
# mellea/stdlib/components/intrinsic/_util.py:252
return adapter.io_contract.parse(result_str)and its own follow-up issue (#1516) formalised that path properly.
build_prompt() never got the matching treatment. It's abstract on IOContract (_core.py:141), and every concrete subclass either raises NotImplementedError (_DictContract/_ListContract) or is a placeholder that says outright it isn't used:
# mellea/backends/huggingface.py:3234, on _UnusedIOContract
def build_prompt(self, **kwargs: object) -> Component:
raise NotImplementedError(
"not used on the intrinsic generation path: "
"_generate_from_intrinsic builds prompts via IntrinsicsRewriter."
)A repo-wide search for .build_prompt( finds zero call sites — not just for intrinsics, for any capability. So the epic went half-way: the output side got unified, the input side didn't, and nothing ever decided whether it should be.
Why this matters now
Three independent pieces of adapter work have each run into this and each deliberately routed around it rather than resolve it:
- Discussion Adapter API: one lifecycle, or two shapes? #1486 rejects folding activation/reformatting into
build_prompt. - Issue design(adapters): freeze Ollama adapter support and redirect to llama.cpp, or maintain #1633 (
ServerMediatedBindingsemantics) explicitly says its work "does not migrate rawio.yamlexecution intoIOContract." - Issue Prompting Fallbacks for Granite Library Intrinsics #993 (prompt-based fallback adapters) is reusing
IntrinsicsRewriterrather than implementingbuild_prompt, for the same reason the other two gave.
Three in a row correctly declining to touch it means the gap itself needs a decision, not another workaround.
Ask
Decide one of:
- Finish it. File the input-side equivalent of refactor(intrinsics): resolve the adapter's output contract from the adapter, not a parallel argument (Epic #929 Phase 2) #1516:
_generate_from_intrinsic(and the other generation paths) would calladapter.io_contract.build_prompt(**kwargs)instead of instantiatingIntrinsicsRewriterdirectly, and everyIOContractsubclass gets a real implementation instead of a stub or a raise. - Remove it. Drop
build_promptfrom theIOContractabstract interface and document that prompt construction is intentionally out of scope for it —IOContractbecomes an output-parsing contract only, closing the asymmetry the other way.
No urgency — not blocking #993 or #1633. Filed so the gap is tracked rather than rediscovered by the next person who bumps into it.
Activity
planetf1 commentedon Oct 20, 2026
Came back to this to frame the actual decision.
Facts first:
build_prompthas no callers. The tests only stub it because the ABCmakes them, and all our prompt building goes through
IntrinsicsRewriterinstead(#1486, #1633, #993, #1654). But it's public API (
IOContractis in__all__), andthe output half of the contract,
parse, is real and used everywhere. The input halfis the piece that never happened.
So the design question: does prompt construction belong in the adapter's I/O contract,
or in the generation machinery? Deleting the method settles it as "the rewriter owns
it"; building it out settles it as "the contract owns it", at the cost of becoming its
first real caller.
Keeping this under needs-design. The facts above are recorded so the decision has
something concrete to work from.