From 49a6a6d9a03b8209e3cbfbb2eeba63745ef0d5f5 Mon Sep 17 00:00:00 2001 From: Amos Date: Tue, 1 Sep 2026 03:00:23 +0300 Subject: [PATCH] Match the pi learning system's tool definitions (quiz/ask) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- components/question-dock.tsx | 6 ++++- src/agent/system-prompt.md | 2 +- src/agent/tools.ts | 16 +++++++++---- src/core/question-core.ts | 44 +++++++++++++++++++++--------------- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/components/question-dock.tsx b/components/question-dock.tsx index 864b346..836ac06 100644 --- a/components/question-dock.tsx +++ b/components/question-dock.tsx @@ -156,7 +156,11 @@ function QuestionDockForm({ toolName, toolCallId, input, onSubmit }: Omit