agentleFS
MicrosoftKnown publishermicrosoft/PilotSwarm/packages/sdk/plugins/mgmt/skills/orchestration-session-lifecycle/SKILL.md

orchestration-session-lifecycle

Skill14 starsChanged 8 months agoMITView on GitHub

How a PilotSwarm session maps to a duroxide orchestration. Read this before concluding that an "idle" session's orchestration is broken, stopped or stuck: most idle sessions are healthy, dehydrated and waiting for their next stimulus.

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When you call read_session_info and see no recent activity, that

    line 44
  2. Distinctive:

    no worker has picked it up

    line 72
  3. Distinctive:

    When asked "is this session healthy?", do not say "the orchestration is not running" unless you have verified the four-condition stall test …

    line 93
  4. Distinctive:

    "Stalled.": All four conditions of the stall test met.

    line 102
  5. Distinctive:

    Use these phrases. They map cleanly to operator action.

    line 105

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Orchestration ↔ Session Lifecycle

You are the agent-manager. Before reporting that a session looks "stuck", "stopped", or "missing its orchestration", read this carefully. The single most common false-positive in tuner reports is conflating session idle with orchestration not running. They are not the same thing.

The contract

A PilotSwarm session is a long-lived logical entity. The duroxide orchestration backing it is an event-driven generator that runs only when there is work to do and is otherwise dehydrated to disk. This is by design — it's how PilotSwarm scales to thousands of sessions on a few worker pods.

A healthy session spends most of its lifetime with no live orchestration in memory. That is the steady state. Not a bug.

Concrete lifecycle states

Session looks likeOrchestration isHealthy?
Just createdActive, running first turn✅
Mid-turn (LLM call in flight)Active, awaiting activity✅
Waiting for user inputDehydrated; history persisted✅
Cron'd background loop, between ticksDehydrated; durable timer pending✅
Idle for hours, no recent eventsDehydrated; ready to wake✅
state = completed in CMSTerminated, history retained✅
state = failed in CMSTerminated, last error recorded⚠️ investigate
Active in CMS but no recent iteration events for hours and no pending timerPossibly stuck⚠️ investigate

What "idle" actually means

When you call read_session_info and see no recent activity, that does not mean the orchestration is dead. To distinguish a healthy dormant session from a real stall, check all of:

  1. CMS state. state field. running / waiting / completed / failed / cancelled. Anything other than failed is not a fault per se.
  2. Pending timers / events. read_orchestration_stats(session_id) returns queue.pendingCount and KV counters. A non-zero queue means the orchestration has work waiting and will be picked up by the next worker. A zero queue with state = waiting is also normal — it means the orchestration genuinely has nothing to do and is correctly dehydrated waiting on a stimulus (user input, cron wake-up, child completion).
  3. Recent execution history. read_execution_history(session_id, limit=20) shows the most recent activities and timers. If the last entry is WaitForUserInput or TimerFired waiting on cron, the session is idle by design.
  4. Last checkpoint timestamp. From read_session_metric_summary: lastCheckpointAt / lastDehydratedAt. A session dehydrated 3 hours ago, with no events since and state = waiting, is healthy.

You only have a real stall when all of these are true:

  • state is running
  • there is a pending event in the queue (pendingCount > 0)
  • the last execution history entry is older than the orchestration turn timeout (typically minutes, not hours)
  • no worker has picked it up

That combination usually means a worker crashed mid-turn or the session has lost affinity. Anything short of that is not a stall.

Cron sessions in particular

sweeper and facts-manager use low-frequency maintenance cron timers (21600 seconds by default). pilotswarm and resourcemgr should not maintain recurring cron loops; they wake from direct operator prompts or runtime stimuli. Between ticks, cron sessions are dehydrated. Looking at read_session_info for a sweeper between maintenance ticks, you will see no live orchestration. That is correct.

The [cron 6h 0m] style chips you see in the sessions pane mean "this session has a pending cron timer firing in N seconds". The orchestration genuinely is not in memory — duroxide will rehydrate it when the timer fires.

What to report instead

When asked "is this session healthy?", do not say "the orchestration is not running" unless you have verified the four-condition stall test above. Say one of:

  • "Active and progressing." State=running, recent events.
  • "Idle (waiting on user/cron/child) — healthy dormant." State=waiting or active-but-blocked, no pending stuck events.
  • "Completed." State=completed.
  • "Failed at <step> with <error>." State=failed.
  • "Stalled." All four conditions of the stall test met. Recommend worker logs / restart.

Use these phrases. They map cleanly to operator action.

Things that look like bugs but are not

  • No recent agent_events in read_agent_events. Means no LLM turn has run recently. Expected for a dormant session.
  • hydration_count == 0 but the session is hours old. Means the session was created and ran exactly once, then dehydrated. Common for short reactive sessions.
  • Snapshot bytes growing. Normal — that's the point of the durable history.
  • pendingCount = 0 and state = waiting. Healthy dormant. Not stuck.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.