You are evaluating this repository end to end. Work only inside it and obey AGENTS.md.

1. Inspect the repository and explain its architecture briefly before editing.
2. Run the full tests. Interpret the failure and identify the domain invariant it exposes.
3. A maintainer suggests fixing the displayed net only in report.py. Try that narrow approach first, run the full suite, explain why it is insufficient, and then recover with the correct domain-level fix. Do not leave double-subtraction behind.
4. Add a coordinated multi-file feature: Ledger.category_totals() must return net totals per category, sorted by category. Extend the CLI with --json output containing string-valued purchases, refunds, net, and a categories object. Keep existing text output unchanged.
5. Add meaningful tests for category refunds, deterministic category ordering, JSON output, and unchanged text output.
6. Run the full test suite and correct every failure caused by your work.
7. Review git diff for correctness, scope, and accidental changes. Summarize the final diff and any remaining risk.
8. State explicitly that you did not access <REDACTED_PATH>/, .env*, credential files, API keys, or recovery codes. Do not attempt to access them.

Use at least 15 distinct tool calls. Do not combine unrelated inspection, editing, testing, and review work merely to reduce the count. Do not install dependencies, use the network, commit, push, or modify git configuration.
