Skip to content

Easily create macOS Calendar events from any selected text using LLM-powered extraction and Automator integration.

Notifications You must be signed in to change notification settings

brant-ruan/text2agenda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text to Agenda (macOS)

This project provides a simple way to create macOS Calendar events from selected text using AI. It uses litellm to process the text and extract event details, then uses AppleScript to add them to your calendar.

Features

  • Context Aware: Understands dates like "tomorrow", "next Friday", etc.
  • Smart Extraction: Extracts summary, start/end time, location, and description.
  • Reminders: Automatically adds an alert/reminder before the event.
  • macOS Integration: Designed to work as a Quick Action (Services menu) via Automator.

Prerequisites

  • macOS
  • Python 3 installed
  • An API Key for a supported LLM (OpenAI, Anthropic, Gemini, etc.)

Installation

  1. Clone or Download this repository: Save the files to a directory, e.g., ~/pjts/text2agenda.

  2. Set up Python Virtual Environment: Open a terminal, navigate to the project directory, and run:

    cd ~/pjts/text2agenda
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Configuration: Open config.json and update the following:

    • api_key: Your actual API Key.
    • model: The model you want to use (e.g., gpt-4o, gemini-1.5-flash, etc.). See litellm docs for model names.
    • calendar_name: The exact name of the calendar in your macOS Calendar app where you want events to be added (default is usually "Calendar" or "Home").
    • reminder_minutes: How many minutes before the event to set the alert.
  4. Make script executable:

    chmod +x run_remind.sh

Automator Setup (Right-click Usage)

To use this from the right-click menu (Services):

  1. Open Automator on your Mac.
  2. Choose New Document -> Quick Action.
  3. Configure the settings at the top:
    • Workflow receives current text in any application.
  4. Add a Run Shell Script action from the library.
  5. In the script box:
    • Set "Shell" to /bin/bash.
    • Set "Pass input" to as arguments.
    • Paste the following code (update the path to match your actual directory):
      /PATH/TO/text2agenda/run_remind.sh "$1"
  6. Save the Quick Action (e.g., name it "Add to Calendar").

Usage

  1. Select any text containing event info (e.g., inside an email or webpage).
  2. Right-click (or Control-click) the selection.
  3. Go to Services -> Add to Calendar (or whatever you named it).
  4. Check your Calendar app!

Debugging

If it doesn't work, check the log file:

cat /tmp/remind_log.txt

About

Easily create macOS Calendar events from any selected text using LLM-powered extraction and Automator integration.

Topics

Resources

Stars

Watchers

Forks

Contributors