/selamy-skills:orchestrate-geminifrom selamy-skills
Safely control Google Gemini CLI on local or remote hosts with private checkouts, immutable goals, least-privilege sandbox policy, durable leases and evidence, restart-safe resume, and system-of-record verification. Use for bounded delegation, jump-box operation, auth or quota routing, tmux recovery, and non-generating validation.
Ships in selamy-skills. 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.
Read when SKILL.md points to them; scripts run unread.
This skill controls Google's gemini executable. It does not control, wrap, or
alias the distinct Antigravity CLI (agy); use orchestrate-agy for that tool.
command -v gemini, then capture gemini --version and gemini --help.
Treat the installed executable as the flag contract.credential_identity, and paid-generation policy in a goal JSON file. Start
from references/goal.example.json; replace every example value before
dispatch. Pin the container image by image@sha256 digest in the same goal.0700. Store
the prompt and a task-specific default-deny policy as owner-only files.Use batched, read-only SSH probes before mutations. Never inspect credential contents, transmit secrets through prompts, or infer authorization from another process, account, checkout, or supervisor.
| Need | Surface | Acceptance boundary |
|---|---|---|
| Login, trust, approvals, or discussion | Interactive tmux | Prove exact marked submission and fresh activity; never count it as contained delivery |
| Capability/auth/sandbox proof only | --preflight-only | No model process; terminal preflight_succeeded |
| No-generation installation/sandbox smoke test | --validation-fake-responses | Terminal validation_succeeded, never delivery |
| Bounded delegated work | Headless runner | Verified stream, process harvest, Git scope, and gates |
Prefer plan for read-only investigation. Use default or auto_edit only
when the immutable goal authorizes edits and the private checkout plus policy
contain them. The runner rejects model aliases, YOLO, extension loading,
inherited sandbox mounts, shared Git metadata, a workspace-root .gemini
configuration tree, repository attribute files, and every process-execution
tool allow. Repository attributes are unsupported
because host Git may execute model-controlled clean or process filters.
skills/orchestrate-gemini/scripts/run_headless.py \
--run-dir /absolute/lane-state/runs/attempt-001 \
--state-dir /absolute/lane-state \
--cwd /absolute/private-clone \
--goal-file /absolute/goal.json \
--prompt-file /absolute/task.prompt \
--policy-file /absolute/policy.toml \
--gemini /absolute/path/to/gemini \
--sandbox-provider docker \
--timeout-seconds 120 \
--model gemini-2.5-pro \
--approval-mode plan \
--preflight-only
Preflight acquires a non-blocking flock lease, persists the canonical goal and
digest, proves the exact clean Git base, validates the default-deny policy,
creates an isolated Gemini home and temp directory, proves the selected
container service and digest-pinned image are available, trusts only the
verified checkout, isolates HOME, empties startup discovery/call commands and
MCP configuration, disables extensions, skills, hooks, and credit overage,
installs fixed container hardening, and requires exactly Gemini CLI 0.51.0. It
never starts a generated turn.
The policy passed with --admin-policy is supplemental in Gemini CLI 0.51.0.
The runner stops if a standard system admin-policy directory would supersede
it. Review references/policy.example.toml and add only the narrow tool names
the goal requires at a priority above the catch-all deny.
Remove --preflight-only only after its evidence passes. The runner stages the
owner-only prompt beneath the private checkout's Git metadata and puts only an
@<path> reference in argv. This matters because Gemini 0.51.0 transforms
non-TTY stdin into an inner Docker --prompt argument. The staged file is
removed after worker harvest; an owner-only evidence copy remains.
The worker and capability probes run in fresh process groups under one absolute
operation deadline plus a fixed short cleanup grace. Verification commands run
inside the same digest-pinned image with no network, a read-only checkout, an
isolated home/temp, and the same process/container harvesting. The supervisor
tracks descendants by PID plus process start time,
including a child that calls setsid(), and escalates TERM to KILL. Known or
uncertain survivors prevent success. Output must contain exactly one init, one successful
result, a non-empty assistant message, no fatal error, the exact requested
model, and a session ID.
The provider guard labels every Gemini and verifier container, removes the upstream host-gateway mapping, binds proxy readiness to loopback, makes the checkout root and Git metadata read-only, and remounts only declared paths writable. Before and after execution it rejects symlinks, multiply-linked regular files, and special files anywhere in those writable trees so a declared path cannot bridge into another checkout or host resource. It also requires Gemini's fixed worker network to be internal, requires the fixed proxy network to be external, and rejects every unexpected network operation or attachment. After harvest, the runner checks sanitized Git state and a full filesystem snapshot, including ignored paths. Any Git metadata change fails. Exit zero means verified delivery, not merely that Gemini stopped talking.
Google stopped serving Gemini CLI requests for free, Google AI Pro, and Google
AI Ultra individual accounts on June 18, 2026. This v0.51 workflow therefore
rejects consumer OAuth and supports live execution only with a paid Gemini API
key. Live generation requires allow_paid_generation: true plus
ORCHESTRATE_GEMINI_PAID_GENERATION_ACK=authorized. Supply the key only in an
owner-only file containing GEMINI_API_KEY=<value> via
--credential-env-file; never export it. The outer CLI receives a non-secret
placeholder, and the provider guard replaces that placeholder with a runtime
--env-file path. The ephemeral copy is removed on every terminal path after
container reconciliation. Any real key in runtime argv is rejected. Record a
reviewed, non-secret quota-owner or billing-project identifier as
credential_identity; do not put a key value or a secret-derived hash there.
The policy must not allow run_shell_command or its legacy alias: a same-user
child process could read the credential from the Gemini parent's process
environment and issue unaccounted paid requests.
Live model transport crosses an internal container network through the bundled
CONNECT proxy, which permits only generativelanguage.googleapis.com:443.
The proxy checkout mount is read-only and its readiness port binds only to
loopback. Validation mode instead forces --network none. The wrapper
serializes v0.51 executions because upstream uses a global proxy container name.
To exercise the real executable and container launch without contacting a
model, use a reviewed Gemini --fake-responses fixture:
skills/orchestrate-gemini/scripts/run_headless.py \
...same reviewed arguments... \
--validation-fake-responses /absolute/reviewed.responses
The runner retains the fixture and its digest, marks validation_mode: true,
forces container network none, and can only finish as
validation_succeeded. Never present this classification as delegated
work. Do not run a live smoke turn merely to strengthen validation when the
quota route is unknown or paid generation is forbidden.
For login, trust, or approval recovery, launch Gemini in a named tmux lane. The
helper stages the marked directive as an owner-only file and passes only an
@<path> reference through Gemini's --prompt-interactive interface:
skills/orchestrate-gemini/scripts/launch_tmux.sh \
lane-repo-gemini-task-YYYYMMDD \
/absolute/private-clone \
/absolute/task.prompt \
"$(command -v gemini)" \
--model MODEL --sandbox
The launcher rejects an existing session and prints a unique dispatch ID plus pre-capture path. After resolving setup screens under the intended identity, prove the exact dispatch:
skills/orchestrate-gemini/scripts/verify_dispatch.sh \
"$SESSION" "$DISPATCH_ID" "$PRE_CAPTURE"
For a file-backed follow-up (an absolute-path, current-user-owned, owner-only
file), run scripts/submit_followup.sh "$SESSION" "$FOLLOWUP_FILE". Using
python3 and the bundled scripts/orchestrate_dispatch.py classifier, it
checks pre.txt first (exiting 75 on active modals or dirty composers, and
also exiting 75 if a modal/approval UI blocks input during paste or submit),
sends bracketed paste (tmux paste-buffer -p), verifies composer readiness
before Enter, and classifies wrapped panes (submitted, queued with
ORCHESTRATION_ALLOW_QUEUED=1 opt-in, accepted_active, unsubmitted,
partial_paste, blocked_modal, ambiguous) before allowing a single recovery
Enter. Count work as submitted only when start/end markers appear in order,
Gemini emits the exact post-end acknowledgement, fresh tool or thinking activity
follows, and a clean composer returns. Session existence, stale Working text,
or a marker sitting in or split from the composer is not proof of dispatch.
Each attempt uses a new direct child of STATE_DIR/runs and reuses the lane's
immutable goal. Before dispatch, the runner reconciles a stale worker using its
PID, process group, and start-time identity and removes daemon-owned containers
carrying the lane/UID labels. The kernel lane lock and canonical per-UID v0.51
global execution lock are inherited by the worker at process creation, closing
the launch-before-identity crash window and preventing replacement dispatch
until the worker exits. Resume only
by naming a terminal prior run:
skills/orchestrate-gemini/scripts/run_headless.py \
...same immutable lane arguments... \
--resume-from /absolute/lane-state/runs/attempt-001
The runner accepts only a prior succeeded delivery with the same immutable
execution-request digest—including the prompt digest and reviewed credential
identity—and checkout identity, then forwards that run's exact session ID with
--resume. Validation and failed runs are not resumable. It
never uses latest. Do not
resume after scope expansion, goal change, ambiguous process cleanup, identity
change, or attempt-budget exhaustion; create a newly reviewed goal instead.
Inspect status.json, command.json, stream output, process harvest state,
changed-path evidence, verification outputs, and the exact Git tree. Require
classification: succeeded, matching requested/reported model plus exclusive
requested-model result statistics, no survivor,
base ancestry, in-scope paths, and passing immutable commands. For a PR, rerun
the repository gates at its exact head, inspect hosted CI and review state, then
verify the merged commit from canonical main. A model narrative, an idle
pane, a locally green test from another SHA, or validation_succeeded is not
delivery.
agents/openai.yaml (opens in a new tab)references/goal.example.json (opens in a new tab)references/policy.example.toml (opens in a new tab)scripts/api_egress_proxy.mjs (opens in a new tab)scripts/launch_tmux.sh (opens in a new tab)scripts/orchestrate_dispatch.py (opens in a new tab)scripts/provider_guard.py (opens in a new tab)scripts/run_headless.py (opens in a new tab)scripts/submit_followup.sh (opens in a new tab)scripts/verify_dispatch.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub selamy-labs/agent-skills --plugin selamy-skills111 skills in this plugin
/adaptive-estimationUse when tracking a slowly-varying latent quantity from noisy measurements with quantifiable uncertainty — a drifting metric, capacity, latency trend, or confidence. Prefer a Kalman-style adaptive estimator over fixed moving averages or static thresholds./adaptive-loop-budgetingUse when an autonomous loop needs explicit limits on attempts, time, cost, tool calls, verification depth, or risk, and a clear stop, continue, yield, or escalate decision./adopt-and-deleteUse when adopting a shared module, library, chart, or service, or doing any consolidation, migration, or refactor that supersedes existing code. The change that adds the replacement must REMOVE what it replaced, in the same atomic change.Other plugins' skills for the same job