Skip to content
/ Lonca
Documentation contents

Orchestration

The leads

The conversations that settle what the rules cannot: a task lead per task and a Workspace Lead per workspace, deciding as a pair.

PlansFreeStandardProTeam

Orchestration's core is plain rules. When a rule cannot settle a question, it goes to the leads: a task lead for each task, and a Workspace Lead for each workspace. Both are Claude Code or Codex conversations that Lonca keeps itself, each with a fixed set of tools Lonca checks. They decide as a pair: a task lead settles its own task's questions or hands them up; the Workspace Lead settles what its task lead cannot, approves what reaches beyond a task, and is the conversation you have over the workspace's queue.

Three levels

A question climbs only as far as it has to: stage agent, then task driver, then task lead, then Workspace Lead, then you.

Task driverTask leadWorkspace Lead
What it isThe core’s rules for one taskA model, one conversation per taskA model, one conversation per workspace
When it runsAlwaysWhen the driver raises a question, or you write to itWhen you write to it, a task lead hands it something, a watched event comes, or a connected assistant’s message is sent
What it can reachIts taskIts own task onlyThe tasks of its own workspace, their queue, the workspace’s decisions and its projects’
TerminalNoneNone: headlessNone: headless

The decision log says who acted: Task driver for a task's rules, Task Lead for a task's judgement and Workspace Lead for the workspace's lead; a connected assistant is named by its client name. In Lonca's own vocabulary they are Ustabaşı (kural), Ustabaşı (akıl) and Kethüda. What the single lead of earlier releases decided reads as the Workspace Lead's.

The task lead

