skill-upgrader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Upgrader

Skill升级工具

Meta-skill that upgrades any SKILL.md to Decision Theory v5 Hybrid format using 4 parallel Ragie-backed agents.
这是一种元技能,可借助4个并行的Ragie驱动Agent将任意SKILL.md升级为决策理论v5 Hybrid格式。

When to Use

使用场景

  • "Upgrade this skill to v5"
  • "Formalize this skill with decision theory"
  • "Add MDP structure to this skill"
  • "Apply the skill-upgrader to X"
  • "将此Skill升级至v5版本"
  • "用决策理论规范化此Skill"
  • "为该Skill添加MDP结构"
  • "对X应用Skill升级工具"

Prerequisites

前置条件

Ragie RAG with indexed books:
  • decision-theory partition: LaValle Planning Algorithms, Sutton & Barto RL
  • modal-logic partition: Blackburn Modal Logic, Huth & Ryan Logic in CS
已索引相关书籍的Ragie RAG:
  • 决策理论分区:LaValle Planning Algorithms、Sutton & Barto RL
  • 模态逻辑分区:Blackburn Modal Logic、Huth & Ryan Logic in CS

Workflow

工作流程

Step 1: Setup Session

步骤1:设置会话

bash
SESSION=$(date +%Y%m%d-%H%M%S)-upgrade-{skill_name}
mkdir -p thoughts/skill-builds/${SESSION}
bash
SESSION=$(date +%Y%m%d-%H%M%S)-upgrade-{skill_name}
mkdir -p thoughts/skill-builds/${SESSION}

Step 2: Initialize Blackboard

步骤2:初始化黑板

Create
thoughts/skill-builds/{session}/00-blackboard.md
:
markdown
undefined
创建
thoughts/skill-builds/{session}/00-blackboard.md
markdown
undefined

Skill Upgrade: {skill_name}

Skill升级:{skill_name}

Started: {timestamp}
启动时间:{timestamp}

Input Skill

输入Skill

{path_to_skill}
{path_to_skill}

Target Format

目标格式

Decision Theory v5 Hybrid
决策理论v5 Hybrid

Agent Findings

Agent发现结果

(Agents append below)

undefined
(Agent将结果追加至下方)

undefined

Step 3: Launch 4 Agents in Parallel

步骤3:并行启动4个Agent

Use Task tool to spawn all 4 agents simultaneously. Each agent:
  1. Reads the input skill
  2. Queries Ragie for their specific book
  3. Appends findings to the blackboard

使用Task工具同时生成所有4个Agent。每个Agent的工作内容:
  1. 读取输入的Skill
  2. 针对各自负责的书籍查询Ragie
  3. 将发现结果追加至黑板

Agent 1: LaValle Planner

Agent 1:LaValle规划器

Book: LaValle's "Planning Algorithms" (decision-theory partition) Focus: States, Actions, Transitions
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: LaValle's "Planning Algorithms" in Ragie partition 'decision-theory'

TASK: Identify MDP structure in the skill.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "MDP state space definition" -p decision-theory
uv run python scripts/ragie_query.py -q "action space sequential decisions" -p decision-theory
uv run python scripts/ragie_query.py -q "POMDP partial observability" -p decision-theory
Read the input skill and answer:
  1. What are the STATES? (phases, modes, tracked info)
  2. What are the ACTIONS? (what can agent do in each state)
  3. How do TRANSITIONS work? (deterministic or stochastic)
  4. Is this POMDP or fully observable?
WRITE to blackboard section: ## Agent 1: States, Actions & Transitions
Format as plain English with LaValle chapter citations. """ )

---
对应书籍:LaValle所著《Planning Algorithms》(决策理论分区) 聚焦方向:状态、动作、转移
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: LaValle's "Planning Algorithms" in Ragie partition 'decision-theory'

TASK: 识别Skill中的MDP结构。

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "MDP state space definition" -p decision-theory
uv run python scripts/ragie_query.py -q "action space sequential decisions" -p decision-theory
uv run python scripts/ragie_query.py -q "POMDP partial observability" -p decision-theory
Read the input skill and answer:
  1. What are the STATES? (phases, modes, tracked info)
  2. What are the ACTIONS? (what can agent do in each state)
  3. How do TRANSITIONS work? (deterministic or stochastic)
  4. Is this POMDP or fully observable?
WRITE to blackboard section: ## Agent 1: States, Actions & Transitions
Format as plain English with LaValle chapter citations. """ )

---

Agent 2: Sutton & Barto Optimizer

Agent 2:Sutton & Barto优化器

Book: Sutton & Barto's "Reinforcement Learning" (decision-theory partition) Focus: Policy, Termination, Value Depends on: Agent 1
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Sutton & Barto's "Reinforcement Learning" in Ragie partition 'decision-theory'

