Jobs
omfp runs two kinds of jobs, both as daemon processes you can watch in the omfp:jobs widget.
| Declared jobs | Agents’ background commands | |
|---|---|---|
| Declared by | an init file, ctx.jobs.define(name, spec) |
an agent, with the job_start tool |
| Runs | a shell command, a prompt to a thread, or a function | a shell command in the workspace folder |
| When | by hand (:job-run, a key), on a schedule (cron), or kept running as a service |
once, at once |
| Owned by | the workspace; each run is kept in the store | the thread that started it, killed with it |
| Ends | in the run history | as a message that wakes the agent (or through job_wait) |
ctx.jobs.define("test", { description: "Fast tests", command: "nix develop -c just test" });ctx.jobs.define("mail", { schedule: "0 8 * * 1-5", prompt: { text: "Read my unread mail and list what needs an answer.", thread: "reuse" },});ctx.jobs.define("inbox-watch", { trigger: "service", command: "./scripts/watch-inbox.sh", restart: "on-failure" });Something recurring or lasting (“read my mail every morning”, “watch the inbox folder”, “a deploy I can run with a key”) is a declared job; a long build or a test run an agent needs while it works is a background command.
sequenceDiagram participant A as Agent participant K as Kernel A->>K: job_start "cargo build" K-->>A: job id, at once Note over A: keeps working K-->>A: the job's result, as a message