Community程式設計與開發github.com

grahama1970/assistant

共享 GPT + 分類器推論閘道,用於角色監控任務。透過四層級聯(啟發式→分類器→本地 GPT→scillm)進行驗證與分類。

assistant 是什麼?

grahama1970/assistant 是一個共享的 GPT + 分類器 + 回歸器推論閘道,專為角色監控(persona monitor)任務設計。其核心是「溫暖池塘(warm pond)」概念——透過 `/assistant-lab`(自我改進工作檯)自主演化推論堆疊,而 `/monitor-skills` 則提供跨技能生態系的觀測能力。 系統採用四層級聯架構:Tier 0 啟發式(正則/關鍵字/結構)近乎零成本;Tier 0.5 分類器(DistilBERT/sklearn)與 Tier 0.75 回歸器(sklearn/XGB)提供快速推論;Tier 1.5 共享 GPT(Qwen3-0.6B GGUF)提供約 200ms 的本地推論;Tier 2 scillm(DeepSeek V3.2)作為教師模型(0.12 美元/1K tokens)。 此技能強制要求所有系統提示必須透過 `/prompt-lab` 迭代,並支援影子模式(shadow mode)以便安全地將新學生模型上線。模型工廠(ModelFactory)可自主監控影子同意率,決定是否推廣模型至正式環境。支援 Python API 與 CLI 工具,適用於驗證(validate)與分類(classify)工作流程。

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

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

停止。在調用任何端點之前,請完整閱讀此 SKILL.MD。

assistant 是做什麼的?

共享 GPT + 分類器 + 回歸器推論閘道,用於角色監控任務。

「溫暖池塘」—— /assistant 可以透過 /assistant-lab(自我改進工作檯:create-、-lab、模型工廠)自主演化其推論堆疊,而 /monitor-skills 則提供跨技能生態系的觀測能力。

提示迭代規則(不可協商)

所有 /assistant 模型的系統提示必須先透過 /prompt-lab 迭代,才能烘焙至訓練資料(透過 /create-gpt)。絕不要在 Python 字串中手寫系統提示。

  • 新模型提示 → 先對真實答案進行 /prompt-lab eval
  • 提示高原期(80-90% 影子同意率)→ 跨變體進行 /prompt-lab compare
  • 模型重新訓練 → 在 /create-gpt 之前先用 /prompt-lab find-minimum 驗證提示

層級聯架構

層級方法成本延遲建立方式
0啟發式(正則/關鍵字/結構)免費微秒手工編寫
0.5分類器(DistilBERT/sklearn)免費5-25ms/create-classifier
0.75回歸器(sklearn/XGB)免費5-10ms/create-regressor
1.5共享 GPT(Qwen3-0.6B GGUF)免費~200ms/create-gpt
2scillm(DeepSeek V3.2,經由 Chutes)$0.12/1K2-5s角色教師

模型生命週期(溫暖池塘)

層級 2 角色教師建立標籤
    ↓ harvest.py 提取 shadow.jsonl
    ↓
ModelFactory.auto_improve(task)
    ↓ 讀取影子同意率
    ├─ >= 90%:推廣(shadow_mode → false)
    ├─ 80-90%:高原期 → /prompt-lab 重新設計
    ├─ 70-80%:重新訓練 /create-gpt 或 /create-classifier
    └─ < 70%:積極重新訓練 + 架構變更
    ↓
/gpt-lab 基準測試 或 /classifier-lab 評估
    ↓ 通過?→ 推廣至註冊表
    ↓
/monitor-skills 偵測漂移或健康問題
    ↓
/assistant-lab auto-improve(診斷 → 訓練 → 評估 → 推廣)

使用方式

# 透過層級聯驗證資料
./run.sh validate --task qra-assessor --scope brandon_bailey --input '{"question":"...", "answer":"..."}'

# 分類文字
./run.sh classify --task bridge-tagger --text "satellite vulnerability assessment"

