-
-
Notifications
You must be signed in to change notification settings - Fork 8
feat(dreamer): scheduled task automation system #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Version files synced to 2.1.0 from CHANGELOG.md |
Greptile SummaryAdds Matrix Dreamer, a scheduled task automation system that executes Claude commands using native OS schedulers (launchd for macOS, crontab for Linux). Tasks can be scheduled using cron expressions or natural language (e.g., "every day at 9am") and optionally run in isolated git worktrees. Key Changes:
Security Implementation:
Architecture Highlights:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MCP as MCP Tool Handler
participant Add as Add Action
participant Parser as Cron Parser
participant Store as Database Store
participant Factory as Scheduler Factory
participant Scheduler as Platform Scheduler
participant OS as OS Scheduler (launchd/crontab)
User->>MCP: matrix_dreamer({ action: 'add', name: 'task', schedule: 'every day at 9am', command: 'echo hello' })
MCP->>Add: handleAdd(input)
Add->>Parser: parseSchedule('every day at 9am')
Parser->>Parser: naturalLanguageToCron()
Parser-->>Add: { expression: '0 9 * * *' }
Add->>Store: createTask(task)
Store->>Store: Parameterized SQL INSERT
Store-->>Add: savedTask
Add->>Factory: getScheduler()
Factory->>Factory: Detect platform (darwin/linux)
Factory-->>Add: scheduler instance
Add->>Scheduler: register(task)
alt Linux (crontab)
Scheduler->>Scheduler: shellEscape() for all inputs
Scheduler->>Scheduler: Write temp file with crontab content
Scheduler->>OS: crontab /path/to/temp
OS-->>Scheduler: Success
else macOS (launchd)
Scheduler->>Scheduler: escapeXml() + shellEscape()
Scheduler->>Scheduler: Generate plist file
Scheduler->>OS: launchctl load plist
OS-->>Scheduler: Success
end
Scheduler-->>Add: Registration complete
alt Registration fails
Add->>Store: deleteTask(taskId)
Store-->>Add: Rollback complete
Add-->>User: Error: scheduler registration failed
else Registration succeeds
Add-->>User: Success with task details
end
Note over OS: At scheduled time (9am daily)
OS->>OS: Execute: cd 'workDir' && claude -p 'command'
OS->>OS: Log output to ~/.claude/matrix/dreamer/logs/
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
27 files reviewed, 1 comment
c874e4f to
9f8a881
Compare
Add Matrix Dreamer - schedule and manage automated Claude tasks using native OS schedulers (launchd on macOS, crontab on Linux). Features: - 7 actions: add, list, run, remove, status, logs, history - Cron expressions + natural language scheduling - Optional git worktree isolation for task execution - Execution history tracked in SQLite database - Shell escaping for security (prevents command injection) New dependencies: croner, cronstrue Database: v5 migration adds dreamer_tasks and dreamer_executions tables
9f8a881 to
40d067e
Compare
|
Version files synced to 2.1.0 from CHANGELOG.md |
|
@greptileai reassess |
Summary
every day at 9am)Key Features
addlistrunremovestatuslogshistoryChanges
matrix_dreamerMCP tool with 7 actionsdreamer_tasks+dreamer_executionstablescroner,cronstrueSecurity
shellEscape()(single-quote wrapping)Test plan
matrix_dreamer({ action: 'add', name: 'test', schedule: 'every day at 9am', command: 'echo hello' })creates tasklaunchctl list | grep dreamershows registered task on macOSmatrix_dreamer({ action: 'list' })returns created taskmatrix_dreamer({ action: 'run', taskId: '...' })executes taskmatrix_dreamer({ action: 'remove', taskId: '...' })removes task