Ids and claims from the server
With a server pin (.aitodo/server.yaml) the store takes its ids and claims from the server, so clones on other machines (people, CI, agents) never collide.
The commands do not change; every call sends your token.
- A claim is a lease owned by your token name + worktree + host, living
8 h;ticket update,ac …,note,section …renew it, by handtkt ticket claim SG-128 --renew. Another token's lease:ERR_ALREADY_CLAIMED; only an admin takes it over with--force. - Server unreachable:
ERR_COORDINATOR_UNREACHABLE;tkt --offline <cmd>works locally for that call (ids may collide;tkt doctorfinds it,tkt ticket renumberrepairs it). Read-only commands never contact the server.
Details5 items
- Ids:
ticket new,decision new,move,import,renumber,resolve-conflictusePOST /v1/projects/{p}/ids{kind: ticket|decision, prefix, floor}(kindseparates a group prefixDfrom the decision prefixD; numbers exceedfloor, the clone's max, and raise the localcounters.json).GET /v1/projects/{p}/ids?kind=…&prefix=…is the counter (move --dry-run). Failed writes skip numbers.tkt doctor:counter: server: <url> (project <id>);tkt where:coordinator: <url> (project <id>) serves ids, leases. - Leases: keyed by ticket ULID (kept by renumber, move);
AITODO_CLAIM_TTL(e.g.8h,30m,1d; invalid: the server does not start). Own token, other worktree or host:--forcemoves it; another token's needs admin (elseERR_AUTH_FORBIDDEN). Release: owner (any worktree) or admin.tkt ticket claims --jsonaddsowner,host,expiresAt; expired = free, never stale. Renewal uses the gitignored.aitodo/leases.json; failures only warn;--renewon a gone lease:ERR_NOT_FOUND. tkt next(no--claim) reads leases (unreachable:Warning: claims unknown: …). Closing (done/canceled) is written anyway; the lease expires. Offline also viaAITODO_OFFLINE=1; no provisional ids, no sync command;resolve-conflictrepairs too.- REST:
GET /v1/projects/{p}/claims{leases: [{ulid, ticketId, owner, assignee, branch, worktree, host, claimedAt, renewedAt, expiresAt, mine}], ttlSeconds};POST /v1/projects/{p}/claims/{ulid}{ticketId, assignee, branch, worktree, host, force?}: 201 new, 200 renewed/forced, 409;PUTrenews the owner's only (404, 409);DELETEowner or admin (403, 404). - Busy server: while another request holds the server's database, a write answers 503
ERR_DB_BUSY(Server busy, retry, aRetry-Afterheader, the request id); nothing was written.tktasks again a few times, waiting longer each time, for a read, an id and a claim; any other write stops with the message: run it again. A read never waits on a write.