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

ResponsibilityOwner
What is done, in which order, with what priority and budgetTack
Which profile, and through it which team, takes a taskTack: 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 limitsdocket
Approvals and questions inside a rundocket raises them; Tack shows them and sends the answer
The verdict, the stages, the signatureThe verifier (prill is one)
Push, pull request, merge, level, ceilingTack
ParallelismTack'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.

  1. The tick. tack_app::auto_start::spawn adds the loop beside the GitHub poll in tack-cli's serve.rs. It calls tick every AppConfig.auto_start_seconds (TACK_AUTO_START_SECONDS, default 30, 0 starts nothing). The loop is its own task because the GitHub loop does not run without a token. tick lists the projects with auto_start_enabled = 1, not archived, with an auto_start_status, and calls project_tick for each.
  2. The candidates. project_tick reads 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 runs resolve_profile and default_selector (step 4) to learn whether a profile and a machine exist.
  3. The choice. tack_core::auto_start::pick is pure. It sorts by priority, then sort_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.
    • WentOver holds 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_open is 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.
  4. The request. start builds a CreateExecution with idempotency_key = "auto-start:<item>:<version>" and metadata.started_by = "auto_start". It names no profile, agent or selector. It sets permission_policy to the profile's tools for the agent and network from the profile (tack_core::run_defaults::profile_network_for: the profile's tool_policy.network, or for any agent but docket its tools for the agent being * or naming WebFetch or WebSearch; always true for opencode), and adds approvals: "ask" unless every machine the run may land on reports the agent's sandbox as bwrap or harness (sandboxed_everywhere). That is the Run dialog's rule. start_run then resolves the rest as for any other run, with the principal auto_start:
    • resolve_profile calls tack_core::run_defaults::resolve (next section) and records the source in metadata.profile_source.
    • The agent is the profile's tool_policy.agent, else the project's default_harness; with neither, the request is refused with select_an_agent.
    • default_selector returns the profile's fleet, else the only active runner, else an error.
    • load_profile snapshots the profile, fills permission_policy.network from profile_network_for (the profile and the request's agent) when the request does not carry the key (a request that says true or false keeps it), and resolves the run's limits; enqueue_run writes the request. A replay answers the same request and the tick does nothing more.
  5. The note. Only after the request exists, start writes the system comment "Started by itself: it reached X with the role Y" through merge::tell. It does not touch the task's status: only a person moves it.
  6. The claim. The scheduler (tack-orch, called through tack-app) matches the request to a runner. A request no runner can take waits with a reason and fails with no_runner_can_claim after SchedulingPolicy.unclaimable_fail_after, 30 minutes by default. The runner claims it when one of its attempt slots is free.
  7. The slot. On a claim the engine calls ActiveAttempts::register, which records the lease and returns a watch::Receiver<bool> that turns true when the server asks for a cancellation. One ticker sends a single heartbeat for every active lease (transport.rs, heartbeat_all) and passes each lease_results row to ActiveAttempts::apply. A folder worked in place stays one attempt at a time because workspace.rs locks the folder.
  8. The agent. For docket the engine drives DocketAdapter (validate, start, wait, cancel, reconcile), described below. For every other agent it drives the shared local_process lifecycle.
  9. 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.
  10. The merge. tack_app::merge::attempt collects the facts and calls tack_core::autonomy::evaluate. At L4 and L5 the autonomy tick (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:

  • waiting lists the tasks in the start status that the next pass would not start, most urgent first.
  • code is one of open_request, blocked, no_profile, no_machine, went_over, budget or max_open.
  • A project with auto-start off answers enabled: false and an empty list.
  • An agent credential with read on 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:

OrderInputSourcemetadata.profile_source
1The caller named a profileExplicitabsent
2The task's saved run settings, then those of each ancestor in turnRunSettingsrun_settings
3The profile of the roles at each link, when every role that names one names the sameRole(name)role:<name>
4The project's default profileProjectDefaultproject_default
5The built-in Implementer (kind = 'implementer')Implementerimplementer

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_of gives the item's Node (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 is planner or researcher. The refusal is CoreError::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-options answers [{profile_id, allowed, reason, node}] from the same runnable, 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), so pick never sees one. "Someone to do it" is true when the item or any ancestor has a role or a chosen profile.
  • fleet_id and harness come from the chosen profile's fleet_id column and its tool_policy.agent.
  • The server resolves; the browser does not. GET /api/items/{id}/agent-context answers profile_id and profile_source so 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 (started or finished), the verdict and the cycle, read from the text of the attempt's latest agent.hop_started / agent.hop_finished event. 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's limit.used.
  • never_started: true when the attempt failed and the computer refused it (harness_rejected), or the team's ceiling did (a message that names ceiling L<n>). The one rule is tack_core::run_outcome::never_started; GET /api/executions/{id}/attempts carries the same flag on each attempt.
  • verifier_recommendation: merge, review or reject, 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

StepCallFunction
VersionGET /status.json; apiVersion must be a number, 6 or laterprobe::status
The escalation recordGET /escalations?since=0 must answer 200probe::escalation_record
Teams and their profilesGET /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 itprobe::teams
Make the team once per processPOST /pods with ensure: true and no blueprint: docket's own default shape standsClient::ensure_pod
Where the team worksGET /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 repositoryDocketAdapter::has_repository
What the team wrote in this taskGET /pods/<pod>/records/<set>?limit=50&sql=SELECT * FROM <set> WHERE _task = '<task>', once per declared set, after the task endsrecords::kept
Post the attemptPOST /tasks/<pod>Client::enqueue_task
Read the taskGET /tasks/<pod>/<id>Client::task
Follow the hopsGET /traces/<pod>?since=<cursor>follow
Look for approvals and questionsGET /escalations?since=<seq>&task=<id>read_escalations
Answer eitherPOST /escalations/<id> with {optionId, content?, actor: "tack"}deliver
CancelPOST /tasks/<pod>/<id>/cancel with {reason, actor: "tack"}; actor only when settledCursor is listedcancel
Continue a step that stopped on its budgetPOST /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 secondretry_task, continue_offer
Untracked filesGET /tasks/<pod>/<id>/difffinish
Which features docket hasGET /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 pausedpaused (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 itprobe::paused, paused_team_line
What a team is doingGET /tasks/<pod>, with ?updatedSince=<cursor> when taskCursor is listed; the trace, as above, when taskCurrent is notactivity::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").

FeatureWhat it addsTack
taskCurrentcurrent on a running taskused: what a team is doing
taskCursor?updatedSince= on the task list, with rev and nextused: what a team is doing
podMemoryGET /pods/<p>/memoryused: through memoryStatus
readScopea second, read-only serve tokennot used: the runner sends its one token
conversationa task created with conversation: {maxTurns} runs one step turn by turnused: a thread is one task that continues (converse reads continues)
settledCursora settled escalation takes a new seq; actor on cancelused
failureKindsevery failed task has a failureKind; pod_budgetused
podPausepaused and pausedReason on a teamused
hopTimesstartedAt, finishedAt, cycle on a hopused
retryContinuesa retry re-runs the step that failed and continues its sessionused: Continue
budgetOutcomebudget on a hop that ran out of rounds, tool calls, tokens or timeused: Continue, Start over
networkEnforcednetwork.enforced on a team and each memberreads the key
podWorkDirworkDir on a folder teamreads the key
podFetchfetchDomains on a team and on each member that holds fetchused in the sentence that says how to give a team the web; the members' hosts: reads the key
webReadwebRead {mode, reason, fix} on a team and blocking on each needused: the refusal quotes reason and fix; TeamReport.web_read; a need with blocking: false refuses nothing
searchsearch {provider, ready, reason, fix, options[{provider, command, secret}]} on a teamused: 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
capabilityMissingcapabilityMissing on a hop and failureKind: capability_missingreads the key
consultPartspart: {index, count} on the escalations of a consult with several questionsreads the key
pipelineCheckeda task naming a pipeline the team cannot staff is refused at claimused, 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
podShapeshape in a team's document and apply for a folder teamused: the button that applies the repository's teams
podContractdelivers, methods and needs on a teamused: the team's contract
podResumePOST /pods/<p>/resumeused: Resume team
memoryStatus?status= on the memory routeused: what a team has learnt and waits to learn
memoryDecidePOST /pods/<p>/memory/<id>used: Approve and Refuse on the team's sheet
isolationPostureisolationPosture on GET /health: jailed or noneused: 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:

  • idempotencyKey is the attempt id, so a replayed post answers the same task.

  • externalRef is <item id>/attempt-<n>.

  • The card goes once, as fields. description is the profile's own instructions plus the card's fenced title, description and comments, built from the request's task (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 no task goes as the composed instructions alone. task is docket's structured request:

    • objective is the title.
    • doneWhen is the brief's definition of done, else the project's.
    • acceptance, constraints and risk are the brief's (acceptance and constraints one sentence each).
    • kind is the item's type as the project's vocabulary names it.
    • paths are the repository-relative paths the acceptance criteria name (a file or absent path, a command's cwd), without repeats.
    • answers are 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 brief is sent: docket would fold it into the description as a second copy of the same text. docket answers 400 for a key it does not know or a field of the wrong type, and the attempt fails with that sentence.

  • gate is the first acceptance criterion docket can run as a command (a command criterion, else a test or file check); a metric is never a gate.

  • baseRef is the commit the request's base revision names in the repository, or the rework_base branch for a rework.

    • POST /api/executions {from_run} also sets rework_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_run is refused not_found when it names no request, and unprocessable when that request belongs to another project or left no branch to continue from.
    • The request keeps the id it named as metadata.from_run (a from_run the caller put in metadata itself is dropped).
    • When the run's profile is a Reviewer and it succeeds with a result whose last Verdict: line is merge, review or reject, the word is stored in reviewer_verdicts against the newest attempt of that request. GET /api/projects/{id}/metrics/factory counts it in work_quality.verifier_agreement beside the pack's (verifier is prill or reviewer).
  • maxTokens comes from the request's token budget. restrictions carries deniedTools from tool_policy.docket.denied_tools and network: "none" when the run has the network off. A restriction can only narrow what the team already has (ADR 0018).

  • pipeline is read from tool_policy.docket.pipeline_by_type by item type. priority and trusted are sent when the request's metadata carries them.

  • autonomy is 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_send never 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).

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.

  1. It reads the trace. It reads the trace page since the cursor and turns the records for this task into timeline lines:
    • hop_started and hop_finished become hop lines.
    • escalation_asked, escalation_resolved, escalation_expired and escalation_decided become lines of kind escalation.asked, escalation.resolved, escalation.expired or escalation.decided (escalation_progress). escalation_delivered makes 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>.cursor and is written by rename after each page is delivered, so a second adapter over the same directory resumes where the first stopped.
  2. 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), an input step, a gate and a change to the files that check it (check_changed).
    • The first record still pending that 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, with part (index, count). They are asked one after the other, each as its own decision whose metadata.part says which it is (only when count is above one), and docket keeps the step waiting until every one is answered.
    • An input whose only option is decline but which takes text is offered an Answer beside Decline.
    • The last seq below 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 wait is not a question: it becomes one line of kind escalation.waiting (once per escalation id), and a task blocked with wait_expired ends the attempt Failed with that code.
    • An approval marked outward is read once more by id (GET /escalations/<id>, the only route that carries call) before it is asked. The call rides in the decision's metadata beside outward: true, and every statement that settles or expires the decision removes call from it. Without a call the record is not asked and the timeline says to answer it in docket.
    • A docket that lists settledCursor gives an escalation a new seq when it resolves or expires, so the list read from since returns the held question in its final state. When that state is resolved (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 channel HarnessAdapter::answered_elsewhere_channel hands 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 kept next_question from reading another one. If the board cannot be told, the decision stays open until the attempt ends.
    • An expiry in docket cancels the task and the run ends not_answered.
    • A docket without settledCursor reports nothing of this.
  3. It reads the task.
    • While the task is pending and docket lists podPause (read once per attempt), the adapter reads GET /pods/<pod> on each poll until it finds the team paused. It then puts one line of kind agent.team_paused on the timeline with the command that resumes the team (paused_team_line). A pending task of a team that runs says nothing.

    • In done, failed, blocked or cancelled it stops. The code the attempt ends with depends on how the task ended:

      TaskAttempt ends with
      blocked, blockedReason is input_expirednot_answered
      blocked, failureKind is pod_budget (only from a docket that lists failureKinds)pod_budget, with the sentence "The team's budget is spent" and the command that resumes the team
      any other blockedblocked
      failed with no more specific kinddocket's hop_failed once docket lists failureKinds, failed before
      failed, failureKind is needs_human (a task at L5 whose tool call needs approval, which docket asks nobody about)needs_human, with docket's reason
      failed, failureKind is capability_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's reason, and missing (kind, name, fix) from the hop's capabilityMissing
    • Whatever the kind, when the last hop failed and its artifact.files_changed lists 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's branch, head_commit and base_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 in waiting_input or waiting_approval is 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 escalation expired, the adapter cancels the task and ends the attempt failed with not_answered. With a null expiresAt, as on a consult that docket does not expire, nothing ends the wait but an answer, docket's own resolution, or Stop.

  4. 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 and actor: "tack".
    • The text goes in content under the one property the record's requestedSchema names (reason for an approval, a gate or a changed check). An input answered in text sends no optionId.
    • An option docket does not offer is sent as deny where docket offers it, else decline.
    • A 409 (already settled) or a 404 means 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 ends not_answered. A failed task whose failureKind is approval_expired ends not_answered too, with docket's reason kept. Only a deny a person sent is approval_denied.

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), class and family (from the hop's promptManifest);
  • verdict and summary (the handoff's), and ok;
  • prompts: the manifest's layers, each layer, name, version, sha256, scope, tokens;
  • the assumptions and questions the handoff carried.

Some entries are shorter:

  • From a docket that lists hopTimes, a hop that ran an agent turn also gives startedAt, finishedAt (ISO 8601 UTC, kept as docket wrote them) and cycle. 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, never null (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 steps at 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 (_id ascending), the id bound as a parameter, and with a _role on every row. _role is 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's role in the plan.
  • Without a scope (an older docket, which would silently ignore task= 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 is tack_proposals, the result carries plan_invalid with 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 ref is its index. parent and depends_on (refs separated by commas or spaces) become the indexes of other rows, and a parent must be an earlier row. acceptance is one sentence a line.
  • The result carries the document as plan. When a row does not convert (no ref or title, a repeated ref, a parent or depends_on that names no row), it carries plan_invalid with a sentence naming that row's ref instead.
  • evidence::capture stages plan exactly as it stages a tack-plan.json (the same artifact kind and the same checks) and turns plan_invalid into the attempt.plan_invalid event.
  • A tack-plan.json on 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}/resume picks the newest active runner that reports the team for that agent. It queues a TeamOperation::ResumeTeam for it in tack_app::runner_operations, in memory, and waits up to 30 seconds.
  • The runner polls POST /api/runner/v1/operations/poll every 3 seconds (transport::OPERATIONS_INTERVAL) and is handed each operation once.
  • It runs the operation with harness::do_team_operation and answers POST /operations/{operation_id}/result with an OperationOutcome: done with the team's report afterwards, or refused with 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:

  1. It makes the pod with POST /pods {name, blueprint, ensure}. It adds location (the project's folder) only for the build shape: for the other three docket takes location as 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. ensure on a pod that exists changes nothing, whatever shape it asks for.
  2. It sends POST /pods/<pod>/apply {directory: <folder>/.docket/teams/<team>}. docket refuses a pod.yaml whose shape is not the pod's (400, naming both) and answers 200 with every item skip for 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 (false for a team that was not paused, which is not an error), and 404 for 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 shows used at or over tokens.
  • 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.thread carries a TurnNote (tack-protocol conversation.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 the handoff summary 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.md at 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 (origin thread and origin_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 with conversation: {maxTurns}, the note's max_turns cut 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 as reply, as a done task would, and the task stays.
  • Every later turn reads that task's pending turn escalation and answers it, POST /escalations/<id> with optionId: reply and content: {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). The turn escalation 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_restarted first.
  • A team whose method has several steps answers 400 with code: conversation_needs_one_step and enqueues nothing. The same task goes again without conversation, the attempt's converse capability reads replays with 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 maxTurns or when its turn escalation expires after the team's approvalExpiryHours.

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):

FieldRead from
read_onlyreadOnly, 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
recordsGET /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
folderworkDir 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_tasksthe 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
shapeblueprint, 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|refused with {entries: [...]} (404 for a team it does not dispatch, 400 for another status). The adapter asks for pending and accepted on every probe, only from a docket that lists memoryStatus (probe::memory). An answer it cannot read, or an entry it cannot parse, leaves memory absent and the rest of the report whole, since an empty list and an unknown one are not the same.
  • Deciding. TeamMemory.can_decide says whether the docket lists memoryDecide. 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 is 422). That queues the runner operation DecideMemory for the runner that reports the team. The runner posts POST /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.", 404 names the team and the entry, 403 says the runner holds a read-only token.
  • Without the feature docket is not asked. The sentence gives docket pod memory approve <id> --pod <team> or refuse <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 refusals pod-memory-decide-* (409, 404 twice, 400 five times, 401) and pod-memory-evidence-*. The capture script builds the evidence entries in the throwaway home with docket's own MemoryEntry, because no task of the capture runs a command: they hold evidence {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 and with_memory_decide() the decision. seed_memory(team) and seed_memory_evidence(team) give a team those entries, decide_memory(team, id, status) is the operator's command at docket's CLI, and fail_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 join GET /api/teams makes, read by Repository::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: branch or report first, and records after it for a team that declares record sets. The adapter keeps the first, since the record sets are the team's records.
  • methods[]: every pipeline a task may name, one per name, most of them recipes a lean team lacks the roles for. default is 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 has error, missing_roles: [] and default: false, which is why error is read and not the empty missing_roles.
  • needs[]: a need's kind equals its name (fetch-hosts, search-host, isolation), and fix is empty once it is met.
  • budget (podResume): {tokens, used, window, windowStart} on every row and report, with window none, day or week; used counts over the window. The adapter lists podShape in the capability's API features; podResume is the presence of budget.

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 kind column, which a person sets in the profile form, POST/PATCH /api/agent-profiles or a project file, from tack_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:

MisfitWhen
no_webthe network is none and every member says reads_web: false
no_proposalsevery member says can_propose: false
no_repositorythe team delivers a report
unknown_method, method_broken, steps_skippedthe 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_unmetone 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 in start, after ensure and before POST /tasks/<team>. A misfit ends the attempt as Rejected with 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 /tasks having accepted the task), the attempt fails with the code pipeline and docket's sentence. tack_core::run_outcome::never_started counts 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_request when 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 whose can_propose is true and 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/teams lists each profile's misfits against 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:

  • L3 when the profile names a team the runner reports and that team is attended.
  • Otherwise the agent's own autonomy_ceiling: L3 when any team the runner reports is capped, else L5. 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:

  1. 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).
  2. Script behaviour with a Script: trace events before and after the gate, a Gate (None, Approval, Consult or Hold), the final status, a file to commit on the task's branch, untracked files and the usage. A hop_finished entry may carry promptManifest and artifact (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:

      MethodDocket beforeWhat changes
      without_task_current()taskCurrentno current
      without_task_cursor()taskCursorno rev; updatedSince ignored
      without_failure_kinds()failureKindsa failed task with no kind of its own carries none
      without_settled_cursor()settledCursora cancel with an actor is refused; an escalation that settles keeps the seq it opened at
      without_hop_times()hopTimesa hop of the record carries no startedAt, finishedAt or cycle
      without_pod_pause()podPauseno paused on the rows and reports

      With settledCursor, an escalation that resolves, expires or is closed by a cancel takes the next seq, and GET /escalations lists in seq order. With hopTimes, a hop_finished entry that has a role gets the three keys (startedAt being durationMs before finishedAt, and cycle 0 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 stays pending; resume_pod(team) is docket 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 /health and /status.json only the features it serves, so podMemory and readScope are never named, and conversation only after with_conversation(). A task posted with conversation: {maxTurns} answers each turn short of the last with an escalation of kind turn, replies and closes it as docket does. set_pipeline_steps(team, n) makes a method of several steps, which refuses it with the captured 400. close_conversation(task) is docket's CLI or sweep ending one. Script.replies are the turns' answers and Script.more_questions the other questions of a consult call, each its own record with its part, the task waiting until every one is answered.

    • Task list. The fake stamps a rev on every task that changes and derives current from its trace, as docket does. Its GET /tasks/<pod> answer is built from tasks-list and tasks-updated-since, which are constructed (the capture script queues no task that stays running) from a task of a real run of docket. scripts/compare-constructed-docket-fixtures.py checks their keys, with those of a finished task, a consult of several questions and the hop events, against such a run.

  3. Add the route to the "What the fake implements" list in the README, and the keys you skip to "What it leaves out".
  4. When docket's answer changes, run scripts/capture-docket-fixtures.sh against 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.