# 註冊新模型
./run.sh register --task NAME --model-path PATH --type gpt|classifier --threshold 0.85

# 顯示已註冊模型、命中率、層級分佈
./run.sh status

# 對所有層級執行合成輸入測試
./run.sh self-test

# 提取層級 2 升級為訓練資料
./run.sh harvest --since 24h

Python API

from assistant import validate, classify

# 使用四層級聯進行驗證
result = validate(
    input_data={"question": "什麼是 CWE-79?", "answer": "跨站腳本攻擊..."},
    task="qra-assessor",
    scope="brandon_bailey",
)
print(result.tier, result.confidence, result.result)

# 使用三層級聯進行分類
result = classify(
    text="satellite vulnerability assessment",
    task="bridge-tagger",
)
print(result.prediction, result.confidence, result.source)

合約

  • 輸入:任務相關的 dict(驗證器)或文字字串(分類器)
  • 輸出:GatewayResult 或 ClassifyResult,包含 tier、confidence、latency
  • 依賴:loguru、typer;可選:llama-cpp-python、torch、joblib
  • 指標:追加 JSONL 至 ~/.pi/assistant/metrics.jsonl

模型工廠

# 檢查任務需要哪些模型
./run.sh factory needs --task stress-test-grader

# 從收集的教師標籤訓練 GPT
./run.sh factory train-gpt --task stress-test-grader

# 透過 /gpt-lab 評估
./run.sh factory evaluate --task stress-test-grader --type gpt

# 推廣通過的模型(停用影子模式)
./run.sh factory promote --task stress-test-grader --type gpt

# 自主改進循環(決策 + 訓練 + 評估 + 推廣)
./run.sh factory auto-improve --task stress-test-grader
from model_factory import ModelFactory

factory = ModelFactory()
result = factory.auto_improve("stress-test-grader")
# → 讀取影子同意率,視需要訓練/評估/推廣

關鍵行為

  1. 懶加載模型:權重僅在首次呼叫時載入,並在行程內快取
  2. 記憶注入:從角色範圍中回想,並預先附加至 GPT 系統提示
  3. 直通模式:若無本地模型,直接降級至 scillm
  4. 影子模式:設定 "shadow_mode": true 的任務會同時執行本地模型與 scillm,將不一致處記錄至 shadow.jsonl,並返回教師(scillm)結果。實現新學生模型的安全上線。
  5. 收割:夜間提取層級 2 升級作為教師標籤
  6. 模型工廠:透過 /assistant-lab,當影子模式顯示需要改進時,自主訓練、評估、推廣模型
  7. 溫暖池塘:/monitor-skills 監控生態系(可觀測性),/assistant-lab 修復問題(自我改進)。兩者共同形成 /assistant 得以演化的溫暖池塘。

常見錯誤

錯誤:在 Python 字串中手寫系統提示

SYSTEM_PROMPT = "你是一個 QRA 驗證器。請檢查答案是否正確..."

正確:透過 /prompt-lab 迭代提示,再烘焙至訓練資料

.pi/skills/prompt-lab/run.sh eval --prompt qra_validator_v1 --model deepseek
# 只有在 prompt-lab 驗證通過後 → 建立訓練資料

錯誤:使用不足的資料訓練(每類別少於 200 個樣本)

./run.sh factory train-gpt --task sparta-intent  # 50 個樣本,12 個類別 = 每類 4 個!

正確:停留在層級 2,先收割更多教師標籤

./run.sh harvest --since 7d  # 累積影子標籤
./run.sh status              # 訓練前檢查樣本數量

錯誤:跳過影子模式,直接推廣未測試的模型

./run.sh factory promote --task stress-test-grader  # 無影子比較!

正確:執行影子模式,驗證同意率,再推廣

./run.sh factory auto-improve --task stress-test-grader
# auto-improve 讀取影子同意率並決定

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-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.

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.

相關技能