Skip to content

Ask Dave: verify reply claims instead of exact phrasing so the voice actually speaks - #19

Merged
Pradeeppilotdev merged 10 commits into
mainfrom
fix/ask-dave-voice-speaks
Nov 13, 2026
Merged

Pradeeppilotdev merged 10 commits into
mainfrom
fix/ask-dave-voice-speaks

Conversation

@TheGaffer7839

Copy link
Copy Markdown
Collaborator

Why

Ask Dave's conversational reply was dropped on nearly every question. For example, "hi dave" was dropped as "not supported small talk", and "how many pending invoices do I have" was dropped even though the facts were right. The verifier only accepted replies built from fixed phrase patterns.

Safety rule: unchanged

Every factual claim in a reply is still checked against the selected evidence. That covers every invoice ID, amount, count, outcome word, pause state, policy state and reason. Any claim that can't be verified drops the reply, and the owner sees the code-rendered facts exactly as before. What changed is the wording around verified claims: it no longer has to be one of a fixed set of phrases.

What changed (agent/ask/voice.ts, agent/ask/answer.ts)

  1. Claims, not phrasing. The old phrase matcher still runs first, so every reply it accepted before is still accepted. A sentence it doesn't accept is now checked claim by claim:
    • IDs: must be selected and in exact case. An unknown or unselected ID is rejected.
    • Amounts: bound to the nearest invoice, or to the budget field named next to them (used / remaining / per-payment / available / daily budget).
    • Outcomes: must match that invoice's state. Negation is handled, and "paid" also requires verified attribution.
    • Pause and policy state: must match the vault.
    • Everything else: the remaining words must come from a fixed connective/friendly vocabulary. So "fine", "safe", "will", "so", "sent", "approved", or a made-up reason still drop the reply. URLs and @ are rejected too.
  2. Counts with owner synonyms:
    • "waiting / unpaid / not paid yet / outstanding / pending" = queued + proposed + pending (a strict pending count is also accepted);
    • "paid / settled" = paid;
    • "blocked / rejected" = blocked + failed;
    • "of your N bills" = total.
  3. Chat: the fixed phrase list is gone. Requirements: selected alone, ≤ 300 chars, no digits, IDs, outcome or vault-state words, action claims or URLs. I also kept a short no-assessment rule ("fine", "safe", "risk", "scam", "everything", budget/policy words), so "Your supplier is a scammer" can't pass as small talk.
  4. PR Ask Dave: how-to cards, code-computed 'what fits', voice diagnosis #16's three proposals:
    • no_record is ignored when other keys are selected;
    • " was blocked because " is accepted, but only that invoice's own meaning;
    • a next-step sentence inherits the invoice ID of the previous sentence.
  5. Count line: adds "Waiting to be paid: N." It shows even with the voice off.
  6. Debug: COUNTERSIGN_ASK_DEBUG=1 now also prints the dropped reply text (stderr only; the owner never sees it).

The SYSTEM prompt now:

  • routes "how many bills are pending/paid/blocked" to activity (fit stays for "how many payments can I make");
  • states the claim rule;
  • shows the because form;
  • uses "Hi! How can I help with your vault?" as the chat example.

Tests

  • npm run test:ask: 48/48. Two new tests cover:
    • Passes: "You have 12 bills waiting to be paid", "12 pending invoices", "12 queued and waiting to be paid", "Of your 17 bills, 12 are waiting", a friendly amount claim, the because + next-step form, pause/policy state, "Hi! How can I help with your vault?", and no_record + budget.
    • Fails: "You have 11 waiting", "2 bills were blocked", "17 bills were paid", an extra unverified number, "INV-BEANS-003 was paid" when it's blocked, "was not blocked", a wrong amount, "approved", "I've sent", an email address, another invoice's reason, a next step with no ID to inherit, "I paid your bills", and an assessment in chat.
  • Every existing voice test still passes unchanged, including all the strict "wrong" cases.
  • Only one existing test was updated for exact phrasing: the count-line deepEqual in "How is my agent doing?", which now ends with "Waiting to be paid: 0."
  • npm run test:ask:sandbox: 1/1. npm test: 11/11. npm run test:app: 61/61.

Live (current agent vault, 4 model calls, COUNTERSIGN_ASK_DEBUG=1)

This ran before the last two changes (debug reply text, and a count carrying over to "queued and waiting"). Vault: 18 bills (12 queued, 3 paid, 3 blocked).

Question Reply shown? Debug
hi dave Yes: "Hi! How can I help with your vault?" none
how many pending invoices do I have No reply dropped: claim or phrasing does not match. The facts were shown, including the new "Waiting to be paid: 12."
why was INV-PASTRY-02-b52ef8a9 blocked? No reply dropped: claim or phrasing does not match. The facts were shown with the glossary reason
how is my agent doing? No reply dropped: claim or phrasing does not match. The count line and report card were shown

