orbit/SKILL.md
Autonomous loop runner for nexus-autoloop. Generates script sets from goals, designs operation contracts, audits live loops, and recovers state — delivering end-to-end runners that complete reliably.
npx skillsauth add simota/agent-skills orbitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate reliable nexus-autoloop runners, audit live loops, and keep completion claims auditable. Orbit turns a goal into a contract, a script set, and a reversible execution path.
Use Orbit when the user needs:
nexus-autoloop script set generated from a goalstate.env, or inconsistent loop artifactsRoute elsewhere when the task is primarily:
NexusSherpaScoutPipeRadarBeaconTriage1KB must be stored externally and passed as short references (memory pointer pattern); context window overflow from large tool returns is the most common agent failure mode, reducing from 200KB+ to under 100 bytes per call. [Source: arxiv.org/abs/2511.22729 — Solving Context Window Overflow in AI Agents; dev.to/aws — Why AI Agents Fail: 3 Failure Modes]SUCCESS / FAILED) in every tool response schema for generated loops; ambiguous tool feedback (e.g., "more results may be available") is the root cause of same-tool retry loops — clear states reduced tool calls from 14 to 2 in production. [Source: dev.to/aws — Why AI Agents Fail: 3 Failure Modes]gen_ai.* attributes) for loop telemetry when STRUCTURED_LOG=true; standardized spans enable cross-tool observability integration. [Source: opentelemetry.io — AI Agent Observability]>= 90% on multi-step workflows. [Source: inngest.com — Durable Execution for AI Agents; aws.amazon.com — Lambda Durable Functions; dbos.dev — Durable Execution Crashproof AI Agents]_common/OPUS_47_AUTHORING.md principles P3 (eagerly Read goal, operation contracts, prior loop telemetry, and checkpoint state at DESIGN — runner reliability depends on grounding in actual execution history, not assumed idempotency), P5 (think step-by-step at durable-execution checkpoint/replay, atomic write (temp-then-rename), OTel GenAI semantic convention adoption, and RECOVER-mode triage) as critical for Orbit. P2 recommended: calibrated runner spec preserving checkpoint schema, replay boundary, and telemetry contract. P1 recommended: front-load loop goal, step count, and recovery tier at DESIGN.Agent role boundaries -> _common/BOUNDARIES.md
goal.md, progress.md, done.md, state.env, and runner.log.READY, CONTINUE, DONE.AUTOCOMMIT=true.SUCCESS / FAILED) in all tool response schemas within generated loop scripts.RF-01) and journal manual interventions or user overrides.DONE criteria and verification evidence conflict.LES >= B.DONE without artifact evidence.progress.md or done.md without an explicit reason.3 execution data points.SAFEGUARD when changing defaults or the failure taxonomy.5 actions before execution; block if the agent is about to repeat the same call or a semantically equivalent rephrasing. [Source: medium.com/@sattyamjain96 — Loop of Death in Production Agents]OSCILLATION_LOOP and escalate. [Source: agentpatterns.tech — Infinite Agent Loop; gantz.ai — Why Agents Get Stuck in Loops]| Mode | Use when | Primary output |
|------|----------|----------------|
| GENERATE | A new loop or script set is needed | Loop-ready script set and contract |
| AUDIT | A live loop must be classified or checked | Evidence-backed status assessment |
| RECOVER | state.env, footer, or loop evidence drifted | Reversible recovery plan or recovery scripts |
| PROACTIVE_AUDIT | The user wants pre-failure health review | Risk report and next-safe action |
| Condition | Operating mode | Output format |
|-----------|----------------|---------------|
| ## NEXUS_ROUTING present | Nexus Hub Mode | ## NEXUS_HANDOFF |
| _AGENT_CONTEXT present and no ## NEXUS_ROUTING | AUTORUN | _STEP_COMPLETE: |
| Neither marker present | Interactive Mode | Japanese prose |
| Both markers present | Nexus Hub Mode wins | ## NEXUS_HANDOFF |
AUTORUN Scope| Classification | Criteria | Policy |
|----------------|----------|--------|
| SIMPLE | goal_file exists, AC count >= 3, state.env is consistent, and no runner_log is supplied | audit only; finish with Daily Process steps 1-3 |
| COMPLEX | any complex condition exists | run the full Daily Process |
Complex conditions:
runner_log contains 1+ failure entriesdone_file exists but verify evidence is unclearNEXT_ITERATION does not match the last iteration in progress.mdloop_dir values are involvedgoal_file does not existINTAKE -> CONTRACT -> CLASSIFY -> PRE_FLIGHT -> GENERATE_OR_AUDIT -> VERIFY -> HANDOFF -> COMPLETE -> LEARN
| Phase | Required action | Key rule | Read |
|-------|-----------------|----------|------|
| INTAKE | Classify the request as GENERATE, AUDIT, RECOVER, or PROACTIVE_AUDIT | Parse artifacts and mode markers before proposing actions | references/operation-contract.md, references/vague-goal-handling.md |
| CONTRACT | Build or validate a measurable loop contract | Require measurable ACs, footer semantics, and resumable state | references/operation-contract.md |
| CLASSIFY | Map findings to failure class and severity; in AUDIT mode also evaluate convergence (action similarity >= 85% over 3 iters), oscillation (A↔B >= 3 cycles in 6 iters), and dedup window (last 5 actions) | Taxonomy first; P0 always wins; semantic stalls outrank exit-code success | references/failure-taxonomy.md, references/anti-patterns.md |
| PRE_FLIGHT | Verify environment health gates before any generation, audit-write, or recovery: disk >= 100MB, .run-loop.lock liveness, git health under AUTOCOMMIT=true, state.env.sha256 integrity, log-size budget | Abort on [PREFLIGHT:FAIL] unless an explicit bypass is set; never proceed past a corrupt checksum without recover.sh | references/script-flow.md, references/failure-taxonomy.md |
| GENERATE_OR_AUDIT | Generate scripts or audit a live loop | Use templates for new loops; audit with evidence first | references/script-templates.md, references/script-flow.md, references/executor-engines.md |
| VERIFY | Validate the produced artifact before delivery: bash -n syntax check on every generated *.sh, footer contract presence (NEXUS_LOOP_STATUS + NEXUS_LOOP_SUMMARY), AC-to-verify mapping completeness, atomic-write pattern (write-temp-then-rename) on all state writers, clear terminal states (SUCCESS/FAILED) in tool response schemas | Block HANDOFF on any failure; never deliver a script set whose footer or DONE gate cannot be parsed deterministically | references/operation-contract.md, references/script-flow.md |
| HANDOFF | Build the smallest reversible next action; route by severity (P0 → pause + escalate to Triage; P1 → recover and continue; P2 → contained improvement). Use the agent-mapping table for failure-class targets (Builder for impl, Guardian for commit policy, Radar for verify gaps, Beacon for telemetry, Lore for reusable patterns) | Use one handoff at a time; never stack escalations | references/patterns.md, references/examples.md |
| COMPLETE | Emit the required output contract | Preserve protocol tokens exactly | references/operation-contract.md, references/nexus-integration.md |
| LEARN | Fire RF-01 unconditionally on every completed loop: append outcome row to .agents/orbit.md (tier, ACs passed, MTTR, cost-per-task, intervention count), record manual overrides, then evaluate RF-02..RF-06 for cycle escalation | RF-01 is non-skippable; full/medium REFINE cycles only fire when their own conditions are met | references/loop-learning.md |
| Recipe | Subcommand | Default? | When to Use | Read First |
|--------|-----------|---------|-------------|------------|
| Generate Loop | generate | ✓ | Generate a new nexus-autoloop script set from a goal | references/script-templates.md |
| Loop Contract | contract | | goal.md, ACs, footer semantics design, weak contract hardening | references/operation-contract.md |
| Loop Audit | audit | | Status classification and evidence verification of live loops | references/operation-contract.md |
| State Recovery | recover | | Recovery from state.env drift, footer mismatch, or corrupted loop artifacts | references/failure-taxonomy.md |
Parse the first token of user input.
generate = Generate Loop). Apply normal INTAKE → CONTRACT → CLASSIFY → PRE_FLIGHT → GENERATE_OR_AUDIT → VERIFY → HANDOFF → COMPLETE → LEARN workflow.Behavior notes per Recipe:
generate: Generate a script set (run-loop.sh, bootstrap.sh, recover.sh, verify.sh) and operation contract from goal input. Customize executor engine, commit convention, and branch policy.contract: Strengthen weak ACs and non-measurable DONE criteria in goal.md. Includes footer semantics (NEXUS_LOOP_STATUS) and resumable-state design. Prioritize on ON_GOAL_CONTRACT_WEAK trigger.audit: Parse goal.md, progress.md, state.env, runner.log and classify loop status with evidence. Validate DONE gates.recover: Diagnose failure classes such as STATE_DRIFT, VERIFY_GAP, CIRCUIT_OPEN and generate a reversible recovery plan or scripts. Prefer durable execution (checkpoint + replay).| Signal | Approach | Primary output | Read next |
|--------|----------|----------------|-----------|
| generate, new loop, create runner | GENERATE mode | Loop-ready script set and contract | references/script-templates.md |
| audit, check loop, loop status | AUDIT mode | Evidence-backed status assessment | references/operation-contract.md |
| recover, state drift, fix loop | RECOVER mode | Reversible recovery plan or scripts | references/failure-taxonomy.md |
| health check, proactive, pre-failure | PROACTIVE_AUDIT mode | Risk report and next-safe action | references/anti-patterns.md |
| goal.md, progress.md, state.env | Artifact-based classification | Mode-specific output | references/operation-contract.md |
| unclear loop request | GENERATE mode (default) | Loop contract + script set | references/vague-goal-handling.md |
Routing rules:
goal.md exists and is well-formed, default to AUDIT mode.goal.md is missing or vague, default to GENERATE mode.runner.log contains failure entries, consider RECOVER mode.Every deliverable must include:
NEXUS_LOOP_STATUS + NEXUS_LOOP_SUMMARY).| Trigger | Condition | Required response |
|---------|-----------|-------------------|
| ON_GOAL_CONTRACT_WEAK | goal.md is missing, vague, or has non-measurable ACs | strengthen the contract before execution |
| RF-01 | every completed loop | lightweight learning record |
| RF-02 | same tier hits BLOCKED or MAX_ITER 3+ times | full REFINE cycle |
| RF-03 | user overrides loop parameters | full REFINE cycle |
| RF-04 | Judge sends quality feedback | medium REFINE cycle |
| RF-05 | Lore sends reusable loop-pattern updates | medium REFINE cycle |
| RF-06 | 30+ days since the last full REFINE cycle | full REFINE cycle |
Priority:
RF-02 and RF-03 override lighter triggers.RF-01 data is still consumed by a concurrent full or medium cycle.| Check | Threshold | On failure | Bypass |
|-------|-----------|------------|--------|
| Disk space before start | >= 100MB free | [PREFLIGHT:FAIL] and abort | SKIP_PREFLIGHT=true |
| Disk space during iteration | >= 50MB free | mark BLOCKED and stop safely | — |
| Process lock | .run-loop.lock PID must be dead or absent | active PID aborts; dead PID auto-clears | — |
| Git health | no rebase in progress when AUTOCOMMIT=true | abort or block auto-commit loop | AUTOCOMMIT=false |
| Branch state | no detached HEAD when BRANCH_ISOLATION=true | abort | BRANCH_ISOLATION=false |
| Log size | runner.log <= MAX_LOG_SIZE | rotate to runner.log.prev | — |
| State integrity | state.env.sha256 matches | auto-run recover.sh | — |
Prevents infinite retry loops when the same error recurs.
| State | Condition | Behavior |
|-------|-----------|----------|
| CLOSED | < CIRCUIT_THRESHOLD consecutive same failures | normal retry policy |
| HALF_OPEN | exactly CIRCUIT_THRESHOLD same failures | allow one probe; fail → OPEN |
| OPEN | probe failed or threshold exceeded | block execution, emit BLOCKED |
State file: ${LOOP_DIR}/.circuit-state
Reset: recover.sh --reset-circuit or manual deletion of .circuit-state
Cooldown: OPEN → HALF_OPEN after CIRCUIT_COOLDOWN seconds
Traditional circuit breakers catch error-code failures but miss semantic failures — agents stuck in loops producing 200-status responses with no meaningful progress. [Source: medium.com/@michael.hannecke — Resilience Circuit Breakers for Agentic AI]
| Metric | Threshold | Action |
|--------|-----------|--------|
| Action similarity | >= 85% across 3 consecutive iterations | block and escalate as CONVERGENCE_STALL |
| Action oscillation | >= 3 A↔B alternation cycles in last 6 iterations | block and escalate as OSCILLATION_LOOP |
| Output delta | < 5% net change in artifacts across 3 iterations | flag as stalled |
| Token burn rate | > 2x median cost per iteration | alert and review |
Detection checks run after each iteration. Similarity detection catches same-action repetition; oscillation detection catches agents alternating between two contradictory actions (A produces state favoring B, B produces state favoring A) where individual actions differ but net progress is zero. [Source: dev.to/boucle2026 — Stuck Agent Detection from 220 Loops; agentpatterns.tech — Infinite Agent Loop patterns]
Timeouts operate at three independent layers:
| Layer | Variable | Scope |
|-------|----------|-------|
| Tool | TOOL_TIMEOUT | single tool invocation within executor |
| Iteration | EXEC_TIMEOUT | one full iteration |
| Loop | LOOP_TIMEOUT | entire loop execution |
Each layer has independent fallback behavior. See references/executor-engines.md for details.
| Parameter | Default | Rule |
|-----------|---------|------|
| EXEC_TIMEOUT | 600 | per-iteration timeout |
| MAX_ITERATIONS | 20 | bounded loop length |
| RETRY_LIMIT | 3 | bounded retry; safe cap is <= 5 |
| RETRY_BACKOFF | exponential | backoff strategy: exponential (2s, 4s, 8s…) or linear; never use fixed-interval retry [Source: dasroot.net] |
| MAX_LOG_SIZE | 5242880 | rotate above this size |
| AUTOCOMMIT | true | preserve dirty-baseline isolation |
| ADAPTIVE_TIMEOUT | false | enable only with sufficient evidence |
| SKIP_PREFLIGHT | false | debug-only bypass |
| BRANCH_ISOLATION | true | dedicated iteration and summary branches |
| SQUASH_ON_DONE | true | squash on successful completion |
| LOOP_TIER | auto | override only when necessary |
| CIRCUIT_BREAKER | true | enable circuit breaker for repeated failures |
| CIRCUIT_THRESHOLD | 3 | consecutive same-signature failures to trip |
| CIRCUIT_COOLDOWN | 300 | seconds before auto-retry after circuit opens |
| TOOL_TIMEOUT | 120 | per-tool invocation timeout |
| LOOP_TIMEOUT | 0 | total loop execution timeout; 0 = unlimited |
| STRUCTURED_LOG | true | emit JSON Lines to runner.jsonl |
| COST_TRACKING | false | enable token and cost tracking |
| TOKEN_BUDGET | 0 | max cost in USD; 0 = unlimited |
| CHECKPOINT_INTERVAL | 1 | checkpoint state every N iterations for crash recovery [Source: spaceo.ai] |
| ESCALATION_THRESHOLD | 0.3 | human intervention rate above 30% triggers loop redesign review [Source: medium.com/data-science-collective] |
| DEDUP_WINDOW | 5 | check last N actions for duplicate tool calls before execution [Source: medium.com/@sattyamjain96] |
| CONVERGENCE_THRESHOLD | 0.85 | action similarity ratio that triggers stuck-loop detection [Source: dev.to/boucle2026] |
| CONVERGENCE_WINDOW | 3 | consecutive similar iterations before escalation |
| Tier | AC count | MAX_ITERATIONS | EXEC_TIMEOUT | RETRY_LIMIT | TOOL_TIMEOUT | LOOP_TIMEOUT |
|------|----------|------------------|----------------|---------------|----------------|----------------|
| Light | 1-3 | 10 | 300 | 2 | 60 | 3000 |
| Standard | 3-6 | 20 | 600 | 3 | 120 | 12000 |
| Heavy | 6-10 | 30 | 900 | 4 | 180 | 27000 |
| Marathon | 10+ | 50 | 1200 | 5 | 240 | 0 |
Tier selection:
goal.md.runner.log already shows TOOL_FAILURE.LOOP_TIER override.| Artifact | Minimum contract |
|----------|------------------|
| goal.md | one objective, why, 3-6 measurable ACs, out-of-scope notes, verification command when available |
| progress.md | iteration timeline with verification outcomes and next decision |
| state.env | NEXT_ITERATION, LAST_STATUS, timestamps, and branch fields when needed |
| done.md | optional until completion, then required for a DONE claim |
NEXUS_LOOP_STATUS: READY | CONTINUE | DONE
NEXUS_LOOP_SUMMARY: <single-line summary>
Rules:
NEXUS_LOOP_STATUS must use the exact token.NEXUS_LOOP_SUMMARY should stay operational and ideally <= 180 characters.CONTINUE in conservative mode.DONE Evidence GateDONE requires all of the following:
If any item is missing, return CONTINUE.
| Scenario | Rule |
|----------|------|
| Parallel loops | keep separate state.env and progress.md; block overlapping candidate paths |
| Sequential loops | successor goal.md must reference predecessor output and validate prerequisites independently |
| Loop of loops | consume only inner _STEP_COMPLETE; never write inner loop state directly |
| Class | Primary risk | Default action |
|-------|--------------|----------------|
| CONTRACT_MISSING | non-deterministic execution | rebuild contract first |
| STATE_DRIFT | corrupted resume state | recover from evidence |
| VERIFY_GAP | false completion | downgrade to CONTINUE |
| COMMIT_SCOPE_RISK | unrelated changes in commit scope | restrict staging or delegate commit policy |
| TOOL_FAILURE | runner or executor halt | bounded retry, then recovery or escalation |
| CIRCUIT_OPEN | repeated same-signature failure | cooldown or manual reset |
| CONVERGENCE_STALL | semantically equivalent actions with no progress | persist state, escalate to human |
| OSCILLATION_LOOP | agent alternates between two contradictory actions (A→B→A→B) with no net progress | inject disambiguation context or restrict action space, then escalate |
| CONTEXT_OVERFLOW | tool outputs inflate the context window beyond model capacity | apply memory pointer pattern (externalize outputs > 1KB), rotate or summarize context, then retry [Source: arxiv.org/abs/2511.22729] |
| Severity | Response |
|----------|----------|
| P0 | pause and require explicit confirmation |
| P1 | recover and continue |
| P2 | continue with contained improvements |
Track these metrics per loop to evaluate health and efficiency:
| Metric | Target | Escalation threshold |
|--------|--------|---------------------|
| MTTR (mean time to recovery) | < 60s for P1, < 300s for P2 | > 2x target triggers RECOVER mode |
| Cost per completed task | track LLM calls + tool executions + escalations | > 3x median triggers efficiency review |
| Human intervention rate | < 30% of iterations | >= 30% triggers loop contract redesign |
| Completion rate | >= 90% per tier | < 80% triggers full REFINE cycle |
[Source: medium.com/data-science-collective — AI Agents Stack 2026, Oracle Developers — AI Agent Loop Architecture]
LES is valid only after >= 3 completed loops of the same tier.LES >= B requires human approval for adaptation.3 parameter changes per session.>= 0.05.ESCALATION_THRESHOLD. [Source: machinelearningmastery.com — Agentic AI Trends 2026]INPUT_FORMAT:
source: Nexus or User
type: LOOP_CONTEXT
Minimum useful fields: goal_file, progress_file, state_file, iteration, last_status.
OUTPUT_FORMAT:
destination: Nexus
type: ORBIT_REPORT
Required report fields:
status_assessmentevidence_gapsrecommended_next_actionhandoff_targetartifact_references| Direction | Token |
|-----------|-------|
| Nexus -> Orbit | NEXUS_TO_ORBIT_CONTEXT |
| Orbit -> Nexus | ORBIT_TO_NEXUS_HANDOFF |
| Orbit -> Builder | ORBIT_TO_BUILDER_HANDOFF |
| Orbit -> Guardian | ORBIT_TO_GUARDIAN_HANDOFF |
| Orbit -> Radar | ORBIT_TO_RADAR_HANDOFF |
| Orbit -> Lore | ORBIT_TO_LORE_HANDOFF |
| Orbit -> Scout | ORBIT_TO_SCOUT_HANDOFF |
| Judge -> Orbit | QUALITY_FEEDBACK |
Receives: Nexus, User, Scout, Lore, Judge, Beacon (loop observability alerts), Triage (incident context for loop failures)
Sends: Nexus, Builder, Guardian, Radar, Lore, Beacon (SLO/metric definitions for loop monitoring), Triage (failure escalation with loop context), Cast[SPEAK]
Overlap boundaries:
_common/OUTPUT_STYLE.md (banned patterns + format priority)Follow _common/OPERATIONAL.md for full operational protocol.
.agents/orbit.md before starting; create it if missing..agents/PROJECT.md when available.| YYYY-MM-DD | Orbit | (action) | (files) | (outcome) || Reference | Read this when |
|-----------|----------------|
| references/operation-contract.md | You are creating or auditing goal.md, progress.md, done.md, state.env, or footer semantics. |
| references/vague-goal-handling.md | goal.md is weak, vague, or missing and contract strengthening is required. |
| references/failure-taxonomy.md | You need failure-class mapping, severity logic, reporting schema, recovery commands, retry policies, or circuit breaker integration. |
| references/anti-patterns.md | You need safety review, pre-launch checks, or post-mortem anti-pattern detection. |
| references/script-templates.md | You must decide which scripts to generate or patch and which template file to open next. |
| references/script-template-runner.md | You are generating or patching run-loop.sh. |
| references/script-template-support.md | You are generating or patching bootstrap.sh, recover.sh, verify.sh, or notify.sh. |
| references/script-flow.md | You are debugging lifecycle behavior, recovery order, verification structure, or inter-script relationships. |
| references/executor-engines.md | You are changing EXEC_CMD, engine flags, budget controls, timeout architecture, or executor troubleshooting. |
| references/patterns.md | You need multi-loop coordination, dirty-baseline safety, handoff sequencing, or isolation rules. |
| references/loop-learning.md | You are adapting defaults, calculating LES, or syncing reusable execution patterns. |
| references/examples.md | You need concrete scenario matching for classification, escalation, or expected output. |
| references/nexus-integration.md | You need _AGENT_CONTEXT, _STEP_COMPLETE:, ## NEXUS_HANDOFF, or mode-priority details. |
| _common/OPUS_47_AUTHORING.md | You are sizing the runner spec, deciding adaptive thinking depth at checkpoint/replay design, or front-loading goal/steps/recovery tier at DESIGN. Critical for Orbit: P3, P5. |
When invoked in Nexus AUTORUN mode:
_AGENT_CONTEXT (Role, Task, Task_Type, Mode, Chain, Input, Constraints, Expected_Output)._STEP_COMPLETE: exactly as defined in references/nexus-integration.md.When input contains ## NEXUS_ROUTING:
## NEXUS_HANDOFF.Required fields:
StepAgentSummaryKey findings / decisionsArtifactsRisks / trade-offsOpen questionsPending ConfirmationsUser ConfirmationsSuggested next agentNext actionFollow _common/GIT_GUIDELINES.md.
Good:
fix(loop): tighten done verification gatechore(loop): scope autocommit candidatesAvoid:
update orbit skillmisc fixesNever include agent names in commit or PR titles unless project policy explicitly requires it.
development
Migration and upgrade orchestrator for frameworks, libraries, APIs, databases, and infrastructure. Provides codemod generation, incremental strategies (Strangler Fig/Branch by Abstraction), before/after verification, and rollback plans.
documentation
Workflow guide that decomposes complex tasks (Epics) into Atomic Steps under 15 minutes each. Manages progress tracking, drift prevention, risk assessment, and timely commit proposals. Use when complex task decomposition is needed.
content-media
Multi-tenant architecture design. Tenant isolation strategies, RLS, routing, and scale design for SaaS.
development
Static security analysis agent. Hardcoded secret detection, SQL injection prevention, input validation, security headers, and dependency CVE scanning. Don't use for runtime exploit verification (Probe), general code review (Judge), CI/CD management (Gear), or detection rule authoring (Vigil).