The pass asks a per-CARD question — its own query text, and the kind, type and phase it is working in
selectForInjection takes a queryText its own comment calls "the planning job's intent" — one string for the whole pass. A run planning twelve cards embeds it twelve times and hands all twelve identical lessons, ranked identically. That is indistinguishable from injecting a fixed block, which is what this epic exists to stop.
This story moves the question down a level. For each card the pass is working on, it composes:
- the query text, from that card — title, kind, type, target repo, the deliverables it enumerates;
- the kind and type of the card;
- the phase it is in —
skeletonwhile laying a level's children,deepenwhile writing a body.
The phase is the coordinate only the pass can supply. The card does not carry it and the store cannot infer it, so it has never been asked for — which is why lessons about shaping a level arrive while somebody is writing acceptance criteria.
Keep the enhancement property: an empty selection yields an empty promptSection and injects nothing, so a card whose question matches no lesson plans exactly as it does today.
Acceptance criteria
- The planning path builds a per-card query and the three axes from the card and the pass, not from the job intent.
- Two cards planned in the SAME pass, of different type, produce different queries and different selected lesson id sets — asserted on ids, not rendered prose.
- The same card produces a different selection while widening than while deepening, asserted — the phase axis actually discriminates.
- Selected ids are recorded per card on the job record, so injection stays inspectable per card rather than per pass.
- An empty selection still yields an empty
promptSectionand injects nothing. - Generate, augment and replan all go through the one shared helper — no per-handler query construction.
Context refs
motir-aisrc/services/lessonService.ts—SelectForInjectionInput.queryText,LessonInjection.lessonIds, the shared-helper contract.motir-aisrc/jobs/plannerInputs.ts— where the query is filled and the phase is known.motir-aisrc/jobs/handlers/generateTree.ts,src/jobs/handlers/replan.ts— the two call sites the helper keeps aligned.motir-aitests/lessonInjection.test.ts,tests/plannerInputs.test.ts.