Operational automation
Operational automation turns alerts, recurring schedules, and agent requests into work with a useful operator outcome. It connects intake, scheduling, bounded agent turns, analytics, delivery, and service hosting while keeping work safe to inspect and recover.
System boundary
The system accepts an operational signal or a scheduled work definition. It runs the selected agent, skill, or report path, records the result, and sends that result to a remote channel or a local operator surface.
This diagram shows how an alert or schedule becomes measured work and an operator outcome.
flowchart LR
signal[Alert or request] --> intake[Validated intake]
schedule[Recurring or skill schedule] --> run[Scheduled run]
intake --> run
run --> turn[Agent, skill, or report turn]
turn --> analytics[Operational analytics]
turn --> outcome[Operator outcome]
outcome --> delivery[Remote channel or shell]
The gateway can host chat, web traffic, and scheduled work. A dedicated scheduler can own recurring work instead. Shared task state and run contracts keep the business flow stable when the host changes.
References: infrastructure/README.md• L3-10 infrastructure/…/__init__.py• L1-7 infrastructure/…/runner.py• L556-609
Alert intake
Alert intake gives monitoring systems a small HTTP boundary for sending operational events into the process. The boundary checks trust and payload shape before it places an accepted alert in shared state for slower work.
Alert boundary
The alert listener accepts structured alert details and adds a receive time when one is not present. A configured bearer token permits remote callers. Without a token, the mutating endpoint accepts loopback callers only. Invalid requests stop at the boundary, while accepted requests report queue state.
References: infrastructure/alert_intake.py• L47-66 infrastructure/alert_intake.py• L74-115 infrastructure/alert_intake.py• L118-127
Alert handoff
The inbox separates fast network intake from slower alert work. The gateway web host and interactive shell can install the same inbox, so alert intake does not depend on the surface that consumes alerts. A full inbox keeps the newest item and reports that an older item was dropped.
References: infrastructure/alert_intake.py• L23-44 core/…/inbox.py• L26-82
For the alert lifecycle and operator schedule entry points, see Alert intake and scheduling.
Scheduled work
Scheduled work runs reports, prompts, work-item actions, and agent loops at defined times. A schedule combines a work kind with timing, enablement, destination, and the inputs needed by that work.
Schedule definitions
Operators can create, inspect, edit, start, stop, run, and remove recurring loops. A loop can use a report-only turn or an agent turn. It can also use a deterministic report builder when model work is not needed. Agent loops can follow a catalog skill by name or an installed skill folder, while shipped loop templates provide current prompt text when available.
Manual loops can use the interactive shell, Slack, Telegram, or email when the required destination is ready. If no channels are named, the loop uses reachable defaults and removes duplicates. A loop group presents related task records as one operator-facing schedule.
An operator can also request one loop run from a supported host. That request starts a background run through the scheduled-work path instead of using the chat turn that requested it. The same start boundary supplies the loop owner and shares the host's in-flight and shutdown controls.
Loop edits validate the requested fields and update the current group as one change. A schedule edit does not recreate its task identity. Prompt and mode edits remain limited to ordinary manual loops with stored instructions, while managed skill or report instructions keep their owning source of truth. Manual loops can also change their delivery channels and destination details as one validated edit.
Supported scheduled work covers these operational patterns:
- Monitoring digests and uptime transition notices.
- GitHub pull request sweeps and analytics reports.
- Work item reminders and recurring check-ins.
- Manual prompt loops and recurring skills.
The scheduler carries a source label with each headless payload. This identifies the work path without coupling the scheduler to the service that runs it. Older stored task kinds are normalized before strict validation, so retired entries can become safe disabled records with a repair notice instead of disappearing.
References: infrastructure/…/types.py• L14-24 infrastructure/…/loop_constants.py• L5-53 infrastructure/…/sources.py• L1-23 infrastructure/…/loops.py• L303-425 infrastructure/…/loops.py• L473-554 infrastructure/…/loop_edit.py• L43-61 infrastructure/…/loop_edit.py• L63-201 infrastructure/…/run_now.py• L1-33 infrastructure/…/legacy_task_migration.py• L18-61
Scheduled report format
Scheduled report format gives every loop one portable Markdown shape. The prompt defines what the loop reports, while the shared style guide defines how it presents the title, headline, short sections, facts, actions, links, and coverage gaps.
The same report is parsed once and rendered for each destination. Channel adapters therefore render native Slack, Telegram, email, or shell output without asking the agent to write vendor-specific markup. The format also sets a destination-aware length budget so a report remains readable after delivery.
References: infrastructure/…/report_style.py• L1-14 infrastructure/…/report_style.py• L36-84 infrastructure/…/report_style.py• L87-98 infrastructure/…/report_layout.py• L1-13 infrastructure/…/report_layout.py• L73-115
Schedule timing
Schedules accept standard five-field cron expressions and six-field expressions with a leading seconds field. The second form supports fast polling work, while the standard form supports schedules that run no more often than once per minute. Prompt loops are normally limited to at most one run per hour; CI repair polling is the deliberate exception.
Invalid timing or time zones stop a schedule before it is stored. A schedule that uses a human time is converted to the same cron model used by the scheduler.
References: infrastructure/…/cron_expression.py• L1-12 infrastructure/…/cron_expression.py• L98-126 infrastructure/…/cron_expression.py• L159-179 infrastructure/…/loops.py• L254-283 infrastructure/…/runner.py• L381-399
Schedule storage
Task definitions live in a shared store that all relevant hosts can read. A schedule change wakes a running scheduler, and safe replacement protects a damaged store instead of silently overwriting it. The run database remains the authority for claims and recovery. Per-task run records give operators and later scheduled turns a durable view of each attempt.
The store treats a schedule as one configured definition for one organization. Repeating the same confirmation does not create duplicate work, while a changed pinned skill revision updates the existing definition. Removing or disabling a schedule also marks queued ticks as skipped, so an operator change remains effective after work enters the queue.
Task reads and mutations respect the active organization when a turn has organization scope. A process-wide store can therefore support several organizations without exposing one organization's schedules to another.
References: infrastructure/…/task_store.py• L190-226 infrastructure/…/task_store.py• L260-351 infrastructure/…/task_store.py• L354-394 infrastructure/…/task_store.py• L403-554 infrastructure/…/run_store.py• L155-279 infrastructure/…/run_store.py• L392-454 infrastructure/…/__init__.py• L1-48 infrastructure/…/task_visibility.py• L1-17
Scheduled execution
At a trigger time, the scheduler records the admitted tick and creates one stable execution identity from the task and its UTC fire time. Seconds remain part of that identity, so fast polling ticks do not merge into one run. A shared claim and renewable lease let several hosts observe the same store without running one tick twice.
The scheduler limits concurrent scheduled runs and can recover pending or expired work. A scheduler that starts after a short outage can run the latest missed tick once, while a live resync does not replay past slots after an edit. It can reconcile tasks added by another process without a restart. The executor rechecks current task state before it builds work and before it delivers the result. A schedule edit fences off obsolete automatic ticks, while an operator removal or disablement skips the run and prevents the result from being sent. Retained reports and per-destination outcomes allow a delivery-only retry without running the work again.
References: infrastructure/…/runner.py• L122-175 infrastructure/…/runner.py• L178-224 infrastructure/…/runner.py• L252-319 infrastructure/…/runner.py• L348-431 infrastructure/…/runner.py• L434-609 infrastructure/…/claim_lease.py• L31-48 infrastructure/…/claim_lease.py• L50-100 infrastructure/…/executor.py• L60-121 infrastructure/…/executor.py• L124-185 infrastructure/…/executor.py• L197-345 infrastructure/…/schedule_change.py• L12-33 infrastructure/…/schedule_cancel.py• L46-74 infrastructure/…/run_store.py• L155-316
Scheduled run continuity
Each scheduled attempt keeps the task definition, submitted prompts, built report, work result, delivery results, meaningful actions, and a short note for the next run. The next tick reads only its own finished history and uses it to avoid repeated work and follow up on open items.
Meaningful actions summarize successful changes and reported work outcomes. They identify the affected target and result while limiting command detail and removing credentials. This history gives analytics one bounded record for the full attempt and preserves the meaning of an earlier run after a loop changes.
References: infrastructure/…/run_history.py• L1-15 infrastructure/…/run_history.py• L169-204 infrastructure/…/previous_runs.py• L1-17 infrastructure/…/previous_runs.py• L72-79 infrastructure/…/previous_runs.py• L212-237 infrastructure/…/run_activity.py• L1-13 infrastructure/…/run_activity.py• L50-90 infrastructure/…/tool_actions.py• L1-13 infrastructure/…/tool_actions.py• L174-234
Recurring skill lifecycle
Recurring skills can run from a named and pinned skill revision or from a skill folder installed outside the signed catalog. Catalog skills use the active catalog snapshot. An installed skill reads SKILL.md at each tick, so a local update affects the next run. A verified catalog release activates for later turns while a running turn keeps its current snapshot. Release activation telemetry reports a remote release once per machine and release, while a fresh process using bundled cards is not treated as a new release.
Before a skill starts, host-owned checks can confirm that its needed integrations are usable. A missing or failed check does not invent a capability. A scheduled skill that needs a helper script or an interactive menu fails rather than running without its instructions. An installed skill also fails when its card is missing, empty, unreadable, too large, or has no usable instructions.
References: infrastructure/…/installed_skill.py• L1-7 infrastructure/…/installed_skill.py• L20-54 infrastructure/…/loop_prompt.py• L54-87 infrastructure/…/tasks.py• L246-264 infrastructure/…/loop_prompt.py• L28-51 infrastructure/…/puller.py• L1-7 infrastructure/…/puller.py• L60-118 infrastructure/…/telemetry.py• L1-49 infrastructure/…/skill_prerequisites.py• L1-8 infrastructure/…/skill_prerequisites.py• L37-63
GitHub CI repair is a related automation path with its own operator flow. It reserves one repository and pull-request scope, schedules a bounded repair, and keeps the evidence needed to explain the result. See GitHub CI repair automation for that path.
Agent turns
An agent turn is one bounded unit of model-led work that may use tools and return text. The same turn boundary supports visible user sessions and headless scheduled work, while the host supplies the surface-specific runner and output behavior.
Interactive turns
The shared turn runner gives chat transports and in-process callers one path for admitting work, binding a session agent, handling cancellation, finalizing output, and recording turn signals. Interactive turns keep a logical session and reuse one session-scoped agent across messages.
Each turn binds its output to the current transport. A shared session lease prevents another local host from changing the same session at the same time, while different sessions remain independent and can run concurrently.
References: infrastructure/…/turn_runner.py• L1-19 infrastructure/…/turn_runner.py• L118-196 infrastructure/…/turn_runner.py• L221-308 infrastructure/…/session_agents.py• L98-105 infrastructure/…/session_agents.py• L225-312 infrastructure/…/bindable_output.py• L1-8
Interactive shell controls
Interactive shell controls make operator prompts cancellable without making exit behavior ambiguous. Escape cancels a question and returns no answer. The first Ctrl+C shows an exit hint, while a second press within the short exit window accepts process exit. After exit starts, optional cleanup can stop while required session persistence still runs.
References: infrastructure/…/prompt_support.py• L20-59 infrastructure/…/prompt_support.py• L104-150 infrastructure/…/prompt_support.py• L211-265 infrastructure/…/prompt_support.py• L268-295
Background turns
Scheduled work calls a small headless agent contract. A headless turn has no live user session, so each unattended turn opens a fresh temporary session and closes it after the work ends. Unattended turns cannot run interactive shell commands, switch the runtime, or wait for a live answer. A question or approval becomes a deferred choice instead.
Approval state is bound to the exact tool name and effective arguments. This stops an answer for one action from authorizing a different action when the session resumes.
References: infrastructure/…/agent_runner.py• L1-28 infrastructure/…/runners.py• L35-61 infrastructure/…/tasks.py• L47-70 infrastructure/…/unattended_session.py• L30-71 infrastructure/…/unattended_session.py• L108-137 infrastructure/…/unattended_session.py• L159-185
Turn output cleanup
Turn output cleanup removes terminal plan snapshots from user-facing replies. The plan stays in the terminal overlay, while chat and scheduled output keep the agent's useful result without repeating checklist state.
References: infrastructure/…/plan_snapshots.py• L1-32
Stream guardrails
Stream guardrails protect operator-visible agent output while it is still being written. They hold chunks until a newline or bounded size so a secret split across reads is scanned as one unit. A detected block is replaced instead of stopping the stream, while audit-only matches remain visible and are logged.
Each flushed chunk with a match emits one bounded secret-detection event. This gives operators an exposure signal without truncating the agent result.
References: infrastructure/…/stream.py• L1-20 infrastructure/…/stream.py• L34-101 infrastructure/…/stream.py• L104-162 infrastructure/…/events.py• L82-89
Credential redaction
Shared credential redaction removes known credential patterns from diagnostic text and JSON-oriented structured values before they are retained or serialized. It returns a safe copy of mappings and sequences, redacts both mapping keys and values, and converts unsupported objects to redacted text. The same boundary supports scheduler history, analytics properties, trace decisions, and other operator evidence without changing the work result.
References: infrastructure/…/secret_redaction.py• L1-36 config/secret_redaction.py• L12-54 infrastructure/…/run_history.py• L55-72 infrastructure/…/event_properties.py• L92-101 infrastructure/…/decisions.py• L21-49
Turn capacity
All active turns share one process-wide capacity gate. A new request can be refused when the process is full. Work that has already been accepted, such as a scheduled run or queued remote prompt, waits for a slot because dropping it would lose the work.
Memory-heavy child work has a separate gate. Coding agents, repository clones, and CI repair workers wait there while keeping their turn slot. This protects the host from several large child processes exhausting the container.
References: infrastructure/…/slots.py• L1-15 infrastructure/…/slots.py• L41-114 infrastructure/…/heavy_work.py• L1-13 infrastructure/…/heavy_work.py• L59-117 infrastructure/…/concurrency.py• L72-120
Capability and process safety
Hosted and unattended turns use narrower capabilities than local interactive turns. The host records those limits before the harness plans the turn, so one shared turn model does not give every surface the same authority.
Child work runs under bounded process ownership. The Python sandbox limits time, network access, and writes. On Windows, a native job owns the root process and its descendants from launch through cleanup. Platform process boundaries therefore prevent cancellation from leaving child processes behind.
References: infrastructure/…/capability_policy.py• L12-29 infrastructure/…/unattended_session.py• L108-110 infrastructure/…/runner.py• L198-225 infrastructure/…/windows_job.py• L117-226 infrastructure/…/windows_job.py• L315-329
Integration resolution
The harness reaches integration behavior through registered host providers. Resolution can combine organization or web-app data with local store and environment data, while the session keeps a stamp that changes when an integration source changes. Account metadata and the remote integration generation are part of that stamp, so a later turn refreshes its view after credentials or workspace context changes without coupling the core harness to vendor packages.
Providers can also enrich the resolved view with vendor-neutral repository scope. They infer scope from the message, conversation, environment, working directory, and remembered references, then apply it to the turn without making the core harness name a specific version-control vendor.
Skill prerequisite checks use the same provider boundary. The host can hold a skill at entry when a known integration is missing, while an unavailable checker does not lock a user out by mistake. Provider registration happens at boot for each host profile, and reset clears the registries that providers populate.
References: infrastructure/…/__init__.py• L1-9 infrastructure/…/__init__.py• L137-173 infrastructure/…/integration_resolution.py• L131-181 infrastructure/…/integration_resolution.py• L195-235 infrastructure/…/integration_resolution.py• L204-215 infrastructure/…/integration_resolution.py• L274-287 infrastructure/…/integration_resolution.py• L337-447 infrastructure/…/repo_scope.py• L16-45 infrastructure/…/repo_scope.py• L59-114 infrastructure/…/integration_selection.py• L1-21 infrastructure/…/skill_prerequisites.py• L18-63
Detached CLI handoff
The interactive shell can hand a long-running captured CLI command to a detached child process without losing the work at the foreground timeout. The handoff keeps only a bounded amount of output for the operator, then continues draining the child pipes and discards later bytes so the child cannot stall on a full pipe. The child returns its real exit status when it finishes, while the shell reports that the work is still running.
This path keeps scheduled or otherwise important CLI work alive after the shell stops waiting. The private entry flag routes the detached child through the main process entry point, and the handoff owns cleanup if the child must be killed.
References: infrastructure/…/cli_handoff.py• L1-77 config/…/cli_handoff.py• L1-5 surfaces/entrypoint.py• L54-64 surfaces/…/cli_parity.py• L150-193 surfaces/…/cli_parity.py• L215-370
Operational analytics
Operational analytics records how work starts, completes, fails, and reaches an operator. It supports product and runtime views without making telemetry a dependency of the work itself.
Analytics context
Each event can carry the organization, usage surface, agent session, and user context that applies to the current process or turn. Interactive turns also bind a prompt-turn identifier. Scheduled turns add their task identity through the trace session.
Personal users, authenticated organizations, chat actors, anonymous installations, and automation runs remain separate identity grains. This prevents a gateway actor from being counted as a personal user and keeps automation out of human acquisition and retention views.
References: infrastructure/…/usage_context.py• L1-12 infrastructure/…/usage_context.py• L32-57 infrastructure/…/usage_context.py• L134-212 infrastructure/…/scheduled_task_attribution.py• L1-20 infrastructure/…/trace_session.py• L23-75 infrastructure/…/README.md• L85-110
Analytics events
The event vocabulary covers CLI use, integration setup, agent turns, gateway turns, scheduled work, skill releases, local safety, and repair workflow outcomes. Streaming guardrails add an event for detected agent secrets. Event properties use bounded names and values that answer an operational question without turning raw commands, paths, URLs, secrets, tool arguments, or tool results into a general event contract.
Scheduled work has three useful views: the task registry, a delivered loop report, and one finished run record. A run record joins its task, fire time, attempt, prompts, report, work result, actions, carry note, and per-destination outcomes. Delivered loop reports use a stable message identity, so recent inbox reports can be resent after a dropped capture without creating a new stored report. Scheduler registration reports a redacted and bounded whole-store task view on change, and refreshes an unchanged view after a short interval so dropped captures can be repaired. A stable event identity lets later registration passes repair a dropped capture without adding a duplicate.
References: infrastructure/…/events.py• L49-69 infrastructure/…/events.py• L82-92 infrastructure/…/capture.py• L347-400 infrastructure/…/capture.py• L690-747 infrastructure/…/scheduled_task_attribution.py• L13-20 infrastructure/…/registry_telemetry.py• L1-173 infrastructure/…/loop_report_telemetry.py• L1-133 infrastructure/…/run_history.py• L241-259
Prompt and turn records
Prompt logging captures one prompt turn from start to completion and sends a bounded record to the sinks the operator enabled. It links the prompt and response to session history, model and skill context, token details, loop outcome, and AI-generation analytics. Deterministic terminal work and failed provider calls remain distinct from successful model work.
The recorder restores parent correlation context after nested turns and treats provider errors or cancellation as turn outcomes. Logging is optional and sink failures do not change the agent result. Model prompt text is redacted and capped before it reaches local or remote analytics. A turn with no conversational output uses a synthetic response only for analytics, so session history does not replay filler as an assistant answer.
References: infrastructure/…/lifecycle.py• L21-88 infrastructure/…/model_prompt.py• L24-43 infrastructure/…/recorder.py• L100-140 infrastructure/…/recorder.py• L302-333 infrastructure/…/recorder.py• L349-361 infrastructure/…/recorder.py• L363-501 infrastructure/…/recorder.py• L504-555
Trace observations
Trace observations provide an optional richer view of agent, model, tool, and span activity. Hosts install a backend when they need this view. Without one, the trace seam is inert, and a sink failure does not enter product work.
Tool views are deep-copy redacted before shared sinks use them. Credential-like keys become a redacted marker, runtime objects become a separate marker, and bounded previews keep terminal reports small. This lets tracing, reports, and activity displays share safe evidence without changing the raw result needed by the work stage.
Scheduled work binds task metadata into its trace session. The same session can therefore connect submitted prompts, turn telemetry, actions, and run history without making the trace sink a required dependency.
References: infrastructure/…/observations.py• L1-17 infrastructure/…/redaction.py• L10-29 infrastructure/…/redaction.py• L34-90 infrastructure/…/redaction.py• L93-119 infrastructure/…/submitted_messages.py• L1-10 infrastructure/…/submitted_messages.py• L46-68 infrastructure/…/trace_session.py• L40-75
Analytics transport
Capture is asynchronous and best effort. It assigns a stable anonymous installation identity, adds runtime and usage context, queues versioned events for the analytics service, and writes bounded local failure breadcrumbs when transport problems occur. Opt-out settings stop telemetry, and analytics failures do not stop agent or scheduler work.
Authenticated events use the configured account or organization destination. Anonymous events remain useful for early usage signals but do not claim an account identity. The transport fails closed when destination or credential state is invalid instead of silently switching identity.
References: infrastructure/…/README.md• L5-36 infrastructure/…/README.md• L38-83 infrastructure/…/README.md• L250-278 infrastructure/…/provider.py• L171-188 infrastructure/…/provider.py• L844-939 infrastructure/…/provider.py• L1063-1119
Product metrics
Product analytics separates personal activity from organization gateway activity and separates verified or reported automation from unknown-origin installations. The metric set covers acquisition, activation, retention, feature adoption, integration adoption, gateway answer rate, agent reliability, tool-call success, latency, and scheduled-work reliability.
Anonymous installation counts are directional. Trusted user metrics use server-resolved personal identity, while gateway metrics use authenticated organization identity. Missing CI evidence remains unknown rather than being treated as proof of human activity.
References: infrastructure/…/METRICS.md• L1-12 infrastructure/…/METRICS.md• L14-40 infrastructure/…/METRICS.md• L44-60 infrastructure/…/README.md• L208-248
See Operational analytics for the product and runtime analytics view.
Outcome delivery
Outcome delivery converts a built report into one or more operator messages. The scheduler keeps the result of the work separate from the result of delivery, so a report can be successful even when delivery is partial or when a quiet run has no message.
Work outcomes
Every report can carry a work outcome. It distinguishes success, no-op, blocked, failed, incomplete, and unknown work from the later delivery status. A work outcome also states whether its error can be retried. A non-retryable block can pause the schedule because another attempt cannot clear the same condition.
References: infrastructure/…/outcomes.py• L8-49 infrastructure/…/types.py• L127-150 infrastructure/…/executor.py• L230-285
Destination plans
A task can use one destination, explicit provider and chat targets, or a loop channel list. The plan resolves credentials and provider-specific chat details once, removes duplicates, and keeps a stable target order before delivery begins. Explicit targets take precedence over loop channels, so a task cannot accidentally create a cross-product of both forms. Supported loop destinations include the interactive shell, Slack, Telegram, and email. Provider adapters are installed by the host, so scheduling depends on a delivery contract rather than vendor code.
References: infrastructure/…/delivery_plan.py• L1-13 infrastructure/…/delivery_plan.py• L34-108 infrastructure/…/delivery_plan.py• L111-165 infrastructure/…/delivery_plan.py• L168-228 infrastructure/…/loop_constants.py• L5-12 infrastructure/…/types.py• L46-65
Delivery outcomes
Fan-out sends to several destinations in parallel and records each target separately. A run is successful when every target receives the message, partial when at least one target succeeds, and failed when none succeeds. A quiet report is recorded from its work outcome without creating a message.
References: infrastructure/…/fanout.py• L22-27 infrastructure/…/fanout.py• L72-87 infrastructure/…/fanout.py• L132-170 infrastructure/…/executor.py• L287-373 infrastructure/…/run_store.py• L457-502
Local shell delivery
Interactive-shell destinations persist loop messages in a local inbox. The shell reads recent messages in reverse time order, while loop history can restore a missing report only when the same task attempt recorded the matching local delivery. This keeps local display tied to the attempt that produced it.
The shell uses one semantic theme for prompt markers, status text, warnings, errors, input surfaces, and Markdown. Changing the theme refreshes derived terminal styles together, so local delivery keeps the same meaning across output paths.
References: infrastructure/…/interactive_shell_delivery.py• L1-31 infrastructure/…/local_delivery.py• L27-140 infrastructure/…/report_layout.py• L31-70 infrastructure/…/markdown.py• L1-19 infrastructure/…/markdown.py• L110-167 infrastructure/…/theme.py• L42-71 infrastructure/…/theme.py• L493-558
For delivery providers and deployment paths that carry these outcomes beyond the scheduler, see Delivery and deployment.
Service topology
Operational automation can run as one hosted process or as focused services. Deployment must give scheduled firing to one live scheduler owner, while other hosts may still read task state, accept alerts, or display local results.
Host roles
| Host | Primary role | Scheduling role |
|---|---|---|
| Gateway | Chat, web access, alert intake, and agent turns | Co-hosts scheduled work when enabled. |
| Dedicated scheduler | Long-lived recurring work | Owns firing and waits for later task changes. |
| Web service | Health, alert intake, and queued work | Does not act as a chat surface. |
| Container service | Refreshes the main-channel binary and starts gateway, scheduler, or web mode | Runs the selected mode under a restart-aware supervisor. |
| Interactive shell | Local prompts, alert view, and local notices | Hosts local prompt loops while open. |
References: infrastructure/README.md• L3-10 infrastructure/…/background_service.py• L86-134 infrastructure/…/entrypoint.py• L24-36 surfaces/entrypoint.py• L54-64
Background service
The dedicated scheduler can run as a per-user background service on macOS or Linux. The service manager restarts it after exit and writes its output to a scheduler log. Status checks the live process rather than only the presence of a service file. A build change waits when a scheduled execution is still in flight, so a service update does not kill active work.
References: infrastructure/…/background_service.py• L1-7 infrastructure/…/background_service.py• L86-134 infrastructure/…/background_service.py• L199-222 infrastructure/…/background_service.py• L225-280
Container supervision
Container startup refreshes the current main-channel binary before it starts the selected mode. If refresh fails but an executable is already present, the supervisor starts the existing binary. Reload and stop paths terminate the child before replacement, so old gateway, scheduler, or web processes do not overlap the new one.
References: infrastructure/…/__init__.py• L1-8 infrastructure/…/entrypoint.py• L1-8 infrastructure/…/entrypoint.py• L24-36 infrastructure/…/entrypoint.py• L64-89 infrastructure/…/entrypoint.py• L132-185
Release artifacts
Release packaging must carry dynamically loaded runtime modules, skill data, loop templates, and runtime data. It excludes infrastructure trees that run in a separate deployment path. This keeps skill-driven schedules valid when the system runs from a packaged release rather than a source checkout.
The skills registry can publish, fetch, verify, and activate catalog releases. A stale local catalog cannot replace a newer live skill unless an explicit force action allows it, and a failed signature check does not become active work.
References: infrastructure/…/release_manifest.py• L1-26 infrastructure/…/release_manifest.py• L34-66 infrastructure/…/release_manifest.py• L77-93 infrastructure/…/client.py• L1-7 infrastructure/…/client.py• L97-123 infrastructure/…/publish.py• L1-8 infrastructure/…/publish.py• L179-236 infrastructure/…/puller.py• L60-118
Change checklist
When these files or sections are changed, remember to consider these:
- A new task kind must have a work path, runner payload and source label, persisted task shape, run record, delivery plan, and analytics identity.
- A change to loop mode, prompt, template, report, or skill parameters must keep task creation, prompt selection, headless execution, and run history aligned.
- A loop edit must keep group membership, organization scope, validation, prompt ownership, delivery fields, next-run calculation, and schedule-change fencing aligned.
- An on-demand loop start must keep host starter installation, loop ownership, background execution, in-flight protection, and shutdown drain aligned.
- A catalog or installed skill change must preserve skill reference resolution, per-tick instruction loading, size and content checks, and the rule that scheduled turns cannot use helper scripts or menus.
- A change to cron identity or precision must preserve one claim per scheduled tick, including sub-minute ticks, missed-fire recovery, and time-zone conversion.
- A scheduler storage change must keep task definitions, pending runs, leases, retained reports, target outcomes, run records, organization ownership, and reload signals aligned across processes.
- A run-history change must preserve the task snapshot, submitted prompts, work outcome, delivery outcomes, actions, carry note, and bounded analytics record for one attempt.
- A change to tool action capture must keep side-effect classification, success and work-outcome rules, redaction, target and result fields, and action size limits aligned.
- A change to claim recovery must preserve the difference between a live owner, an expired attempt, and a delivery-only retry limited to known failed targets.
- A recurring skill must be available in source and release data, and its pinned name and revision must remain resolvable at run time.
- A new delivery target must be supported by destination resolution, channel readiness checks, native report rendering, host adapter registration, per-target history, and failed-only retry scope.
- A work outcome change must keep report producers, run persistence, delivery status, task success updates, legacy outcome loading, and analytics status aligned.
- A local delivery change must keep the persisted inbox, run target history, and loop result restoration tied to the same task attempt.
- A report format change must keep the style guide, parser, destination length budget, native channel renderers, and quiet-run or coverage behavior aligned.
- A new analytics event or property must keep its event vocabulary, context enrichment, transport serialization, payload limits, privacy rules, and downstream metric contract aligned.
- Scheduler registry telemetry must keep the display-field allowlist, redaction and size bounds, change digest, refresh interval, and incomplete-store marker aligned with the analytics event contract.
- Delivered loop report telemetry must keep the fixed message identity, delivery time, recent resend window, and organization lookup aligned so recovery does not duplicate or misattribute reports.
- Skill release telemetry must keep activation timing, source classification, and once-per-release announcement state aligned with the catalog snapshot seen by running turns.
- Analytics identity changes must keep personal users, organizations, chat actors, anonymous installations, and automation classifications distinct.
- Prompt logging changes must keep redaction, size limits, session turn detail, local JSONL output, AI-generation fields, model-prompt fields, and cancellation or provider-error labels aligned.
- Trace redaction changes must keep deep-copy isolation, credential and runtime masking, bounded previews, and the raw work-stage result separate.
- Streaming guardrail changes must keep cross-chunk buffering, bounded flushes, audit-only behavior, replacement ranges, and one detection event per flushed chunk aligned.
- Credential-redaction changes must keep the shared text and structured-value policy aligned with scheduler history, trace decisions, analytics properties, prompt logs, and any new diagnostic sink.
- A detached CLI handoff change must keep the private entry flag, bounded foreground capture, continued pipe draining, child exit status, and process cleanup aligned.
- A change to turn capacity must preserve the different drop policy for new requests and wait policy for already accepted scheduled or queued work. Heavy child work must not acquire a second heavy-work slot.
- A change to unattended capability policy must preserve deferred handling for questions and approvals and must not grant shell, runtime-switch, or cancellation access to headless work.
- A change to schedule removal or disablement must keep task-store mutation, queued-run cancellation, in-flight cancellation checks, run-history status, and delivery state aligned.
- A background-service or container-supervisor change must keep liveness, build selection, refresh fallback, child cleanup, reload, stop signals, and selected mode arguments consistent.
- A harness provider change must preserve boot registration, integration source invalidation, repository-scope enrichment, skill prerequisite behavior, and test reset behavior.
- A prompt-control change must preserve the shared question mark and theme lookup, Escape cancellation, the Ctrl+C double-press window, and the distinction between optional teardown and required session persistence.
- A theme change must keep semantic colors aligned across Rich output, raw terminal styles, prompt surfaces, menus, and Markdown.
- A release change must keep dynamically loaded modules, skill files, templates, signature verification, activation timing, release telemetry, and separate-deployment exclusions aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Two live hosts own scheduled firing | One tick can produce duplicate outcomes. | Use one scheduler owner and claim each task and UTC fire-time pair in shared run storage. |
| A six-field schedule loses its seconds in the fire-time key | Separate polling ticks can merge into one run. | Keep seconds in the claim identity. |
| A live tick from before a schedule edit remains queued | Work can run with an old definition after the operator changed the schedule. | Persist an edit cutoff, retire pending old ticks, and reject obsolete automatic fire times. |
| A scheduler starts after an outage and replays every missed slot | A restart can flood a destination with stale work. | Catch up only the latest missed slot within the grace window, and use the fire-time claim key. |
| A scheduler task is read outside its organization scope | One organization can inspect or change another organization's schedule. | Stamp ownership on stored tasks and filter task visibility by the active organization. |
| A scheduled run loses its lease while still running | A recovery pass can start another attempt and the old attempt cannot safely finish. | Renew the fenced lease and reject completion from an expired owner. |
| A schedule is removed or disabled while its worker is building or sending | Cancelled work can still produce a message. | Re-read task state before work and delivery, and skip queued ticks on mutation. |
| A schedule store is unreadable during a write | A write can erase all configured schedules. | Preserve the unreadable file and write a fresh store. |
| A pending or expired run has no readable delivery scope | A retry can resend a report to destinations that already received it. | Refuse to widen an unknown scope and retry only persisted failed targets. |
| A recurring skill or pinned revision cannot resolve | The scheduled run fails before it can produce a report. | Resolve the skill before the headless runner starts. |
| An installed skill folder is missing, too large, or has no usable SKILL.md | The tick fails instead of running without its instructions. | Read and validate the installed card at each tick. |
| An on-demand run is requested in a process without a loop starter | The chat turn cannot start the loop and may mislead the operator about its state. | Return the explicit unsupported-host result and use the loop page on a supported host. |
| A headless turn reaches an interactive capability | The turn can block or attempt an action with no visible operator. | Withhold interactive capabilities and convert questions into deferred choices. |
| A deferred approval is matched to a different tool invocation | An answer can authorize the wrong action. | Bind approval state to the exact tool name and effective arguments. |
| An operator confuses the first Ctrl+C hint with an accepted exit | The shell can remain open when the operator expects it to close, or optional cleanup can be interrupted without the exit state set. | Keep the shared double-press gate and mark exit before teardown. |
| A detached CLI child writes beyond the foreground capture window without a continuing drain | The child can block on a full pipe and never finish. | Keep independent stdout and stderr drains alive until EOF, discarding bytes after the capture bound. |
| A Windows descendant escapes its job or cleanup closes readers first | A cancelled action can keep using resources or leave the shell blocked on a pipe. | Assign the suspended root before resume, kill on job close, and finish process cleanup before reader close. |
| A secret straddles stream chunks and each chunk is scanned alone | The secret can reach terminal scrollback or the detector can miss it. | Buffer through a newline or bounded window before scanning and replace blocked matches without closing the stream. |
| A side-effecting tool call is recorded with raw arguments | Secrets or large payloads can enter run history and later analytics. | Record only bounded target and result details after credential redaction. |
| A new diagnostic sink bypasses the shared text or value redactor | Credential patterns can enter traces, analytics, or local history. | Apply the shared redaction boundary before serialization or retention. |
| A fan-out destination fails after another destination succeeds | A retry can duplicate the report at a destination that already received it. | Store ordered target outcomes and retry only failed targets. |
| A loop asks for an unsupported or unready channel | The schedule is stored with a destination that cannot receive its report. | Normalize channels, validate credentials and recipients, and resolve each target before fan-out. |
| A report uses channel-specific markup or exceeds the smallest destination budget | One channel can show broken formatting or truncate the main finding. | Give the agent one portable Markdown guide and apply the smallest selected-channel budget. |
| The analytics queue, local store, or network transport fails | Work continues but the affected event is not sent. | Keep capture asynchronous and best effort with bounded diagnostics; resend recent loop reports and refresh unchanged task snapshots on later passes. |
| Analytics credentials or destination state conflicts with saved identity | Events can be sent through an unintended account or origin. | Disable remote delivery for that process instead of falling through to another identity. |
| A scheduled run record contains a secret or oversized report | Sensitive data can leak or the analytics event can be rejected. | Redact text, cap fields, and fit the complete record to the event budget. |
| A scheduler registry snapshot exceeds analytics key or size limits | The task view can be incomplete and dashboards can miss saved tasks. | Mark truncation and store only an allowlisted, bounded display projection. |
| A skill catalog activation is announced more than once for one release | Release metrics overcount activation. | Claim the release before capture and announce it once per machine and release. |
| Heavy child work starts beyond the host's safe memory limit | Several turns can exhaust the container and terminate unrelated work. | Use the process-wide heavy-work gate and return a bounded busy result. |
| A sandbox or child process outlives its owner | A cancelled action can keep using resources or leave side effects running. | Apply timeout and access limits, and own descendant cleanup through the platform process boundary. |
| A service unit exists but its process is not live | Status can claim recurring work is available when no scheduler can fire it. | Check the service manager's live state and require health after installation. |
| A container cannot refresh the main build | A service can fail to start or run an old binary. | Start a known executable when refresh fails, and fail only when no executable is available. |
| A release contains code but not dynamically loaded skills or templates | Packaged schedules can start but fail when their skill or template is needed. | Build the release manifest from runtime modules and all required skill data. |
| A separately deployed infrastructure tree is bundled as application data | The release grows without adding runnable capability and can blur deployment ownership. | Exclude non-frozen deployment trees from the application data manifest. |
Key files
| File | Why to read it |
|---|---|
| infrastructure/alert_intake.py | Defines the shared boundary for incoming operational alerts. |
| core/…/inbox.py | Shows the handoff from fast alert intake to alert consumers. |
| infrastructure/…/types.py | Defines schedule, task kind, work outcome, delivery outcome, and run concepts. |
| infrastructure/…/cron_expression.py | Defines accepted schedule timing forms and rate limits. |
| infrastructure/…/loops.py | Shows how operators create and manage recurring work, channels, email destinations, skills, and starter loops. |
| infrastructure/…/run_now.py | Defines the host boundary for starting one loop run on demand. |
| infrastructure/…/loop_edit.py | Shows validated group edits for recurring loops and their delivery fields. |
| infrastructure/…/loop_constants.py | Defines stable loop parameter names and mode choices. |
| infrastructure/…/loop_prompt.py | Shows how stored loop text, templates, catalog skills, and installed skill cards become scheduled input. |
| infrastructure/…/report_style.py | Defines the portable report shape and destination-aware length guidance. |
| infrastructure/…/report_layout.py | Shows how one Markdown report becomes channel-neutral sections and lines. |
| infrastructure/…/plan_snapshots.py | Defines removal of terminal plan snapshots from user-facing text. |
| infrastructure/…/installed_skill.py | Defines the external skill-folder contract used by scheduled loops. |
| infrastructure/…/tasks.py | Shows how task kinds become reports or headless agent payloads. |
| infrastructure/…/task_store.py | Shows shared task persistence, organization scope, deduplication, reload, safe writes, schedule edits, and cancellation. |
| infrastructure/…/run_store.py | Shows execution claims, leases, retained reports, target outcomes, backlog, and recovery. |
| infrastructure/…/legacy_task_migration.py | Shows how retired task definitions become safe disabled records. |
| infrastructure/…/__init__.py | Shows the scheduler's public persistence boundary for task and run state. |
| infrastructure/…/task_visibility.py | Defines request-scoped visibility for organization-owned schedules. |
| infrastructure/…/schedule_change.py | Defines the fence for automatic ticks made obsolete by a schedule edit. |
| infrastructure/…/schedule_cancel.py | Defines cancellation checks for removed or paused schedules. |
| infrastructure/…/runner.py | Shows trigger registration, bounded scheduled work, catch-up, live reconciliation, and recovery. |
| infrastructure/…/executor.py | Shows the common path from claim to work, cancellation checks, delivery, history, and analytics. |
| infrastructure/…/delivery_plan.py | Shows destination resolution, fan-out precedence, deduplication, and failed-target scope. |
| infrastructure/…/run_history.py | Shows the bounded record shared by operators, later turns, and analytics. |
| infrastructure/…/previous_runs.py | Shows how a loop receives safe summaries of its own earlier attempts. |
| infrastructure/…/tool_actions.py | Shows how successful side effects and work outcomes become bounded action lines. |
| infrastructure/…/loop_report_telemetry.py | Shows recovery reporting for recent delivered loop messages. |
| infrastructure/…/registry_telemetry.py | Shows the safe bounded task-registry view sent to analytics. |
| infrastructure/…/background_service.py | Shows how the scheduler stays available without an open shell on supported platforms. |
| infrastructure/…/turn_runner.py | Shows the transport-neutral path for interactive and gateway turns. |
| infrastructure/…/session_agents.py | Shows session-scoped agent reuse and output binding. |
| infrastructure/…/unattended_session.py | Defines fresh sessions, deferred choices, approvals, and unattended capability limits. |
| infrastructure/…/stream.py | Defines bounded stream scanning, secret replacement, audit behavior, and detection capture. |
| infrastructure/…/secret_redaction.py | Provides the shared redaction boundary for text and structured diagnostic values. |
| config/secret_redaction.py | Defines the credential patterns and replacement markers used by shared redaction. |
| infrastructure/…/cli_handoff.py | Defines bounded output capture and continuing drains for detached CLI work. |
| infrastructure/…/windows_job.py | Defines ownership and cleanup for Windows command descendants. |
| surfaces/…/cli_parity.py | Shows how the shell hands long-running CLI work to a detached child and reports its outcome. |
| infrastructure/…/slots.py | Defines drop, bounded-wait, and queued-work policies for turn capacity. |
| infrastructure/…/heavy_work.py | Defines the separate limit for memory-heavy child work. |
| infrastructure/…/runner.py | Defines bounded Python execution and restricted access. |
| infrastructure/…/integration_resolution.py | Shows how host providers resolve integrations from account, web-app, local, and environment sources. |
| infrastructure/…/repo_scope.py | Defines vendor-neutral repository-scope enrichment for agent turns. |
| infrastructure/…/skill_prerequisites.py | Defines host-owned checks before a skill starts. |
| infrastructure/…/README.md | Defines the versioned analytics service contract, identity rules, runtime dimensions, and event privacy. |
| infrastructure/…/METRICS.md | Defines product and runtime metric calculations and identity grains. |
| infrastructure/…/events.py | Defines the event vocabulary for product, runtime, scheduled-work, and safety analytics. |
| infrastructure/…/capture.py | Defines public capture calls and bounded scheduled, agent, and repair events. |
| infrastructure/…/provider.py | Shows anonymous identity, install state, queueing, transport, opt-out, diagnostics, and failure behavior. |
| infrastructure/…/recorder.py | Shows one prompt turn flowing to session history, local logs, and AI analytics. |
| infrastructure/…/scheduled_task_attribution.py | Connects turn-level records to the scheduled task that caused them. |
| infrastructure/…/event_properties.py | Shows bounded credential-redacted event property values. |
| infrastructure/…/redaction.py | Defines safe shared views and bounded previews for tool evidence. |
| infrastructure/…/decisions.py | Shows credential redaction for diagnostic decision attributes. |
| infrastructure/…/submitted_messages.py | Captures prompts submitted during one headless run. |
| infrastructure/…/trace_session.py | Defines trace identity and metadata inheritance across nested work. |
| infrastructure/…/interactive_shell_delivery.py | Shows how scheduled messages reach the interactive shell inbox. |
| infrastructure/…/theme.py | Defines the semantic palette shared by shell prompts, menus, status output, and Markdown. |
| infrastructure/…/entrypoint.py | Shows binary refresh, mode selection, child supervision, reload, and stop behavior for containers. |
| infrastructure/…/release_manifest.py | Shows which dynamic runtime modules, skill data, and separately deployed trees enter or stay out of release artifacts. |
| infrastructure/…/client.py | Defines the public fetch and authenticated publish interface for skill releases. |
| infrastructure/…/puller.py | Shows verified background skill release retrieval and activation timing. |
| infrastructure/…/publish.py | Shows version-aware skill change planning and release validation. |
| infrastructure/…/telemetry.py | Shows once-per-release reporting for skill catalog activation. |
| integrations/…/tool.py | Defines the scheduling and inspection interface for bounded GitHub repairs. |
| integrations/…/schedule.py | Shows target validation, account-scoped reservation, deadline reuse, and scheduler registration. |
| integrations/…/worker.py | Shows bounded repair attempts, CI verification, account checks, and retained evidence. |
| integrations/…/supervisor.py | Shows child-process supervision, cancellation, timeout handling, and final reports. |
| integrations/…/storage.py | Shows atomic repair state, active-run identity, and checkout cleanup. |
| integrations/…/tool.py | Shows the bounded one-call CI repair flow from seed through verification and evidence. |