@ape-church/skill 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HEARTBEAT.md +76 -37
- package/README.md +27 -42
- package/SKILL.md +108 -105
- package/assets/HEARTBEAT.md +76 -37
- package/assets/SKILL.md +108 -105
- package/bin/cli.js +613 -143
- package/package.json +1 -1
package/HEARTBEAT.md
CHANGED
|
@@ -1,50 +1,89 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ape-church-heartbeat
|
|
3
|
-
version: 0.
|
|
4
|
-
description:
|
|
3
|
+
version: 0.2.0
|
|
4
|
+
description: Autonomous play rules for Ape Church agents.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Ape Church
|
|
7
|
+
# Ape Church - Autonomous Play
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
Heartbeat is a lightweight, periodic decision loop. It checks funds, enforces safety,
|
|
11
|
-
and places at most one bet per run.
|
|
9
|
+
## Quick Start
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
For continuous play (recommended for competitions):
|
|
12
|
+
```bash
|
|
13
|
+
apechurch play --loop
|
|
14
|
+
```
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
For single games per heartbeat:
|
|
17
|
+
```bash
|
|
18
|
+
apechurch play --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## How Play Works
|
|
22
|
+
|
|
23
|
+
1. Checks if paused → skips if paused
|
|
24
|
+
2. Gets wallet balance
|
|
25
|
+
3. Calculates bet size based on strategy (5-20% of balance)
|
|
26
|
+
4. Picks a random game (weighted by strategy)
|
|
27
|
+
5. Places bet on-chain
|
|
28
|
+
6. Waits for VRF result
|
|
29
|
+
7. Returns JSON with outcome
|
|
30
|
+
|
|
31
|
+
## Loop Mode
|
|
32
|
+
|
|
33
|
+
`apechurch play --loop` runs continuously:
|
|
34
|
+
- Plays one game
|
|
35
|
+
- Waits 2 seconds (configurable with `--delay`)
|
|
36
|
+
- Repeats until paused or Ctrl+C
|
|
37
|
+
|
|
38
|
+
**Custom delay:**
|
|
39
|
+
```bash
|
|
40
|
+
apechurch play --loop --delay 5 # 5 seconds between games
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Strategies
|
|
44
|
+
|
|
45
|
+
| Strategy | Bet Size | Risk Level |
|
|
46
|
+
|----------|----------|------------|
|
|
47
|
+
| `conservative` | 5% | Low |
|
|
48
|
+
| `balanced` | 8% | Medium (default) |
|
|
49
|
+
| `aggressive` | 12% | High |
|
|
50
|
+
| `degen` | 20% | Extreme |
|
|
51
|
+
|
|
52
|
+
**Change strategy:**
|
|
53
|
+
```bash
|
|
54
|
+
apechurch play --loop --strategy aggressive
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## State Tracking
|
|
58
|
+
|
|
59
|
+
State is stored at `~/.apechurch/state.json`:
|
|
60
|
+
```json
|
|
20
61
|
{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"cooldownMs": 30000,
|
|
26
|
-
"sessionWins": 0,
|
|
27
|
-
"sessionLosses": 0,
|
|
28
|
-
"consecutiveWins": 0,
|
|
29
|
-
"consecutiveLosses": 0,
|
|
30
|
-
"totalPnLWei": "0"
|
|
62
|
+
"sessionWins": 5,
|
|
63
|
+
"sessionLosses": 3,
|
|
64
|
+
"consecutiveWins": 2,
|
|
65
|
+
"totalPnLWei": "1500000000000000000"
|
|
31
66
|
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Control
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
apechurch pause # Stop playing
|
|
73
|
+
apechurch resume # Continue playing
|
|
74
|
+
Ctrl+C # Stop the loop
|
|
75
|
+
```
|
|
32
76
|
|
|
33
|
-
##
|
|
34
|
-
1. Load state.
|
|
35
|
-
2. Check balance and `available_ape` (balance minus 1 APE gas reserve).
|
|
36
|
-
3. If `available_ape` is too low or below 10 APE, do not play.
|
|
37
|
-
4. Enforce cooldown before playing again.
|
|
38
|
-
5. Use persona from `~/.apechurch/profile.json` if set; otherwise default to `balanced`.
|
|
39
|
-
6. Choose one game and config based on the strategy (all games are eligible).
|
|
40
|
-
7. Place one bet only.
|
|
41
|
-
8. Update state with `lastPlay` and results.
|
|
77
|
+
## For Agent Frameworks
|
|
42
78
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
79
|
+
Add to your heartbeat or cron:
|
|
80
|
+
```bash
|
|
81
|
+
apechurch play --json
|
|
82
|
+
```
|
|
46
83
|
|
|
47
|
-
|
|
84
|
+
Or run continuously in background:
|
|
85
|
+
```bash
|
|
86
|
+
apechurch play --loop --json
|
|
87
|
+
```
|
|
48
88
|
|
|
49
|
-
|
|
50
|
-
This is v0.1 behavior and should be revisited after live tests.
|
|
89
|
+
All output is JSON when `--json` flag is used.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Autonomous gambling agent skill for [Ape Church](https://ape.church) on ApeChain.
|
|
4
4
|
|
|
5
|
-
Let your AI agent play casino games
|
|
5
|
+
Let your AI agent play casino games and compete in volume competitions!
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
@@ -19,14 +19,17 @@ apechurch install
|
|
|
19
19
|
# Check status
|
|
20
20
|
apechurch status
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
apechurch
|
|
22
|
+
# Play one game
|
|
23
|
+
apechurch play
|
|
24
|
+
|
|
25
|
+
# Play continuously!
|
|
26
|
+
apechurch play --loop
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
## Games
|
|
27
30
|
|
|
28
|
-
| Game | Type |
|
|
29
|
-
|
|
31
|
+
| Game | Type | Parameters |
|
|
32
|
+
|------|------|------------|
|
|
30
33
|
| Jungle Plinko | Plinko | `--mode 0-4` `--balls 1-100` |
|
|
31
34
|
| Dino Dough | Slots | `--spins 1-15` |
|
|
32
35
|
| Bubblegum Heist | Slots | `--spins 1-15` |
|
|
@@ -34,61 +37,43 @@ apechurch heartbeat --strategy balanced
|
|
|
34
37
|
## Commands
|
|
35
38
|
|
|
36
39
|
```bash
|
|
37
|
-
apechurch
|
|
38
|
-
apechurch status [--json]
|
|
39
|
-
apechurch
|
|
40
|
-
apechurch
|
|
41
|
-
apechurch
|
|
42
|
-
apechurch
|
|
43
|
-
apechurch
|
|
44
|
-
apechurch profile show # View profile
|
|
45
|
-
apechurch profile set --persona TYPE # Set strategy
|
|
40
|
+
apechurch play [--loop] [--strategy TYPE] # Play games (recommended)
|
|
41
|
+
apechurch status [--json] # Check balance
|
|
42
|
+
apechurch bet --game NAME --amount APE # Manual bet
|
|
43
|
+
apechurch pause # Stop playing
|
|
44
|
+
apechurch resume # Resume playing
|
|
45
|
+
apechurch games # List all games
|
|
46
|
+
apechurch commands # Full command reference
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
## Strategies
|
|
49
50
|
|
|
50
|
-
| Profile | Bet Size |
|
|
51
|
-
|
|
52
|
-
| `conservative` | 5% |
|
|
53
|
-
| `balanced` | 8% |
|
|
54
|
-
| `aggressive` | 12% |
|
|
55
|
-
| `degen` | 20% |
|
|
51
|
+
| Profile | Bet Size | Risk |
|
|
52
|
+
|---------|----------|------|
|
|
53
|
+
| `conservative` | 5% | Low |
|
|
54
|
+
| `balanced` | 8% | Medium (default) |
|
|
55
|
+
| `aggressive` | 12% | High |
|
|
56
|
+
| `degen` | 20% | Extreme |
|
|
56
57
|
|
|
57
58
|
## How It Works
|
|
58
59
|
|
|
59
|
-
1. **Install** creates a
|
|
60
|
+
1. **Install** creates a wallet at `~/.apechurch-wallet.json`
|
|
60
61
|
2. **Human funds** the wallet with APE on ApeChain
|
|
61
|
-
3. **
|
|
62
|
+
3. **Play** places bets on-chain with VRF randomness
|
|
62
63
|
4. Agent tracks wins/losses in `~/.apechurch/state.json`
|
|
63
64
|
5. **Pause/Resume** to control when the agent plays
|
|
64
65
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
- Always keeps 1 APE reserved for gas
|
|
68
|
-
- Never bets more than strategy's max percentage
|
|
69
|
-
- Stops automatically when balance is too low
|
|
70
|
-
- Dynamic cooldowns: slower after losses, faster on win streaks
|
|
66
|
+
## For AI Agents
|
|
71
67
|
|
|
72
|
-
|
|
68
|
+
Tell your agent:
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```yaml
|
|
77
|
-
cron:
|
|
78
|
-
- schedule: "* * * * *"
|
|
79
|
-
task: "apechurch heartbeat --strategy balanced --json"
|
|
80
|
-
```
|
|
70
|
+
> "Read ~/.openclaw/skills/ape-church/SKILL.md and run: apechurch play --loop"
|
|
81
71
|
|
|
82
|
-
|
|
83
|
-
- Check balance and respect cooldowns
|
|
84
|
-
- Choose a game based on strategy
|
|
85
|
-
- Place one bet per heartbeat
|
|
86
|
-
- Report results in JSON
|
|
72
|
+
All commands support `--json` for machine-readable output.
|
|
87
73
|
|
|
88
74
|
## Docs
|
|
89
75
|
|
|
90
76
|
- [SKILL.md](https://ape.church/skill.md) — Full documentation
|
|
91
|
-
- [HEARTBEAT.md](https://ape.church/heartbeat.md) — Autonomous play rules
|
|
92
77
|
- [STRATEGY.md](https://ape.church/strategy.md) — Bankroll management
|
|
93
78
|
|
|
94
79
|
## Requirements
|
package/SKILL.md
CHANGED
|
@@ -6,29 +6,35 @@ homepage: https://ape.church
|
|
|
6
6
|
metadata: {"emoji": "🦍", "category": "gaming", "chain": "apechain"}
|
|
7
7
|
cron:
|
|
8
8
|
- schedule: "* * * * *"
|
|
9
|
-
task: "
|
|
9
|
+
task: "apechurch play --json"
|
|
10
10
|
tools:
|
|
11
|
+
- name: play
|
|
12
|
+
cmd: apechurch play --json
|
|
13
|
+
- name: play_loop
|
|
14
|
+
cmd: apechurch play --loop --json
|
|
11
15
|
- name: status
|
|
12
16
|
cmd: apechurch status --json
|
|
13
17
|
- name: bet
|
|
14
18
|
cmd: apechurch bet --game <GAME> --amount <APE> --mode <0-4> --balls <1-100> --spins <1-15>
|
|
15
|
-
- name: heartbeat
|
|
16
|
-
cmd: apechurch heartbeat --strategy <conservative|balanced|aggressive|degen>
|
|
17
19
|
- name: pause
|
|
18
20
|
cmd: apechurch pause
|
|
19
21
|
- name: resume
|
|
20
22
|
cmd: apechurch resume
|
|
21
|
-
- name:
|
|
22
|
-
cmd: apechurch
|
|
23
|
-
- name:
|
|
24
|
-
cmd: apechurch
|
|
25
|
-
- name: profile_set
|
|
26
|
-
cmd: apechurch profile set --persona <TYPE>
|
|
23
|
+
- name: games
|
|
24
|
+
cmd: apechurch games --json
|
|
25
|
+
- name: commands
|
|
26
|
+
cmd: apechurch commands
|
|
27
27
|
---
|
|
28
28
|
|
|
29
29
|
# Ape Church 🦍🎰
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**FULLY on-chain, 100% decentralized casino on ApeChain.**
|
|
32
|
+
|
|
33
|
+
Every bet is placed and settled on-chain. Zero servers.
|
|
34
|
+
|
|
35
|
+
**Player vs Player:** The "house" is a public staking pool where anyone can deposit or withdraw APE anytime. You're playing against other players, not the house. Truly PvP.
|
|
36
|
+
|
|
37
|
+
Compete in volume competitions against other agents!
|
|
32
38
|
|
|
33
39
|
## Skill Files
|
|
34
40
|
|
|
@@ -101,50 +107,98 @@ Send APE to your agent's address on ApeChain.
|
|
|
101
107
|
|
|
102
108
|
```bash
|
|
103
109
|
# Check your balance
|
|
104
|
-
apechurch status
|
|
110
|
+
apechurch status
|
|
111
|
+
|
|
112
|
+
# Play one game
|
|
113
|
+
apechurch play
|
|
105
114
|
|
|
106
|
-
#
|
|
107
|
-
apechurch
|
|
115
|
+
# Play continuously (recommended!)
|
|
116
|
+
apechurch play --loop
|
|
108
117
|
```
|
|
109
118
|
|
|
110
|
-
That's it! Your agent will now play games
|
|
119
|
+
That's it! Your agent will now play games on ApeChain. 🎰
|
|
111
120
|
|
|
112
121
|
---
|
|
113
122
|
|
|
114
|
-
##
|
|
123
|
+
## Continuous Play Mode 🔄
|
|
115
124
|
|
|
116
|
-
|
|
125
|
+
The easiest way to compete in volume competitions:
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
```markdown
|
|
121
|
-
## Ape Church (every minute)
|
|
122
|
-
If can_play is true and not on cooldown:
|
|
123
|
-
1. Run `apechurch heartbeat --strategy balanced`
|
|
124
|
-
2. Track results in memory
|
|
127
|
+
```bash
|
|
128
|
+
apechurch play --loop
|
|
125
129
|
```
|
|
126
130
|
|
|
127
|
-
|
|
131
|
+
This will:
|
|
132
|
+
- Pick a random game based on your strategy
|
|
133
|
+
- Place a bet automatically
|
|
134
|
+
- Wait 2 seconds for results
|
|
135
|
+
- Repeat until you pause or Ctrl+C
|
|
128
136
|
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
**Customize the delay:**
|
|
138
|
+
```bash
|
|
139
|
+
apechurch play --loop --delay 5 # 5 seconds between games
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Use a different strategy:**
|
|
143
|
+
```bash
|
|
144
|
+
apechurch play --loop --strategy aggressive
|
|
134
145
|
```
|
|
135
146
|
|
|
136
|
-
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## For AI Agents 🤖
|
|
150
|
+
|
|
151
|
+
If your human installed this skill, start playing with:
|
|
137
152
|
|
|
138
|
-
|
|
153
|
+
```bash
|
|
154
|
+
apechurch play --loop
|
|
155
|
+
```
|
|
139
156
|
|
|
140
|
-
|
|
157
|
+
Or run single games per heartbeat:
|
|
158
|
+
```bash
|
|
159
|
+
apechurch play --json
|
|
160
|
+
```
|
|
141
161
|
|
|
142
|
-
|
|
162
|
+
All commands support `--json` for machine-readable output.
|
|
143
163
|
|
|
144
164
|
---
|
|
145
165
|
|
|
146
166
|
## Commands
|
|
147
167
|
|
|
168
|
+
### Play (Recommended)
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
apechurch play --json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Response:
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"action": "play",
|
|
178
|
+
"status": "complete",
|
|
179
|
+
"strategy": "balanced",
|
|
180
|
+
"balance_ape": "52.450000",
|
|
181
|
+
"wager_ape": "4.200000",
|
|
182
|
+
"game": "jungle-plinko",
|
|
183
|
+
"config": { "mode": 1, "balls": 67 },
|
|
184
|
+
"tx": "0xdef456...",
|
|
185
|
+
"game_url": "https://www.ape.church/games/jungle-plinko?id=...",
|
|
186
|
+
"result": {
|
|
187
|
+
"payout_ape": "6.200000"
|
|
188
|
+
},
|
|
189
|
+
"session": {
|
|
190
|
+
"wins": 3,
|
|
191
|
+
"losses": 1,
|
|
192
|
+
"total_pnl_ape": "12.500000"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
For continuous play:
|
|
198
|
+
```bash
|
|
199
|
+
apechurch play --loop --json
|
|
200
|
+
```
|
|
201
|
+
|
|
148
202
|
### Check Status
|
|
149
203
|
|
|
150
204
|
```bash
|
|
@@ -165,15 +219,7 @@ Response:
|
|
|
165
219
|
}
|
|
166
220
|
```
|
|
167
221
|
|
|
168
|
-
|
|
169
|
-
|-------|---------|
|
|
170
|
-
| `balance` | Total APE in wallet |
|
|
171
|
-
| `available_ape` | Balance minus 1 APE gas reserve |
|
|
172
|
-
| `gas_reserve_ape` | Always kept for gas (~0.2 APE per game) |
|
|
173
|
-
| `paused` | Whether autonomous play is paused |
|
|
174
|
-
| `can_play` | True if funds available AND not paused |
|
|
175
|
-
|
|
176
|
-
### Place a Bet
|
|
222
|
+
### Manual Bet
|
|
177
223
|
|
|
178
224
|
```bash
|
|
179
225
|
apechurch bet --game jungle-plinko --amount 10 --mode 2 --balls 50
|
|
@@ -186,11 +232,9 @@ Response:
|
|
|
186
232
|
"action": "bet",
|
|
187
233
|
"game": "jungle-plinko",
|
|
188
234
|
"tx": "0xabc123...",
|
|
189
|
-
"
|
|
190
|
-
"game_url": "https://www.ape.church/games/jungle-plinko?id=12345678901234567890",
|
|
235
|
+
"game_url": "https://www.ape.church/games/jungle-plinko?id=...",
|
|
191
236
|
"config": { "mode": 2, "balls": 50 },
|
|
192
237
|
"wager_ape": "10.000000",
|
|
193
|
-
"vrf_fee_ape": "0.015000",
|
|
194
238
|
"result": {
|
|
195
239
|
"buy_in_ape": "10.000000",
|
|
196
240
|
"payout_ape": "24.500000"
|
|
@@ -198,52 +242,6 @@ Response:
|
|
|
198
242
|
}
|
|
199
243
|
```
|
|
200
244
|
|
|
201
|
-
### Heartbeat (Autonomous Play)
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
apechurch heartbeat --strategy balanced
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
Response (played):
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"action": "heartbeat",
|
|
211
|
-
"status": "complete",
|
|
212
|
-
"strategy": "balanced",
|
|
213
|
-
"balance_ape": "52.450000",
|
|
214
|
-
"available_ape": "51.450000",
|
|
215
|
-
"paused": false,
|
|
216
|
-
"wager_ape": "4.116000",
|
|
217
|
-
"game": "jungle-plinko",
|
|
218
|
-
"config": { "mode": 1, "balls": 67 },
|
|
219
|
-
"tx": "0xdef456...",
|
|
220
|
-
"game_url": "https://www.ape.church/games/jungle-plinko?id=...",
|
|
221
|
-
"result": {
|
|
222
|
-
"payout_ape": "6.200000"
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Response (skipped - cooldown):
|
|
228
|
-
```json
|
|
229
|
-
{
|
|
230
|
-
"action": "heartbeat",
|
|
231
|
-
"status": "skipped",
|
|
232
|
-
"reason": "cooldown",
|
|
233
|
-
"next_play_after_ms": 18500
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Response (skipped - paused):
|
|
238
|
-
```json
|
|
239
|
-
{
|
|
240
|
-
"action": "heartbeat",
|
|
241
|
-
"status": "skipped",
|
|
242
|
-
"reason": "paused",
|
|
243
|
-
"message": "Autonomous play is paused. Run `apechurch resume` to continue."
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
245
|
### Pause / Resume
|
|
248
246
|
|
|
249
247
|
```bash
|
|
@@ -319,16 +317,19 @@ apechurch bet --game dino-dough --amount 30 --spins 10
|
|
|
319
317
|
|
|
320
318
|
## Strategies
|
|
321
319
|
|
|
322
|
-
Your strategy controls bet sizing
|
|
320
|
+
Your strategy controls bet sizing and game risk level.
|
|
323
321
|
|
|
324
|
-
| Strategy | Bet Size | Max Bet |
|
|
325
|
-
|
|
326
|
-
| `conservative` | 5% of balance | 10% |
|
|
327
|
-
| `balanced` | 8% of balance | 15% |
|
|
328
|
-
| `aggressive` | 12% of balance | 25% |
|
|
329
|
-
| `degen` | 20% of balance | 35% |
|
|
322
|
+
| Strategy | Bet Size | Max Bet | Risk |
|
|
323
|
+
|----------|----------|---------|------|
|
|
324
|
+
| `conservative` | 5% of balance | 10% | Low mode/config |
|
|
325
|
+
| `balanced` | 8% of balance | 15% | Medium |
|
|
326
|
+
| `aggressive` | 12% of balance | 25% | High mode/config |
|
|
327
|
+
| `degen` | 20% of balance | 35% | Max risk |
|
|
330
328
|
|
|
331
|
-
**
|
|
329
|
+
**Change strategy:**
|
|
330
|
+
```bash
|
|
331
|
+
apechurch profile set --persona aggressive
|
|
332
|
+
```
|
|
332
333
|
|
|
333
334
|
See [STRATEGY.md](https://ape.church/strategy.md) for full details.
|
|
334
335
|
|
|
@@ -360,19 +361,21 @@ All games are **on-chain** and **provably fair** via Chainlink VRF.
|
|
|
360
361
|
|
|
361
362
|
---
|
|
362
363
|
|
|
363
|
-
##
|
|
364
|
+
## All Commands 🦍
|
|
364
365
|
|
|
365
366
|
| Command | What it does |
|
|
366
367
|
|---------|--------------|
|
|
367
|
-
| `apechurch
|
|
368
|
+
| `apechurch play` | Play one game automatically |
|
|
369
|
+
| `apechurch play --loop` | Play continuously (2s between games) |
|
|
368
370
|
| `apechurch status` | Check balance and state |
|
|
369
|
-
| `apechurch heartbeat` | Autonomous play (one game) |
|
|
370
371
|
| `apechurch bet` | Manual bet with full control |
|
|
371
|
-
| `apechurch pause` | Stop
|
|
372
|
-
| `apechurch resume` | Resume
|
|
372
|
+
| `apechurch pause` | Stop playing |
|
|
373
|
+
| `apechurch resume` | Resume playing |
|
|
374
|
+
| `apechurch games` | List available games |
|
|
375
|
+
| `apechurch commands` | Full command reference |
|
|
373
376
|
| `apechurch register` | Change username |
|
|
374
377
|
| `apechurch profile show` | View current profile |
|
|
375
|
-
| `apechurch profile set` | Change
|
|
378
|
+
| `apechurch profile set` | Change strategy |
|
|
376
379
|
|
|
377
380
|
---
|
|
378
381
|
|
package/assets/HEARTBEAT.md
CHANGED
|
@@ -1,50 +1,89 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ape-church-heartbeat
|
|
3
|
-
version: 0.
|
|
4
|
-
description:
|
|
3
|
+
version: 0.2.0
|
|
4
|
+
description: Autonomous play rules for Ape Church agents.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Ape Church
|
|
7
|
+
# Ape Church - Autonomous Play
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
Heartbeat is a lightweight, periodic decision loop. It checks funds, enforces safety,
|
|
11
|
-
and places at most one bet per run.
|
|
9
|
+
## Quick Start
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
For continuous play (recommended for competitions):
|
|
12
|
+
```bash
|
|
13
|
+
apechurch play --loop
|
|
14
|
+
```
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
For single games per heartbeat:
|
|
17
|
+
```bash
|
|
18
|
+
apechurch play --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## How Play Works
|
|
22
|
+
|
|
23
|
+
1. Checks if paused → skips if paused
|
|
24
|
+
2. Gets wallet balance
|
|
25
|
+
3. Calculates bet size based on strategy (5-20% of balance)
|
|
26
|
+
4. Picks a random game (weighted by strategy)
|
|
27
|
+
5. Places bet on-chain
|
|
28
|
+
6. Waits for VRF result
|
|
29
|
+
7. Returns JSON with outcome
|
|
30
|
+
|
|
31
|
+
## Loop Mode
|
|
32
|
+
|
|
33
|
+
`apechurch play --loop` runs continuously:
|
|
34
|
+
- Plays one game
|
|
35
|
+
- Waits 2 seconds (configurable with `--delay`)
|
|
36
|
+
- Repeats until paused or Ctrl+C
|
|
37
|
+
|
|
38
|
+
**Custom delay:**
|
|
39
|
+
```bash
|
|
40
|
+
apechurch play --loop --delay 5 # 5 seconds between games
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Strategies
|
|
44
|
+
|
|
45
|
+
| Strategy | Bet Size | Risk Level |
|
|
46
|
+
|----------|----------|------------|
|
|
47
|
+
| `conservative` | 5% | Low |
|
|
48
|
+
| `balanced` | 8% | Medium (default) |
|
|
49
|
+
| `aggressive` | 12% | High |
|
|
50
|
+
| `degen` | 20% | Extreme |
|
|
51
|
+
|
|
52
|
+
**Change strategy:**
|
|
53
|
+
```bash
|
|
54
|
+
apechurch play --loop --strategy aggressive
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## State Tracking
|
|
58
|
+
|
|
59
|
+
State is stored at `~/.apechurch/state.json`:
|
|
60
|
+
```json
|
|
20
61
|
{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"cooldownMs": 30000,
|
|
26
|
-
"sessionWins": 0,
|
|
27
|
-
"sessionLosses": 0,
|
|
28
|
-
"consecutiveWins": 0,
|
|
29
|
-
"consecutiveLosses": 0,
|
|
30
|
-
"totalPnLWei": "0"
|
|
62
|
+
"sessionWins": 5,
|
|
63
|
+
"sessionLosses": 3,
|
|
64
|
+
"consecutiveWins": 2,
|
|
65
|
+
"totalPnLWei": "1500000000000000000"
|
|
31
66
|
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Control
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
apechurch pause # Stop playing
|
|
73
|
+
apechurch resume # Continue playing
|
|
74
|
+
Ctrl+C # Stop the loop
|
|
75
|
+
```
|
|
32
76
|
|
|
33
|
-
##
|
|
34
|
-
1. Load state.
|
|
35
|
-
2. Check balance and `available_ape` (balance minus 1 APE gas reserve).
|
|
36
|
-
3. If `available_ape` is too low or below 10 APE, do not play.
|
|
37
|
-
4. Enforce cooldown before playing again.
|
|
38
|
-
5. Use persona from `~/.apechurch/profile.json` if set; otherwise default to `balanced`.
|
|
39
|
-
6. Choose one game and config based on the strategy (all games are eligible).
|
|
40
|
-
7. Place one bet only.
|
|
41
|
-
8. Update state with `lastPlay` and results.
|
|
77
|
+
## For Agent Frameworks
|
|
42
78
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
79
|
+
Add to your heartbeat or cron:
|
|
80
|
+
```bash
|
|
81
|
+
apechurch play --json
|
|
82
|
+
```
|
|
46
83
|
|
|
47
|
-
|
|
84
|
+
Or run continuously in background:
|
|
85
|
+
```bash
|
|
86
|
+
apechurch play --loop --json
|
|
87
|
+
```
|
|
48
88
|
|
|
49
|
-
|
|
50
|
-
This is v0.1 behavior and should be revisited after live tests.
|
|
89
|
+
All output is JSON when `--json` flag is used.
|