版本:v0.2.0(与当前主线对齐)
更新时间:2026-03-30
TreeSkill 支持三层配置:环境变量、.env、--config YAML,优先级是环境变量 > .env > YAML > 默认值。
llm:
api_key: "sk-xxx"
base_url: "https://api.openai.com/v1"
model: "gpt-4o-mini" # actor
judge_model: "gpt-4o" # APO/ASO judge
rewrite_model: "gpt-4o" # APO/ASO rewrite
protocol: "openai"
storage:
trace_path: "./data/traces.jsonl"
skill_path: "./skills"
apo:
beam_width: 1
branch_factor: 2
beam_rounds: 3
gradient_accumulation_steps: 5
num_candidates: 2
verbose: trueexport TREE_LLM_API_KEY="sk-xxx"
export TREE_LLM_BASE_URL="https://api.openai.com/v1"
export TREE_LLM_MODEL="gpt-4o-mini"
export TREE_LLM_JUDGE_MODEL="gpt-4o"
export TREE_LLM_REWRITE_MODEL="gpt-4o"python -m treeskill --help
python -m treeskill.main --config demo/example/config.yaml --skill demo/exampleTreeSkill 当前主线和兼容层都使用目录化 SKILL.md。
my-skill/
├── SKILL.md # 必须,frontmatter + Markdown system prompt
├── config.yaml # 可选,skill 级参数
└── script.py # 可选,工具函数
SKILL.md 示例:
---
name: my-writing-assistant
description: 专业中文写作助手
metadata:
version: "1.0"
target: "更像真人说话,有温度"
---
你是一位专业的中文写作助手。
语言要自然,避免 AI 腔,给出可落地的写作建议。对应字段:
metadata.version→Skill.versionmetadata.target→Skill.target- 内容正文 →
Skill.system_prompt
# 主线:SealQA lifecycle(默认)
python -m treeskill
# 仅 ASO mini
python -m treeskill sealqa-aso
# 兼容模式
python -m treeskill legacy-chat
python -m treeskill.main --skill demo/example --ckpt ckpt/example-run主线输出保存在 demo/outputs/,可查看 summary.json、各迭代 iteration_*。
python -m treeskill.main --config demo/example/config.yaml --skill demo/example常见 slash 命令:/bad、/rewrite、/target、/optimize、/tree、/split、/ckpt、/restore、/quit。
python -m treeskill.main --config demo/example/config.yaml \
--skill demo/example --dataset demo/data/sealqa_tree_samples.json \
--optimizepython -m treeskill.main --optimize --annotate --dataset demo/data/sealqa_tree_samples.json--manual:强制人类 judge--no-resume:跳过断点恢复提示,直接重跑
SKILL 的工具来自三类:
script.py:本地 Python 工具config.yaml中定义的 HTTP/MCP 工具~/.kode/ MCP 外部接入(运行时按需)
运行时配置可在 demo/example/config.yaml 与 demo/example/SKILL.md 查看。
python -m treeskill:当前主线(推荐)python -m treeskill.main:兼容 AP O / 交互式流程demo/archive/:历史实验与旧思路(保留但不作为主线)