CommunityCodierung & Entwicklunggithub.com

grahama1970/batch-quality

Vorab-Prüfungen und Qualitätstore für Batch-LLM-Operationen. Testet tatsächlich Stichproben durch das LLM, bevor Tokens verbrannt werden. Nutzt SPARTA-Verträge für DuckDB-Validierungsabfragen. Integriert sich in task-monitor für erzwungene Qualitätstore.

Was ist batch-quality?

Der 'batch-quality'-Skill verhindert verschwendete LLM-Aufrufe, indem er die Qualität VOR der Ausführung kompletter Batch-Operationen validiert. Im Gegensatz zu einfachen Dateiprüfungen führt er tatsächlich LLM-Aufrufe auf N Stichproben durch, validiert die JSON-Antwortstruktur und nutzt SPARTA-Verträge für Datenbank-Validierungsabfragen in DuckDB. Der Skill integriert sich in das task-monitor-System, das unabhängig von der Pipeline Qualitätstore erzwingt. Er eignet sich besonders für Pipelines der Wissensextraktion, QRA-Generierung und andere Batch-Operationen, bei denen Ausführungsfehler teuer sind. Der Skill erzwingt einen Pause-Assess-Diagnose-Tweak-Resume-Zyklus während langer Batches, mit Warn- und Stopp-Schwellenwerten für Metriken wie Grounding-Qualität und Fehlerquoten.

Funktioniert mit~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/grahama1970/agent-skills/tree/main/skills/batch-quality

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Batch Quality Skill

Verhindern Sie verschwendete LLM-Aufrufe, indem Sie die Qualität VOR der Ausführung kompletter Batch-Operationen validieren.

Was dieser Skill tatsächlich tut

Im Gegensatz zu einfachen Dateiprüfungen macht dieser Skill:

  1. Führt tatsächlich LLM auf N Stichproben aus mit scillm
  2. Validiert JSON-Antwortstruktur (excerpts, source_quality, etc.)
  3. Nutzt SPARTA-Verträge für DuckDB-Validierungsabfragen
  4. Integriert sich in task-monitor für erzwungene Qualitätstore

Kurzanleitung

cd .pi/skills/batch-quality

# Preflight: 3 Stichproben durch tatsächliches LLM testen
uv run python cli.py preflight \
    --stage 05 \
    --run-id run-recovery-verify \
    --samples 3

# Wenn Preflight bestanden ist, Batch ausführen
# ...Batch-Operation...

# Validieren: DuckDB gegen Vertrag prüfen
uv run python cli.py validate \
    --stage 05 \
    --run-id run-recovery-verify \
    --task-name "sparta-stage-05"

Befehle

preflight

Testet N Stichproben durch tatsächliches LLM, bevor der vollständige Batch ausgeführt wird.

uv run python cli.py preflight \
    --stage <stage-name> \
    --run-id <sparta-run-id> \
    --samples 3 \
    --prompt <optional-prompt-file>

Was es tatsächlich tut:

  1. Lädt SPARTA-Vertrag für die Stufe (falls vorhanden)
  2. Prüft Umgebungsvariablen (CHUTES_API_KEY, CHUTES_TEXT_MODEL)
  3. Stellt Verbindung zu DuckDB für den Run her
  4. Zieht N Elemente aus der Eingabewarteschlange
  5. Führt jedes Sample durch scillm (tatsächlicher LLM-Aufruf)
  6. Validiert JSON-Antwortstruktur
  7. Erfordert, dass 50 %+ der Samples bestehen

Exit-Codes:

  • 0: BESTANDEN – sicher fortzufahren
  • 1: FEHLGESCHLAGEN – zuerst Probleme beheben

validate

Validiert Batch-Ausgabe mit SPARTA-Verträgen.

uv run python cli.py validate \
    --stage <stage-name> \
    --run-id <sparta-run-id> \
    --task-name <task-monitor-name>

Was es tatsächlich tut:

  1. Lädt SPARTA-Vertrag (z.B. 05_extract_knowledge.json)
  2. Führt alle validation_queries aus dem Vertrag gegen DuckDB aus
  3. Prüft jedes Abfrageergebnis gegen expected_min
  4. Benachrichtigt task-monitor über Bestehen/Fehlschlagen

Vertragsbeispiel (05_extract_knowledge.json):

{
  "validation_queries": [
    {"name": "url_knowledge_count", "query": "SELECT COUNT(*) FROM url_knowledge", "expected_min": 10},
    {"name": "urls_processed", "query": "SELECT COUNT(*) FROM url_extraction_log WHERE ok = true", "expected_min": 5}
  ]
}

status

Zeigt aktuellen Preflight-Status an (JSON-Ausgabe).

uv run python cli.py status

clear

Löscht den Preflight-Status (erfordert neuen Preflight).

uv run python cli.py clear

SPARTA-Pipeline-Integration

# 1. Aufgabe mit Validierungsanforderung registrieren
uv run python .pi/skills/task-monitor/monitor.py register \
    --name "sparta-stage-05" \
    --require-validation