When the pipeline cannot settle a task's question by rule, the core gives it to that task's lead. Its conversation holds only that task: its consultations, its notes and what you wrote to it.

  • It starts at once. A lead never waits behind another task's question. A task has one turn at a time: a second question of the same task starts when the first turn ends.
  • It settles or hands up. The lead settles the question with Lonca's tools, hands it to the Workspace Lead, or hands what is yours by rule to you, in its own words. Its tools reach its own task alone, whatever a tool argument says.
  • Your answers go through it. Your answer to a stage agent's question goes to the task's lead, which carries it to the stage agent.
  • Its answer counts down. A lead's answer shows on the question card for five seconds before it goes, and you can stop it (see the countdown).
  • Nothing you say is lost. What you answer or write between its turns goes with the lead's next turn, under "Since your last turn:", each once. A message you write while a turn runs waits and goes as the next turn.
  • It explains what Lonca hands you. When a question comes to you without the lead deciding it (a stuck task, a step that failed twice, something outside the code, a question it did not settle in time), the lead writes a few plain sentences in your language on what is wrong and what you can do. They lead the card, and the rest folds under Technical details. The task never waits for them: if that turn fails, the card shows Lonca's own words.
  • It writes plainly. Its replies and questions are short and in plain words: what happened to the work and what is needed from you, without file paths, function names or Lonca's internal terms. Ask for the technical detail and you get it, in that conversation only; asking in one task does not change the others.
  • It knows what Lonca does. Its instructions, and the Workspace Lead's, carry a "What Lonca does" section written from Lonca's own list: what Lonca's core does by itself, what a stage agent asks Lonca for, what the leads do with their tools, and what is yours alone. task_status says which of those hold for the task's repository (an app started for E2E, a gate, a sign-in and its services, by name, never a value). So a lead does not send you to do what Lonca does itself, such as restarting the app or retrying a push.
  • Its links take you there. When a lead points you somewhere in Lonca (the task, a stage agent's session, a Settings section, the Configurator), the place is a button in its reply. A click opens the place and fills it in; saving, starting or sending stays yours (see Links that take you there).

When a lead's turn fails

A turn that crashes, runs past its nine-minute limit or is stopped does not hold the question, and is not tried again by itself. Under consultant and autopilot the question goes to the Workspace Lead, saying The task lead's turn failed: …; under assistant it comes to you at once, saying so. A turn that ends without settling the question is handed on the same way.

The lead also holds the task's brief conversation, before and after the hand-off: see The hand-off brief.

The Workspace Lead

Each workspace has its own lead: the conversation you have over that workspace's queue. Its tools reach its own workspace's tasks alone. A task of another workspace is refused in the same words as a task that does not exist, so it learns nothing of it. The tools that only make sense across tasks are its alone: listing its workspace's tasks, ordering them among the places they already held in the queue, answering what a task lead asks it to approve.

  • One per workspace, set up once. orchestration.workspace_lead configures every workspace's lead: they share its agent, model, effort and instructions. Each is a conversation of its own, and one busy with a question never holds up another's.
  • It arbitrates once. A question that comes back after a task lead settled it goes to the Workspace Lead, which settles it or hands it to you. Asked again after that, it comes to you; under assistant, at once.
  • It never holds work up. A Workspace Lead that does not settle a consultation within ten minutes, fails or is unavailable hands it to you, saying so.
  • Some things always come to you. Environment problems (a rejected push, gh not signed in) skip both models, after Lonca's own tries for a failure that may pass by itself.
  • An outside assistant is never you. A message from a connected assistant reaches the Workspace Lead quoted, as another model's request. It unlocks nothing that is yours to ask for, and does not stand over the lead's judgement as your word does. A turn it starts may only read, escalate to you and pause.
  • A stopped loop goes to the task lead first. It may carry the task on, with one more round. The same loop coming back after it was carried on, since you last answered a loop stop, comes to you. There is no limit on how many different stops it carries on.
  • A task with no workspace has none. Its task lead works as usual, and everything that would go to a Workspace Lead comes to you at once. The same holds for a workspace whose id is longer than 64 characters.
  • A task moved to another workspace belongs to that workspace's lead from then on: what the old lead held of the task goes to the new one, and the old lead's tools refuse the task from that moment.

The pair, before you

Under consultant and autopilot, a question the task lead cannot settle goes to the Workspace Lead before it comes to you. The task lead hands it over with ask_workspace_lead (the question, how it weighed it and its reason), or escalates it: the core routes a task lead's escalation to the Workspace Lead unless the lead marks it as yours by rule. A question the task lead's turn ran out of time on, failed on or ended without settling goes there too. The consultation then belongs to the Workspace Lead:

  • The question card says why it has it, in place of the thinking line: With the Workspace Lead: the task lead asked it., With the Workspace Lead: the task lead could not settle it. or With the Workspace Lead: it arbitrates a repeated question.
  • The task lead can do nothing with that consultation until the Workspace Lead answers: its tools are refused meanwhile.
  • The Workspace Lead settles it with the ordinary tools on that task: answer, send to the stage agent, rerun, settle a criterion, move, skip a finding, or escalate to you. The task lead hears what it did in its next turn.
  • It may leave the task lead a note with tell_lead. A note starts no turn and shows in the lead's conversation.
  • When it brings the question to you, the card quotes the task lead's words beside its own, and says why it had the question.

Advice given back

The Workspace Lead may give the consultation back to the task lead once, with its advice (advise_lead): what it sees from the workspace (another task, a decision, what you told it) and what it would do. The card then says With the Task Lead: the workspace lead advised it., and the task lead settles the question with the advice in mind. If the task lead hands it on again, the Workspace Lead settles it or brings it to you: the same question is never given back twice. An advised question that later comes to you carries the advice on its card once, beside the task lead's words.

What is yours by rule comes straight to you at every level: the anomalies (deleting outside the worktree, sudo, a force push or rewritten shared history, secrets read or sent outward), merging, deleting, dropping a criterion the issue's author wrote, and an open E2E check the environment does not block. A question also comes to you at a dead end: the same loop stop again, a stage at its limit of actions or consultations, or both models' turns on it failing.

Who may do what

The task lead's scope is its task: anything that reaches past it, the task lead proposes or asks for, and the Workspace Lead or you decide. The one exception is its own repository's project decisions, which it records and retires itself. Both leads read this table in their instructions, and Lonca refuses a call outside its column.

The task leadThe Workspace LeadYou
AreaIts taskIts workspace’s tasksEverything
Work on a task (answer, rerun, move, send, set a finding aside, settle a criterion, pause or resume, PR comments, fetch)Its taskAny task of its workspaceIn Lonca’s window
DecisionsRecords and retires its repository’s project decisions; proposes workspace onesRecords, retires, merges, moves; approves; offers a distributionEverything
A move past an unpassed review or gateAsks for approvalApproves or refusesMakes it
Queue orderNoneIts workspace’s queued tasksAll
PauseIts taskA task of its workspaceAll (Pause all)
Hand a question upTo the Workspace Lead; to you what is yours by ruleTo youNone
Hand a question downNoneGives it back with advice, leaves the task lead a noteAnswers

Who decides at each level

PlansFreeStandardProTeamAssistant and consultant: Standard. Autopilot: Pro and Team.

The level you choose under Settings → Orchestration, How much the leads decide, binds both models. Autonomy and decisions describes the levels in full.

LevelThe task leadThe Workspace Lead
AssistantHands a judgement to you with its recommendation, or first asks the Workspace Lead for advice. Its moves and decisions are proposed to you.Answers you in its conversation and receives watched events. Asked for advice, it applies only what is already decided, gives the question back once with its advice, or brings the rest to you with its recommendation.
ConsultantDecides what it has a clear recommendation for; hands the Workspace Lead what it cannot settle.Decides what it has a clear recommendation for. Escalates to you when it too is torn.
AutopilotApplies its own recommendation; asks the Workspace Lead only when it cannot form one.Applies its own recommendation. Escalates only when it cannot form one.

Moves past an unpassed review or gate

The leads can move a task from any step to any other. A task lead's move to a step after review, or after the gate, while that check has not passed in the current round, is not made at once: the Workspace Lead approves it first. A review whose findings were all set aside counts as passed.

  • While the Workspace Lead holds the request, the Flow tab shows a dashed notice, for example Waiting for the Workspace Lead: move from review to publish, skipping review and the gate, with the lead's note and reason.
  • An approved move then counts down for five seconds like any move, and you can stop it.
  • A refusal reaches the lead with the reason, as a refused call does.
  • Answering a question, rerunning a stage and a move that skips neither check are not held. Neither is a move the Workspace Lead makes itself.
  • A move asked during a consultation belongs to it. Once that consultation is settled, or the task is paused, the request is dropped and the lead is told, so an approval never lands after its question is over.

The request comes to you instead under assistant, with the Workspace Lead not ready, when it does not answer within ten minutes, or when the request cannot reach it within 30 minutes. A move then shows as a proposal on the Flow tab, with Move to … and Stay where it is. A move forward that skips checks is named in the pull request under Steps not run (see the PR description). Publishing is refused while a security finding is open.

Decisions

Decisions come in two layers (see Project and workspace decisions). What each lead may do with them:

  • A task lead writes its own project's decisions (P3): it records and retires the decisions of its task's repository, and no other. Under assistant they are proposed to you instead, as a card on the task's Flow tab.
  • A task lead only proposes a workspace decision (D12), with propose_decision: the text, the reason and, when it nearly repeats an earlier one, the reference it replaces. The Workspace Lead records it, with the same check for a decision close to another that the Decisions tab makes, or declines it, and the lead is told which.
  • Under assistant, or with the Workspace Lead unavailable, a proposal comes to you as a card on the task's Flow tab: Record saves it as yours, Dismiss drops it. A task has one proposal in flight at a time, across both layers. Nothing waits on it.
  • The Workspace Lead records, retires and merges the decisions of both layers: its workspace's, and those of its workspace's repositories. It may also offer to move workspace decisions to their projects (see The distribution offer).

On Free there are no leads, and you record every decision yourself (see Decision memory).

Variables

The leads see a variable's name and whether it is set, never a secret's value (see Variables and secrets). A task lead lists and sets its own task's plain variables, asks you for a value it cannot set, and asks the Workspace Lead for a project variable. The Workspace Lead sets and removes plain project variables within its own workspace, and asks you for a secret one. A secret is yours to enter and to remove. Under assistant every write is a proposal on your card.

Asking them to pause

Ask the task lead, or the Workspace Lead, in your own words to pause a task, or several, or to resume them. They put your words in the pause's reason, which shows on the task's card and on the paused card, and such a pause waits on you under Needs you, as one you made by hand would (see Pausing a task). A task lead pauses and resumes its own task; the Workspace Lead any task of its workspace. Pausing everything is yours: Pause all in the title bar. The Workspace Lead may also pause a task on its own when something is plainly wrong, and says what in the reason.

  • With a pause or a resume, a lead can propose a Jira move to the hold status (orchestration.jira.on_pause), or back, and a comment. The pause or resume happens at once; nothing reaches Jira until you approve it. The proposal is a card on the task's Flow tab, under Needs you: the move and the comment are checkboxes, ticked as proposed, and the comment's text is in a box you can edit. Untick what you do not want. Approve sends what is ticked, exactly as it reads; Dismiss sends nothing. The proposer hears your answer. If a move or a comment fails, the card stays and says why, and what already went is not offered again.
  • The Workspace Lead's conversation says how many wait (3 Jira proposals wait for you). Clicking it opens them all in one list, each with its own checkboxes, and Approve all sends each as it stands, after one confirmation that counts the comments and the moves. A proposal with nothing ticked is left out, for its own Dismiss.
  • A Jira proposal goes with one task: Pause all and load control propose nothing for Jira. A local story has no Jira issue, so its pause goes ahead without a proposal.
  • On Free, with no leads, pause and resume are by hand only.

What the Workspace Lead hears about

Three things tell the Workspace Lead without waiting for it:

  • a stage starting a third time in one round;
  • a lead moving a task back to the plan;
  • a lead skipping a finding.

Lonca sends a short notice with ids and the lead's reason, never a reviewer's finding text. The Workspace Lead acts only when something is wrong, with the same tools on that task. Notices are gathered and go with its next turn; a turn starts for them only when it is idle, and at most once every five minutes.

Where you talk to them

Each is a conversation with a message box. Enter sends; Shift+Enter or Option+Enter starts a new line. There is no terminal to switch to: what you write goes as a message, never typed into a session.

The task’s session picker
The Sessions panel's picker has a Task Lead entry, right after the Terminal: the task's whole conversation with its lead, the task's decisions between the messages, each turn's tool calls, and a message box. A turn that runs shows live.
⌘K
Opens a drawer on the selected task's lead; with no task selected, on the current workspace's lead. A switch in the drawer's header moves between the selected task's lead and its workspace's lead (a task with no workspace has only its task lead).
The Orchestration view
The Orchestration chip in the title bar opens it: the Board, a Flow and a Decisions tab, and under them the current workspace's lead, titled Workspace Lead · <workspace> (⌘J shows and hides it). With two workspaces or more, a control at the top offers the current workspace or All workspaces; under All workspaces the panel asks you to pick a workspace to talk to its lead. The conversation button beside the chip opens the current workspace's lead alone.
Discuss
Discuss with Task Lead on a question card opens that task's lead with the question quoted above the box.
The task menu
Talk to Task Lead about it opens the task's lead from the task list.

A command for you to run

When a lead wants you to run a command, it writes it alone in a bash block, exactly as it should run. Beside the block, Copy copies it and Run runs it in a task's Terminal, your own shell in the task's worktree: a task lead's in its own task's, the Workspace Lead's in the selected task's (in the Orchestration view, the task the view was opened on). A command of more than one line is shown whole before it runs. Neither lead can run it or see what it prints: when it needs the result, it asks you to paste the output into the conversation. A task lead does not ask that for its own branch: it reads it with branch_status. It never suggests a command that deletes or rewrites work, pushes, or reads secrets. See Sessions and agents.

Naming a task

In the Workspace Lead's conversation, type # to name a task: a list opens, matched by key and then by title, and the task you pick is written as #KEY. Each message carries the task it is about as a chip: the task whose page you wrote from, or the one you named (a task of another workspace is not that lead's). Opened from a task's page, the box says Writing about KEY. To ask about something else, pick All tasks.

