[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75TA6653YNJVNCSWS01NXER":3,"skill-same:01M75TA6653YNJVNCSWS01NXER":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M75TA6653YNJVNCSWS01NXER","context-bridge",null,"Compress, store, and inject conversation context blocks between AI sessions — decisions, open questions, next actions, and people — from the R1 to your local machine","ajohnsonnow\u002Fr1-warren","ajohnsonnow","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8867891?v=4","01M75T7TQ3B5VRHJF6X2Q7AWWW","Anthony Johnson","01M75T7TQPJG8YZTAVCH4SQW27",0,"MIT","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fcontext-bridge\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: context-bridge\ndescription: Compress, store, and inject conversation context blocks between AI sessions — decisions, open questions, next actions, and people — from the R1 to your local machine\nversion: 1.0.0\nauthor: rabbit-r1-skillz\n---\n\n# ContextBridge — OpenClaw Skill\n\nContextBridge lets you end any AI session by speaking your key decisions, open questions, and next steps into the R1. The R1 compresses the transcript via LLM, stores a named context block locally, and later injects that block as a structured preamble into your next AI conversation — eliminating copy-paste and context loss between sessions.\n\n## How it works\n\n1. **Capture** — At the end of a session, press PTT on the R1. Scroll to choose a context name (Project Alpha, Client Call, etc.), then speak your decisions, open questions, and next steps.\n2. **Compress** — R1 sends the transcript to this skill, which uses an LLM to extract structured fields: decisions made, open questions, next actions, people involved, and topic tags.\n3. **Store** — The compressed context block is returned to the R1 and saved in named context storage (up to 10 contexts, with optional expiry).\n4. **Browse** — Scroll through saved contexts on the R1 home screen. PTT to open a card view showing date, tags, and bullet previews.\n5. **Inject** — From the card view, press PTT to inject the context. This skill formats it as a structured block and sends it to your configured target (clipboard, Notion, or Obsidian) so your next AI conversation starts with full context.\n6. **Merge** — Double-tap PTT on the home screen to open merge mode. Select two contexts; this skill (or local merge logic) combines them into one.\n\n## Prerequisites\n\n### Required\n\n- **Node.js 20+** on your local machine\n- **OpenClaw CLI** installed and running (`openclaw serve`)\n- An **Anthropic API key** for LLM-powered compression and merging\n\n### Optional (for injection targets)\n\n- **xclip \u002F pbcopy** or Windows clipboard access — for clipboard injection\n- **Notion integration token** and a target page\u002Fdatabase ID — for Notion injection\n- **Obsidian vault path** — for Obsidian injection (writes a new note in a `_context-bridge\u002F` folder)\n\n## Local setup\n\n### 1. Install dependencies\n\n```bash\ncd ~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\nnpm install @anthropic-ai\u002Fsdk dotenv\n```\n\n### 2. Configure environment\n\nCreate `~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002F.env`:\n\n```env\n# Required\nANTHROPIC_API_KEY=sk-ant-...\n\n# Optional — Notion injection\nNOTION_TOKEN=secret_...\nNOTION_PAGE_ID=...\n\n# Optional — Obsidian injection\nOBSIDIAN_VAULT_PATH=\u002FUsers\u002Fyou\u002FDocuments\u002FMyVault\n\n# Injection target override (clipboard | notion | obsidian)\n# R1 app sends this per-inject, but this is the server-side fallback\nDEFAULT_INJECT_TARGET=clipboard\n```\n\n### 3. Register the skill\n\nAdd to `~\u002F.openclaw\u002Fopenclaw.config.json`:\n\n```json\n{\n  \"skills\": [\n    {\n      \"name\": \"context-bridge\",\n      \"path\": \"~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002Fskill.js\",\n      \"description\": \"Compress and inject conversation context blocks between AI sessions\"\n    }\n  ]\n}\n```\n\n### 4. Create the skill file\n\nCreate `~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002Fskill.js`:\n\n```javascript\n\"use strict\";\nrequire(\"dotenv\").config({ path: __dirname + \"\u002F.env\" });\nconst Anthropic = require(\"@anthropic-ai\u002Fsdk\");\nconst fs        = require(\"fs\");\nconst path      = require(\"path\");\nconst { exec }  = require(\"child_process\");\nconst { promisify } = require(\"util\");\nconst execAsync = promisify(exec);\n\nconst anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });\n\n\u002F\u002F ── Entry point called by OpenClaw ──────────────────────────\nmodule.exports = async function contextBridge(command, params, storage) {\n  switch (command) {\n    case \"compress\": return compress(params);\n    case \"inject\":   return inject(params);\n    case \"merge\":    return merge(params);\n    default:         return { error: `Unknown command: ${command}` };\n  }\n};\n\n\u002F\u002F ── COMPRESS — LLM extracts structured fields from transcript ──\nasync function compress({ transcript, name, expiryDays }) {\n  if (!transcript || !transcript.trim()) {\n    return {\n      decisions: [],\n      questions: [],\n      actions:   [],\n      people:    [],\n      tags:      [],\n      error:     null,\n    };\n  }\n\n  const prompt =\n    \"You are a context compression assistant. Extract structured information from the spoken context below.\\n\" +\n    \"Return a JSON object with these fields:\\n\" +\n    \"  decisions: string[]  — key decisions made (max 3, each under 70 chars)\\n\" +\n    \"  questions: string[]  — open questions remaining (max 3, each under 70 chars)\\n\" +\n    \"  actions:   string[]  — concrete next action items (max 3, each under 70 chars)\\n\" +\n    \"  people:    string[]  — people mentioned by name (max 4)\\n\" +\n    \"  tags:      string[]  — 1-2 short topic tags, no spaces or # (e.g. [\\\"api-design\\\", \\\"auth\\\"])\\n\" +\n    \"If a field has no content, use an empty array. Return only valid JSON, no other text.\\n\\n\" +\n    \"Spoken context:\\n\" + transcript.slice(0, 4000);\n\n  try {\n    const msg = await anthropic.messages.create({\n      model:      \"claude-haiku-4-5-20251001\",\n      max_tokens: 512,\n      messages:   [{ role: \"user\", content: prompt }],\n    });\n\n    const text   = msg.content[0]?.text?.trim() || \"{}\";\n    const match  = text.match(\u002F\\{[\\s\\S]*\\}\u002F);\n    const parsed = match ? JSON.parse(match[0]) : {};\n\n    return {\n      decisions: toStringArray(parsed.decisions, 3),\n      questions: toStringArray(parsed.questions, 3),\n      actions:   toStringArray(parsed.actions,   3),\n      people:    toStringArray(parsed.people,     4),\n      tags:      toStringArray(parsed.tags,       2),\n      error:     null,\n    };\n  } catch (e) {\n    return { error: e.message, decisions: [], questions: [], actions: [], people: [], tags: [] };\n  }\n}\n\n\u002F\u002F ── INJECT — deliver a context block to configured target ──────\nasync function inject({ contextBlock, name, target }) {\n  const dest = target || process.env.DEFAULT_INJECT_TARGET || \"clipboard\";\n\n  try {\n    if (dest === \"clipboard\") {\n      await writeToClipboard(contextBlock);\n    } else if (dest === \"notion\") {\n      await writeToNotion(name, contextBlock);\n    } else if (dest === \"obsidian\") {\n      await writeToObsidian(name, contextBlock);\n    }\n    return { ok: true, target: dest, error: null };\n  } catch (e) {\n    return { ok: false, error: e.message };\n  }\n}\n\n\u002F\u002F ── MERGE — combine two context blocks with LLM deduplication ──\nasync function merge({ contextA, contextB, mergedName }) {\n  const combined = {\n    decisions: dedup([...contextA.decisions, ...contextB.decisions]),\n    questions: dedup([...contextA.questions, ...contextB.questions]),\n    actions:   dedup([...contextA.actions,   ...contextB.actions  ]),\n    people:    dedup([...contextA.people,    ...contextB.people   ]),\n    tags:      dedup([...contextA.tags,      ...contextB.tags     ]),\n  };\n\n  \u002F\u002F If entries fit within limits, skip LLM and return local merge\n  const totalItems =\n    combined.decisions.length + combined.questions.length + combined.actions.length;\n\n  if (totalItems \u003C= 9) {\n    return {\n      decisions: combined.decisions.slice(0, 3),\n      questions: combined.questions.slice(0, 3),\n      actions:   combined.actions.slice(0, 3),\n      people:    combined.people.slice(0, 4),\n      tags:      combined.tags.slice(0, 2),\n      error:     null,\n    };\n  }\n\n  \u002F\u002F LLM dedup\u002Fconsolidation for over-full merges\n  const prompt =\n    \"Merge and deduplicate these two context blocks into one. \" +\n    \"Keep the most important items in each category (max 3 per category). \" +\n    \"Return JSON with fields: decisions, questions, actions, people (max 4), tags (max 2). \" +\n    \"Each item max 70 chars. Return only valid JSON.\\n\\n\" +\n    \"Context A (\" + contextA.name + \"):\\n\" + JSON.stringify(contextA, null, 2) + \"\\n\\n\" +\n    \"Context B (\" + contextB.name + \"):\\n\" + JSON.stringify(contextB, null, 2);\n\n  try {\n    const msg = await anthropic.messages.create({\n      model:      \"claude-haiku-4-5-20251001\",\n      max_tokens: 512,\n      messages:   [{ role: \"user\", content: prompt }],\n    });\n\n    const text   = msg.content[0]?.text?.trim() || \"{}\";\n    const match  = text.match(\u002F\\{[\\s\\S]*\\}\u002F);\n    const parsed = match ? JSON.parse(match[0]) : combined;\n\n    return {\n      decisions: toStringArray(parsed.decisions, 3),\n      questions: toStringArray(parsed.questions, 3),\n      actions:   toStringArray(parsed.actions,   3),\n      people:    toStringArray(parsed.people,     4),\n      tags:      toStringArray(parsed.tags,       2),\n      error:     null,\n    };\n  } catch (e) {\n    return {\n      ...combined,\n      decisions: combined.decisions.slice(0, 3),\n      questions: combined.questions.slice(0, 3),\n      actions:   combined.actions.slice(0, 3),\n      error:     null,\n    };\n  }\n}\n\n\u002F\u002F ── CLIPBOARD ──────────────────────────────────────────────────\nasync function writeToClipboard(text) {\n  const platform = process.platform;\n  if (platform === \"darwin\") {\n    const proc = require(\"child_process\").spawn(\"pbcopy\");\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else if (platform === \"linux\") {\n    const proc = require(\"child_process\").spawn(\"xclip\", [\"-selection\", \"clipboard\"]);\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else if (platform === \"win32\") {\n    const proc = require(\"child_process\").spawn(\"clip\");\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else {\n    throw new Error(\"Clipboard not supported on this platform\");\n  }\n}\n\n\u002F\u002F ── NOTION ─────────────────────────────────────────────────────\nasync function writeToNotion(name, contextBlock) {\n  if (!process.env.NOTION_TOKEN || !process.env.NOTION_PAGE_ID) {\n    throw new Error(\"NOTION_TOKEN and NOTION_PAGE_ID required\");\n  }\n\n  const https   = require(\"https\");\n  const body    = JSON.stringify({\n    parent: { page_id: process.env.NOTION_PAGE_ID },\n    properties: {\n      title: { title: [{ text: { content: name + \" — \" + new Date().toLocaleDateString() } }] },\n    },\n    children: [{\n      object: \"block\",\n      type: \"code\",\n      code: {\n        rich_text: [{ type: \"text\", text: { content: contextBlock } }],\n        language: \"plain text\",\n      },\n    }],\n  });\n\n  await new Promise((resolve, reject) => {\n    const req = https.request({\n      hostname: \"api.notion.com\",\n      path:     \"\u002Fv1\u002Fpages\",\n      method:   \"POST\",\n      headers: {\n        Authorization:    \"Bearer \" + process.env.NOTION_TOKEN,\n        \"Notion-Version\": \"2022-06-28\",\n        \"Content-Type\":   \"application\u002Fjson\",\n        \"Content-Length\": Buffer.byteLength(body),\n      },\n    }, res => {\n      let data = \"\";\n      res.on(\"data\", d => { data += d; });\n      res.on(\"end\", () => {\n        if (res.statusCode >= 200 && res.statusCode \u003C 300) resolve(data);\n        else reject(new Error(\"Notion error \" + res.statusCode + \": \" + data.slice(0, 200)));\n      });\n    });\n    req.on(\"error\", reject);\n    req.write(body);\n    req.end();\n  });\n}\n\n\u002F\u002F ── OBSIDIAN ───────────────────────────────────────────────────\nasync function writeToObsidian(name, contextBlock) {\n  const vaultPath = process.env.OBSIDIAN_VAULT_PATH;\n  if (!vaultPath) throw new Error(\"OBSIDIAN_VAULT_PATH not configured\");\n\n  const folder   = path.join(vaultPath, \"_context-bridge\");\n  if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });\n\n  const safeTitle = name.replace(\u002F[^a-zA-Z0-9 _-]\u002Fg, \"\").slice(0, 60);\n  const date      = new Date().toISOString().split(\"T\")[0];\n  const filename  = path.join(folder, `${date} ${safeTitle}.md`);\n\n  const content   = `# ${name}\\n_Captured ${new Date().toLocaleString()}_\\n\\n\\`\\`\\`\\n${contextBlock}\\n\\`\\`\\`\\n`;\n  fs.writeFileSync(filename, content, \"utf8\");\n}\n\n\u002F\u002F ── HELPERS ────────────────────────────────────────────────────\nfunction toStringArray(val, max) {\n  if (!Array.isArray(val)) return [];\n  return val.filter(s => typeof s === \"string\" && s.trim()).slice(0, max);\n}\n\nfunction dedup(arr) {\n  const seen = new Set();\n  return arr.filter(s => {\n    const key = s.toLowerCase().trim();\n    if (seen.has(key)) return false;\n    seen.add(key);\n    return true;\n  });\n}\n```\n\n### 5. Start OpenClaw\n\n```bash\nopenclaw serve\n```\n\nConfirm you see `context-bridge` listed among registered skills.\n\n## Command reference\n\n### `compress`\n\nSent automatically when the R1 finishes a capture session.\n\n| Field | Type | Description |\n|---|---|---|\n| `transcript` | string | Raw STT transcript from the R1 |\n| `name` | string | Context name chosen by the user |\n| `expiryDays` | number | Configured decay: 7, 30, or 0 (never) |\n\n**Response:**\n\n| Field | Type | Description |\n|---|---|---|\n| `decisions` | string[] | Key decisions extracted (max 3) |\n| `questions` | string[] | Open questions (max 3) |\n| `actions` | string[] | Next action items (max 3) |\n| `people` | string[] | People mentioned (max 4) |\n| `tags` | string[] | Topic tags (max 2) |\n| `error` | string\\|null | Error message if compression failed |\n\n---\n\n### `inject`\n\nSent when the user presses PTT on a context card.\n\n| Field | Type | Description |\n|---|---|---|\n| `contextId` | string | Internal context ID |\n| `name` | string | Context name |\n| `contextBlock` | string | Pre-formatted structured text block |\n| `target` | string | `clipboard`, `notion`, or `obsidian` |\n\n**Response:**\n\n| Field | Type | Description |\n|---|---|---|\n| `ok` | boolean | Whether injection succeeded |\n| `target` | string | Which target was used |\n| `error` | string\\|null | Error message on failure |\n\nIf injection fails, the R1 app falls back to reading the context aloud via TTS — you can dictate or type it into your AI tool manually.\n\n---\n\n### `merge`\n\nSent when the user confirms a merge of two contexts.\n\n| Field | Type | Description |\n|---|---|---|\n| `contextA` | object | First context record |\n| `contextB` | object | Second context record |\n| `mergedName` | string | Auto-generated merged name |\n\n**Response:** Same structure as `compress` response, representing the merged context.\n\n---\n\n## Injection workflow example\n\nAfter injecting a context named \"API Design Review\" to clipboard:\n\n1. Open your AI tool (Claude.ai, ChatGPT, etc.)\n2. Start a new conversation\n3. Paste the clipboard content — it looks like:\n\n```\n=== Context: API Design Review [Jun 14, 2026] ===\nDECISIONS:\n  • Use JWT for auth, not session cookies\n  • Rate limit at API gateway layer, not service level\n  • Versioning via URL prefix \u002Fv1\u002F\nOPEN QUESTIONS:\n  • How to handle token refresh in mobile clients?\n  • Should pagination be cursor-based or offset?\nNEXT ACTIONS:\n  • Draft OpenAPI spec for auth endpoints\n  • Benchmark gateway throughput under load\n  • Review OWASP API Top 10 against current design\nPEOPLE: Sarah, Marcus, Dev team\n=== End Context ===\n```\n\nThe AI immediately has full context from your previous session without any copy-paste from previous chat history.\n\n## Troubleshooting\n\n**R1 shows \"OpenClaw timeout\" and falls back to voice delivery**\n- Confirm `openclaw serve` is running\n- Both the R1 device and your machine must be on the same network\n- Check `~\u002F.openclaw\u002Flogs\u002F` for connection errors\n\n**Compression returns generic or empty fields**\n- Speak more explicitly: name decisions as \"we decided to...\", questions as \"open question:\", actions as \"next step is...\"\n- Increase your Anthropic API quota if you hit rate limits\n\n**Clipboard injection not working on Linux**\n- Install `xclip`: `sudo apt install xclip`\n- Alternatively, switch inject target to `obsidian` or `notion`\n\n**Obsidian file not appearing**\n- Confirm `OBSIDIAN_VAULT_PATH` points to the vault root (the folder containing your `.obsidian\u002F` directory)\n- Files land in `\u003Cvault>\u002F_context-bridge\u002F` — check that folder in the Obsidian file explorer\n\n**Notion injection returns 401**\n- Verify the integration has been added to the target page: open the Notion page → ··· → Add connections → select your integration\n- Confirm `NOTION_PAGE_ID` is the bare UUID from the page URL, not the full URL\n\n## Security notes\n\n- Context blocks may contain sensitive session content. Treat `ANTHROPIC_API_KEY` as a secret — never commit `.env`.\n- The skill runs exclusively on your local machine. No context data is sent anywhere except the LLM provider (for compression\u002Fmerge) and your chosen injection target.\n- OpenClaw communicates over localhost by default. Do not expose the OpenClaw port over the internet without authentication.\n- If using Notion injection, ensure the integration has minimum required permissions (insert content only).\n","# ContextBridge — OpenClaw Skill\n\nContextBridge lets you end any AI session by speaking your key decisions, open questions, and next steps into the R1. The R1 compresses the transcript via LLM, stores a named context block locally, and later injects that block as a structured preamble into your next AI conversation — eliminating copy-paste and context loss between sessions.\n\n## How it works\n\n1. **Capture** — At the end of a session, press PTT on the R1. Scroll to choose a context name (Project Alpha, Client Call, etc.), then speak your decisions, open questions, and next steps.\n2. **Compress** — R1 sends the transcript to this skill, which uses an LLM to extract structured fields: decisions made, open questions, next actions, people involved, and topic tags.\n3. **Store** — The compressed context block is returned to the R1 and saved in named context storage (up to 10 contexts, with optional expiry).\n4. **Browse** — Scroll through saved contexts on the R1 home screen. PTT to open a card view showing date, tags, and bullet previews.\n5. **Inject** — From the card view, press PTT to inject the context. This skill formats it as a structured block and sends it to your configured target (clipboard, Notion, or Obsidian) so your next AI conversation starts with full context.\n6. **Merge** — Double-tap PTT on the home screen to open merge mode. Select two contexts; this skill (or local merge logic) combines them into one.\n\n## Prerequisites\n\n### Required\n\n- **Node.js 20+** on your local machine\n- **OpenClaw CLI** installed and running (`openclaw serve`)\n- An **Anthropic API key** for LLM-powered compression and merging\n\n### Optional (for injection targets)\n\n- **xclip \u002F pbcopy** or Windows clipboard access — for clipboard injection\n- **Notion integration token** and a target page\u002Fdatabase ID — for Notion injection\n- **Obsidian vault path** — for Obsidian injection (writes a new note in a `_context-bridge\u002F` folder)\n\n## Local setup\n\n### 1. Install dependencies\n\n```bash\ncd ~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\nnpm install @anthropic-ai\u002Fsdk dotenv\n```\n\n### 2. Configure environment\n\nCreate `~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002F.env`:\n\n```env\n# Required\nANTHROPIC_API_KEY=sk-ant-...\n\n# Optional — Notion injection\nNOTION_TOKEN=secret_...\nNOTION_PAGE_ID=...\n\n# Optional — Obsidian injection\nOBSIDIAN_VAULT_PATH=\u002FUsers\u002Fyou\u002FDocuments\u002FMyVault\n\n# Injection target override (clipboard | notion | obsidian)\n# R1 app sends this per-inject, but this is the server-side fallback\nDEFAULT_INJECT_TARGET=clipboard\n```\n\n### 3. Register the skill\n\nAdd to `~\u002F.openclaw\u002Fopenclaw.config.json`:\n\n```json\n{\n  \"skills\": [\n    {\n      \"name\": \"context-bridge\",\n      \"path\": \"~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002Fskill.js\",\n      \"description\": \"Compress and inject conversation context blocks between AI sessions\"\n    }\n  ]\n}\n```\n\n### 4. Create the skill file\n\nCreate `~\u002F.openclaw\u002Fskills\u002Fcontext-bridge\u002Fskill.js`:\n\n```javascript\n\"use strict\";\nrequire(\"dotenv\").config({ path: __dirname + \"\u002F.env\" });\nconst Anthropic = require(\"@anthropic-ai\u002Fsdk\");\nconst fs        = require(\"fs\");\nconst path      = require(\"path\");\nconst { exec }  = require(\"child_process\");\nconst { promisify } = require(\"util\");\nconst execAsync = promisify(exec);\n\nconst anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });\n\n\u002F\u002F ── Entry point called by OpenClaw ──────────────────────────\nmodule.exports = async function contextBridge(command, params, storage) {\n  switch (command) {\n    case \"compress\": return compress(params);\n    case \"inject\":   return inject(params);\n    case \"merge\":    return merge(params);\n    default:         return { error: `Unknown command: ${command}` };\n  }\n};\n\n\u002F\u002F ── COMPRESS — LLM extracts structured fields from transcript ──\nasync function compress({ transcript, name, expiryDays }) {\n  if (!transcript || !transcript.trim()) {\n    return {\n      decisions: [],\n      questions: [],\n      actions:   [],\n      people:    [],\n      tags:      [],\n      error:     null,\n    };\n  }\n\n  const prompt =\n    \"You are a context compression assistant. Extract structured information from the spoken context below.\\n\" +\n    \"Return a JSON object with these fields:\\n\" +\n    \"  decisions: string[]  — key decisions made (max 3, each under 70 chars)\\n\" +\n    \"  questions: string[]  — open questions remaining (max 3, each under 70 chars)\\n\" +\n    \"  actions:   string[]  — concrete next action items (max 3, each under 70 chars)\\n\" +\n    \"  people:    string[]  — people mentioned by name (max 4)\\n\" +\n    \"  tags:      string[]  — 1-2 short topic tags, no spaces or # (e.g. [\\\"api-design\\\", \\\"auth\\\"])\\n\" +\n    \"If a field has no content, use an empty array. Return only valid JSON, no other text.\\n\\n\" +\n    \"Spoken context:\\n\" + transcript.slice(0, 4000);\n\n  try {\n    const msg = await anthropic.messages.create({\n      model:      \"claude-haiku-4-5-20251001\",\n      max_tokens: 512,\n      messages:   [{ role: \"user\", content: prompt }],\n    });\n\n    const text   = msg.content[0]?.text?.trim() || \"{}\";\n    const match  = text.match(\u002F\\{[\\s\\S]*\\}\u002F);\n    const parsed = match ? JSON.parse(match[0]) : {};\n\n    return {\n      decisions: toStringArray(parsed.decisions, 3),\n      questions: toStringArray(parsed.questions, 3),\n      actions:   toStringArray(parsed.actions,   3),\n      people:    toStringArray(parsed.people,     4),\n      tags:      toStringArray(parsed.tags,       2),\n      error:     null,\n    };\n  } catch (e) {\n    return { error: e.message, decisions: [], questions: [], actions: [], people: [], tags: [] };\n  }\n}\n\n\u002F\u002F ── INJECT — deliver a context block to configured target ──────\nasync function inject({ contextBlock, name, target }) {\n  const dest = target || process.env.DEFAULT_INJECT_TARGET || \"clipboard\";\n\n  try {\n    if (dest === \"clipboard\") {\n      await writeToClipboard(contextBlock);\n    } else if (dest === \"notion\") {\n      await writeToNotion(name, contextBlock);\n    } else if (dest === \"obsidian\") {\n      await writeToObsidian(name, contextBlock);\n    }\n    return { ok: true, target: dest, error: null };\n  } catch (e) {\n    return { ok: false, error: e.message };\n  }\n}\n\n\u002F\u002F ── MERGE — combine two context blocks with LLM deduplication ──\nasync function merge({ contextA, contextB, mergedName }) {\n  const combined = {\n    decisions: dedup([...contextA.decisions, ...contextB.decisions]),\n    questions: dedup([...contextA.questions, ...contextB.questions]),\n    actions:   dedup([...contextA.actions,   ...contextB.actions  ]),\n    people:    dedup([...contextA.people,    ...contextB.people   ]),\n    tags:      dedup([...contextA.tags,      ...contextB.tags     ]),\n  };\n\n  \u002F\u002F If entries fit within limits, skip LLM and return local merge\n  const totalItems =\n    combined.decisions.length + combined.questions.length + combined.actions.length;\n\n  if (totalItems \u003C= 9) {\n    return {\n      decisions: combined.decisions.slice(0, 3),\n      questions: combined.questions.slice(0, 3),\n      actions:   combined.actions.slice(0, 3),\n      people:    combined.people.slice(0, 4),\n      tags:      combined.tags.slice(0, 2),\n      error:     null,\n    };\n  }\n\n  \u002F\u002F LLM dedup\u002Fconsolidation for over-full merges\n  const prompt =\n    \"Merge and deduplicate these two context blocks into one. \" +\n    \"Keep the most important items in each category (max 3 per category). \" +\n    \"Return JSON with fields: decisions, questions, actions, people (max 4), tags (max 2). \" +\n    \"Each item max 70 chars. Return only valid JSON.\\n\\n\" +\n    \"Context A (\" + contextA.name + \"):\\n\" + JSON.stringify(contextA, null, 2) + \"\\n\\n\" +\n    \"Context B (\" + contextB.name + \"):\\n\" + JSON.stringify(contextB, null, 2);\n\n  try {\n    const msg = await anthropic.messages.create({\n      model:      \"claude-haiku-4-5-20251001\",\n      max_tokens: 512,\n      messages:   [{ role: \"user\", content: prompt }],\n    });\n\n    const text   = msg.content[0]?.text?.trim() || \"{}\";\n    const match  = text.match(\u002F\\{[\\s\\S]*\\}\u002F);\n    const parsed = match ? JSON.parse(match[0]) : combined;\n\n    return {\n      decisions: toStringArray(parsed.decisions, 3),\n      questions: toStringArray(parsed.questions, 3),\n      actions:   toStringArray(parsed.actions,   3),\n      people:    toStringArray(parsed.people,     4),\n      tags:      toStringArray(parsed.tags,       2),\n      error:     null,\n    };\n  } catch (e) {\n    return {\n      ...combined,\n      decisions: combined.decisions.slice(0, 3),\n      questions: combined.questions.slice(0, 3),\n      actions:   combined.actions.slice(0, 3),\n      error:     null,\n    };\n  }\n}\n\n\u002F\u002F ── CLIPBOARD ──────────────────────────────────────────────────\nasync function writeToClipboard(text) {\n  const platform = process.platform;\n  if (platform === \"darwin\") {\n    const proc = require(\"child_process\").spawn(\"pbcopy\");\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else if (platform === \"linux\") {\n    const proc = require(\"child_process\").spawn(\"xclip\", [\"-selection\", \"clipboard\"]);\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else if (platform === \"win32\") {\n    const proc = require(\"child_process\").spawn(\"clip\");\n    proc.stdin.write(text);\n    proc.stdin.end();\n    await new Promise(r => proc.on(\"close\", r));\n  } else {\n    throw new Error(\"Clipboard not supported on this platform\");\n  }\n}\n\n\u002F\u002F ── NOTION ─────────────────────────────────────────────────────\nasync function writeToNotion(name, contextBlock) {\n  if (!process.env.NOTION_TOKEN || !process.env.NOTION_PAGE_ID) {\n    throw new Error(\"NOTION_TOKEN and NOTION_PAGE_ID required\");\n  }\n\n  const https   = require(\"https\");\n  const body    = JSON.stringify({\n    parent: { page_id: process.env.NOTION_PAGE_ID },\n    properties: {\n      title: { title: [{ text: { content: name + \" — \" + new Date().toLocaleDateString() } }] },\n    },\n    children: [{\n      object: \"block\",\n      type: \"code\",\n      code: {\n        rich_text: [{ type: \"text\", text: { content: contextBlock } }],\n        language: \"plain text\",\n      },\n    }],\n  });\n\n  await new Promise((resolve, reject) => {\n    const req = https.request({\n      hostname: \"api.notion.com\",\n      path:     \"\u002Fv1\u002Fpages\",\n      method:   \"POST\",\n      headers: {\n        Authorization:    \"Bearer \" + process.env.NOTION_TOKEN,\n        \"Notion-Version\": \"2022-06-28\",\n        \"Content-Type\":   \"application\u002Fjson\",\n        \"Content-Length\": Buffer.byteLength(body),\n      },\n    }, res => {\n      let data = \"\";\n      res.on(\"data\", d => { data += d; });\n      res.on(\"end\", () => {\n        if (res.statusCode >= 200 && res.statusCode \u003C 300) resolve(data);\n        else reject(new Error(\"Notion error \" + res.statusCode + \": \" + data.slice(0, 200)));\n      });\n    });\n    req.on(\"error\", reject);\n    req.write(body);\n    req.end();\n  });\n}\n\n\u002F\u002F ── OBSIDIAN ───────────────────────────────────────────────────\nasync function writeToObsidian(name, contextBlock) {\n  const vaultPath = process.env.OBSIDIAN_VAULT_PATH;\n  if (!vaultPath) throw new Error(\"OBSIDIAN_VAULT_PATH not configured\");\n\n  const folder   = path.join(vaultPath, \"_context-bridge\");\n  if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });\n\n  const safeTitle = name.replace(\u002F[^a-zA-Z0-9 _-]\u002Fg, \"\").slice(0, 60);\n  const date      = new Date().toISOString().split(\"T\")[0];\n  const filename  = path.join(folder, `${date} ${safeTitle}.md`);\n\n  const content   = `# ${name}\\n_Captured ${new Date().toLocaleString()}_\\n\\n\\`\\`\\`\\n${contextBlock}\\n\\`\\`\\`\\n`;\n  fs.writeFileSync(filename, content, \"utf8\");\n}\n\n\u002F\u002F ── HELPERS ────────────────────────────────────────────────────\nfunction toStringArray(val, max) {\n  if (!Array.isArray(val)) return [];\n  return val.filter(s => typeof s === \"string\" && s.trim()).slice(0, max);\n}\n\nfunction dedup(arr) {\n  const seen = new Set();\n  return arr.filter(s => {\n    const key = s.toLowerCase().trim();\n    if (seen.has(key)) return false;\n    seen.add(key);\n    return true;\n  });\n}\n```\n\n### 5. Start OpenClaw\n\n```bash\nopenclaw serve\n```\n\nConfirm you see `context-bridge` listed among registered skills.\n\n## Command reference\n\n### `compress`\n\nSent automatically when the R1 finishes a capture session.\n\n| Field | Type | Description |\n|---|---|---|\n| `transcript` | string | Raw STT transcript from the R1 |\n| `name` | string | Context name chosen by the user |\n| `expiryDays` | number | Configured decay: 7, 30, or 0 (never) |\n\n**Response:**\n\n| Field | Type | Description |\n|---|---|---|\n| `decisions` | string[] | Key decisions extracted (max 3) |\n| `questions` | string[] | Open questions (max 3) |\n| `actions` | string[] | Next action items (max 3) |\n| `people` | string[] | People mentioned (max 4) |\n| `tags` | string[] | Topic tags (max 2) |\n| `error` | string\\|null | Error message if compression failed |\n\n---\n\n### `inject`\n\nSent when the user presses PTT on a context card.\n\n| Field | Type | Description |\n|---|---|---|\n| `contextId` | string | Internal context ID |\n| `name` | string | Context name |\n| `contextBlock` | string | Pre-formatted structured text block |\n| `target` | string | `clipboard`, `notion`, or `obsidian` |\n\n**Response:**\n\n| Field | Type | Description |\n|---|---|---|\n| `ok` | boolean | Whether injection succeeded |\n| `target` | string | Which target was used |\n| `error` | string\\|null | Error message on failure |\n\nIf injection fails, the R1 app falls back to reading the context aloud via TTS — you can dictate or type it into your AI tool manually.\n\n---\n\n### `merge`\n\nSent when the user confirms a merge of two contexts.\n\n| Field | Type | Description |\n|---|---|---|\n| `contextA` | object | First context record |\n| `contextB` | object | Second context record |\n| `mergedName` | string | Auto-generated merged name |\n\n**Response:** Same structure as `compress` response, representing the merged context.\n\n---\n\n## Injection workflow example\n\nAfter injecting a context named \"API Design Review\" to clipboard:\n\n1. Open your AI tool (Claude.ai, ChatGPT, etc.)\n2. Start a new conversation\n3. Paste the clipboard content — it looks like:\n\n```\n=== Context: API Design Review [Jun 14, 2026] ===\nDECISIONS:\n  • Use JWT for auth, not session cookies\n  • Rate limit at API gateway layer, not service level\n  • Versioning via URL prefix \u002Fv1\u002F\nOPEN QUESTIONS:\n  • How to handle token refresh in mobile clients?\n  • Should pagination be cursor-based or offset?\nNEXT ACTIONS:\n  • Draft OpenAPI spec for auth endpoints\n  • Benchmark gateway throughput under load\n  • Review OWASP API Top 10 against current design\nPEOPLE: Sarah, Marcus, Dev team\n=== End Context ===\n```\n\nThe AI immediately has full context from your previous session without any copy-paste from previous chat history.\n\n## Troubleshooting\n\n**R1 shows \"OpenClaw timeout\" and falls back to voice delivery**\n- Confirm `openclaw serve` is running\n- Both the R1 device and your machine must be on the same network\n- Check `~\u002F.openclaw\u002Flogs\u002F` for connection errors\n\n**Compression returns generic or empty fields**\n- Speak more explicitly: name decisions as \"we decided to...\", questions as \"open question:\", actions as \"next step is...\"\n- Increase your Anthropic API quota if you hit rate limits\n\n**Clipboard injection not working on Linux**\n- Install `xclip`: `sudo apt install xclip`\n- Alternatively, switch inject target to `obsidian` or `notion`\n\n**Obsidian file not appearing**\n- Confirm `OBSIDIAN_VAULT_PATH` points to the vault root (the folder containing your `.obsidian\u002F` directory)\n- Files land in `\u003Cvault>\u002F_context-bridge\u002F` — check that folder in the Obsidian file explorer\n\n**Notion injection returns 401**\n- Verify the integration has been added to the target page: open the Notion page → ··· → Add connections → select your integration\n- Confirm `NOTION_PAGE_ID` is the bare UUID from the page URL, not the full URL\n\n## Security notes\n\n- Context blocks may contain sensitive session content. Treat `ANTHROPIC_API_KEY` as a secret — never commit `.env`.\n- The skill runs exclusively on your local machine. No context data is sent anywhere except the LLM provider (for compression\u002Fmerge) and your chosen injection target.\n- OpenClaw communicates over localhost by default. Do not expose the OpenClaw port over the internet without authentication.\n- If using Notion injection, ensure the integration has minimum required permissions (insert content only).\n",{"name":5,"author":24,"version":25,"description":7},"rabbit-r1-skillz","1.0.0","main","734489c70f6293d3b800cd956559034acaa9f563","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren","https:\u002F\u002Fgithub.com\u002Fajohnsonnow","structuredforgrowth.com","2026-09-04 21:06:25",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add ajohnsonnow\u002Fr1-warren --skill context-bridge",{"tool":38,"command":39},"bunx","bunx skills add ajohnsonnow\u002Fr1-warren --skill context-bridge",{"tool":41,"command":42},"pnpm","pnpm dlx skills add ajohnsonnow\u002Fr1-warren --skill context-bridge","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fcontext-bridge\u002FSKILL.md",true,[46,52,56],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"card.jpg","ASSET","资产文件",23900,"https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fcontext-bridge\u002Fcard.jpg",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"icon.png",8469,"https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fcontext-bridge\u002Ficon.png",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"index.html","REFERENCE","参考文档",64376,"https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fcontext-bridge\u002Findex.html",[63,70,77,84,91,98],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M75THZJQ1XYR8QDWB9RXC9QV","whisper-quiz","WhisperQuiz — voice-answered trivia game for Rabbit R1. Generates questions via the R1's built-in LLM, captures spoken answers via STT, and evaluates correctness with flexible LLM-based matching.","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fwhisper-quiz\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M75THW5BJRSQQM3QP6M568FT","walk-cast","Walking podcast production skill. Receives raw audio metadata and transcript from the R1, removes long pauses, applies noise reduction and normalization, generates AI chapter titles and episode metadata via LLM, and uploads the final episode to your configured podcast RSS host (Spotify for Podcasters \u002F Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fwalk-cast\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M75THTANZTS2AMDDBP615RTA","voice-novel","Local machine skill for VoiceNovel — handles story export to disk.","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fvoice-novel\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M75THQ175ZRJ3E0GPFW7QKM8","voice-guide","Environment description and navigation assistant for blind and low-vision users. Analyzes camera frames via a vision LLM, reads visible text, identifies scene categories (people\u002Fvehicles\u002Ffood\u002Fhazards\u002Fexits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fvoice-guide\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M75THKAJR69WV7QQYJ26X95C","voice-draft","Voice-driven document drafting for the Rabbit R1. Dictate stream-of-consciousness speech; the R1 formats it into Email, Blog Post, Report, Proposal, Meeting Notes, Creative Writing, Code Comments, Cover Letter, or Tweet Thread — then saves the result to a configured folder on your local machine via OpenClaw.","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fvoice-draft\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M75THGKGY2JY59MM9PREXCXX","voice-commit","Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git\u002FCI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.","https:\u002F\u002Fgithub.com\u002Fajohnsonnow\u002Fr1-warren\u002Fblob\u002Fmain\u002Fvoice-commit\u002FSKILL.md",[],[]]