Only 1 of 4 replies was shown live. The old debug line didn't include the rejected text, so I couldn't see which claim failed. That's why debug now prints it. A follow-up live run (4 calls) is needed to see the exact dropped text and tune the vocabulary. Don't merge before that.

🤖 Generated with Claude Code

TheGaffer7839 and others added 2 commits November 12, 2026 21:22
A reply sentence that does not match a fixed phrase is now accepted when every
claim in it checks out against the selected evidence: invoice IDs, amounts
(bound to their invoice or budget field), counts (with owner synonyms such as
waiting/unpaid/outstanding/pending = queued+proposed+pending), outcome words,
pause and policy state, and exact glossary reasons. Remaining words must come
from a fixed connective/friendly vocabulary, so assessments, causes, promises,
actions, URLs and @ still drop the reply.

- chat: no fixed phrase list; no digits, IDs, outcome/vault-state words,
  assessments, actions or URLs
- no_record beside other keys is ignored
- "<ID> was blocked because <exact glossary meaning>", and a next-step
  sentence inherits the previous sentence's invoice ID
- activity count line adds "Waiting to be paid: N"
- COUNTERSIGN_ASK_DEBUG also prints the dropped reply text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…voice card

- reasoning_effort:'low' (NEAR AI ignores 'none', enable_thinking and
  thinking:{type:'disabled'}; 'low' drops reasoning to ~1 token)
- the model sees the 10 most recent invoices plus any named in the question;
  code still renders and verifies from the full facts pack
- help:spot-bad-invoice how-to card, routed for faulty/fake/scam questions
- "current" accepted as connective wording in replies

"how is my agent doing?" on the current vault: 25.3 s -> 3.7 s, reply shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheGaffer7839

Copy link
Copy Markdown
Collaborator Author

Update: speed + spot-bad-invoice card (commit on this branch)

Reasoning off. I probed NEAR AI with z-ai/glm-5.3-flash and a one-line prompt:

  • reasoning_effort:"none", chat_template_kwargs.enable_thinking:false, thinking:{type:"disabled"}, enable_thinking:false and /nothink were all ignored (29+ reasoning tokens each).
  • reasoning_effort:"low" dropped reasoning to 1 token. Ask Dave now sends reasoning_effort:"low".

Less evidence to the model. The model now sees the 10 most recent invoices plus any invoice named in the question. Code still renders and verifies answers from the full facts pack, and the report card still lists every bill.

Timing (same question, same vault, COUNTERSIGN_ASK_DEBUG=1): "how is my agent doing?"

  • before: 25.3 s, reply dropped;
  • after: 3.7 s, and this reply was shown: "Your agent recorded proposals for 6 of 18 bills in the inbox. Currently 12 bills are queued, 3 paid, and 3 blocked, with 12 waiting to be paid."

The new debug line showed the earlier drop was caused only by the word "current", which is now accepted.

help:spot-bad-invoice covers: a bad signature, a payee that isn't the pinned payout, the same supplier bill under a new ID, a second bill for a covered service week, and a lookalike account. It also says how to check before paying: the Import panel, the account check, and npm run agent:desk -- ask --check <signed-invoice.json>. SYSTEM routes faulty/fake/scam questions to it.

  • Live, "how do I know if an invoice is a scam?" selected the card in 4.4 s. The model's paraphrase reply was dropped, so the card text was shown.

Tests: test:ask 49/49 (new: evidence cap, card command check), test:ask:sandbox 1/1, npm test 11/11, test:app 61/61. The only existing test changed is the request-body key list, which now includes reasoning_effort.

…it found

- agent/ask/battery.json: 30 real-owner questions incl. typos and off-script
- scripts/ask-battery.ts: live run, table of direct / facts only / refused /
  error with time; saves raw selections to work/ask-battery-last.json
- verifier: supplier amounts bound to the supplier, flag phrases and flag
  counts bound to the invoice, IDs listed by a selected record, "it"/"this"
  in glossary text, help-card commands and the card's own words
- owner "pending" no longer accepts the strict pending count ("0 pending"
  while 12 wait was misleading); a leading Yes/No is never accepted
- debug reason names the failing claim and sentence

First run: 12/30 direct, 2.8 s median; one misleading reply, now rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheGaffer7839

Copy link
Copy Markdown
Collaborator Author

Acceptance battery: run 2 (npm run ask:battery, 30 live calls)

14/30 answered directly (run 1: 12/30). Median time 2.9 s. Four answers had API-side latency spikes: 26.0 s, 52.4 s, 16.1 s and 7.8 s. Zero false claims: I checked all 14 shown replies against the current vault. Target ≥ 24 is not met.

