Track AI token usage and cost on every engineering task
A standing rule in the agent's instruction file (for example AGENTS.md) makes every engineering task log record tokens and cost, so you learn what AI help actually costs per task type.
Project Manager · Construction · AGENTS.md convention
Content updated · Tool links listed below; vendor features and pricing change, so confirm with the vendor
Short answer
Use Claude Code or OpenAI Codex (AGENTS.md rule): The agent logs its own token use and cost at the end of every task into a ledger. A standing rule in the agent's instruction file (for example AGENTS.md) makes every engineering task log record tokens and cost, so you learn what AI help actually costs per task type. A person still checks: totals against your provider's billing.
AI tie-in
Tool: Claude Code or OpenAI Codex (AGENTS.md rule)
The agent logs its own token use and cost at the end of every task into a ledger.
Prompt 1
At the end of this task, append to usage-ledger.csv: date, task name, model, input tokens, output tokens, cached tokens, estimated cost, and wall time.
Human check: Totals against your provider's billing.
The problem
Track AI token usage and cost on every engineering task. This is a common, time-consuming task for a project manager.
What this workflow does
A standing rule in the agent's instruction file (for example AGENTS.md) makes every engineering task log record tokens and cost, so you learn what AI help actually costs per task type.
How it works: AI drafts or analyzes. A person operates the tools, checks the work, and takes action.
Your checkpoint: Reported token counts vary by tool; reconcile with your provider's billing.
Before you start
- Access to the named tool; confirm license, version and cost with the vendor.
- A small, non-confidential sample to try the workflow on first.
- A qualified person to review the output before it is used.
Tools and access
Follow the steps
- Add a rule to the agent instructions: record input, output and cached tokens and model at the end of every task.
- Keep a simple ledger (task, date, model, tokens, cost, time saved estimate).
- Review monthly by task type.
- Drop or change models for tasks where cost exceeds value.
Try a small example
Replace the bracketed fields with your own project details. No tested sample run is published for this workflow yet.
Sample input
Fill in the bracketed [fields] in the text below with your project data.
Starter prompt
At the end of this task, append to usage-ledger.csv: date, task name, model, input tokens, output tokens, cached tokens, estimated cost, and wall time.
Expected output
Not published yet. Treat any output as a draft and check it against the source documents.
Check the result
- Every value, citation or quantity traces back to a source document.
- Missing information is marked as missing, not filled in.
Limits and recovery
- Reported token counts vary by tool; reconcile with your provider's billing.
- Check your organization’s data policy before sharing project files with third-party tools.
Stop or switch when: The source cannot be verified, permissions are missing, or the result contains unsupported facts.
Frequently asked questions
How does AI help with this?
Claude Code or OpenAI Codex (AGENTS.md rule): The agent logs its own token use and cost at the end of every task into a ledger. A person still checks: Totals against your provider's billing.
How do I track AI token usage and cost on every engineering task?
Add a rule to the agent instructions: record input, output and cached tokens and model at the end of every task. Keep a simple ledger (task, date, model, tokens, cost, time saved estimate). Review monthly by task type. The full step list is above.
Does this use an AI agent or regular software?
It is labeled AI assists: AI drafts or analyzes. A person operates the tools, checks the work, and takes action.
What tools do I need?
AGENTS.md convention. Confirm license, version and cost with the vendor, and try it on a small non-confidential sample first.
Has this workflow been tested?
Based on our own use · in regular use. Written from a workflow we built and use. Specifics are generalized and no project data is published. Not independently verified.
Evidence and maintenance
Written from a workflow we built and use. Specifics are generalized and no project data is published. Not independently verified.