Skip to content

Keep Buddy's action and mentor requests out of the FAQ - #210

Merged
daniilperkin merged 1 commit into
devfrom
feature/209-faq-buddy-prompts
Sep 27, 2026
Merged

daniilperkin merged 1 commit into
devfrom
feature/209-faq-buddy-prompts

Conversation

@daniilperkin

Copy link
Copy Markdown
Contributor

Summary

Part of SprintStartProject/Wiki#319 (chat → Buddy migration). Closes #209. Unblocks the FAQ half of SprintStartProject/sprintstart-backend#214.

Once /chat is retired, every question in a project-scoped Buddy conversation feeds the FAQ, in both capability modes, and only this classifier filters (Wiki#319, decision 12). Chat only ever got documentation questions; Buddy is also a mentor, so it also gets requests to act, questions about the asker's own onboarding, and context-only follow-ups. The old prompts discarded only greetings/smalltalk/thanks, so all of those would have become FAQ entries for the PM.

Changes

  • One shared discard list: insights.faq.NON_FAQ_KINDS, rendered verbatim by both _CLASSIFY_SYSTEM (live, per question) and _GROUPING_SYSTEM (full rebuild). If the two prompts drifted, a PM's refresh would bring back entries the live path had dropped. Categories:
    • (a) greetings, smalltalk, thanks, chit-chat (as before)
    • (b) requests for the assistant to do something: "move my card to done", "remind my PM about the review"
    • (c) questions about the asker's own onboarding state: "what should I work on next?", "summarise my onboarding path"
    • (d) follow-ups that only make sense inside their conversation: "and the second one?"
    • Tiebreak: it stays a documentation question when the same docs would answer anyone who asks it. "How do I get VPN access?" still counts.
  • "documentation chatbot" / "docs chatbot" → "the project's assistant" in both prompts.
  • Descriptions and docs brought in line: FaqClassifyRequest.question, FaqClassifyResponse.relevant, the /insights/faq/classify route description, module docstrings, and docs/faq-grouping-concept.md (new "classifier decides" bullet).
  • No wire change: the backend still sends question text only (it strips quoted selections, backend#214).

Tests (+17)

A scripted model returns whatever the script says, so asserting relevant=false for "move my card" only tests parsing. So the tests check both sides:

  • Prompt content: they capture the system prompt each entry point really sends and assert that every category and example is in it, that "chatbot" is gone, and that classify contains NON_FAQ_KINDS verbatim (shared-list guarantee).
  • Parsing: an irrelevant verdict yields no group, no documents and no second redaction call. group_faqs drops the discarded Buddy requests and keeps the mentor-toned doc question.
  • The capturing stubs override generate with its real signature, so no new type: ignore.

Verification

  • uv run ruff format --check . ✅
  • uv run ruff check . ✅
  • uv run python -m pyright src/: 0 errors ✅
  • uv run python -m pytest: 980 passed, 8 skipped (dev baseline 963 passed) ✅
  • Red check: reverting the two insights modules fails the new tests.

Not covered: real-model classification quality. That needs a live LLM (an llm_required test would be skipped in CI), so it's worth a manual spot check with the examples above once backend#214 feeds Buddy questions.

Base

Branched from dev. It doesn't overlap with #208 (Buddy tutor), which touches no insights/ files, so it can merge in either order.

Every question in a project-scoped Buddy conversation will feed the FAQ
once the chat is retired (Wiki#319, backend#214), in both capability
modes, and only the AI classifier filters. Chat only ever received
documentation questions, so both FAQ prompts described their input as
questions "asked to a docs chatbot" and discarded nothing but greetings,
smalltalk and thanks. Buddy is also a mentor: it is asked to act ("move
my card to done", "remind my PM about the review"), to report on the
asker ("what should I work on next?", "summarise my onboarding path")
and to continue a conversation ("and the second one?"). Under the old
rules each of those would have become an FAQ entry for the PM.

Both prompts now discard four kinds of text: smalltalk (as before),
requests to do something, questions about the asker's own onboarding
state, and follow-ups that only make sense inside their conversation.
The rule closes with the test that keeps a personal phrasing from being
mistaken for a personal question: it stays a documentation question when
the same documentation would answer anyone who asks it, so "how do I get
VPN access?" still counts even though it says "I".

The categories live in one constant, insights.faq.NON_FAQ_KINDS, that
the live classifier (classify) and the full rebuild (group) both render.
Two hand-kept copies would drift, and a rebuild that disagreed with the
classifier would resurrect entries the live path had dropped, or drop
entries it had kept, the next time a PM pressed refresh.

"Documentation chatbot" / "docs chatbot" become "the project's
assistant" in both prompts. The FaqClassifyRequest.question and
FaqClassifyResponse.relevant descriptions, the classify route
description, the module docstrings and docs/faq-grouping-concept.md say
the same. No schema change: the backend keeps sending question text
only, and strips quoted selections before sending (backend#214).

Tests pin what a stub can prove. With a scripted model the verdict is
whatever the script says, so asserting relevant=false for "move my card"
would only test parsing. Instead the tests capture the system prompt
each entry point actually sends and assert every category and example
is in it, that the chatbot wording is gone, and that the classify prompt
contains the shared constant verbatim. The parsing side is covered too:
an irrelevant verdict yields no group, no documents and no second
redaction call, and group drops discarded Buddy requests while keeping
the mentor-toned documentation question. The capturing stubs override
generate with its real signature, so they need no type: ignore.

Verification: ruff format --check, ruff check and pyright src/ (0
errors) clean; pytest 980 passed, 8 skipped (963 before, +17 new).
Reverting the two insights modules fails the new tests at collection.

Closes #209
@daniilperkin
daniilperkin merged commit 523c91b into dev Sep 27, 2026
4 checks passed
@daniilperkin
daniilperkin deleted the feature/209-faq-buddy-prompts branch September 27, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAQ prompts: accept Buddy questions and drop action/mentor requests (chat → Buddy migration)

2 participants