CommunityProgramación y desarrollogithub.com

grahama1970/batch-quality

Validación previa al vuelo y puertas de calidad para operaciones de LLM por lotes. Prueba muestras con el LLM real antes de quemar tokens. Utiliza contratos SPARTA para consultas de validación en DuckDB. Se integra con task-monitor para puertas de calidad forzadas.

¿Qué es batch-quality?

Batch Quality Skill es una herramienta de validación previa al vuelo diseñada para evitar el desperdicio de tokens en operaciones por lotes con LLMs. A diferencia de simples verificaciones de existencia de archivos, esta habilidad ejecuta llamadas reales al LLM sobre un conjunto de muestras (usando scillm), valida la estructura de las respuestas JSON y aplica contratos SPARTA para consultas de validación en DuckDB. Se integra con task-monitor para imponer puertas de calidad obligatorias. Incluye comandos como `preflight` (prueba N muestras), `validate` (valida la salida del lote contra un contrato), `status` (estado actual) y `clear` (limpia el estado). Su principio clave es que "el pre-vuelo es barato; los lotes fallidos son caros", y además impone puertas de calidad durante la ejecución (bucle Pausa-Evalúa-Diagnostica-Ajusta-Reanuda) para operaciones largas como generación de QRA. Compatible con entornos Python (uv) y bases de datos DuckDB.

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

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Batch Quality Skill (Habilidad de Calidad por Lotes)

Previene llamadas desperdiciadas al LLM validando la calidad ANTES de ejecutar operaciones por lotes completas.

Lo Que Esta Habilidad Realmente Hace

A diferencia de simples verificaciones de existencia de archivos, esta habilidad:

  1. Ejecuta realmente el LLM en N muestras usando scillm
  2. Valida la estructura de la respuesta JSON (extractos, source_quality, etc.)
  3. Utiliza contratos SPARTA para consultas de validación en DuckDB
  4. Se integra con task-monitor para puertas de calidad forzadas

Inicio Rápido

cd .pi/skills/batch-quality

# Pre-vuelo: Probar 3 muestras con el LLM real
uv run python cli.py preflight \
    --stage 05 \
    --run-id run-recovery-verify \
    --samples 3

# Si el pre-vuelo pasa, ejecutar su lote
# ...operación por lotes...

# Validar: Verificar DuckDB contra el contrato
uv run python cli.py validate \
    --stage 05 \
    --run-id run-recovery-verify \
    --task-name "sparta-stage-05"

Comandos

preflight (pre-vuelo)

Prueba N muestras con el LLM real antes de ejecutar el lote completo.

uv run python cli.py preflight \
    --stage <nombre-de-etapa> \
    --run-id <id-de-ejecución-sparta> \
    --samples 3 \
    --prompt <archivo-de-prompt-opcional>

Lo que realmente hace:

  1. Carga el contrato SPARTA para la etapa (si existe)
  2. Verifica las variables de entorno (CHUTES_API_KEY, CHUTES_TEXT_MODEL)
  3. Se conecta a DuckDB para la ejecución
  4. Toma una muestra de N elementos de la cola de entrada
  5. Ejecuta cada muestra a través de scillm (llamada real al LLM)
  6. Valida la estructura de la respuesta JSON
  7. Requiere que más del 50% de las muestras pasen

Códigos de salida:

  • 0: APROBADO - seguro continuar
  • 1: FALLIDO - corregir problemas primero

validate (validar)

Valida la salida del lote usando contratos SPARTA.

uv run python cli.py validate \
    --stage <nombre-de-etapa> \
    --run-id <id-de-ejecución-sparta> \
    --task-name <nombre-del-monitor-de-tarea>

Lo que realmente hace:

  1. Carga el contrato SPARTA (ej., 05_extract_knowledge.json)
  2. Ejecuta todas las validation_queries del contrato contra DuckDB
  3. Verifica el resultado de cada consulta contra expected_min
  4. Notifica a task-monitor si pasó o falló

Ejemplo de contrato (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 (estado)

Verifica el estado actual del pre-vuelo (salida JSON).

uv run python cli.py status

clear (limpiar)

Limpia el estado del pre-vuelo (requiere un nuevo pre-vuelo).

uv run python cli.py clear

Integración con el Pipeline SPARTA

# 1. Registrar tarea con requisito de validación
uv run python .pi/skills/task-monitor/monitor.py register \
    --name "sparta-stage-05" \
    --require-validation

# 2. Ejecutar pre-vuelo (PRUEBA realmente el LLM)
uv run python .pi/skills/batch-quality/cli.py preflight \
    --stage 05 \
    --run-id run-recovery-verify \
    --samples 3

# 3. Ejecutar lote (solo si el pre-vuelo pasó)
uv run python -m sparta.pipeline_duckdb.05_extract_knowledge \
    --run-id run-recovery-verify

# 4. Validar usando consultas del contrato
uv run python .pi/skills/batch-quality/cli.py validate \
    --stage 05 \
    --run-id run-recovery-verify \
    --task-name "sparta-stage-05"

Configuración

Variables de entorno:

  • SPARTA_ROOT: Ruta al proyecto SPARTA (por defecto: ~/workspace/experiments/sparta)
  • CHUTES_API_KEY: Clave API para llamadas al LLM
  • CHUTES_API_BASE: URL base de la API (por defecto: https://llm.chutes.ai/v1)
  • CHUTES_TEXT_MODEL: ID del modelo para extracción de texto

Ubicación del contrato: $SPARTA_ROOT/tools/pipeline_gates/fixtures/D3-FEV/contracts/

Dependencias

  • typer - Framework CLI
  • duckdb - Consultas a bases de datos
  • scillm - Procesamiento por lotes del LLM (para pruebas reales de muestras)

Puertas de Calidad en Vuelo Obligatorias (NO NEGOCIABLES)

Para operaciones por lotes de larga duración (especialmente generación QRA, extracción, etc.), el pre-vuelo por sí solo es insuficiente. DEBE ejecutar puertas de calidad durante la ejecución, no solo antes.

El Bucle Pausa-Evalúa-Diagnostica-Ajusta-Reanuda

Después de cada N puntos de control del lote (ej., cada 5 lotes KNN / ~1000 QRAs):

  1. PAUSA — SIGSTOP el proceso de generación
  2. INSTANTÁNEA — Copia DuckDB para análisis sin conexión, SIGCONT inmediatamente
  3. MUESTRA — Muestra aleatoria estratificada (estratos de anclaje alto/medio/bajo)
  4. EVALÚA — Verifica cada muestra: anclaje de entidades, calidad de respuesta, razonamiento
  5. DIAGNOSTICA — Análisis de tendencias: ¿Está disminuyendo el anclaje? ¿Aumentan las fallas de entidades?
  6. AJUSTA — Si se degrada: ajusta prompt, umbrales de filtro, puntuaciones de relaciones
  7. REANUDA — Solo si la calidad cumple los umbrales
  8. DETENER + NOTIFICAR — Si la calidad está por debajo del mínimo, detener y notificar a un humano

Esto no es opcional. Un lote que se ejecuta hasta 100k QRAs sin puertas de calidad producirá basura que lleva más tiempo limpiar que regenerar correctamente.

Script de Puerta de Calidad QRA

# Vigilancia continua (se ejecuta junto con la generación QRA)
python $SPARTA_ROOT/scripts/qra_quality_gate.py watch \
    --run-id run-recovery-verify \
    --batch-interval 5 \
    --samples 10

# Evaluación única
python $SPARTA_ROOT/scripts/qra_quality_gate.py assess \
    --run-id run-recovery-verify \
    --samples 20

# Ver tendencia a través de puntos de control
python $SPARTA_ROOT/scripts/qra_quality_gate.py trend \
    --run-id run-recovery-verify

Umbrales de Calidad

MétricaAdvertenciaDetener
Anclaje Promedio< 0.65< 0.55
% Fallo de Entidad> 5%> 10%
Tasa de Fallo de Muestra> 15%> 30%
Disminución de Anclaje (por punto de control)> 0.05> 0.10

Por Qué Esto Importa

La puntuación de anclaje QRA se desvió de 0.74 a 0.62 durante horas sin intervención porque el vigilante era pasivo. Una puerta de calidad adecuada habría detectado la disminución en 0.70 → 0.65 y la habría diagnosticado (KNN agotando relaciones fáciles, desviación del prompt, etc.) en lugar de dejarla caer a 0.62.

Principio Clave

El pre-vuelo es barato. Los lotes fallidos son caros.

Probar 3 muestras cuesta ~$0.01 y toma 30 segundos. Ejecutar 1000 elementos con un prompt roto cuesta ~$3 y toma horas.

Las puertas en vuelo son más baratas que regenerar. Pausar durante 10 segundos cada 1000 QRAs para verificar la calidad no cuesta nada. Ejecutar 100k QRAS a ciegas y descubrir que la mitad no sirve cuesta todo.

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.

Skills relacionados