⌘V pastes an image into any of these boxes, as in the Claude CLI: PNG, JPEG, GIF or WebP up to 10 MB. Dropping a file writes its path; Lonca does not read or copy the file.

Conversations with checked tools

A lead's turn on Claude Code runs it headless (claude -p), and Lonca writes every argument of its command line: the model, the tools, the folders it may read. Nobody could answer a permission question in such a turn, so what Lonca does not allow is refused:

  • Allowed: Lonca's own tool, and reading (Read, Grep, Glob) only under the folders Lonca names for that turn: a task lead's task folders, the Workspace Lead's own.
  • Refused: file editing, the web and sub-agents; git's .git folders, since a remote URL can carry a token; the folder that holds the leads' tokens.
  • Bound to their scope. A task lead's tool calls are bound to its own task by the channel, not by what it writes, and a Workspace Lead's to its own workspace. The Workspace Lead's tools are refused to a task lead, and the task lead's to the Workspace Lead.
  • Refusals it can act on. A reason longer than 500 characters is cut to fit, and the lead is told. Any other refused call names what was wrong: an argument the tool does not take, or a text's limit and its length.
ToolsWho has themWhat they do
task_status, read_artifact, read_stage_agent_screen, decision_log, list_decisionsBothRead the task, its files, a terminal stage agent’s screen, the decision log, the decisions
answer_question, rerun_stage, move_task, skip_finding, settle_criterionBothAnswer the open question, run a step again, move the task, set a finding aside, keep, reword or drop a generated criterion
send_to_stage_agent, fetch_documentBothWrite into a running stage agent’s terminal; read a document a stage agent asked for
handle_pr_commentsBothHand the PR’s comments over to be judged and applied, as Handle selected does; only when you asked for it
pause, resume, escalateBothPause or resume a task; hand the question to you
record_decision, retire_decisionBothKeep the decisions; a task lead its own project’s only
list_variables, set_variable, unset_variable, request_variableBothRead and set a task’s plain variables; ask you for a value
ask_workspace_lead, propose_decision, request_project_variable, explain_stopTask leadHand the consultation to the Workspace Lead; propose a workspace decision; ask for a project variable; explain a stop on your card
branch_statusTask leadRead its task’s branch as git sees it now: uncommitted files, ahead of and behind the base, the latest commits, the remote branch’s tip, and which of the remote’s commits are already here. It never fetches or writes
list_tasks, reorder_queueWorkspace LeadRead its workspace’s tasks, order its queue
offer_distribution, move_decisionWorkspace LeadOffer to move workspace decisions to their projects; carry out a move you approved
set_project_variable, unset_project_variableWorkspace LeadSet or remove a plain project variable in its workspace
approve, refuse, tell_lead, advise_leadWorkspace LeadAnswer a task lead’s held request; leave it a note; give a question back with advice

