Features
Mirror Mate includes built-in features that provide contextual information to the AI. Features fetch external data and inject it into the system prompt.
Configuration
All features are configured in config/features.yaml.
Available Features
| Feature | Description | API Key Required |
|---|---|---|
| Weather | Current weather info | No |
| Calendar | Google Calendar events | Yes (Service Account) |
| Time | Current date/time | No |
| Reminder | Event reminders | No (uses Calendar) |
Note: LLM and TTS providers are configured separately in
config/providers.yaml. See Providers.
Weather Feature
Fetches current weather data from Open-Meteo (free, no API key required).
Configuration
features:
weather:
enabled: true
provider: open-meteo
locations:
- name: "Tokyo"
latitude: 35.6762
longitude: 139.6503
- name: "Osaka"
latitude: 34.6937
longitude: 135.5023
defaultLocation: "Tokyo"Note: Weather locations can be automatically set based on your locale using Locale Presets. When not explicitly set, the preset values are used (e.g., Tokyo/Osaka for Japanese, San Francisco/New York for English).
Options
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable/disable the feature |
provider | string | Weather API provider (currently only open-meteo) |
locations | array | List of locations with name, latitude, and longitude |
defaultLocation | string | Name of the default location to use |
Output Example
Current weather in Tokyo: Sunny, 15°C, wind 10km/hCalendar Feature
Fetches events from Google Calendar using a service account.
Step 1: Create a Google Cloud Project
- Go to Google Cloud Console
- Click Select a project → New Project
- Enter a project name (e.g., "mirrormate") and click Create
- Wait for the project to be created and select it
Step 2: Enable Google Calendar API
- In Google Cloud Console, go to APIs & Services → Library
- Search for "Google Calendar API"
- Click on it and then click Enable
Step 3: Create a Service Account
- Go to IAM & Admin → Service Accounts
- Click + Create Service Account
- Enter a name (e.g., "calendar-reader") and click Create and Continue
- Skip the optional steps and click Done
- Click on the newly created service account
- Go to the Keys tab
- Click Add Key → Create new key
- Select JSON and click Create
- Save the downloaded JSON file securely
Step 4: Share Your Calendar with the Service Account
Important: The service account can only access calendars that are explicitly shared with it.
- Open Google Calendar
- In the left sidebar, hover over the calendar you want to share
- Click the ⋮ (three dots) → Settings and sharing
- Scroll down to Share with specific people or groups
- Click + Add people and groups
- Enter the service account email address:
- Find it in the downloaded JSON file under
client_email - It looks like:
[email protected]
- Find it in the downloaded JSON file under
- Set permission to See all event details
- Click Send
Step 5: Configure Environment Variables
Add to your .env file:
GOOGLE_SERVICE_ACCOUNT_EMAIL=[email protected]
GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n"
GOOGLE_CALENDAR_ID=[email protected]Note: The private key should have
\nfor newlines (as stored in the JSON key file).
Step 6: Configure the Feature
features:
calendar:
enabled: true
maxResults: 5Options
Environment Variables:
| Variable | Description |
|---|---|
GOOGLE_SERVICE_ACCOUNT_EMAIL | Service account email from JSON key file |
GOOGLE_PRIVATE_KEY | Private key from JSON key file |
GOOGLE_CALENDAR_ID | Calendar ID to fetch events from |
YAML Options:
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable/disable the feature |
maxResults | number | Maximum number of events to fetch |
Finding Your Calendar ID
- Open Google Calendar
- Click the three dots next to your calendar
- Select "Settings and sharing"
- Scroll to "Integrate calendar"
- Copy the "Calendar ID"
Output Example
Today's schedule: 10:00 Team Meeting, 14:00 1-on-1
Next event: 10:00 Team Meeting (in 30 minutes)Troubleshooting
Error: "Not Found" (404)
This error means the service account cannot access the calendar.
Solution:
- Verify the calendar is shared with the service account (see Step 4)
- Check that the
GOOGLE_CALENDAR_IDenvironment variable matches your calendar - Wait a few minutes after sharing (changes may take time to propagate)
Error: "Missing credentials"
Solution:
- Ensure
GOOGLE_SERVICE_ACCOUNT_EMAILandGOOGLE_PRIVATE_KEYare set in.env - Restart the dev server after modifying
.env
Error: "Invalid grant" or authentication errors
Solution:
- Verify the private key is correctly formatted with
\nfor newlines - Ensure the service account key hasn't been revoked
- Check that the Google Calendar API is enabled in your project
Reminder Feature
Automatically reminds you of upcoming calendar events with customizable timing.
Configuration
features:
reminder:
enabled: true
pollingInterval: 30 # seconds
reminders:
- minutes: 10
urgent: false
- minutes: 5
urgent: true
- minutes: 1
urgent: trueOptions
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable/disable the reminder feature |
pollingInterval | number | How often to check for upcoming events (in seconds) |
reminders | array | List of reminder configurations |
reminders[].minutes | number | Minutes before event to trigger reminder |
reminders[].urgent | boolean | If true, shows red pulsing card; otherwise green card |
How It Works
- The system polls the calendar API at the configured interval
- When an event matches a configured reminder time, a card appears with TTS notification
- Each reminder is only shown once per event per configured time
Requirements
- Calendar feature must be enabled and configured
- Google Calendar credentials must be set up (see Calendar Feature section)
Behavior
| urgent | Card Color | Animation |
|---|---|---|
| false | Green | None |
| true | Red | Pulsing + Bounce |
Example Configurations
Default (10min and 5min warnings):
reminders:
- minutes: 10
urgent: false
- minutes: 5
urgent: trueMore aggressive (15min, 5min, 1min warnings):
reminders:
- minutes: 15
urgent: false
- minutes: 5
urgent: false
- minutes: 1
urgent: trueTime Feature
Provides current date and time information to the AI.
Configuration
features:
time:
enabled: true
timezone: "Asia/Tokyo"Note: The timezone can be automatically set based on your locale using Locale Presets. When not explicitly set, the preset value is used.
Options
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable/disable the feature |
timezone | string | IANA timezone identifier (default from locale preset) |
Output Example
Current time: Monday, December 30, 2024 14:30Supported Timezones
Common timezone values:
Asia/Tokyo- Japan Standard Time (JST)America/New_York- Eastern Time (ET)Europe/London- Greenwich Mean Time (GMT)UTC- Coordinated Universal Time
Creating Custom Features
To create a new feature:
- Create a new directory under
src/lib/features/ - Implement the
Featureinterface:
import { Feature } from "../types";
export class MyFeature implements Feature {
name = "my-feature";
async getContext(): Promise<string> {
// Fetch and format your data
return "Context string for AI";
}
}- Add configuration type in
src/lib/features/types.ts - Register the feature in
src/lib/features/registry.ts - Add configuration to
config/features.yaml