# 2. Preflight ausführen (TESTET TATSÄCHLICH LLM)
uv run python .pi/skills/batch-quality/cli.py preflight \
    --stage 05 \
    --run-id run-recovery-verify \
    --samples 3

# 3. Batch ausführen (nur wenn Preflight bestanden)
uv run python -m sparta.pipeline_duckdb.05_extract_knowledge \
    --run-id run-recovery-verify

# 4. Mit Vertragsabfragen validieren
uv run python .pi/skills/batch-quality/cli.py validate \
    --stage 05 \
    --run-id run-recovery-verify \
    --task-name "sparta-stage-05"

Konfiguration

Umgebungsvariablen:

  • SPARTA_ROOT: Pfad zum SPARTA-Projekt (Standard: ~/workspace/experiments/sparta)
  • CHUTES_API_KEY: API-Schlüssel für LLM-Aufrufe
  • CHUTES_API_BASE: API-Basis-URL (Standard: https://llm.chutes.ai/v1)
  • CHUTES_TEXT_MODEL: Modell-ID für Textextraktion

Vertragsverzeichnis: $SPARTA_ROOT/tools/pipeline_gates/fixtures/D3-FEV/contracts/

Abhängigkeiten

  • typer – CLI-Framework
  • duckdb – Datenbankabfragen
  • scillm – LLM-Batch-Verarbeitung (für tatsächliche Stichprobentests)

Zwingende Qualitätstore während der Ausführung (NICHT VERHANDELBAR)

Bei langlebigen Batch-Operationen (insbesondere QRA-Generierung, Extraktion usw.) reicht ein Preflight allein nicht aus. Sie MÜSSEN Qualitätstore während der Ausführung durchführen, nicht nur davor.

Der Pause-Assess-Diagnose-Tweak-Resume-Zyklus

Nach jedem N Batch-Checkpoints (z.B. alle 5 KNN-Batches / ~1000 QRAs):

  1. PAUSE – SIGSTOP des Generierungsprozesses
  2. SNAPSHOT – DuckDB für Offline-Analyse kopieren, SIGCONT sofort
  3. SAMPLE – Stratifizierte Zufallsstichprobe (hohe/mittlere/niedrige Grundierungsebenen)
  4. ASSESS – Jede Stichprobe prüfen: Entity-Grundierung, Antwortqualität, Begründung
  5. DIAGNOSE – Trendanalyse: Nimmt die Grundierung ab? Steigen Entity-Fehler?
  6. TWEAK – Bei Verschlechterung: Prompt anpassen, Filters chwellen, Beziehungswerte ändern
  7. RESUME – Nur fortsetzen, wenn Qualität Schwellenwerte erfüllt
  8. STOP + BENACHRICHTIGEN – Wenn Qualität unter Mindestwert fällt, anhalten und Menschen benachrichtigen

Dies ist nicht optional. Ein Batch, der 100k QRAs ohne Qualitätstore ausführt, produziert Müll, dessen Bereinigung länger dauert als die korrekte Regenerierung.

QRA-Qualitätstor-Skript

# Kontinuierlicher Watchdog (läuft parallel zur QRA-Generierung)
python $SPARTA_ROOT/scripts/qra_quality_gate.py watch \
    --run-id run-recovery-verify \
    --batch-interval 5 \
    --samples 10

# Einmalige Bewertung
python $SPARTA_ROOT/scripts/qra_quality_gate.py assess \
    --run-id run-recovery-verify \
    --samples 20

# Trend über Checkpoints anzeigen
python $SPARTA_ROOT/scripts/qra_quality_gate.py trend \
    --run-id run-recovery-verify

Qualitätsschwellenwerte

MetrikWarnungStopp
Durchschnittliche Grundierung< 0.65< 0.55
Entity-Fehler %> 5 %> 10 %
Stichproben-Fehlerrate> 15 %> 30 %
Grundierungsabnahme (pro Checkpoint)> 0.05> 0.10

Warum das wichtig ist

Der QRA-Grundierungswert driftete über Stunden von 0,74 auf 0,62, ohne dass eingegriffen wurde, weil der Watchdog passiv war. Ein ordentliches Qualitätstor hätte den Rückgang bei 0,70 → 0,65 erkannt und diagnostiziert (KNN erschöpft einfache Beziehungen, Prompt-Drift usw.), anstatt ihn bis auf 0,62 abrutschen zu lassen.

Schlüsselprinzip

Preflight ist billig. Fehlgeschlagene Batches sind teuer.

3 Stichproben zu testen kostet ~0,01 $ und dauert 30 Sekunden. 1000 Elemente mit einem defekten Prompt auszuführen kostet ~3 $ und dauert Stunden.

Qualitätstore während der Ausführung sind billiger als Regenerierung. Alle 1000 QRAs für 10 Sekunden anzuhalten, um die Qualität zu überprüfen, kostet nichts. Blind 100k QRAs auszuführen und festzustellen, dass die Hälfte unbrauchbar ist, kostet alles.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

grahama1970/acceptance-contract

Turn a client brief, zip bundle, directory, or single requirements file into a typed acceptance-contract bundle with extracted requirements, acceptance checks, open questions, an immutable-goal draft, and a create-report-backed decision report. Use when users say acceptance contract, brief to requirements, freeze the goal, create immutable goal, amend immutable goal, build a Battle requirements bundle, or extract requirements from this bundle.

grahama1970/agent-ecosystem

Canonical map and shared contracts for the agent-governance ecosystem: the pi.receipt_envelope.v1 boundary envelope, the component graph, and the rules for which component owns which schema. Use when wiring a skill or extension into the shared receipt world, when asking how shame, triage-error, tau, ask, project-watchdog, ops-herdr, ponytail, and Memory fit together, or when validating an envelope.

grahama1970/agentic-evals

Agentic evaluation of skills using multi-trial fixtures, deterministic command assertions, trajectory checks, safety constraints, and evidence-backed readiness scoring. Use when users ask for agentic evals, multi-trial skill evaluation, skill trajectory validation, or readiness scoring for a skill workflow.

grahama1970/agent-inbox

File-based inter-agent messaging with headless dispatch. Check inbox, send bugs/requests to other projects, automatically spawn headless agents to fix bugs, and track progress via task-monitor.

grahama1970/agents-registry

Generate and query the centralized agent identity registry. Scans .pi/agents/*/AGENTS.md, parses frontmatter, outputs agents-registry.json and optionally syncs to /memory for semantic search.

grahama1970/agent-status

Artifact-driven status surfaces for long-running project-agent work. Maintains status.json, events.jsonl, proof manifests, and a stale-aware STATUS.html so humans can tell where the agent is, what passed, what is still unproven, and what decision or action is next — without dashboard theater.

grahama1970/align

Round-based context alignment before execution. Use when the human, project agent, WebGPT, scillm, ask, dogpile, memory, or project-knowledge may each hold different facts about a task; especially before ambiguous design, infographic, product workflow, high-stakes implementation, plan-iterate, project-infographic, or multi-review work.

grahama1970/analytics

Flexible data science analytics for any dataset. Auto-discovers schema, recommends charts, exports to create-figure. Works with JSONL, JSON, CSV from any source.

grahama1970/analyze-chatterbox-emotions

Evaluate generated Chatterbox voice files as voice-quality artifacts: affect match, arousal/valence proxies, pause placement, intelligibility inputs, clipping, loudness, and discontinuity flags. Use when reviewing Chatterbox emotional tags, pauses, Turbo/base affect delivery, Persona Dream utterance renders, or whether generated speech matches an intended product-facing affect.

grahama1970/analyze-elf

Reverse-engineer features from ELF binaries. Extracts CLI commands, state machines, protocols, Zod schemas, and data models. Automatically generates a /create-walkthrough prosecution brief with Mermaid diagrams. Uses /treesitter for AST analysis of bundled JS/TS source.

grahama1970/animation-vocabulary

Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the bouncy thing when a popover opens" → Pop in; "the iOS rubber-band scroll" → Rubber-banding). Use when the user asks "what's it called when…", or describes a motion effect without knowing its name and wants the right word to prompt an AI or designer with. For naming an effect, not designing or building one.

grahama1970/anonymize-data

Anonymize supported CSV, JSON, UTF-8 text, and SQLite files using an explicit policy through the oai-trial project. Use for anonymize data, pseudonymize exports, redact policy literals, or discover and explicitly approve fuzzy name aliases. The skill is a thin CLI/Docker interface, not another engine.

grahama1970/anvil

Heavy-duty "No-Vibes" debugging and hardening orchestrator. Use this for complex, stubborn bugs where `review-code` has failed, or for "Red Teaming" (hardening) a codebase. Runs multiple agents in parallel (Thunderdome) using git worktree isolation.

grahama1970/apple-design

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

grahama1970/argue

Multi-persona structured debate orchestrator. Personas research via /dogpile, consult colleagues via /ask, and argue toward nuanced synthesis on complex questions.

grahama1970/arxiv

Search arXiv for papers and extract knowledge into memory. Use `search` to find papers, `learn` to extract knowledge.

grahama1970/ask

Use when the user asks to query project memory, ask an oracle, use supported browser-backed reviewers, run Tau roundtable/single-handler workflows, ask Pi-native subagents from within Pi, run persona/deep-review workflows, generate image prompts, check OS/project health through composed skills, or run an ask DAG. This skill is the executable /ask runtime; do not replace it with an informal subagent, plain web search, or hand-written review; inside Pi, explicit Pi-native subagent targets are routed through the pi-subagents tool as an Ask target type.

grahama1970/assess

Step back and critically reassess project state. Use when asked to "assess", "step back", "fresh eyes", "check alignment", "sanity check", "health check", "prune documentation", or "evaluate what's working". Offers documentation pruning and doc-code alignment analysis. Offer to run after major changes (don't auto-run).

grahama1970/assistant

Shared GPT + classifier inference gateway for persona monitor tasks. Routes validation and classification through a 4-tier cascade: heuristic → classifier → local GPT → scillm.

grahama1970/assistant-lab

Self-improvement workbench for /assistant. All the tools needed to diagnose, train, evaluate, and promote models in a continuous loop. The "warm pond" where /assistant evolves its own inference stack.

Verwandte Skills