The leads on Codex

Codex has no rule that holds a read to a folder, so a lead on Codex reads nothing itself. Its turn runs codex exec read-only (--sandbox read-only, never asking), with its shell, its file and image tools, the web and sub-agents switched off, and your own Codex MCP servers switched off one by one. It reaches Lonca only through Lonca's MCP server, with the same tools as above, and two more of its own: read_file and list_folder.

  • The same folders. Lonca reads for it exactly the folders a lead on Claude Code may read in that turn: the task's folder, the code, the parent story's folder, the images of the conversation.
  • Refused: a path that leads out of them (.., an absolute path elsewhere, a link), .env files, keys, .ssh, git's own folder and Lonca's tokens.
  • Files and images. A text file comes 64 KiB at a time; an image comes as an image. The images you attach to a message go to the turn too.
  • One session. Its session goes on from turn to turn (codex exec resume) until fresh_at_tokens.

Configuration

The Configurator writes this block. workspace_lead: configures the leads: every workspace's lead, and the task leads unless task_lead says otherwise.

config.yaml
agents:
  - id: claude-lead
    label: Claude Code (leads)
    command: claude              # the program only: Lonca writes every argument

orchestration:
  workspace_lead:
    agent: claude-lead           # or codex-lead, with a Codex model
    model: opus
    effort: medium               # low | medium | high | xhigh | max
    transport: cli               # cli (default) or mcp
    fresh_at_tokens: 100000      # a fresh session past this context; null keeps one
    # prompt_file: prompts/workspace-lead.md
  task_lead:                     # optional: the task leads' own model, effort, instructions
    model: sonnet
    effort: medium
    # prompt_file: prompts/task-lead.md
  max_lead_actions_per_stage: 50
  max_consults_per_stage: 50
