Skip to content

Repository files navigation

Company Command

Command your company of AI agents.

Company Command is distributed as comcmd.

A small, model-neutral autonomous-company control plane. Company Command compiles a declarative CompanySpec into durable work, runs that work through replaceable agent workers, mediates every side effect through a default-deny capability gateway, and pauses durably for authenticated human approval when policy requires it. Roles are bundles of skills, permissions, data scopes, model profiles, budgets, and escalation rules — not simulated employees.

The backend

Company Command is the backend: one FastAPI service (comcmd serve) over a Postgres event log. In-process for dev, durable (Postgres + DBOS) in production.

pip install -e ".[server,durable,dev]"
comcmd serve                          # http://127.0.0.1:8080  (GET /health, /docs)
# or: docker compose up --build     # Company Command + Postgres, durable, on :8080

See docs/BACKEND.md for the full API and the governed start → approve (WebAuthn) → execute lifecycle over HTTP.

Status — Phase 0 + Phase 1 (governed effects + human approval)

Implemented and tested (40 tests):

  • CompanySpec models + JSON Schema (comcmd/spec, comcmd schema)

  • Manifest compiler with default-deny validation (comcmd/compile)

  • Append-only hash-chained event ledger (comcmd/kernel/ledger.py)

  • Default-deny capability gateway ("Mandamus-Lite") with A0–A4 assurance tiers, bounded-auto, scoped single-use capabilities, receipts (comcmd/gateway)

  • WebAuthn approval (comcmd/gateway/webauthn_verifier.py, enrollment.py, approvals.py): assertion bound 1:1 to the immutable action digest, UV required, phishing-resistant origin binding, distinct-approver quorum (A3 dual control). Deny-by-default when unconfigured.

  • Idempotent executor (comcmd/kernel/executor.py): an authorized effect runs exactly once; replay after a crash re-runs nothing.

  • Deterministic workflow runner with crash-resume and an approval/resume path (comcmd/kernel/workflow.py)

  • Worker API + bounded native worker; model profiles with an offline-defer backend and an OpenAI-compatible backend (comcmd/workers, comcmd/models)

  • Optional Loop worker for bounded repository engineering with Codex and/or Claude, isolated task workspaces, independent verification, and resumable run evidence (comcmd/workers/loop.py)

  • Optional OpenWorker adapter for local read-only research, connectors, and artifact production. It forces OpenWorker into plan mode; external writes remain separate Company Command action intents (comcmd/workers/openworker.py).

  • Operator CLI: compile, run, inspect, schema, approvals

  • Postgres durable ledger (comcmd/kernel/ledger_pg.py, make_ledger): the hash-chained event log on Postgres with per-company advisory-locked atomic appends, so crash-resume is durable across processes/machines. The runner and CLI run unchanged against it.

Exit gates met: Phase 0 crash-resume (tests/test_workflow.py); Phase 1 — no worker writes except through the gateway, every approved write bound to an immutable action revision (tests/test_approval_e2e.py), and durable execution across processes on Postgres (tests/test_ledger_pg.py). Remaining: DBOS workflow primitives (queues/timers/leases/HA) layered on the Postgres ledger, honestly gated in comcmd/kernel/durable.py (see ADR-001).

Quickstart

python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"          # or: pip install pydantic pyyaml pytest

pytest                            # 56 tests (63 with Postgres+DBOS enabled)
python -m comcmd.cli compile companies/example-studio
python -m comcmd.cli run      companies/auto-steam ship-title      # a second, different company
python -m comcmd.cli run      companies/example-studio validate-product --ledger comcmd.sqlite
python -m comcmd.cli approvals comcmd.sqlite example-studio
python -m comcmd.cli schema -o schemas/company.schema.json
python -m comcmd.cli eval companies/triage-demo --baseline triage-single --variant triage-panel

Run repository work through Loop

Install the optional worker dependency, then select Loop for a workflow:

pip install -e ".[dev,loop]"

comcmd run companies/example-studio validate-product \
  --worker loop \
  --repository /absolute/path/to/repository \
  --workspace-root ~/.local/state/comcmd/loop-workspaces \
  --goal "Make the test suite pass without weakening tests" \
  --acceptance "pytest exits successfully" \
  --loop-executor codex \
  --loop-verifier claude

Acme generates the Loop configuration from trusted CLI/operator policy. Task input cannot inject commands, providers, limits, environment variables, or state paths. Every task step gets a persistent isolated clone, allowing an interrupted Loop run to resume in the same workspace. PASSED becomes an ok worker artifact; EXHAUSTED or STOPPED parks the task as FAILED_RETRYABLE; FAILED remains an error.

Loop may edit only the isolated repository. Merge, deploy, publish, messaging, payments, and other external effects remain separate Acme ActionIntent and human-gate steps. Run Loop workers inside the same credential-stripped, network-constrained worker runtime required for other CLI agents; process environment filtering is defense in depth, not a filesystem or network sandbox.

Use OpenWorker as a governed read-only worker

Start OpenWorker's local server, then point a Company Command workflow at it:

pip install -e ".[openworker]"
openworker-server --cwd /absolute/readable/workspace --port 8765

comcmd run companies/example-studio validate-product \
  --worker openworker \
  --openworker-url http://127.0.0.1:8765 \
  --openworker-workspace /absolute/readable/workspace

The adapter uses OpenWorker's session API and forces plan mode. Read-only connector calls may contribute to the returned artifact. File writes, commands, messages, calendar changes, and other consequential operations are denied in OpenWorker and must instead be represented as Company Command ActionIntents, authorized by the gateway, and executed idempotently by Company Command.

The eval command is the multi-agent gate: it runs a single-agent baseline against a fan-out+verify variant over scenarios and only reports PROMOTE if the multi-agent variant beats the baseline on success without unacceptable cost / latency / policy regressions. Adding agents that don't win is theater — the gate says so.

A CompanyPack is a directory: a declared company.yaml plus an optional pack.py supplying the company's deterministic domain skills and effect handlers. companies/example-studio and companies/auto-steam are two very different companies on the same kernel — the governance core is generic, the domain lives in the pack.

run drives the example workflow to its humanGate and parks it in WAITING_FOR_HUMAN; approvals shows the pending action and its challenge. A verified WebAuthn approval (WorkflowRunner.approve_step) authorizes the effect through the gateway and drives the task to SUCCEEDED — see tests/test_approval_e2e.py for the full ceremony. The remaining Phase 1 item is DBOS/Postgres durability (see ADR-001).

Layout

comcmd/
  spec/       CompanySpec models, loader, JSON Schema
  compile/    manifest compiler + typed errors (default-deny)
  kernel/     records, hash-chained ledger, workflow runner, idempotent executor, durable seam
  gateway/    ActionIntent, A0–A4 policy, default-deny gate, approvals+quorum,
              WebAuthn verifier, credential enrollment
  workers/    Worker API + native/Loop/OpenWorker workers + Codex/OpenHands adapters
  models/     capability profiles + backends (offline-defer / OpenAI-compat)
  pack.py     CompanyPack loader + build_runner wiring
  cli.py
companies/    example-studio/ and auto-steam/ (company.yaml [+ pack.py])
tests/        + tests/support/ (software WebAuthn authenticator)

Non-goals (Phase 0)

Simulated office chat · self-modifying roles/policies · arbitrary nested agent spawning · a custom vector DB · a runtime dependency on MandamusCo (Company Command reimplements a small "Mandamus-Lite" and never modifies MandamusCo). See IMPLEMENTATION_PLAN.md §8.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages