feat(mcp): point agents at ledger_context before booking (openwiki discovery) (#933)

The ledger-context digest rides inside gnubok_get_agent_briefing, but the
server-instructions block never told agents to USE it before categorizing or
creating vouchers. This adds that pointer, the AGENTS.md-injection analogue
from the openwiki pattern (dev_docs/ledger_context_resource.md, Discovery):
consult how THIS company books each counterparty/supplier and prefer the
observed patterns over guesses, with explicit mapping rules outranking them,
and historical frequency framed as evidence, not permission to auto-post.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-08 15:09:15 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent fddc58f624
commit c3764e8987
+1
View File
@@ -12018,6 +12018,7 @@ export async function handleMcpRequest(request: Request): Promise<Response> {
'• When the user asks "how do I do X" or you\'re unsure of the correct sequence (month-end close, VAT review, year-end, invoicing, payroll), call gnubok_list_skills first: domain workflows are documented as loadable skills with tool references.',
'',
'Common workflows:',
'• Before categorizing or creating vouchers, consult ledger_context in gnubok_get_agent_briefing (full picture: the Accounted://ledger/context resource): it shows how THIS company has booked each counterparty and supplier (dominant account, VAT treatment, evidence = historical frequency). Prefer these observed patterns over guesses; explicit mapping rules outrank them. Frequency is not permission to auto-post: still stage for approval.',
'• Categorize transactions: gnubok_list_uncategorized_transactions → gnubok_suggest_categories → gnubok_categorize_transaction (stages) → gnubok_approve_pending_operation (after user confirms in chat).',
'• Applying income to invoices: pick by what you have: a specific bank transaction + a known invoice → gnubok_match_transaction_to_invoice; an invoice you know is paid but no specific bank line → gnubok_mark_invoice_as_paid; a whole period of unmatched income to reconcile → gnubok_auto_match_period (dry_run first). All stage for approval. Unsure which match/link tool fits, or whether to credit 1510 (faktureringsmetoden) vs debit 19xx (kontantmetoden)? gnubok_load_skill("bank-reconciliation") has the full decision tree; gnubok_get_agent_briefing returns the company\'s accounting_method.',
'• Invoicing: gnubok_list_customers (or gnubok_create_customer) → gnubok_create_invoice → gnubok_send_invoice or gnubok_mark_invoice_as_sent → gnubok_mark_invoice_as_paid. Refund via gnubok_credit_invoice.',