fix: tell the agent the receipt policy the books actually use

The server's instructions hardcoded '$25.00'; they now state the
configured threshold, and a zero threshold reads 'every entry needs at
least one receipt'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MtYEaR6M6Ybdhm6X98BWNu
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-12 17:30:35 -07:00
1 parent 005a96055a
commit 01d41c0daf
3 files changed
+73 -5

No files matched your search

+20 -4
View File
@@ -101,10 +101,26 @@ impl ReceiptPolicy {
/// Human-readable policy summary for previews and errors.
pub fn describe(&self) -> String {
format!(
"receipts required when entry debits are strictly greater than {}",
self.threshold()
)
if self.threshold().is_zero() {
"receipts required on every entry".to_string()
} else {
format!(
"receipts required when entry debits are strictly greater than {}",
self.threshold()
)
}
}
/// The receipt rule, phrased for the agent's operating instructions.
pub fn rule(&self) -> String {
if self.threshold().is_zero() {
"every entry needs at least one receipt".to_string()
} else {
format!(
"any entry moving more than ${} in debits needs at least one receipt",
self.threshold().round_dp(2)
)
}
}
/// Normalize a description for split detection.
+5 -1
View File
@@ -4051,7 +4051,11 @@ impl ServerHandler for BooksServer {
.enable_resources()
.build(),
)
.with_instructions(INSTRUCTIONS)
// Tell the agent the policy these books actually use.
.with_instructions(INSTRUCTIONS.replace(
"any entry moving more than $25.00 in debits needs at least one receipt",
&self.policy.rule(),
))
.with_server_info(Implementation::new(
"wanderbooks",
env!("CARGO_PKG_VERSION"),