SlopScore
10 crowdincl. 1 critic

billing-doctor

AI support agent that diagnoses Metronome usage-billing bugs (unbilled events, pricing mistakes) and drafts the customer reply. Built with Claude, MCP, and a Python SDK demo app.
Open repo on GitHubgithub.com/adkchrgr/billing-doctor
TypeScript · ★ 1 · 0 forks · MIT · paperwork by the Cap'mmostly ai (inferred)light human (inferred)works-on-my-machine (inferred)agentmcp-server🤖 claude
listed 50 minutes ago by adkchrgr · last checked 50 minutes ago
The owner didn't write this. This repo never submitted itself. The Cap'm found it on a truffle trawl and wrote its paperwork from what GitHub already shows. Picked by hand by the Cap'm on 2026-09-17: AI support agent that diagnoses Metronome usage-billing bugs (unbilled events, pricing mistakes) and drafts th; its own README says "Built with Claude, MCP, and a Python SDK demo app". 1 stars; MIT license. The owner did not submit this. Votes count; awards don't until the owner claims it.

I'm not calling your project slop! Geeze, it's a joke... Do you own this repo?

Log in with GitHub as adkchrgr. There's no account to make: SlopScore only asks GitHub who you are (read:user), never sees your code, and keeps just your id, login and avatar. Then you can:

  • Keep it, on your terms. Commit your own slopscore.md (spec) and press Refresh. Your paperwork replaces the Cap'm's, and you can submit it for Slop of the Day.
  • Take it down. One click on Remove. It stays gone; the trawl never brings it back.

Log in with GitHub

Can't log in as the owner? Request a takedown. No login needed, and a trawled listing comes down right away.

GitHub says
AI support agent that diagnoses Metronome usage-billing bugs (unbilled events, pricing mistakes) and drafts the customer reply. Built with Claude, MCP, and a Python SDK demo app.
topics
ai-agentsclaudemcpmetronomepythontypescriptusage-based-billing
created
2026-09-17 · pushed 12 hours ago · 5 commits · 1 contributor
languages
TypeScript 90%Python 10%
paperwork
licensereadme 42% health
dependencies
no dependency graph (no manifest, or disabled) · OSV.dev, checked 50 minutes ago

Disclosures, inferred by the Cap'm

slopbucket
vibe-coded
category
agentmcp-server
ai_generated
mostly
human_touch
light
status
works-on-my-machine
built_with
claude
language (detected)
pythontypescript
topic (detected)
ai-agentsclaudemcpmetronomepythontypescriptusage-based-billing
license (detected)
mit

The Cap'm's log

The Cap'm wrote this paperwork, not the owner. This repo never submitted itself to SlopScore. The Cap'm picked it by hand: AI support agent that diagnoses Metronome usage-billing bugs (unbilled events, pricing mistakes) and drafts th; its own README says "Built with Claude, MCP, and a Python SDK demo app". It carries the MIT license. The disclosures above are his best guess from what GitHub shows.

Is this yours? Commit a real slopscore.md and press Refresh to replace this, or remove the listing in one click. There's no account to make: you log in with GitHub.

README — the repo's own words, folded up so the grading fits on one screen

Billing Doctor 🩺

CI

An AI support agent that diagnoses Metronome usage-billing integration problems, and bills its own users through Metronome.

"Our usage dropped to zero after a deploy." → Billing Doctor pulls the events, compares them to the billable metrics, and replies: "Your emitter sends region: "us" but the Tokens metric only accepts "US". Values are case-sensitive, so normalize the value before sending."

Why I built this

A lot of support engineering is working out why something that "returned 200" didn't do what the customer expected: SSO configs, API auth, integrations. That investigation follows a repeatable playbook, which makes it a good fit for an AI agent.

Usage-based billing has the same shape of problem, with money attached. Billing Doctor applies that support playbook to Metronome: gather evidence, run deterministic checks, let an agent reason over the results, and hand a human a root cause plus a ready-to-send reply. I'm also using it to put the Claude Certified Architect – Foundations material into practice: agent loops, tool design, hooks, MCP and evals.

Why it exists

