Skip to content
Website ↗

Pheromone bus and scheduling ​

The pheromone bus gives agents in one local daemon a shared task state. Task cards track goals, dependencies, and execution status. Signals inform scheduling. Acceptance evidence records what the agents actually delivered. Keeping these records separate lets the scheduler react to new findings while preserving independent completion rules. Start with the task walkthrough, then use the rules below to trace one dispatch decision.

Task cards and leases ​

A TaskCard records the task, root, and parent IDs, its goal, acceptance criteria, dependencies, and status. A child inherits its root task ID, and the parent lists the new card as a dependency. Cards move from pending through claimed and running. Terminal states are completed, failed, and cancelled. The card records the task and its current authority, so the execution remains traceable after an agent exits.

Claiming a pending card requires completed dependencies and execution permitted by its ancestors. The bus sets an owner, increments the generation, sets an expiry of 120 seconds by default, and adds intent in the same command. Renewal extends the expiry within the same generation. Refreshing an expired lease clears it and returns a claimed or running card to pending. Earlier work that returns late fails the owner, generation, or expiry check for protected updates. A new claim resets acceptance for the card so the previous generation's result cannot satisfy it.

See TaskCard in packages/core/src/bus/task.ts:30, parent-child relationships in packages/core/src/bus/bus.ts:393, and requireLease, renew, and claim in packages/core/src/bus/lease-commands.ts:44, packages/core/src/bus/lease-commands.ts:59, and packages/core/src/bus/lease-commands.ts:232.

How the five signals take effect ​

Each deposit records the task, signal type, source, strength, creation time, and expiry. It can include a short note. Deposits on an active card require the current lease. The host can use depositExternal to record observations on pending or terminal cards. The same signal limits apply, and the observation leaves the task's status unchanged.

TypeWhat it recordsDefault lifetimesniff weight
alarmA blocker encountered during execution or review5 minutes5
intentA planned action such as claiming a task2 minutes4
doubtAn uncertainty to check or a failure that needs follow-up30 minutes3
trailProgress or findings other agents can use60 minutes2
successA successful action such as candidate review and selected checks30 minutes1

Effective concentration is the sum of unexpired, unresolved entries at read time. Each entry contributes its full amount until it expires. Cumulative deposits sum all retained entries, including expired and resolved ones. Defaults allow an integer amount from 1 to 10 per deposit, 512 stored signals per card, and at most 100 effective concentration per type per task. A deposit that would exceed any limit is rejected. These limits bound the influence of repeated reinforcement.

See DEFAULT_TTL_SECONDS, ARBITRATION_WEIGHT, and DEFAULT_BUS_LIMITS in packages/core/src/bus/signals.ts:24, packages/core/src/bus/signals.ts:33, and packages/core/src/bus/signals.ts:58. For writes and views, see packages/core/src/bus/signal-commands.ts:51, packages/core/src/bus/signal-commands.ts:120, and packages/core/src/bus/views.ts:99.

From signals to a dispatch decision ​

The bus's sniffTasks view ranks pending tasks with completed dependencies by weighted effective concentration and returns up to eight by default. During actual subtask dispatch, the runtime computes a stimulus using the parent task's trail and doubt. It checks the model budget, registry capacity, write conflicts, turn limit, and active parallel work before comparing the stimulus with the threshold for the caste and task kind.

text
Base stimulus = 5 + min(trail / 10, 3) - doubt / 10
Round to one decimal place, with a minimum of 1

For example, a parent with effective trail of 10 and doubt of 4 has a base stimulus of 5.6. The default threshold for a worker's code task is 5, and the default for a scout's code task is 6. The first clears this check. The second waits. Each full 10 seconds in the queue can add one point, with the waiting bonus bounded by the same threshold ceiling of 9. Settled subtasks feed back their results. A success attempts to add 2 trail and a failure attempts to add 4 doubt. The matching caste-and-kind threshold is multiplied by 0.9 for success or 1.1 for failure, within the range 2 to 9.

See sniffTasks in packages/core/src/bus/views.ts:153 and stimulusOf, ThresholdTable.reinforce, and schedule in packages/core/src/ant/scheduler.ts:160, packages/core/src/ant/scheduler.ts:58, and packages/core/src/ant/scheduler.ts:233. See parent signal inputs and feedback in packages/api/src/scout-subtasks.ts:430 and packages/api/src/scout-subtask-finalization.ts:25.

Active and unresolved alarms ​

Effective alarm of at least 3 on the parent limits concurrent subtasks to two or fewer. At 7 it limits concurrency to one. When the scheduler observes a concentration of 12 or more, it pauses new dispatch for five minutes. At the end of that interval it can reassess the concentration at the original source. With the default limit of three, for example, an active alarm of 7 makes additional subtasks wait while running work follows its own execution lifecycle.

Scheduling concentration and task completion use separate checks. An expired alarm can contribute zero to the effective concentration and still prevent completion until the current lease holder records it as resolved. Completion checks for unresolved alarms on the task and its descendants, along with current-generation acceptance, completed dependencies, and closed execution. See execution and acceptance

See packages/core/src/ant/scheduler.ts:169, packages/core/src/ant/scheduler.ts:273, and packages/api/src/scout-threshold-state.ts:40. See resolveAlarm and stageCompletion in packages/core/src/bus/signal-commands.ts:223 and packages/core/src/bus/lease-commands.ts:164.

See also the five castes. Source references identify symbols and lines in the Codant development version.