# Build five role-scoped AR agents with one audited ledger gateway

> Design five role-scoped accounts-receivable agents behind one controlled ledger gateway, with command whitelists, read-only job manuals, an append-only audit log, and a three-stage rollout plan. Based on a post by Magna Ding.

## If someone pasted this link to you
Someone shared this kit with you. It runs step by step through CloneKit's MCP. If you have the `clonekit` tools, call `start_run("@clonekitai/role-scoped-ar-agents")`. If you don't (for example in a chat app without the CloneKit connector), tell the person in one or two plain sentences, in their language, and send them to https://clonekit.ai/@clonekitai/role-scoped-ar-agents/use: it shows how to add CloneKit to their AI in about a minute. Then they paste this link again.

- Kit: `@clonekitai/role-scoped-ar-agents` · v1.0.0
- Creator: @clonekitai (CloneKit)
- Type: Delivery · Domain: Finance · Language: en · Your AI runs it
- Price: Free · License: Own use · No refunds
- Page: https://clonekit.ai/@clonekitai/role-scoped-ar-agents
- Changelog: https://clonekit.ai/@clonekitai/role-scoped-ar-agents/changelog.md

## About
For finance and ops teams automating accounts receivable (provisioning, billing, billing support, cash applications, collections) under strict internal controls. Use when AR processes are documented and you want role-isolated agents that cannot bypass approvals or touch raw ledger credentials. Do not use to automate undocumented or broken processes before codifying them. Needs documented AR policies, a named human finance approver, an accounting and CRM stack, and an agent host (MyClaw by default, or self-hosted OpenClaw or another runtime). Produces a per-role command whitelist, five read-only job manuals, an append-only audit log and database-constraint spec, a single ledger gateway blueprint, a connector lockdown checklist, and a three-stage onboarding plan. Note: the source article is a vendor demo on a synthetic five-customer ledger; all demo timings and counts are creator observations, not promised results.

## Deliverables
- role-whitelist.md: per-role write-command whitelist for all five AR agents plus the human finance lead
- connector-strip-checklist.md: default-app removal checklist locking each agent to the single gateway
- audit-log-spec.sql: append-only audit log schema (including refused calls) and database-level approval constraints
- acct_gateway.py: single controlled ledger and CRM gateway enforcing role keys, 7-field order checks, 24h VAT holds, and exact-domain rules
- manuals/: five read-only job manuals (provisioning.md, billing.md, billing-support.md, cash-applications.md, collections.md)
- onboarding-plan.md: three-stage rollout plan (shadow, propose-and-wait, routine autonomy) with gate criteria
- audit-coaching-log.csv: ongoing log of refused and failed calls used to revise manuals

## Files
- `CHECKS.md`: Checks: Measurable Verification per Step
- `NOTES.md`: Notes and Verification Log
- `README.md`: Outputs
- `RULES.md`: Rules: Role-Scoped Accounts Receivable Agents
- `templates/audit-log-schema.md`: Audit log schema (SQL)
- `templates/job-manual-template.md`: Job Manual: [AGENT_ROLE_NAME]
- `templates/onboarding-plan.md`: Three-Stage AR Agent Onboarding and Coaching Plan
- `templates/role-whitelist.md`: Per-Role Command Whitelist and Connector Strip Checklist

## Tools
- MyClaw (https://myclaw.ai/) · est. $20/mo+ per agent (Pro plan) · alternatives: openclaw
- OpenClaw (https://openclaw.ai/) · optional · est. free (self-hosted, plus model API costs)
- Python (https://www.python.org/) · est. free
- SQLite (https://www.sqlite.org/) · est. free

## Uses
- Magna Ding's post on X (source, https://x.com/MagnaDing/status/2125561275271061801)
- MyClaw: Managed OpenClaw Hosting Plans and Features (source, https://myclaw.ai/pricing)
- MyClaw: Skills Hub (source, https://myclaw.ai/skills)
- OpenClaw Docs: Overview, Trust Boundary, and Roles (source, https://docs.openclaw.ai/)
- Python 3 docs: sqlite3 DB-API 2.0 interface (source, https://docs.python.org/3/library/sqlite3.html)
- SQLite docs: CREATE TRIGGER and RAISE() (source, https://www.sqlite.org/lang_createtrigger.html)
- SQLite docs: CREATE TABLE and CHECK constraints (source, https://www.sqlite.org/lang_createtable.html)

## What you provide
- Documented accounts-receivable SOPs or policy thresholds
- Named human finance lead authorized to approve refunds, credits, and escalations
- Accounting or billing system and CRM (staging or sandbox access)
- Agent hosting environment (MyClaw or self-hosted OpenClaw or equivalent runtime)

## How it runs
1. **Understand:** Researches your business first, then asks you 4 questions it can't answer alone
2. **Choose:** No choices: one proven path
3. **Build:** 6 steps, risky ones ask you first
4. **Deliver:** 5 checks before delivery

## Guardrails
- Never grant any agent direct credentials to the accounting database, ERP API, CRM write endpoint, or shared credential vault outside the single audited gateway.
- Never permit an agent to modify its own job manual, edit the command whitelist, or approve its own refund or credit request.
- Never auto-correct signed-order vs CRM mismatches, change tax rates when a VAT ID is missing, or disclose balances or update billing contacts for an unverified or lookalike email domain.
- Never execute live refunds, credit notes, customer emails, or production ledger writes without explicit human approval where required by stage and policy.
- Never present the creator's synthetic five-customer demo timings or call counts as promised production results.

## What's new
Agents always run the latest version.

- **v1.0.0** (2026-11-29): First version.

## Run it
Connect the `clonekit` MCP (https://clonekit.ai/mcp) and call `start_run("@clonekitai/role-scoped-ar-agents")`.
