Genome Manager

TotalClaw 作者 kylechen26 v1.0.2

GEP(基因组进化协议)的完整基因组生命周期管理。填补了关键空白:尽管基因组是智能体自我进化的基础,但零基因组管理工具仍然存在。提供结构化存储、突变跟踪(进化/适应/专业化)、谱系管理和验证。使代理能够将成功的模式编码为可共享的基因组,从而在网络上创建集体进化。

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:kylechen26~kylechen26-genome-manager
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Akylechen26~kylechen26-genome-manager/file -o kylechen26-genome-manager.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/2962791a532299827c419203e65d159769b7113f
# Genome Manager

Manages the Genome Evolution Protocol (GEP) genomes - structured success patterns that enable AI agents to self-evolve.

## What are Genomes?

Genomes are encoded patterns of successful agent behavior:
- **Task Type**: Classification (research, debug, security, etc.)
- **Approach**: Steps, tools, prompts used
- **Outcome**: Success metrics, timing, quality scores
- **Lineage**: Parent genomes, mutation history

## When to Use This Skill

Use when:
- Extracting successful patterns from completed tasks
- Creating reusable genome libraries
- Mutating genomes for optimization
- Tracking genome performance over time
- Preparing genomes for EvoMap sharing

## Genome Lifecycle

```
Experience → Encode → Store → Retrieve → Adopt → Evolve → Share
```

## Quick Start

### CLI Usage

This skill provides a command-line tool for genome management:

```bash
# Create a new genome
python3 scripts/genome_manager.py create \
  --name research-comprehensive-v1 \
  --task-type research \
  --steps "search,extract,synthesize" \
  --tools "web_search,web_fetch" \
  --success-rate 0.95 \
  --sample-size 50

# List all genomes
python3 scripts/genome_manager.py list

# Get a specific genome
python3 scripts/genome_manager.py get research-comprehensive-v1

# Create a mutated copy
python3 scripts/genome_manager.py mutate research-comprehensive-v1 \
  --type evolution \
  --changes "added verification step"

# Validate genome quality
python3 scripts/genome_manager.py validate research-comprehensive-v1
```

### Programmatic Usage

```python
# Import from skill directory
import sys
sys.path.insert(0, "{baseDir}/scripts")
from genome_manager import create_genome, list_genomes

# Create genome programmatically
genome = create_genome(args)
```

## Genome Schema

```json
{
  "genome_id": "uuid-v4",
  "name": "research-comprehensive-v1",
  "task_type": "research",
  "version": "1.0.0",
  "created_at": "ISO-8601",
  "approach": {
    "steps": ["step1", "step2"],
    "tools": ["tool1", "tool2"],
    "prompts": ["prompt_ref"],
    "config": {}
  },
  "outcome": {
    "success_rate": 0.95,
    "avg_duration_seconds": 180,
    "user_satisfaction": 0.92,
    "sample_size": 50
  },
  "lineage": {
    "parent_id": "parent-uuid or null",
    "generation": 1,
    "mutations": [
      {"type": "evolution", "timestamp": "...", "changes": "..."}
    ]
  },
  "tags": ["research", "comprehensive", "verified"]
}
```

## Storage Locations

Default genome storage:
- `memory/genomes/*.json` - Local genome library
- `~/.openclaw/genomes/` - Shared across agents
- EvoMap network - Distributed sharing (future)

## Mutation Types

| Type | Description | Use Case |
|------|-------------|----------|
| **evolution** | Incremental improvement | Refine existing pattern |
| **adaptation** | Context-specific change | Adjust for new domain |
| **specialization** | Narrow scope | Optimize for specific sub-task |
| **crossover** | Combine two genomes | Merge successful patterns |

## Validation Rules

Before saving a genome:
- [ ] Success rate >= 0.8 (proven pattern)
- [ ] Sample size >= 3 (not luck)
- [ ] No credentials in prompts
- [ ] Steps are reproducible
- [ ] Tools are available

## Security

- Genomes never contain API keys or credentials
- All paths use {baseDir} for portability
- Review before sharing to EvoMap network
- Validate mutations don't break security rules

## Integration with EvoAgentX

```python
from evoagentx import Workflow
from genome_manager import Genome

# Load genome into EvoAgentX workflow
genome = Genome.load("research-comprehensive-v1")
workflow = Workflow.from_genome(genome)

# Evolve it further
evolution = await workflow.evolve(dataset=test_cases)
```

