CLI for OmniFocus via OmniAutomation
Project description
ofocus
A command-line interface for OmniFocus on macOS. Read and write tasks, projects, and tags directly from your terminal — or let AI agents (Claude Code, MCP servers, etc.) work with OmniFocus.
ofocus talks to OmniFocus through JXA (JavaScript for Automation) via osascript — no plugins, no server, no API keys. If OmniFocus is running, ofocus works.
Install
Requires Python 3.13+ and uv.
# From source
git clone https://github.com/yourusername/ofocus.git
cd ofocus
uv sync
# Run directly
uv run ofocus --help
Quick start
# What's on my plate?
ofocus stats
# Check the inbox
ofocus inbox
# Add something to the inbox
ofocus inbox add "Buy coffee beans" --flag
ofocus inbox add "Read paper" --due 2026-03-15 --note "The one from Alice"
# Find tasks across inbox and projects
ofocus search "quarterly"
# List active tasks, optionally filtered
ofocus tasks
ofocus tasks --project "Work" --flagged
ofocus tasks --tag "errand" --due-before 2026-03-10
# Mark done, update, or drop
ofocus complete j7cpqVlu
ofocus update j7cpqVlu --name "Buy good coffee beans" --flag
ofocus drop j7cpqVlu
# Projects and tags
ofocus projects
ofocus projects --folder "Work"
ofocus project-create "Q2 Planning" --folder "Work"
ofocus tags
Commands
| Command | Description |
|---|---|
ofocus inbox |
List inbox tasks |
ofocus inbox add "name" |
Add task to inbox (--note, --due, --flag) |
ofocus tasks |
List active tasks (--project, --tag, --flagged, --due-before) |
ofocus search "query" |
Search by name/note across inbox and active tasks |
ofocus complete <id> |
Mark a task complete |
ofocus update <id> |
Update a task (--name, --due, --flag/--no-flag, --note) |
ofocus drop <id> |
Drop a task |
ofocus delete <id> |
Permanently delete a task |
ofocus projects |
List projects (--folder) |
ofocus project-create "name" |
Create a project (--folder) |
ofocus tags |
List all tags |
ofocus stats |
Quick counts (inbox, active, flagged, overdue) |
ofocus dump |
Full JSON dump of everything |
Every command supports --json for machine-readable output.
JSON mode
All commands accept --json to output structured JSON instead of human-readable text. This makes ofocus composable with other tools:
# Pipe flagged tasks to jq
ofocus tasks --flagged --json | jq '.[].name'
# Get task IDs for scripting
ofocus inbox --json | jq -r '.[].id'
# Full database export
ofocus dump > omnifocus-backup.json
Task IDs
Human output shows truncated 8-character IDs for readability. Use --json to get full IDs for complete, update, drop, and delete commands:
$ ofocus inbox --json | jq -r '.[] | "\(.id) \(.name)"'
j7cpqVlu3kR Buy coffee beans
a9xmPn2Qw4Y Read paper
$ ofocus complete j7cpqVlu3kR
Completed: Buy coffee beans
Use with Claude Code and AI agents
The --json flag on every command makes ofocus a natural tool for Claude Code, MCP servers, and other AI agents that need to read or manage OmniFocus tasks programmatically. Agents can list tasks, create new ones, mark them complete, and search — all through structured JSON over stdin/stdout.
# An agent can check what's overdue
ofocus tasks --due-before 2026-03-08 --json
# Add a task from an agent workflow
ofocus inbox add "Follow up on PR review" --due 2026-03-10 --json
# Dump everything for context
ofocus dump
How it works
ofocus constructs JXA scripts and runs them via osascript -l JavaScript. Each command builds a small JavaScript snippet that talks to Application("OmniFocus"), executes it as a subprocess, and parses the JSON output. No AppleScript, no Shortcuts, no network calls.
Requirements
- macOS (uses
osascript) - OmniFocus 3 or 4
- Python 3.13+
Development
uv sync # Install deps
uv run pytest # Run tests
uv run ruff check src/ tests/ # Lint
uv run ofocus stats # Smoke test (needs OmniFocus running)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ofocus-0.1.1.tar.gz.
File metadata
- Download URL: ofocus-0.1.1.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a12b7a00c5ed208beb3796f45891357a04f6d8a360e17fcb72e620103c9fd32
|
|
| MD5 |
e02e20cc5560d89a8cfde052faa8ee17
|
|
| BLAKE2b-256 |
4f6d83f2add8fbbcc544d60daebbb66fc5db20c40adf57346054277de6166bab
|
File details
Details for the file ofocus-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ofocus-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
823ec81a3db3113e3358bd2475e3b10cdf9d700c6902532c24087cb8e22f3c96
|
|
| MD5 |
77087e585eeee772312fda02715218a1
|
|
| BLAKE2b-256 |
04ec2fe61576252de222c8b996754df5ef0692824df5597f2aab02d8c1fd39cf
|