AGENT SKILL

calendar-aura

R1 calendar companion — fetches today's events, attendee context, and Gmail thread summaries; handles invite responses; saves voice notes to events.

License 许可
MIT
最近更新
2026-09-04
Stars
★ 0
Forks
0

01 前言 Front Matter

name
calendar-aura
author
rabbit-r1-skillz
version
1.0.0
description
R1 calendar companion — fetches today's events, attendee context, and Gmail thread summaries; handles invite responses; saves voice notes to events.

02 资源文件 3

03 SKILL.md 正文

CalendarAura — OpenClaw Skill

CalendarAura bridges your R1 to Google Calendar, Outlook, and Gmail. It fetches today's event schedule, enriches each event with email thread context and attendee history, and handles invite responses. Voice notes recorded on-device are attached to their calendar event via this skill.

Architecture

R1 device ──ocSend──► OpenClaw skill (local machine)
                              │
             ┌────────────────┼────────────────────┐
             ▼                ▼                    ▼
      Google Calendar     Gmail API          Contact store
      (or Outlook)      thread lookup       (local JSON)

The R1 sends commands over the OpenClaw shared-storage bridge. This skill executes them on your local machine where OAuth credentials are available, then writes results back to shared storage for the R1 to read.

Commands

get_events

Fetches today's event list.

Params:

Field Type Description
date string ISO date string YYYY-MM-DD

Returns data:

Field Type Description
events array Array of event objects (see Event schema below)

get_prebrief

Fetches full pre-brief context for a single event: attendee history from contacts, recent Gmail thread matching the event, and suggested talking points.

Params:

Field Type Description
eventId string|null Calendar event ID
summary string Event title (for Gmail thread search fallback)
start string ISO timestamp of event start
attendees array [{name, email}] list
location string Event location string

Returns data:

Field Type Description
contacts object Map of email → context string
agenda string[] Agenda items parsed from event description
emailContext string|null Summary of most recent Gmail thread
talkingPoints string[] LLM-generated talking points (max 4)
savedNotes string|null Previously saved voice notes for this event

save_note

Attaches a voice note to a calendar event. Stores in local JSON and optionally appends to the event description via Calendar API.

Params:

Field Type Description
eventId string|null Calendar event ID
summary string Event title (used as key when no ID)
start string ISO timestamp
noteText string Transcribed voice note
timestamp string ISO timestamp of when note was recorded

Returns data:

Field Type Description
saved boolean Whether note was saved successfully

respond_invite

Accepts or declines a calendar invite and sends the response.

Params:

Field Type Description
eventId string|null Calendar event ID
summary string Event title (fallback identifier)
response "accept" | "decline" User's RSVP
reason string Decline reason (empty string if none)

Returns data:

Field Type Description
sent boolean Whether response was sent

Event schema

{
  "id": "google_event_id_or_null",
  "summary": "Product Review",
  "start": "2026-06-14T14:00:00-07:00",
  "end":   "2026-06-14T15:00:00-07:00",
  "allDay": false,
  "location": "https://zoom.us/j/123456",
  "attendees": [
    { "name": "Sarah Chen", "email": "sarah@example.com" },
    { "name": "Marcus Webb", "email": "marcus@example.com" }
  ],
  "organizer": "Sarah Chen",
  "pending": false,
  "description": "Q2 roadmap discussion\n\nAgenda:\n- Priorities\n- Timeline"
}

Prerequisites

  • Node.js 20+
  • OpenClaw CLI (npm install -g openclaw-cli && openclaw serve)
  • A Google Cloud project with Calendar API + Gmail API enabled (or Microsoft Graph for Outlook)
  • An Anthropic API key for talking-point generation

Local setup

1. Install dependencies

mkdir -p ~/.openclaw/skills/calendar-aura
cd ~/.openclaw/skills/calendar-aura
npm init -y
npm install @anthropic-ai/sdk googleapis @azure/msal-node node-fetch dotenv

2. Google OAuth setup

  1. Go to Google Cloud Console → APIs & Services → Credentials
  2. Create an OAuth 2.0 Client ID (Desktop app)
  3. Download the JSON and save as ~/.openclaw/skills/calendar-aura/google-credentials.json
  4. Enable Google Calendar API and Gmail API for your project
  5. Run the one-time auth flow (see step 5)

3. Configure environment

