{ Prompts4All }

Audit what agent sessions cost

Agent Audit

Audit where the tokens and the time of my agent sessions go in this project, and show me how to get the same results for less.

  • The period: {period, for example the last 14 days}
  • The prices, if you want the cost in money: {price per million tokens for each model}
  1. Find the data: the token counts in the session transcripts, a usage command of the harness, or a billing export. Say which source you use and what it does not include. If there is no record, stop and tell me how to get one.

  2. Totals. Give the number of sessions, the input tokens, the input tokens that came from the cache, and the output tokens. Calculate the cost only from the prices that I gave. Do not guess a price.

  3. Where it goes. Divide the total by:

    • the fixed cost of a session (the context before the first message), multiplied by the number of sessions;
    • the ten most expensive sessions, with a short label for the purpose of each;
    • tool results for each tool: which tools returned the most text (large file reads, test output, logs, web pages);
    • repeated work: the same file read many times, and the same command run again with the same result;
    • the model: which model did which type of work.
  4. Cache. If the record shows cache use, give the part of the input that came from the cache, and list the sessions where that part is low.

  5. Results. Mark the sessions that gave no result that I used: stopped early, or reverted afterward.

  6. Propose changes, each with the saving that you estimate and the calculation:

    • a smaller fixed context;
    • quiet output for commands that print much, and reads of a part of a file;
    • a cheaper model for mechanical work (search, format, simple edits), and the strongest model for plans and reviews;
    • a new session in place of a very long one;
    • subagents for searches, so that their output stays out of the main context.

Rules:

  • Count with a script. Do not read the transcripts into your context, because that costs tokens too.
  • Do not put session content in the report. A short label for each session is sufficient.
  • Do not estimate a number that you can count.

Output: a table of the division in step 3, with tokens and percent. Then the five changes that save the most, each with its estimate. Then one line: the cost of this audit.