DDelonix RuntimeContributor handbook

Architecture

Project structure

Before you read: Clone, build and test — you have a checkout that builds, and know which gates exist.

This page is the map of the repository: what each top-level file and directory is, who changes it and when, and which parts are generated and must never be edited by hand. Read it after Clone, build and test and before Architecture — the architecture explains why the code is split the way it is; this page tells you where things are. After it you can place any path in the repository, say who changes it, and know whether you may edit it by hand or must regenerate it.

A CI gate keeps it honest: python3 scripts/dev_docs.py --check fails when a tracked top-level path (or a second-level directory of crates/, bins/ or docs/) is missing from the tables below, or when a table names a path that no longer exists.

Reading the repository in five minutes#

Start at the root and follow the dependencies inward:

  1. Cargo.toml — the workspace: every member crate, and every dependency version (members only write { workspace = true }).
  2. bins/delonix-runtime-bin/src/main.rs — the delonix CLI. Each command group is one module under src/cmd/; follow the group you care about.
  3. crates/<layer>/<crate>/src/lib.rs — the engine. The directory is the layer (foundation → contexts → adapters / providers → interfaces), and every lib.rs opens with a //! comment saying what the crate does. The crates has one section per crate.
  4. docs/dev/ — this handbook. docs/adr/ — the decisions behind the structure.

AGENTS.md is the long, Portuguese working journal of the project. It is useful for finding where to look, but parts of it are out of date; confirm anything it says in the code.

Annotated tree#

text
.
├── Cargo.toml, Cargo.lock        workspace members, shared dependency versions, lock file
├── rust-toolchain.toml           pinned Rust toolchain (clippy + rustfmt)
├── buf.yaml                      buf modules/lint for the node contract in proto/
├── deny.toml                     cargo-deny policy (advisories, licences, sources)
├── Makefile, Delonixfile         release binaries and the secondary CLI image
├── AGENTS.md                     project journal and agent rules (Portuguese)
├── ARCHITECTURE.md               C4 model of the engine (Portuguese)
├── README.rst, CONTRIBUTING.md   user entry point, contributor entry point
├── GOVERNANCE.md, MAINTAINERS.md, CODE_OF_CONDUCT.md, SECURITY.md, LICENSE
├── .clinerules, .cursorrules     pointers to AGENTS.md for AI coding tools
├── .dockerignore, .gitignore, .git-blame-ignore-revs
├── .ai/                          skills for AI assistants (E2E quality)
├── .github/                      CI and release workflows, CODEOWNERS, issue/PR templates
├── crates/
│   ├── foundation/               pure shared types and rules (no mechanism)
│   ├── contexts/                 Compute, Stack, security decisions
│   ├── adapters/                 Linux, OCI, SDN, VM, volumes, state, scanner, telemetry
│   ├── providers/                remote systems behind ports (Proxmox VE, TrueNAS)
│   └── interfaces/               CRI, local management API, node API, MCP server
├── bins/
│   ├── delonix-runtime-bin/      the `delonix` CLI (+ templates, pt.po catalogue)
│   ├── delonix-mgmt-bin/         the `delonix-mgmt` binary
│   ├── delonix-node-api-bin/     the `delonix-node-api` binary
│   └── delonix-mcp-bin/          the `delonix-mcp` binary
├── proto/                        node contract delonix.node.v1 (draft, ADR-0040)
├── third_party/                  vendored googleapis protos (Apache-2.0)
├── tests/                        out-of-tree compatibility scripts (CRI, Docker API)
├── docs/
│   ├── adr/                      Architecture Decision Records
│   ├── api/                      OpenAPI — generated from proto/
│   ├── comandos/                 per-command user pages — generated by docs/gen.py
│   ├── dev/                      this handbook (English + translations)
│   ├── discovery/                dated investigations (historical)
│   ├── handbook/                 this handbook as HTML — generated
│   ├── releases/                 release notes, one per version (historical)
│   ├── roadmap/                  improvement-programme traceability matrix
│   ├── runtime/                  dated runtime discovery (historical)
│   └── schema/                   manifest JSON Schema — generated from code
├── scripts/                      CI gates, generators, E2E/chaos harnesses, installer
├── examples/                     manifests validated by CI
├── images/                       one folder per VM image: a `vm.yaml` recipe and a README
├── dist/                         systemd unit for delonix-cri
├── editors/                      VMfile syntax for Vim and VS Code
└── reports/                      dated audit reports (historical)

