- 18 agent specs across Software, Support, Marketing, Cross-cutting (orchestrator + 7 software + 5 support + 3 cross-cutting + leads-finder) - 8 reusable skills (handoff, pr-review, dokploy-deploy, campaign-structure, content-calendar, ticket-triage, license-lifecycle, invoice-draft) - 3 JSON schemas: handoff, deliverable, approval - Policies: autonomy levels, tool risk classification, compliance (DSGVO/GoBD/UWG) - routing.toml: model tiers T1/T2/T3 + provider config (PII gating) - Rust workspace (5 crates, all compile + 16 tests pass): - aos-mcp: tool registry + risk tagging - aos-policy: autonomy levels, budget enforcement, approval requests - aos-license: ed25519 license issue/verify (real crypto + CLI binary) - aos-ledger: integer-cents money math, gapless numbering, VAT, audit chain - aos-sync: frontmatter validator (18/18 specs pass), CLI binary - CLAUDE.md entry point with architecture overview + roadmap
4.6 KiB
4.6 KiB
name, version, applies_to, risk
| name | version | applies_to | risk | ||
|---|---|---|---|---|---|
| invoice-draft | 1.0.0 |
|
medium |
Invoice Draft
When to use
When a task requires drafting an invoice for a client. Drafting the record is medium-risk; sending it is a separate, always-approved high-risk step.
Steps
- Read the task: client id, billing period, contract (rates, VAT rule, currency, reverse-charge applicability, payment terms).
- Pull billable time + expenses from AOS via
aos-mcpreads: approved timesheets (not raw drafts), receipts already attached and approved, any pass-through costs (hosting, ad spend, license fees billed on). - Confirm the contract's VAT rule: standard rate, reverse-charge (EU B2B
with valid VAT ID), Kleinunternehmer, or Drittland. If unclear →
blocked. Never guess a VAT rate. - Compute via the
aos-ledgerRust crate. Net / VAT / gross and rounding (2 dp, banker's per §14 UStG) are calculated by the crate — never by arithmetic in the prompt. The crate assigns the next gapless invoice number from the client's fiscal-year sequence; the agent never picks, reuses, or skips a number. - Assemble line items: description (DE / EN per client language), quantity, unit, unit price (net), per-line VAT rate.
- Validate against the contract: rates match the price list, expense
markups match, currency matches. Any mismatch →
blocked. - Write the invoice record to AOS via the crate's
commitcall withstatus: draft. The crate owns the write (gapless numbering, hash chain on the audit log). - Produce the E-Rechnung attachment: the crate renders ZUGFeRD
(XRechnung-compliant) XML in the PDF. Validate the XML against the
XRechnung schema; on failure →
blocked, do not send. - Attach all expense receipts and time-entry refs to the invoice record (GoBD — Belegführung).
- Surface the draft to
accounting-leadfor review (rates, period, VAT rule, substantiation, E-Rechnung validity). - On lead approval, emit an
ApprovalRequest(schemas/approval.json):action: send_invoice,risk: high,rationale(number, client, period, gross, due),diff_summary("Send invoice for to <client.email>; due "),payloadwith invoice_id/number/net/vat/gross/currency/due_at/delivery_channel,estimated_cost_eur: 0. - Pause. The policy crate will not execute
aos:send_invoicewithout an approved matching approval. The agent does not send.
Inputs
- A task with
task_id, client id, billing period. - The client's contract (rates, VAT rule, currency, payment terms, reverse-charge status, VAT ID).
- Approved time entries and expenses in AOS for the period.
- The client's
language.deliverablessetting for the invoice language.
Outputs
An AgentDeliverable (schemas/deliverable.json) with:
status:needs_review|needs_approval|blockeddeliverables[]: AOS invoice record ref (aos_record, status: draft), the E-Rechnung PDF/XML ref (file), receipt attachments list, the invoice number assigned by the crate.risks[]: rate inferred, expense unverified, reverse-charge without recent VIES check, rounding edge case, contract mismatch flagged rather than blocked.cost: tokens only (sending is a separate gate).
Guard rails / compliance
- GoBD — gapless numbering: the
aos-ledgercrate assigns every number. The agent never invents, picks, reuses, or skips one. - GoBD — no deletion: a wrong invoice is storniert (reversed) with an audit entry citing the original number. Drafts never sent are retained.
- GoBD — Belegführung: every line references a substantiating record (time entry / receipt / contract clause).
- Never do money math in the prompt. Net / VAT / gross, currency conversion, and rounding happen in the crate.
- E-Rechnung compliance: ZUGFeRD / XRechnung XML must validate before send. Invalid XML blocks.
- Never send without an approved
ApprovalRequestof actionsend_invoice. - Reverse-charge: only applied when the client's VAT ID is valid and current — re-check with VIES at draft time; record the check timestamp.
- Retention: invoices 8 years, business letters 6 years (crate-enforced). Currency conversion uses the ECB reference rate for the invoice date; the crate records the rate used.
References
schemas/approval.json—send_invoiceactionschemas/deliverable.json—draftoutput formatpolicies/compliance.md— GoBD, E-Rechnung, DSGVOpolicies/tool-risk.md—aos:send_invoiceisrisk: highcrates/aos-ledger— money math, gapless numbering, hash chain, storno