Match the pi learning system's tool definitions (quiz/ask)

Compared the port against the original pi setup
(vault/π/learn/.pi: quiz.ts, ask-user-question.ts, teach SKILL.md) —
the pi version never produced invalid correctAnswer values. Root cause
of the port's validation failures: the pi options schema's 'Give each
option a stable value; you reference the correct one by that value in
correctAnswer' sentence was dropped in the port. Without it the model
omits values and must copy a long natural-language label verbatim into
correctAnswer — and instead slugifies it ('cultural-diagnosis' for
'A cultural diagnosis') every turn.

Now matched to pi:
- quiz schema: pi's field order (question, details, options,
  multiSelect, correctAnswer, explanation) and descriptions — options
  carry the stable-value instruction, correctAnswer is phrased as a
  value reference ('the value field of the option you intend'), not a
  copy-exact-or-fail threat. nodeId (lh-only, graph) stays.
- ask schema: dropped the redundant 'mode' param (pi has none; the dock
  already infers from options presence), pi's descriptions.
- quiz tool description: pi's full text (ask contrast, note field,
  dontKnow semantics) minus terminal-only details, plus lh's turn
  protocol sentence.
- system-prompt: fixed the stale 'exactly two tools' line (plan/research/
  demo/visual tools have their own sections).

Not matched, deliberately: tool results stay JSON (pi sends curated
text; formatAnswerMessage exists if we want it later), shuffle param
(lh always shuffles seeded), pi's ask '(Recommended)' label hint.
This commit is contained in:
Amos
2026-09-01 03:00:23 +03:00
parent 7ab444ead3
commit 49a6a6d9a0
4 changed files with 43 additions and 25 deletions
+11 -5
View File
@@ -22,13 +22,19 @@ import { planTools } from "./tools/plan.ts";
*/
export const quizTool = tool({
// Description ported from the pi original (the learning system this app
// grew out of) — that one never produced invalid correctAnswer values.
description:
"Ask the learner a GRADED question with a known correct answer, then instantly grade and give feedback. " +
"Use it to (1) assess what the learner already understands before teaching, and (2) run tight practice/retrieval loops after explaining. " +
"Options-only: single-select or multi-select, plus an automatic 'I don't know' choice so the learner can signal a genuine gap instead of guessing. " +
"correctAnswer must be the EXACT value (or label) of one of the listed options — a correctAnswer that matches no option fails validation and the call is returned to you to fix. " +
"No free-text answers — for non-graded questions use ask_user_question instead. " +
"Ask exactly one question per tool call; after calling, end your turn and wait for the graded result.",
"Unlike ask_user_question (which collects preferences/decisions with no right answer), quiz always has a " +
"correct answer supplied by you, marks the learner's selection right/wrong, reveals the correct answer, and " +
"can show an explanation. Use it to (1) assess what the learner already understands before teaching, and " +
"(2) run tight practice/retrieval loops after explaining, or probe understanding whenever you're unsure " +
"they've got it. Options-only: single-select or multi-select, plus an automatic 'I don't know' choice so the " +
"learner can signal a genuine gap instead of guessing. An always-present optional note field lets the learner " +
"attach a free-text note to ANY answer; it reaches you only when non-empty. No free-text answers — for " +
"non-graded questions use ask_user_question instead. Ask exactly one question per tool call; after calling, " +
"end your turn and wait for the graded result.",
inputSchema: quizInputSchema,
});