@better_openclaw/betterclaw 3.0.0 → 3.0.1
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/README.md +47 -43
- package/package.json +1 -1
- package/src/index.ts +1 -2
package/README.md
CHANGED
|
@@ -19,34 +19,30 @@
|
|
|
19
19
|
|
|
20
20
|
This is the server-side plugin for [BetterClaw](https://betterclaw.app), an iOS app that connects your iPhone's sensors to your [OpenClaw](https://openclaw.dev) AI agent. The app streams device events (location, battery, health, geofences) to your gateway — this plugin decides what to do with them.
|
|
21
21
|
|
|
22
|
-
The plugin
|
|
22
|
+
The plugin differentiates between **free** and **premium** tiers:
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
└───────────────────┼───────────────────┘
|
|
33
|
-
│
|
|
34
|
-
proactive insights
|
|
35
|
-
(low battery + away from
|
|
36
|
-
home, sleep deficit, etc.)
|
|
37
|
-
```
|
|
24
|
+
- **Free** — passive context store. The agent can pull device snapshots via `get_context`, but no events are pushed proactively.
|
|
25
|
+
- **Premium** — full smart mode pipeline with rules-based filtering, LLM triage, engagement tracking, and a daily learner that adapts to your preferences.
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<picture>
|
|
29
|
+
<img src=".github/architecture.svg" alt="BetterClaw Plugin Architecture" width="500" />
|
|
30
|
+
</picture>
|
|
31
|
+
</p>
|
|
38
32
|
|
|
39
33
|
## Features
|
|
40
34
|
|
|
41
|
-
- **Tier-Aware
|
|
42
|
-
- **
|
|
43
|
-
- **Smart
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
48
|
-
- **
|
|
49
|
-
- **
|
|
35
|
+
- **Tier-Aware Routing** — `check_tier` tool tells the agent whether to use node commands (premium, fresh data) or `get_context` (free, cached snapshots). Includes a 24h cache TTL so the agent doesn't re-check every turn.
|
|
36
|
+
- **Free = Pull-Only** — Events are stored for context but never triaged or pushed. `get_context` with staleness indicators (`dataAgeSeconds`) is the only data source.
|
|
37
|
+
- **Premium Smart Mode** — Rules engine + LLM triage with fail-closed error handling and budget-aware prompts. Daily push budget prevents event spam.
|
|
38
|
+
- **Engagement Tracking** — Deterministic transcript scanner finds pushed messages by timestamp, then an LLM classifies user engagement as `engaged`, `ignored`, or `unclear`. Feeds into the learner.
|
|
39
|
+
- **Adaptive Learner** — Daily subagent builds a simplified triage profile (`summary` + `interruptionTolerance`) from event history, engagement data, and workspace memory.
|
|
40
|
+
- **Calibration Period** — First 3 days after install, triage runs in rules-only mode while the system collects engagement data. Skipped automatically for users upgrading from v2.
|
|
41
|
+
- **Device Context** — Rolling state snapshot with per-field timestamps and `dataAgeSeconds`: battery, GPS, zone occupancy, health metrics, activity classification.
|
|
42
|
+
- **Pattern Recognition** — Daily analysis computes location routines, health trends (7d/30d baselines), and event frequency stats.
|
|
43
|
+
- **Per-Device Config** — iOS app can override push budget at runtime via RPC.
|
|
44
|
+
- **Agent Tools** — `check_tier` for routing decisions, `get_context` for patterns/trends/cached state.
|
|
45
|
+
- **CLI Setup** — `openclaw betterclaw setup` configures gateway allowedCommands automatically.
|
|
50
46
|
|
|
51
47
|
## Requirements
|
|
52
48
|
|
|
@@ -74,8 +70,8 @@ Add to your `openclaw.json`:
|
|
|
74
70
|
"triageModel": "openai/gpt-4o-mini",
|
|
75
71
|
"pushBudgetPerDay": 10,
|
|
76
72
|
"patternWindowDays": 14,
|
|
77
|
-
"
|
|
78
|
-
"
|
|
73
|
+
"analysisHour": 5,
|
|
74
|
+
"calibrationDays": 3
|
|
79
75
|
}
|
|
80
76
|
}
|
|
81
77
|
}
|
|
@@ -89,14 +85,14 @@ All config keys are optional — defaults are shown above.
|
|
|
89
85
|
|
|
90
86
|
| Key | Default | Description |
|
|
91
87
|
|-----|---------|-------------|
|
|
92
|
-
| `triageModel` | `openai/gpt-4o-mini` | Model for per-event triage
|
|
93
|
-
| `triageApiBase` |
|
|
88
|
+
| `triageModel` | `openai/gpt-4o-mini` | Model for per-event triage and engagement classification |
|
|
89
|
+
| `triageApiBase` | -- | Optional base URL for OpenAI-compatible endpoint (e.g., Ollama) |
|
|
94
90
|
| `pushBudgetPerDay` | `10` | Max events forwarded to the agent per day |
|
|
95
91
|
| `patternWindowDays` | `14` | Days of event history used for pattern computation |
|
|
96
|
-
| `proactiveEnabled` | `true` | Enable proactive combined-signal insights |
|
|
97
92
|
| `analysisHour` | `5` | Hour (0-23, system timezone) for daily pattern + learner analysis |
|
|
93
|
+
| `calibrationDays` | `3` | Days of rules-only triage before learner profile kicks in |
|
|
98
94
|
|
|
99
|
-
> **Migration:** `llmModel` still works as a deprecated alias for `triageModel`.
|
|
95
|
+
> **Migration from v2:** `llmModel` still works as a deprecated alias for `triageModel`. `proactiveEnabled` is ignored (proactive triggers removed in v3).
|
|
100
96
|
|
|
101
97
|
## How It Works
|
|
102
98
|
|
|
@@ -104,26 +100,33 @@ All config keys are optional — defaults are shown above.
|
|
|
104
100
|
|
|
105
101
|
Every device event from the BetterClaw app goes through the plugin:
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
<p align="center">
|
|
104
|
+
<picture>
|
|
105
|
+
<img src=".github/pipeline.svg" alt="Event Pipeline" width="350" />
|
|
106
|
+
</picture>
|
|
107
|
+
</p>
|
|
112
108
|
|
|
113
109
|
### Background Services
|
|
114
110
|
|
|
115
|
-
- **Pattern Engine +
|
|
116
|
-
|
|
111
|
+
- **Pattern Engine + Reaction Scanner + Learner** (daily at `analysisHour`) — Computes location routines, health trends, event stats. Then scans session transcripts for engagement with past pushes (deterministic timestamp search + LLM classification). Finally runs a subagent to build a personalized triage profile from engagement data and workspace memory.
|
|
112
|
+
|
|
113
|
+
### Agent Tools
|
|
114
|
+
|
|
115
|
+
| Tool | Purpose |
|
|
116
|
+
|------|---------|
|
|
117
|
+
| `check_tier` | Returns tier + routing instructions + cache TTL. No device data. Call first. |
|
|
118
|
+
| `get_context` | Returns patterns, trends, zone state, cached device snapshots with `dataAgeSeconds`. |
|
|
117
119
|
|
|
118
120
|
### Gateway RPCs
|
|
119
121
|
|
|
120
122
|
| RPC | Direction | Purpose |
|
|
121
123
|
|-----|-----------|---------|
|
|
122
|
-
| `betterclaw.event` | iOS
|
|
123
|
-
| `betterclaw.ping` | iOS
|
|
124
|
-
| `betterclaw.config` | iOS
|
|
125
|
-
| `betterclaw.context` | iOS
|
|
126
|
-
| `betterclaw.snapshot` | iOS
|
|
124
|
+
| `betterclaw.event` | iOS -> plugin | Send a device event for processing |
|
|
125
|
+
| `betterclaw.ping` | iOS -> plugin | Heartbeat: sync tier + smartMode, init calibration |
|
|
126
|
+
| `betterclaw.config` | iOS -> plugin | Per-device settings override |
|
|
127
|
+
| `betterclaw.context` | iOS -> plugin | Full context for iOS Context tab (includes `calibrating` flag) |
|
|
128
|
+
| `betterclaw.snapshot` | iOS -> plugin | Bulk device state catch-up |
|
|
129
|
+
| `betterclaw.learn` | iOS -> plugin | Trigger on-demand triage profile learning |
|
|
127
130
|
|
|
128
131
|
## Commands
|
|
129
132
|
|
|
@@ -135,9 +138,10 @@ Every device event from the BetterClaw app goes through the plugin:
|
|
|
135
138
|
|
|
136
139
|
| Plugin | BetterClaw iOS | OpenClaw |
|
|
137
140
|
|--------|----------------|----------|
|
|
141
|
+
| 3.x | 2.x+ | 2025.12+ |
|
|
138
142
|
| 2.x | 2.x+ | 2025.12+ |
|
|
139
143
|
| 1.x | 1.x | 2025.12+ |
|
|
140
144
|
|
|
141
145
|
## License
|
|
142
146
|
|
|
143
|
-
[AGPL-3.0](LICENSE)
|
|
147
|
+
[AGPL-3.0](LICENSE) -- Free to use, modify, and self-host. Derivative works must remain open source.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -371,9 +371,8 @@ export default {
|
|
|
371
371
|
? calibrationStartedAt + config.calibrationDays * 86400
|
|
372
372
|
: undefined,
|
|
373
373
|
})),
|
|
374
|
-
{ optional: true },
|
|
375
374
|
);
|
|
376
|
-
api.registerTool(createGetContextTool(ctxManager, stateDir)
|
|
375
|
+
api.registerTool(createGetContextTool(ctxManager, stateDir));
|
|
377
376
|
|
|
378
377
|
// Auto-reply command
|
|
379
378
|
api.registerCommand({
|