Tasks and schedules
Kheish includes first-class primitives for structured work tracking and delayed or recurring execution.Tasks
Tasks are session-scoped records that represent units of work with ownership and status. They support:- titles and descriptions
- owner assignment
- progress and status updates
- dependency tracking through blocked-by relationships
- session tasks live inside one session control state
- project tasks live in the daemon project store and can point at one assigned session, one public discussion thread, and one latest run
- Flow projections expose the underlying run correlation; inspect session tasks through the normal task API
- one session needs local decomposition, status tracking, or scheduling hints during execution
- work ownership, dependencies, or public discussion must stay durable across multiple sessions
Background shell tasks
Shell execution is not treated as an opaque side effect. Background shell tasks are persisted daemon tasks with:- task identifiers
- output capture
- stop controls
- watchdog handling and truncation limits
pendingorin_progressshell tasks becomefailed- metadata includes
terminal_reason: "daemon_restarted"andrecovered_on_boot: true - captured partial output remains readable with
tasks output - the daemon does not restart or re-attach the shell command
cancelledremains reserved for explicit operator or agent stop requests
tasks output reports output retrieval, not command success. A retrieval_status of success means Kheish read the persisted output view. The command itself is successful only when the task record has status: "completed" and shell metadata has exit_code: 0.
Schedules
Schedules let the daemon create future runs without an external scheduler. They support:- one-shot execution
- recurring execution
- pause, resume, cancel, and trigger-now operations
- overlap and misfire policies
Why schedules belong in the daemon
Putting schedules inside the daemon keeps them close to the state they act on. A schedule can target an existing session, preserve the same control-plane behavior as manual input, and survive daemon restarts through persisted scheduler state.Evidence Note
- Code verified:
crates/kheish-daemon/src/shell_tasks.rs,crates/kheish-daemon/src/services/task.rs,crates/kheish-daemon/src/state/task_workflow.rs,crates/kheish-daemon/src/control_tools/tasks.rs. - CLI/API verified:
tasks list,tasks get,tasks output,tasks stopcommand surfaces checked againstcrates/kheish-daemon/src/main.rsandcrates/kheish-daemon/src/api/handlers.rs. - Daemon live tested for this note: no; deterministic daemon/service tests cover the documented recovery semantics.
- Provider-specific tested for this note: no; shell task recovery is daemon-local and provider-neutral.
