Decided December 2026. This is where cigen is going. What exists today is in STATUS.md; when the two disagree, STATUS.md describes the code and this file describes the goal.
An agent-first CI compiler whose main job is skipping work that already passed, and getting that right.
- You write one small config in
.cigen/. cigen generatewrites native provider config (.github/workflows/*.yml, later.circleci/config.yml), which is committed. It stays readable, deterministic and checked for drift in CI.- In CI, the same released
cigenbinary (installed by a generated step) runs in a cheap planner job: it hashes each job's inputs, asks a pass-record store which jobs already passed, and the generated config never starts a runner for those. - Locally, agents get answers in a second without pushing:
cigen plan,cigen explain <job>,cigen expand <job>.
Coding agents now write nearly all CI config, and they keep hand-writing "skip jobs whose inputs already passed" (232 public pull requests in 215 repositories between September and December 2026, many signed by Claude Code). Each copy is a few hundred lines of hashing, cache markers and trust rules, and its bugs are silent: a missed input turns a real failure into a green check. cigen should be the shared, tested implementation.
"Write once, run on any provider" is no longer the headline. Agents translate YAML between providers in minutes, and GitHub Actions YAML runs on Blacksmith, Depot, Namespace, Forgejo and (in preview) CircleCI. Multiple providers remain a useful escape hatch.
- Inputs you can't forget. A job declares its source files. cigen adds the rest itself: toolchain pins
(
rust-toolchain.toml,.ruby-version,.tool-versions,packageManager), lockfiles, image digests, and the job's own definition plus every script it calls (job fingerprints). - Skipped jobs never start. One planner job computes every hash with one batch lookup. Jobs that already passed get no runner. A final aggregator job counts "skipped" as passed for required checks. On CircleCI the plan becomes a setup workflow with a continuation.
- Never skip on doubt. If the pass-record store is unreachable or returns garbage, everything runs. Skipping is an optimisation and must never fail or block a build.
- Trustworthy pass records. Fork pull requests can't write them. A forced rerun never needs caches deleted by hand.
- Readable, deterministic output. Generated files are committed and byte-for-byte reproducible. Provider features cigen doesn't model stay available as escape hatches and are passed through untouched, never dropped.
- Fail fast with a fix. Unknown keys are errors with a suggestion. Errors are available as JSON and say what to do next. No silent defaults.
- Built for agents. Docs as plain Markdown with
.mdcopies andllms.txt, aninstall.mdan agent can be pointed at, skills shipped with the CLI, a strict published JSON schema, andcigen adoptto propose a config from existing workflows.
Designed December 2026; not built. Today each job checks its own marker after it starts (STATUS, "What works"). This replaces that with a plan made once, before any job starts.
A job that runs GitHub's own matrix (github: { strategy }) runs once per entry with one definition, so its pass
records must be per entry (STATUS known problem 23). The plan has one output per job, so until the planner can
enumerate a literal matrix it plans such a job as run, and each entry checks its own marker, keyed by
cigen hash --matrix. A matrix built by an expression (fromJSON(...)) can't be enumerated before the job starts and
always takes that path.
Every generated GitHub workflow with skippable jobs gets two extra jobs, cigen_plan first and cigen_gate last:
cigen_plan:
runs-on: ubuntu-latest
outputs: # one pair per job, declared statically by cigen generate
test: ${{ steps.plan.outputs.test }} # "run" or "skip"
test_hash: ${{ steps.plan.outputs.test_hash }}
steps:
- uses: actions/checkout@v4 # the union of the planned jobs' checkout options
- name: Install cigen 0.3.0 # the install step (cigen_install)
- id: plan
run: cigen plan --github-output
test:
needs: [cigen_plan, build]
if: ${{ !cancelled() && needs.cigen_plan.outputs.test != 'skip'
&& (needs.build.result == 'success' || needs.cigen_plan.outputs.build == 'skip') }}
steps:
- checkout, install cigen
- run: cigen hash --job test --expect ${{ needs.cigen_plan.outputs.test_hash }} --github-output
- the job's own steps
- record the pass under the hash the job computed (only reached if every step passed)
cigen_gate:
needs: [build, test] # every job in the workflow, not cigen_plan
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# one clause per job: anything but success or skipped (failure, cancelled, empty, unknown) fails
- if:
${{ !(needs.build.result == 'success' || needs.build.result == 'skipped')
|| !(needs.test.result == 'success' || needs.test.result == 'skipped') }}
run: exit 1cigen planhashes every planned job, looks the hashes up in the store in one batch, applies the rules below, and writes all its outputs at once at the end. A skipped job gets no runner.- Fail-open by construction. A job runs unless the planner's output for it is exactly
skip. A planner that crashes, times out or never starts leaves the output empty, so everything runs.!cancelled()stops GitHub's rule that a job is skipped when a job it needs failed: this way a failed planner doesn't skip the whole workflow. The explicitneedschecks then put that rule back for the job's other needs. A dependency the planner skipped counts as passed; one the user's ownif:skipped still skips the job, as GitHub would. - A job's own
if:is ANDed onto the generated condition, never replaced. - The planner costs one small runner on the critical path: checkout, install and hashing, about 20-40 seconds before
any job starts. A workflow where nearly everything runs on every push can turn planning off (
skip: false). - Locally,
cigen planprints the same plan with a reason per job ("inputs changed: src/lib.rs", "passed in run 1234 on main", "a job that needs it runs"). It reads any store reachable from a laptop; the GitHub Actions cache isn't, so with that store it shows hashes only.
GitHub reports a job skipped by its if: as passing a required check. That still breaks in three ways:
- a workflow that never starts leaves its required checks pending for good;
- a GitHub matrix job skipped before expansion reports one check under the unexpanded name, so per-leg required checks stay pending (cigen expands matrices itself, so it avoids this one);
- other tools that read check runs (merge bots, dashboards, VisualCI's own aggregator) see "skipped" and may count it as missing or neutral. (DocSpring's VisualCI CI asks that required checks never show as skipped.)
Three ways to report success for a job that passed earlier:
- The job starts and exits early (today's flow). Each skipped job costs a runner: queue wait (minutes when runners are backed up), checkout and install, and a full billed minute on GitHub-hosted runners. That's most of what planning is meant to save.
- One gate job, the only required check. It costs nothing per skipped job: one job of about 5 seconds per workflow, with no checkout or install. Existing branch protection has to switch to requiring the gate alone, and skipped jobs still show grey in the run view.
- The planner posts a commit status named after each skipped job. It costs nothing either, but needs
statuses: write, which fork pull requests don't get. A status isn't a check run, so a required check pinned to the GitHub Actions app won't accept it, and the job's own "skipped" check run still appears beside it.
Decision: the gate. cigen_gate is generated for every planned workflow. The docs and cigen explain tell users
to require cigen_gate and nothing else, and cigen generate prints that once when a workflow first gains a gate. The
gate passes only when every job's result is success or skipped. Failed, cancelled, empty or unknown results all
fail it, so it also stands in for "all checks green"; a mockci test pins that condition once it's built. Its name is
stable, so renaming or adding jobs never touches branch protection. A job that must be required on its own can opt out
of planning (skip: in_job) and keep today's early exit.
trait PassStore {
/// The keys among `keys` that have a pass this run may trust. An error means "no passes".
fn lookup(&self, run: &RunIdentity, keys: &[PassKey]) -> Result<BTreeMap<PassKey, PassRecord>>;
/// Records a pass, in the scope of the run that earned it.
fn record(&self, run: &RunIdentity, key: &PassKey, record: &PassRecord) -> Result<()>;
}Backends, in order: the GitHub Actions cache (the default, no setup), the HTTP protocol below (VisualCI, or your own server), then S3/R2 and Redis.
- GitHub Actions cache. The planner generates one
actions/cache/restorestep per job withlookup-only: trueandcontinue-on-error: true. It reads theircache-hitoutputs, so a cache-service error reads as a miss. The job records withactions/cache/save, using the samepath(the cache's version hashes it). Batch lookup through the cache service's internal API is possible but undocumented, so it isn't the default. - S3/R2 and Redis. One object or key per pass, with a lifecycle rule or TTL for expiry.
- A free hosted store on visualci.com, speaking the protocol: sign in with GitHub, no secrets to set up. Unlike the GitHub cache, it has no 7-day eviction and supports batch lookup. Its account page shows recent records, usage and "why did this run?" history, with Purge all and purging by job or key prefix.
Key: cigen/<scheme>/<generation>/<job id>/<hash>.
schemechanges only when the hashing changes, so a cigen upgrade that hashes the same way keeps old passes.generationcomes from the config (skip.generation, default 0). Bumping it purges every pass.- The job's hash covers its runner (
image,runs-on), so the key needs no OS part.
Over HTTP, JSON both ways. The client is configured with a base URL and no host is hard-coded: paths are relative to
it (VisualCI will serve something like https://api.visualci.com/cigen/).
POST <base>/v1/lookup {"keys": ["cigen/1/0/test/9f2c…", …]} (at most 256 keys)
→ 200 {"passed": [{"key", "scope", "sha", "ref", "run_url", "recorded_at", "cigen_version"}]}
POST <base>/v1/record {"key", "job", "sha", "ref", "run_url", "run_attempt", "cigen_version"}
→ 201 (or 200 if this scope already has the key; a record is never changed)
scope is "trusted" or "ref", so "why did this skip?" can say where the pass came from.
Auth and scope: the server decides, never the request. On GitHub Actions the client sends a GitHub OIDC token
(audience cigen). Elsewhere it sends an API token. The server reads the token's claims, repository_id,
repository_owner_id, ref, event_name and job_workflow_ref, and assigns a scope:
- trusted: a push to the default branch or to a ref the account lists as trusted (release branches);
- ref: every other ref, each in its own scope (
refs/pull/123/merge).
The repository and its owner are identified by repository_id and repository_owner_id, never by name, so a renamed
or transferred repository keeps its passes, and a new repository with an old one's name can't read them.
The token doesn't carry the default branch. The server learns it from its GitHub App installation, or from the public
repository API (public repositories only). A private repository without the App needs its trusted refs listed on the
account page; until then every run gets a ref scope, which never skips on main but is safe.
A lookup reads the run's own scope and then trusted. A record goes to the writer's own scope only. So a pull request
reads main's passes, but main never reads a pull request's, and pull requests can't read each other's.
- Whenever there's a token, the repository comes from it, never from the body. One repository can't read or write another's passes. The one exception is the tokenless fork read below.
- A record holds hashes, job names and who wrote it (ref, commit, run link), never code.
- Errors fail open. A timeout (2 seconds per call, no retries), any non-2xx response or a malformed body counts as no passes, and the run still goes green.
- Quotas. The hosted store has per-owner quotas and rate limits. A record over quota comes back as a 429, or as a
2xx with
"recorded": false. The client treats both as "not recorded", and the job still succeeds. - Expiry and purging. A pass expires 30 days after its last hit. The store keeps history ("why did this run?") separately from the live keys, and purges by account, job or key prefix.
A pull request can edit the workflow, and its code runs in the job. Any credential the job holds is therefore the pull request's to use. Scoping has to be enforced by the store:
- GitHub Actions cache: GitHub enforces it. Caches written on a pull request's ref are visible only to that pull request, while the default branch's caches are visible to all. Forks get the same rule.
- HTTP protocol (VisualCI): OIDC claims, checked by the server as above. Fork pull requests get no OIDC token. For
public repositories they may read trusted passes without a token: the lookup then carries a
repository_id, used only when there's no token. The server checks that the repository is public and returns trusted passes only, which exposes job names and hashes (fine for public code). Private repositories' forks run everything. - S3/R2 and Redis: static credentials can't tell one pull request from another. The credentials that write trusted
passes live in a GitHub environment (
cigen-pass-write) whose deployment branches are the trusted refs. Pull requests get read-only credentials, and their own passes go to the GitHub Actions cache, which scopes them. - Triggers that run trusted code on untrusted input (
pull_request_target,workflow_run) never record. A planned job under one of them is a generation error. - Forced reruns. "Re-run all jobs" reruns the planner with
github.run_attempt > 1, and the planner then plans every job to run. "Re-run failed jobs" doesn't rerun the planner, which succeeded, so its outputs carry over, and only the failed jobs (which have no pass) run again. Aworkflow_dispatchinputcigen_forceplans every job to run. Nobody deletes caches by hand. - Promotion on merge (VisualCI, installed repositories only). On the GitHub App's merged event, if the merge
commit's tree equals the tree of the tested
refs/pull/N/mergecommit (the records'sha), the store copies those passes into trusted, somaindoesn't rerun the tree it just tested. If the trees differ becausemainmoved, nothing is promoted.
- One binary. The planner and the jobs install the same pinned release, or take the same
cigen_installartifact. - The same files. The planner's checkout is the union of its jobs' options (submodules, LFS). A job whose checkout
the planner can't reproduce (another repository, ref or
path, or a sparse checkout) is always planned to run, with that as the reason. - Upstream changes reach downstream jobs. A job's hash includes the hashes of the jobs it
needs, so a changed build makes the tests that use its artifact run. Today's hash does this too (PR #30). - Skips are closed under
needs. A job is skipped only if every job that needs it is skipped too, because a skipped job leaves no outputs or artifacts behind. Later, an order-only dependency that consumes nothing could opt out. - The job checks the plan. It recomputes its hash before its own steps and records under its own hash. A difference from the planner's hash is a warning annotation (a cigen bug), never a failure. mockci asserts it never happens.
- Only full passes are recorded. A job writes its record as its last step, only after every step before it succeeded. It never records when cancelled, and never under the triggers above.
- Doubt runs. Store down, a slow store, garbage, a planner error, or a plan whose output is missing all mean the job runs. A skip needs an exact key match on a record the run's scope may trust.
- Hash
needs(done in PR #30) and addcigen hash --expect. cigen planlocally, read-only, with reasons. This is also the first agent tool in order-of-work item 5.- Generate the planner, the job conditions and the gate behind
skip: planner. Jobs lose their in-job lookup and early exit and keep the record step. Keys move to the new format, so the first run after upgrading runs every job. Once cigen's own CI runs green on it,plannerbecomes the default andin_jobthe opt-out. - The HTTP protocol backend, with a reference server in the repository that the mockci scenarios use. VisualCI implements the same protocol.
- S3/R2, then Redis.
- CircleCI: the same plan in the setup workflow, under CircleCI parity.
What mockci needs first. It already has job if:, needs.<job>.result and outputs, status functions, and the
skip-when-a-need-failed rule.
lookup-onlyonactions/cache/restore(accepted today, but it restores anyway), andgithub.run_attemptwith "re-run all" and "re-run failed" runs.- A checks report: each check name with what branch protection would see (success, skipped, failure or pending), so scenarios can assert that the gate is the only required check and is never skipped.
- Fork pull requests (no secrets, no OIDC token, a read-only token),
pull_request_target, and environments with deployment-branch rules. - The reference store, with a down mode, a slow mode and a garbage mode, plus OIDC-style claims set per run.
- Scenarios: a build input change makes the dependent test run; a dependency of a running job isn't skipped; store
down, a crashed planner and a cancelled planner each run everything and end green; a pull request can't make
mainskip; a fork reads but never writes; "re-run all jobs" runs everything.
Decided December 2026.
- One schema. A config is one document.
cigen.ymlholds all of it;.cigen/is the same document split into files, which the loader merges back into that shape before anything reads it:config.yml(andconfig/*.ymlfragments) for the top level,workflows/<name>.ymlorworkflows/<name>/config.ymlfor a workflow's settings,workflows/<name>/jobs/<job>.ymlfor jobs,commands/<name>.ymlfor commands. A repo with both layouts, or a key defined in two files, is an error. - Strict. Unknown keys are errors that name the file, the key and the closest valid key. Keys for features that
were never built (
docker_build,architectures,resource_classes,vars,caches,output_path,dynamic) are errors too, until a module implements them. - Escape hatches per provider. Anything only one provider understands goes in a
github:orcircleci:block, at the top level, in a workflow or in a job. When cigen generates for a provider, that provider's block is merged in as if its keys were written beside it, untouched; other providers never see it. GitHub'son:,permissionsandconcurrencylive in the workflow'sgithub:block; CircleCI'sresource_class,parallelism,parametersandorbsincircleci:blocks. - Names.
needsfor dependencies,inputsfor what a job's result depends on (globs, or@groupreferences), top-levelinput_groups.requires,source_files,source_file_groups,skip_if,trigger,runnerand theenvironmentalias forenvare removed.
# cigen.yml
provider: github
input_groups:
rust: ['src/**/*.rs', 'Cargo.toml', 'Cargo.lock']
workflows:
ci:
github:
on: { pull_request: {}, push: { branches: [main] } }
jobs:
test:
image: rust:latest
inputs: ['@rust', 'tests/**']
steps:
- run: cargo testModules remove the boilerplate every repo pastes: Rust toolchains and caches, pnpm and Node, Ruby and Bundler,
Playwright, Docker builds with content-based tags, release matrices, deploys, VisualCI uploads. Each module ships its
docs, an agent skill and golden fixtures, and contributes the inputs it knows about (a Rust module adds
rust-toolchain.toml and Cargo.lock). Modules are listed in a catalogue that CI validates.
Designed December 2026, not built yet.
A job lists its modules under modules:. Each item is a module's name, or a one-key map from the name to its
parameters:
jobs:
check:
image: ubuntu-latest
modules:
- rust: { components: [clippy] }
- node: { path: docs }
inputs: ['src/**', 'docs/src/**']
steps:
- run: cargo clippy --all-targets -- -D warnings
- run: pnpm --dir docs build- A module adds steps after the checkout and the skip check (a skipped job runs none of them) and before the job's own
steps, and can add steps after them (CircleCI's
save_cache). Modules expand in the order listed; the steps they add after the job's steps come in reverse order. - Parameters are strict like the rest of the config: an unknown module or parameter is an error that names the closest
valid one, and a wrong type says which type is expected. A module can appear twice in a job only with different
paths. packages:is removed and becomes a renamed-key error ("packagesis nowmodules"). The GitHub provider's hard-coded cargo and pnpm cache steps forpackages: [rust]and[node], and the protocol'spackagesandpackage_specsfields, go with it.uses:keeps meaning the provider's own reference (a GitHub action) and is passed through. A module is never named withuses:, souses: actions/setup-node@…andmodules: [node]can't be confused.- Later modules that work at a point among the steps (a Docker build, a VisualCI upload) would be a step,
- module: docker/buildwithwith:, and modules that create jobs (release matrices, deploys) a top-level key. Neither is in the first build.
Modules are built into the cigen binary and written in Rust, one directory each:
src/modules/
mod.rs the Module trait and the registry, in a fixed order
rust/
mod.rs parameters (a serde struct with deny_unknown_fields), inputs, expansion, unit tests
README.md user docs: what it does, every parameter, the output for each provider
SKILL.md the agent skill: frontmatter `name` and `description`, then when and how to use it
node/
ruby/
Rust rather than YAML files because the first modules need logic: choosing npm, pnpm or Yarn from packageManager or
the lockfile, reading rust-toolchain.toml, failing with a fix when no version is pinned. A YAML module format would
need conditions and substitution, which is the template language the October 2025 rewrite removed. Rust gives typed
parameters and unit tests without a new language. Users write their own reusable steps with commands:. No remote
registry is planned; if one comes, its modules would be data pinned by content hash in a lockfile, hashed as below.
Versions. Modules carry no version in the config: the cigen release pins them. A breaking parameter change becomes
a strict-schema error with a fix, listed in the release notes. name@version stays free for a registry.
A module's change reaches the job's hash. For each module a job uses, cigen hash --job adds a config entry
module:<position>:<name>: the canonical JSON of the module's resolved parameters (defaults filled in, detected values
such as the package manager included) and its expansion for every provider the config names. Any change to what a job
runs (a new step, a bumped action pin, another install command) changes the hash and reruns the job; a cigen upgrade
that changes nothing a job runs keeps its passes. The job's own definition, modules: included, is hashed already.
That hash is honest only when the cigen that hashes in CI is the one that generated the committed workflow: a newer
workflow hashed by an older binary would hash steps it isn't running. So the generated skip step passes the digest of
the job's module expansions it was generated with (cigen hash --job check --modules-digest <digest>), and cigen hash
compares it with its own: on a mismatch it says so and the job runs (principle 3). The planner job will do the same
for every job, after the drift check.
Action pins. Every action a module emits is pinned to a full commit SHA. A moving tag (@v7) can be moved upstream
without changing any hash, the same false skip as a moving image tag. Each module's README lists the release behind
each SHA, and scripts/update-module-pins.sh looks up the latest releases and rewrites the pins; the expansion changes,
so the jobs that use them rerun, which is right.
Expansion runs in the core, after loading and before the config is converted for a provider:
expand(params, provider, project) -> Expansion { before: Vec<Step>, after: Vec<Step> }. It produces ordinary steps:
run steps wherever a shell command does the job, so both providers share them, and provider-native steps otherwise (a
GitHub uses: step, a CircleCI restore_cache). Providers receive plain steps and need no knowledge of modules.
It stays deterministic because expansion is a pure function of the parameters and the project files it reads
(rust-toolchain.toml, package.json, which lockfiles exist). It builds steps in a fixed order with ordered maps and
reads neither the environment nor the clock. The golden tests generate each fixture twice, as for everything else.
The rust module with default parameters, in a project with rust-toolchain.toml:
# GitHub Actions
- name: Install Rust toolchain
run: rustup toolchain install # installs what rust-toolchain.toml names
- name: Cache cargo
uses: Swatinem/rust-cache@<commit SHA of v2.9.3>
# … the job's steps
# CircleCI
- run:
name: Install Rust toolchain
command: rustup toolchain install
- restore_cache:
keys:
- cargo-v1-{{ arch }}-{{ checksum "rust-toolchain.toml" }}-{{ checksum "Cargo.lock" }}
- cargo-v1-{{ arch }}-{{ checksum "rust-toolchain.toml" }}-
# … the job's steps
- save_cache:
key: cargo-v1-{{ arch }}-{{ checksum "rust-toolchain.toml" }}-{{ checksum "Cargo.lock" }}
paths: [~/.cargo/registry, ~/.cargo/git, target]Each toolchain file belongs to a family, defined in the core (src/inputs/) whether or not a module exists for it. A
family's pins and lockfiles are looked for in the project root and at a module's path:
- rust:
rust-toolchain,rust-toolchain.tomlandCargo.lock; used bycargo,cargo-*,rustc,rustup,rustfmtandcross. - node:
.nvmrc,.node-version,package-lock.json,pnpm-lock.yaml,yarn.lock,bun.lock,bun.lockbandpackage.json'spackageManager; used bynode,npm,npx,pnpm,pnpx,yarn,bun,bunxandcorepack. - ruby:
.ruby-versionandGemfile.lock; used byruby,gem,bundle,bundler,rake,rails,rspec,rubocopandirb. - python:
.python-version,Pipfile.lock,poetry.lockanduv.lock; used bypython,python3,pip,pip3,pipenv,poetry,uv,uvxandpytest. - go:
.go-versionandgo.sum; used bygoandgofmt. - java:
.java-version; used byjava,javac,mvnandgradle. - php:
composer.lock; used byphpandcomposer. - terraform:
.terraform-version; used byterraform.
.tool-versions, mise.toml and .mise.toml can pin any tool and put shims in front of every command, so they stay
in every job.
The rules, each erring towards including:
- By default every job gets every family's files in the project root, with or without modules. Adding
modules: [rust]to get a toolchain and a cache never changes when a job skips. - A module adds its family's files and its own (listed per module below), at its
pathand at the project root. - Narrowing is a separate opt-in:
narrow_inputs: trueat the top level sets the default for every job, and a job's ownnarrow_inputsoverrides it. A narrowed job gets only the families of its modules (rule 2) and those from rules 4 and 5. The docs and the key's error text state the trade-off plainly: a narrowed job reruns less often, and it skips wrongly if one of its tools starts another toolchain's tools without cigen seeing it (a Rust test that shells out topnpm). - A narrowed job gets every family whose commands it visibly runs. cigen reads the command words of its run
steps, of the commands it uses, of the shell scripts those run, and of its local actions. A narrowed job with
modules: [rust]and a stepnode scripts/report.jsstill gets.nvmrcandpnpm-lock.yaml. When a job runs a Node package manager, the scripts in itspackage.jsonfiles are read the same way, becausepnpm buildruns whatever thebuildscript says. - Anything cigen can't see into gives a narrowed job every family: a command word that is neither a family's
command nor on a short list of neutral commands (shell builtins and keywords, coreutils,
git,curl,tar,jq); a script that isn'tshorbash(bin/rails, a Python file);make,task,just,docker,evalandbash -c; a GitHub action that isn't on a known list (actions/checkout,actions/cacheand the artifact actions are neutral,actions/setup-nodeis node,ruby/setup-rubyis ruby); a CircleCI step other thancheckoutand the cache, workspace and artifact steps.
narrow_inputs: true # every job: only the toolchains it declares or visibly runs
workflows:
ci:
jobs:
fmt:
modules: [rust]
steps: [{ run: cargo fmt --check }] # gets the rust family only
e2e:
narrow_inputs: false # its tests start other toolchains' tools: every family
modules: [rust]
steps: [{ run: cargo test --test e2e }]Command words are the first word of each line and the first after &&, ||, ;, |, (, $(, a backtick, then,
do, else and !, after prefixes such as sudo, env, exec, time, timeout <n>, xargs and nohup, skipping
VAR=value assignments, with continued lines joined. A misreading errs safe: a word wrongly taken for a command is
unknown, so the job gets every family, and a family's command anywhere in a step's text counts for that family even
outside a command position.
What narrowing still can't see: a tool that starts another toolchain's tools. Turning it on says a job's tools are its
modules' toolchains plus what it visibly runs; where that isn't true, set narrow_inputs: false on the job, list the
other module, or add the files to inputs. cigen explain <job> shows, for each family, whether the job got its files
and why (the default, a module, a command word and where it is, something opaque, or narrowed away).
The registry in src/modules/mod.rs is the catalogue. tests/module_catalogue.rs checks that every module:
- has
README.mdandSKILL.md, the skill's frontmatternamematching the module and with adescription; - documents exactly its parameters in its README's parameter table (the names come from the module's
parameters()metadata, which also drives its error messages); - has a golden fixture,
integration_tests/module_<name>/, that generates every provider it supports; - emits only actions pinned to commit SHAs;
- expands with default parameters into a GitHub workflow that mockci's strict parser loads.
The index, src/modules/README.md (each module's name, summary, family, providers and parameters), is generated from
the registry and checked like a golden file (CIGEN_UPDATE_GOLDEN=1). The cigen.dev docs and the skills shipped with
the CLI come from the module directories; cigen modules list and cigen modules show <name> belong to the agent tools.
Every module has scenarios in tests/module_scenarios.rs: changing an input the module contributes reruns a job that
uses it; without narrow_inputs, changing another family's lockfile reruns it; with narrow_inputs: true, the same
change leaves it skipped, and reruns it once a step visibly runs that family's command or anything opaque. mockci runs run steps on the host, so the scenarios stub the setup
actions (Simulator::stub_action) and put fake rustup, pnpm and bundle commands first on the PATH, which needs a
small mockci addition.
rust: installs the toolchain and caches cargo's downloads and target/.
| Parameter | Default | Meaning |
|---|---|---|
toolchain |
what rust-toolchain.toml or rust-toolchain names, else stable |
a channel or version; setting it when a file exists is an error (two pins) |
components |
[] |
added to the file's, such as [clippy, rustfmt] |
targets |
[] |
added to the file's, such as [x86_64-unknown-linux-musl] |
cache |
true |
cache the cargo registry, git dependencies and target/ |
path |
. |
the workspace root, where Cargo.lock is |
- Inputs: the rust family,
Cargo.toml, every tracked**/Cargo.toml,.cargo/config.tomland.cargo/config. - Both providers: a run step,
rustup toolchain install(from the file, or with--profile minimal,-cand-tfor a channel), thenrustup component addandrustup target addfor extra components and targets on a file's toolchain. GitHub's runners and the Rust images ship rustup. - GitHub caches with
Swatinem/rust-cache(workspaces: <path>); CircleCI withrestore_cacheandsave_cache, keyed by{{ arch }}, the toolchain file andCargo.lock, with a prefix fallback.
node: Node, a package manager, a frozen install and its download cache.
| Parameter | Default | Meaning |
|---|---|---|
version |
.nvmrc or .node-version at path or the root, else an error |
a version, or preinstalled for the image's Node |
package_manager |
package.json's packageManager, else the one lockfile present, else an error |
npm, pnpm or yarn (Bun later) |
install |
true |
run a frozen install |
cache |
true |
cache the package manager's downloads |
path |
. |
the directory holding package.json |
- Inputs: the node family,
package.json, every tracked**/package.json,pnpm-workspace.yaml,.npmrc,.yarnrc.yml,.yarnrc,.yarn/patches/**,.yarn/releases/**andpatches/**. - pnpm and Yarn need a version in
packageManager(Corepack's convention); without one, generation fails and says to add it. Two lockfiles withoutpackageManageris an error that names both. - Install commands:
npm ci,pnpm install --frozen-lockfile,yarn install --immutable(Yarn 2+) oryarn install --frozen-lockfile(Yarn 1), prefixed withcd <path> &&whenpathisn't.. - GitHub:
pnpm/action-setupfor pnpm, thenactions/setup-nodewithnode-version-fileornode-version,cache: <package manager>andcache-dependency-pathset to the lockfile, then the install. - CircleCI: Node comes from the job's image. When the image is
cimg/nodeornodeand its tag doesn't start with the pinned version, generation fails and says which to change; any other image needsversion: preinstalled. Then the package manager at thepackageManagerversion,restore_cachekeyed by{{ arch }}and the lockfile, the install, andsave_cacheof a fixed store directory.
ruby: Ruby, Bundler, a frozen bundle install and the gem cache.
| Parameter | Default | Meaning |
|---|---|---|
version |
.ruby-version or .tool-versions at path or the root, else an error |
a version, or preinstalled for the image's Ruby |
install |
true |
run bundle install with the lockfile frozen |
cache |
true |
cache installed gems |
without |
[] |
Bundler groups to leave out (BUNDLE_WITHOUT) |
path |
. |
the directory holding the Gemfile |
- Inputs: the ruby family,
Gemfile,gems.rb,gems.locked,*.gemspecand.bundle/config. - GitHub:
ruby/setup-rubywithworking-directory: <path>,bundler-cachewhen installing with the cache (it runs a frozen install and caches it),ruby-versiononly when set as a parameter (it reads the version files itself), andBUNDLE_WITHOUTin the step's env. Installing without the cache adds a run step,bundle install, withBUNDLE_FROZEN=true. - CircleCI: Ruby from the image, checked against the pin as for Node (
cimg/ruby,ruby);restore_cachekeyed by{{ arch }}, the Ruby version file andGemfile.lock;bundle config set --local path vendor/bundle,frozen trueandwithout, thenbundle install;save_cacheofvendor/bundle.
Small pull requests, each with its tests and STATUS.md:
- The
modules:key, the registry, parameter validation and errors, expansion before conversion, the hash entry, and therustmodule with its fixtures and scenarios.packages:becomes a renamed-key error, and the protocol'spackagesandpackage_specsfields and the GitHub provider's package cache steps are removed. - Families and the
narrow_inputsopt-in (src/inputs/), with scenarios for each rule above. - The
nodemodule. - The
rubymodule. - cigen's own
.cigen/moves tomodules: [rust]andmodules: [node].
An in-house, test-only CI simulator, so bugs like the constant skip-cache key are caught before users hit them:
- Models the provider behaviour cigen relies on:
${{ }}expressions,needs,if, job outputs, cache scoping by branch, exact and prefix cache hits, eviction, fork permissions, and later CircleCI's setup workflows and$BASH_ENV. - Runs generated steps as real shell commands and records pipelines, workflows, jobs, cache hits and skips in SQLite.
- Scenario tests assert behaviour across runs ("change only a Rust file: clippy must run"; "a fork writes no pass
record"; "after a merge,
mainreuses the pull request's results for the same tree"). - A conformance job runs the same scenarios on real GitHub Actions and Blacksmith and compares results, so the mock can't drift into encoding our own misunderstandings.
- It stays a test harness: no UI, no scheduler, no remote runners.
Generated workflows download the release that generated them and check it against the release's .sha256. That
catches a corrupt or truncated download, but the checksum comes from the same release, so it can't tell a replaced
release from a real one (STATUS known problem 19). Two ways to check where the binary came from:
- GitHub artifact attestations:
release.ymlattests each archive, and the install step checks the attestation. cigen generateembeds the expected checksums of its own released version (four, one per target) in the step, so the release's own.sha256is no longer trusted.
- Clean up (done December 2026): Woodpecker removed, skip key fixed, deterministic output, golden tests, truthful docs.
- The mock CI harness (first version done December 2026: MOCK_CI.md).
- One schema in two layouts (above), then automatically derived inputs, then modules.
- The planner job for GitHub Actions and the pass-record store trait (GitHub cache, Redis, S3, VisualCI): see "The planner and pass-record stores" for the design and its migration steps.
- Agent tools:
plan,explain,expand, the published schema, JSON errors. - First users: cigen's own CI on GitHub Actions, then VisualCI on Blacksmith.
- The hosted pass-record API in VisualCI.
- A redesigned homepage on cigen.dev with docs at
/docs/, agent-friendly throughout. - CircleCI parity, then other projects.
Runners or compute, Docker layer or dependency caches, build-artifact caches, test selection inside a job, test analytics, flaky-test tracking, merge queues, local CI runners, or a CI platform of our own.
cigen began as an attempt to extract and open source DocSpring's Ruby CircleCI generator, which already does content-hash skipping in a setup workflow, automatic job fingerprints, skip reports and contract tests. That generator is the design reference for cigen's skipping. DocSpring migrates last, and only if cigen beats its generator on merit, but everything is built so that migration stays possible: CircleCI setup workflows and continuations, generation-time conditions, approval jobs, multi-architecture jobs, self-hosted runner routing and per-job contexts must all fit the model. DocSpring's configuration is private: describe ideas from it, never copy its code or config into this repo.