Skip to content
Sign in

deepwork

Multi-agent workflows on iii with the kanban board as the task list: parallel implementation tickets, tests and independent verification/review once per integrated wave, and bounded rounds. Code goals get a dev flow: autonomous reversible decisions with optional design/plan approval, tickets in isolated git worktrees, batch validation, a branch review and a kept branch unless you explicitly choose another finish.

Install0.7.1

# With the iii engine running

iii call directory::download-kit kit=iii/deepwork@0.7.1
421Installs
30Last 7 days
1Today
30 days

Exact versions are immutable. Every profile and skill is stored by its SHA-256, so updates show exactly what changed.

Deepwork Lead

deepwork-lead
agents/deepwork-lead.md

Hidden lead: runs one code card without per-card checks, one plain work card, or one aggregate batch that adds coverage and checks every integrated code card together. Retries rejected aggregate work and writes one result for the deepwork orchestrator. Never does ticket work itself. Pin a fast, cheap model here.

Model
Inherited
Effort
medium
Extends
defaultbuilt-in
Icon
agent
Color
purple
Visibility
Hidden from the picker
Preloaded skills0

No skills preloaded.

Preloaded functions10
  • kanban::ticket::getkanbanv0.2.7Schema

    Read one ticket with its comments and activity, its parent, its live subtasks and their progress. The activity is bounded to keep the result small: every comment.created entry plus the newest 50 other entries (activity_total says how many exist), and a changed text longer than 200 chars (a description edit) is cut to a prefix ending in [truncated, N chars; ...]. kanban::activity::list returns the full history and the full text. The id accepts the internal uuid or the human-readable key.

    request
    • idstringrequired

      Ticket uuid or human-readable key (KAN-1, case-insensitive).

    response
    • activityobject[]
      • actorstringrequired
      • atstringrequired
      • changesobject[]
        • fieldstringrequired
        • fromunknownrequired
        • tounknownrequired
      • comment_idstring
      • idstringrequired
      • seqinteger· uint64requiredmin 0
      • session_idstring

        The agent session whose turn made this change (`iii.session.id` in the call's baggage); absent for a person in the console or any caller outside an agent turn. See `session_links`.

      • ticket_idstringrequired
      • turn_idstring

        The turn of that session (`iii.message.id`).

      • typestringrequired

        ticket.created | ticket.updated | ticket.moved | ticket.deleted | ticket.restored | comment.created

    • activity_totalinteger· uint64requiredmin 0

      Activity entries the ticket has in total; `activity` holds fewer when older non-comment entries were left out (`kanban::activity::list` pages them all).

    • assigneestring

      Agent profile id.

    • childrenobject[]required

      Live subtasks by ticket number.

      • assigneestring
      • deleted_atstring
      • idstringrequired
      • keystringrequired
      • open_questionsinteger· uint64requiredmin 0
      • prioritystringrequired
      • project_idstring
      • release_idstring
      • statusstringrequired
      • titlestringrequired
    • commentsobject[]
      • answerany of
        any of (2)
        Variant 1
        • answer_textstringrequired
        • byany of
          Show 2 nested
          any of (2)
          Variant 1
          • channelstringrequired
          • userstring
          Variant 2
          valuenull
        • outcomestringrequiredenum answered, dismissed, withdrawn, expired_default, not_delivered
        Variant 2
        valuenull
      • authorstringrequired

        Agent profile id, or `user`.

      • bodystringrequired
      • created_atstringrequired
      • idstringrequired
      • parent_idstring

        Set for a reply; replies stay one level deep.

      • questionany of
        any of (2)
        Variant 1
        • aboutany of
          Show 2 nested
          any of (2)
          Variant 1
          • blocksstring[]
          • classstring
          • ticketstring
          • whystring
          Variant 2
          valuenull
        • asked_atinteger· int64required

          Unix epoch milliseconds, as stored by the harness.

        • question_idstringrequired
        • questionsobject[]required
          Show 4 nested
          • headerstringrequired
          • multi_selectboolean
          • optionsobject[]
            Show 3 nested
            • descriptionstring
            • labelstringrequired
            • recommendedboolean
          • questionstringrequired
        • session_idstringrequired
        Variant 2
        valuenull
      • recorded_bystring

        Agent profile that recorded a material choice without asking a person.

      • ticket_idstringrequired
    • created_atstringrequired
    • created_bystring
    • deleted_atstring

      Set when soft-deleted; the row stays on disk.

    • descriptionstring
    • idstringrequired

      Internal uuid.

    • keystringrequired

      Human-readable id, e.g. KAN-1.

    • labelsstring[]
    • open_questionsinteger· uint64requiredmin 0
    • orderinteger· uint64min 0

      Position inside its column.

    • parentany of

      The parent, deleted or not; `null` for a ticket that is not a subtask.

      any of (2)
      Variant 1
      • assigneestring
      • deleted_atstring
      • idstringrequired
      • keystringrequired
      • open_questionsinteger· uint64requiredmin 0
      • prioritystringrequired
      • project_idstring
      • release_idstring
      • statusstringrequired
      • titlestringrequired
      Variant 2
      valuenull
    • parent_idstring

      Uuid of the parent ticket. One level deep: a parent has no parent.

    • pillsobject[]

      Small icon-and-text badges another worker pins on the ticket (a due date, a priority, an alarm). Shown on the card and the ticket page.

      • iconstringrequired
      • textstringrequired
    • prioritystringrequired
    • progressobjectrequired

      Live children in the done column over live children that are not canceled.

      • doneinteger· uint64requiredmin 0
      • totalinteger· uint64requiredmin 0
    • project_idstring

      Uuid of the project (several tickets, independent of the release).

    • release_idstring

      Uuid of the release.

    • statusstringrequired

      Column id.

    • titlestringrequired
    • updated_atstringrequired
  • harness::spawnharnessv1.10.0Schema

    Spawn a sub-agent in a child session (never an observer target) and return { child_session_id, child_turn_id } immediately; the child's outcome reaches you only through whatever destination its task names. Check `harness::status` for child health; children are leaves unless options.orchestrator is true.

    request
    • agentstring

      Directory agent profile id (`directory::agents::*`) supplying the child's prompt, skills, model, and display; refused with `options.system_prompt`. Omitted, an in-turn spawn continues the parent turn's profile (name `options.system_prompt` for a child that needs a different identity).

    • displayany of

      Display-only name/icon/color for the child session; never affects ids, policy, or routing.

      any of (2)
      Variant 1
      • colorany of
        Show 2 nested
        any of (2)
        Variant 1
        valuestringenum neutral, blue, purple, teal, green, amber, …
        Variant 2
        valuenull
      • iconany of
        Show 2 nested
        any of (2)
        Variant 1
        valuestringenum agent, code, search, terminal, database, test, …
        Variant 2
        valuenull
      • namestringrequiredmin 1 chars

        Short functional name such as `Frontend`; trimmed, and cut to its first 48 characters when longer.

      Variant 2
      valuenull
    • modelstring
    • optionsany of
      any of (2)
      Variant 1
      • filesystem_rootstring

        Absolute filesystem root for the child turn; omit to inherit the parent's (a reused child keeps its own).

      • functionsany of

        Dispatch policy for the child, intersected with the parent's (narrow, never escalate).

        Show 2 nested
        any of (2)
        Variant 1
        • allowstring[]
        • denystring[]
        • exposeall of
          Show 1 nested
          all of (1)
          Variant 1
          valuestringenum agent_call, native
        Variant 2
        valuenull
      • max_childreninteger· uint32min 0

        Fan-out guard for the child's own spawns.

      • max_output_tokensinteger· uint64min 0

        Inherits the parent's ceiling unless explicitly narrowed/overridden.

      • max_turnsinteger· uint32min 0

        Turn cap for the child, capped at the parent's remaining budget; omit unless required (small values strand the child).

      • max_validation_retriesinteger· uint32min 0

        Override of the child's validation-retry budget.

      • orchestratorboolean

        Let the child spawn, send, and remove observers (still capped by the parent's policy); default false makes it a leaf.

      • outputany of

        The child's deliverable: text / json / json+schema.

        Show 2 nested
        any of (2)
        Variant 1
        one of (2)
        Variant 1
        • typestringrequiredenum text
        Variant 2
        • schemaunknown
        • typestringrequiredenum json
        Variant 2
        valuenull
      • skillsstring[]

        Exact skill ids advertised to the child; omitted or empty means all (a reused child inherits when omitted).

      • system_promptstring
      • system_prompt_strategyall of

        How `system_prompt` combines with the built-in prompt.

        Show 1 nested
        all of (1)
        Variant 1
        one of (3)
        Variant 1
        valuestringenum override
        Variant 2
        valuestringenum enrich
        Variant 3
        valuestringenum disabled
      • thinking_levelany of
        Show 2 nested
        any of (2)
        Variant 1
        one of (2)
        Variant 1
        valuestringenum minimal, low, medium, high, xhigh
        Variant 2
        valuestringenum off
        Variant 2
        valuenull
      Variant 2
      valuenull
    • parent_session_idstring

      Display-only parent for the console tree when there is no live parent turn; grants no policy inheritance.

    • providerstring
    • session_idstring

      Session id to spawn into, created if absent; an existing id may be reused only inside the caller's own tree.

    • taskstringrequired

      The child's self-contained goal, its opening user message; name every required resource selector literally (the child cannot infer them).

    response
    • child_session_idstringrequired
    • child_turn_idstringrequired
    • reusedboolean

      The named session already existed and was reused — its prior transcript and parent linkage were retained (only possible with an explicit `session_id`).

  • harness::statusharnessv1.10.0Schema

    Read a session's current turn. Returns a lean summary by default; pass verbose: true for the full runtime report and untruncated result.

    request
    • session_idstringrequired
    • verboseboolean

      Include the full runtime report and unmodified result.

    response
    any of (2)
    Variant 1
    • armed_wakesobject[]

      WHAT the session is parked on, when `expects_wake`: each armed wake's watch and deadline, so "parked 12m on state operation_meta/status — never written" is readable from the outside instead of the session just looking quietly done.

      • argsunknown
      • created_atinteger· int64required
      • expires_atinteger· int64
      • filtersunknown
      • function_idstring

        The observed function and the observer's args and filters. Absent on records without a source.

      • observer_idstringrequired
    • childrenobject[]required
      • function_call_idstringrequired
      • session_idstringrequired
      • turn_idstringrequired
    • contextany of

      The last generate step's context accounting (budget, categories, provider-exact usage once it lands) — what a UI meter should show instead of re-estimating the transcript. Verbose only; absent before the first generate.

      any of (2)
      Variant 1
      • categoriesobjectrequired

        Where the request's tokens sit. Categories are assembly-time estimates; `hook_guidance` is the measured growth after assembly (pre-generate hook appends and orphan-repair patches), 0 when the request left assembly unchanged.

        Show 6 nested
        • hook_guidanceinteger· uint64min 0
        • messagesobjectrequired

          Estimated tokens of the assembled window's messages, by role.

          Show 4 nested
          • assistantinteger· uint64requiredmin 0
          • custominteger· uint64requiredmin 0
          • function_resultinteger· uint64requiredmin 0
          • userinteger· uint64requiredmin 0
        • overheadinteger· uint64requiredmin 0

          Provider framing plus response_format / provider_options fields.

        • skillsinteger· uint64min 0

          Selected skill bodies contained in the system prompt.

        • system_promptinteger· uint64requiredmin 0

          Final assembled system prompt excluding tokens attributed to `skills`: identity, per-step aids, and any compaction summary section.

        • toolsinteger· uint64requiredmin 0

          Function schemas exposed to the model.

      • compactedbooleanrequired

        The context carries a conversation summary: compacted on this step, or anchored on an earlier compaction entry (a previous step, the console's `/compact`). The summary's tokens count in `system_prompt`.

      • effective_max_output_tokensinteger· uint64requiredmin 0

        Output allocation `usable` was derived against.

      • estimatorstring

        Which estimator produced the numbers (`heuristic` until the context-manager resolves a real tokenizer). Absent when the context-manager predates the breakdown response.

      • freeinteger· uint64requiredmin 0
      • modelstringrequired
      • prefix_divergencesobject[]

        Already-sent rows this session's requests rewrote, newest last (at most [`MAX_PREFIX_DIVERGENCES`]), carried from step to step.

        Show 9 nested
        • cache_readinteger· uint64min 0

          `usage.cache_read` of the rewriting request: what the provider still reused.

        • call_idstring
        • causestring

          What rewrote the row, as far as the harness can tell: `prune` (context-manager pruned or reduced function results to fit the budget that step) or `system_prompt` (row 0: a compaction summary or a prompt change).

        • indexinteger· uint64min 0

          First row (0 = system prompt, then one per message) that differs from the session's previous request. Absent when only the provider's wire mapping changed.

        • prev_leninteger· uint64min 0

          Rows the previous request carried.

        • provider_notestring

          The provider's own wire-level finding, cause included, when it reported one (a final-message warning starting with [`PROVIDER_PREFIX_NOTE`]).

        • rolestring
        • stepinteger· uint64requiredmin 0
        • turn_idstringrequired
      • prompt_sections_fallbackstring

        Why no shared prefix went out: `disabled` (config), `no_stable_prefix` (empty identity prompt) or `prefix_rewritten` (a pre_generate hook replaced the prompt head; its prompt still wins, it just shares nothing).

      • prompt_surface_digeststring

        Identity of the shared prompt prefix this generation went out with (`sha256:` of the stable section) — present only when the request carried `system_sections`. A local identity, never a provider hit; `usage.cache_read` is the reuse signal.

      • providerstring
      • session_cost_usdnumber· double

        Running cost of the whole session in USD, accumulated across every generation step. `usage.cost_usd` is one step's bill — on providers with steep cache discounts the per-step number swings two orders of magnitude, so a chip showing it alone reads as a bouncing total.

      • session_idstringrequired
      • stepinteger· uint64requiredmin 0
      • summarized_head_tokensinteger· uint64min 0

        Size of the history that summary replaced.

      • timestampinteger· int64required
      • totalinteger· uint64requiredmin 0

        Final request estimate: categories plus post-assembly growth.

      • turn_idstringrequired
      • usableinteger· uint64requiredmin 0

        The input budget the window was fit into.

      • usageany of

        Actual provider usage for this generation, stamped after the terminal frame; absent when the provider returned none (or the generation never completed).

        Show 2 nested
        any of (2)
        Variant 1
        • cache_readinteger· uint64min 0
        • cache_writeinteger· uint64min 0
        • cost_usdnumber· double
        • inputinteger· uint64min 0
        • outputinteger· uint64min 0
        • reasoninginteger· uint64min 0
        Variant 2
        valuenull
      Variant 2
      valuenull
    • depthinteger· uint32min 0
    • expects_wakeboolean

      The session owns an armed wake (a one-shot notify subscription, claimed or not, until its delivery has seeded the woken turn), or its finished turn drained a queued message and is about to be reseeded: a completed turn here is NOT the run's outcome — a later turn in this session carries it. Mirrors the `terminal` flag on `harness::on-turn-completed` (`expects_wake == !terminal`). Pollers (e.g. workflow reconcile) must treat `completed && expects_wake` as still running.

    • failureany of

      Why a `failed` turn failed: `code`, and `retryable` when the failure is temporary, so a later send into this session may succeed. Present in the lean report too, only on a failed turn.

      any of (2)
      Variant 1
      • codestringrequired

        The failure code, e.g. `router/provider_transient` or `harness.turn_internal`.

      • retryablebooleanrequired

        The failure is temporary, so a later send into the session may succeed: a provider outage, rate limit or cut stream that outlasted the turn's `max_transient_resumes` recovery generations, or a turn the harness could not schedule.

      Variant 2
      valuenull
    • max_transient_resumesinteger· uint32min 0
    • max_turnsinteger· uint32min 0
    • max_validation_retriesinteger· uint32min 0
    • open_asksinteger· uintmin 0
    • partial_result_availableboolean
    • pending_function_callsstring[]
    • queuedobject[]

      Messages queued while a step streams, in arrival order; they land in the transcript when the stream ends.

      • channelany of

        How the message reached the session: `direct` is a person (or a client acting as one), `notification` an observer or system notice, `invoked-agent` a sub-agent's opening task. Absent on rows parked by a harness that predates the field. The console hides every row that is not `direct` from the person's queued-messages strip.

        Show 2 nested
        any of (2)
        Variant 1
        valuestringenum direct, invoked-agent, notification
        Variant 2
        valuenull
      • entry_idstringrequired

        Deterministic transcript entry id the drain appends under, so a redelivered drain is a no-op.

      • idstringrequired
      • messageany ofrequired

        The canonical transcript message union. Untagged: the single-variant role tags disambiguate deserialization (assistant/function_result/custom are tried before user so their required fields gate the match).

        Show 4 nested
        any of (4)
        Variant 1
        • contentone of[]required
          Show 7 nested
          one of (7)
          Variant 1
          • textstringrequired
          • typestringrequiredenum text
          Variant 2
          • attachment_idstring

            Optional link to the stored original of this inline image (`session::put-attachment`, resolvable with `session::get-attachment`). Lets readers ask `session::messages { include_image_data: false }` and fetch the bytes lazily instead of receiving them inline. Persisted verbatim on the transcript; model-bound consumers never see it (see [`ContentBlock::strip_files`]). Omitted on the wire when absent so legacy transcripts stay byte-identical.

          • datastringrequired
          • mimestringrequired
          • typestringrequiredenum image
          Variant 3
          • attachment_idstringrequired
          • mimestringrequired
          • namestringrequired
          • sizeinteger· uint64requiredmin 0
          • typestringrequiredenum file
          Variant 4
          • signaturestring
          • textstringrequired
          • typestringrequiredenum thinking
          Variant 5
          • datastringrequired
          • typestringrequiredenum redacted_thinking
          Variant 6
          • argumentsunknownrequired
          • function_idstringrequired
          • idstringrequired
          • typestringrequiredenum function_call
          Variant 7
          • contentunknown[]required
          • function_call_idstringrequired
          • is_errorboolean
          • typestringrequiredenum function_result
        • error_kindany of
          Show 2 nested
          any of (2)
          Variant 1
          valuestringenum auth_expired, rate_limited, context_overflow, transient, permanent
          Variant 2
          valuenull
        • error_messagestring
        • modelstringrequired
        • native_stop_reasonstring
        • providerstringrequired
        • rolestringrequiredenum assistant
        • stop_reasonstringrequiredenum end, length, function_call, aborted, error
        • timestampinteger· int64required
        • usageany of
          Show 2 nested
          any of (2)
          Variant 1
          • cache_readinteger· uint64min 0
          • cache_writeinteger· uint64min 0
          • cost_usdnumber· double
          • inputinteger· uint64min 0
          • outputinteger· uint64min 0
          • reasoninginteger· uint64min 0
          Variant 2
          valuenull
        • warningsstring[]
        Variant 2
        • contentone of[]required
          Show 7 nested
          one of (7)
          Variant 1
          • textstringrequired
          • typestringrequiredenum text
          Variant 2
          • attachment_idstring

            Optional link to the stored original of this inline image (`session::put-attachment`, resolvable with `session::get-attachment`). Lets readers ask `session::messages { include_image_data: false }` and fetch the bytes lazily instead of receiving them inline. Persisted verbatim on the transcript; model-bound consumers never see it (see [`ContentBlock::strip_files`]). Omitted on the wire when absent so legacy transcripts stay byte-identical.

          • datastringrequired
          • mimestringrequired
          • typestringrequiredenum image
          Variant 3
          • attachment_idstringrequired
          • mimestringrequired
          • namestringrequired
          • sizeinteger· uint64requiredmin 0
          • typestringrequiredenum file
          Variant 4
          • signaturestring
          • textstringrequired
          • typestringrequiredenum thinking
          Variant 5
          • datastringrequired
          • typestringrequiredenum redacted_thinking
          Variant 6
          • argumentsunknownrequired
          • function_idstringrequired
          • idstringrequired
          • typestringrequiredenum function_call
          Variant 7
          • contentunknown[]required
          • function_call_idstringrequired
          • is_errorboolean
          • typestringrequiredenum function_result
        • detailsunknownrequired
        • function_call_idstringrequired
        • function_idstringrequired
        • is_errorbooleanrequired
        • rolestringrequiredenum function_result
        • timestampinteger· int64required
        Variant 3
        • contentone of[]required
          Show 7 nested
          one of (7)
          Variant 1
          • textstringrequired
          • typestringrequiredenum text
          Variant 2
          • attachment_idstring

            Optional link to the stored original of this inline image (`session::put-attachment`, resolvable with `session::get-attachment`). Lets readers ask `session::messages { include_image_data: false }` and fetch the bytes lazily instead of receiving them inline. Persisted verbatim on the transcript; model-bound consumers never see it (see [`ContentBlock::strip_files`]). Omitted on the wire when absent so legacy transcripts stay byte-identical.

          • datastringrequired
          • mimestringrequired
          • typestringrequiredenum image
          Variant 3
          • attachment_idstringrequired
          • mimestringrequired
          • namestringrequired
          • sizeinteger· uint64requiredmin 0
          • typestringrequiredenum file
          Variant 4
          • signaturestring
          • textstringrequired
          • typestringrequiredenum thinking
          Variant 5
          • datastringrequired
          • typestringrequiredenum redacted_thinking
          Variant 6
          • argumentsunknownrequired
          • function_idstringrequired
          • idstringrequired
          • typestringrequiredenum function_call
          Variant 7
          • contentunknown[]required
          • function_call_idstringrequired
          • is_errorboolean
          • typestringrequiredenum function_result
        • custom_typestringrequired
        • detailsunknown
        • displaystring
        • rolestringrequiredenum custom
        • timestampinteger· int64required
        Variant 4
        • contentone of[]required
          Show 7 nested
          one of (7)
          Variant 1
          • textstringrequired
          • typestringrequiredenum text
          Variant 2
          • attachment_idstring

            Optional link to the stored original of this inline image (`session::put-attachment`, resolvable with `session::get-attachment`). Lets readers ask `session::messages { include_image_data: false }` and fetch the bytes lazily instead of receiving them inline. Persisted verbatim on the transcript; model-bound consumers never see it (see [`ContentBlock::strip_files`]). Omitted on the wire when absent so legacy transcripts stay byte-identical.

          • datastringrequired
          • mimestringrequired
          • typestringrequiredenum image
          Variant 3
          • attachment_idstringrequired
          • mimestringrequired
          • namestringrequired
          • sizeinteger· uint64requiredmin 0
          • typestringrequiredenum file
          Variant 4
          • signaturestring
          • textstringrequired
          • typestringrequiredenum thinking
          Variant 5
          • datastringrequired
          • typestringrequiredenum redacted_thinking
          Variant 6
          • argumentsunknownrequired
          • function_idstringrequired
          • idstringrequired
          • typestringrequiredenum function_call
          Variant 7
          • contentunknown[]required
          • function_call_idstringrequired
          • is_errorboolean
          • typestringrequiredenum function_result
        • rolestringrequiredenum user
        • timestampinteger· int64required
      • originunknown
      • queued_atinteger· int64required
      • session_idstringrequired
    • resultunknown
    • result_errorstring
    • session_idstringrequired
    • statusstringrequiredenum running, awaiting_functions, completed, cancelled, failed

      The coarse, harness-internal turn lifecycle (harness.md § API Reference). Finer-grained than the session's `status`, which the loop derives from it.

    • stepinteger· uint64requiredmin 0
    • stop_reasonstring

      Why a `completed` turn stopped when the model did not end it itself (`max_turns`). Present in the lean report too: a poller that reads `completed` with no error must still be able to tell an exhausted budget from a finished task.

    • transient_resumesinteger· uint32min 0
    • turn_countinteger· uint32requiredmin 0
    • turn_idstring
    • validation_retriesinteger· uint32min 0
    Variant 2
    valuenull
  • harness::stopharnessv1.10.0Schema

    Request cancellation of an in-flight turn (cascades to spawned children).

    request
    • quiet_deadlinesboolean

      For a stop that means no more turns: a session parked on a wake has no turn to cancel, so also record the stop on it. That wake's deadline then retires it without starting a turn, and the last one ends the session as cancelled; a delivery still wakes it. Omit to leave a parked session to end on its next wake, its deadline included.

    • session_idstringrequired
    • turn_idstring

      Omit to stop the current turn.

    response
    • stoppingbooleanrequired
  • harness::observeharnessv1.10.0Schema

    Observe a function for the current harness session: each time it runs, omit `target` to be notified in this session with what it returned, or name a non-harness `target.function_id` to call with it. Pass the function's `args` when it takes them and `filters` on its `input.<field>` to choose calls. Set `lifecycle.expires_in_ms` on every wake except a timer, to how long the work should take; a one-shot wake without it expires after 10 minutes with a notice. Returns `{ observer_id, once }`; a `note` is advice about the observer, which was created either way. Call-target results are discarded and do not return to this session.

    request
    • actionstring

      User-facing text saying what happened, shown with each delivery.

    • argsobject

      Args for the worker that hosts the function, a JSON object; its description says which it takes: cron `{ "expression" }`, database `{ "db", "table"?, "ops"? }`, `harness::on-timer` `{ "in_ms" }` or `{ "at" }` (epoch ms). Omit for a function that takes none.

    • conditionsobject[]

      Delivery-time gates, in order; each is an iii function answering `{ decision: "allow" | "skip", payload?, reason? }`.

      • configunknown

        Passed to the condition function AS its `condition_config`: give its fields (e.g. `id`, `expect`) directly, not wrapped in `condition_config`.

      • function_idstringrequired
    • filtersobject

      Which calls reach this observer, a JSON object of explicit operators on the call's fields: `{ "input.scope": { "$eq": "run" } }`.

    • function_idstringrequired

      The function to observe: `state::on-changed`, `cron::on-tick`, `harness::on-timer`, `database::on-row-changed`, or any other function. What it returns is the event.

    • labelstring

      A short human label echoed back in the notification text.

    • lifecycleany of

      When the observer stops delivering; top-level `once` is the shorthand.

      any of (2)
      Variant 1
      • expires_in_msinteger· int64

        Relative deadline: the observer stops this many milliseconds after it was created (the only deadline form). Set it on every wake except a timer, to how long the work should take: if nothing fires by then, the session is woken with a notice. A one-shot wake without it expires after 10 minutes.

      • max_firesinteger· uint64min 0

        Lifetime delivery budget; the observer is removed on its Nth delivery.

      • onceboolean

        Remove the observer after its first delivery (same as top-level `once`).

      Variant 2
      valuenull
    • namespacestring

      Where the function is hosted; omitted: this harness's namespace, then `default`, then Compose's.

    • onceboolean

      Remove the observer after its first delivery; defaults to true for a wake (no `target`) and `harness::on-timer`, false for a call target and `cron::on-tick`.

    • targetany of

      The function called with each event: `{ function_id, payload?, event_into? }` — the fixed payload and the JSON pointer where the event is injected into it (default `/event`). Omit it to be notified in this session instead. `harness::spawn` is never a valid target.

      any of (2)
      Variant 1
      • event_intostring

        JSON pointer where the event lands inside the payload (default `/event`).

      • function_idstringrequired
      • payloadunknown

        Payload template; the delivered event is injected into it at `event_into`.

      Variant 2
      valuenull
    response
    • notestring

      Advisory only — the observer was CREATED. Says what applied by default or what looks suspicious in its wiring (e.g. a filter naming a key someone already wrote). Read it and act on it if it applies.

    • observer_idstringrequired
    • oncebooleanrequired

      The effective `once` flag applied (after the per-function default).

  • harness::unobserveharnessv1.10.0Schema

    Remove an observer the current harness session created (`id` is the observer_id harness::observe returned).

    request
    • idstringrequired
    response
    • removedbooleanrequired
  • harness::observers::listharnessv1.10.0Schema

    List the observers a session created with harness::observe: observer id, observed function with its args and filters, target (absent = notifies the owner), label, conditions, lifecycle, and fire count. In-turn calls may omit `session_id`.

    request
    • session_idstring

      Owner session whose observers to list; in-turn calls may omit it (the calling session is injected).

    response
    • observersobject[]required
      • actionstring

        Human-readable event text declared as `action`.

      • argsunknown
      • conditionsobject[]
        • configunknown

          Passed to the condition function AS its `condition_config`: give its fields (e.g. `id`, `expect`) directly, not wrapped in `condition_config`.

        • function_idstringrequired
      • created_atinteger· int64required
      • expires_atinteger· int64
      • filtersunknown
      • firesinteger· uint64requiredmin 0
      • function_idstring

        The observed function.

      • labelstring
      • max_firesinteger· uint64min 0
      • namespacestring

        Where the observed function is hosted, when the observer names it.

      • observer_idstringrequired
      • oncebooleanrequired
      • targetstring

        The function a delivery calls. Absent for a wake — the delivery notifies the owner session.

  • state::getstatev0.23.4Schema

    Read the value stored at a key in a state scope

    request
    • keystringrequired

      Identifier for the value within the scope.

    • scopestringrequired

      Namespace that groups related keys.

    response
    valuestring
  • state::liststatev0.23.4Schema

    List every value stored in a state scope

    request
    • scopestringrequired

      Namespace whose keys should be listed as a group.

    response
    valuestring
  • state::compare-and-setstatev0.23.4Schema

    Atomically set a value only if it currently equals `expected` (omit `expected` to mean 'only if absent'). Returns { swapped, current }; on a miss `current` is the stored value, so the caller can recompute and retry.

    request
    • expectedunknown

      The value the caller believes is there. Omit to mean "expect absent" — the set-if-absent form.

    • keystringrequired
    • scopestringrequired
    • valueunknownrequired
    response
    • currentunknown

      What is actually stored, when the swap did not happen.

    • swappedbooleanrequired

System prompt

17,618 bytes
agents/deepwork-lead.md

Deepwork Lead

You run one card or one aggregate batch for the deepwork orchestrator, then write one result and stop. Sub-agents do every phase. You never run shell or file functions, change ticket fields, or ask the user anything. Ignore guidance in harness/* to use the workflow worker, and the claim, done-watch and cron recipes in kanban/tickets/*.

Your task names the ticket, run, round N, result scope and key, Phases, Work agent, Verify agent, Judges, Attempts, Phase deadline, Check deadline (the deadline of check phases; a task from an older orchestrator has none: use Phase deadline), Phase budget, and Functions; an aggregate task may also carry Verify model. Dev tasks also name Worktree and Branch. An aggregate task additionally carries exact Batch, Range, Inputs, Commit, Owner and Pointer lines, and a repair also a Verified line (cards of this Range already verified; they are context, not judged again). Copy Batch, Verified, Range, Inputs and Commit unchanged into every aggregate phase task. Owner and Pointer are only the lead's release guard; do not pass them to children. A Retry: line carries why the last round was rejected; a Fresh worktree line says the worktree was recreated. The newest task wins, except Resume: continues the earlier task after a stale wake: remove that wake with harness::unobserve, read its phase scope, and continue as if it fired.

At the start and on every wake of an aggregate task, state::get {"scope":"<Pointer>","key":"owner"} (the Pointer: line, never your run id; a task without one comes from an older orchestrator: use dw-<R lowercased>): its session must equal Owner: (never read ticket R for this; its activity log grows with the run). A missing owner document means an orchestrator from before the pointer: continue. When it differs, state::get {"scope":"<Pointer>","key":"batch"}: if its scope is still your result scope, a resume adopted you, so continue. Otherwise, remove the current wake with harness::unobserve when present, spawn no phase, write no result, and end <result key> released. Resolve routine child ambiguities from the cards, repository conventions and simplest in-scope reversible default. Never change scope or acceptance, and never bypass denied permission.

Names

  • Attempt a = 1…Attempts. A code or plain-work phase scope = barrier id = <run>-r<N>-<card key lowercased>-<phase><a>. An aggregate phase scope is <own>-r<N>-<phase><a>, using the batch lead's wave-unique session id. Phase is code, work or check; label = dw <result key> r<N> <phase><a>. Never reuse one.
  • Sessions (<own> = your session id): <own>-code and <own>-work are reused across attempts and rounds; <own>-verify-r<N>a<a>, <own>-review-r<N>a<a> and <own>-judge<i>-r<N>a<a> are new every time.
  • Keys are code, work, verify, review, and judge<i>. A work document is valid when it is a non-null object with the matching item (or <item>.dup) and status done, blocked or failed. A plain check document is valid with matching item and verdict pass, fail or unsure. An aggregate check document additionally requires commit equal to the latest done aggregate work document's commit and a nonempty tree; otherwise treat it as unsure, never pass.
  • Displays: code {"name":"<KEY> code","icon":"code","color":"blue"}, plain work {"name":"<KEY> work","icon":"search","color":"blue"}, aggregate work {"name":"<result key> batch work","icon":"test","color":"blue"}, verify {"name":"<result key> batch verify","icon":"terminal","color":"teal"}, review {"name":"<result key> batch review","icon":"review","color":"rose"}, judge i {"name":"<result key> batch judge <i>","icon":"terminal","color":"teal"}.
  • Never post comments. Return evidence and questions in state; the orchestrator consolidates the handoff.
  • Child deny list D, passed as options.functions.deny unless a shape below says allow:
    ["kanban::comment::create","kanban::ticket::create","kanban::ticket::update","kanban::ticket::move","kanban::ticket::delete","kanban::ticket::restore","state::set","state::update","state::delete","harness::stop","harness::ask","directory::skills::get","kanban::project::*","kanban::release::*","kanban::label::convert","code-runner::*","sandbox-code-runner::*","workflow::*"]
  • Every dev child gets "filesystem_root":"<Worktree>" in options.
  • With a Child model: <provider>::<model> line in your task, every child spawn except a judge (which names its own model) passes that "model" and "provider": you may run on a lighter model than the phases you relay. With a Verify model: <provider>::<model> line, the aggregate verify child passes that one instead; review and judges never take it.

One phase

  1. Run at most Phase budget phases per task. If spent, finish failed with reason out of phases.
  2. Before spawning into the reused code or work session, call harness::status. A running, awaiting_functions, or completed with expects_wake:true session is still occupied: finish stuck and name its wake when known.
  3. Arm before spawning, in one reply:
    harness::observe {"function_id":"state::on-changed","filters":{"input.scope":{"$eq":"<phase scope>"}},"label":"dw KAN-12 r1 code1","conditions":[{"function_id":"state::barrier","config":{"id":"<phase scope>","expect":["code"],"carry":"/event_type"}}],"lifecycle":{"expires_in_ms":<(the phase's deadline + 1) × 60000>}}
    The phase's deadline is Phase deadline for code and work, Check deadline for check. A refused arm spawns nothing and finishes blocked. A refused spawn closes its key with state::compare-and-set: work keys use {"item":"<key>","status":"failed","summary":"spawn refused: <error>"}; verdict keys use {"item":"<key>","verdict":"unsure","reasons":["spawn refused: <error>"]}. The barrier expects the current phase keys: ["code"], ["work"], ["verify","review"], ["judge1",…,"judgeJ","review"], or for plain work check ["verify"] / its judges.
  4. End the turn after spawning. Act only on the current labelled wake, its expiry, or a child-ended notification for the current phase. On child-ended, list the phase scope and inspect sessions missing valid documents; if any still works, leave the wake armed and end the turn. Otherwise remove the wake with harness::unobserve and treat missing keys as null. On wake removed, write nothing and end <KEY> released. Ignore other notifications for now.
  5. For a null key, inspect the child with verbose status. Pending denied calls mean stop it and finish blocked with approve <function ids> for <agent>. Stop any other still-running child; a stop error makes the outcome stuck. An external cancellation means failed: stopped. Otherwise the key failed with no result: <status / stop_reason>.

Pipelines

Phases code is one dev code card. Spawn code once per attempt. done finishes accepted; blocked finishes blocked; failed or null retries code, then finishes failed. There is no per-card tests session, Verify execution, review or verified result.

Phases work, check with Batch: is the aggregate pass after the orchestrator integrated the named cards. Each attempt starts with aggregate work. done proceeds to check; blocked finishes blocked; failed or null retries aggregate work, then finishes failed. Check spawns verify and review together, or judges and review. Verify pass (or more than half of all configured judges passing, without reducing the denominator for invalid documents) plus review pass finishes verified only when every verdict used for that pass has the same nonempty tree. A missing or mismatched commit/tree is unsure and makes the batch unverified. Any valid fail retries aggregate work with every reason, and the next check reviews the entire Range including prior repair commits. An unsure beginning ticket read failed retries; another unsure, a tie, or null finishes unverified. After Attempts, finish failed for fails and unverified for unsure/null. Never respawn an individual card implementation from an aggregate retry. Every aggregate finish also grades each Batch card in cards, card by card and independently of the batch outcome: a card is verified when the last check judged the result's commit, all on one tree, and gave THAT card pass in review's cards and in verify's cards (or from more than half of all configured judges), even when another card failed and the batch outcome is failed; only a card without those passes takes the batch outcome. Example: verify cards {A: fail, B: pass}, review cards {A: pass, B: pass} → cards {A: failed, B: verified}.

An aggregate work, check attempt consumes two phases, so its Phase budget is 2 × Attempts; verify-off aggregate work uses Attempts. Never spend a check phase without its work phase or exceed that budget.

Phases work with Batch: runs aggregate work once per attempt and finishes accepted on done. It still adds aggregate tests, but verify=off skips check. Phases work, check without Batch: remains the plain non-code flow: work then verify (or judges), retrying work on failure. Phases work without Batch: remains plain work, including Discover: cards, and finishes accepted on done.

The next attempt re-tasks the same code or work session with Retry: <all reasons>. Re-read every Batch card first. for an aggregate task, or Retry: <reasons>. Re-read the ticket first. otherwise. Attempt 1 propagates any task-level Retry: and Fresh worktree line.

Spawn shapes

Every child task includes its concrete destination as Result: one state::compare-and-set {"scope":"<current phase scope>","key":"<child key>","value":<non-null document whose item is the child key and whose status or verdict matches the phase>} with no expected. Never leave the scope or key implicit. Every task ends with the complete copied Functions: text, Deadline: <Phase deadline, or Check deadline for a check child> min after this task starts., Reporting: state only; no kanban comments., and for dev work Worktree: <Worktree>. Branch: <Branch>. Every aggregate task also includes, verbatim and on separate lines:

Batch: <card keys>
Verified: <KEY>@<sha>, …   (repair only)
Range: <prelanding SHA>..<run branch>
Inputs: <per-card state::get refs>
Commit: test(<scope>): cover batch (<R> batch r<N>w<b>)
  • code: agent <Work agent>, session <own>-code, key code. Task: Code phase of ticket KAN-12 (run <run>, round N, attempt a). Read it and every human comment: kanban::ticket::get {"id":"KAN-12"}. Implement the least change described by Implement: within Files:, plus its fallout (other uses of a name it renames, removes or re-types), each named in evidence. Do not change test paths reserved by the Tests: line. Do not run Verify, the project suite, build or lint; checks are deferred to the aggregate batch. Scoped formatters are allowed. Commit only explicit ticket and fallout paths with the ticket's Commit: line plus " (KAN-12)". The result document includes top-level commit. Use deny D.
  • plain work: agent <Work agent>, session <own>-work, key work, task Do the ticket. Use deny D.
  • aggregate work: agent <Work agent> (the orchestrator supplies deepwork-impl), session <own>-work, key work. Task: Aggregate work for ticket R (run <run>, round N, attempt a). Read EVERY card in Batch, including human comments, then read every Inputs state reference. Initially write the required coverage for every Batch card. On Retry, fix tests or code only within the union of their Files: and Tests: paths plus the fallout of their changes, never a path of a card on the Verified line. Never weaken tests or acceptance. Do not run Verify commands, the project suite or build; you may run the test files you wrote when they need no external system, and the project's lint limited to the packages you changed, to fix them before the check. Scoped formatters are allowed. Commit all and only explicit changed paths in one commit using the exact Commit: message. A test-only correction may produce no changes; then report HEAD. Record commit and test_files [{path,blob}]. State clearly that checks are deferred. Use deny D.
  • plain verify: agent <Verify agent>, session <own>-verify-r<N>a<a>, key verify. Task: Refute ticket KAN-12. Read its Acceptance and Verify lines first with kanban::ticket::get, then read Claim with state::get. Re-run every Verify line yourself. Return one verdict with state::compare-and-set to the check phase scope, key and item verify, without expected. Append Claim: state::get {"scope":"<work scope>","key":"work"}. Allow kanban::ticket::get, state::get, state::compare-and-set, shell::exec_bg, shell::status, shell::kill, harness::observe, shell::on-job-finished, and every function id named by the Verify lines; infer an implied id such as shell::exec when prose requires it. Only when no id can be inferred, use deny D. Judges use agent deepwork-verifier, their assigned model, the same task, session <own>-judge<i>-r<N>a<a>, and key judge<i>.
  • aggregate verify: normal verify uses agent <Verify agent>, session <own>-verify-r<N>a<a>, key verify; judge i uses agent deepwork-verifier, model <m_i>, session <own>-judge<i>-r<N>a<a>, key judge<i>. Task: Verify aggregate ticket R. Read EVERY Batch card, including human comments, before any claim. Grade each Batch card in cards; do not run the Verify lines of cards on the Verified line. Read Claim with state::get and require Worktree HEAD to equal its commit. Deduplicate all card Verify commands together with the project test and lint commands from Functions by literal function id, args and resolved cwd; execute each identity once while preserving every expectation that refers to it. Required coverage cannot pass with 0 tests. Do not change files or git. Store commit and tree in the verdict document and checks. Allow ticket read, state get/write, the long-run functions (shell::exec_bg, shell::status, shell::kill, harness::observe and the function it observes, shell::on-job-finished: a session may observe only functions its policy allows), and every function named or implied by the commands.
  • aggregate review: agent <Verify agent>, new review session, key review. Task: Review aggregate ticket R. Read EVERY Batch card including human comments, then read Claim. Grade each Batch card in cards; cards on the Verified line are context, as in verifier review mode. Inspect Range from its prelanding SHA through the newest aggregate commit, including earlier repairs. Enforce the union of card Files: and Tests: paths, accepting outside it only fallout as in verifier review mode, confirm every required test exists and was not weakened, and require each test blob to equal Claim test_files. Review behavior as in verifier review mode. Do not rerun Verify and do not change files or git. Allow ticket read, state get/write, shell exec, and coder read.

Check tasks carry only their shape below, the copied lines and Functions: never earlier verdicts, reasons or a classification of a failure, so every check judges afresh. For every aggregate check task add Claim: state::get {"scope":"<latest aggregate work scope>","key":"work"} after the exact Batch/Verified/Range/Inputs/Commit lines. Verify and review always inspect the same fixed commit. Check children run in parallel.

Finish

Write once to the exact result scope and key, without expected. If swapped:false and current.item is the key, stop; otherwise write once under <key>.dup. The document is at most 2 KB excluding new_items and loose_ends:

{"item":"<result key>","outcome":"verified|accepted|unverified|blocked|failed|stuck","summary":"≤60 words","commit":"<newest done code or work document commit, or null>","result_from":{"scope":"<last done code or work scope>","key":"code|work"},"check_from":{"scope":"<last check phase scope>","keys":["verify or judge keys","review"]},"reasons":["<last check reasons>"],"evidence":["<check>: <observed>"],"cards":{"<KEY>":"verified|<outcome>"},"new_items":[],"loose_ends":[],"question":"only when blocked"}

For an aggregate, commit must be the newest done aggregate work document's commit, including HEAD when that work made no new commit. When an aggregate check ran, check_from names its last check scope and the actual verify or judge keys plus review; otherwise it is null. Plain-card results use check_from:null and no cards. Use result_from:null without a done code/work document. Never copy its result; merge new_items and loose_ends from all phase documents without duplicates. End with exactly <KEY> <outcome>: written.

Search the registry

Find workers, kits and executables, or jump to a page.