ALAI Client Invoice Cycle — Runbook
ALAI Client Invoice Cycle — Runbook
Purpose:Version: Actionable1.0
commandCreated: sequence2026-07-28
forOwner: creating,John sending,(AI tracking,Director) and/ collectingAlem aBasic client(CEO)
invoice.Source Fullprocess: skillSkill workflow:invoice (~/.claude/skills/invoice/SKILL.md.), Skill financial-overview
Audience:Tooling: John (primary)invoice-generator.js, Finverge (accounting/Fiken sync)fiken.js, Alemcontacts.js, drafts.js, MCP mcp__email__email_send
1. Purpose
Defines how ALAI creates, sends, tracks, and reconciles client invoices — from client validation through payment reconciliation and overdue escalation. This is the ONLY approved path to send an invoice; invoices are never emailed ad hoc.
2. Tooling Map
| Purpose | Tool |
|---|---|
| Create/list/show/pay invoices | NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js |
| Client/contact lookup | NODE_PATH=~/system/node_modules node ~/system/tools/contacts.js |
| Email draft queue (approval gate) | NODE_PATH=~/system/node_modules node ~/system/tools/drafts.js |
| Accounting sync (Norway entity) | node ~/system/tools/fiken.js |
| Send invoice email | MCP mcp__email__email_send (account: "john") |
| PDF template | ~/system/templates/invoices/standard-invoice.html |
| Local invoice DB | ~/system/databases/invoices.db |
Invoice DB fields include: client, amount, currency (NOK/EUR/USD/BAM/RSD), vat_pct, vat_amount, total_amount, description, line_items, status (draft/sent/paid/overdue/cancelled), project_id, company, due_date, paid_at, payment_reference. Default payment terms: Last14 updated:days 2026-07-28.
3. The Cycle — Step by Step
Step 1 — Validate the Clientclient
NODE_PATH=~/system/node_modules node ~/system/tools/contacts.js search "<client>"
NODE_PATH=~/system/node_modules node ~/system/tools/contacts.js show <id>
- Client not in
contacts.db→-> ask Alem for details, addthem.the client. Neverfabricate.invent. - No email on file
→-> askAlem,Alem.doNevernot guess.invent. - Confirm org number
+and address are present (required on the invoice).
Step 2 — Collect Invoiceinvoice Data
data
InteractivelyGather (from Alem or existingcontract context):
- Client (name/company)
- Amount (excl. VAT)
- Currency (NOK, EUR, USD, BAM,
RSD)RSD — must match the contract currency, never mixed) - Description
(what'sof what is beingbilled)billed - Line items (optional, for
detail)itemized invoices) - Payment terms (default 14
days)days, check contract for custom terms) - Reference (project, contract, PO
number)number —mandatory, every invoice must tie to a contract or POmandatory)
Step 3 — Create the Invoice
invoice
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js create "<client>" <amount> <currency> "<description>"
Verify the tool output:
- Invoice ID assigned
- VAT (25%
MVA) auto-addedapplied for NOK invoices - Total = amount +
MVAVAT - Due date = today + payment terms
- PDF generated in
~/system/deliverables/invoices/
Step 4 — CEO Review (mandatory, no exceptions)
Showwith Alem (MANDATORY GATE)
Present before sending:sending — never sent without explicit sign-off:
Client:
{name}- Client,
Amount:Amount, {amount} {currency}
MVAVAT (25%):, {mva}Total, Total: {total} {currency}
Description: {description}Description, Due date: {date}date, Payment terms:terms
{days} days
Step 5 — Draft,Create Approve,email Send
draft (not a direct send)
NODE_PATH=~/system/node_modules node ~/system/tools/drafts.js list pending
- Invoice email = HIGH risk -> requires manual approval
- Reminder email = MEDIUM risk -> auto-approve + Slack notify
Step 6 — Send (after Alem approval)
NODE_PATH=~/system/node_modules node ~/system/tools/drafts.js approve <draft-id>
NODE_PATH=~/system/node_modules node ~/system/tools/drafts.js send <draft-id>
Or directly via MCP email if no draft was auto-created:MCP:
mcp__email__email_send(
account: "john", to: "<client-email>",
subject: "Invoice #<id> — ALAI Holding AS",
body: "<text>...", attachments: ["~/system/deliverables/invoices/INV-<id>.pdf"]
)
Step 67 — Fiken Syncsync (Norwegian entity accounting)
NODE_PATH=~/system/node_modules node ~/system/tools/fiken.js invoices sync
Run after every new invoice if the client has a Fiken contactcommands configured.available: status, companies, invoices list|show|sync, contacts list|show|sync, balances, transactions list [--days N], reconcile [--dry-run], dashboard [--json].
Step 78 — Payment reconciliation
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js reconcile <invoice-id> <payment-ref> [date]
# alias:
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js mark-paid <invoice-id> <payment-ref>
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js reconciliation-report
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js reconcile <invoice-id> <payment-ref> [date]
# alias:
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js mark-paid <invoice-id> <payment-ref>
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js reconciliation-report
Automated bank-transaction matching: node ~/system/tools/fiken.js reconcile [--dry-run].
Step 9 — Auto-Remindremind Schedule/ overdue escalation
TheHandled by the pipeline-watcher daemon runs(auto-remind), thethrottled reminderto cadencesync automatically:with Fiken at most every 6h before evaluating overdue status (MC #106151 — prevents nagging on invoices already paid):
| Friendly reminder | Norwegian)
|
| Firm reminder | notify)
|
Check status / send manually if needed:status:
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js list overdue
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.js remind <invoice-id>check-overdue
Step
Manual 8reminder: — Ongoing Tracking
NODE_PATH=~/system/node_modules node ~/system/tools/invoice-generator.jslistremindall<invoice-id>NODE_PATH=~/system/node_modules
node4.
~/system/tools/Full invoice-generator.jslistCommandunpaidReferenceNODE_PATH=~/system/node_modulescreatenode<client>~/system/tools/invoice-generator.js<amount> [currency] [description] Create invoice list [unpaid|paid|overdue|all] List invoices show <invoice-id> Show details pay <invoice-id> [date] Mark as paid (simple) reconcile <invoice-id> <payment-ref> [date] Mark paid with payment reference mark-paid <invoice-id> <payment-ref> Alias for reconcile (current date) reconciliation-report Payment reconciliation report pdf <invoice-id> Generate PDF send <invoice-id> [--to email] Generate email draft (MCP ready) remind <invoice-id> Generate reminder draft (MCP ready) check-overdueNODE_PATH=~/system/node_modulesFindnodeoverdue~/system/tools/invoice-generator.jsinvoices, generate reminders auto-remind [--dry-run] Auto-escalation reminder system dashboard Invoice dashboard statsNODE_PATH=~/system/node_modules node ~/system/tools/fiken.js dashboard
For a full financial position (bank balances + outstanding + pipeline forecast), use/financial-overview:NODE_PATH=~/system/node_modules node ~/system/tools/fiken.js balancesStatistics
5. Hard Rules
- VAT 25%
MVA on allfor NOKinvoices— applied automatically byinvoice-generator.js.addsAlwaysit automatically. Verifyverify thetotal before sending.total.CEOAlem approves every invoice —invoice =HIGH risk. Never send withoutAlem'san explicit "OK".- Client must exist in
contacts.db—beforenoany invoiceforisan unregistered contact.created.- Reference is mandatory — every invoice
tiesmust link to a contract orPO number.PO.- ALAI branding — PDF always uses the standard ALAI
invoicetemplate.- Currency
matchesmust match the contract — never mix NOK/EUREUR/otheronfor the same clientrelationship.engagement.- Anti-hallucination — never invent an amount. If Alem hasn't stated a figure, ask.
- Due date
is realistic— default 14 days; check the contract for custom terms.- Fiken sync — run after every new invoice
whereif Fiken is configured forthethatclient.entity.
References6. Worked ExampleAlem: "Fakturiši Wizard 25000 NOK za februar maintenance" 1. contacts.js search "Wizard" -> Wizard NUF, [email protected] 2. invoice-generator.js create "Wizard NUF" 25000 NOK "February 2026 maintenance and support" 3. Output: INV-0005, 25000 + 6250 VAT = 31250 NOK, due date = today+14 4. Present to Alem for review 5. Alem: "OK" 6. drafts.js approve + send 7. fiken.js invoices sync
7. Related Documents
- Skill:
invoice(~/.claude/skills/invoice/SKILL.md) FinancialSkill:financial-overviewskill:(~/.claude/skills/financial-overview/SKILL.md)InvoiceALAI-CLIENT-ONBOARDING.mdDB:— contract terms originate here (Phase 4/5)- ALAI-CLIENT-INCIDENT-RESPONSE.md
Document Location: ~/
system/databases/invoices.dbALAI/processes/runbooks/ALAI-CLIENT-INVOICE-CYCLE.md
~/system/templates/invoices/standard-invoice.html