/dev-tools:ix-buildfrom dev-tools
Run or inspect shared-host build leases with ix-build. Use when coordinating Cargo builds, checking queued work, or diagnosing memory-cap outcomes.
Ships in dev-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Environment settings use IX_BUILD_*; LOCKED_BUILD_* variables are ignored.
Existing locked-build state and policy paths remain supported. See the
namespace and error-code migration.
Use the installed ix-build command to submit and inspect builds. Do not write a private wrapper around it.
ix-build run -- cargo test -p package-name
Every lane of a user shares /tmp/ix-build-<uid> (owned, mode 0700), regardless of lane IX_HOME. ~/.ix/ix-build/state aliases that queue. Policy is a durable editable file at ~/.ix/ix-build/policy.json; the legacy ~/.ix/locked-build/policy.json remains supported. Installation preserves existing operator edits and recovers old temporary-policy aliases into durable files. Edit JSON directly: each admission pass rereads and validates it, queued workers use new values, and running leases retain their grants. policy set KEY VALUE optionally validates and atomically writes one change with a backup and before/after output. Explicit state/config overrides remain available for isolated fixtures. status reports state_path; policy show prints effective paths to stderr. Nested Cargo calls pass directly to real Cargo without state access when IX_BUILD_LEASE=1, or when the legacy runner sets a nonempty CARGO_TARGET_DIR and equal positive CARGO_BUILD_JOBS/RUST_TEST_THREADS.
New policy init ranks eligible writable local disks by device class: NVMe,
other SSD, HDD. Equal classes prefer HOME; secondary disks need100GB free.
Known read-only, removable, network and temporary mounts are excluded. Targets
use <mount>/ix-build-<uid>/targets, with ~/.ix/ix-build/targets as
the HOME fallback; disk_path measures that selected filesystem. Existing
policies keep their hand-set paths. Jobs use a short per-owner TMPDIR under
disk_path, outside Git worktrees. Paths use /tmp when the build disk path is
inside Git or too long for sockets. The default path is under 70 bytes.
Policy tmpdir overrides it; relative values resolve from the command cwd.
Temporary directories must be private and cannot be symlinks. Caller targets remain authoritative.
For a per-command override, put env inside the admitted command:
ix-build run --class point -- env TMPDIR=/tmp cargo test -j 4 -- --test-threads=4
Choose --class must-fix, --class point, --class block, or --class periodic. The default is periodic. Direct runs and the Cargo shim derive the owner from the user, host, and current worktree directory; IX_BUILD_OWNER overrides it. Ticket labels derive from the Git branch; IX_BUILD_TICKET overrides them. This gives each worktree its own Cargo target directory.
Policy owner_running_share bounds concurrent units while another owner waits.
The default is ceil(capacity_units/active_owners); an owner's first request can exceed its share.
A large waiting request reserves capacity as leases finish. Nonurgent owners take turns by their last grant.
One owner can fill the host when nobody else waits.
Status exposes running_by_owner, queued_by_owner, oldest_queued_seconds_by_owner, and per-request owner_share blockers.
Metrics ix_build_owner_running and ix_build_owner_queued include both counts, including zero, for active owners.
For more memory, configure memory_per_job_by_class.<class> and its absolute memory_cap_by_class.<class> ceiling.
Explicit run --memory 16GiB requires memory_admission=lease_accounted and respects max_request_memory and the total budget.
Cargo commands check CARGO_HOME, git/, and registry/ for write access before launch.
IB_CARGO_HOME_NOT_WRITABLE identifies the cache path and failed resource.
For a sandboxed lane, create a writable task cache and pass it to the outer runner:
mkdir -p .task-cargo
CARGO_HOME="$PWD/.task-cargo" ix-build run --class point -- cargo test -j 4 -- --test-threads=4
Dependencies download again into a fresh cache. CARGO_NET_OFFLINE=true requires a prefetched cache.
Remove the task cache when its ticket finishes.
ix-build status
ix-build cancel REQUEST-ID
ix-build wait REQUEST-ID
queued means the request is accepted and waiting for admission. Its command has not started. running means it owns a lease and its command has started. Use the request id from status to cancel queued or running work.
status already emits JSON; it has no --json flag. Read .requests[],
including retained terminal requests, and select lifecycle_state before
counting active work. Include admitted, which owns a lease before command start.
Each request has string owner, request_id and
lifecycle_state, numeric queued_seconds, and an array blocked_reasons.
Each blocked reason is an object with reason, value, limit and seconds;
extract .reason before joining text. Status blocked_reasons aliases current
blockers and is empty after admission. historical_blocked_reasons retains
accumulated queue evidence.
Count queued, admitted and running requests by owner:
ix-build status | jq '[.requests[] | select(.lifecycle_state == "queued" or .lifecycle_state == "admitted" or .lifecycle_state == "running")] | group_by(.owner) | map({owner: .[0].owner, count: length})'
Observed result, with owner anonymized:
[{"owner":"user@host-a:work","count":1}]
Print queued owner, request id, state, wait seconds and reason names:
ix-build status | jq -r '.requests[] | select(.lifecycle_state == "queued") | [.owner, .request_id, .lifecycle_state, .queued_seconds, ([.blocked_reasons[].reason] | join(","))] | @tsv'
The observed queue was empty, so the second command printed no rows while the
owner count included one running request. blocked_reasons is [] when no
block was recorded. See status JSON
for the captured object shape and field meanings.
One elected scheduler batches admissions every 250 ms and recovery every two
seconds. Queued workers and callers read notices, with a snapshot check at
least every two seconds. Status reads an atomic snapshot without taking the
state write lock. wait reattaches to an accepted request without enqueueing.
Use ix-build submit when the caller should exit while the durable supervisor
continues the build. It accepts the same admission options as run and prints
request=<id> after worker registration. On Linux, submit requires the installed
store's verified host PID namespace. Use run in a sandbox or when that
verification is unavailable: a detached process group still dies with its PID
namespace. Abandoned detached queued requests end with supervision_lost after
a ten-second startup grace, releasing their queue position and reservation;
live legacy workers keep their existing behavior.
Run ix-build wait <id> in the background or set
--notify-command; do not poll status. The notification shell command gets
the request id, terminal state, and exit code as $1, $2, and $3. The flag
overrides IX_BUILD_NOTIFY_COMMAND, which overrides the optional policy field
completion_notification_command. Notification failures never change the
build result. A user may configure, for example,
agent-msg send your-server:your-workspace:your-tab "Build $1: $2, exit $3";
replace the placeholder with the intended lead address.
The released busy-host rename uses the existing shared store and lock inodes.
Run the normal installer while queued and running callers stay alive; it does
not cancel work or require an idle queue. On every compatible upgrade, even
--drain waits only for short publication locks and leaves the scheduler
in charge. Publication locks join the kernel wait queue with one bounded
blocking budget. Never remove lock files or cancel callers to force installation.
An incompatible live store is refused before publication.
See the queue reference.
Nested Cargo inherits IX_BUILD_REAL_CARGO from the admitted outer runner.
Its success or failure passes directly to that command without state access,
additional supervision, or signalling the outer lease. Linux memory sampling
rechecks children that disappear during a procfs read. Zombies contribute zero;
unreadable live processes fall back to status anonymous RSS, then total RSS.
Only consecutive wholly unavailable tree samples exhaust memory_sample_failure_limit
(default 8); readable samples reset it.
The generated hold_ms default is 5,400,000 ms (90 minutes) without captured
stdout or stderr progress. At the deadline, new output warns and extends the
inactivity interval by hold_ms; without new output the command is terminated.
This is not a ceiling on total duration. run forwards output captured before
termination, and the request's .stdout and .stderr state files remain until
normal pruning. Supervisor messages use .worker.stdout and .worker.stderr
and do not count as command progress. Memory caps, admitted units and
supervision remain enforced.
Generated policies reserve memory_reserve_per_job_bytes=3000000000 (3 GB)
per effective worker for admission, and enforce
memory_limit_per_job_bytes=8000000000 (8 GB) per worker as a hard cap.
memory_reserve_per_job_by_class overrides reservations;
memory_per_job_by_class overrides hard limits. The sum of admitted
reservations must fit memory_budget_bytes (measured host RAM minus the host
reserve). Hard caps can sum above that budget while each command stays capped.
Generated class reservations use 1.25 GB/job for block and must-fix,
and 0.75 GB/job for point. Four jobs reserve 5 GB or 3 GB respectively;
hard limits keep the 8 GB/job fallback. Existing policies keep their values.
rss_cap means memory enforcement killed the command for exceeding its cap, including a cgroup scope whose memory.events reports oom_kill. Status includes memory_cap_bytes; run reports the request id, rss_cap, and cap in bytes. The observed child signal is retained as diagnostic data. memory_cap_unavailable means policy required memory enforcement that the launcher could not establish, so the command was not launched.
supervision_lost means the runner lost its watchdog, scope, or lease supervision. It terminates the whole command group with TERM and then SIGKILL after termination_grace_ms before returning. Linux recovery uses the kernel boot UUID so a drifting boot timestamp cannot expire a live lease.
supervisor_lost is recovery's label when its worker is absent/different and both owned groups are verified gone, without a recorded command outcome. PIDs are namespace-local. install-tools pins the host PID namespace and boot UUID once per boot. Host-side recover reclaims an extinct foreign namespace after checking its unique namespace init. Linux kills the namespace's members when that init exits. Readable NSpid fields distinguish host tasks and non-init members even when their namespace links require elevated permissions. An unreadable possible init retains the reservation with reason foreign_pid_namespace_live_or_unverifiable. Ordinary unprivileged host recovery needs no additional permission for host tasks' namespace links. Extinct running leases emit IB_SUPERVISION_LOST in their terminal event. Live namespaces retain their leases.
Use ix-build recover --dry-run to inspect foreign leases without writing state, policy, aliases or failure logs. For an uncertain lease, preview an explicit operator decision with ix-build recover --dry-run --release <request-id> --reason "owner confirmed ended sandbox". Omit --dry-run only when authorized to release it. Release refuses observed live worker, watchdog or command evidence. It requires an expired hold or a provably dead owner worker. An accepted release sends no signals and records the operator UID, reason and prior stop in an operator_release event with IB_SUPERVISION_LOST.
The fallback watchdog counts only the launched command and its descendants, validated against the command's birth identity. Linux thread tasks are excluded so each address space is counted once. Linux uses summed Pss_Anon bytes from /proc/<pid>/smaps_rollup, proportionally accounting shared anonymous pages and excluding file/tmpfs mappings; unreadable Linux processes use conservative status/RssAnon or status/VmRSS fallbacks; macOS uses RSS. Exact per-process metrics are recorded in lease_record.latest_memory_sample, alongside the peak in memory_sample. Each lease logs one initial sample with contributing PIDs/bytes; the sample that crosses the cap is saved in lease_record.memory_sample. A cap diagnostic includes measured bytes, cap bytes, and metric. Cgroup OOM diagnostics use memory.peak when available.
Each refusal or abnormal completion prints one diagnostic line to the caller
and saves that same text as message in the event ledger and status JSON:
ix-build: <CODE> request=<id> limit=<policy key>=<value> measured=<value> (<what>) killed=<pid/command>
| Code | Limit source and measurement |
|---|---|
IB_RSS_CAP | policy.memory_limit_per_job_bytes*parallelism (or the class override); measured command-tree proportional anonymous memory or conservative RSS fallback on Linux, RSS on macOS |
IB_OOM_KILLED | The same memory cap; the owned scope's memory.events counter or retained systemd Result=oom-kill. Reports sampled RSS and the actual counter, or counter unavailable with the Result source. killed names the owned scope when recorded. |
IB_HOLD_TIMEOUT | policy.hold_ms; output or process CPU inactivity milliseconds |
IB_SUPERVISION_LOST | Built-in policy.supervision_required=true; worker/watchdog evidence, or degraded supervision with observed exit 0 |
IB_REFUSED_MEMORY_BUDGET | policy.memory_budget_bytes; requested admission reservation bytes |
IB_REFUSED_CLASS_CAP | policy.memory_cap_by_class.<class>; requested lease bytes |
IB_REFUSED_QUEUE | policy.MAX_REQUESTS or policy.maximum_units; retained requests or requested units |
IB_REFUSED_CAP_UNAVAILABLE | policy.on_missing_cgroup; unavailable cap backend |
IB_CANCELLED | Built-in policy.run_permitted=true; caller revoked permission |
IB_EXTERNAL_SIGNAL | Built-in policy.external_signals=none; “terminated by signal N from outside ix-build” |
IB_COMMAND_EXIT | Built-in policy.success_exit_code=0; actual command exit status |
IB_INVALID_REQUEST | Built-in policy.valid_request=true or configured priority bound; rejected input |
IB_STATE_UNAVAILABLE | Built-in policy.state_access=read_write; unavailable state/configuration |
Built-in rule names describe required behavior; they are not configurable
policy keys. An unavailable historical measurement is explicit. killed
identifies the process group or not-started/command for a refusal.
ix-build error-codes lists the enum. code, limit_key, limit_value,
measured_value, measured_what and killed are separate JSON fields.
When the worker can continue supervising after a watchdog glitch, it records
the real command exit status. A successful command stays successful and reports
that supervision was degraded. Linux reboot recovery uses the kernel boot UUID;
macOS uses kern.boottime. Timestamp-only fallback tolerates 120 seconds of
jitter, so small clock changes do not expire live leases.
Queued requests expose memory_needed_bytes, memory_free_budget_bytes,
position, queue_depth_at_enqueue, requested/granted jobs and memory,
per-state timestamps/durations, and current blocked_reasons with observed
value, limit and seconds. Reasons can overlap. Lease-accounted memory-blocked
heads allow fitting backfill through the aging reservation until max_wait_ms.
Live-available backfill stops at (maximum priority + 1) * aging_ms, or
max_wait_ms when shorter. Must-fix precedes aged lower classes until
max_wait_ms (default 1,200,000 ms / 20 minutes). Then the oldest eligible
waiter reserves capacity across all classes, with backfill stopped. Owner
sharing and every resource gate still apply; running leases continue.
Status request starvation_reservation_in_seconds counts down to eligibility,
is zero when due, and is null outside the queue. Actual admission requires
older eligible waiters and resource blockers to clear.
Backfill never exceeds the memory budget.
metrics exports ix_build_requests_total{host,class,outcome},
ix_build_terminations_total{host,class,code},
ix_build_queue_wait_seconds{host,class} (histogram), and
ix_build_blocked_seconds_total{host,class,reason}. Status JSON's metrics
object carries the same families. Counts survive reopening and explicit
pruning. Owner gauges use owner labels; cumulative families exclude owner and request ids.
Existing requested_memory_bytes/granted_memory_bytes remain hard-cap
fields. Separate requested_memory_reservation_bytes and
granted_memory_reservation_bytes describe admission. memory_needed_bytes
is the reservation needed by a queued request. An event with correction=true
repairs a previously published outcome for the same attempt. Use its latest
snapshot; it does not increment counters a second time. Historical counters
retain the originally observed classification.
Use ix-build policy show to inspect effective values and their provenance (default or configured, plus the supplying key). Inherited per-class reservation/limit values and the automatic explicit-request ceiling are resolved in the output. ix-build policy init writes visible defaults only when absent and preserves existing policies; it has no overwrite flag. Every memory setting can be overridden by a file edit or policy set and is reread on admission; running grants remain fixed. Disk reserve accepts any nonnegative byte value through either edit path.
Memory admission uses PSI and paging activity. Linux memory full avg60
above memory_pressure_full_avg60_max (default 20%) blocks with
psi_memory_full; some avg10 above memory_pressure_some_avg10_max
(default 20%) blocks with psi_memory_some. Combined pswpin/pswpout
activity above swap_io_rate_max (default 1024 kernel pages/second) blocks
with swap_io_rate. Its measurement window, swap_io_window_ms, defaults
to 10000 ms and accepts 1000 through 60000 ms. Equality passes.
Swap occupancy above swap_used_fraction_max (default 0.5) blocks with
swap_used_fraction only when available RAM is below
memory_available_floor_bytes (default 8000000000). Quiet high occupancy
admits and appears in status.memory_pressure_warnings as
swap_occupied_quiet. High occupancy waits with swap_io_warming_up while
the first activity window is collected. Missing paging interfaces skip
activity gating and warn with swap_activity_unavailable instead.
Warnings stay separate from request blocked_reasons and blocked-time metrics.
Set any threshold or window in ~/.ix/ix-build/policy.json or with
policy set; each admission rereads the file. policy show includes each
effective value and its default/configured provenance. Existing policy
values are preserved. See memory pressure
for window recovery and external sample fields.
Tool manifest versions are minimums: an installed version at or above the pin passes, with SemVer prerelease ordering and build metadata ignored. Entries without version require only an executable on PATH; check-install never runs their help/version commands. Missing executables fail.
An explicit CARGO_TARGET_DIR is preserved by ix-build run and the Cargo shim, is excluded from per-lease trimming, and is cleaned by worktree hygiene.
check-install reads the live store header with its own reader and fails on an incompatible minimum reader version.
It also lists differing running executable images with PID, version, and hash.
On macOS, a process predating installation has an unverifiable pre-swap image; its version is explicitly unavailable.
The command honors --state and IX_BUILD_STATE.
Before touching any host, run the candidate installer's hold compatibility test
against that host's installed previous-release binary. Verify the binary's
--version commit against the previous dev-tools tag (the ix-build package
version alone does not identify the dev-tools release). From tools/ix-build:
IX_BUILD_PREVIOUS_BINARY=/absolute/path/to/installed/ix-build ix-build run --class point --ticket SWM-515 -- cargo test --locked -j 4 --bin ix-build installer_hold_is_readable_by_previous_strict_parser_and_optional_previous_binary -- --test-threads=4 --nocapture
The test invokes the production installer's hold constructor in an isolated
temporary state directory, then runs only status with the installed binary against the
candidate's hold record. It checks the previous strict field list and the
binary's reported hold identity. It never installs on the host or changes its
policy. Require a passing result before installation; capture both binary
commits, the command and its result in every rollout brief. Do this on each
target host with its own installed binary before any host changes. An unset
IX_BUILD_PREVIOUS_BINARY runs only the strict-parser regression and does not
satisfy this rollout pre-flight.
Durable hold, lease, queue and policy readers ignore additive fields, warning
once per process; min_reader_version still refuses incompatible stores. The
installer writes the previous hold field list to queue-hold.json and keeps
holder diagnostics in identity-bound queue-hold.meta.json. Old readers never
open the metadata file.
Installation preserves all existing metrics environment entries from the
unit or plist, reports what it preserved, and defaults IX_BUILD_KACHE to
a detected kache executable only when the setting is absent.
For compatible upgrades, invoke ix-build install-tools --owner <recorded-owner>.
Preflight runs before short publication locks. Existing schedulers, queued
workers and running leases continue. --drain accepts a publication wait
bounded by 30 seconds, install_drain_timeout_ms and --drain-timeout-ms.
An incompatible store fails before swap, without holding the queue.
During an explicit queue hold, every queued status row includes install_drain
and queue_hold with holder, reason and deadline. Running rows have empty
current blockers; historical_blocked_reasons retains prior waits.
If runtime and durable policy files differ, installation and normal runner
startup refuse with both paths, SHA256 hashes, mtimes, newer file and differing
keys. Inspect ix-build policy adopt-runtime (dry-run by default); after
choosing runtime values, run ix-build policy adopt-runtime --apply to
back up both files, copy runtime values into the durable policy and symlink
the runtime path to it. Explicit --state and --config select isolated
locations. Status includes policy path, symlink target and hash. No host
policy values are chosen by the installer.
From the dev-tools repository root, install the binary, measured policy, and
Cargo shim with make install-tools ROLLOUT_OWNER=<stable-rollout-owner>. The command puts the
shim ahead of real Cargo in the supported shell startup files. Start a new
shell after the first install. npm packages are installed with both
--registry=https://registry.npmjs.org/ and
--@agent-ix:registry=https://registry.npmjs.org/, so a user or scope registry
setting cannot route Agent IX package installs through a different registry.
Run ix-build check-install to compare installed CLI pins against
tools/ix-build/tool-versions.json; its one-line ok/mismatch output
and exit status are suitable for ix-board cadence checks. This host manifest
does not pin Cargo or rustc; each repository owns its toolchain selection,
using rust-toolchain where configured. A rust-version value sets an MSRV
floor, not a host-wide toolchain pin.
Only the rollout owner pinned in ~/.ix/ix-build/install.json may install.
Concurrent installs are rejected. The record stores source commit, artifact
SHA256, UTC install milliseconds and ownership-transfer history. Use
ix-build install-tools --owner <new> --transfer-from <recorded-owner> for
an explicit transfer. check-install prints these values and fails if a direct
binary write changed the installed artifact. Git builds embed HEAD; source
archives need IX_BUILD_COMMIT=<full-sha> IX_BUILD_DIRTY=false at build time
after verifying that the source archive is clean.
max_queued_per_owner is a positive policy override. The default is
ceil(maximum_units/4), minimum one. Over-cap submissions get IB_REFUSED_QUEUE
with limit=policy.max_queued_per_owner, the attempted count, and the setting
to change. Only queued requests count. Status exports queued_by_owner
(owner-to-count map) and effective max_queued_per_owner (integer).
An abandoned launch with a proven-absent original client and no command members
ends IB_SUPERVISION_LOST within one watchdog poll, freeing its lease. Client
birth identities and PID namespaces are recorded separately from replaceable
workers. Live clients, live command members, foreign namespaces and uncertain
kernel group liveness retain capacity; a healthy command's exit remains authoritative.
run --memory 16GiB selects a total reservation and hard cap for that request,
without changing parallelism or class defaults. Sizes accept integer bytes or
KB/MB/GB and KiB/MiB/GiB. In lease_accounted mode the positive policy
max_request_memory ceiling defaults to half memory_budget_bytes;
oversized requests get IB_REFUSED_CLASS_CAP naming that key. Absolute
memory_cap_by_class and the host budget remain authoritative. Status/events
show requested/granted hard memory and reservation bytes; an explicit cap's
diagnostic limit source is request.memory_bytes. The status metrics and
Prometheus gauges ix_build_active_memory_reserved_bytes / ix_build_active_memory_limit_bytes
sum active sizes by {host,class,state}, where state is queued or running.
Choose the entry point for your wrapper's work, then supply its owner, ticket, and command:
ix-build run --class point --owner <owner> --ticket <ticket> -- cargo build
ix-build run --class must-fix --owner <owner> --ticket <ticket> -- cargo build
ix-build run --class kani --owner <owner> --ticket <ticket> -- cargo kani
ix-build worktree-run --repository <repo> --slot <n> --ticket <ticket> -- cargo test
Use ix-build status and ix-build metrics to inspect controller state.
Installation measures local cores, RAM, and disk to write a new policy. Capacity equals logical cores; the memory budget reserves 25% of total RAM. Existing policy files are preserved. Host owners keep overrides in their local policy. Windows is unsupported: the process supervisor uses Unix process and signal APIs.
An interrupted binary swap retains its transaction fence after deadline expiry;
ix-build queue resume restores the recorded installation before reopening
admission. An expired pre-swap drain cannot freeze the queue after its installer
has exited. status.runtime_policy_file retains the runtime symlink target
alongside the canonical policy_file report.
Policy set, init and adopt-runtime --apply join the kernel lock queue
for policy_writer_wait_ms (default 10,000 ms; range 1..=86,400,000), using
a bounded blocking wait. Adoption shares one wait budget across admission and
state locks. A timeout says policy writer is busy, names the lock path and
elapsed wait, and reports the holder PID/command when Linux exposes it.
Plain policy file edits with a backup remain supported and are recorded in
the policy ledger on the next observed edit.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub agent-ix/dev-tools --plugin dev-tools15 skills in this plugin
/audit-commentsAudit comments in a repository or bounded code section, remove tautologies and stale notes, convert decision records to ADRs, file issues for hack-enabling excuses, and add a ratcheting lint rule. Use when asked to audit or delete code comments./backport-codeA skill for systematically backporting bug fixes and features across specs, templates, and downstream repositories./code-reviewReview code for Agent-IX Golden Path compliance, focusing on test style, mock boundaries, implementation gaps, and code-test alignment. Dispatches by language — Python inline, Rust via `rust-review`, React via `review-react`.Other plugins' skills for the same job