cloudspec is the specification level for infrastructure and cloud architectures. It declares the building blocks a cloud architecture is made of (zones, node pools, nodes, workloads, volumes, buckets, endpoints, secrets, identity, managed services such as queues and databases, agents) as an executable specification, composes them into architecture documents, and scores each architecture with KPIs per block: the throughput of a queue, the failure rate of an endpoint, the cost of a node pool.
cloudspec is also the intermediate representation between formats: cloudspec is to infrastructure what codespec is to code. Every source translates into a cloudspec specification and every target is generated out of one:
source --inbound translator--> cloudspec --outbound generator--> target
Status: planning. The building blocks are in
blocks/, one ESS system cloud
moved from weft. The first code is crates/cloudspec-sim/ and a first slice of
crates/cloudspec/. The plan is in .engineering/, the vision in
docs/vision.md, and what moves here from other repositories in
docs/boundary.md. To start, read
docs/getting-started.md; every command is in
docs/cli.md.
- Describe an architecture from building blocks in layers, with the actors that use it.
- Check an architecture against the blocks before anything is built.
- Translate a source into an architecture: a Helm chart, Kubernetes manifests, a live cluster, a Docker Compose file, an ESS system, an agenticspec deployment bundle. Generate a target from one: Kubernetes manifests, Helm, a Nomad job, Amazon ECS task definitions, Compose, systemd units, Terraform, or weft, which runs it. Each translation is deterministic, reports what it mapped, mapped with loss or refused, and counts only when source and target pass the same check.
- Run any architecture in one process with the in-memory runtime, deterministic under a seed: the engine of simulations, load tests and search, the reference of the equivalence check, and the studio's live backend.
- Simulate an architecture, including load tests and faults, and search for a better variant (hill climbing over the choices an architecture leaves open).
- Read a running Kubernetes cluster and derive its architecture: entry points, every service, workload and job, databases, hosted and managed services, and what lies outside the cluster.
- Remodel an existing environment: change the derived architecture and get the changes to apply.
- From one architecture and a configuration, name the ports a runtime must serve.
- Hold agents as workloads:
agentis a workload kind of cloudspec's own (a job, a scheduled job, a persistent service), whatever source declared it. - A studio to explore architectures, run evaluations and search.
- Not a production runtime. weft realizes a cloudspec specification on a placement; the in-memory runtime is for simulation and tests.
- Not a vendor's infrastructure-as-code tool. It hands a target the ports and the configuration it needs, or generates the target's files, and records what the target observed.
- Not a multi-tenant product. Tenants, accounts, billing and a management API belong to the multi-tenant example specification weft runs.
| repository | role |
|---|---|
| ESS | the specification language and toolchain cloudspec is written in; also reads a live Kubernetes cluster into infra-ir (ess import kubernetes) |
| cloudspec | building blocks, architecture documents, KPIs, translation in and out, the in-memory runtime, simulation and search, ingestion, ports |
| weft | the runtime that realizes a cloudspec specification on a placement through ports and adapters; its first example specification is the enterprise multi-tenant cloud, whose tenancy, access, catalog, metering and consoles are the example's, not weft's core |
| codespec | the same intermediate-representation approach for code: source to cir/1 to source, checked by running both |
| topospec | the composition of systems at repository scale (repositories, packages, contracts, build edges); it references a cloudspec architecture and part for where a system runs, and does not model infrastructure itself |
The first slice of the cloudspec CLI reads an agenticspec deployment bundle and writes plain
Kubernetes manifests, for example for a local cluster:
cargo run -p cloudspec -- translate agenticspec \
--from fixtures/agenticspec/neutral/neutral.bundle.yaml --out control-plane-server.yaml
cargo run -p cloudspec -- generate kubernetes \
--from fixtures/agenticspec/neutral/neutral.bundle.yaml --out manifests
kubectl apply -f manifeststranslate writes a cloudspec-architecture/2 document and its coverage report
(control-plane-server.coverage.json). generate accepts the bundle or that document, writes one
file per object into the directory and its coverage report beside it (manifests.coverage.json;
--coverage <file> names another path), so kubectl apply -f manifests applies the whole
directory, and checks its own output: no secret or egress reference the input does not declare, no
secret value. A refused object stops the run with exit 1; the coverage report is still written and
names the rule.
translate reads two bundle formats of agenticspec. In the newer one (a volume claim with mount,
an object in packing.document.external or an ingress entry per export) an ingress entry with no
bind is bound to loopback, with no unit it belongs to the core unit and with no part to the
control part, and its protocol names the Service port; in the older one a missing bind means
every address. fixtures/agenticspec/workstation/ is a bundle of the newer format written by
agenticspec, and both steps map it with no refusal. Each agent unit becomes a workload of kind
agent (Agents), run by the runtime bound to role agent-runtime, with
its agent document by digest. generate kubernetes writes it as a Deployment or a StatefulSet of
the image the --binding file gives that role, and the agent document as a ConfigMap mounted
read-only, its digest in the annotation cloudspec/agent-digest. A unit's model route becomes a
contract need on model_endpoint (Models); it stays unbound
until a binding names an engine, a loss for which no object is written. The coverage reports
(fixtures/cloudspec/workstation/workstation.coverage.json,
fixtures/kubernetes/workstation.coverage.json) name each.
Network rules are NetworkPolicies, default deny: one per namespace, plus one allow per served port
on every address (from any source), per link between two units and per egress destination with an
IP or CIDR address (fixtures/agenticspec/network/);
the coverage report names each link and destination that got no rule, and why.
For an image built on the cluster's nodes and never pushed (a local cluster with an imported image),
the bundle's binding says target.images: local and every container gets imagePullPolicy: Never. --image-pull <always|if-not-present|never> overrides it, or sets it for an architecture
document:
cargo run -p cloudspec -- generate kubernetes \
--from fixtures/agenticspec/workload/workload.bundle.yaml --out manifests-worker \
--image-pull if-not-presentA never-pushed image has no repository digest, so a local cluster finds it by name:tag only.
With local images (target.images: local or --image-pull never), a unit with a known tag is
written as name:tag, and its digest is kept in the pod annotation cloudspec/image-digest. The
tag comes from --image-tag <unit>=<tag> (repeatable), else from the bundle (name:tag@sha256:…
or a tag field beside the runtime's image). A registry image is always written as
name@sha256:<digest>:
cargo run -p cloudspec -- generate kubernetes \
--from fixtures/agenticspec/workload/workload.bundle.yaml --out manifests-worker-dev \
--image-tag worker=devA frontend's route and the forward of a UI unit's upstream are written as an Ingress. A local
cluster that runs no ingress controller says so in the binding, target: {ingress: none}: no
Ingress is written, the frontend is served by its own Service, and its static-file server
forwards each path when the binding gives it frontend.forward_args; otherwise the frontend's
forward is refused by name (forward_needs_ingress), and check kubernetes --binding refuses an
Ingress such a cluster would not serve. What to write: A cluster without an ingress
controller.
translate kubernetes reads the other way: a directory of rendered manifests, such as a Helm
chart rendered with its values (helm template), becomes an architecture and its coverage report:
cargo run -p cloudspec -- translate kubernetes \
--from fixtures/kubernetes-in/shop --out shop.yamlWorkloads (Deployment, StatefulSet, DaemonSet, Job, CronJob) become service workloads with their
shape, image, TCP and UDP ports, checks, claims and limits, environment, arguments, secret files,
scratch directories, spread, node requirements, tolerations and the host network; Services,
Ingresses, claims, ServiceAccounts and NetworkPolicies add ports and UDP ranges, the border,
volumes, a need on the cluster API and links, and a LoadBalancer Service becomes a dedicated L4
endpoint. A Secret is read by name, never its values. Which kind maps to what is the table
translation/kubernetes-kinds.yaml; a kind it does not list, such as a custom resource, is refused
by name in the coverage report and left out of the architecture, and the run exits 1.
--namespace <name> sets the scope of objects that name none, and --node-group-label <key>
names a provider's node label whose value is a pool.
The check also runs alone:
cargo run -p cloudspec -- check kubernetes --dir manifests --declared control-plane-server.yamlThe architecture check reads cloudspec-architecture/2 documents; --json prints one object
per file. --batch checks many documents in one run and prints one answer, {"results": [...]},
one entry per path in argument order, each the object a run on that path alone prints (a file
that cannot be read is an entry with its error); it exits 1 when an entry is not valid and 2,
with no answer, on a usage error:
cargo run -p cloudspec -- check --json --batch architectures/minimal.yaml architectures/groups.yamlsimulate runs an architecture under a load profile (<name>.load.yaml: the rate and shape of
each journey's requests, and service figures per part) as a seeded discrete-event model. Each
part is a queue with replicas times concurrency servers; each request walks its journey's links,
and a failed call follows the link's on_failure (fail, retry, fallback). It prints one line of
JSON: throughput, the 50th, 95th and 99th percentile of latency, failure rate and saturation,
for the architecture (kpis), per part and per journey. The same seed gives the same bytes. An
architecture or profile the check refuses gives {"error": ...} and exit 1:
cargo run -p cloudspec -- simulate --load architectures/journeys.load.yaml --seed 1 \
architectures/journeys.yaml--batch runs many architectures under the same profile and seed and prints one line,
{"results": [...]}, one entry per path in argument order, each the line a single run of that
path prints; a refused document is an {"error": ...} entry, and the run exits 1 when there is
one.
render html draws an architecture as one self-contained HTML page, with the renderer of
agenticspec (crate agenticspec-render): one band per layer (docs/layers.md § Rendering by
layer), scopes as regions inside the workload band, parts with their ports, links labelled with
what they carry, and, when given, the refusals of a check result, the transports a binding picks
for session ports and the coverage report, totalled per layer. Each group of parts has its own
colour and icon; a part's kind, replicas, external and border are on its card, its other
properties in the table Details. The page holds its stylesheet, script and SVG inline and loads
nothing from the network:
cargo run -p cloudspec -- render html --from fixtures/render/shop.yaml \
--coverage fixtures/render/shop.coverage.json --check fixtures/render/shop.check.json \
--binding fixtures/render/shop.binding.yaml --out shop.html--from also takes a bundle, translated in memory; its coverage is then listed unless
--coverage names a file. Without --check, the page marks each required use port that no
link leaves from as use_unresolved itself.
task checktests the CI path filter, validates the planning store and the specification in blocks/, checks
that no block names a higher layer, checks the vendoring script, and tests the Rust crates.
AGENTS.md holds the rules for changes.
task site
task site:servebuilds the documentation site (website/, Docusaurus, with Node.js 20 or later) into
website/build, and serves it on http://127.0.0.1:3000/cloudspec/ (task site:serve PORT=<n>
for another port).