Community编程与开发github.com

assistant-lab

用于 /assistant 的自我提升工作台。包含诊断、训练、评估和持续循环推进模型所需的所有工具。这是 /assistant 进化其自身推理栈的“温暖池塘”。

assistant-lab 是什么?

assistant-lab 是一个专为 AI 代理(如 /assistant)设计的自我改进工具集。它的核心是一个持续的闭环:首先诊断任务性能问题,然后基于影子模式(shadow mode)下教师模型(如 scillm)生成的标签数据来决定下一步行动。根据学生模型与教师模型的一致性率,它会自动选择不同的策略:高于 90% 则直接提升(promote)模型;80-90% 则使用 /prompt-lab 重新设计提示词;70-80% 则重新训练模型;低于 70% 则进行更激进的架构调整。该技能支持多种模型类型(GPT、分类器、回归器),并且可以无缝集成本地训练(RTX A5000)和远程训练(RunPod Flash,针对 3B-13B 参数的大模型)。它与 /monitor-skills 协作,后者负责监控所有技能的健康状况,而 assistant-lab 则专注于修复 /assistant 自身的模型。它提供了清晰的 CLI 和 Python API,用于诊断、训练、评估、提升和获取教师标签,并内置了严格的数据量检查(如 GPT 模型至少需要 1000 个样本)和成本预算门控,确保训练过程高效可控。

兼容平台~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/grahama1970/agent-skills/tree/main/skills/assistant-lab

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

assistant-lab 是做什么的?

针对 /assistant 的自我提升工作台。这是 实验室, /assistant 在此诊断问题、训练新模型、评估它们, 并将通过的模型提升到生产注册表中。

请不要与 /monitor-skills 混淆,后者是观测性 守护进程,负责监控所有技能的健康状况、漂移和同步问题。 /assistant-lab 特指自我改进工具箱。

自我提升循环

/monitor-skills 检测问题    ← 观测性
    ↓
/assistant-lab 诊断根本原因 ← 本技能
    ↓
影子模式:教师 (scillm) 将标签写入 shadow.jsonl
    ↓
ModelFactory.auto_improve(task)
    ├─ 读取影子一致性率
    ├─ >= 90%: 提升 → 更新 model_registry.json
    ├─ 80-90%: 平台期 → /prompt-lab 重新设计
    ├─ 70-80%: 重新训练 → /create-gpt 或 /create-classifier
    └─ < 70%: 激进重新训练 + 架构更改
    ↓
/gpt-lab 基准测试 或 /classifier-lab 评估
    ↓ 通过? → 提升到生产注册表
    ↓
/assistant 在推理时使用改进后的模型

可用工具

工具用途使用时机
/create-gpt训练 QLoRA/SFT/GRPO GPT(层级 1.5)一致性 < 80% 或尚无模型
/create-classifier训练 DistilBERT/sklearn 分类器(层级 0.5)文本分类任务
/create-regressor训练 sklearn/XGB 回归器(层级 0.75)连续值预测任务
RunPod Flash通过 Python SDK 进行无服务器 GPU 训练(7B–70B)模型太大,本地 A5000 无法承载 — 取代了用于训练的 /ops-runpod
/gpt-lab将 GPT 与教师基线进行基准测试训练之后、提升之前
/classifier-lab评估分类器的准确率/F1 值分类器训练之后
/prompt-lab检测到平台期时重新设计提示词一致性卡在 80-90%
/scillm层级 2 教师 — 创建标签始终使用(教师是真实依据)

用法

CLI

# 诊断任务需要什么
./run.sh diagnose --task stress-test-grader

# 完整的自主改进循环
./run.sh auto-improve --task stress-test-grader

# 训练特定模型类型
./run.sh train --task stress-test-grader --type gpt
./run.sh train --task sparta-ambiguity --type classifier

# 评估模型
./run.sh evaluate --task stress-test-grader --type gpt

# 提升通过的模型(禁用影子模式)
./run.sh promote --task stress-test-grader --type gpt

# 从 shadow.jsonl 中收集教师标签
./run.sh harvest --task stress-test-grader --since 24h

# 显示所有任务的影子一致性统计
./run.sh status

# 运行完整的自测(在测试数据上执行 训练→评估→提升 循环)
./run.sh self-test

Python API

from assistant_lab import AssistantLab

lab = AssistantLab()

# 诊断:这个任务需要什么?
diagnosis = lab.diagnose("stress-test-grader")
# → {"has_gpt": False, "has_classifier": False, "shadow_agreement": 0.0, ...}

# 自动改进:决策 + 训练 + 评估 + 提升
result = lab.auto_improve("stress-test-grader")
# → {"actions": ["trained gpt", "evaluated (passing=True)", "promoted"]}

# 手动步骤
lab.train("stress-test-grader", model_type="gpt")
lab.evaluate("stress-test-grader", model_type="gpt")
lab.promote("stress-test-grader", model_type="gpt")

模型工厂

核心引擎是 ModelFactory(来自 /common/model_factory.py)。 /assistant-lab 通过 CLI + 诊断 + 报告对其进行了封装。

影子一致性阈值

一致性率行动理由
>= 90%提升学生模型能可靠匹配教师
80-90%/prompt-lab 重新设计平台期 — 提示词可能是瓶颈天花板
70-80%重新训练,使用更多标签更多数据很可能有帮助
< 70%激进重新训练更改架构或基座模型
< 50样本等待数据不足,无法决策

最低训练数据量(不可协商)

请勿在数据不足时调用 /create-gpt train 或 /create-classifier train。

