agentleFS
guerrilla2799guerrilla2799/ops-and-scale-os/skills/credit-and-cost-control/SKILL.md

credit-and-cost-control

Skill1 starsChanged 3 months agoMITView on GitHub

Use before any run that spends money, or when the user says "credits are burning", "our enrichment bill is too high", "how much will this cost", "forecast credits", "compare providers", "set a spend limit", "we blew through our credits". Runs the pre-flight, forecasts the run, compares providers on cost per usable record, and installs ceilings that fail closed. Writes workspace/data/cost-model.csv.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any enrichment, research, or agent run at scale

    line 12
  2. Distinctive:

    Every time. This is a hook-worthy checklist, meaning it should be enforced by the tool rather than remembered by a person.

    line 25
  3. Distinctive:

    Test on 5 rows. Inspect the output field by field.

    line 80
  4. Distinctive:

    Never run unbounded: Every run has a row cap

    line 107

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Credit and Cost Control

Forecast before spending, ceiling everything, and compare providers on cost per usable record rather than on price.

When to use

  • Before any enrichment, research, or agent run at scale
  • The bill arrived larger than expected
  • Choosing between providers
  • Setting up access for a new user, which is the highest-risk moment

Inputs

  • Needs from user: current balance, the run definition, provider pricing, and who has access to spending keys
  • Reads: workspace/data/waterfall-spec.csv

Workflow

1. Run the pre-flight

Every time. This is a hook-worthy checklist, meaning it should be enforced by the tool rather than remembered by a person.

[ ] Current balance checked and recorded
[ ] Estimated cost of this run computed and stated out loud
[ ] Free and known-field gate confirmed upstream of every paid column
[ ] Row cap set on this run
[ ] Enrich-only-empty-fields confirmed
[ ] Deep or exhaustive research modes off unless explicitly approved
[ ] Account-level ceiling configured and current
[ ] Test at 5 rows completed and inspected

If the estimate exceeds 20% of the remaining balance, stop and get a decision. Do not proceed and report afterward.

2. Forecast the run

Rows after the gate            n
× expected cost per row        from the waterfall arithmetic
= estimated spend              n
÷ expected usable records      n
= forecast cost per usable     n

State all five numbers before starting. A forecast you did not write down is not a forecast.

3. Compare providers correctly

Price per lookup is the wrong comparison. Build the table.

Provider AProvider B
Price per lookup
Match rate
Verification pass rate
Usable records per 1,000 attempted
Cost per usable record

A provider at 40% of the price with 30% of the match rate is more expensive per usable record and delivers a much smaller list. Run the table on your own segment, because match rates vary enormously by geography and company size.

4. Install ceilings that fail closed

Three layers, and the third is the only one that actually holds.

LayerWhere it livesStrength
Per-run capIn the skill or run definitionAdvisory. A determined instruction talks past it
Per-skill budgetWritten in the skill bodyAdvisory, but useful documentation
Account or key ceilingConfigured in the vendor accountHard. Fails closed

Per-user keys with per-user ceilings. A shared key with no per-user limit is one bad afternoon away from the month's budget. This is the single most common expensive mistake, and it is a five-minute fix.

5. The 5/25 pattern

Test on 5 rows. Inspect the output field by field. Then 25. Inspect again. Then release to the capped run.

This catches nearly everything a full run would have taught you, at a fraction of a percent of the cost. The failures it catches are usually a wrong field mapping, a provider returning the wrong entity, or a prompt producing plausible fabrication.

6. Monthly review, four numbers

1. Total spend by layer, and the trend
2. Cost per usable record by pipeline, three-month trend
3. Correction rate per deployed agent
4. Utilization: what fraction of what you bought was used

Number four kills more contracts than the other three combined. Seat-based and credit-based tools are routinely bought a tier above real consumption and nobody checks, because the invoice is a fixed line item. Check it sixty days before renewal.

Output

  • Writes: workspace/data/cost-model.csv, run log with actuals against forecast
  • Uses: templates/cost-model.csv
  • Prints: the pre-flight result, the five forecast numbers, actual against forecast after the run, and any ceiling changes made

Rules & quality bar

  • Pre-flight before every run that costs money
  • State the forecast before starting, and compare actual to forecast afterward
  • Cost per usable record is the only provider comparison that counts
  • Ceilings at the account level, per user. Advisory budgets do not hold
  • 5 rows, then 25, then release
  • Deep research modes default off
  • Never run unbounded. Every run has a row cap
  • Estimate over 20% of remaining balance means stop and ask

Related skills

  • Pairs with: enrichment-waterfall, agent-guardrails
  • Informs: martech-stack-audit at renewal
  • See also: docs/cost-model.md for the full arithmetic and failure modes

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.