Create ~/.openclaw/skills/calendar-aura/.env:

# Required
ANTHROPIC_API_KEY=sk-ant-...

# Google (Calendar + Gmail)
GOOGLE_CREDENTIALS_PATH=/Users/you/.openclaw/skills/calendar-aura/google-credentials.json
GOOGLE_TOKEN_PATH=/Users/you/.openclaw/skills/calendar-aura/google-token.json
GOOGLE_CALENDAR_ID=primary

# Optional — Microsoft Outlook (use instead of Google, not both)
AZURE_CLIENT_ID=
AZURE_TENANT_ID=
OUTLOOK_REFRESH_TOKEN=

# Optional — note storage file
NOTES_FILE=/Users/you/.openclaw/skills/calendar-aura/notes.json

# Optional — contacts context file (JSON map of email → context string)
CONTACTS_FILE=/Users/you/.openclaw/skills/calendar-aura/contacts.json

4. Register the skill

Add to ~/.openclaw/openclaw.config.json:

{
  "skills": [
    {
      "name": "calendar-aura",
      "path": "~/.openclaw/skills/calendar-aura/skill.js",
      "description": "Calendar context, pre-briefs, invite responses, voice notes"
    }
  ]
}

5. Create the skill file

Create ~/.openclaw/skills/calendar-aura/skill.js:

"use strict";
require("dotenv").config({ path: __dirname + "/.env" });

const fs        = require("fs");
const path      = require("path");
const { google } = require("googleapis");
const Anthropic  = require("@anthropic-ai/sdk");

const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });

// ── Google auth ──────────────────────────────────────────────────────────
function getGoogleAuth() {
  const creds  = JSON.parse(fs.readFileSync(process.env.GOOGLE_CREDENTIALS_PATH));
  const { client_secret, client_id, redirect_uris } = creds.installed;
  const auth   = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
  const token  = JSON.parse(fs.readFileSync(process.env.GOOGLE_TOKEN_PATH));
  auth.setCredentials(token);
  return auth;
}

// ── Notes store ──────────────────────────────────────────────────────────
function loadNotes() {
  const file = process.env.NOTES_FILE || path.join(__dirname, "notes.json");
  if (!fs.existsSync(file)) return {};
  return JSON.parse(fs.readFileSync(file, "utf8"));
}

function saveNotes(notes) {
  const file = process.env.NOTES_FILE || path.join(__dirname, "notes.json");
  fs.writeFileSync(file, JSON.stringify(notes, null, 2));
}

// ── Contacts store ───────────────────────────────────────────────────────
function loadContacts() {
  const file = process.env.CONTACTS_FILE || path.join(__dirname, "contacts.json");
  if (!fs.existsSync(file)) return {};
  return JSON.parse(fs.readFileSync(file, "utf8"));
}

// ── Main entry point ─────────────────────────────────────────────────────
module.exports = async function calendarAura(command, params) {
  switch (command) {
    case "get_events":     return cmdGetEvents(params);
    case "get_prebrief":   return cmdGetPrebrief(params);
    case "save_note":      return cmdSaveNote(params);
    case "respond_invite": return cmdRespondInvite(params);
    default: return { error: `Unknown command: ${command}` };
  }
};

// ── get_events ───────────────────────────────────────────────────────────
async function cmdGetEvents({ date }) {
  const auth     = getGoogleAuth();
  const calendar = google.calendar({ version: "v3", auth });

  const dayStart = new Date(date + "T00:00:00");
  const dayEnd   = new Date(date + "T23:59:59");

  const resp = await calendar.events.list({
    calendarId:   process.env.GOOGLE_CALENDAR_ID || "primary",
    timeMin:      dayStart.toISOString(),
    timeMax:      dayEnd.toISOString(),
    singleEvents: true,
    orderBy:      "startTime",
    maxResults:   25,
  });

  const events = (resp.data.items || []).map(ev => ({
    id:        ev.id,
    summary:   ev.summary || "Untitled",
    start:     ev.start.dateTime || ev.start.date,
    end:       ev.end?.dateTime || ev.end?.date || null,
    allDay:    !ev.start.dateTime,
    location:  ev.location || "",
    attendees: (ev.attendees || []).map(a => ({
      email: a.email,
      name:  a.displayName || "",
    })),
    organizer:   ev.organizer?.displayName || ev.organizer?.email || "",
    pending:     ev.attendees?.some(a => a.self && a.responseStatus === "needsAction") || false,
    description: ev.description || "",
  }));

  return { events };
}

