nx_nxtask.nx
buildroot/runtime/nx_nxtask.nx
about
nxtask.nx -- sovereign agent task graph (beads-equivalent).
Persistent, structured-memory task tracker for the Mormon local
AI agent (docs/LAYER_1_3_SOVEREIGNTY_AUDIT.md). Tracks work
across sessions; survives agent restarts.
Design inherited from beads (gastownhall/beads) where it fit
sovereignty discipline. Divergences:
- NO external SQL engine (Dolt is 100 MB + MySQL-compat).
Instead: content-addressable flat files, one JSON blob
per task. Ride on fs.nx. Zero runtime deps.
- NO Dolt cell-level merge. Instead: append-only event log
per task id; merge via event-timestamp ordering. v0.1.0
adds cross-agent merge; v0.0.1 single-agent only.
- Same JSON API as beads where possible -- Mormon can switch
backends seamlessly later.
v0.0.1 scope: add, list, claim, close, show, ready. No
hierarchy, no deps yet -- foundations first, semantics layer
in v0.1.0.
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_nxtask_main.nxnx_nxtask_store.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 45 | struct Task |
| 63 | struct TaskGraph |
consts
| 29 | const TASK_MAGIC_1000000000: i64 = 1000000000 |
| 30 | const TASK_MAGIC_1000001000: i64 = 1000001000 |
| 31 | const TASK_MAGIC_1000002000: i64 = 1000002000 |
| 32 | const TASK_MAGIC_1000003000: i64 = 1000003000 |
| 33 | const TASK_MAGIC_1000005000: i64 = 1000005000 |
| 34 | const TASK_MAGIC_1000006000: i64 = 1000006000 |
| 35 | const TASK_MAGIC_1000007000: i64 = 1000007000 |
| 39 | const TASK_MAX_DESC: i64 = 2048 |
| 40 | const TASK_MAX_OPEN_TASKS: i64 = 1024 |
| 41 | const TASK_STATE_OPEN: i64 = 0 |
| 42 | const TASK_STATE_CLAIMED: i64 = 1 |
| 43 | const TASK_STATE_CLOSED: i64 = 2 |
| 69 | const TASK_BYTES: i64 = 112 |
| 70 | const MAX_DEPS: i64 = 16 |
functions
| 74 | func nxtask_graph_new(cap: i64) -> *TaskGraph |
| 83 | func task_at(g: *TaskGraph, idx: i64) -> *Task |
| 92 | func nxtask_add(g: *TaskGraph, desc: *u8, desc_len: i64, |
| 135 | func nxtask_add_dep(g: *TaskGraph, task_idx: i64, |
| 156 | func nxtask_is_ready(g: *TaskGraph, idx: i64) -> i64 |
| 184 | func nxtask_claim(g: *TaskGraph, idx: i64, |
| 209 | func nxtask_close(g: *TaskGraph, idx: i64, |
| 233 | func nxtask_count_state(g: *TaskGraph, state: i64) -> i64 |
| 246 | func nxtask_next_ready(g: *TaskGraph) -> i64 |
| 257 | func main() -> i64 |