Runs, Teams and Automation
This page is for contributors who change how a run starts, which agent profile and team take it, or when Tack merges the result. It follows one automatic run from the moment a task waits in the trigger status to the merge, and names the function that does each step. After reading it you can find the code behind any rung of the Automation ladder and extend it.
People use the same features through Automating a Project; operators set up the machine side in Installing and Operating Runners. The decisions are ADR 0021 (teams, ladder) and ADR 0020 (merge authority); see Architecture Decisions.
Who owns what
| Responsibility | Owner |
|---|---|
| What is done, in which order, with what priority and budget | Tack |
| Which profile, and through it which team, takes a task | Tack: the role, then the project default |
| Starting a run (by a person, by a rule, as rework) | Tack. docket never enqueues on its own |
| Running the agent and its team, the jail, the per-task limits | docket |
| Approvals and questions inside a run | docket raises them; Tack shows them and sends the answer |
| The verdict, the stages, the signature | The verifier (prill is one) |
| Push, pull request, merge, level, ceiling | Tack |
| Parallelism | Tack's runner (several attempts) and docket's teams (one task per team at a time) |
The life of an automatic run
The numbered steps are what happens when a project has auto-start on and a task with a role reaches the trigger status. A run started by hand skips steps 1 to 3 and joins at step 4 through POST /api/executions.
- The tick.
tack_app::auto_start::spawnadds the loop beside the GitHub poll intack-cli'sserve.rs. It callstickeveryAppConfig.auto_start_seconds(TACK_AUTO_START_SECONDS, default 30,0starts nothing). The loop is its own task because the GitHub loop does not run without a token.ticklists the projects withauto_start_enabled = 1, not archived, with anauto_start_status, and callsproject_tickfor each. - The candidates.
project_tickreads the work in that status that has at least one role (item_roles) or a profile on the item or on an ancestor, is not a group, and has no execution request at all (queries::items::waiting_with_someone_to_do_it: a task starts once). It also finds the requests still open (queued,leased,preparing,running,waiting_decision), whether the day's token limit is spent (tack_app::scheduler_wiring::budget_reached), and each task's unfinished blockers (DependencyGraph::unfinished_blockers). For each task it runsresolve_profileanddefault_selector(step 4) to learn whether a profile and a machine exist. - The choice.
tack_core::auto_start::pickis pure. It sorts by priority, thensort_order, and walks the list once.- A task is skipped for the first reason that applies, in this order:
OpenRequest,Blocked(n),NoProfile,NoMachine,WentOver,Budget,MaxOpen. WentOverholds a profile whose agent reports no usage while it runs (reports_usage_while_running) when its newest finished run counted more than the limit it ran with: nothing would stop the next one at the limit.max_openis the project's cap minus the runs already open. No column's WIP limit is read, because the tick moves nothing.- Skips are logged at debug level and are not written to the task. The next section shows how a person sees them.
- A task is skipped for the first reason that applies, in this order:
- The request.
startbuilds aCreateExecutionwithidempotency_key = "auto-start:<item>:<version>"andmetadata.started_by = "auto_start". It names no profile, agent or selector. It setspermission_policyto the profile's tools for the agent andnetworkfrom the profile (tack_core::run_defaults::profile_network_for: the profile'stool_policy.network, or for any agent but docket its tools for the agent being*or naming WebFetch or WebSearch; always true for opencode), and addsapprovals: "ask"unless every machine the run may land on reports the agent'ssandboxasbwraporharness(sandboxed_everywhere). That is the Run dialog's rule.start_runthen resolves the rest as for any other run, with the principalauto_start:resolve_profilecallstack_core::run_defaults::resolve(next section) and records the source inmetadata.profile_source.- The agent is the profile's
tool_policy.agent, else the project'sdefault_harness; with neither, the request is refused withselect_an_agent. default_selectorreturns the profile's fleet, else the only active runner, else an error.load_profilesnapshots the profile, fillspermission_policy.networkfromprofile_network_for(the profile and the request's agent) when the request does not carry the key (a request that saystrueorfalsekeeps it), and resolves the run's limits;enqueue_runwrites the request. A replay answers the same request and the tick does nothing more.
- The note. Only after the request exists,
startwrites the system comment "Started by itself: it reached X with the role Y" throughmerge::tell. It does not touch the task's status: only a person moves it. - The claim. The scheduler (
tack-orch, called throughtack-app) matches the request to a runner. A request no runner can take waits with a reason and fails withno_runner_can_claimafterSchedulingPolicy.unclaimable_fail_after, 30 minutes by default. The runner claims it when one of its attempt slots is free. - The slot. On a claim the engine calls
ActiveAttempts::register, which records the lease and returns awatch::Receiver<bool>that turnstruewhen the server asks for a cancellation. One ticker sends a single heartbeat for every active lease (transport.rs,heartbeat_all) and passes eachlease_resultsrow toActiveAttempts::apply. A folder worked in place stays one attempt at a time becauseworkspace.rslocks the folder. - The agent. For docket the engine drives
DocketAdapter(validate,start,wait,cancel,reconcile), described below. For every other agent it drives the sharedlocal_processlifecycle. - After the attempt. Before it deletes the workspace the engine captures the evidence, runs the verifier and pushes the branch (
evidence.rs,verify.rs,git.rs). The board opens the pull request. - The merge.
tack_app::merge::attemptcollects the facts and callstack_core::autonomy::evaluate. At L4 and L5 the autonomytick(tack_app::autonomy::tick) does this by itself. At L3 only the Merge button does, or the project's merge-on-Done option (tack_app::merge::on_done). The ceiling is one of the holds (below).
Why a task is waiting
plan builds the candidates and the Limits for both the tick and explain. explain runs pick and turns each skip into a Why (code and a plain sentence from tack_core::auto_start::why) without starting anything.
GET /api/projects/{id}/auto-start answers {enabled, status, waiting: [{item_id, why: {code, text}}]} from it:
waitinglists the tasks in the start status that the next pass would not start, most urgent first.codeis one ofopen_request,blocked,no_profile,no_machine,went_over,budgetormax_open.- A project with auto-start off answers
enabled: falseand an empty list. - An agent credential with
readon the project may call it.
The board card, the Work panel and the Automation line read it through shared/state/autoStart.ts, which loads it once per project and again on a board event.
Which profile a run gets
tack_core::run_defaults::resolve(explicit, chain, project_default, implementer, profiles) returns a Resolved { profile_id, fleet_id, harness, source, from }. chain is the item and then its ancestors up to the top, each a ChainLink { item, title, run_settings, roles }: queries::items::routing_chain reads it in one recursive query for one item, and queries::items::routing_facts reads every item of a project so that hierarchy::chain builds the chains in core for the project-wide router. resolve takes the first of these that exists:
| Order | Input | Source | metadata.profile_source |
|---|---|---|---|
| 1 | The caller named a profile | Explicit | absent |
| 2 | The task's saved run settings, then those of each ancestor in turn | RunSettings | run_settings |
| 3 | The profile of the roles at each link, when every role that names one names the same | Role(name) | role:<name> |
| 4 | The project's default profile | ProjectDefault | project_default |
| 5 | The built-in Implementer (kind = 'implementer') | Implementer | implementer |
Orders 2 and 3 are asked of one link before the next: the first link that names a profile wins, so an item's own choice beats its parent's. from is (id, title) of the ancestor the answer came from, and None when the item named its own or the project's answered; GET /api/projects/{id}/routing serves it as from { id, title }. Roles at one link that name different profiles are Ambiguous: the climb stops there and resolve returns the project default with that source (ambiguous), or falls to the Implementer when the project has none.
Work runs; a group is planned
tack_app::runs::start_run::start_run resolves the profile and then asks check_runnable before anything is written:
queries::items::node_ofgives the item'sNode(its type's level, or a visible child).tack_core::hierarchy::runnable(node, profile_kind, title, type_name)refuses a group unless the profile's kind isplannerorresearcher. The refusal isCoreError::GroupNotRunnable(group_not_runnable,409) and no request is made.
The Run dialog, the human API, the MCP create_execution, a trigger and a thread all start through start_run, so the rule has one place. Around it:
GET /api/items/{id}/run-optionsanswers[{profile_id, allowed, reason, node}]from the samerunnable, for the dialog to disable the profiles that would be refused.- The waiting query leaves groups out in SQL (its type's level is
group, or a visible child exists), sopicknever sees one. "Someone to do it" is true when the item or any ancestor has a role or a chosen profile. fleet_idandharnesscome from the chosen profile'sfleet_idcolumn and itstool_policy.agent.- The server resolves; the browser does not.
GET /api/items/{id}/agent-contextanswersprofile_idandprofile_sourceso that the Run dialog can show "Chosen by the role X".
What a run answers
A run keeps what it was made with: GET /api/executions (every shape) and GET /api/executions/{id} answer agent_profile_id and requested_harness_kind read from the request's own columns, so a screen finds the run's profile (and through it the team) and its agent from the run, not from the item's current setting. agent_profile_id is null once that profile is deleted; requested_harness_kind is null when the run left the agent to the computer.
For a screen of a whole project, GET /api/executions?project_id=<id> is the call. It returns every run of the project that has not ended (queued, running, waiting on a person, needing the operator) and every run that ended in the last 24 hours, newest first, with no limit. item_ids wins over it, and an unknown project is a 404.
Each row carries facts read from the newest attempt, so a card never opens an attempt or matches a message to read them:
latest_hop: the role, the kind (startedorfinished), the verdict and the cycle, read from the text of the attempt's latestagent.hop_started/agent.hop_finishedevent. It is null when the attempt reported none (every agent but docket, or an attempt not yet at its first hop). The step is matched to the team's list the way the Execution tab matches it (stepMatch.ts, case-insensitively by role). The hops of all rows come from one query, and the tokens counted so far are the row'slimit.used.never_started: true when the attempt failed and the computer refused it (harness_rejected), or the team's ceiling did (a message that namesceiling L<n>). The one rule istack_core::run_outcome::never_started;GET /api/executions/{id}/attemptscarries the same flag on each attempt.verifier_recommendation:merge,revieworreject, from the merge-readiness pack of a succeeded attempt. It is null while the attempt has not succeeded or left no readable pack.
tack_app::runs::run_facts reads the last two: one query for the whole batch and one file read per pack.
The docket adapter
crates/tack-runner/src/harness/docket.rs holds DocketAdapter, which implements HarnessAdapter and HarnessProbe directly. docket is a daemon the runner talks to, so there is no stdout to parse and no HarnessGrammar. The submodules are client.rs (one method per route), probe.rs (version and teams), task.rs (the task body) and daemon.rs (supervision).
The adapter is registered in harness::discover only when [docket] names a binary or a base_url (DocketConfig::configured). The daemon is started only when binary is set and base_url is not (bootstrap::start_docket). A docket on PATH is never enough: an unasked docket start --dispatch would take over the operator's own teams.
Routes used
| Step | Call | Function |
|---|---|---|
| Version | GET /status.json; apiVersion must be a number, 6 or later | probe::status |
| The escalation record | GET /escalations?since=0 must answer 200 | probe::escalation_record |
| Teams and their profiles | GET /pods, then GET /pods/<pod> for each, and GET /pods/<pod>/records for the record sets (404 on an older docket). Every pod the list names is reported, whether or not a profile names it | probe::teams |
| Make the team once per process | POST /pods with ensure: true and no blueprint: docket's own default shape stands | Client::ensure_pod |
| Where the team works | GET /pods/<pod> once when the run starts: workspaceKind is workdir for a folder team (and the run then sends no baseRef and no prepare, which docket refuses there); a docket that does not send it is read by repoConfigDir, "" for a folder; a missing key counts as a repository | DocketAdapter::has_repository |
| What the team wrote in this task | GET /pods/<pod>/records/<set>?limit=50&sql=SELECT * FROM <set> WHERE _task = '<task>', once per declared set, after the task ends | records::kept |
| Post the attempt | POST /tasks/<pod> | Client::enqueue_task |
| Read the task | GET /tasks/<pod>/<id> | Client::task |
| Follow the hops | GET /traces/<pod>?since=<cursor> | follow |
| Look for approvals and questions | GET /escalations?since=<seq>&task=<id> | read_escalations |
| Answer either | POST /escalations/<id> with {optionId, content?, actor: "tack"} | deliver |
| Cancel | POST /tasks/<pod>/<id>/cancel with {reason, actor: "tack"}; actor only when settledCursor is listed | cancel |
| Continue a step that stopped on its budget | POST /tasks/<pod>/<id>/retry, no body: a failed or blocked task goes back to pending and its next run starts at the step whose hop failed, in that step's session. Sent only when retryContinues and budgetOutcome are listed. Any other status is 409, which means the retry was already sent: the adapter follows the task and never sends a second | retry_task, continue_offer |
| Untracked files | GET /tasks/<pod>/<id>/diff | finish |
| Which features docket has | GET /health; features names what this docket added to API 6, and the adapter reads each name it uses (table below); settledCursor is also what lets follow tell the board a question was answered at docket (below) | activity::Features::of, Client::has_feature |
| Whether a team is paused | paused (always a bool) on every row of GET /pods and on GET /pods/<pod>, with pausedReason (budget today) while it is; only read when podPause is listed; no route clears it | probe::paused, paused_team_line |
| What a team is doing | GET /tasks/<pod>, with ?updatedSince=<cursor> when taskCursor is listed; the trace, as above, when taskCurrent is not | activity::read |
docket lists its features in its health answer (features). Each name is a fact docket adds without moving the API version, and the adapter reads the key behind a name only from a docket that lists it, except where the key is absent from an older docket's answer anyway (marked "reads the key").
| Feature | What it adds | Tack |
|---|---|---|
taskCurrent | current on a running task | used: what a team is doing |
taskCursor | ?updatedSince= on the task list, with rev and next | used: what a team is doing |
podMemory | GET /pods/<p>/memory | used: through memoryStatus |
readScope | a second, read-only serve token | not used: the runner sends its one token |
conversation | a task created with conversation: {maxTurns} runs one step turn by turn | used: a thread is one task that continues (converse reads continues) |
settledCursor | a settled escalation takes a new seq; actor on cancel | used |
failureKinds | every failed task has a failureKind; pod_budget | used |
podPause | paused and pausedReason on a team | used |
hopTimes | startedAt, finishedAt, cycle on a hop | used |
retryContinues | a retry re-runs the step that failed and continues its session | used: Continue |
budgetOutcome | budget on a hop that ran out of rounds, tool calls, tokens or time | used: Continue, Start over |
networkEnforced | network.enforced on a team and each member | reads the key |
podWorkDir | workDir on a folder team | reads the key |
podFetch | fetchDomains on a team and on each member that holds fetch | used in the sentence that says how to give a team the web; the members' hosts: reads the key |
webRead | webRead {mode, reason, fix} on a team and blocking on each need | used: the refusal quotes reason and fix; TeamReport.web_read; a need with blocking: false refuses nothing |
search | search {provider, ready, reason, fix, options[{provider, command, secret}]} on a team | used: TeamReport.search, shown on the team's card and by tack runner doctor; an unknown provider drops the answer, a bad one is logged and never fails the report; the key never travels, secret is its name; no fit check reads it, since search-host is a need with blocking: false |
capabilityMissing | capabilityMissing on a hop and failureKind: capability_missing | reads the key |
consultParts | part: {index, count} on the escalations of a consult with several questions | reads the key |
pipelineChecked | a task naming a pipeline the team cannot staff is refused at claim | used, not probed: Tack refuses such a run before sending from the team's reported methods[].missingRoles, and docket's refusal, if it comes (failureKind: pipeline, no hop), ends the run with the code pipeline and docket's sentence, so it reads Not started |
podShape | shape in a team's document and apply for a folder team | used: the button that applies the repository's teams |
podContract | delivers, methods and needs on a team | used: the team's contract |
podResume | POST /pods/<p>/resume | used: Resume team |
memoryStatus | ?status= on the memory route | used: what a team has learnt and waits to learn |
memoryDecide | POST /pods/<p>/memory/<id> | used: Approve and Refuse on the team's sheet |
isolationPosture | isolationPosture on GET /health: jailed or none | used: the probe's sandbox is harness only for jailed; absent, none or unknown reads as none with its reason, so the run dialog and auto-start ask |
An apiVersion below 6, or one that is not a number, is a probe error: "needs docket 0.3.0-beta.1 (API 6); this docket answers API N". A docket that answers the version but not GET /escalations is a probe error too: "needs docket 0.3.0-beta.1 with the escalation record; this docket answers API N without it". The version number cannot tell the two apart, so the route decides. validate runs both checks before any task is posted, so no task reaches a docket of another version. The version docket answered is the one the doctor and the run's harness_version print.
The task body carries prepare from the request's repository.prepare: a Replace sends its command, Off sends "", and Detect sends nothing, so docket uses its team's prepare: or the lockfile's command. A task docket settles failed with failureKind: "prepare" ends the attempt failed with the reason "Could not prepare the dependencies (docket): " followed by docket's own.
The task
task::body builds the POST /tasks/<pod> body from the request snapshot:
-
idempotencyKeyis the attempt id, so a replayed post answers the same task. -
externalRefis<item id>/attempt-<n>. -
The card goes once, as fields.
descriptionis the profile's own instructions plus the card's fenced title, description and comments, built from the request'stask(the item as data), and nothing else: no brief, no definition of done, and nothing is cut back out of composed prose. A request that carries notaskgoes as the composed instructions alone.taskis docket's structured request:objectiveis the title.doneWhenis the brief's definition of done, else the project's.acceptance,constraintsandriskare the brief's (acceptanceandconstraintsone sentence each).kindis the item's type as the project's vocabulary names it.pathsare the repository-relative paths the acceptance criteria name (afileorabsentpath, acommand'scwd), without repeats.answersare the questions docket asked in the item's previous attempt with the option a person picked, read from the run's stored events when the run is started, so "Run again" does not ask them twice.
A field with nothing to say is left out, never sent empty. No
briefis sent: docket would fold it into the description as a second copy of the same text. docket answers400for a key it does not know or a field of the wrong type, and the attempt fails with that sentence. -
gateis the first acceptance criterion docket can run as a command (acommandcriterion, else atestor file check); ametricis never a gate. -
baseRefis the commit the request's base revision names in the repository, or therework_basebranch for a rework.POST /api/executions {from_run}also setsrework_base. The server resolves it to the named request's newest kept branch (actual_execution.git.branch) instead of trusting a branch the caller sends.from_runis refusednot_foundwhen it names no request, andunprocessablewhen that request belongs to another project or left no branch to continue from.- The request keeps the id it named as
metadata.from_run(afrom_runthe caller put inmetadataitself is dropped). - When the run's profile is a Reviewer and it succeeds with a result whose last
Verdict:line ismerge,revieworreject, the word is stored inreviewer_verdictsagainst the newest attempt of that request.GET /api/projects/{id}/metrics/factorycounts it inwork_quality.verifier_agreementbeside the pack's (verifierisprillorreviewer).
-
maxTokenscomes from the request's token budget.restrictionscarriesdeniedToolsfromtool_policy.docket.denied_toolsandnetwork: "none"when the run has the network off. A restriction can only narrow what the team already has (ADR 0018). -
pipelineis read fromtool_policy.docket.pipeline_by_typeby item type.priorityandtrustedare sent when the request's metadata carries them. -
autonomyis sent exactly as the request snapshot carries it (ExecutionRequestSnapshot::autonomy), and only then.- The board puts a level in the snapshot only when the run was created with an explicit one (
POST /api/executions {autonomy}, the "Run again at L3" action).tack_app::autonomy::level_to_sendnever derives it from the project's merge level, the team's ceiling or the profile, and a non-docket harness gets none. - A snapshot with no level sends no key, and docket decides from the pod's profile and its requirements, since lights-out is docket's own concept.
- The runner reads no team's profile to narrow it. A level above what the team admits is answered with a
422, which fails the attempt (below).
- The board puts a level in the snapshot only when the run was created with an explicit one (
A thread's turn on a team whose docket lists conversation is not always a new task; see "Threads and turns". A 400 or 422 from docket makes the attempt fail with docket's text (the sentence a 422 above docket's ceiling carries is one of them) and the task is never posted again. The process id is <pod>/<task id>, which is how reconcile finds the pod after a restart.
Which team
DocketAdapter::team returns the profile's tool_policy.docket.team. Without one it returns default_pod, the repository folder's basename lowercased to [a-z0-9-], 64 characters at most, default when nothing is left. A profile with no team therefore falls to the project's default team, created on first use in the project's folder. validate checks that a named team exists on the daemon and rejects the attempt before anything is posted when it does not. Only the local_branch workspace mode is accepted; the others are refused with a sentence.
Following the task
follow polls every two seconds (POLL_INTERVAL). Each poll does four things.
- It reads the trace. It reads the trace page since the cursor and turns the records for this task into timeline lines:
hop_startedandhop_finishedbecome hop lines.escalation_asked,escalation_resolved,escalation_expiredandescalation_decidedbecome lines of kindescalation.asked,escalation.resolved,escalation.expiredorescalation.decided(escalation_progress).escalation_deliveredmakes none.- The decided line names the option id and the policy, as docket's event carries no rationale: "decided alone: option deny (policy deny, level L5)". The metrics count the attempts that have a line of kind
escalation.decided. - The cursor lives in
<state_dir>/docket/<attempt id>.cursorand is written by rename after each page is delivered, so a second adapter over the same directory resumes where the first stopped.
- It reads the task's escalations,
GET /escalations?since=<seq>&task=<id>, docket's one record of every pause: a tool call a policy holds (approval), a step's question (consult), aninputstep, agateand a change to the files that check it (check_changed).- The first record still
pendingthat was not asked becomes one decision, in docket's words: its prompt, its options in its order (the last is the way out), its recommendation. The decision goes through the existing decision channels. - A step that asked several questions at once (
consultParts) opens one escalation each, withpart(index,count). They are asked one after the other, each as its own decision whosemetadata.partsays which it is (only whencountis above one), and docket keeps the step waiting until every one is answered. - An
inputwhose only option isdeclinebut which takes text is offered an Answer beside Decline. - The last
seqbelow the first pending record is kept in<state_dir>/docket/<attempt id>.since, written by rename like the cursor. A pending record stays above it, which is how a runner restarted with a question open asks it again. - A pending
waitis not a question: it becomes one line of kindescalation.waiting(once per escalation id), and a taskblockedwithwait_expiredends the attempt Failed with that code. - An
approvalmarkedoutwardis read once more by id (GET /escalations/<id>, the only route that carriescall) before it is asked. The call rides in the decision'smetadatabesideoutward: true, and every statement that settles or expires the decision removescallfrom it. Without a call the record is not asked and the timeline says to answer it in docket. - A docket that lists
settledCursorgives an escalation a newseqwhen it resolves or expires, so the list read fromsincereturns the held question in its final state. When that state isresolved(a person answered at docket's own CLI, or a policy did) and Tack still holds the question open:- the adapter sends an
AnsweredElsewhere { vendor_id, source: "docket" }on the channelHarnessAdapter::answered_elsewhere_channelhands out; - it adds one line of kind
escalation.answered_elsewhere("answered in docket, not in Tack: " and the question) and stops holding the question, so the next pending one is asked on the following read; - the engine closes the board's decision through
POST /attempts/{id}/decisions/answered-elsewhere(AttemptDataProtocol::answered_elsewhere) and clears its pending decision, which is what had keptnext_questionfrom reading another one. If the board cannot be told, the decision stays open until the attempt ends.
- the adapter sends an
- An expiry in docket cancels the task and the run ends
not_answered. - A docket without
settledCursorreports nothing of this.
- The first record still
- It reads the task.
-
While the task is
pendingand docket listspodPause(read once per attempt), the adapter readsGET /pods/<pod>on each poll until it finds the team paused. It then puts one line of kindagent.team_pausedon the timeline with the command that resumes the team (paused_team_line). Apendingtask of a team that runs says nothing. -
In
done,failed,blockedorcancelledit stops. The code the attempt ends with depends on how the task ended:Task Attempt ends with blocked,blockedReasonisinput_expirednot_answeredblocked,failureKindispod_budget(only from a docket that listsfailureKinds)pod_budget, with the sentence "The team's budget is spent" and the command that resumes the teamany other blockedblockedfailedwith no more specific kinddocket's hop_failedonce docket listsfailureKinds,failedbeforefailed,failureKindisneeds_human(a task atL5whose tool call needs approval, which docket asks nobody about)needs_human, with docket'sreasonfailed,failureKindiscapability_missing(a step met a gap in the team's own setup, and docket asked nobody)capability_missing, with the message "The team<pod>stopped on a gap in its own setup: " and docket'sreason, andmissing(kind,name,fix) from the hop'scapabilityMissing -
Whatever the kind, when the last hop failed and its
artifact.files_changedlists files (docket pins the tree of an Implementer stopped by its budget, its transport or a gap in its setup), the reason also carries the task'sbranch,head_commitandbase_commit. The engine then captures the patch though the run stays Failed. -
When the attempt's own timeout passes, the adapter cancels the task and ends the attempt with
timeout. The timeout bounds the agent's work, so the time between two polls that both saw the task inwaiting_inputorwaiting_approvalis added to the deadline. -
A wait has a deadline only when docket gives one: the pending escalation's
expiresAt. If the task is still waiting at a poll after that time, or docket's record says the escalationexpired, the adapter cancels the task and ends the attemptfailedwithnot_answered. With a nullexpiresAt, as on a consult that docket does not expire, nothing ends the wait but an answer, docket's own resolution, or Stop.
-
- It posts a person's answer. An answer arrives on the answer channel and is posted at once to
POST /escalations/<id>with the option's id andactor: "tack".- The text goes in
contentunder the one property the record'srequestedSchemanames (reasonfor an approval, a gate or a changed check). Aninputanswered in text sends nooptionId. - An option docket does not offer is sent as
denywhere docket offers it, elsedecline. - A
409(already settled) or a404means docket settled it elsewhere and is not an error. Any other refusal is written on the timeline and the question is asked again as a new decision. - An answer the runner made up because nobody gave one (
unanswered: the board closed the decision with no answer) is never posted. The task is cancelled and the attempt endsnot_answered. Afailedtask whosefailureKindisapproval_expiredendsnot_answeredtoo, with docket'sreasonkept. Only adenya person sent isapproval_denied.
- The text goes in
What each step was made of
When the task is seen ended and its trace has settled, the adapter builds steps from the task record it already read and puts it in the run's terminal_reason beside the code and the branch (steps.rs). The manifest is on the record, not on the trace, and is read once, at settle.
One entry per hop, in order:
role,model(the one the hop was served by),classandfamily(from the hop'spromptManifest);verdictandsummary(the handoff's), andok;prompts: the manifest's layers, eachlayer,name,version,sha256,scope,tokens;- the
assumptionsandquestionsthe handoff carried.
Some entries are shorter:
- From a docket that lists
hopTimes, a hop that ran an agent turn also givesstartedAt,finishedAt(ISO 8601 UTC, kept as docket wrote them) andcycle. A command, gate, wait or resolution hop, a hop recorded before the feature and any hop from a docket without it give none of the three, and the keys are absent from the step, nevernull(each child of a parallel group has its own). There is no duration in the value: the screen subtracts. - A hop recorded before docket kept a manifest has
prompts: [], never an invented layer. - A task with no hop has no
stepsat all.
The runner stages the same value as one artifact of the attempt, trajectory.json, with the evidence. For a prill verifier the attempt evidence then names the family of the last implementer step beside the model and a trajectory whose uri is where the board serves that artifact and whose digest is the SHA-256 of the staged bytes. Without steps neither is sent, and no claims are.
The branch comes back
On done, the adapter reads the commit of refs/heads/<task branch> in the repository and names it as the run's head_commit; nothing is checked out or reset, and the user's working tree, index and HEAD are never touched. Evidence is the difference from the base commit to that commit, the verifier is given the repository, and the push sends that commit. Files docket reports as untracked produce one timeline line ("N files docket did not commit are not in the evidence"). When the branch is not in the repository the attempt fails with branch_not_applied.
A done task with no worktree on a team whose codebase is "" is a folder team's: the attempt succeeds with {"code": "done", "outside_repository": true, "team", "task", "summary"}, summary being the last step's (null when it wrote none), and carries no branch or head_commit. Engine::fail_without_change leaves an outcome with outside_repository alone, and with no head commit nothing is published and no merge is proposed from it.
When the task has ended, records is added beside steps in the result: [{"set", "columns", "rows", "cut"}], one entry per declared set that holds a row of this task. rows are objects keyed by column (docket's _task, _session, _step among them) and cut is true when the set held more than 50. It is absent when no set has a row.
How a set is read depends on whether GET /pods/<team>/records gives its entry a scope (pod or task):
- With a
scope:GET /pods/<team>/records/<set>?task=<id>. docket answers with that task's rows in write order (_idascending), the id bound as a parameter, and with a_roleon every row._roleis the role of the hop that proposed the row, not the role the work is for, so it is carried on the row and never becomes an entry'srolein the plan. - Without a
scope(an older docket, which would silently ignoretask=and answer every row of the set): one statement built only from a set name and a task id made of letters, digits,-and_. Any other name is skipped.task=is never sent for such a set. - A set docket refuses (
400) is skipped with a warning in the log. When it istack_proposals, the result carriesplan_invalidwith the refusal's sentence, so the person is told why nothing was proposed.
A document that declares a set accepts scope: task, which makes the ref unique within one task. A team that wants its proposals to start clean for each task declares it before the first write, because docket refuses to change the scope of a declared set.
A team that already wrote rows keeps scope: pod, so its ref stays unique across the whole team. A second task that writes a ref already used gets the first task's row back (created: false) and has no row of its own, which Tack reads as a task that proposed nothing. Agents → Teams says so for such a team.
A team that declares a set named tack_proposals proposes items through it, because a folder team has no work tree to hold a plan file and a repository team would merge the file with its branch.
- Its rows for this task (columns
ref,title,description,type,role,team,parent,depends_on,acceptance, all text) become one plan-v1 document, in row order. - A row's
refis its index.parentanddepends_on(refs separated by commas or spaces) become the indexes of other rows, and a parent must be an earlier row.acceptanceis one sentence a line. - The result carries the document as
plan. When a row does not convert (norefortitle, a repeatedref, aparentordepends_onthat names no row), it carriesplan_invalidwith a sentence naming that row'srefinstead. evidence::capturestagesplanexactly as it stages atack-plan.json(the same artifact kind and the same checks) and turnsplan_invalidinto theattempt.plan_invalidevent.- A
tack-plan.jsonon a docket task's branch is never read: it is the agent's work, not a proposal. - A team with no such set, or no row of this task in it, stages nothing.
Capabilities
capabilities() declares cancel, decisions, artifacts, usage, policy and proposals ("through a team's tack_proposals record set") and resume as supported (a task still running when the runner restarts is taken back from the journal's handle). Whether a given team uses proposals is in that team's records. sandbox() returns "harness", which the server accepts beside bwrap and none and the UI renders as "Runs in an isolated sandbox". probe::probe adds the teams to the capability snapshot and sets autonomy_ceiling to L3 when any team is capped, else L5.
What a team is doing
FeatureCapabilities.activity says whether an agent can report the work its teams hold (TeamActivity in tack-protocol, execution/activity.rs). docket does; Claude Code, Codex and opencode report it unsupported, with the reason that they hold no team. The report is in Tack's words: a task has a ref, an on_board item id (absent for work the board did not start: a person at docket's CLI, a routine, another channel), a state (queued, running, waiting, blocked, done, failed, cancelled), what a waiting task waits_on, its current_step (name, role, model, since, cycle) and its finished_steps (name, ok, verdict, summary, assumptions, questions, tokens, finished_at). A task is on_board only when its externalRef is <item id>/attempt-<n>, the label the board writes.
The docket adapter reads it in harness/docket/activity.rs, once per team and call, and keeps a cursor per team in memory. GET /health says which features this docket has. With taskCursor it asks GET /tasks/<team>?updatedSince=<cursor> and keeps the next it answers; without it, it reads the whole list and sends only the tasks that differ from what it sent last. With taskCurrent a running task carries current; without it the adapter reads GET /traces/<team> past its trace cursor and takes the newest hop_started of a task with no hop_finished after it. A finished task whose last change is more than 14 days old is not reported. The steps come from the hops of the task record: artifact.summary, artifact.verdict, assumptions and questions, and the tokens as docket counts them (input - cached + output).
The runner sends what changed every 15 seconds (transport::ACTIVITY_INTERVAL) to POST /api/runner/v1/activity, an additive v1 operation (activity.request.json, activity.response.json, runner-authenticated like the heartbeat). Each task replaces what the board holds for it, so a repeated report changes nothing, and a batch the board did not take is kept for the next tick. Tack stores it in team_tasks and team_task_steps (migration 100_team_activity), forgets finished work after 14 days, and answers GET /api/teams/{id}/activity (id is the team's name; ?harness= picks one when two agents report the same name). A task with on_board absent is the one the screen calls "outside the board". An agent that cannot report answers supported: false with its reason.
What a person asks of a team from the board
The runner is the only one that talks to docket, so a request that starts at a button reaches it the way everything does: the runner asks.
POST /api/teams/{harness}/{name}/resumepicks the newest active runner that reports the team for that agent. It queues aTeamOperation::ResumeTeamfor it intack_app::runner_operations, in memory, and waits up to 30 seconds.- The runner polls
POST /api/runner/v1/operations/pollevery 3 seconds (transport::OPERATIONS_INTERVAL) and is handed each operation once. - It runs the operation with
harness::do_team_operationand answersPOST /operations/{operation_id}/resultwith anOperationOutcome:donewith the team's report afterwards, orrefusedwith a sentence. - The waiting request returns the report, or the sentence (
409). - An operation nobody takes, or a board that restarts, leaves nothing to run later.
POST /api/projects/{id}/teams/apply uses the same queue for TeamOperation::ApplyTeam { team, shape, directory, accept }, once per team, for the newest runner whose docket entry lists podShape in api_features (the probe writes it with HarnessCapability::set_api_features). directory is the project's folder, which must be a folder (code_origin folder or new_folder).
The adapter applies a team in two steps:
- It makes the pod with
POST /pods {name, blueprint, ensure}. It addslocation(the project's folder) only for thebuildshape: for the other three docket takeslocationas the team's working folder and makes one of its own when none is given, and the project's checkout, which holds the team's own configuration of record, is not a place for a team to write.ensureon a pod that exists changes nothing, whatever shape it asks for. - It sends
POST /pods/<pod>/apply {directory: <folder>/.docket/teams/<team>}. docket refuses apod.yamlwhoseshapeis not the pod's (400, naming both) and answers200with every itemskipfor a folder applied twice.
docket refuses a folder that would run commands with 409, a reviewCode and the list in runs. The adapter then answers needs_review with the code and one line per command, and the route returns it. The person's confirmation is the same request again with accept set to the code, which the adapter sends on. Nothing is kept between the two calls, so there is no row to expire and no decision (a decision belongs to an attempt, and an apply has none).
For docket, harness/docket/probe.rs::resume sends POST /pods/<pod>/resume only when GET /health lists podResume, then reads the team again.
- The same feature puts
budget(tokens,used,window,windowStart) on the team's report and on every row of the list. - docket answers the route with the team's report and
resumed(falsefor a team that was not paused, which is not an error), and404for an unknown team. It clears nothing else: a team whose budget is still spent is paused again by the next step that starts, which the board says when the report it gets back showsusedat or overtokens. - Without the feature the operation is refused with the sentence that gives docket's own command.
FakeDocket::with_pod_resume()serves the key and the route from the captured reports (pod-budget,pod-resumed,pod-resume-not-paused);set_budget(team, …)changes what the budget says. All three are captures.
Threads and turns
A thread is a conversation between a person and one agent profile (tack_core::thread, tack_app::threads, tack-api handlers/threads.rs, tables threads, thread_messages and thread_turns, migration 102_threads).
- It has a home project, where its turns run.
- It may have a credential. Then it reaches the projects that credential may read, and only that credential and the operator write in it.
- A message has a principal (
operator:…,agent:<credential>,thread:<id>for a reply), a body of at most 4000 characters and references to items, change sets and decisions.
Each message from the operator starts a turn: an ordinary run of the thread's profile, enqueued with start_run under the principal thread:<id>. A message an agent posts (it needs the converse scope) is posted and starts no turn, because an agent that could start a turn by writing to its own thread would start a loop (tack_core::thread::opens_turn).
- The anchor. A run belongs to an item, so a thread keeps one hidden anchor item in its home project (
items.hidden = 1). The turn rewrites the anchor's description to its input and runs against it, so existing runs, roles and limits behave as for any item, and the profile's own token limit applies to every turn. Hidden items are left out of every board, list, tree, search, count, work-in-progress limit and the digest (the digest still shows a turn that waits on a person, but not one that failed; the thread says that). - The input is built by
tack_core::thread::turn_input: the window (the last six messages whole, up to thirty older ones as their first line, all within 12 000 characters, the newest message always whole), the digest of the projects the thread reaches, and where to leave the reply. - The turn note. The request's
metadata.threadcarries aTurnNote(tack-protocolconversation.rs: thread id, turn number, the most turns, the message that started the turn). A harness that keeps its own context reads it instead of the whole window.
The reply is the run's final message, staged as a reply artifact (text/markdown). It comes from one of two places:
terminal_reason.reply, when a harness holds the agent's final message. The docket adapter sets it, for a thread's turn only, to thehandoffsummary of the team's last step, which docket fills with the step's whole reply when the step made no handoff call. It does so for a team in a repository and for one in a folder alike.- Otherwise
tack-reply.mdat the root of the work tree, which the turn's input asks a local agent for and the capture keeps out of the patch. The docket adapter rewrites that sentence in its task to say the team's last step answers and no file is written, and adds the thread's id with the fields to name it by (originthreadandorigin_ref), because a manager reaching Tack over HTTP through docket's service sees nothing else of the thread.
tack_app::threads::settle runs every five seconds (Loops, "threads"). It finds the turns whose run ended, posts the reply under thread:<id> with the change sets made with origin thread and the thread's id since the turn started (an agent gives propose the thread_id), and settles each turn once. A run that ends with no reply, or failed, is said in the thread.
The caps are tack_core::thread constants:
- 50 turns a thread (
MAX_TURNS). - One turn at a time: an operator's message while the last turn has not answered is refused with
409. An agent's message is not held back by a pending turn or by the turn cap, since it starts no turn. - A thread with no message for 7 days closes (
IDLE_DAYS; the same loop does it, and a message to an idle thread closes it and is refused, whoever wrote it).
FeatureCapabilities.converse says how an agent keeps the conversation going between turns: replays (every turn is a new run given the window; every adapter reports it) or continues (the agent keeps the context and a turn sends it only the new message). A reader reads the way with ConverseMode::of.
A thread on docket continues one task
A thread on a docket team whose docket lists conversation continues: probe reports continues with the reason, and a docket without the feature reports replays.
- The first turn (
TurnNote.turn == 1) posts one task withconversation: {maxTurns}, the note'smax_turnscut to docket's most, 20. The runner keeps the task in<state_dir>/docket/thread-<thread id>.json(team, task and where the trace stood when the last turn ended). - A turn ends the moment the task waits on its escalation of kind
turn(waiting_input). The attempt ends Succeeded with the step's handoff asreply, as a done task would, and the task stays. - Every later turn reads that task's pending
turnescalation and answers it,POST /escalations/<id>withoptionId: replyandcontent: {text: <the message>}. It then follows the task from where the last turn stopped (the file seeds the attempt's own cursor, so a turn's timeline holds only its own steps). Theturnescalation is never put to a person and its events say nothing on the timeline. - A new conversation starts when a turn finds no task to answer: the runner holds none for the thread, docket ended the conversation at its cap (20 turns) or its sweep or CLI closed it, or the task was cancelled. The turn posts a new conversation task, which carries the whole thread so far in its item as every replayed turn does, and puts one line of kind
agent.conversation_restartedfirst. - A team whose method has several steps answers
400withcode: conversation_needs_one_stepand enqueues nothing. The same task goes again withoutconversation, the attempt'sconversecapability readsreplayswith docket's sentence, and the thread replays turn by turn as for any agent. - A closed thread. The runner does not learn that the board closed a thread (the close is a row in the board's database and no runner request carries it). A thread closed for its turn cap or its idle days leaves the docket task to end by itself, at its
maxTurnsor when itsturnescalation expires after the team'sapprovalExpiryHours.
What a team reports
probe::capped marks a team as one that needs a person during a run: its profile is not lights-out, or it reports a violation.
The runner reports the teams in HarnessCapability.teams (TeamReport), the one description of a team any agent fills in Tack's own words (ADR 0032). name, profile and violations are always there. Every other field is optional, and absent means the agent did not say, which is never "none". No field carries a docket word: docket's own names arrive only as data, in shape, in a member's or step's role and in a step's name. The docket adapter fills the fields from GET /pods and GET /pods/<team> (probe::team):
| Field | Read from |
|---|---|
read_only | readOnly, the folders the team's sandbox may read |
works_in (repository or folder) | workspaceKind (codebase or workdir) on the report, else on the list's row; with neither key (an older docket), repoConfigDir, "" meaning a folder |
records | GET /pods/<team>/records, the sets with their row counts |
members (role, model, can_propose, writes_project, reads_web, web_hosts) | members[].role and members[].model.value; can_propose is records.write of members[].capabilities naming tack_proposals, writes_project is kinds holding write or exec, reads_web is tools holding fetch (docket lists it only while it offers it), web_hosts is fetchDomains (podFetch; * is any public host, and an empty list is left absent); each stays absent (the member is shown as before) when the member has no capabilities, or none Tack can read, and the rest of the object (records.query) is not read |
decides (to_the_end or asks_a_person) | the profile verdict: asks_a_person when probe::capped says the team needs a person, else to_the_end |
folder | workDir of the report, for a team that works in a folder (podWorkDir); absent for a team in a repository |
network (none, limited, open) | network.mode, except that a none with network.enforced: false (no jail holds it, so egress is open) is open; a docket that sends no enforced is read by its mode; a mode Tack has no word for stays absent |
queue (waiting, running) | the list row's queue: waiting is pending, waitingApproval and waitingInput, running is running |
proposals_shared_across_tasks | the scope of tack_proposals in the records listing: pod is true (a ref used in one task cannot be used in another), task is false; absent when the listing has no scope (an older docket) or the team has no such set |
paused (budget or other) | paused and pausedReason of the report, else of the row; read only when podPause is listed, and absent while the team runs; a reason other than budget, or none, is other |
shape | blueprint, shown and never sent (the first ask of ADR 0032; absent from a docket that does not send it) |
steps (name, kind, role, checked_by, sends_back_to, sends_back_max) | pipeline.steps (the second ask; absent from a docket that does not send it). Step kinds role/agent, run/command, input/ask, wait and parallel map to agent, command, ask, wait and parallel; gate kinds mechanical, verdict, approval and external to checked_by command, reviewer, person and external; rework.to and rework.max to sends_back_to and sends_back_max. A step Tack cannot read or has no word for leaves steps absent, because a pipeline with a step missing would read as another one |
A team's memory
TeamReport.memory is {pending, accepted}, each a list of entries (id, kind, subject, note, reason, stale, provenance, evidence), oldest first as docket lists them. It is absent when the harness keeps none or could not be read.
- Reading. docket answers
GET /pods/<team>/memory?status=pending|accepted|refusedwith{entries: [...]}(404for a team it does not dispatch,400for another status). The adapter asks forpendingandacceptedon every probe, only from a docket that listsmemoryStatus(probe::memory). An answer it cannot read, or an entry it cannot parse, leavesmemoryabsent and the rest of the report whole, since an empty list and an unknown one are not the same. - Deciding.
TeamMemory.can_decidesays whether the docket listsmemoryDecide. When it does, a person decides an entry from the sheet:POST /api/teams/{harness}/{name}/memory/{id}with{decision: "approve"|"refuse", reason?}(the operator's alone; a refusal without a reason is422). That queues the runner operationDecideMemoryfor the runner that reports the team. The runner postsPOST /pods/<team>/memory/<id>(probe::decide_memory), reads the team's report again, answers with it, and sends that report to the board at once, so the next 30-second pass closes the notification. - Refusals become sentences:
409"That entry is no longer waiting.",404names the team and the entry,403says the runner holds a read-only token. - Without the feature docket is not asked. The sentence gives
docket pod memory approve <id> --pod <team>orrefuse <id> --pod <team> --reason "<why>", and the sheet renders Approve and Refuse disabled (MEMORY_DECIDE_REASON). - Test captures:
pod-memory-accepted(a fresh entry and a stale one),pod-memory-pending(a pitfall and a convention, held for approval),pod-memory-refused,pod-memory-none,pod-memory-default,pod-memory-approved,pod-memory-refused-by-http, the refusalspod-memory-decide-*(409, 404 twice, 400 five times, 401) andpod-memory-evidence-*. The capture script builds the evidence entries in the throwaway home with docket's ownMemoryEntry, because no task of the capture runs a command: they holdevidence {exit: 1},{ok: true}and{}. It also has docket's own function record a task's memory section, since no model is there to write one. - Fake:
FakeDocket::with_memory_status()serves the read andwith_memory_decide()the decision.seed_memory(team)andseed_memory_evidence(team)give a team those entries,decide_memory(team, id, status)is the operator's command at docket's CLI, andfail_memory_reads()makes the read fail.
The notification for a pending entry is no board fact. tack_app::notifications::subscriber::reconcile_memory reads the newest report of each team from the active runners' capability snapshots (the read behind GET /api/teams, with no poller of docket).
- It opens a needs-you notification
memory:<project>:<team>:<id>for each pending entry and each project that uses the team. - It closes one whose entry is no longer pending, whose team no computer reports any more or whose project no longer uses the team.
- A team belongs to no project, so a project uses it by what the board already holds: the profile of one of its roles or its default profile names the team (
run_defaults::named_team, the joinGET /api/teamsmakes, read byRepository::project_profile_policies). A profile that names an agent matches only that agent's team. A team no project uses opens nothing. - A team that reports no memory says nothing: what is open for it stays.
- The pass runs at start, after any repair and every 30 seconds. The runner re-probes every five minutes (
CAPABILITY_REPROBE_INTERVAL) and sends the report only when it changed, so a person hears of a new entry, or of one decided at docket, within about five and a half minutes.
A team's contract
TeamReport carries delivers (branch or report), methods (name, source, default, missing_roles, error) and needs (kind, name, fix, satisfied). All three are absent when the harness did not say, which is not the same as none.
docket sends them as delivers, methods[] (missingRoles, error) and needs[] on GET /pods/<team>. The adapter reads them only when GET /health lists podContract (probe::contract), so a docket that does not list it behaves as before.
delivers: docket's is a list:branchorreportfirst, andrecordsafter it for a team that declares record sets. The adapter keeps the first, since the record sets are the team'srecords.methods[]: every pipeline a task may name, one per name, most of them recipes a lean team lacks the roles for.defaultis true only for the method whose file is the team's bound pipeline, so a team made from a shape has none until a recipe is applied. A file that does not load haserror,missing_roles: []anddefault: false, which is whyerroris read and not the emptymissing_roles.needs[]: a need'skindequals itsname(fetch-hosts,search-host,isolation), andfixis empty once it is met.budget(podResume):{tokens, used, window, windowStart}on every row and report, withwindownone,dayorweek;usedcounts over the window. The adapter listspodShapein the capability's API features;podResumeis the presence ofbudget.
TeamReport::of_agent makes the report of a local agent: a team of one named after its agent, with no profile. It delivers a branch, has one method (agent, the agent's own loop) and has the needs the runner's check found (sign_in, satisfied when the agent is signed in and absent when the check could not tell; model, unmet while the harness requires a model and names no default). The local harness fills it in probe and keeps it for the next run.
A team that cannot do what the run needs
TeamReport::misfits (tack-protocol, over team_misfits) compares what a profile needs with what the team said. TeamNeeds::of(kind, web, method) is what the profile needs:
- the web, when the run's network is on;
- proposals, for a Planner;
- the repository, for any kind but Planner and Researcher (the profile's
kindcolumn, which a person sets in the profile form,POST/PATCH /api/agent-profilesor a project file, fromtack_core::outline::bundle::PROFILE_KINDS; a built-in keeps its own); - the method the card's type names in
docket.pipeline_by_type.
The misfits are:
| Misfit | When |
|---|---|
no_web | the network is none and every member says reads_web: false |
no_proposals | every member says can_propose: false |
no_repository | the team delivers a report |
unknown_method, method_broken, steps_skipped | the team lists its methods and the one named is not there, does not load, or has missing_roles (docket refuses such a task at claim, pipelineChecked, so the run would end before any step) |
needs_unmet | one for each need the team says is not satisfied |
A need of kind model is met by the run naming a model, which the scheduler and the harness check per run, so it never counts here. Only what was said counts: an absent network, member list, contract or method list is never a misfit.
What happens on a misfit:
- The docket adapter reads
GET /pods/<team>again instart, afterensureand beforePOST /tasks/<team>. A misfit ends the attempt asRejectedwith the change in docket that meets it (misfit_sentence), so the team never stops to ask a person for its own setup. - When docket refuses at claim anyway (
failureKind: pipeline,POST /taskshaving accepted the task), the attempt fails with the codepipelineand docket's sentence.tack_core::run_outcome::never_startedcounts it as a run that never started, as it does a refusal by the computer. - A local harness refuses a run the same way in
check_requestwhen its last probe found a need unmet (an agent that is not signed in), before anything is spawned. Before the first probe it refuses nothing. - A Researcher is told how to propose (
docket_plan_channel) only when a member can, in the same conditional words a local Researcher gets for its file. Every step of the team reads that sentence, and docket ends a task when a role calls a tool another member holds and it does not (capability_missing). So the sentence names the roles whosecan_proposeistrueand tells every other role to leave proposing to them. A team whose members say nothing of it is told as before, naming none. GET /api/teamslists each profile'smisfitsagainst the team's last report (for a profile that names methods, those of each method too), and the Teams page says them under the profiles.
Saving a profile (POST /api/agent-profiles, PATCH /api/agent-profiles/{id}) checks docket.pipeline_by_type: a profile whose agent is named and is not docket is refused, a method outside the reported team's catalogue is refused naming the catalogue, and a method with missing_roles is saved with the sentence in the response's warnings. A team that reports no methods, or that no runner reports, is not second-guessed.
The list of teams
GET /api/teams lists every team any active runner reports, once per name and agent (the newest report wins), each with its agent, the runner that reports it, when, the whole TeamReport and the profiles that name it (tool_policy.docket.team, and tool_policy.agent when the profile names one); a name a profile uses that no runner reports comes last in the same list with reported: false and no report. A local agent reports a team of one (see above), so its entry is named after the agent, has no profile, and lists the profiles that run on that agent and name no team (a profile naming no agent runs on claude-code). An agent that reports no teams adds none. crates/tack-api/src/handlers/teams.rs reads the runners' stored snapshots and the profiles, nothing else.
The ceiling
The ceiling is read at merge time, never frozen in the request. tack_db::queries::autonomy::attempt_ceiling_inputs joins the attempt to its runner's capability snapshot and to resolved_agent_profile.tool_policy.docket.team in the request. tack_app::autonomy::ceiling_of then answers:
L3when the profile names a team the runner reports and that team is attended.- Otherwise the agent's own
autonomy_ceiling:L3when any team the runner reports is capped, elseL5. This covers a profile that names no team and a runner that does not report the one it names. - Unknown (
None) when the agent reports neither. An unknown ceiling is no hold.
tack_core::autonomy::Facts.ceiling carries it. In evaluate, Hold::HarnessCeiling { ceiling, wanted } is checked in the Trigger::Auto branch only, right after LevelBelowL4. The Merge button and the merge on Done are not held by the ceiling: the policy must say what will actually happen next time, and a team's profile can change between the run and the merge.
GET /api/projects/{id}/autonomy reports ceiling and a teams line for each team a role uses (TeamLine { name, profile, caps_at, fix, read_only, works_in, records }). The Ceiling rung of the UI reads it.
When a demotion takes the whole project to L3, tack_app::autonomy::demote also sets auto_start_enabled = 0 and writes the system comment DROPPED_TO_L3. Project.auto_start_disabled_reason is computed in the SELECT from that comment while auto-start is off and the level is L3.
Usage per model
A harness that can tell which models it used writes Usage.additional["by_model"], an object { "<model>": { "input": n, "output": n, "cache_read": n?, "cache_write": n? } }. Claude Code writes it from claude_code.rs; docket from usage.byModel (DocketAdapter::outcome, which keeps input and output only).
One SQL adds up everything. tack_db::repo::metrics::spend_by_model(repo, project, since) returns one SpendRow { model, team, tokens_in, cache_read, tokens_out, attempts } per model and team. An attempt with a by_model object counts once per model, with cache reads and writes added to tokens_in. Any other attempt counts under RUN_MODEL_SQL, the model the agent reported, else the one the run asked for. A run on the agent's default model that reported none has no model.
The Factory page (handlers/metrics.rs) reads it, so every figure it shows comes from the same rows.
A task that repeats
items.recurrence is weekly, monthly or quarterly (migration 089_item_recurrence). When a task with a recurrence enters a done status from one that was not done, create_next_recurrence in handlers/items.rs runs. It does nothing when an earlier successor (recurrence_of = this id) is still unfinished. Otherwise tack_core::recurrence::next_due computes the due date from the task's due date, or from today when it has none: a week later, the last day of the next month, or the last day of the quarter after the current one. clone_for_next copies the words and shape, drops the sprint and assignee, and keeps the roles through assign_role_to_item. The new task starts in the first to-do status and the closed one gets the system comment "Created the next one, due …".
The fake docket
No test in CI runs a real docket. crates/tack-runner/tests/fake_docket/mod.rs is an in-process docket on a loopback port, answering from recordings of a real docket (API 6, made by scripts/capture-docket-fixtures.sh) with the keys it has and no others, plus the keys docket sent after the recordings were made (workspaceKind, blueprint, pipeline.steps), which without_workspace_kind() and without_shape_and_steps() leave out as an older docket would. The tests that compare the fake's keys with the recordings leave them out until the recordings are retaken. Its README, crates/tack-runner/src/harness/fixtures/docket/v5/README.md, lists the routes it implements and the keys it leaves out (the directory is named v5; the answers are API 6). The adapter is tested against it in crates/tack-runner/tests/docket_api.rs.
To extend it:
- Add the route to the fake's router and make it record the request, so a test can assert on
FakeDocket::requests_to(method, prefix). - Script behaviour with a
Script: trace events before and after the gate, aGate(None,Approval,ConsultorHold), the final status, a file to commit on the task's branch, untracked files and the usage. Ahop_finishedentry may carrypromptManifestandartifact(summary,verdict,assumptions,questions): the fake writes them on the task record's hop and leaves them off the trace event, as docket does, and a hop given neither has neither key.-
An older docket. Each
without_*method serves the docket from before one feature, leaving the key out and the feature's name unlisted:Method Docket before What changes without_task_current()taskCurrentno currentwithout_task_cursor()taskCursorno rev;updatedSinceignoredwithout_failure_kinds()failureKindsa failed task with no kind of its own carries none without_settled_cursor()settledCursora cancel with an actoris refused; an escalation that settles keeps theseqit opened atwithout_hop_times()hopTimesa hop of the record carries no startedAt,finishedAtorcyclewithout_pod_pause()podPauseno pausedon the rows and reportsWith
settledCursor, an escalation that resolves, expires or is closed by a cancel takes the nextseq, andGET /escalationslists inseqorder. WithhopTimes, ahop_finishedentry that has arolegets the three keys (startedAtbeingdurationMsbeforefinishedAt, andcycle0 when the event names none), and one whose role is null gets none. -
Pausing.
pause_pod(team, reason)pauses a team, so a task posted to it stayspending;resume_pod(team)isdocket run --pod <team> --resume: the held tasks start. -
Escalations.
resolve_from_cli(task, option)settles the task's pending escalation as a person at docket's own CLI does, leaving the task held.ask_again(task, prompt)makes the same task open a second approval with an id of its own.next_task_from("cli")makes the next task one that did not come through the board. -
Conversations. The fake lists on
/healthand/status.jsononly the features it serves, sopodMemoryandreadScopeare never named, andconversationonly afterwith_conversation(). A task posted withconversation: {maxTurns}answers each turn short of the last with an escalation of kindturn, replies and closes it as docket does.set_pipeline_steps(team, n)makes a method of several steps, which refuses it with the captured400.close_conversation(task)is docket's CLI or sweep ending one.Script.repliesare the turns' answers andScript.more_questionsthe other questions of a consult call, each its own record with itspart, the task waiting until every one is answered. -
Task list. The fake stamps a
revon every task that changes and derivescurrentfrom its trace, as docket does. ItsGET /tasks/<pod>answer is built fromtasks-listandtasks-updated-since, which areconstructed(the capture script queues no task that stays running) from a task of a real run of docket.scripts/compare-constructed-docket-fixtures.pychecks their keys, with those of a finished task, a consult of several questions and the hop events, against such a run.
-
- Add the route to the "What the fake implements" list in the README, and the keys you skip to "What it leaves out".
- When docket's answer changes, run
scripts/capture-docket-fixtures.shagainst the new docket and replace the recordings; the README says which version they came from.
The daemon's supervision is tested separately with a shell script on a scratch path that serves /health; see crates/tack-runner/src/harness/docket/daemon/tests.rs.