Skip to content

Schedule tool: scheduling as a regular Tool (replaces Scheduler)#2

Merged
EdmondDantes merged 1 commit into
mainfrom
feat/schedule-tool
Jun 14, 2026
Merged

Schedule tool: scheduling as a regular Tool (replaces Scheduler)#2
EdmondDantes merged 1 commit into
mainfrom
feat/schedule-tool

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

What

Turns scheduling into a regular ToolInterface the agent invokes, instead of a separate Scheduler class wired in bin/claw.

  • src/Tool/ScheduleTool.php — tool schedule with input { after_seconds, message }. The user gets a one-shot reminder (⏰ <message>) at that time.
  • Each scheduled item is its own coroutine that awaits delay() then fires — no central run()/tick() loop, no logical clock, real wall-clock delays. This replaces the previous interval/tick design.
  • Removes src/Scheduler.php and tests/SchedulerTest.php.
  • bin/claw wires the tool with the conversation's send(...) as its delivery sink, so the tool stays decoupled from the Chat layer (it receives a \Closure(string): void).
  • Docs updated (README status, ARCHITECTURE.md file layout).

Behaviour & limits

  • Delivers a reminder to the user (variant A). Re-prompting the agent to act on a schedule (variant B) is a deliberate later step.
  • One-shot; in-memory (does not survive a restart — persistence is a later layer).
  • risk = Safe (no confirmation prompt).

Tests

tests/Tool/ScheduleToolTest.php: delivery after a real timed delay + input validation.

74 tests pass, PHPStan level 8 clean, php-cs-fixer clean.

Expose scheduling as a regular ToolInterface: the agent calls 'schedule' with {after_seconds, message} and the user gets a one-shot reminder at that time. Each scheduled item is its own coroutine that awaits delay() then fires — no central timer loop, real wall-clock delays.

Removes src/Scheduler.php (logical-clock every/tick/run) and its test in favour of this. bin/claw wires the tool with the conversation's send() as the delivery sink. Reminders are in-memory and one-shot (not persisted yet).

74 tests, PHPStan level 8, php-cs-fixer — all green.
@EdmondDantes EdmondDantes merged commit 8703f1f into main Jun 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant