Community程式設計與開發github.com

grahama1970/assistant-lab

/assistant 的自我改善工作檯。提供診斷、訓練、評估和推廣模型所需的所有工具,形成持續改進的循環。這是 /assistant 進化其自身推理堆疊的「溫水池」。

assistant-lab 是什麼?

grahama1970/assistant-lab 是一個專為 /assistant 設計的自我改善工具箱,旨在透過自動化循環來診斷問題、訓練模型、評估效能並將通過的模型推廣至正式環境。它與 /monitor-skills 不同,後者負責觀察所有技能的運行健康狀況,而 assistant-lab 則專注於/assistant 自身的模型迭代與進化。該技能支援多種模型訓練,包括 GPT (QLoRA/SFT)、分類器 (DistilBERT/sklearn) 和回歸器 (XGBoost),並內建基於影子一致率 (Shadow Agreement) 的智能決策引擎 (ModelFactory),可根據模型表現自動選擇重新設計提示、重新訓練或變更架構。對於大型模型 (3B-13B),它整合了 RunPod Flash 進行無伺服器 GPU 訓練,並提供預算上限和安全確認機制,避免浪費資源。最終目標是透過持續的自我改進循環,減少對更高成本 Tier 2 教師模型 (如 scillm/DeepSeek V3) 的依賴,直接優化 /assistant 的推理品質與成本效益。

相容平台~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 (Tier 1.5)一致率 < 80% 或無現有模型
/create-classifier訓練 DistilBERT/sklearn 分類器 (Tier 0.5)文字分類任務
/create-regressor訓練 sklearn/XGB 回歸器 (Tier 0.75)連續預測任務
RunPod Flash透過 Python SDK 進行無伺服器 GPU 訓練 (7B–70B)模型過大,本地 A5000 無法負載 — 取代 /ops-runpod 進行訓練
/gpt-lab對 GPT 進行基準測試,與教師基準比較訓練後,推廣前
/classifier-lab評估分類器準確率/F1分類器訓練後
/prompt-lab偵測到高原期時重新設計提示一致率卡在 80-90%
/scillmTier 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 → 停留在 Tier 2 教師
分類器 (sklearn/SetFit)每個類別 200 個n_samples / n_classes >= 200
回歸器100+ 總計標準 sklearn 建議

證據:sparta_stress_grading 僅以 246 個樣本訓練 → 33.7% 一致率。 這浪費了 4 個月收集的影子標籤,因為模型訓練得太早了。 先收集,準備好再訓練。

訓練資料流程

Tier 2 教師 (透過 persona 的 scillm)
    ↓ 標籤儲存至 shadow.jsonl
    ↓
/assistant-lab harvest --task X
    ↓ 提取 input+output 對
    ↓
/create-gpt train --task X --data labels.jsonl
    ↓ 在 Qwen2.5-1.5B 上進行 QLoRA(預設)
    ↓
/gpt-lab benchmark --task X
    ↓ 比較學生模型 vs 教師
    ↓
/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 類型

GPUVRAM備註
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 VRAM) 上執行 QLoRA / SFT 訓練
    ├─ 5. 將模型權重拉取至 /mnt/storage12tb/models/
    ├─ 6. create-gpt export --quantize Q4_K_M (GGUF)
    └─ 7. 評估 + 若通過則自動推廣

安全閘道

  • 預算上限:--max-cost(預設 $15.00)若估算超出限制則阻止訓練
  • 確認:必須傳入 --confirm — 否則僅顯示成本並退出
  • 自動清理:Flash 工作會在退出時取消(即使發生錯誤,透過 trap 機制)
  • 指標記錄:每次 Flash 訓練執行都會記錄到 lab_metrics.jsonl

與自我改善循環的整合

遠端訓練的模型與本地模型使用相同的級聯機制整合:

Tier 0:   啟發式 (免費,即時)
Tier 0.5: 分類器 (本地,免費)
Tier 1.5: 本地 GPT ≤1.7B (create-gpt,訓練後免費)
Tier 1.5: 遠端 GPT 3-13B (train-remote,訓練後免費)  ← 新增
Tier 2:   scillm/DeepSeek V3 (Chutes,$0.12/千次呼叫)

一個 7-13B 的 Tier 1.5 模型可以顯著減少 Tier 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.

相關技能