@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.
Files changed (3) hide show
  1. package/README.md +47 -43
  2. package/package.json +1 -1
  3. 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 is the **sole event gateway** for all tiers. Smart mode controls filtering depth: OFF = passive context store, ON = full pipeline with rules, LLM triage, and proactive insights.
22
+ The plugin differentiates between **free** and **premium** tiers:
23
23
 
24
- ```
25
- BetterClaw iOS App This Plugin (on gateway) Agent
26
- ────────────────── ──────────────────────── ────────
27
-
28
- battery ──────▶ ┌───────────────────┼───────────────────┐
29
- location ─────▶ │ Rules Engine │ Context Store │
30
- health ───────▶ │ LLM Triage │ Pattern Engine │ ──▶ filtered events
31
- geofence ─────▶ │ Daily Learner │ Proactive Triggers│ + full context
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 Smart Mode** — Smart mode ON = full pipeline (rules triage push). Smart mode OFF = passive store (context updated, no filtering or pushing). Synced via periodic heartbeat from iOS.
42
- - **Two-Layer LLM Triage** — Daily learner builds a personalized triage profile from OpenClaw memory summaries + event reactions. Per-event cheap LLM call with structured output for ambiguous events.
43
- - **Smart Filtering** — Per-source dedup, cooldown windows, and a configurable daily push budget prevent event spam
44
- - **Device Context** — Rolling state snapshot with per-field timestamps: battery, GPS, zone occupancy, health metrics, activity classification
45
- - **Pattern Recognition** — Daily analysis computes location routines, health trends (7d/30d baselines), and event frequency stats
46
- - **Proactive Insights** — Combined-signal triggers: low battery away from home, unusual inactivity, sleep deficit, routine deviations, weekly digest
47
- - **Per-Device Config** — iOS app can override push budget and proactive settings at runtime via RPC
48
- - **Agent Tool** — `get_context` tool lets your agent read the full device snapshot, tier, smart mode status, and triage profile on demand
49
- - **CLI Setup** — `openclaw betterclaw setup` configures gateway allowedCommands automatically
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
- "proactiveEnabled": true,
78
- "analysisHour": 5
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 (supports `provider/model` format) |
93
- | `triageApiBase` | | Optional base URL for OpenAI-compatible endpoint (e.g., Ollama) |
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
- 1. **Context Update** — Device context store is always updated with the latest sensor data.
108
- 2. **Smart Mode Check** — If smart mode is OFF, the event is stored and processing stops. If ON, continues.
109
- 3. **Rules Engine** — Checks dedup, cooldown timers, and daily budget. Critical events (geofence, low battery) always push. Obvious spam is dropped.
110
- 4. **LLM Triage** — Ambiguous events get a cheap LLM call with the personalized triage profile for a push/drop decision.
111
- 5. **Agent Injection** — Events that pass are injected into the agent's main session with formatted context.
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 + Daily Learner** (daily at `analysisHour`) — Computes location routines, health trends, event stats. Then runs a subagent turn to build a personalized triage profile from OpenClaw memory summaries and notification reaction data.
116
- - **Proactive Engine** (hourly) — Evaluates combined-signal conditions and fires insights when thresholds are met.
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 plugin | Send a device event for processing |
123
- | `betterclaw.ping` | iOS plugin | Heartbeat: sync tier + smartMode, get budget info |
124
- | `betterclaw.config` | iOS plugin | Per-device settings override |
125
- | `betterclaw.context` | iOS plugin | Full context for iOS Context tab |
126
- | `betterclaw.snapshot` | iOS plugin | Bulk device state catch-up |
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) Free to use, modify, and self-host. Derivative works must remain open source.
147
+ [AGPL-3.0](LICENSE) -- Free to use, modify, and self-host. Derivative works must remain open source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better_openclaw/betterclaw",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Intelligent event filtering, context tracking, and proactive triggers for BetterClaw",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
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), { optional: true });
375
+ api.registerTool(createGetContextTool(ctxManager, stateDir));
377
376
 
378
377
  // Auto-reply command
379
378
  api.registerCommand({