Claude-code-skills ln-011-agent-installer
Installs or updates Codex CLI, Gemini CLI, Claude Code, and detects Google Antigravity IDE. Use when CLI agents need installation or update.
git clone https://github.com/levnikolaevich/claude-code-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/levnikolaevich/claude-code-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills-catalog/ln-011-agent-installer" ~/.claude/skills/levnikolaevich-claude-code-skills-ln-011-agent-installer && rm -rf "$T"
skills-catalog/ln-011-agent-installer/SKILL.mdPaths: File paths (
,shared/) are relative to skills repo root. Locate this SKILL.md directory and go up one level for repo root.references/
Agent Installer
Type: L3 Worker Category: 0XX Shared
Installs or updates CLI agents via npm and Claude CLI. Single pass per agent: install then immediately verify.
MANDATORY READ: Load
shared/references/coordinator_summary_contract.md, shared/references/environment_worker_runtime_contract.md, and shared/references/worker_runtime_contract.md
Input / Output
| Direction | Content |
|---|---|
| Input | OS info, flags per agent, flag, optional , optional |
| Output | Structured summary envelope with = / / , plus per-agent install outcomes in / |
If
summaryArtifactPath is provided, write the same summary JSON there. If not provided, return the summary inline and remain fully standalone. If runId is not provided, generate a standalone run_id before emitting the summary envelope.
Runtime
Runtime family:
environment-worker-runtime
Phase profile:
PHASE_0_CONFIGPHASE_1_INSTALL_VERIFYPHASE_2_POST_GEMINI_CONFIGPHASE_3_POST_CODEX_SANITY_CHECKPHASE_4_WRITE_SUMMARYPHASE_5_SELF_CHECK
Runtime rules:
- emit
summary_kind=env-agent-install - standalone runs generate their own
and write the default worker-family artifact pathrun_id - managed runs require both
andrunId
and must write the summary to the exact provided pathsummaryArtifactPath - always write the validated summary artifact before terminal outcome
Output Contract
Always build a structured
env-agent-install summary envelope per:
shared/references/coordinator_summary_contract.mdshared/references/environment_worker_runtime_contract.md
Payload fields:
targetsagents_processedagents_skippedversionsgemini_settings_updatedcodex_drift_detectedstatus
Agent Registry
| Agent | Install Command | Health Check |
|---|---|---|
| Codex | | |
| Gemini | | |
| Claude | | |
| Antigravity | manual install via IDE (no CLI) | detect directory presence |
Workflow
For each agent: Install → Verify → Record
Phase 1: Install & Verify
For each agent in registry, apply first matching rule:
| Condition | Action | Report |
|---|---|---|
| SKIP | "disabled by user" |
| Show planned command | "dry run" |
| npm agent | then | version or error |
| Claude | then | version or error |
Single pass: install and verify happen atomically per agent. No separate scan phase — the install result IS the state.
Error handling:
| Error | Detection | Response |
|---|---|---|
| npm not in PATH | fails | FAIL gracefully, report "npm not found in PATH" |
| Permission denied | stderr contains "EACCES" | FAIL, suggest |
| Network error | stderr contains "ETIMEDOUT" or "ENETUNREACH" | FAIL, report "network error" |
| Unknown error | Any other non-zero exit | FAIL, include stderr |
Output table:
Agent Installation: | Agent | Action | Version | Status | |--------|-----------|----------|--------| | Codex | installed | 0.1.2503 | ok | | Gemini | skipped | - | disabled by user | | Claude | updated | 1.0.30 | ok |
Phase 2: Post-Install Gemini Configuration
After successful Gemini install/update, merge into
~/.gemini/settings.json:
- Read existing file (or
if missing){} - Deep-merge: set
tosecurity.enableConseca
(preserve all other keys — MCP servers, model, trust, etc.)false - Write back (2-space indent JSON)
- Model — do NOT pass
flag when invoking Gemini CLI. Auto mode routes to best available model (gemini-3.1-pro / gemini-3-flash).-m
Phase 2b: Post-Install Codex Mapping Sanity Check
After successful Codex install/update:
- Check
for discovery-visible cache (especially~/.codex/skills
)~/.codex/skills/cache/** - Check
install locations for foreign paths such as~/.codex/skills/known_marketplaces.json~/.claude/plugins/... - Check
top-level~/.codex/config.toml
andapproval_policysandbox_mode - If drift is found, report a WARN and defer remediation to
ln-013-config-syncer
This installer does not relocate Codex cache, rewrite skill mapping, or manage Codex execution defaults. It only reports drift so install success is not mistaken for a healthy Codex environment.
Critical Rules
- Never modify
flags. Respect them, never change themdisabled - Fail gracefully. One agent failure does not block others
- Global install only. Always
(CLI tools must be in PATH)npm install -g - Report all changes. Include config modifications in the final summary table
- Idempotent. Safe to run multiple times
- Non-destructive config writes. Always read → deep-merge → edit. Never overwrite
from scratch — it contains MCP servers, hooks, and user preferences managed by other skills.~/.gemini/settings.json - Codex mapping and execution-default remediation belongs to ln-013. This skill may detect Codex skill-root drift or
/approval_policy
drift, but it must not rewrite marketplace/cache layout or Codex top-level permission defaults itself.sandbox_mode
Anti-Patterns
| DON'T | DO |
|---|---|
| Separate check/install/verify phases | Single pass: install then verify |
| Retry failed installs automatically | One attempt, report failure |
Use | Suggest for permission issues |
Install agents marked | Skip with clear report |
| Overwrite entire config file with only known fields | Read existing → deep-merge only owned fields → edit back |
Definition of Done
- All agents processed in single pass (install + verify)
- Disabled agents skipped with report
- Version verified immediately after each install
- Codex mapping and execution-default sanity checked or explicitly reported for ln-013 follow-up
- Status table displayed
- Structured summary returned
- Summary artifact written to the managed or standalone runtime path
Version: 1.1.0 Last Updated: 2026-03-23