WAIT: Read Agent 1's findings from blackboard first.

TASK: Design policy and termination conditions.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "policy deterministic stochastic" -p decision-theory
uv run python scripts/ragie_query.py -q "episodic termination conditions" -p decision-theory
uv run python scripts/ragie_query.py -q "reward function design" -p decision-theory
Using Agent 1's states and actions, answer:
  1. What's the POLICY? (state → action rules)
  2. When does it END? (terminal states, success/failure)
  3. What are REWARDS? (goals +, costs -)
  4. Which states are HIGH/LOW value?
WRITE to blackboard section: ## Agent 2: Policy & Values
Format as plain English with Sutton & Barto section citations. """ )

---
对应书籍:Sutton & Barto所著《Reinforcement Learning》(决策理论分区) 聚焦方向:策略、终止条件、价值 依赖:Agent 1的结果
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Sutton & Barto's "Reinforcement Learning" in Ragie partition 'decision-theory'

WAIT: Read Agent 1's findings from blackboard first.

TASK: Design policy and termination conditions.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "policy deterministic stochastic" -p decision-theory
uv run python scripts/ragie_query.py -q "episodic termination conditions" -p decision-theory
uv run python scripts/ragie_query.py -q "reward function design" -p decision-theory
Using Agent 1's states and actions, answer:
  1. What's the POLICY? (state → action rules)
  2. When does it END? (terminal states, success/failure)
  3. What are REWARDS? (goals +, costs -)
  4. Which states are HIGH/LOW value?
WRITE to blackboard section: ## Agent 2: Policy & Values
Format as plain English with Sutton & Barto section citations. """ )

---

Agent 3: Blackburn Modal Logician

Agent 3:Blackburn模态逻辑学家

Book: Blackburn's "Modal Logic" (modal-logic partition) Focus: Constraints (temporal, epistemic, deontic)
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Blackburn's "Modal Logic" in Ragie partition 'modal-logic'

TASK: Extract constraints from the skill.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "temporal logic LTL operators" -p modal-logic
uv run python scripts/ragie_query.py -q "epistemic logic knowledge" -p modal-logic
uv run python scripts/ragie_query.py -q "deontic logic obligations" -p modal-logic
Read the input skill and identify:
  1. TEMPORAL: "must do X before Y" → □, ◇, U
  2. EPISTEMIC: "must know X" → K operator
  3. DEONTIC: "must/forbidden/may" → O, F, P
  4. DYNAMIC: "action causes effect" → [action]
WRITE to blackboard section: ## Agent 3: Constraints
For each constraint:
  • Plain English description
  • Modal logic notation
  • Why it matters
  • Blackburn chapter citation """ )

---
对应书籍:Blackburn所著《Modal Logic》(模态逻辑分区) 聚焦方向:约束(时间、认知、道义)
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Blackburn's "Modal Logic" in Ragie partition 'modal-logic'

TASK: Extract constraints from the skill.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "temporal logic LTL operators" -p modal-logic
uv run python scripts/ragie_query.py -q "epistemic logic knowledge" -p modal-logic
uv run python scripts/ragie_query.py -q "deontic logic obligations" -p modal-logic
Read the input skill and identify:
  1. TEMPORAL: "must do X before Y" → □, ◇, U
  2. EPISTEMIC: "must know X" → K operator
  3. DEONTIC: "must/forbidden/may" → O, F, P
  4. DYNAMIC: "action causes effect" → [action]
WRITE to blackboard section: ## Agent 3: Constraints
For each constraint:
  • Plain English description
  • Modal logic notation
  • Why it matters
  • Blackburn chapter citation """ )

---

Agent 4: Huth & Ryan Verifier

Agent 4:Huth & Ryan验证器

Book: Huth & Ryan's "Logic in Computer Science" (modal-logic partition) Focus: Validation, Safety, Liveness Depends on: Agents 1-3
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Huth & Ryan's "Logic in Computer Science" in Ragie partition 'modal-logic'

WAIT: Read Agents 1-3 findings from blackboard first.

TASK: Verify consistency and completeness.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "safety properties verification" -p modal-logic
uv run python scripts/ragie_query.py -q "liveness properties eventually" -p modal-logic
uv run python scripts/ragie_query.py -q "model checking CTL" -p modal-logic
Check:
  1. SAFETY: What bad things never happen? □¬(bad)
  2. LIVENESS: What good things eventually happen? ◇(good)
  3. CONSISTENCY: Any contradictions between agents?
  4. COMPLETENESS: Any gaps in coverage?
WRITE to blackboard section: ## Agent 4: Verification
Report with ✓/✗ for each property. Overall verdict: PASS or NEEDS_WORK Huth & Ryan section citations. """ )

---
对应书籍:Huth & Ryan所著《Logic in Computer Science》(模态逻辑分区) 聚焦方向:验证、安全性、活性 依赖:Agent 1-3的结果
Task(
  subagent_type="general-purpose",
  prompt="""
