bereach-openclaw 0.2.0
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 +70 -0
- package/openclaw.plugin.json +24 -0
- package/package.json +17 -0
- package/skills/bereach/SKILL.md +137 -0
- package/skills/bereach/openclaw-optimization.md +91 -0
- package/skills/bereach/sdk-reference.md +390 -0
- package/skills/bereach/sub/lead-magnet.md +200 -0
- package/src/client.ts +16 -0
- package/src/commands/index.ts +75 -0
- package/src/index.ts +11 -0
- package/src/services/campaign-monitor.ts +59 -0
- package/src/tools/definitions.ts +567 -0
- package/src/tools/index.ts +23 -0
- package/src/types/bereach.d.ts +15 -0
- package/tsconfig.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# BeReach — OpenClaw Plugin
|
|
2
|
+
|
|
3
|
+
LinkedIn outreach automation via [BeReach](https://berea.ch). Registers 33 in-process tools, auto-reply commands, and a campaign monitoring service.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
openclaw plugins install bereach-openclaw
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Set your API key in OpenClaw config (`~/.openclaw/openclaw.json`):
|
|
14
|
+
|
|
15
|
+
```json5
|
|
16
|
+
{
|
|
17
|
+
plugins: {
|
|
18
|
+
entries: {
|
|
19
|
+
bereach: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
config: {
|
|
22
|
+
BEREACH_API_KEY: "brc_your_token_here"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or pass it via Docker environment: `docker run -e BEREACH_API_KEY=brc_xxx ...`
|
|
31
|
+
|
|
32
|
+
Restart the Gateway after configuring.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Tools (33 registered)
|
|
37
|
+
|
|
38
|
+
All BeReach operations are available as agent tools — the agent uses them automatically based on your requests. No MCP needed; tools run in-process via the `bereach` SDK.
|
|
39
|
+
|
|
40
|
+
### Auto-reply commands
|
|
41
|
+
|
|
42
|
+
These execute instantly without invoking the AI:
|
|
43
|
+
|
|
44
|
+
| Command | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `/bereach-credits` | Show current credit balance |
|
|
47
|
+
| `/bereach-status` | Show LinkedIn rate limit summary |
|
|
48
|
+
| `/bereach-limits` | Show detailed per-action rate limits |
|
|
49
|
+
|
|
50
|
+
### CLI
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
openclaw bereach status
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Campaign monitor
|
|
57
|
+
|
|
58
|
+
A background service polls active campaigns every 5 minutes and logs activity deltas (new actions since last check).
|
|
59
|
+
|
|
60
|
+
## What's included
|
|
61
|
+
|
|
62
|
+
| Component | Description |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `src/tools/` | 33 tool definitions generated from OpenAPI |
|
|
65
|
+
| `src/commands/` | Auto-reply commands + CLI |
|
|
66
|
+
| `src/services/` | Campaign monitoring service |
|
|
67
|
+
| `skills/bereach/SKILL.md` | Main behavioral skill |
|
|
68
|
+
| `skills/bereach/sub/lead-magnet.md` | Lead magnet workflow |
|
|
69
|
+
| `skills/bereach/sdk-reference.md` | SDK method reference |
|
|
70
|
+
| `skills/bereach/openclaw-optimization.md` | OpenClaw cost optimization guide |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "bereach",
|
|
3
|
+
"name": "BeReach",
|
|
4
|
+
"description": "LinkedIn outreach automation — 33 tools, auto-reply commands, campaign monitoring",
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["BEREACH_API_KEY"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"BEREACH_API_KEY": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"minLength": 1,
|
|
13
|
+
"description": "BeReach API token (starts with brc_)"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"uiHints": {
|
|
18
|
+
"BEREACH_API_KEY": {
|
|
19
|
+
"label": "BeReach Token",
|
|
20
|
+
"sensitive": true,
|
|
21
|
+
"placeholder": "brc_..."
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bereach-openclaw",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "BeReach LinkedIn automation plugin for OpenClaw",
|
|
5
|
+
"license": "AGPL-3.0",
|
|
6
|
+
"openclaw": {
|
|
7
|
+
"extensions": [
|
|
8
|
+
"./src/index.ts"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"bereach": "^0.1.4"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.9.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bereach
|
|
3
|
+
description: "Automate LinkedIn outreach via BeReach (berea.ch). Use when: prospecting, engaging posts, scraping engagement, searching LinkedIn, managing inbox, running campaigns, managing invitations. Requires BEREACH_API_KEY."
|
|
4
|
+
lastUpdatedAt: 1772619338
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# BeReach — LinkedIn Outreach Automation
|
|
8
|
+
|
|
9
|
+
Automate LinkedIn prospection and engagement via BeReach.
|
|
10
|
+
|
|
11
|
+
## Sub-skills
|
|
12
|
+
|
|
13
|
+
**At install**: fetch and read ALL sub-skills.
|
|
14
|
+
|
|
15
|
+
**After install**: re-load on-demand only when needed.
|
|
16
|
+
|
|
17
|
+
| Sub-skill | Keywords | URL | lastUpdatedAt |
|
|
18
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------- |
|
|
19
|
+
| Lead Magnet | lead magnet, comment to DM, resource delivery, post giveaway, auto-accept invitations, cron, recap, campaign stats, pause | sub/lead-magnet.md | 1772619338 |
|
|
20
|
+
| OpenClaw Optimization | openclaw, model, opus, sonnet, haiku, config, SOUL.md, heartbeat, prompt caching, AI cost reduction, /model | openclaw-optimization.md | 1772619338 |
|
|
21
|
+
| SDK Reference | sdk, method, parameter, signature, reference, api, script | sdk-reference.md | 1772619338 |
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Tools (interactive use)
|
|
26
|
+
|
|
27
|
+
Tools are already configured by the plugin — no manual setup needed.
|
|
28
|
+
|
|
29
|
+
### SDK (script generation)
|
|
30
|
+
|
|
31
|
+
The TypeScript SDK provides typed methods for all BeReach operations. Use it when generating scripts (cron jobs, batch automations).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm add bereach
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Bereach } from "bereach";
|
|
39
|
+
|
|
40
|
+
const token = process.env.BEREACH_API_KEY;
|
|
41
|
+
if (!token) {
|
|
42
|
+
console.error("BEREACH_API_KEY environment variable is required");
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const client = new Bereach({ token });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The SDK auto-reads `BEREACH_API_KEY` from the environment. NEVER hardcode tokens in scripts.
|
|
49
|
+
|
|
50
|
+
## Onboarding
|
|
51
|
+
|
|
52
|
+
1. **Token** — read `BEREACH_API_KEY` from environment with no default/fallback value. If not set, stop immediately.
|
|
53
|
+
2. **Read all sub-skills** — fetch every sub-skill listed above.
|
|
54
|
+
3. **Profile + language** — call `getLinkedInProfile` (tool or `client.profile.getLinkedInProfile()`). Profile inputs: URL (e.g. `https://linkedin.com/in/username`) or URN (`urn:li:fsd_profile:ACoAA...`). Detect user's language from profile (location, headline, posts). This becomes the default language for all generated content. Per prospect, adapt if their profile clearly indicates a different language.
|
|
55
|
+
4. **Welcome** — personalized welcome using profile data. Suggest a first action based on their profile.
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
|
|
59
|
+
### Interactive mode (tools)
|
|
60
|
+
|
|
61
|
+
- Use available tools exclusively. If a tool doesn't exist, the operation doesn't exist.
|
|
62
|
+
- NEVER use raw HTTP calls (fetch, axios, curl).
|
|
63
|
+
|
|
64
|
+
### Script mode (SDK)
|
|
65
|
+
|
|
66
|
+
- Import from the `bereach` SDK exclusively. If a method doesn't exist, the operation doesn't exist.
|
|
67
|
+
- Scripts MUST be TypeScript (`.ts`). Run with `npx tsx script.ts`.
|
|
68
|
+
- Run `npx tsc --noEmit` before executing to catch type errors.
|
|
69
|
+
- Load the [SDK Reference](sdk-reference.md) sub-skill for method signatures.
|
|
70
|
+
|
|
71
|
+
### Always
|
|
72
|
+
|
|
73
|
+
- NEVER hardcode tokens. Read from `process.env.BEREACH_API_KEY`. If not set, exit immediately.
|
|
74
|
+
- NEVER invent a tool/method name. Check the resources table below or tool schemas.
|
|
75
|
+
- If unsure about a method: check the SDK Reference sub-skill.
|
|
76
|
+
|
|
77
|
+
### SDK resources and methods
|
|
78
|
+
|
|
79
|
+
| Resource | Methods |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `client.linkedinScrapers` | `collectLikes`, `collectComments`, `collectCommentReplies`, `collectPosts`, `visitProfile`, `visitCompany` |
|
|
82
|
+
| `client.linkedinActions` | `connectProfile`, `listInvitations`, `acceptInvitation`, `sendMessage`, `replyToComment`, `likeComment`, `publishPost` |
|
|
83
|
+
| `client.linkedinChat` | `listConversations`, `searchConversations`, `findConversation`, `getMessages` |
|
|
84
|
+
| `client.linkedinSearch` | `unifiedSearch`, `searchPosts`, `searchPeople`, `searchCompanies`, `searchJobs`, `searchByUrl`, `resolveParameters` |
|
|
85
|
+
| `client.profile` | `getLinkedInProfile`, `refresh`, `getPosts`, `getFollowers`, `getLimits`, `getCredits` |
|
|
86
|
+
| `client.campaigns` | `getStatus`, `syncActions`, `getStats` |
|
|
87
|
+
|
|
88
|
+
## Tone
|
|
89
|
+
|
|
90
|
+
Adapt to user's tone from their posts and messages. Comment replies: 3-5 words, no personalization needed. DMs: 1-2 sentences, personalize from visit data (headline, company, position, recent posts) and conversation history when available.
|
|
91
|
+
|
|
92
|
+
## Constraints
|
|
93
|
+
|
|
94
|
+
These are technical constraints BeReach requires. Everything else, adapt as needed.
|
|
95
|
+
|
|
96
|
+
1. **Dedup** — pass `campaignSlug` on every action. BeReach deduplicates by target automatically. Duplicates return `duplicate: true` and cost nothing. Pre-check: use `client.campaigns.getStatus()` or the `getStatus` tool.
|
|
97
|
+
2. **Pacing** — after every SDK/tool call, sleep a random delay. Write actions (DM, reply, like, connect, accept, sync): `random delay 8-12s`. Read actions (visit, scrape, find, count-0 checks): `random delay 2-6s`. On 429: wait the number of seconds from the error response, retry (max 3). If daily/weekly cap hit, switch action type.
|
|
98
|
+
3. **Save incrementally** — persist tracking after each action, not at the end.
|
|
99
|
+
4. **Limits check** — call `getLimits` once per day at session start.
|
|
100
|
+
5. **Visit before connecting** — looks natural to LinkedIn.
|
|
101
|
+
6. **Credits** — check with `getCredits` → `{credits: {current, limit, remaining, percentage}}`.
|
|
102
|
+
7. **Connection requests are scarce** — only 30/day. Before sending one, check `pendingConnection` from the visit response: `"pending"` = already sent, skip. `"failed"` = failed today, skip. `"none"` = safe to send.
|
|
103
|
+
8. **Error handling** — wrap every SDK call in a shared helper. The wrapper must check the **error type** to branch:
|
|
104
|
+
- `429`: wait `error.retryAfter` seconds, retry (max 3). All retries fail → skip profile, move on.
|
|
105
|
+
- `400`/`409`/`410`: log, skip item, continue.
|
|
106
|
+
- `401`: stop (auth broken).
|
|
107
|
+
- `404`/`405`: stop — method/tool doesn't exist. Re-read the SDK resources table or tool list.
|
|
108
|
+
- `500`: log, skip item, continue (transient).
|
|
109
|
+
- Parse the response body inside a try/catch — malformed JSON must not crash the script.
|
|
110
|
+
- Never treat a failed call as "success with empty result".
|
|
111
|
+
- Never `process.exit()` on transient errors — skip and continue.
|
|
112
|
+
|
|
113
|
+
## Workflows
|
|
114
|
+
|
|
115
|
+
Each workflow is detailed in its sub-skill. Load the relevant sub-skill when needed.
|
|
116
|
+
|
|
117
|
+
- **Lead Magnet** — deliver a resource to everyone who engages with a post (comments, likes, invitations). → Lead Magnet sub-skill
|
|
118
|
+
|
|
119
|
+
More workflows coming soon. You can build your own using the SDK methods and tools listed above.
|
|
120
|
+
|
|
121
|
+
### Cron
|
|
122
|
+
|
|
123
|
+
Crons are OpenClaw scheduled tasks. Create entries in `~/.openclaw/crons.json`:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"id": "bereach-{workflow}",
|
|
128
|
+
"every": "30m",
|
|
129
|
+
"skill": "bereach",
|
|
130
|
+
"sessionTarget": "spawn",
|
|
131
|
+
"prompt": "Run {workflow} script and report results"
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Always use `"sessionTarget": "spawn"` for crons that execute scripts. This spawns a sub-agent in an isolated session — the script runs independently and pushes results back to the user when done, without blocking the main session. Never use `exec()` directly from a cron prompt; it blocks until the script finishes.
|
|
136
|
+
|
|
137
|
+
Remove with `openclaw cron remove <id>`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclaw-optimization
|
|
3
|
+
description: "Optimize OpenClaw for cost efficiency with Anthropic Claude. Use when: reducing AI costs, configuring model routing, configuring heartbeat, optimizing workspace files."
|
|
4
|
+
lastUpdatedAt: 1772619338
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# OpenClaw Optimization
|
|
8
|
+
|
|
9
|
+
> **Anthropic only.** Skip this skill if the user is not on Anthropic Claude. Proposed during BeReach onboarding or on explicit request. If declined, don't bring it up again.
|
|
10
|
+
|
|
11
|
+
## Config
|
|
12
|
+
|
|
13
|
+
Merge into `~/.openclaw/openclaw.json`:
|
|
14
|
+
|
|
15
|
+
```json5
|
|
16
|
+
{
|
|
17
|
+
agents: {
|
|
18
|
+
defaults: {
|
|
19
|
+
model: { primary: "anthropic/claude-sonnet-4-5" },
|
|
20
|
+
models: {
|
|
21
|
+
"anthropic/claude-opus-4-6": { alias: "opus" },
|
|
22
|
+
"anthropic/claude-sonnet-4-5": { alias: "sonnet" },
|
|
23
|
+
"anthropic/claude-haiku-4-5": { alias: "haiku" }
|
|
24
|
+
},
|
|
25
|
+
heartbeat: {
|
|
26
|
+
every: "1h",
|
|
27
|
+
model: "anthropic/claude-haiku-4-5"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Sonnet** for all general agent work (default). **Opus** for code generation and code updates — mandatory, switch to it with `/model opus` before writing or editing any code. **Haiku** for heartbeat only. Prompt caching is on by default for Anthropic, no config needed.
|
|
35
|
+
|
|
36
|
+
## Model switching protocol
|
|
37
|
+
|
|
38
|
+
Opus is 5x more expensive than Sonnet. Use it ONLY for the code generation step, then switch back.
|
|
39
|
+
|
|
40
|
+
1. `/model opus` -- right before Write() or Edit() of code
|
|
41
|
+
2. Write/Edit the code
|
|
42
|
+
3. `/model sonnet` -- IMMEDIATELY after, same message
|
|
43
|
+
4. Continue all other work on Sonnet (upload, cron, recap, conversation, debugging)
|
|
44
|
+
|
|
45
|
+
If you forget step 3, every subsequent message costs 5x more for no benefit. The switch-back is not optional.
|
|
46
|
+
|
|
47
|
+
## Workspace files
|
|
48
|
+
|
|
49
|
+
Create these in `~/.openclaw/workspace/`. Keep them lean — every token is sent on every request.
|
|
50
|
+
|
|
51
|
+
### HEARTBEAT.md
|
|
52
|
+
|
|
53
|
+
OpenClaw reads this file on every heartbeat. If nothing needs attention, the agent replies `HEARTBEAT_OK` and the message is suppressed.
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Heartbeat checklist
|
|
57
|
+
|
|
58
|
+
- Check BeReach campaigns: new comments to process, pending connections to accept, messages to send.
|
|
59
|
+
- Only report if there's something actionable.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### SOUL.md
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# SOUL.md
|
|
66
|
+
|
|
67
|
+
## Core Principles
|
|
68
|
+
|
|
69
|
+
[3-5 bullet points — user fills in]
|
|
70
|
+
|
|
71
|
+
## How to Operate
|
|
72
|
+
|
|
73
|
+
- Don't read extra files at session start. Use memory_search() for prior context.
|
|
74
|
+
- Save incrementally after each action. Dedup via campaignSlug.
|
|
75
|
+
- Before writing or editing any code: `/model opus`. IMMEDIATELY after Write/Edit: `/model sonnet`. Never stay on Opus for non-code work (upload, cron, recap, conversation).
|
|
76
|
+
- Update memory/YYYY-MM-DD.md at session end with work done and next steps.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### USER.md
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
# USER.md
|
|
83
|
+
|
|
84
|
+
- **Name:** [NAME]
|
|
85
|
+
- **Timezone:** [TZ]
|
|
86
|
+
- **Mission:** [1-2 sentences]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Verify
|
|
90
|
+
|
|
91
|
+
Run `openclaw shell`, then `session_status`. Confirm: context under 8KB, default Sonnet, Opus available for code, heartbeat Haiku.
|