// ── get_prebrief ─────────────────────────────────────────────────────────
async function cmdGetPrebrief({ eventId, summary, start, attendees, location }) {
  const auth    = getGoogleAuth();
  const gmail   = google.gmail({ version: "v1", auth });
  const contacts = loadContacts();
  const notes   = loadNotes();

  // Attendee context from contacts file
  const contactCtx = {};
  for (const a of attendees) {
    if (a.email && contacts[a.email]) {
      contactCtx[a.email] = contacts[a.email];
    }
  }

  // Gmail thread search using event title
  let emailContext = null;
  try {
    const q      = `subject:"${summary.slice(0, 40)}" in:inbox newer_than:7d`;
    const search = await gmail.users.threads.list({ userId: "me", q, maxResults: 1 });
    const thread = search.data.threads?.[0];
    if (thread) {
      const full = await gmail.users.threads.get({
        userId: "me", id: thread.id, format: "metadata",
        metadataHeaders: ["Subject", "From", "Date"],
      });
      const msgs = full.data.messages || [];
      emailContext = `${msgs.length} message thread about "${summary}" (latest: ${
        msgs[msgs.length-1]?.payload?.headers?.find(h => h.name === "From")?.value || "unknown"
      })`;
    }
  } catch (_) {
    emailContext = null;
  }

  // Saved notes for this event
  const noteKey   = eventId || summary.replace(/\s+/g, "_").toLowerCase();
  const savedNote = notes[noteKey] || null;

  // LLM talking points
  let talkingPoints = [];
  const hasContext = attendees.length > 0 || emailContext;
  if (hasContext) {
    try {
      const prompt = `Generate exactly 3 concise talking points (one sentence each) for an upcoming meeting:
Title: ${summary}
Time: ${new Date(start).toLocaleString()}
Attendees: ${attendees.map(a => a.name || a.email).join(", ")}
Location: ${location || "Not specified"}
${emailContext ? `Recent email context: ${emailContext}` : ""}
${savedNote ? `Saved notes: ${savedNote.note}` : ""}

Respond with a JSON array of exactly 3 strings. No other text.`;

      const msg = await anthropic.messages.create({
        model:      "claude-haiku-4-5-20251001",
        max_tokens: 256,
        messages:   [{ role: "user", content: prompt }],
      });

      const text = msg.content[0]?.text?.trim() || "[]";
      const parsed = JSON.parse(text);
      talkingPoints = Array.isArray(parsed) ? parsed.slice(0, 4) : [];
    } catch (_) {
      talkingPoints = [];
    }
  }

  // Parse agenda from event description (if available via get_events flow)
  // The R1 doesn't pass description here — agenda items come from LLM-inferred points
  const agenda = talkingPoints.length > 0 ? [] : [];

  return {
    contacts:      contactCtx,
    agenda,
    emailContext,
    talkingPoints,
    savedNotes: savedNote ? savedNote.note : null,
  };
}

// ── save_note ────────────────────────────────────────────────────────────
async function cmdSaveNote({ eventId, summary, start, noteText, timestamp }) {
  const notes  = loadNotes();
  const key    = eventId || summary.replace(/\s+/g, "_").toLowerCase();

  const existing = notes[key] ? notes[key].note + "\n---\n" : "";
  notes[key] = {
    note:      existing + noteText,
    updatedAt: timestamp,
    summary,
    start,
  };
  saveNotes(notes);

  // Optionally append to Calendar event description
  try {
    const auth     = getGoogleAuth();
    const calendar = google.calendar({ version: "v3", auth });
    if (eventId) {
      const ev = await calendar.events.get({
        calendarId: process.env.GOOGLE_CALENDAR_ID || "primary",
        eventId,
      });
      const desc = ev.data.description || "";
      await calendar.events.patch({
        calendarId: process.env.GOOGLE_CALENDAR_ID || "primary",
        eventId,
        resource: {
          description: desc + `\n\n[R1 Note — ${new Date(timestamp).toLocaleString()}]\n${noteText}`,
        },
      });
    }
  } catch (_) {
    // Saving to Google Calendar is best-effort; local file was already saved above
  }

  return { saved: true };
}