Top-level files#

Path What it is Who changes it / when Read more
Cargo.toml Workspace root: the member list, [workspace.package], [workspace.dependencies] (every crate path and every external version) and [workspace.lints.clippy]. Its version is the published tag. Anyone adding a crate or dependency; the version changes only in a release commit (scripts/version_gate.py). Coding conventions, Contribution workflow
Cargo.lock Resolved dependency graph for the whole workspace; builds use --locked. Updated by cargo when dependencies change; commit it with that change. Clone, build and test
rust-toolchain.toml Pins the Rust channel with rustfmt and clippy, so dev and CI build with the same compiler. Maintainers, in a dedicated commit. Preparing your environment
buf.yaml buf v2 configuration: the proto/ module (linted) and the vendored third_party/googleapis module (not linted), with the written lint exceptions. Whoever changes the node contract rules. docs/adr/0040-engine-restructuring-layers-ports-node-contract.md
deny.toml cargo-deny policy: advisories (each ignore with a reason), licences, sources. Run by the cargo-deny CI job. Anyone adding a dependency that trips it — with a written justification. Clone, build and test
Makefile Convenience targets: binaries (release delonix + delonix-cri, the primary artefact), image, ghcr-push, bench, coverage. Maintainers. Clone, build and test
Delonixfile Multi-stage build of the secondary CLI container image (builds delonix + delonix-cri from source). Maintainers, when the image build changes. Delonixfile and VMfile
.dockerignore Keeps target/, dist/ and .git out of the Delonixfile build context. Rarely. —
.gitignore Ignores target/, __pycache__/ and local agent-tool files. Rarely. —
.git-blame-ignore-revs Commits git blame should skip (the workspace-wide rustfmt run). Enable with git config blame.ignoreRevsFile .git-blame-ignore-revs. Whoever lands a mass reformatting commit. —
AGENTS.md Project journal and agent rules, in Portuguese: the engine's identity and boundary (canonical), the gates, and a long history per feature. Some sections are out of date. Maintainers and contributors recording decisions and findings; conflicts are resolved by keeping both sides. Start here
ARCHITECTURE.md C4 model (context, containers, components) and functional system design, in Portuguese, rendered into the user site. Hand-written, kept in step with the code on structural changes. Architecture
README.rst The user-facing entry point: what Delonix is, installation, first commands. Changed with user-visible features and releases. Publishing the documentation
CONTRIBUTING.md Short contributor entry point that points into docs/dev/. Handbook maintainers. Contribution workflow
GOVERNANCE.md How decisions are made (single-maintainer model, ADRs for structural decisions). Maintainers. docs/adr/README.md
MAINTAINERS.md Who maintains which area (one maintainer today). Maintainers. GOVERNANCE.md
CODE_OF_CONDUCT.md Contributor Covenant. Maintainers. —
SECURITY.md How to report a vulnerability privately (GitHub Private Vulnerability Reporting). Maintainers. docs/SECURITY-RELEASES.md
LICENSE Apache-2.0 licence of the project. Never, in practice. —
.clinerules Pointer file for the Cline assistant: "the rules are in AGENTS.md". Its crate count is stale; AGENTS.md and The crates are authoritative. Rarely. —
.cursorrules Same pointer, for Cursor. Rarely. —

Source code (crates/, bins/, proto/, tests/)#

The crate list, each crate's layer and who depends on whom are generated facts in Architecture and The crates; they are not repeated here.

