create_task (tasks.py)

JIGGA · automation

Task store + a lightweight index (Hardening H1b). Tasks are one JSON file each under `tasks_dir/`. The hot paths — the supervisor picking pending assignees every tick, an agent claiming its pending tasks, `set_task_state` resolving an id — used to glob and parse *every* task file

"""Task store + a lightweight index (Hardening H1b).

Tasks are one JSON file each under `tasks_dir/`. The hot paths — the supervisor
picking pending assignees every tick, an agent claiming its pending tasks,
`set_task_state` resolving an id — used to glob and parse *every* task file on
each call (O(all tasks) per state change and per tick).

A derived index at `state/tasks/index.json` maps `task_id -> {state, assignee,
created_at}` so those lookups read only the files they need. The index is
self-healing: it's rebuilt from disk whenever it's missing, and readers tolerate
entries whose file has since been archived/removed (the task files remain the
source of truth). `list_tasks` keeps the full scan — it's the cold reporting
path that wants every task.
"""

from __future__ import annotation

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key