agent
A Claude Code agent whose command is claude, or a Codex agent whose command is codex, and, at most, placeholders (Lonca's entries: claude-lead, codex-lead). Any other word (a --permission-mode, an --allowedTools, Codex's -c or --sandbox) makes the config fail to load, and so does an agent that is neither Claude Code nor Codex.
model
What the CLI’s --model takes. On Claude Code: an alias such as opus, a full id, a Bedrock or Vertex id, or a gateway’s name. On Codex: a model codex lists, such as gpt-5.5, never opus or sonnet, which Codex does not know; a task_lead model is a Codex one too.
effort
How hard it thinks. Settings → Orchestration has a slider for it.
task_lead
Gives the task leads a model, an effort or a prompt file of their own; the Workspace Lead keeps the workspace_lead block’s. A key left out stays the workspace_lead block’s. It needs workspace_lead: and takes no other key.
transport
For the leads on Claude Code. cli reaches Lonca's tools through one command, allowed by a single permission rule. mcp uses Lonca's MCP server; use it only where your organisation's Claude Code settings allow --mcp-config. A lead on Codex always uses the MCP server.
fresh_at_tokens
Every turn re-reads the whole conversation. Past this context size, the next turn starts a fresh session, given the conversation’s last part. You still see the whole conversation. The smallest value is 60000.
prompt_file
Replaces the working instructions. How Lonca’s messages look, which tools exist and what Lonca does stay as Lonca writes them.
max_lead_actions_per_stage
Not a budget: this many actions on one stage without moving on is an anomaly, and the question comes to you. max_consults_per_stage is the same for consultations; advice given back counts as one more.