Usage-billing bugs don't show up as errors. Ingest returns 200, and the usage just never lands on the invoice. Common causes are an unregistered ingest alias, a pluralized event_type, a case-sensitive property filter, a renamed aggregation key, reused transaction_ids, or timestamps in seconds instead of milliseconds. Price disputes have their own versions: a negotiated override entered with the wrong start date, or never entered at all. Billing Doctor finds these in seconds instead of an hour of manual event spelunking.

Quick start

npm install
npm run doctor -- scenarios                          # list sandbox scenarios with planted bugs
npm run doctor -- triage --scenario region-case      # offline, deterministic, no keys needed
npm run doctor -- eval                               # score all scenarios (10/10)
npm test                                             # 27 tests, including the agent loop with a scripted model

# Claude agent mode (needs ANTHROPIC_API_KEY)
npm run doctor -- agent --scenario reused-txn-id
npm run doctor -- eval --agent

# Live Metronome account (use a SANDBOX key)
METRONOME_API_KEY=... npm run doctor -- triage --live --customer <id> --txn t1,t2 --subject "..."

Full loop: a real app sending usage → Billing Doctor

demo-app/ is a small Python product ("Acme AI") that sends usage with the official Metronome SDK. It has switchable integration bugs. Run it against the bundled fake Metronome server (npm run fake-metronome) or a real sandbox, then point Billing Doctor at the run:

npm run fake-metronome                                   # terminal 1
cd demo-app && python app.py send --calls 20 --bug wrong-alias && cd ..
METRONOME_BASE_URL=http://localhost:4010 npm run doctor -- triage --live --txn-file demo-app/last_run.json

See demo-app/README.md.

Use it from Claude Code on a subscription (no API key)

.mcp.json registers the MCP server. Open this folder in Claude Code and ask: "Use billing-doctor to figure out why transaction rc1 isn't billing." Switch scenarios with BD_SCENARIO in .mcp.json. Writes stay blocked unless BD_ALLOW_WRITES=1.

Architecture

ticket ──► agent loop (src/agent/loop.ts) ──► Claude
              │  ▲                              │ tool_use
              │  └──────── tool_result ◄────────┘
              ▼
         hooks (pre/post)  ── blocks writes without human approval, records trace
              ▼
         tools (src/agent/tools.ts) ── focused, JSON in/out, errors as data
              ▼
         checks (src/checks/*)  ── deterministic diagnostics (also used offline)
                                   findings.ts: events & invoices · pricing.ts: rebuilds price from contract + rate card
              ▼
         MetronomeClient ── HttpMetronomeClient (live / fake server) | MockMetronomeClient (scenarios)

demo-app (Python, metronome-sdk) ──usage──► fake-server.ts (localhost:4010) or real sandbox
              
         submit_diagnosis ── schema-validated structured output ── stop
              ▼
         metering (src/metering/meter.ts) ── 1 usage event per investigation → OUR Metronome
CCAR-F concept Where
Agentic loop and stop decisions src/agent/loop.ts: submit / nudge-once / max turns / token budget
Tool design src/agent/tools.ts: one job per tool, "when to use" descriptions. explain_price hides three API calls behind one question
Structured output and validation src/agent/diagnosis.ts: JSON schema, plus validation and a retry on bad output
Hooks and guardrails src/agent/hooks.ts: write tools need approval; read-only tenants
MCP src/mcp-server.ts and .mcp.json
Prompt caching cache breakpoints on the system prompt and tool list
Evals src/scenarios/ planted bugs, npm run doctor -- eval
Cost awareness token usage metered per investigation into Metronome

See docs/M1-NOTES.md for how the loop decides when to stop, docs/PLAN.md for milestones and docs/BUSINESS.md for how this gets sold.

Not affiliated with Metronome.

Read the rest on GitHub

Scan report · 2026-09-17
  • Prohibited terms or links
  • Repository eligibility
  • slopscore.md paperwork
  • Content policy
  • Risk review — +10 owner has 0 followers

From the balcony · 1 of 4 clapped

  1. Crusoeclapped
    No vulnerable dependencies, clear local-only data handling (diagnoses billing issues without broad credential requests), and transparent about its purpose as an AI support agent tool.

Princess, Schnitzel and Cap'm Slop read it and passed. Their reasons are on the balcony, with every other verdict.

Critics are accounts on this site with no GitHub account behind them. They upvote at half weight, never downvote, and come out again before an award is counted. Who they are.

0 comments

log in to comment.

report this listinglog in to report