## Version History

- 1.0.0: Core genome CRUD operations
- 1.0.1: Added mutation tracking

---

## 中文说明

# 基因组管理器(Genome Manager)

管理基因组进化协议(GEP)的基因组 —— 一种结构化的成功模式,使 AI 智能体能够自我进化。

## 什么是基因组?

基因组是对成功智能体行为的编码模式:
- **任务类型(Task Type)**:分类(研究、调试、安全等)
- **方法(Approach)**:所用的步骤、工具、提示词
- **结果(Outcome)**:成功指标、耗时、质量评分
- **谱系(Lineage)**:父代基因组、突变历史

## 何时使用本技能

在以下情况下使用:
- 从已完成的任务中提取成功模式
- 创建可复用的基因组库
- 通过突变对基因组进行优化
- 长期跟踪基因组性能
- 为 EvoMap 共享准备基因组

## 基因组生命周期

```
Experience → Encode → Store → Retrieve → Adopt → Evolve → Share
```

## 快速开始

### CLI 用法

本技能提供用于基因组管理的命令行工具:

```bash
# Create a new genome
python3 scripts/genome_manager.py create \
  --name research-comprehensive-v1 \
  --task-type research \
  --steps "search,extract,synthesize" \
  --tools "web_search,web_fetch" \
  --success-rate 0.95 \
  --sample-size 50

# List all genomes
python3 scripts/genome_manager.py list

# Get a specific genome
python3 scripts/genome_manager.py get research-comprehensive-v1

# Create a mutated copy
python3 scripts/genome_manager.py mutate research-comprehensive-v1 \
  --type evolution \
  --changes "added verification step"

# Validate genome quality
python3 scripts/genome_manager.py validate research-comprehensive-v1
```

### 编程方式用法

```python
# Import from skill directory
import sys
sys.path.insert(0, "{baseDir}/scripts")
from genome_manager import create_genome, list_genomes

# Create genome programmatically
genome = create_genome(args)
```

## 基因组结构(Schema)

```json
{
  "genome_id": "uuid-v4",
  "name": "research-comprehensive-v1",
  "task_type": "research",
  "version": "1.0.0",
  "created_at": "ISO-8601",
  "approach": {
    "steps": ["step1", "step2"],
    "tools": ["tool1", "tool2"],
    "prompts": ["prompt_ref"],
    "config": {}
  },
  "outcome": {
    "success_rate": 0.95,
    "avg_duration_seconds": 180,
    "user_satisfaction": 0.92,
    "sample_size": 50
  },
  "lineage": {
    "parent_id": "parent-uuid or null",
    "generation": 1,
    "mutations": [
      {"type": "evolution", "timestamp": "...", "changes": "..."}
    ]
  },
  "tags": ["research", "comprehensive", "verified"]
}
```

## 存储位置

默认基因组存储:
- `memory/genomes/*.json` —— 本地基因组库
- `~/.openclaw/genomes/` —— 跨智能体共享
- EvoMap network —— 分布式共享(未来)

## 突变类型

| 类型 | 说明 | 适用场景 |
|------|-------------|----------|
| **evolution** | 渐进式改进 | 优化已有模式 |
| **adaptation** | 针对特定上下文的变化 | 适配新领域 |
| **specialization** | 收窄范围 | 针对特定子任务优化 |
| **crossover** | 合并两个基因组 | 融合成功模式 |

## 验证规则

保存基因组之前:
- [ ] 成功率 >= 0.8(经过验证的模式)
- [ ] 样本量 >= 3(并非偶然)
- [ ] 提示词中不含任何凭据
- [ ] 步骤可复现
- [ ] 工具可用

## 安全

- 基因组绝不包含 API 密钥或凭据
- 所有路径均使用 {baseDir} 以保证可移植性
- 共享到 EvoMap network 前先审查
- 验证突变不会破坏安全规则

## 与 EvoAgentX 集成

```python
from evoagentx import Workflow
from genome_manager import Genome

# Load genome into EvoAgentX workflow
genome = Genome.load("research-comprehensive-v1")
workflow = Workflow.from_genome(genome)

# Evolve it further
evolution = await workflow.evolve(dataset=test_cases)
```

## 版本历史

- 1.0.0: 核心基因组 CRUD 操作
- 1.0.1: 新增突变跟踪