Before 12.0.0 these keys were orchestrator:, advisor: and max_advisor_actions_per_stage. The old names still load until 13.0, and after the update the Configurator renames them in place (see Updates and versions).

Always on, and restarts

Orchestration and the leads are always on: the leads' switch went in 12.0.0, and Pause all in the title bar makes every pipeline wait where it is. How much the leads settle themselves is How much the leads decide in Settings → Orchestration; Assistant brings you every judgement call. An install that had the leads switched off before 12.0.0 starts on Assistant, and a notice says so.

  • The leads take part while your plan includes them. A plan without them lets running turns finish and sends every new question to you.
  • Everything is kept in Lonca's files and database. After a restart, a held decision shows again with its countdown from the start and is not asked of the lead again; a question that was with a lead is given to it again; a request the Workspace Lead held is given to it again; and what waits for a lead's next turn still goes with it.
  • The conversations are kept under orchestrator/leads/ in Lonca's state folder (~/.local/state/lonca/), the latest 500 messages each: lead-<task id>/ for a task lead, ws-<workspace id>/ for a workspace's lead.
  • Before 12.0.0 one lead served every workspace. The update moves its conversation once: with exactly one workspace it becomes that workspace's lead, and the conversation goes on there; with more workspaces or none, it is kept aside as master-archived/, Lonca never reads it again, and each workspace's lead starts fresh. That folder is yours to keep or delete.

On Claude Code or Codex

The leads run on Claude Code or Codex, whatever your stage agents run on; never on a custom agent. The Configurator keeps them on Claude Code, and writes codex-lead when you ask for Codex or only Codex is installed. Settings → Agents moves them with the stage agents (see Settings), and Settings → Orchestration moves the leads alone, on the Workspace Lead's row. Moving them onto Codex puts a Codex model in place of a Claude Code name such as opus, and Settings says so before you save.

With neither installed

If neither Claude Code nor Codex is installed, the Configurator leaves the workspace_lead: block out and says so in its report. Then:

  • every question the rules cannot settle comes to you, on the task's Flow tab;
  • the Orchestration view shows the Board and says that there is no Workspace Lead to talk to, with Open the Configurator;
  • the task lead still holds the brief conversation, in brief mode: it reads, answers and proposes the brief, with no tools. It runs on the ai: command (Background AI), read-only, on Claude Code or Codex. With no ai: either, the conversation says that writing a brief needs Background AI, which you turn on in Settings → Agents.

The same brief mode applies before a hand-off, and on the Free plan.