Skip to content

moooon

Motir

Vibe your whole project. Bring an idea — Motir's three AI layers plan it, track it, and ship it, end to end. You're looking at Motir, built in Motir.

  • Vibe Project
  • Open Source
  • AI Agent
  • AI Loop
1
requests
0
upvotes
145
planned
1,361
shipped

Motir · Work items

MOTIR-3300Done

Selection filters on kinds, types and phases — and selectForInjection finally carries them

Make the three axes filterable, and open the seam that has kept every existing filter unreachable.

listForInjection already models the pattern: AND "categories" && ARRAY[…]::text[], omitted entirely when nothing is supplied. Copy that shape for kinds, types and phases — three independent clauses, each omitted when its axis is not asked for, so a lesson unconstrained on an axis matches every query on it.

The seam is the point. SelectForInjectionInput is { aiProjectId, queryText, phase, limit } and both planner call sites go through it, so no planning selection has ever narrowed on anything but mistakeTypes. Add the three axes to that input and pass them down.

mistakeTypes is untouched and keeps its job: it answers which consumer (onboarding_planning / regular_planning / coding / planning_craft), and the 2026-06-20 decision that a planner reads its own bucket plus planning_craft still stands. The new axes answer which card, underneath it.

captureMistake currently writes no axes at all. Give it the three, recorded when its caller supplies them.

Acceptance criteria

  • listForInjection accepts optional kinds, types and phases and applies one overlap clause per axis, each omitted when that axis is empty.
  • The three axes are independent: a query naming only types does not constrain kinds or phases.
  • SelectForInjectionInput carries all three and passes them through unchanged.
  • captureMistake persists supplied axes and writes empty sets when none are given.
  • A call supplying no axes returns the same rows in the same order as today, asserted against the existing selection test.
  • mistakeTypes behaviour is unchanged, asserted.
  • pnpm typecheck clean; the lesson suites pass.

Context refs

  • motir-ai src/repositories/lessonRepository.ts — the && overlap clause and its omit-when-empty behaviour, the pattern to follow.
  • motir-ai src/services/lessonService.tsSelectForInjectionInput, selectForInjection, captureMistake, and the comment recording the phase-bucket-plus-craft decision.
  • motir-ai tests/lessonInjection.test.ts.
  • MOTIR-3299 — the columns and vocabularies this reads.