google/capsem/dev-gate
Claude Code and agent skill by google/capsem
- vendor
Checking that the SKILL.md file is still in the repository.
How capsem-gate works and how to add or change a gate command. Use when touching build, test, or release logic, or when a boundary/primitive/recursion/purity guard fails.
Install
npx vskill@latest install google/capsem/dev-gateSKILL.md
The same SKILL.md was published earlier as google/capsem/dev-gate.
The build and release gate
The justfile dispatches; build_system/builder/gate/ decides. No recipe carries a shell body, none exceeds five lines, and both are contract tests rather than conventions.
just test is one process, one machine lock, one workspace, one plan. Its dry run reports the current totals; conditional asset staging makes a literal step/action count depend on machine state. Its exact-source journal is the proof both release commands require by default before they tag or dispatch. An explicit operator-approved release force waives that local journal while retaining source guards, fresh audits and full hosted qualification. The unattended nightly scheduler is also exempt ([release].unattended_channels in `config/gate.toml`; see `RELEASE.md` section 8). Proof selection is owned by qualificationflow.decide and qualificationevidence.find_release_proof.
The rule everything else follows from
A plan action may never invoke `just` or another `capsem-gate` command.
GuardedRunner refuses it at runtime, seeing through uv run --project build_system --frozen and caffeinate env. This is not style: the machine lock is not reentrant, so every such call was a child waiting out its 7200-second timeout for the lock its own parent held. Twenty-two of them existed, and each read perfectly at the call site — Run(["just", "_sign"]) looks like naming a step.
When you need another command's work, compose its fragment:
Groundwork several fragments share uses plan.shared(...), which makes the second caller a dependant rather than a duplicate. Pass `after` to the work, not to the shared step — sequencing shared groundwork behind one of its consumers is a cycle, and one that only appears once two lanes compose.
A fragment that has more than one leaf returns all of them. static returned only its last, so the phases after it started while a storage release it owned was still outstanding.
The interpreter comes first
capsem-gate is capsem.gatelaunch:main, not capsem.gate.cli:main. It re-execs under a source-keyed pycache_prefix before importing any of `capsem.gate`, and exports PYTHONPYCACHEPREFIX so pytest and every other child inherits it. CPython validates a .pyc by mtime and size, so two same-length edits inside one timestamp tick leave stale bytecode that still looks current — which produced 74 false failures during one review, and which would otherwise let a release qualify code that is not in the tree.
The marker is an exact generation identity, not a boolean. A private exact-commit checkout inherits the parent process environment, so the launcher must recompute its source key and re-exec when that marker, the exported prefix, or the interpreter's live prefix differs. Its generation remains under the outer checkout's repository cache; never trade source isolation for a prefix-local cache that disappears with the worktree.
The complete gate refuses in source.record if CAPSEM_GATE_PYCACHE is absent. If you drive a full plan from a test, set it.
Nothing in gatelaunch may import capsem.gate at module scope.
Release state is one indivisible value
Qualification.from_environment is read once in GateCommand.__init__ and passed to artifacts(), functional() and glowup(). Three legal shapes — local, binary release, runtime release — and every partial combination is refused while the plan is being built. No module below reads `CAPSEM_RELEASE_*` itself. They each did, from a different variable, and a dropped GITHUB_ENV line built a plan that verified pulled assets against a source-rebuilt package.
In a test, hand the command an explicit qualification= rather than exporting a variable.
execute() enforces; you inherit it
Never overridden — a contract test fails if a subclass defines it. In order:
plan()is built with the machine sealed (planseal.sealed()). Ambient,
not per-runner: release.py escaped an instance-scoped seal by constructing its own Runner inside plan().
plan.validate(config)— cycles, declared exclusives, one owner per
artifact. Before the lock, so a bad plan costs nothing.
--graph/--dry-runanswered. Beforereexec(), or asking becomes
doing.
reexec(), outside the lock.RunLog.open→GuardedRunner→held(*resources)→plan.run(context).RunLogcloses, then every recorded command prints its timing summary; complete gates also enforce the config-owned, evidence-derived slowdown ratchet.
The host kernel owns the network boundary
During implementation, prefer minimal native TDD/regression checks instead of running gate plans repeatedly. Qualify the full outcome at major phase boundaries and before merge/release. Routine bounded commands do not take the global machine lock; use --machine-lease only when deliberately selecting isolated machine work. An explicit request covers the complete command, including Python or shell drivers that launch compilers. Complete gate/release isolation remains authoritative.
Compiler lifetime is independent: known compiler commands automatically share the compiler cache, and opaque build drivers select --compiler-cache without serializing their work on the machine lock. Startup uses the short cache-owned startup lock. Reaping and final server shutdown require exclusive cache use, so a gate cannot terminate a concurrent focused compiler's server.
Candidate, both release commands, and directly invoked private test modules run under Bubblewrap on Linux or Seatbelt on macOS. Linux receives loopback and the configured UNIX sockets but no external interface; macOS uses the generated profile. Linux report mode is deliberately refused because it cannot produce the Seatbelt-style attempted-egress ledger.
GateCommand computes its effective typed sandbox mode once and exports it to ordinary actions through the config-owned environment name. Outside-sandbox actions clear it. Host Doctor combines owning-command policy with live kernel state; the machine-lock marker proves only lock ownership, never enforcement. Candidate produces the complete local qualification journal required by the public release commands under the policy above. Those commands then dispatch independent hosted qualification. All three accept only enforce: explicit off or report is refused before plan construction, re-exec, or resource acquisition. Measure a changing rule through an incomplete module, whose evidence cannot qualify.
A release cannot resolve or publish while trapped in that namespace, so it starts one authenticated helper immediately before re-exec. Only Run and Script actions declared with outside_sandbox=True receive that runner. The mode-0600 metadata is consumed and deleted before the first plan action, and the helper owns no plan, lock, workspace, or release state. Its commands still pass through the same GuardedRunner, step log, journal, watcher checkpoints, and re-entry refusal.
Exact guest base-image pulls are not helper egress. They are individually recorded Docker CLI actions that materialize per-platform child manifests through the already-declared Docker-daemon container-fetch boundary before the sealed asset lanes consume them.
The allowed edges are exact and contract-tested: the shared fast module's OSV dependency and strict RustSec actions; binary channel-source; both binary precheck; source.remote-main and source.publish-ref; and each final release step. The advisory authorities are mutable security inputs and therefore cannot be replaced by locked package prefetch. Never hand the external runner to any other qualification work. Release CI downloads immutable inputs and materializes locked dependencies before invoking its sandboxed modules.
The fast graph owns pinned documentation-scanner preparation through its narrow egress capability before the docs consumer runs. Prove the cold-cache path; a warm developer cache once hid a download attempted inside Bubblewrap. Sealed docs generation uses retained GitHub evidence, while ordinary publication refreshes it and checks out complete Git history.
Native supervisor restart uses its existing glow-up owner because supervisor setup must precede inherited privilege confinement. Linux then runs the SDK worker as the original user with no_new_privs in a loopback-only namespace; see /dev-testing's ../dev-testing/references/local-ci-parity.md. Never run sudo after that restriction or disable it to make setup work.
Declaring a command
Add the module to COMMAND_MODULES in cli.py.
`exclusive` is about cross-process safety. [execution.exclusives] entries are threading.Locks: they order steps inside one plan and coordinate nothing between two capsem-gate processes. just _sign in one terminal could replace the codesigned binaries a qualification in another was executing.
Direct commands retain finite timeout and process-tree cleanup without a global lease. An explicit --machine-lease selects boundedlease for the programs and command prefixes in [locks.bounded], seen through env and assignments. Inside a gate run it reuses the parent's isolation rather than waiting for its own lock. Routine compilation and focused TDD use the default unleased path; phase qualification retains the gate's machine isolation.
The machine flock and holder record are config-owned user-home paths, never checkout-relative paths. Every linked worktree, clone, and detached full-SHA prefix shares the service home, Docker/Colima daemon, ports, and signing state; giving each tree a lock inode is equivalent to having no machine lock.
Step or resource?
The question is when it must happen.
| Step | Work. Skipped when its dependency fails — which is right: it was written against something that was never produced. | |
| Resource | Anything that must happen on every path including the aborted one. held releases in reverse; preserve runs on failure before release, because release destroys the evidence. |
The orphan-process count, the Colima lifecycle and the failure-evidence capture are resources. The source-state check is a pair of steps — it must not run when the gate failed, because the failure is the report.
Everything is data
Every path, filename, architecture, channel and environment variable name comes from config/gate.toml. build_system/tests/gate/test_gate_has_no_literal_data.py catches literals on both sides — a name read and a name used as a key in an environment you hand to a process. Standard conventions (HOME, TMPDIR, PKG_CONFIG_PATH, HOST_UID) are allowlisted; Capsem rails are not.
Reach for the builders rather than assembling dictionaries: config.environment.capsem(home=…, run_dir=…), config.environment.content(assets=…), and the typed families under [environment.package], [environment.release_site], [environment.install_proof].
Treat the runtime assets as one typed RuntimeContent root. Pass that value through composed package/install/glow-up fragments; never rediscover it from ambient variables or mutable checkout selectors at a Docker/Colima boundary.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 15 Nov 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dev-gate/SKILL.md
Popularity
- Repository stars
- 186
- Repository forks
- 26
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/google/capsem/dev-gate)