---
name: google-calendar
description: >
  Sync Google Calendar events into WALL-E's brain via macOS Calendar.
  Reads events using EventKit (fast native API), stores as memories
  with attendees, location, notes. Supports incremental sync with
  update detection. Use for schedule awareness, meeting prep, calendar context.
version: 1.1.0
author: wall-e
execution: script
entry: run.js
args: ["--days-back", "1", "--days-ahead", "14"]
trigger:
  type: interval
  schedule: "every 30m"
config:
  days_back:
    type: number
    default: 1
    description: "How many days back to sync"
  days_ahead:
    type: number
    default: 14
    description: "How many days ahead to sync"
tags: [calendar, google, schedule, meetings, events, sync]
permissions:
  - calendar:read
  - brain:write
---
# Google Calendar Sync

## What This Skill Does

Syncs calendar events from macOS Calendar (which mirrors Google Calendar) into
WALL-E's brain as searchable memories. Uses Apple's EventKit framework via a
compiled Swift binary for fast, reliable access.

## How It Works

1. Compile `cal-reader.swift` to a native binary (cached, only recompiles on change)
2. Run binary to read events from ALL calendars (Google, Outlook, iCloud, etc.)
3. For each event, build a content string with title, attendees, location, notes
4. Dedup by `source_id` = `cal:{uid}:{start}` -- skip unchanged, update modified
5. Store as memories with `source: 'calendar'`, `source_channel: <calendar name>`

## Memory Format

Each event is stored as a memory:
- **source**: `calendar`
- **source_channel**: calendar name (e.g., `owner@example.com`, `Family`)
- **memory_type**: `calendar_event` or `calendar_allday`
- **subject**: event title
- **content**: human-readable summary with attendees, location, notes
- **metadata**: full JSON event data (uid, start, end, attendees with RSVP status)
- **timestamp**: event start time (ISO8601)

## Prerequisites

The terminal running WALL-E must have Calendar access granted:
**System Settings > Privacy & Security > Calendars > [your terminal app]**

The Swift compiler (`swiftc`) must be available (ships with Xcode or Command Line Tools).

## Output

Returns: `{ inserted, updated, skipped, total }`

## Common Queries After Sync

Once synced, calendar events can be found with brain searches like:
- `source:calendar` -- all calendar events
- `source_channel:owner@example.com` -- work calendar only
- Search by attendee name, meeting title, or location