INPUT SKILL: {path}
BLACKBOARD: thoughts/skill-builds/{session}/00-blackboard.md

YOUR BOOK: Huth & Ryan's "Logic in Computer Science" in Ragie partition 'modal-logic'

WAIT: Read Agents 1-3 findings from blackboard first.

TASK: Verify consistency and completeness.

Query Ragie:
```bash
uv run python scripts/ragie_query.py -q "safety properties verification" -p modal-logic
uv run python scripts/ragie_query.py -q "liveness properties eventually" -p modal-logic
uv run python scripts/ragie_query.py -q "model checking CTL" -p modal-logic
Check:
  1. SAFETY: What bad things never happen? □¬(bad)
  2. LIVENESS: What good things eventually happen? ◇(good)
  3. CONSISTENCY: Any contradictions between agents?
  4. COMPLETENESS: Any gaps in coverage?
WRITE to blackboard section: ## Agent 4: Verification
Report with ✓/✗ for each property. Overall verdict: PASS or NEEDS_WORK Huth & Ryan section citations. """ )

---

Step 4: Synthesize Final Skill

步骤4:合成最终Skill

After all agents complete, read the blackboard and create:
Output:
thoughts/skill-builds/{session}/SKILL-upgraded.md
Use v5 Hybrid template:
yaml
---
name: {original_name}
description: {original_description}
version: 5.1-hybrid
---
所有Agent完成工作后,读取黑板内容并创建:
输出文件
thoughts/skill-builds/{session}/SKILL-upgraded.md
使用v5 Hybrid模板:
yaml
---
name: {original_name}
description: {original_description}
version: 5.1-hybrid
---

Option: {name}

选项:{name}

Initiation (I)

启动阶段(I)

[From original + Agent 1 state analysis]
[来自原始内容 + Agent 1的状态分析]

Observation Space (Y)

观测空间(Y)

[From Agent 1 POMDP analysis]
[来自Agent 1的POMDP分析]

Action Space (U)

动作空间(U)

[From Agent 1 actions]
[来自Agent 1的动作分析]

Policy (pi)

策略(pi)

[From Agent 2 state→action rules]
[来自Agent 2的状态→动作规则]

Termination (beta)

终止条件(beta)

[From Agent 2 episode structure]
[来自Agent 2的情节结构]

Q-Heuristics

Q-Heuristics

[From Agent 2 value guidance]
[来自Agent 2的价值指导]

Constraints

约束条件

[From Agent 3 modal logic]
[来自Agent 3的模态逻辑分析]

Verification

验证结果

[From Agent 4 safety/liveness]

---
[来自Agent 4的安全性/活性分析]

---

Example Usage

示例用法

User: "Upgrade .claude/skills/implement_plan/SKILL.md to v5 Hybrid"

Claude:
1. Creates session directory
2. Initializes blackboard
3. Launches 4 agents in parallel (Task tool)
4. Waits for completion
5. Reads blackboard
6. Synthesizes upgraded skill
7. Reports: "Upgraded skill at thoughts/skill-builds/.../SKILL-upgraded.md"
用户:"将.claude/skills/implement_plan/SKILL.md升级至v5 Hybrid格式"

Claude执行步骤:
1. 创建会话目录
2. 初始化黑板
3. 并行启动4个Agent(通过Task工具)
4. 等待所有Agent完成
5. 读取黑板内容
6. 合成升级后的Skill
7. 报告:"升级后的Skill已保存至thoughts/skill-builds/.../SKILL-upgraded.md"

Ragie Query Reference

Ragie查询参考

bash
undefined
bash
undefined

Decision theory partition

决策理论分区

uv run python scripts/ragie_query.py -q "your question" -p decision-theory
uv run python scripts/ragie_query.py -q "your question" -p decision-theory

Modal logic partition

模态逻辑分区

uv run python scripts/ragie_query.py -q "your question" -p modal-logic
uv run python scripts/ragie_query.py -q "your question" -p modal-logic

With reranking for better results

启用重排以获得更优结果

uv run python scripts/ragie_query.py -q "your question" -p decision-theory --rerank
undefined
uv run python scripts/ragie_query.py -q "your question" -p decision-theory --rerank
undefined

Files Created

生成的文件

After upgrade:
thoughts/skill-builds/{session}/
├── 00-blackboard.md      # Agent collaboration
├── SKILL-upgraded.md     # Final v5 Hybrid skill
└── validation-report.md  # Agent 4 verification
升级完成后会生成以下文件:
thoughts/skill-builds/{session}/
├── 00-blackboard.md      # Agent协作内容
├── SKILL-upgraded.md     # 最终的v5 Hybrid Skill
└── validation-report.md  # Agent 4的验证报告