Components
What Ark is made of
A map of the kernel and the automations around it, with the file or command where each piece lives in kaptio-ark. Every agent the kernel and its sweep automations run, and every persona and model, is on Agents and personas.
State
Git-tracked files are the source of truth. Runtime state under .os/ is local and gitignored.
| Component | What it does | Where |
|---|---|---|
| Intents | One markdown file per intent: YAML front matter for machine state, then the narrative sections and the append-only run log. The task graph sits next to it. | intents/INT-NNNN.mdintents/INT-NNNN.tasks.jsonsrc/intent/ |
| Board index | The generated board of every intent with its status, cost and verdict. Regenerated, never edited by hand. | intents/INDEX.mdos intent index |
| Run-log window and archives | Agents read the newest run-log entries plus the five newest person entries. Older entries move verbatim to intents/archive/<id>/, or a whole log splits into month files there (--split, --unsplit), and large evidence of closed intents can leave the checkout; git history keeps it. | src/intent/runlog-window.tsos intent contextos intent archiveos evidence archive |
| Ledger | One cost row per agent run, per intent. The reconcile turns Cursor billing into charged dollars per intent. | .os/ledger/INT-NNNN.jsonlsrc/ledger/ |
Configuration
| Component | What it does | Where |
|---|---|---|
| Org registry | The seven Cycle 19 pods, their seats, the org lanes and the people who hold them. Ark Factory and the kernel both read it; CI validates it. | factory/registry/units.yamlfactory/registry/people.yamlsrc/intent/org-roster.ts |
| Lanes | Twelve Ark lanes, each with an owner, operators, a policy and a graph template. The org registry groups them into nine org lanes, each with an owner and a director. | src/intent/lanes.jsonsrc/intent/lane-policy.tstemplates/graphs/<lane>.yamlfactory/registry/units.yaml |
| Identity | Who Ark speaks for in Slack and where it reports when nobody in particular is running it. | automations/ark-identity.yamlos identity |
| Approvers | The Kaptio and customer approvers for each sweep programme, who sign writes to its Salesforce orgs. Only a set marked confirmed counts. | automations/approvers.yaml |
| Customer registry | Customers, their Tempo accounts, and per-customer policy: a customer that prohibits AI tooling stops os run, os doctor and the sweep dispatcher for that customer. | intents/CUSTOMER-REGISTRY.yamlsrc/intent/customer-registry.ts |
| Sweep programmes | Which channels each sweep programme watches and which intent it writes to. | automations/sweep-programmes.yamlautomations/*-sweep-prompt.md |
Orchestration
os run takes an aligned intent through the stages below. Each agent is described on the Agents and personas page.
| Component | What it does | Where |
|---|---|---|
| Preflight and environment doctor | Checks credentials, git origins, Kaptio DX access and that no Dev Hub is on the machine before any agent runs. A code-rigor track refuses on a failure and others warn; a customer that prohibits AI tooling is refused on every track. os run also checks the model id of each role with the engine that role runs on and refuses an unknown one. | src/orchestrator/preflight.tssrc/orchestrator/env-doctor.tsos doctor |
| Decompose | The Lead turns the intent into a task graph, checked against the track's template, with a scale advisory on task count. | src/orchestrator/lead.tssrc/orchestrator/graph-template.ts |
| Plan gate | A person approves the plan before builders run, and dispatch re-checks the plan hash. | src/orchestrator/plan-gate.tsos plan --approve |
| Dispatch | Runs Builders in parallel within the concurrency limit, reviews each task, runs one fix pass on changes requested, and merges approved branches onto the integration branch. | src/orchestrator/dispatch.ts |
| Apex API reference | Gives an Apex builder a lookup instead of a long prompt: whether an Apex method exists at the project API version, and since when. It covers the Salesforce system classes only; what in-house helpers a repo has is found by reading that repo. An advisory lint reports verbose patterns on added lines and never blocks. Refreshed by hand after a Salesforce release. Rules are on the Gates and rules page. | data/apex/api/scripts/apex/.cursor/rules/apex-idioms.mdcnpm run apex:lint |
| SIT and UAT | The SIT cycle runs the quality gates on the integration branch; the UAT cycle walks persona journeys and judges the fixes. os mr refuses while the last UAT verdict is not_met or partial, until a person accepts the gap. | src/orchestrator/iterator.tssrc/orchestrator/uat-cycle.tssrc/orchestrator/verification-gate.ts |
| Act review loop | For Journeys acts: os act publish puts a recorded act's narrated video and review packet into the catalogue and runs its packet check; os review-feedback turns a send-back into fix tasks for the factory that owns the act. A note counts when the catalogue review bot (OS_REVIEW_BOT_USER_ID) posted it for a signed-in person, under that person, or when a catalogue member at Developer or above wrote it in GitLab; other bots and guest comments are context, never a verdict. | src/orchestrator/act-publish.tssrc/orchestrator/review-feedback.tsos act publishos review-feedback |
| MR | Pushes the integration branch, opens the MR as a Draft labelled ark:proposal unless the repo is on the auto-merge allowlist, and polls the pipeline. | src/orchestrator/mr.tsos mr |
| Engine and runtime | Kernel agents and the Kai Actions dispatcher run through the engine: Cursor by default, Claude as an experimental option. OS_ENGINE picks the engine and OS_ENGINE_<ROLE> overrides it for one role, so a run can mix the two. The scheduled sweep launchers call cursor-agent directly. OS_RUNTIME picks local worktrees, Cursor cloud VMs or a self-hosted pool, per role if needed. | src/engine/src/adapters/cursor.ts |
Gates and guards
The rules behind them are on the Gates and rules page.
| Component | What it does | Where |
|---|---|---|
| Align gate | os run dispatches only aligned or in-flight intents, and refuses an in-flight intent with no task graph and an empty run log. | src/orchestrator/align-gate.ts |
| Budget tripwire | A lane gets no new dispatch once its envelope for the planning window is spent; envelopes are optional, and none or 0 means no lane cap. An intent stops at its optional budget_usd cap. When the window total is spent, the daemon stops picking up new aligned intents; work in flight finishes. | src/orchestrator/budget.tssrc/orchestrator/daemon.tsintents/BUDGETS.yaml |
| Patch-meta gate | Refuses an MR that adds metadata to a patch destination, unless a person records an exception. | src/orchestrator/patch-meta-gate.ts |
| Org readiness | Proves the acceptance org a person will test on, with checks that call the surface they will use. os uat and os mr refuse until it passes. | src/orchestrator/org-readiness.tsos org-readiness |
| Defect gates | D1 to D4: reproduced, ticketed in the right project, fix version confirmed, product sign-off. | src/orchestrator/defect-gates.tsos defect |
| Publish gate | Twelve checks, including the binding final-post skeptic, before a pack reaches a customer channel. | src/orchestrator/publish-gate.tsos pack |
| Precedent gate | Lets a Kai Actions plan run without a fresh approval only when every item matches settled, independently verified precedent, and only in the Read lane. In the default shadow mode it only records its decisions. | src/orchestrator/precedent-gate.ts |
| Trunk guard | Keeps intent state on main. Before a command writes intent state, it switches a clean feature-branch checkout to main and fast-forwards a stale main; it refuses a feature branch with uncommitted changes or a main that has diverged from origin/main. | src/intent/trunk-guard.tsos trunk |
| Push guards | Refuse a push that deletes more than 50 tracked files or 5% of them, and an intent file that skipped id reservation. | src/adapters/push-guard.tsscripts/mass-deletion-guard.shscripts/intents-guard.sh |
| Gate holders | Places an intent in its pod and names who decides each gate. Every stop that needs a person prints the name, and os who lists them all. Advisory: it refuses nobody. | src/orchestrator/gate-holders.tsos who |
Automations
| Component | What it does | Where |
|---|---|---|
| Daemon | Picks up aligned intents in priority order and runs the same pipeline as os run. Runs on the SF Devs service with cloud agents. | os daemonterraform/modules/kaptio-ark/ |
| Sweeps | Scheduled cycles over customer channels, each following its programme prompt. A programme's launcher starts a local cursor-agent session, and DuVine's daily tick runs through the Kai Actions dispatcher; os sweep runs one cycle on a cloud agent. Most programme prompts write nothing on a quiet tick. | automations/*-sweep-launch.shsrc/orchestrator/sweep-cycle.tsos sweep |
| Kai Actions dispatcher | Slack-triggered sweeps and scheduled plan-first ticks. A read-only ask runs in one cycle with no plan. A literal, bounded ask runs direct, though from outside the roster only a Config-lane ask from Kaptio staff or a partner does. Everything else posts a plan and runs after approval. | automations/sweep-dispatcher.ts |
| Reconcile | The ark-reconcile CI job attributes Cursor spend to intents every hour from published session rows, and commits to main once a day, in the 05:00 UTC hour. A daily full recompute with laptop-only inputs runs from a LaunchAgent on one laptop. A cloud run with no run record is placed through its Project's default intent in handover/sessions/cloud-projects.json. | src/ledger/reconcile.tsscripts/cloud-reconcile.shscripts/laptop-reconcile.sh.gitlab-ci.yml |
| Session ingest and hooks | Cursor and Claude Code hooks post each session's intent to the board, which checks it and publishes the rows to handover/sessions/ in batches. The same install adds the model guard and the tool output cap. Registration warns today and will block once every open intent has a pod. | src/board/session-ingest.tstools/enforcement/tools/project-kit/internal/ark-cloud-run-hook |
| Board watch | A read-only CI job every 30 minutes checks board health, pod restarts, publish errors and the workspace disk, and fails the pipeline when any check fails. | scripts/ark-board-watch.sh |
| Trunk watchdog | Every 15 minutes: off-trunk checkouts, unpushed intent commits, id collisions and sweeps that stopped. | automations/trunk-watchdog.sh |
| Heal | Checks with deterministic or agent-drafted repair plans, validated against policy before anything runs. | src/heal/automations/heal-registry.yaml |
Surfaces and integrations
| Component | What it does | Where |
|---|---|---|
| CLI | Every command, run as npm run ark -- <command>. | src/cli.ts |
| Board | The leadership board UI and its API, locally on port 4015 and on the SF Devs service. Leadership changes priority, slots, alignment and budgets there, behind a write role when sign-in is on; intents are never created there. | src/board/ui/os board |
| Slack | Ark posts as the Kai bot, naming who it speaks for. | src/adapters/slack.ts |
| GitLab | Branches, MRs and pipelines, through glab or the REST API. | src/adapters/gitlab.ts |
| Jira | Defect tickets and labels; every ticket Ark creates or works carries the ark label. | src/adapters/jira.ts |
| Kaptio DX | Scratch orgs, customer datasets and the regression tests Ark publishes. | src/adapters/kaptio-dx-service-client.tsos dx datasets |