模型类型最低样本数规则
GPT (QLoRA SFT)总计 1,000+< 1,000 → 停留在层级 2 教师
分类器 (sklearn/SetFit)每类 200n_samples / n_classes >= 200
回归器总计 100+标准 sklearn 指导原则

实例:sparta_stress_grading 基于 246 个样本训练,一致性仅 33.7%。 这是因为模型训练过早,浪费了 4 个月的影子标签。 先收集,准备充分后再训练。

训练数据流程

层级 2 教师(通过角色使用 scillm)
    ↓ 标签保存到 shadow.jsonl
    ↓
/assistant-lab harvest --task X
    ↓ 提取 输入+输出 对
    ↓
/create-gpt train --task X --data labels.jsonl
    ↓ 在 Qwen2.5-1.5B 上执行 QLoRA(默认)
    ↓
/gpt-lab benchmark --task X
    ↓ 比较学生模型与教师模型
    ↓
/assistant-lab promote --task X --type gpt
    ↓ 更新 model_registry.json,shadow_mode=false

远程训练(RunPod Flash)

对于本地 RTX A5000(24GB VRAM,使用 LoRA 时最大约 1.7B)无法承载的模型, assistant-lab 使用 RunPod Flash — 无服务器的 Python SDK,无需 Docker, 无需 SSH,也无需 rsync 开销。Flash 取代了 /ops-runpod 用于所有训练路径。 /ops-runpod 仅保留用于持久推理服务器。

何时使用 Flash

模型大小本地 A5000是否需要 FlashGPU
0.5–1.7BLoRA 可容纳否./run.sh train (本地)
3–7B无法容纳是B200(首选)或 H200
8–13B不可能是B200(首选)或 H200

Flash GPU 类型

GPU显存备注
B200192 GB HBM3e最快;在 MoE / 长上下文场景中比 H200 快 3–5 倍
H200192 GB HBM3可用性良好;可靠的基准线

计费:按秒付费,每个作业最长执行 7 天。

Flash 成本估算(近似)

模型大小GPU预计训练时间预计成本
7B QLoRA SFTB200~1–2 小时~$5–15
7B QLoRA SFTH200~2–3 小时~$8–20
13B QLoRA SFTB200~2–4 小时~$10–25
13B QLoRA SFTH200~3–5 小时~$12–30

命令

# 步骤 1:始终先估算成本
./run.sh estimate --task taxonomy-assessor --target flash --gpu B200 --size 7B

# 步骤 2:在 Flash B200 上训练(需要 --confirm 以保证安全)
./run.sh train --task taxonomy-assessor --target flash --gpu B200 --size 7B --confirm

# 在 Flash H200 上训练
./run.sh train --task taxonomy-assessor --target flash --gpu H200 --size 13B --confirm

# 使用自定义基座模型
./run.sh train --task taxonomy-assessor --target flash --gpu B200 --size 8B \
  --base-model meta-llama/Llama-3.1-8B-Instruct --confirm

# 使用不同量化级别
./run.sh train --task qra-validator --target flash --gpu B200 --size 7B \
  --quantize Q5_K_M --confirm

Flash 训练流程

estimate --target flash --gpu B200 --size 7B
    ↓
train --target flash --gpu B200 --confirm
    ├─ 1. 成本估算 + 预算门控
    ├─ 2. 提交 Flash 无服务器作业(Python SDK — 无需 Docker/SSH)
    ├─ 3. 数据集流式传输到 Flash 工作节点
    ├─ 4. 在 B200/H200 (192GB 显存) 上运行 QLoRA / SFT 训练
    ├─ 5. 将模型权重拉取到 /mnt/storage12tb/models/
    ├─ 6. create-gpt export --quantize Q4_K_M (GGUF)
    └─ 7. 评估 + 如果通过则自动提升

安全门控

  • 预算上限:--max-cost(默认 $15.00)如果估算超过限制则阻止训练
  • 确认:必须传递 --confirm — 否则仅显示成本并退出
  • 自动销毁:退出时(即使出错,通过 trap 机制)会自动取消 Flash 作业
  • 指标记录:每次 Flash 训练运行都会记录到 lab_metrics.jsonl

与自我提升循环的集成

远程训练的模型与本地模型遵循相同的级联规则:

层级 0:   启发式(免费,即时)
层级 0.5: 分类器(本地,免费)
层级 1.5: 本地 GPT ≤1.7B(create-gpt,训练后免费使用)
层级 1.5: 远程 GPT 3-13B(train-remote,训练后免费使用)  ← 新增
层级 2:   scillm/DeepSeek V3(Chutes,$0.12/1K 次调用)

一个 7-13B 的层级 1.5 模型可以显著减少层级 2(Chutes)的升级调用, 其节省的费用可能足以支付训练成本。

与其他技能的关系

/monitor-skills ──→ "技能 X 不健康"
                         ↓
/assistant-lab ──→ 诊断 → 训练 → 评估 → 提升
                         ↓
/assistant ──────→ 在推理时使用被提升的模型
  • /monitor-skills:观察所有技能。检测问题。报告健康状况。
  • /assistant-lab:修复 /assistant 的模型。训练、评估、提升。
  • /assistant:运行推理。使用实验室产出的任何模型。

协定

  • 输入:任务名称 + 可选的模型类型
  • 输出:诊断结果、训练结果、评估结果、提升状态
  • 依赖:model_factory.py(来自 /common)、create-* 和 *-lab 技能
  • 指标:追加到 ~/.pi/assistant/lab_metrics.jsonl

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/batch-quality

Pre-flight validation and quality gates for batch LLM operations. ACTUALLY tests samples through LLM before burning tokens. Uses SPARTA contracts for DuckDB validation queries. Integrates with task-monitor for enforced quality gates.

相关技能