Do not implement yet.
Two tracks: (A) harden v1 tools based on review, (B) add new tools. Track A first — it fixes the foundation before building on it.
- 1.1 SHA command fallback — detect
shasum -a 256vssha256sum, pick whichever exists - 1.2 Extra excludes via env var —
AUDITKIT_EXCLUDE="coverage .next .turbo"appended to the default exclude list. Parse space-separated dir names into-not -pathargs - 1.3 Add
--jsonflag — output[{"hash":"...","path":"..."},...] - 1.4 Add
--quietflag — suppress output, exit 0 if dir has files, exit 1 if empty
- 2.1 Replace grep-per-file loop with single-pass awk approach:
- Read FILE_A into awk, build path→hash map
- Read FILE_B into awk, build path→hash map
- Compare in O(n): emit ADDED/REMOVED/CHANGED
- Use a single awk script invocation, pipe both files with a separator marker
- 2.2 Add
--jsonflag — output{"added":[...],"removed":[...],"changed":[...]} - 2.3 Add
--quietflag — exit 0 if no changes, exit 1 if changes
- 3.1 Enable
dotglob+nullglobbefore the flattening mv to catch dotfiles - 3.2 Collision detection — before mv, check if any source filename already exists in OUT_DIR. If collision, fail with explicit error listing the conflicting filenames
- 3.3 Restore shell options (
shopt -u dotglob) after mv
- 4.1 Structured claim format (alongside existing freeform):
- [TODO 2.7] add file shared/sync-google.js→ parsed as ID=2.7, action=add, target=shared/sync-google.js- remove file popup/legacy.js→ parsed as action=remove, target=popup/legacy.js- must contain "sync.tombstone" in background.js→ parsed as action=contains, pattern=sync.tombstone, file=background.js- Freeform
- some claim textstill works as before (auto-numbered, heuristic matching)
- 4.2 Tighter token extraction:
- Only treat tokens as file patterns if they have a recognized extension (
.js,.py,.json,.html,.css,.ts,.sh,.md,.txt) or contain/ - Filter out common English words (stopwords > 3 chars: "with", "from", "that", "this", "into", etc.)
- Only treat tokens as file patterns if they have a recognized extension (
- 4.3 Strict evidence contract:
- PASS: must include at least one anchored hit (
path:line:snippet) or a file existence proof (file X found at path) - FAIL: must include contradiction evidence
- UNKNOWN: must include "closest hits" — top 3 grep matches sorted by relevance, even if below threshold
- PASS: must include at least one anchored hit (
- 4.4 Add
--git-diff [REF]flag:- Run
git diff --name-only REFfor changed files list - Run
git diff REFfor changed content - Search only within diff output, not full tree
- Default REF:
HEAD~1
- Run
- 4.5 Add
--quietflag — no output, exit 0 = all PASS, exit 1 = any FAIL, exit 2 = any UNKNOWN (no FAIL) - 4.6 Structured ID parsing from plan.md format — detect
**ID**in claims, store asclaim_idfield in output - 4.7 Update
--jsonto includeclaim_id, and evidence as{"file":"...","line":N,"snippet":"..."}objects
- 5.1 Read plan.md, extract unchecked TODO lines (
- [ ] **ID** description) - 5.2 Skip checked lines (
- [x] **ID** ...) — optionally report as SKIP - 5.3 Convert extracted TODOs into structured claims, pipe to verify-claims.py
- 5.4 Output per-ID verdict:
TODO 1.1 — PASS (manifest.json:3: "identity") TODO 2.7 — UNKNOWN (no matching diff) - 5.5 Pass-through flags:
--json,--quiet,--git-diff [REF]
- 6.1 Takes a directory arg, runs hash-tree (before snapshot), saves to temp
- 6.2 Prints "Make your changes, then press Enter" and waits
- 6.3 On Enter: hash-tree again (after), run diff-hash-trees, print results
- 6.4 Optional
--claims FILE— also runs verify-claims against the dir - 6.5 Optional
--plan FILE— also runs audit-plan against the dir - 6.6 Saves all artifacts to
/tmp/auditkit-session-TIMESTAMP/
- 7.1 Takes zip file + allowlist file as args
- 7.2 Unpack via unpack-zip-clean.sh into temp dir
- 7.3 Allowlist format:
!manifest.json= required (must exist)icons/*.png= allowed (may exist)# comment= ignored
- 7.4 Report three categories:
- UNEXPECTED: files not matching any allowlist pattern
- MISSING: required files (
!prefix) not found - SIZE_ANOMALY: any file > 500KB
- 7.5 Optional
--source-dir— hash both source and zip, diff them - 7.6
--jsonand--quietflags - 7.7 Create
templates/allowlist.txtwith common extension file patterns
- 8.1 Orchestrator script — runs the full audit pipeline in one command
- 8.2 Inputs:
--dir DIR(required), plus optional--plan FILE,--claims FILE,--zip FILE,--allowlist FILE,--before-hash FILE - 8.3 Steps:
- Hash-tree the dir (or use
--before-hashfor pre-existing snapshot) - Diff against before-hash if provided
- Run verify-claims if
--claimsgiven - Run audit-plan if
--plangiven - Run audit-zip if
--zip+--allowlistgiven
- Hash-tree the dir (or use
- 8.4 Write
AUDIT_REPORT.md— human-readable, all sections combined - 8.5 Write
AUDIT_REPORT.json— machine-readable, all results combined - 8.6 Gate summary at end of both files:
GATES: PASS: all claims verified FAIL: 2 unexpected files in zip PASS: no size anomalies - 8.7 Exit code: 0 = all gates pass, 1 = any gate fails
- 9.1 Create
templates/regression-scenarios.md:## Scenario: offline delete + online edit CHECK: "handleConflict" in sync-google.js CHECK: "tombstone" in background.js MANUAL: disable wifi, delete note, re-enable, verify sync - 9.2
scenario-runner.shparsesCHECK:lines, greps for pattern in file (or full dir if noin FILE) - 9.3 Output: FOUND/NOT_FOUND per check, scenario-level PASS (all found) / FAIL
- 9.4
--jsonand--quietflags
- 10.1 Add
_selftest/plan.mdwith 3 TODO items matching dir_b - 10.2 Add
_selftest/allowlist.txtwith patterns for dir_b - 10.3 Add
_selftest/scenarios.mdwith 2 CHECK lines for dir_b - 10.4 Create
_selftest/test.zipfrom dir_b contents - 10.5 Update run-selftest.sh:
- v1 hardening: verify sha fallback works, diff uses awk path, unpack handles dotfiles
- New tools: audit-plan, audit-zip, scenario-runner, audit-run
- Composability:
--jsonoutput parses as valid JSON,--quietexit codes correct - Gate output present and correct
- 11.1 Document all new tools with usage examples
- 11.2 Add "Automation Wiring" section:
- Pre-push hook example
- GitHub Actions snippet
- Define failure policy: FAIL = block, UNKNOWN = warn, PASS = proceed
- 11.3 Update "Typical Workflow" to include audit-plan, audit-zip, audit-run
Do not implement yet.