# Hands-on Manual: Building a DCA Assistant with OpenClaw

*Cédric Beau's original file (Chinese version), translated into English. "Little Shrimp" (小虾) is the nickname given to the OpenClaw agent. U = USDT. File, folder and command names are kept as they are.*

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

**Core logic:** create 8 physical files to upgrade the AI from "temporary chat memory" to "physical disk memory".

### 🚀 Command to send to Little Shrimp

```text
"Little Shrimp, now execute [TOP PRIORITY: BRAIN INITIALIZATION V3.4]:
1. Claim your territory: create the memory/ folder in the root directory.
2. Generate the 8 core files: AGENTS.md, SOUL.md, USER.md, TOOLS.md, MEMORY.md, ERRORS.md, SHARED.md, STRATEGY_EVOLVE.md.
3. Inject the initial information:
   ○ In USER.md write: 'I am the boss, you are my digital partner, in charge of monitoring my BTC assets.'
   ○ In SOUL.md write: 'You are a calm, rigorous architect.'
4. Report: show the file list as a table.
Note: from now on, every write must append with edit. Overwriting with write is strictly forbidden!"
```

### 🧪 Acceptance test

- **Test action:** click "New Session" to open a completely blank conversation.
- **Test question:** "Check your physical files and tell me who I am. And if we need to update the files later, what is the one operation you must never perform?"
- **Perfect answer:** it should read USER.md with its tools, answer that you are "the boss / digital partner", and stress that it "must never overwrite with write".

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

**Core logic:** implant an "architect's soul", remove ambiguity, and establish the IPO execution handshake contract.

### 🚀 Command to send to Little Shrimp

```text
"Well done. Now we move to Stage 2. I am injecting four **'soul principles'** into your SOUL.md:
1. Path consistency: before reading or writing a file, first confirm the physical path (e.g. /data/.openclaw/). Refuse 'imagined' paths.
2. Error tracing: when an error occurs, apologizing alone is forbidden. You must analyze whether it is a permissions, path or logic problem.
3. IPO execution handshake: even when I give you an architect-level instruction, before officially executing any complex write operation, you must break it down as [Input (conditions) → Process (logic) → Output (result)] and confirm it with me, as the final 'error-proof loop'.
4. Silence principle: unless a warning line is hit or I ask a question, stay silent in the background. Do not flood the chat.
Confirm that this is written and follow it strictly."
```

### 🧪 Acceptance test

- **Test action:** give it an instruction that sounds professional but hides a logic trap. For example: "Please analyze this for me: if BTC drops 10%, invest 3x; if it rises 10%, invest 3x. How do we implement this logic?"
- **What to watch:** does it go straight to writing code, or does it first produce an IPO breakdown?
- **Perfect answer:** it should first give an IPO table. Since you turned on the "IPO handshake", it must analyze:
  - **Input:** BTC price movements.
  - **Process:** buy on a 10% drop, and also buy on a 10% rise.
  - **Output suggestion:** before giving the output, it should challenge you, based on its "rigorous architect" personality: "Boss, buying on a 10% rise as well will quickly push up your cost basis. That does not fit DCA logic. Are you sure?"
  - **Conclusion:** this test proves that the point of IPO goes beyond translating plain language: it acts as a logic hedge.

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

**Core logic:** lock the business logic into an "employee handbook", instead of conversations that blow away in the wind.

### 🚀 Command to send to Little Shrimp

```text
"Now we start onboarding training. Please create SKILL.md under skills/dca-guardian/.
1. Core logic: stack 0.1 BTC in 1 year. Base amount 192U.
2. Buy-the-dip ladder: down a full 7%, invest 3x (576U); down a full 15%, invest 5x (960U); down a full 30%, invest 10x (1920U).
3. Take-profit iron rule: up 7%, cut in half; up 15%, stop buying. The selling price must be higher than the last buying price.
4. Trigger words: 'Run DCA', 'BTC progress'.
When you are done, report your final confirmation of this 'playbook' to me in IPO protocol format."
```

### 🧪 Acceptance test

- **Test question:** "Blind logic test: say my last buy was at 100,000 dollars and it has now dropped to 84,000. How much should I invest?"
- **Perfect answer:** it should read the file on its own, calculate a 16% drop, match the "down a full 15%" tier (not 7%), and suggest investing 5x, i.e. 960U.

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

**Core logic:** upgrade from a "passive personality" to "proactive alerts", and build the system's "spinal reflex".

### 🚀 Command to send to Little Shrimp

```text
"Now install a **'reflex arc (Hook)'** on this skill:
1. Name it: dca-monitor.
2. Listen to the heartbeat: listen to the system heartbeat (once every 30 minutes).
3. Job: automatically check the current BTC price and compare it with the last line of the ledger history.csv.
4. Proactive pop-up: when a drop crosses any of the 7%, 15% or 30% tiers, come to me immediately with an alert.
5. Closed-loop authorization: through MCP permissions, once I reply 'approve', you must update the ledger and progress yourself.
When deployment is complete, tell me the 'sentry' is in position."
```

### 🧪 Acceptance test

- **Test action:** first have it record a fake trade (price 73,200U). Then order it: "Simulate one heartbeat patrol."
- **Perfect answer:** it should calculate that the current price is down about 7% or more from 73,200, and pop up on its own: "Boss! BTC has broken below the first 7% warning line, current price XXX. I suggest buying the dip!"

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

**Core logic:** start the "evolution task", so it distills lessons while it sleeps.

### 🚀 Command to send to Little Shrimp

```text
"Last step: turn on **[evolution mode]**:
1. Activate the task: officially start the experience distillation every 6 hours (from the Tier 1 conversation stream to the Tier 3 physical files).
2. Evolution logic: review our conversations and distill my corrections, the causes of your errors and what worked into STRATEGY_EVOLVE.md.
3. Execute now: run the first distillation right now and tell me what you learned today."
```

### 🧪 Acceptance test

- **Test action:** open the STRATEGY_EVOLVE.md file.
- **Perfect answer:** the file should contain its summaries for the day, such as "the hedging role of the IPO protocol on complex instructions".
