tamag0
Documentation

Scheduled tasks and watchdog

Companions can start work on a schedule, park it on a precise dependency, and resume when the expected event arrives — without holding an agent process open or leaving silent zombie threads.

Scheduled tasks

Recurring routines run without a human prompting them — a morning brief at 8am, a weekly review on Fridays, a monitoring check every hour:

  • Schedules are defined by cron expression or natural language ("every weekday at 8am"), with timezone support.
  • Each companion has its own tasks; every workspace agent is checked in parallel, so schedules hold even with several companions.
  • An execution creates a normal thread — same memory, tools, lifecycle, and visibility as interactive work. Tasks missed while the app was offline run at the next startup.
  • Tasks are managed from desktop settings or by the companion itself when a human describes a recurring rhythm in conversation.

What the watchdog supervises

The watchdog is the reliability layer around autonomous threads. It handles four kinds of continuity:

  • External events — CI checks, pull-request status, deployments, webhooks, and timers registered by an awaiting_external thread.
  • Companion wakes — work in awaiting_agent is returned to the companion that owns it, with bounded retries rather than an infinite wake loop.
  • Human waitsawaiting_human work can be reminded without repeatedly running a companion that has nothing new to do.
  • Thread dependencies — normal awaiting_thread work resumes when all linked blockers finish; an inconsistent wait with no open blocker is rescued instead of remaining stuck.

The external-wait lifecycle

An external wait is a registered contract, not a vague “check again later”:

  1. The companion records the event it expects, how to observe it, and when a missing result should be surfaced.
  2. The thread moves to awaiting_external, and the companion process is free for other work.
  3. The watchdog checks the external signal without spending a model turn on polling.
  4. When the event fires, the thread moves to awaiting_agent and the owner companion is woken with the original thread context.
  5. If the event never arrives by its deadline, the expired wait moves to human attention rather than becoming a permanent zombie.

For example, a companion can push a pull request, register the CI result, leave the thread, then return automatically to inspect failures or continue the workflow when the checks finish. A pull-request merge, although clicked by a human, is still an external event; a question that needs a human reply is awaiting_human instead.

Bounded recovery instead of endless loops

The watchdog also supervises work that stopped making progress:

  • idle live threads are re-evaluated rather than assumed complete;
  • an owner companion that does not resume successfully is retried only within a bounded circuit;
  • repeated failed companion wakes escalate to a human instead of looping silently;
  • work that remains inactive after escalation can be marked abandoned, making the lack of an outcome explicit;
  • malformed external or thread waits are repaired or surfaced rather than left indefinitely pending.

The purpose is not to make every stalled thread run forever. It is to ensure that every thread either resumes, asks for help, finishes, or visibly stops.

Visible and auditable

Autonomous supervision leaves evidence at two levels:

  • thread state changes and important recovery decisions are recorded with the thread;
  • Settings → Watchdog shows recent signal, classification, wake, retry, and state-sync activity, while structured logs retain the durable operational record.

You can therefore answer “why did this companion wake up?” or “why did this thread stop?” without reconstructing the event from model output.

Tasks and delegation

Companions also maintain a persistent task backlog — created from conversations, Slack, or GitHub events — with priorities, statuses, and delegation between companions. Delegated work remains a durable thread with an owner and can be linked back to the thread that initiated it; it is not an anonymous background job whose provenance disappears.