Path What it is Who changes it / when Read more
crates/ All library crates, one directory per layer (ADR-0040). scripts/arch_fitness.py fails a crate whose directory is not the layer declared in its LAYERS table, and any dependency against the allowed direction. Every engine feature. Architecture
crates/foundation/ Pure foundation: the data-only model — errors, plain-data records (Status, the firewall records), the secret model, generated names, exit-code and DX_* classes (delonix-model), and zero-dependency network rules (delonix-net-rules). Depends only on the foundation. Changes that add a shared type or pure rule. The crates
crates/contexts/ Bounded contexts with the use cases: Compute, with the Container and Vm records (delonix-compute), the node's own helpers — event log, host and process checks, server dispatch (delonix-node) —, Stack — Kinds, reconciler, revisions (delonix-stack) — and the node's security decisions (delonix-security-runtime). Features that change what the engine decides. The crates
crates/adapters/ Mechanisms on this node: Linux namespaces/cgroups (delonix-linux), OCI images (delonix-oci), networking and firewall (delonix-sdn), microVMs (delonix-vm), volumes (delonix-volume), persisted state and the secret vault (delonix-state), vulnerability scanning (delonix-scanner), logging/metrics/tracing (delonix-telemetry). Features that touch the kernel, disk or a local tool. The crates, Cloud native primer
crates/providers/ Remote systems behind a port: a Proxmox VE node as a VmBackend (delonix-proxmox) and TrueNAS provisioning (delonix-truenas). Changes to a provider integration; a new provider enters here as a port implementation. docs/adr/0008-proxmox-vm-backend.md
crates/interfaces/ Servers that expose the engine: the Kubernetes CRI (delonix-cri, which also ships the delonix-cri binary), the local management API (delonix-mgmt), the node contract server (delonix-node-api) and the MCP server (delonix-mcp). Changes to one of those protocols. Cloud native standards
bins/ Binary crates. Each composes one interface (enforced by arch_fitness.py). Every CLI-visible feature. Architecture
bins/delonix-runtime-bin/ The delonix CLI: src/main.rs, one module per command group in src/cmd/, the Portuguese message catalogue data/pt.po, the init project templates in templates/, build.rs, and tests/architecture.rs. Every feature with a command, flag or message. Coding conventions
bins/delonix-mgmt-bin/ The delonix-mgmt binary: a thin main.rs over delonix-mgmt. Rarely; the logic lives in the interface crate. The crates
bins/delonix-node-api-bin/ The delonix-node-api binary: a thin main.rs over delonix-node-api (the node contract on a unix socket, ADR-0040 P5). Rarely; the logic lives in the interface crate. docs/adr/0050-libvirt-linux-providers-capability-catalog.md
bins/delonix-mcp-bin/ The delonix-mcp binary: a thin main.rs over delonix-mcp. Rarely; the logic lives in the interface crate. docs/adr/0025-mcp-local-ai-control-surface.md
proto/ The node contract delonix.node.v1 (proto/delonix/node/v1/*.proto), marked draft; source of truth for gRPC and HTTP/JSON and of docs/api/openapi.yaml. Checked by scripts/contract_gate.py (format, lint, breaking changes, HTTP mappings, OpenAPI). Contract changes, reviewed carefully — breaking changes against the last tag fail. proto/README.md, ADR-0040
tests/ Out-of-tree compatibility checks, not cargo tests: tests/compat/cri-conformance.sh (the critest suite) and tests/compat/docker_api_smoke.py. Cargo integration tests live in each crate's own tests/. Whoever works on CRI or Docker API compatibility. docs/cri-conformance.md, Clone, build and test
fuzz/ cargo-fuzz targets over hand-written parsers fed with untrusted input (a cloned repo's Dockerfile, an image reference string). Its own [workspace], so the sanitizer build flags never touch the main one; the CI fuzz job runs each target for 60s per push/PR. Whoever adds a hand-written parser for externally-controlled input. M04 of docs/roadmap/13-improvements-traceability.md

Documentation (docs/…)#

docs/ is also the GitHub Pages root. Its top-level files are a mix: the HTML pages (index.html, cheatsheet.html, estrutura.html, …) and .nojekyll are generated by docs/gen.py; gen.py itself and Markdown such as cli-stability.md, gitops.md, estrutura.md, guia-vm-lab.md are hand-written sources that it renders; RELEASES.md is generated by scripts/gen-releases.sh; and dated reports (AUDITORIA-E2E.md, RELATORIO-PRE-PRODUCAO.md, paridade-docker-podman.md, comparacao-medida.md, sovereignty-engine.md) record what was measured on a given date.

Path What it is Who changes it / when Read more
docs/ Documentation root and user site (see the paragraph above). User-visible changes regenerate the site with python3 docs/gen.py; CI fails if the committed docs/ differs from the regenerated one. Publishing the documentation
docs/adr/ Architecture Decision Records, NNNN-title.md, with an index in docs/adr/README.md. Accepted ADRs are never rewritten — a new ADR supersedes. A contributor proposing a structural decision. docs/adr/README.md, Contribution workflow
docs/api/ openapi.yaml, generated from proto/ by protoc-gen-openapi. Never edit it. python3 scripts/contract_gate.py --update after a proto/ change. proto/README.md
docs/comandos/ One HTML page per CLI command group, generated by docs/gen.py from the release binary's real --help plus editorial text in the generator. Never by hand: edit docs/gen.py, rebuild the binary, regenerate. Publishing the documentation
docs/dev/ This contributor handbook: English Markdown source, with pt-AO/ and fr-FR/ translations that carry a translated-from hash. Regions between dev-docs:begin/dev-docs:end markers are generated by scripts/dev_docs.py; the rest is hand-written. Handbook maintainers; generated regions follow the code and are refreshed at release time. Publishing the documentation
docs/providers/ capability-matrix.md, the DECLARED provider capability matrix (ADR-0050), generated by delonix provider matrix; a test in delonix-runtime-bin fails when it differs from the output. delonix provider matrix > docs/providers/capability-matrix.md after a declaration changes. docs/adr/0050-libvirt-linux-providers-capability-catalog.md
docs/discovery/ Numbered, dated investigations and plans (inventories, spikes with their raw result files). Historical records — do not rewrite; write a new one. Whoever runs an investigation before a structural change. docs/adr/
docs/handbook/ This handbook as a website (en/, pt-AO/, fr-FR/, zh-CN/, index.html), generated by scripts/dev_docs_site.py from docs/dev/. Never edit the HTML. Regenerated with python3 scripts/dev_docs_site.py after a docs/dev/ change, and at release time. Publishing the documentation
docs/proxmox/ The Proxmox VE API coverage matrix (ADR-0049): api-<ver>.routes.json, the schema of a named release extracted from a node's apidoc.js with its provenance (fetch date, sha256), and matrix-<ver>.md, generated from it and from the routes the provider crate calls. Never edit the matrix. python3 scripts/proxmox_api_inventory.py docs/proxmox/api-9.2.2.routes.json --markdown > docs/proxmox/matrix-9.2.2.md after a route is added to delonix-proxmox; the schema only when a new release is measured. docs/adr/0049-proxmox-api-coverage-measured-matrix-not-a-cluster-proxy.md
docs/releases/ Release notes, one v<version>.md per release. A release commit must add its own (version_gate.py). Historical — do not rewrite past notes. The release commit. Contribution workflow
docs/roadmap/ Traceability matrix of an improvement programme, where every cell cites a measurement or says "not measured". Maintainers, as items are measured or closed. —
docs/runtime/ Dated discovery of the runtime (current state, crate dependency map, target-vs-reality). Historical: crate names in it predate later renames. Not updated; superseded by Architecture and The crates. Architecture
docs/schema/ v1/delonix.json, the manifest JSON Schema, generated from the code (ADR-0007). delonix manifest schema > docs/schema/v1/delonix.json when a manifest type changes. docs/adr/0007-generated-manifest-schema.md

Tooling, CI and packaging (scripts/, .github/, dist/, editors/, examples/, reports/, third_party/, .ai/)#

Path What it is Who changes it / when Read more
scripts/ Gates (arch_fitness.py, lang_ratchet.py, contract_gate.py, version_gate.py, docs_cli_gate.py, cli-tree.sh, dev_docs.py, tmp_roots_gate.py) with their baselines (arch_baseline.json, lang_baseline.json, cli_baseline.tsv, tmp_roots_baseline.json), generators (dev_docs_site.py, gen-releases.sh, sbom.py), harnesses (e2e.sh, chaos.sh, critest.sh, bench.sh, coverage.sh), the installer install.sh, appliance image builds in appliances/, and spike probes in spikes/. Anyone whose change moves a ratchet (lower the baseline in the same commit); maintainers for the rest. Clone, build and test
.github/ workflows/ci.yml (every gate on push and PR to main), chaos.yml (chaos harness), release.yml (manual, gh workflow run release.yml -f tag=vX.Y.Z), vm-image.yml and vm-appliances.yml (manual image publishing), plus CODEOWNERS, issue and PR templates and a pointer file for GitHub Copilot. Maintainers; a new gate is added here and documented in the handbook. Clone, build and test, Publishing the documentation
dist/ delonix-cri.service, the systemd unit for the CRI server (also embedded in the binary). Whoever changes how delonix-cri runs under systemd. Cloud native standards
editors/ VMfile syntax highlighting: vim/ (ftdetect + syntax) and vscode/ (language configuration + TextMate grammar). Whoever changes the VMfile grammar. Delonixfile and VMfile
examples/ Example manifests per Kind, a multi-file network lab (lab-rede/) and a small complete project (delonix-temp/). The CI docs job dry-runs every examples/*.yaml, so a deprecated or broken example fails the build. Every feature that adds or changes a Kind. Delonixfile and VMfile
images/ One folder per VM image: ubuntu, debian, rocky, fedora (custom recipes that build offline) and eight appliances (opnsense, proxmox, truenas, openstack, monitoring, carbonio, glpi, wazuh) whose vm.yaml names a builder in scripts/appliances/. Each has a README; images/README.md indexes them and explains scripts/verify-images.sh. A unit test (vmspec::every_shipped_recipe_is_valid_and_complete) fails if a recipe stops parsing or points at a missing file or builder. Whoever adds a distro or an appliance, or changes the vm.yaml schema. Delonixfile and VMfile
reports/ Dated audit reports: code-quality/ and production-readiness/<version>/ (inventory, gap matrix, backlog). Historical records of an audit at a commit — do not rewrite; nothing in them is implemented by being listed. Whoever runs a new audit (new files). —
third_party/ Vendored googleapis protos (google/api/annotations.proto, http.proto) used for the HTTP mapping of the node contract. Apache-2.0, licence headers kept; the source commit is recorded in its README.md. Never edited here. Whoever updates the vendored protos, both files from one upstream commit. third_party/googleapis/README.md
.ai/ Tool-neutral skills for AI assistants: skills/delonix-runtime-e2e-quality/ (test taxonomy, provider contract, security checks, report templates). Maintainers. —

Generated vs hand-written#

Everything below is produced by a command. Edit the source, run the generator, commit both — and expect CI to fail if you edit the output by hand.

Path Generated file(s) Generator command CI gate that checks it
docs/api/ openapi.yaml python3 scripts/contract_gate.py --update contract gate job (scripts/contract_gate.py)
docs/schema/ v1/delonix.json delonix manifest schema > docs/schema/v1/delonix.json test job, test o_schema_publicado_esta_em_dia_com_o_codigo in bins/delonix-runtime-bin/src/cmd/schema.rs
docs/comandos/ every page python3 docs/gen.py (needs cargo build --release -p delonix-runtime-bin) generated docs and valid examples job, step "O site publicado tem de ser o gerado" (git diff on docs/)
docs/ top-level *.html, .nojekyll python3 docs/gen.py same step as above
docs/ RELEASES.md bash scripts/gen-releases.sh none in CI: release.yml regenerates and commits it after each release
docs/dev/ the dev-docs regions only python3 scripts/dev_docs.py arch fitness job, step python3 scripts/dev_docs.py --check; also refreshed by release.yml
docs/proxmox/ matrix-9.2.2.md python3 scripts/proxmox_api_inventory.py docs/proxmox/api-9.2.2.routes.json --markdown > docs/proxmox/matrix-9.2.2.md script tests job, scripts/test_proxmox_api_inventory.py (test_the_committed_matrix_is_up_to_date)
docs/handbook/ every page python3 scripts/dev_docs_site.py generated docs and valid examples job, python3 scripts/dev_docs_site.py --check; also refreshed by release.yml
scripts/ cli_baseline.tsv, arch_baseline.json, lang_baseline.json scripts/cli-tree.sh --update, arch_fitness.py --update, lang_ratchet.py --update cli surface (cli-tree.sh --gate), arch fitness, lang ratchet jobs
Cargo.lock the lock file cargo every cargo job builds with --locked

Not committed at all: the manpages (delonix man --dir, checked with groff in CI) and target/.

Where does a new file go?#

  • A type or rule every layer can name, with no I/O → crates/foundation/. Pure network math goes in delonix-net-rules; data-only records and names in delonix-model.
  • A decision or use case (what to run, what a Kind means, a plan) → crates/contexts/.
  • Code that calls the kernel, the disk or a local tool (ip, nft, qemu-img) → crates/adapters/, in the crate that owns that mechanism.
  • An integration with a remote system → a new port implementation in crates/providers/, never an if provider == … in existing code.
  • A new protocol server → crates/interfaces/, composed by exactly one binary in bins/.
  • A CLI command or flag → a module in bins/delonix-runtime-bin/src/cmd/, with its Portuguese translation in data/pt.po.
  • A new crate → the directory of its layer and the LAYERS table in scripts/arch_fitness.py and [workspace.dependencies] in Cargo.toml, in the same commit.
  • An example manifest → examples/ (CI dry-runs it). A structural decision → docs/adr/. Contributor documentation → docs/dev/.

The rules behind this list, with examples, are in Coding conventions — Structure: where code goes and The crates.


Next: Architecture — why the code is split that way: the layers, the processes at runtime, the crate graph and the state on disk.