Skip to Content
Kipivo Docs

Architecture & Security Model

Monorepo layering, run state machine, and local security boundaries.

Kipivo is organized as a strict layered monorepo so Web, Desktop, Mobile, the control plane, and the Rust Runner share a single protocol contract without leaking platform or security boundaries.

Monorepo Layers

LayerPackages / AppsConstraints
Platform-agnostic corepackages/protocol, packages/client, packages/i18nZero Node, Bun, or DOM APIs. Shared across Web, Desktop, Mobile, and API.
Web renderingpackages/ui, packages/blocksWeb & Desktop only (@base-ui/react, Tailwind v4). Forbidden in apps/mobile.
Applications & Docsapps/api, apps/web, apps/desktop, apps/mobile, docsdocs is static SSG (docs.kipivo.com) and isolated from console/API packages.
Native Runner & CLIcrates/runner, crates/cliCompiled to a single kipivo binary (kipivod daemon mode).

Run State Machine

All transitions on runs pass through transitionRun() in apps/api using atomic conditional updates (WHERE status = :from):

queued ──▶ dispatching ──▶ running ──▶ awaiting_review ──▶ merging ──▶ merged
                               │              │
                               ├──▶ completed ├──▶ completed (keep_branch)
                               ├──▶ failed    └──▶ rejected (spawns child run)
                               └──▶ cancelling ──▶ cancelled
  • A Run auto-completes (completed) only when the diff is empty and not truncated, and it is not a conflict-resolution child Run.
  • Merge failures (merge_conflict, checkout_dirty, not_on_default_branch, runner_lost) safely return the Run to awaiting_review.

Local Security Boundaries

Kipivo enforces strict defense-in-depth between the control plane and your local Runner:

  1. No server-supplied executable fields: run.start only carries schema-validated task fields (run_id, project_id, prompt, feedback?, executor, model?, base_ref, etc.)—never shell commands, paths, or environment variables.
  2. Trusted check configuration: .kipivo.toml is always read from base_sha, never from agent-modified files.
  3. Local path ownership: local_path is resolved solely from the Runner's local configuration and validated against projects.repo_url before execution.
  4. Process-group timeouts & bounded output: Runs and individual checks enforce separate timeouts that terminate the entire process group and truncate oversized output.
  5. Credential isolation: Executor processes receive an explicit environment allowlist; runner_token is never passed to executors.
  6. Workspace authorization: Every RPC, SSE topic, file download, and webhook/IM callback is verified against workspace membership roles (owner, maintainer, member).

On this page