// ── respond_invite ───────────────────────────────────────────────────────
async function cmdRespondInvite({ eventId, summary, response, reason }) {
  if (!eventId) {
    // Can't respond without an event ID — log for manual action
    console.warn(`[calendar-aura] Cannot respond to invite "${summary}" — no eventId`);
    return { sent: false };
  }

  try {
    const auth     = getGoogleAuth();
    const calendar = google.calendar({ version: "v3", auth });

    // Fetch the event to find self attendee entry
    const ev = await calendar.events.get({
      calendarId: process.env.GOOGLE_CALENDAR_ID || "primary",
      eventId,
    });

    const attendees = (ev.data.attendees || []).map(a => {
      if (a.self) {
        return {
          ...a,
          responseStatus: response === "accept" ? "accepted" : "declined",
          comment: reason || undefined,
        };
      }
      return a;
    });

    await calendar.events.patch({
      calendarId:      process.env.GOOGLE_CALENDAR_ID || "primary",
      eventId,
      sendNotifications: true,
      resource:        { attendees },
    });

    return { sent: true };
  } catch (err) {
    console.error("[calendar-aura] respond_invite error:", err.message);
    return { sent: false };
  }
}

6. One-time Google OAuth flow

Run this once to authorize and save your token:

node - << 'EOF'
const fs = require("fs");
const { google } = require("googleapis");
const readline = require("readline");

const creds = JSON.parse(fs.readFileSync(process.env.GOOGLE_CREDENTIALS_PATH || "./google-credentials.json"));
const { client_secret, client_id, redirect_uris } = creds.installed;
const auth = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);

const SCOPES = [
  "https://www.googleapis.com/auth/calendar",
  "https://www.googleapis.com/auth/gmail.readonly",
];

const url = auth.generateAuthUrl({ access_type: "offline", scope: SCOPES });
console.log("Open this URL in your browser:\n", url);

const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.question("\nPaste the code here: ", async code => {
  rl.close();
  const { tokens } = await auth.getToken(code);
  fs.writeFileSync(process.env.GOOGLE_TOKEN_PATH || "./google-token.json", JSON.stringify(tokens));
  console.log("Token saved.");
});
EOF

7. Contacts file (optional but recommended)

Create ~/.openclaw/skills/calendar-aura/contacts.json to give the pre-brief richer context:

{
  "sarah@company.com": "Product lead. Prefers async updates. Focused on mobile growth this quarter.",
  "marcus@company.com": "Engineering manager. Detail-oriented. Ask about API stability before shipping.",
  "jordan@company.com": "Your direct report. Working on the search feature refactor."
}

8. Start OpenClaw

openclaw serve

calendar-aura should appear in the registered skills list.

Troubleshooting

R1 shows demo events (no live data) CalendarAura ships with a realistic demo dataset as fallback when OpenClaw is unreachable. Confirm openclaw serve is running and both the R1 and your machine are on the same network.

Pre-brief shows "OpenClaw offline" The get_prebrief command timed out. Check that skill.js loaded without syntax errors (node skill.js should exit cleanly). Verify your ANTHROPIC_API_KEY is valid.

Gmail thread not found The search uses the event title as a subject query. If your meeting subject lines don't match calendar event titles, talking points are still generated but without email context.

Invite responses not sending Google Calendar requires the attendee entry to have self: true. This is set automatically when you're on the invite list. If you created the event yourself, there is no attendee entry to update — the response is a no-op.

Token expired Re-run the OAuth flow in step 6. The googleapis client refreshes access tokens automatically if a refresh_token is present in google-token.json. If the refresh token is missing, you need to revoke and re-authorize.

Security notes

  • OAuth tokens (google-token.json) are as sensitive as passwords. Never commit them.
  • .env contains your Anthropic API key — exclude from all version control.
  • This skill reads Calendar and Gmail data and makes LLM API calls. No data is stored on third-party servers beyond the configured LLM provider.
  • OpenClaw communicates over localhost only. Do not expose the OpenClaw port beyond your local machine.
  • Voice notes are stored unencrypted in notes.json. On a shared machine, restrict file permissions: chmod 600 notes.json.

04 同仓库更多 Skills

ajohnsonnow
ajohnsonnow/r1-warren

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.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

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 / Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-novel

Local machine skill for VoiceNovel — handles story export to disk.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

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/vehicles/food/hazards/exits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

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.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-commit

Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git/CI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.

★ 0