Between the runs the vault changed outside Ask Dave: 8 queued bills became blocked with "Policy expired." It is now 18 bills: 3 paid, 15 blocked, 0 waiting.

# Question Result Time
1 hi dave direct 3.1 s
2 how are you direct 4.6 s
3 how many pending invoices do I have direct 2.9 s
4 what's waiting direct 26.0 s
5 did beans get paid facts only 1.3 s
6 why is milk blocked facts only 1.9 s
7 how do I know if an invoice is fake direct 1.3 s
8 can I pay 1 NEAR now facts only 1.4 s
9 what happened today facts only 7.1 s
10 who did I pay most facts only 52.4 s
11 is anything weird facts only 3.6 s
12 how do I raise my limit direct 4.0 s
13 why isn't anything paying facts only 6.1 s
14 hw many bills r blokced direct 2.9 s
15 wats my budget left facts only 5.6 s
16 is my vault paused? facts only 1.6 s
17 how much is in the vault direct 0.9 s
18 thanks dave direct 1.1 s
19 any problems with pastry co? facts only 16.1 s
20 how many have been paid so far direct 2.2 s
21 why was INV-PASTRY-02-b52ef8a9 blocked? direct 5.5 s
22 how is my agent doing? direct 7.8 s
23 what are my current rules? facts only 2.7 s
24 how do i pause payments direct 1.4 s
25 whats going on with my bills lol facts only 2.3 s
26 can you pay milk for me facts only 2.5 s
27 how much did i spend this week facts only 6.2 s
28 is INV-BEANS-02-b52ef8a9 a duplicate? facts only 2.6 s
29 yo dave whats up direct 2.9 s
30 what's the weather tomorrow refused (correct) 2.2 s

Why the other 15 drop. Almost every dropped reply adds an unchecked inference:

  • causal "so …" ("so yes", "so that isn't the cause", "so renew it", "so no single supplier was paid most");
  • a leading "Yes";
  • a paraphrased reason ("blocked because the spending policy expired" instead of the glossary text).

These are the claims the safety rule exists to stop. A check against the saved selections shows that cutting only the unverified sentences would reach about 19/30: still below 24.

Reaching 24 would mean accepting model-written causes and yes/no answers, which would weaken the rule. I have not made that change.

A reply is checked sentence by sentence. Sentences whose every claim checks out
are shown in order; unverified ones (model-written causes, "Yes", paraphrased
reasons) are cut and listed in COUNTERSIGN_ASK_DEBUG output. A greeting left on
its own is not shown, a next step whose invoice sentence was cut is cut too,
and small talk is still all-or-nothing. The safety rule is unchanged: nothing
shown contains an unchecked claim.

Offline replay of battery run 2's saved selections: 14/30 -> 19/30 direct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheGaffer7839

Copy link
Copy Markdown
Collaborator Author

Sentence trimming

A reply is now checked sentence by sentence:

  • Shown: sentences whose every claim checks out, in their original order.
  • Cut: unverified sentences, such as model-written causes, a leading "Yes" or a paraphrased reason. Debug lists each cut sentence and the reason (COUNTERSIGN_ASK_DEBUG=1).
  • Guards:
    • a greeting left on its own is not shown;
    • a next step whose invoice sentence was cut is cut too;
    • small talk is still all-or-nothing.

The safety rule is unchanged: nothing shown contains an unchecked claim.

Offline replay of battery run 2's saved model answers (no new calls): 14/30 → 19/30 answered directly. The five new replies:

Tests: test:ask 51/51, test:ask:sandbox 1/1, npm test 11/11, test:app 61/61. One existing test was updated: "true sentence + false sentence" used to drop the whole reply, and now shows only the true sentence. The test asserts the false sentence is never shown.

TheGaffer7839 and others added 6 commits November 13, 2026 12:18
Found in hands-on testing. Verification and the model call are unchanged;
only code-written cards, computed facts and their reply phrasings.

- help:policy and help:renew point to "Your rules" on the demo website
  (no longer CLI-only).
- New computed fact "runway": vault available / rolling daily budget,
  exact BigInt, rounded down with the remainder. No policy, expired rules
  and a zero budget are said plainly, with the matching card below.
- "What fits" now reads "Today you can still pay N more bills of X. Your
  daily budget (R left) runs out before your vault (A) does." Same numbers;
  earlier phrasings stay accepted.
- New help:stablecoin (1Click lab preview, no money moves) and help:fees.
  Fees checked in the contract: authorize, reserve and execute are
  executor-only calls signed by the executor account, which prepays gas;
  the vault's available balance and policy usage move only by the invoice
  amount.
- help:resume adds the expired-invoice and expired-rules next steps.
- New no-answer text, exported so the battery script stays in sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Pradeeppilotdev
Pradeeppilotdev merged commit f927d1d into main Nov 13, 2026
2 checks passed
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.

2 participants