360 Secure SkillHub
360 安全技能中心

Bear Share Sync

该 Skill 提供三步流水线:轮询 Bear 中带 #share 标签的新笔记并维护已处理状态,把笔记追加为 JSON Canvas 知识节点,再经 BlueBubbles 发送标题与正文前 280 字符的预览;支持环境变量配置与定时调度,需预先安装 grizzly CLI 并配置通道。

terrycarter1985
terrycarter1985
热度 51.12
最近更新 2026-05-18 11:52:48
分类:知识依赖:代码执行 / 读写文件 / 第三方 API应用场景:笔记整理 / 工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add bear-share-sync
Metadata
name
bear-share-sync
description
Detect new Bear notes tagged

Bear Share Sync

Three-step pipeline: Bear #share → Canvas node → iMessage preview.

Prerequisites

  • Bear running with grizzly CLI installed and token configured (~/.config/grizzly/token)
  • BlueBubbles channel configured in OpenClaw gateway (channels.bluebubbles)
  • Canvas file at canvases/agent_capabilities.canvas (created on first run if missing)

Configuration

Set environment variables (or defaults apply):

Variable Default Purpose
BEAR_SHARE_TAG share Bear tag to watch
BEAR_SHARE_CANVAS canvases/agent_capabilities.canvas Path to canvas file
BEAR_SHARE_TARGET (required) iMessage target: E.164 phone, email, or chat_guid:...
BEAR_SHARE_STATE ~/.bear-share-sync/state.json Tracks processed note IDs

Workflow

1. Poll for new #share notes

bash scripts/poll-share-notes.sh

Outputs JSON array of unprocessed notes (id, title, content, tags). Updates state file to mark notes as seen.

2. Update canvas

For each new note, append a knowledge node to the canvas. Run:

python3 scripts/update-canvas.py --canvas "$BEAR_SHARE_CANVAS" --notes /dev/stdin

Node layout: new nodes placed at Y = max(existing Y) + 200, X = 0. Node color = "4" (green). Edge from a central "Shared Notes" group node if present.

See references/canvas-schema.md for the JSON Canvas structure.

3. Send preview via BlueBubbles

bash scripts/send-preview.sh "<target>" "<title>" "<summary>"

Uses the message tool with channel: "bluebubbles". Sends a compact preview:

📝 New shared note: <title>

<first 280 chars of content>…

🔗 See canvas for full node.

Full Pipeline (one-shot)

NOTES=$(bash scripts/poll-share-notes.sh)
if [ "$NOTES" != "[]" ]; then
  echo "$NOTES" | python3 scripts/update-canvas.py --canvas "$BEAR_SHARE_CANVAS" --notes /dev/stdin
  echo "$NOTES" | python3 -c "
import json, sys, subprocess
for n in json.load(sys.stdin):
    subprocess.run(['bash','scripts/send-preview.sh',
        '$BEAR_SHARE_TARGET', n['title'], n['content'][:280]])
"
fi

Scheduling

Set up a cron job to poll every 15 minutes:

*/15 * * * * cd /path/to/skill && ./scripts/poll-share-notes.sh | ...

Or use OpenClaw cron with payload.kind = "agentTurn" and the pipeline command.

Notes

  • The state file prevents re-processing; delete it to re-sync all notes.
  • Canvas uses Obsidian-compatible JSON Canvas spec (see references/canvas-schema.md).
  • If BlueBubbles send fails, the canvas is still updated; check gateway logs for delivery errors.