root bfe1ea9d1c
Some checks failed
lakehouse/auditor 13 blocking issues: cloud: claim not backed — "Verified end-to-end:"
auditor: alternate Kimi K2.6 ↔ Haiku 4.5, drop Opus from auto-promotion
Operator can't sustain Opus's ~$0.30/audit on the daemon. New
strategy:

- Even-numbered audits per PR use kimi-k2.6 via ollama_cloud
  (effectively free under the Ollama Pro flat subscription)
- Odd-numbered audits use claude-haiku-4-5 via opencode/Zen
  (~$0.04/audit)
- Frontier models (Opus, GPT-5.5-pro, Gemini 3.1-pro) are NOT in
  auto-promotion. Operator hands distilled findings to a frontier
  model manually when a load-bearing decision needs it.

Mirrors the lakehouse playbook-memory pattern: cheap models do the
volume, the validated subset compounds, only the compounded bundle
gets handed to a frontier model. Same logic at the auditor layer.

Audit-index derivation: count of existing kimi_verdicts files for
the PR. So if the dir has 4 verdicts for PR #11 already, the 5th
audit is index 4 (even) → Kimi, the 6th is index 5 (odd) → Haiku.
Across an active PR's lifetime the audits naturally interleave the
two lineages.

Cost projection at observed cadence (5-10 pushes/day):
- Old (Haiku default + Opus auto on big diffs): $1-3/day
- New (Kimi/Haiku alternating, no Opus): $0.10-0.40/day
- $31.68 budget lasts: ~3 months instead of ~10 days

Override knobs:
  LH_AUDITOR_KIMI_MODEL=<X>           pins to model X (no alternation)
  LH_AUDITOR_KIMI_PROVIDER=<P>        provider for default model
  LH_AUDITOR_KIMI_ALT_MODEL=<X>       sets the odd-index alternate
  LH_AUDITOR_KIMI_ALT_PROVIDER=<P>    provider for alternate

The OPUS_THRESHOLD env knobs from the prior auto-promotion commit
are now no-ops (unset, no longer referenced).

Verification:
  bun build auditor/checks/kimi_architect.ts   compiles
  systemctl restart lakehouse-auditor          active
  systemctl show env                           Haiku pin removed,
                                               Kimi default + cap=3 set

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 07:26:31 -05:00
..

Lakehouse Claim Auditor

A Bun sub-agent that watches open PRs on Gitea, reads the ship-claims in commit messages and PR bodies, and hard-blocks merges when the code doesn't back the claim.

Rationale: when "compiles + one curl works" gets called "phase shipped," placeholder code accumulates. This auditor runs every 90s, fetches each open PR, and subjects it to four checks:

  1. Static diff — grep/parse looking for placeholder patterns
  2. Dynamic — runs the never-before-executed hybrid test fixture
  3. Cloud inference — asks gpt-oss:120b via /v1/chat to identify gaps in the diff
  4. KB query — looks up data/_kb/ + observer for prior failure patterns on similar claims

Verdict is assembled, posted to Gitea as:

  • A failing commit status (hard block — branch protection prevents merge)
  • A review comment explaining every finding

Run manually

cd /home/profit/lakehouse
bun run auditor/index.ts

Defaults: polls every 90s, stops on auditor.paused file present.

State

  • data/_auditor/state.json — last-audited head SHA per PR
  • data/_auditor/verdicts/{pr}-{sha}.json — per-run verdict record
  • data/_kb/audit_lessons.jsonl — one row per block/warn finding, path-agnostic signature for dedup. Tailed by kb_query on each audit to surface recurring patterns (2+ distinct PRs with same signature → info, 3-4 → warn, 5+ → block). This is how the auditor learns.
  • data/_kb/scrum_reviews.jsonl — scrum-master per-file reviews. If a file in the current PR has been scrum-reviewed, kb_query surfaces the review as a finding with the accepted model and attempt count.

Where YOU edit

auditor/policy.ts — the verdict assembler. Controls which findings block vs warn vs inform. All other code is mechanical: fetching, running checks, posting to Gitea.

Hard-block mechanism

  1. Commit status is posted as failure with context lakehouse/auditor
  2. If main branch protection requires lakehouse/auditor status to pass, Gitea prevents merge
  3. When code is fixed and re-audit passes, status flips to success, merge unblocks

Enable branch protection (one-time, via Gitea UI or API):

  • POST /repos/profit/lakehouse/branch_protections
  • {"branch_name": "main", "required_status_checks": {"contexts": ["lakehouse/auditor"]}}