Skip to content
Open
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Changes sourced from upstream (openclaw/openclaw) are labeled with the originati

## [Unreleased]

### Added

- **contact-check skill**: before the Day 1 cold email to a new address, checks whether that email is allowed under UK PECR, US CAN-SPAM, Canada's CASL, Germany's UWG or France's rules, using [Precleared](https://precleared.dev). Exit codes let scripts gate on the verdict, and the receipt id goes in the CRM notes. Off by default: setting `PRECLEARED_SENDER_COUNTRY` (GB or US) turns it on, and Stage 9 of `AGENTS.md` then runs it before the first email. Node 18+, no dependencies; works without a key (10 checks a day) or with a free key (25 a day).

## 2026-06-12 — OpenClaw v2026.6.6 upstream sync

Upstream: [openclaw/openclaw v2026.6.6](https://github.com/openclaw/openclaw/releases/tag/v2026.6.6) — 77 commits; security hardening, multi-channel delivery stability, Claude Fable 5, and UI performance.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ Pre-built capabilities that extend your AI SDR:
| **sdr-humanizer** | Rules for natural conversation — pacing, cultural adaptation, anti-patterns. |
| **lead-discovery** | AI-driven lead discovery. Web search for potential buyers, ICP evaluation, CRM auto-entry. |
| **quotation-generator** | Auto-generate PDF proforma invoices with company letterhead, multi-language support. |
| **contact-check** | Optional. Checks whether a cold email to a new address is allowed (UK, US, Canada, Germany, France) before the first email, with the rule and a receipt. Off until you set `PRECLEARED_SENDER_COUNTRY`. Powered by [Precleared](https://precleared.dev). |
| **graphify** | Knowledge graph engine — map product relationships, customer intelligence, and market research into queryable graphs. Powered by [graphify](https://github.com/safishamsi/graphify). |

### Skill Profiles
Expand Down
4 changes: 4 additions & 0 deletions deploy/config.sh.example
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ CHROMA_COLLECTION="conversation_history"
# ─── Jina AI (Web Search + Content Extraction) ──────────
JINA_API_KEY="" # Get free key at https://jina.ai/

# ─── Precleared (Cold Email Permission Check, optional) ──
PRECLEARED_API_KEY="" # Optional. Free key at https://precleared.dev/get-key
PRECLEARED_SENDER_COUNTRY="" # GB or US turns contact-check on; empty keeps it off

# ─── Supermemory (Research Storage) ─────────────────────
SUPERMEMORY_API_KEY="" # Get at https://supermemory.ai/
SUPERMEMORY_SPACE="" # Your space name
Expand Down
26 changes: 26 additions & 0 deletions scripts/validate-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ for file in \
workspace/MEMORY.md workspace/HEARTBEAT.md workspace/TOOLS.md \
deploy/config.sh.example deploy/deploy.sh deploy/doctor.sh deploy/generate-config.sh deploy/skill-profiles.sh \
skills/chroma-memory/SKILL.md skills/chroma-memory/chroma.mjs \
skills/contact-check/SKILL.md skills/contact-check/check.mjs \
product-kb/catalog.json product-kb/scripts/generate-pi.js
do
require_file "$file"
Expand Down Expand Up @@ -63,6 +64,31 @@ OPENCLAW_HOME="$TMP_DIR/openclaw" node "$ROOT/skills/chroma-memory/chroma.mjs" s
jq -e 'length == 1 and .[0].has_quote == true and .[0].has_commitment == true' "$TMP_DIR/chroma-search.json" >/dev/null
pass "Chroma memory smoke test works"

node --check "$ROOT/skills/contact-check/check.mjs"
env -u PRECLEARED_SENDER_COUNTRY node "$ROOT/skills/contact-check/check.mjs" --email buyer@example.de --source published > "$TMP_DIR/contact-check-off.json"
jq -e '.skipped == true and .send == true' "$TMP_DIR/contact-check-off.json" >/dev/null
node "$ROOT/skills/contact-check/check.mjs" --email buyer@example.de --source published --country de --sender GB --dry-run > "$TMP_DIR/contact-check.json"
jq -e '.dry_run == true and .payload.address_source == "published" and .payload.recipient_country == "DE" and .payload.sender_country == "GB"' "$TMP_DIR/contact-check.json" >/dev/null
if node "$ROOT/skills/contact-check/check.mjs" --email buyer@example.de --source guessed --sender GB > /dev/null; then
fail "contact-check accepted an invalid --source"
fi
pass "Contact check skill parses and builds requests"

CONTACT_CHECK="$ROOT/skills/contact-check/check.mjs" node --input-type=module -e '
import assert from "node:assert/strict";
import { pathToFileURL } from "node:url";
const { summarise } = await import(pathToFileURL(process.env.CONTACT_CHECK).href);
for (const body of [[], "ok_to_email", null, { verdict: "maybe" }, { reasons: [] }]) {
assert.equal(summarise(200, body).exitCode, 3);
}
const odd = summarise(200, { verdict: "consent_needed", reasons: { text: "x" }, next_step: 5, receipt: "cc_rcpt_X" });
assert.equal(odd.exitCode, 2);
assert.deepEqual([odd.result.rule, odd.result.next_step, odd.result.receipt_id], [null, null, null]);
assert.equal(summarise(200, { verdict: "ok_to_email", receipt: { id: "cc_rcpt_X" } }).result.receipt_id, "cc_rcpt_X");
assert.equal(summarise(429, { error: "daily_limit" }).result.error, "daily_limit");
'
pass "Contact check treats unexpected responses as unavailable"

source "$ROOT/deploy/skill-profiles.sh"
skill_list="$(get_skills_for_profile b2b_trade) chromadb"
skill_count="$(printf '%s\n' $skill_list | sort -u | wc -l | tr -d ' ')"
Expand Down
63 changes: 63 additions & 0 deletions skills/contact-check/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: contact-check
description: "Check whether a cold email to one address is allowed (UK, US, Canada, Germany, France) before the first email of a sequence. Returns a verdict, the rule, what the footer must include and a receipt id."
---

# contact-check — Cold Email Permission Check

> Before the Day 1 email to a new address, ask whether a cold email to that buyer is allowed. Germany and France want prior consent in many cases, a UK sole trader counts as an individual, and Canada's CASL depends on whether the address was published. One call per address, before the first email, and again if the pitch or where you got the address changes.

Powered by [Precleared](https://precleared.dev): a per-address verdict under UK PECR and UK GDPR, US CAN-SPAM, Canada's CASL, Germany's UWG and France's rules, with the rule quoted and a signed receipt. Nothing is sent to the buyer.

**Off by default.** The skill does nothing until `PRECLEARED_SENDER_COUNTRY` is set (see Configuration); until then it exits `0` with `"skipped": true` and the sequence carries on as before.

## Commands

| Command | Description |
|---------|-------------|
| `contact:check` | Check one address before the first cold email |

## Usage

```bash
node skills/contact-check/check.mjs --email buyer@company.de --source published --pitch "truck spare parts" --country DE
```

| Option | Required | Meaning |
|--------|----------|---------|
| `--email` | yes | The buyer's email address |
| `--source` | yes | Where the address came from: `published` (their website, a directory, a trade-show catalogue), `bought` (a purchased list), `scraped` (collected by a tool), `given` (they gave it to you) or `unknown`. It changes the verdict, so never assume `published` |
| `--pitch` | no | What you are offering, in a few words |
| `--country` | no | Buyer's two-letter country code, if known |
| `--sender` | no | `GB` or `US`, where your business is based (overrides `PRECLEARED_SENDER_COUNTRY` for one call) |
| `--existing-customer` | no | The buyer has bought from you before |
| `--dry-run` | no | Print the request without sending it |

## Reading the result

The script prints one JSON object and exits with a code you can gate on:

| Exit | Verdict | What to do |
|------|---------|------------|
| `0` | `ok_to_email`, or the check is off | Send the sequence. The footer must meet `footer_text` (who you are, a postal address, a way to opt out). It describes the requirement; write it in your own words |
| `2` | `consent_needed`, `blocked` or `unknown` | Do not email. Follow `next_step` (for example, get consent through their contact form or a channel the buyer opened) and note it in the CRM |
| `3` | none | The check could not be made (network, daily limit, an unexpected response). Do not email that lead yet: try again on the next run and carry on with replies and other leads |

Always save `receipt_id` in the CRM notes next to the lead. Anyone can open the receipt at `https://precleared.dev/r/<receipt_id>` to see what was checked and why.

## Configuration

```bash
# Optional, in .secrets/env
PRECLEARED_SENDER_COUNTRY="GB" # GB or US. Setting this turns the check on
PRECLEARED_API_KEY="" # Optional. Free key at https://precleared.dev/get-key (25 checks/day)
```

Without a key, Precleared allows 10 checks a day per server. A free key raises that to 25 a day; paid packs cover more.

## File Structure
```
contact-check/
├── SKILL.md # This file
└── check.mjs # Precleared API call (Node 18+, no dependencies)
```
164 changes: 164 additions & 0 deletions skills/contact-check/check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/usr/bin/env node
// contact-check: ask Precleared whether a cold email to one address is allowed.
//
// Usage:
// node check.mjs --email buyer@company.de --source published [--pitch "..."] \
// [--country DE] [--sender GB|US] [--existing-customer] [--dry-run]
//
// Prints one JSON object. Exit codes, so scripts can gate on the result:
// 0 ok_to_email (send, with a footer that meets footer_text), or the check is switched off
// 2 do not send: consent_needed, blocked or unknown
// 3 check unavailable: network error, daily limit, bad key or an unexpected response (try again later)
// 1 usage error
//
// Env: PRECLEARED_SENDER_COUNTRY (GB or US). The check is off until this is set.
// PRECLEARED_API_KEY (optional, free key at https://precleared.dev/get-key).

import { realpathSync } from "node:fs";
import { pathToFileURL } from "node:url";

const API_URL = process.env.PRECLEARED_API_URL || "https://precleared.dev/api/v1/check";
const SOURCES = ["published", "bought", "scraped", "given", "unknown"];
const SENDERS = ["GB", "US"];
const VERDICTS = ["ok_to_email", "consent_needed", "blocked", "unknown"];
const TIMEOUT_MS = 30000;

export function parseArgs(argv) {
const opts = { existingCustomer: false, dryRun: false };
for (let i = 0; i < argv.length; i++) {
const arg = argv[i];
const next = () => {
const value = argv[++i];
if (value === undefined || value.startsWith("--")) throw new Error(`Missing value for ${arg}`);
return value;
};
if (arg === "--email") opts.email = next();
else if (arg === "--source") opts.source = next();
else if (arg === "--pitch") opts.pitch = next();
else if (arg === "--country") opts.country = next();
else if (arg === "--sender") opts.sender = next();
else if (arg === "--existing-customer") opts.existingCustomer = true;
else if (arg === "--dry-run") opts.dryRun = true;
else throw new Error(`Unknown option: ${arg}`);
}
return opts;
}

export function senderFrom(opts, env = process.env) {
return (opts.sender || env.PRECLEARED_SENDER_COUNTRY || "").trim().toUpperCase();
}

export function buildPayload(opts, sender) {
const email = (opts.email || "").trim();
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) throw new Error("--email must be a full email address");
const source = (opts.source || "").trim().toLowerCase();
if (!SOURCES.includes(source)) throw new Error(`--source must be one of: ${SOURCES.join(", ")}`);
if (!SENDERS.includes(sender)) throw new Error("--sender (or PRECLEARED_SENDER_COUNTRY) must be GB or US");
const payload = {
recipient_email: email,
sender_country: sender,
address_source: source,
existing_customer: Boolean(opts.existingCustomer),
};
if (opts.pitch) payload.pitch = opts.pitch.trim().slice(0, 200);
if (opts.country) {
const country = opts.country.trim().toUpperCase();
if (!/^[A-Z]{2}$/.test(country)) throw new Error("--country must be a two-letter code, e.g. DE");
payload.recipient_country = country;
}
return payload;
}

const isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
const text = (value) => (typeof value === "string" && value.trim() ? value.trim() : null);

export function summarise(status, body) {
// Only a JSON object with a known verdict counts as an answer. Anything else means the check
// could not be made (exit 3), so a stray response is never read as a verdict.
if (status === 200 && isObject(body) && VERDICTS.includes(body.verdict)) {
const first = Array.isArray(body.reasons) ? body.reasons[0] : null;
const reason = isObject(first) ? first : {};
return {
exitCode: body.verdict === "ok_to_email" ? 0 : 2,
result: {
verdict: body.verdict,
send: body.verdict === "ok_to_email",
rule: text(reason.text) || text(reason.note),
source: text(reason.source_title),
footer_text: text(body.footer_text),
next_step: text(body.next_step),
receipt_id: isObject(body.receipt) ? text(body.receipt.id) : null,
},
};
}
const error = isObject(body) ? body : {};
return {
exitCode: 3,
result: {
verdict: null,
send: false,
error: text(error.error) || (status === 200 ? "unexpected_response" : `http_${status}`),
message: text(error.message) || "Precleared could not answer. Do not send; try again later.",
get_key_url: text(error.get_key_url),
},
};
}

async function main() {
let payload;
let opts;
let sender;
try {
opts = parseArgs(process.argv.slice(2));
sender = senderFrom(opts);
payload = buildPayload(opts, sender || "GB");
} catch (err) {
console.log(JSON.stringify({ error: "usage", message: err.message }));
return 1;
}
if (!sender) {
console.log(
JSON.stringify({
skipped: true,
send: true,
message: "contact-check is off. Set PRECLEARED_SENDER_COUNTRY to GB or US in .secrets/env to turn it on.",
}),
);
return 0;
}
if (opts.dryRun) {
console.log(JSON.stringify({ dry_run: true, url: API_URL, payload }));
return 0;
}

const headers = { "Content-Type": "application/json", "User-Agent": "b2b-sdr-agent-template" };
if (process.env.PRECLEARED_API_KEY) headers.Authorization = `Bearer ${process.env.PRECLEARED_API_KEY}`;

let status = 0;
let body = null;
try {
const res = await fetch(API_URL, {
method: "POST",
headers,
body: JSON.stringify(payload),
signal: AbortSignal.timeout(TIMEOUT_MS),
});
status = res.status;
body = await res.json().catch(() => null);
} catch (err) {
body = { error: "unreachable", message: `Precleared unreachable: ${err.message}` };
}

const { exitCode, result } = summarise(status, body);
console.log(JSON.stringify(result));
return exitCode;
}

const invokedDirectly =
Boolean(process.argv[1]) && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;

if (invokedDirectly) {
main().then((code) => {
process.exitCode = code;
});
}
1 change: 1 addition & 0 deletions workspace/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Cold email sequence for leads with email addresses:
- **Day 7**: Direct ask (specific product recommendation based on their business)
- **Day 14**: Final follow-up (limited-time offer or new product)
Rules:
- Before the Day 1 email to a new address, run `contact-check` (see TOOLS.md). It stays off until `PRECLEARED_SENDER_COUNTRY` is set in .secrets/env; once on, it checks buyers in the UK, US, Canada, Germany and France. Send the sequence only if it exits 0, with a footer that meets `footer_text`. Exit 2: don't email; follow `next_step` and note it in the CRM. Exit 3 means the check couldn't be made: hold that lead's Day 1 email for the next run and carry on with replies and other leads. Save any `receipt_id` in the lead's notes
- Query Supermemory for company research before composing email
- Subject line must be personalized (mention company name or specific need)
- Include clear CTA in every email
Expand Down
9 changes: 9 additions & 0 deletions workspace/TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ gws gmail users messages send --params '{"userId":"me"}' --body '{"raw":"BASE64_
```
Used for: Cold email sequences, inbox monitoring for replies, formal document delivery.

## Contact Check (Cold Email Permission)
Off until `PRECLEARED_SENDER_COUNTRY` (GB or US) is set in .secrets/env. Once on, run it once per new address before the first cold email to a buyer in the UK, US, Canada, Germany or France, and again if the pitch or where you got the address changes:
```bash
node skills/contact-check/check.mjs --email buyer@company.de --source published --pitch "truck spare parts"
```
`--source` is where the address came from: `published`, `bought`, `scraped`, `given` or `unknown`. Exit code `0` means `ok_to_email` (or the check is switched off); `2` means do not email (follow `next_step`); `3` means the check could not be made: hold that email for the next run and carry on with other work. Save `receipt_id` in the CRM notes.

Optional `PRECLEARED_API_KEY` in .secrets/env (free key at https://precleared.dev/get-key): 25 checks a day instead of 10.

## Jina AI (Web Search + Content Extraction)
For proactive lead discovery and company research.

Expand Down