naveedharri

cowork-scheduler

Schedule automated recurring Cowork sessions that appear in your Desktop sidebar.

naveedharri 0 Updated 3mo ago

Resources

1
GitHub

Install

npx skillscat add naveedharri/benai-skills-internal/cowork-scheduler

Install via the SkillsCat registry.

SKILL.md

Cowork Scheduler — Automated Recurring Sessions

You help users schedule automated Cowork sessions that run on a recurring basis (daily, weekly, etc.) and appear in the Claude Desktop Cowork sidebar.

How it works: Claude Code runs headlessly (claude -p) on a launchd schedule (macOS LaunchAgent) with your installed skills and MCP tools. The conversation output is injected into Desktop's session format so it appears as a real Cowork session.

You are the orchestrator. You drive the conversation — asking what to schedule, when, confirming details, running scripts, and reporting results. The Python scripts are non-interactive tools you call with specific flags.


Schedule Workflow

Step 1: Ask What to Schedule

Ask the user:

  • "What would you like the scheduled session to do?"
  • "What should the session be called?"

Help them write a good prompt. Remind them:

  • Use natural language, NOT slash commands (slash commands don't work in headless mode)
  • Be specific about what you want Claude to do
  • Installed skills will be auto-invoked when relevant

Examples of good prompts:

  • "Search the web for today's top 3 AI news stories and summarize each with key takeaways"
  • "Check the weather for Austin, TX and give me a morning briefing with outfit recommendations"
  • "Review my Notion inbox and summarize any new items"

Wait for the user's response before proceeding.

Step 2: Ask When

Ask: "When should this run?"

Offer common schedules as options:

  1. Every morning at 7am
  2. Every weekday at 9am
  3. Twice daily (9am and 5pm)
  4. Every Monday at 8am
  5. Custom schedule

Use AskUserQuestion to let the user choose.

Convert their answer to a cron expression:

Schedule Cron
Every day at 7am 0 7 * * *
Weekdays at 9am 0 9 * * 1-5
Twice daily (9am, 5pm) 0 9,17 * * *
Every Monday at 8am 0 8 * * 1
Weekends at 10am 0 10 * * 0,6
Every hour 0 * * * *
Every 30 minutes */30 * * * *

Wait for the user's response before proceeding.

Step 3: Confirm & Create

Show the user a summary of what will be scheduled, then ask for confirmation.

Once confirmed, run:

python3 skills/cowork-scheduler/scripts/cowork-cron.py --add \
  --prompt "the user's prompt here" \
  --title "Session Title" \
  --cron "0 7 * * *"

Step 4: Report

Tell the user:

  • What was scheduled (prompt and title)
  • When it will run (human-readable schedule)
  • "A first test run is triggered now. You may see macOS permission dialogs — click Allow on all of them. This is one-time setup; future scheduled runs will be silent."
  • "Each run creates a new session in your Cowork sidebar. Restart Desktop to see new sessions."
  • "Say 'list my scheduled sessions' or 'remove a schedule' to manage them."

List Workflow

When the user asks to see their scheduled sessions:

python3 skills/cowork-scheduler/scripts/cowork-cron.py --list

For JSON:

python3 skills/cowork-scheduler/scripts/cowork-cron.py --list-json

Present the results in a clean table with ID, title, schedule, and prompt.


Remove Workflow

Step 1: List Schedules

First show the current schedules:

python3 skills/cowork-scheduler/scripts/cowork-cron.py --list

Step 2: Ask Which to Remove

Ask: "Which schedule would you like to remove?" Show the IDs.

Wait for the user's response.

Step 3: Remove

python3 skills/cowork-scheduler/scripts/cowork-cron.py --remove --id <ID>

To remove all:

python3 skills/cowork-scheduler/scripts/cowork-cron.py --remove-all

Run Now (One-Off Inject)

If the user wants to run a prompt once and inject it into Cowork (not recurring):

python3 skills/cowork-scheduler/scripts/cowork-inject.py \
  --run \
  --prompt "the prompt here" \
  --title "Session Title"

Or two-step (save output first, then inject):

claude -p "the prompt" \
  --allowedTools Skill,Bash,Read,Write,AskUserQuestion \
  --output-format stream-json > /tmp/output.jsonl

python3 skills/cowork-scheduler/scripts/cowork-inject.py \
  --from-file /tmp/output.jsonl \
  --prompt "the prompt" \
  --title "Session Title"

Script Reference

cowork-cron.py flags

Flag Purpose
--add Add a new scheduled session
--list List scheduled sessions (human-readable)
--list-json List as JSON
--remove --id ID Remove a scheduled session by ID
--remove-all Remove all scheduled sessions
--prompt TEXT Prompt text (required with --add)
--title TEXT Session title (optional with --add)
--cron EXPR Cron expression (required with --add)

cowork-inject.py flags

Flag Purpose
--from-file FILE Read stream-json from file (default: stdin)
--prompt TEXT The original prompt text (required)
--title TEXT Session title (default: first 50 chars of prompt)
--run Run claude -p internally and inject the result
--claude-flags Extra flags to pass to claude -p

cowork-schedule.sh usage

./cowork-schedule.sh "prompt text" "Session Title"

Set ALLOWED_TOOLS env var to customize which tools are available:

ALLOWED_TOOLS="Bash,Read,WebSearch" ./cowork-schedule.sh "Search AI news" "News"

Key Principles

  • Always ask, then act — Present options, wait for user selection, confirm, then execute.
  • Natural language only — Remind users to use natural language prompts, NOT slash commands. Slash commands are disabled in claude -p mode.
  • Non-interactive scripts only — Always call scripts with explicit flags. Never run them without flags.
  • launchd on macOS — Schedules use LaunchAgents (not cron) for full user-context permissions. Plists are stored in ~/Library/LaunchAgents/. Logs go to ~/Library/Logs/CoworkScheduler/.
  • Project-scoped plugins — The job runs from the project directory so project-scoped skills are discovered.
  • Skill auto-invocation — The default ALLOWED_TOOLS includes Skill, so Claude auto-invokes installed skills when relevant.
  • Cross-platform — Session injection supports macOS, Linux, and Windows paths for session storage.