(motir-ai) The re-plan handler must READ `context.generateExplanations` and pass it to `runGenerationPass` — the consumer half
Repo: motir-ai. One PR. The CONSUMER half of the contract whose producer half is the motir-core card this is blocked_by — that card puts generateExplanations on the re-plan job envelope; this one makes the handler act on it.
The defect
src/jobs/handlers/replan.ts never mentions generateExplanations (verified on origin/main, 2026-08-04 — searched with python, since grep finds nothing in these long-line files). It calls runGenerationPass({ grounding, plan, situationPrompt: REPLAN_SITUATION_PROMPT }, sink) with no explanation option, so:
EXPLANATION_INSTRUCTIONis never appended to the composed system prompt, andbuildGenerationToolsnever adds theexplanationMdproperty topropose_node(it is added, and made REQUIRED, only when the flag is set),
meaning every node a re-plan proposes lands with no explanation, whatever the project's setting says. generateTree.ts is the working reference: it reads req?.context?.generateExplanations === true off the job envelope and spreads ...(generateExplanations ? { generateExplanations: true } : {}) into every runGenerationPass call.
Acceptance criteria
replan.tsreads the flag off the job envelope exactly asgenerateTree.tsdoes (same defensive read ofrequestJson.context, same strict=== true) and passes it torunGenerationPass.- With the flag ON, a re-plan's
propose_nodeproposals carryexplanationMdandexplanationSource: 'ai_draft'(theAI_DRAFT_EXPLANATION_SOURCEconstant) through toaddProposals— asserted by a test, not by inspection. - With the flag OFF or absent, the composed prompt and tool surface are byte-identical to today's — the same no-drift discipline
generate_treekeeps. - The proposals materialize into work items whose explanation is recorded as AI-drafted (the
explanationSourcelockstep with motir-core's enum). - Do NOT read motir-core config directly — the flag rides the envelope; that boundary is the reason the producer card exists.
- PR title carries
MOTIR-<id>.
Context refs
src/jobs/handlers/replan.ts— the handler edited; its singlerunGenerationPasscall site.src/jobs/handlers/generateTree.ts— the working reference for both the envelope read and the option spread.src/llm/treeGeneration.ts—buildGenerationSystemPrompt/EXPLANATION_INSTRUCTION/buildGenerationTools/AI_DRAFT_EXPLANATION_SOURCE(why the flag changes both prompt and tool surface).