Files
PaperClipAI/docs/guides
Michael NguyenandClaude Fable 5.2 455462812a docs: describe budgets as they work today (#22784)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Operators control what agents spend with budgets, and the public
docs explain how budgets work
> - The budget docs were last changed in March 2026. The budget system
was rebuilt after that
> - The docs still describe a fixed 80% alert and a 100% auto-pause on
company and agent budgets only
> - The docs do not say that budgets count billed dollars only.
Subscription usage is recorded at zero cents, so a budget never stops an
agent that runs on a subscription
> - An operator who reads the docs today can believe that a budget
protects a subscription. It does not
> - This pull request updates the cost and budget docs to match the code
on `master`. It changes docs only
> - The benefit is that operators and agent developers get a correct
description of what a budget does and does not do

## Linked Issues or Issue Description

Refs #8856

Related open pull requests. None of them changes these docs: #22745,
#13379, #11511, #17356.

**Issue type**

Outdated content.

**Where is the issue?**

- `docs/guides/board-operator/costs-and-budgets.md`
- `docs/api/costs.md`
- The budget lines in `docs/guides/board-operator/managing-agents.md`,
`docs/guides/board-operator/dashboard.md`,
`docs/guides/board-operator/creating-a-company.md`,
`docs/start/core-concepts.md`, and
`docs/guides/agent-developer/cost-reporting.md`

**What's wrong?**

The docs describe the budget system as it was in March 2026. Seven
points are wrong or missing. Each point is listed under Verification
with the code that supports the new text.

**Suggested fix**

Update the docs to describe the behavior of the code on `master`. Do not
change product code.

## What Changed

- `costs-and-budgets.md`: added a warning at the top. A budget counts
billed dollars only, and it does not stop an agent that runs on a
subscription.
- `costs-and-budgets.md`: added the three budget scopes (company, agent,
project) and their windows.
- `costs-and-budgets.md`: added the budget settings and their defaults
(`warnPercent`, `notifyEnabled`, `hardStopEnabled`, `reservationCents`,
`unpricedUsagePolicy`).
- `costs-and-budgets.md`: rewrote the enforcement section. It now
describes the warning, the hard stop, the budget incident, the two ways
to resolve it, and the monthly reset.
- `costs-and-budgets.md`: added where to set a budget in the UI and with
the API. It says that the older `budgetMonthlyCents` fields still work.
- `costs-and-budgets.md`: added sections for the reserve per run, usage
with no reliable price, the Subscriptions card, and provider quota
windows.
- `docs/api/costs.md`: added the budget overview, budget policy, and
incident routes, the report period parameters, and the subscription and
quota routes. Added the required `occurredAt` field to the cost event
example.
- The five related guides: corrected the lines that repeated the old
claims. Each one now links to the main guide.

## Verification

I read the code on `origin/master` at commit `0731cd3afc`. I did not run
the product. Each point below has the file and line that supports the
new text.

1. **Budgets exist for a company, an agent, and a project. A project
budget uses a lifetime window.** Corrected.
   - Scopes: `packages/shared/src/constants.ts:1050`
- The service uses `lifetime` for a project when no window is given:
`server/src/services/budgets.ts:862`
- The project page sends `lifetime`:
`ui/src/pages/ProjectDetail.tsx:658`
- The request validator fills in `calendar_month_utc` when the field is
absent: `packages/shared/src/validators/budget.ts:14`. The docs
therefore tell API callers to send `"windowKind": "lifetime"` for a
project.
2. **Budgets count dollars only. Subscription usage is recorded at zero
cents.** Corrected, and stated at the top of the guide.
- The only metric is `billed_cents`:
`packages/shared/src/constants.ts:1053`
- `subscription_included` is billed at 0:
`server/src/services/heartbeat/run-state.ts:522`
- Budget exposure counts it as 0:
`server/src/services/budget-exposure.ts:33`
- Claude Code and Codex report subscription billing when no API key is
set: `packages/adapters/claude-local/src/server/execute.ts:176`,
`packages/adapters/codex-local/src/server/execute.ts:204`
3. **The warning threshold and the hard stop are settings.** Corrected.
- Defaults `warnPercent` 80 and `hardStopEnabled` true:
`server/src/services/budgets.ts:912`
- `warnPercent` accepts 1 to 99:
`packages/shared/src/validators/budget.ts:17`
- The UI shows `warnPercent` but has no control to change it:
`ui/src/components/BudgetPolicyCard.tsx:108`
4. **At the hard stop, new work is refused, running work is told to
stop, and an incident opens.** Corrected.
- Incident, pause, and cancellation:
`server/src/services/budgets.ts:770`
   - New work is refused: `server/src/services/budgets.ts:825`
- Raise the budget or keep the scope paused:
`server/src/services/budgets.ts:1045`
- **A new month does resume a paused scope.** The budget worker
reconciles held monthly scopes at the end of the UTC month:
`server/src/services/budgets.ts:1329` and
`server/src/services/budget-enforcement-worker.ts:44`. With no spend in
the new window, the service closes the incident and removes the budget
pause: `server/src/services/budgets.ts:716`. This also applies after
"Keep paused". A manual pause stays. A lifetime budget does not reset.
5. **The "focus on critical tasks" text at 80% is skill guidance.**
Corrected.
   - The text is in the skill: `skills/paperclip/SKILL.md:681`
- At the soft threshold the server opens an incident and writes an
activity entry. It sends nothing to the agent:
`server/src/services/budgets.ts:750`
6. **Where to set a budget.** Corrected.
- Routes: `server/src/routes/costs.ts:347` (overview), `:355`
(policies), `:367` (resolve incident), `:399` (company), `:418` (agent)
- UI: `ui/src/pages/audit/audit-navigation.ts:11`,
`ui/src/pages/Costs.tsx:745`, `ui/src/pages/ProjectDetail.tsx:876`,
`ui/src/pages/AgentDetail.production.tsx:186`
- **The old fields still work.** `PATCH /companies/:id` with
`budgetMonthlyCents`: `server/src/services/companies.ts:430`. `PATCH
/agents/:id` with `budgetMonthlyCents`:
`server/src/services/agent-configuration.ts:196`. On an agent the change
needs a board user: `server/src/routes/agents.ts:5637`.
7. **Reserve per run, unpriced-usage policy, Subscriptions, and quota
windows.** Added.
- Reserve per run: `ui/src/components/BudgetPolicyCard.tsx:61`,
`server/src/services/budget-reservations.ts:160`
   - Unpriced-usage policy: `server/src/services/budgets.ts:244`
- Subscriptions: `server/src/routes/costs.ts:114`,
`ui/src/components/SubscriptionCostCard.tsx:113`
- Quota windows: `server/src/routes/costs.ts:332`,
`packages/shared/src/types/quota.ts:2`

Could not confirm:

- I took the UI paths from the code and from
`maps/feature-map/budgets-costs.md`. I did not check them on a running
instance.
- I found no UI control that creates the first company budget. The
Budgets page edits a company budget that exists. The docs say to create
it with the API. A maintainer who knows the UI should confirm this
sentence.
- I did not find an adapter that reports `subscription_overage`. The
docs say only that such usage counts for its reported cost.

Checks:

- `pnpm verify` exits with code 2. It reports a global CI input change
(`docs/api/costs.md`), so required CI supplies the broad coverage. I did
not run the full local suite.
- I checked every internal link and anchor in the seven changed files
with a script. All resolve.
- `git diff --check` reports no whitespace errors.
- No test reads the changed files.

## Risks

Low risk. The change is docs only.

- A wrong sentence in these docs can mislead an operator about spend.
The two sentences that most need a maintainer's review are the monthly
resume (point 4) and the company budget in the UI (see "Could not
confirm").
- `docs/guides/board-operator/delegation.md` still says that a CEO above
80% of its budget focuses on critical tasks. That is the skill guidance
from point 5. I did not change that file.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Claude Fable 5.2 (Anthropic), model ID `claude-fable-5-2`, in Claude
Code. Extended thinking and tool use (file read, search, shell, `gh`).
The model read the code, wrote the docs, and wrote this description.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass — *docs only. No test reads
these files. `pnpm verify` asks for required CI*
- [ ] I have added or updated tests where applicable — *not applicable.
Docs only*
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green — *pending on this PR*
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups —
*pending on this PR*
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 14:25:24 -08:00
..