# OpenClaw Agent Evolution: Recording SOP

*Cédric Beau's original file (Chinese version), translated into English. File, folder and command names are kept as they are.*

## Stage 1: Remember, install the brain (hardware initialization)

**Pain point:** conversations are "volatile". It is like writing with alcohol: one breath of wind and it all evaporates.

**Logic:** create physical partitions on the disk and make the data persistent with the "three-tier memory model".

### Step 1: Create the physical architecture

In the root directory, create the memory/ folder and generate 8 core files:

1. AGENTS.md (identity)
2. SOUL.md (soul)
3. USER.md (the boss)
4. TOOLS.md (weapons)
5. MEMORY.md (knowledge)
6. ERRORS.md (mistakes notebook)
7. SHARED.md (social)
8. STRATEGY_EVOLVE.md (evolution)

### Step 2: Define the "three-tier memory model"

So that lessons settle tier by tier and no logic gets lost:

- **Tier 1 (short term):** the raw conversation stream. This is "instant memory": as the conversation goes deeper, the system automatically erases or compresses it.
- **Tier 2 (medium term):** sorted temporary configurations and task logs. This is "working memory", which stores the intermediate state of the current task.
- **Tier 3 (long term):** logic principles locked into SOUL.md or STRATEGY_EVOLVE.md. These are the "core values", hard rules the AI will never forget.

**Iron rule:** never overwrite with write, always append with edit. Protect the growth rings of its evolution.

## Stage 2: Align, set the rules (inject the soul and the translation protocol)

**Pain point:** plain everyday language is ambiguous. You think it understood, when in fact it is filling in the gaps on its own.

**Logic:** before teaching any skill, first unify the communication contract and install a "requirements translator".

### Action: inject the "architect" iron rules

Force-write these four principles into SOUL.md:

1. **Path consistency:** for any read or write, first confirm the physical path /data/.openclaw/. Refuse vagueness.
2. **Error tracing:** on any Failed, it must analyze the main technical cause (permissions / path / logic). Apologizing alone is forbidden.
3. **IPO translation protocol:** every request received must be broken down into [input → process → output] and confirmed back.
4. **Silence principle:** unless a threshold or a black swan is triggered, stay silent in the background to reduce noise.

## Stage 3: Learn the trade, teach the playbook (Skill modularization)

**Pain point:** it has knowledge but no playbook. If you do not push it, it does not move, and when it executes it is hopelessly clumsy.

**Logic:** Modularization. With the "alignment protocol" from Stage 2, you can efficiently feed it your business logic.

### Action: write the Skill manual (SKILL.md)

- **Content:** create a folder under skills/ and record the business SOP in it (for example: down 7%, invest 3x).
- **Nature:** it is a "reference book" for the AI's brain, a form of soft logic.

## Stage 4: Become proactive, set reflexes (Hook automation)

**Pain point:** it has a passive personality. If the boss says nothing, it just sits there.

**Logic:** Reflex Arc. Bypass the brain's (the LLM's) thinking and use TypeScript to drive 100% deterministic execution.

### Step 1: Skill vs Hook (suggestion vs iron rule)

- **A Skill is a suggestion:** it depends on the AI's own diligence and can fail.
- **A Hook is a reflex:** a specific event triggers it and the code runs directly. It is the system's "spinal reflex".

### Step 2: Install the reflex logic

1. **Boot self-check:** whenever a new Session starts, the Hook automatically loads today's plan.
2. **Security defense:** automatically blocks dangerous file overwrites, protecting core assets.
3. **Heartbeat patrol:** set a heartbeat every 30 minutes that automatically checks market conditions.

## Stage 5: Review, start evolving (self-reflection evolution flow)

**Pain point:** it never learns and falls into the same hole twice. The files were created in Stage 1, but it never got into the habit of "keeping a diary".

**Logic:** Feedback Loop. Set up an automated "review workflow".

### Action: activate the evolution distillation task

- **Evolution mechanism:** officially start the heartbeat distillation logic, once every 6 hours.
- **Distillation process:** force the AI to review the user's corrections in Tier 1 conversations, extract the core lessons, and turn them into Tier 3 principles.
- **Storage:** the experience is officially written into STRATEGY_EVOLVE.md, for true self-iteration.
