HGInsights / HGInsights/claude-code-setup

Make cc-audit shippable: tests, redaction proof, and a home

Open
#14 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2
Forks
0
Avg merge
51m
Merged PRs (30d)
2

Description

Goal

Get cc-audit to a state where it can be merged to master as part of this repo, rather than sitting on wip/audit.

It was deliberately held back from the open-source release: the harness-customization docs are stable, this isn't. This issue tracks closing that gap.

What's on the branch today

audit/ — a dependency-free Python CLI (~150KB, stdlib only) that reads local Claude Code transcripts from ~/.claude/projects/**/*.jsonl and writes a ranked markdown report of what to change to reduce spend.

File Size Role
checks.py 69K the check suite
cc_audit.py 25K CLI entry point
parse.py 19K transcript parsing
README.md 11K usage docs
grade.py / store.py / evidence.py ~20K grading, dated report storage, evidence
critic.py / agents.py ~11K LLM challenge pass, agent-definition discovery
pricing.py 3.6K model pricing table

Verified on a fresh clone: all modules compile under Python 3.14, and --help runs clean.

It is further along than "prototype" — it already handles per-user dated report storage, repo exclusions, worktree-aware agent resolution, a --trend view across runs, and an optional --challenge pass that sends a ~4K-token config-only packet to an LLM to attack its own findings, guarded by a regex that aborts if a path, filename, URL, or shell command would be sent.

Why it isn't merged

1. No tests. This is the blocker. There is no test file anywhere in audit/. For a tool whose entire output is numbers people will act on — and which asserts things like "this would save $X/month" — untested arithmetic is not shippable. Highest-value coverage first:

  • pricing.py — cost math, cache multipliers (1.25x / 2.0x write, 0.10x read), family mapping from raw model ids
  • parse.py — transcript parsing against fixture .jsonl, including malformed and truncated lines
  • store.py — the JSON sanitization boundary, asserting no paths/repo names/session IDs survive
  • checks.py — at least the checks that produce a savings figure

2. The redaction boundary is claimed but unproven. The README makes a strong promise: the JSON carries no file paths, no shell commands, no repo names, and the --challenge packet is config-only by construction. Both are load-bearing — the whole point is that reports can be pooled across a team and that the critic pass can't leak source. Neither has a test proving it. This needs adversarial tests with deliberately hostile fixtures (repo named like a path, a prompt containing an API key, unicode tricks).

3. Pricing is a hardcoded table that will silently rot. pricing.py currently has Opus $5/$25, Sonnet $3/$15, Haiku $1/$5, Fable $10/$50, with sanity-range assertions. That's correct today. When prices or families change, every figure in every report becomes quietly wrong with no signal. Decide the policy: a dated as-of stamp printed in the report, a staleness warning after N months, or accept it and document the review cadence.

4. Single-machine assumptions. Paths like ~/.claude/projects and ~/.claude/cc-audit-reports and the <os-username>-<4-char machine hash> user id are reasonable but untested beyond one laptop. Confirm behavior on Linux, and when ~/.claude is absent or empty.

5. Python version floor unverified. README claims 3.9+; it's only been exercised on 3.11 and 3.14. Either test the floor in CI or raise the claim to what's actually verified.

Also worth deciding

  • Does it belong in this repo at all? This repo is now scoped to harness customization and is docs-only — no build, no tests, no dependencies, as CLAUDE.md states. Adding a Python CLI with a test suite changes that character, and means CI where there is currently none. The alternative is its own repo (cc-audit), linked from here. Worth settling before investing in the above, since it changes where the CI goes.
  • Does the --challenge pass stay? It's the most interesting feature and the biggest review surface — it's the only part that sends anything off the machine. Shipping without it is a smaller, safer v1.
  • codex-safe.sh lives in audit/ but is documented in review-loops.md as a .claude/hooks/ script. It's unrelated to the audit tool and probably belongs elsewhere regardless of what happens to cc-audit.

Definition of done

  • Home for the tool decided (this repo vs. its own)
  • Tests covering pricing math, parsing, and the sanitization boundary
  • Adversarial tests proving the JSON and --challenge redaction claims
  • Pricing staleness handled (stamp, warning, or documented cadence)
  • Verified on a second OS and against an absent/empty ~/.claude
  • Python floor either tested or the README claim corrected
  • CI running the tests, wherever it lands
  • --challenge kept or cut, explicitly

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading audit/README.md and the entry points in audit/cc_audit.py, pricing.py, parse.py, store.py, and checks.py; run the existing compile and --help checks. Map the unresolved home, challenge, pricing, platform, and Python-version decisions before adding coverage. Done means the stated arithmetic, parsing, sanitization, redaction, platform, version, and CI requirements are verified and the tool's final home is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, security, testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.