ln-005-environment-scanner
Original:🇺🇸 English
Translated
Probes CLI agents (Codex, Gemini) and writes docs/environment_state.json — agent availability config for Phase 0
3installs
Added on
NPX Install
npx skill4agent add levnikolaevich/claude-code-skills ln-005-environment-scannerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Paths: File paths (,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.../ln-*
Environment Scanner (Standalone Utility)
Type: Standalone Utility
Category: 0XX Shared
Probes CLI agents (Codex, Gemini) and writes . Skills read this file to check flags before live-probing agents.
docs/environment_state.jsondisabledWhen to Use This Skill
- First-time project setup (no yet)
docs/environment_state.json - After installing/removing CLI agents (Codex, Gemini)
- After (sync may change agent availability)
ln-004-agent-config-sync - When a skill reports unexpected agent unavailability
Output File
docs/environment_state.jsonreferences/environment_state_schema.jsonjson
{
"$schema": "environment_state_v1",
"scanned_at": "2026-03-08T14:30:00Z",
"agents": {
"codex": { "available": true, "version": "0.1.2503" },
"gemini": { "available": false, "detail": "Command not found in PATH" }
}
}User Override
Users can add to any agent entry to opt out without losing detection state:
"disabled": truejson
"codex": { "available": true, "disabled": true, "version": "0.1.2503" }Scanner preserves field on rescan — it overwrites , , but never touches .
disabledavailabledetailversiondisabledHow skills use this: Before running , skills read this file. If → agent is skipped immediately (no probe). If or absent → live health-check runs.
--health-checkdisabled: truedisabled: falseWorkflow
Probe Agents → Write JSON → SummaryPhase 1: Probe CLI Agents
Single call to probes all registered agents:
agent_runner.py --health-checkbash
python shared/agents/agent_runner.py --health-checkPath resolution: is relative to skills repo root. Locate via this SKILL.md directory → parent.
shared/agents/agent_runner.pyParse output (JSON with per-agent status):
| Agent | Registry Key | State Fields |
|---|---|---|
| Codex | | |
| Gemini | | |
If not found or errors: Set both agents to , .
agent_runner.pyavailable: falsedetail: "agent_runner.py not available"Phase 2: Write JSON
- Read existing state (if exists):
docs/environment_state.json- Preserve fields from existing entries
disabled - Preserve any user-added custom fields
- Preserve
- Build new state:
- :
$schema"environment_state_v1" - : current ISO 8601 timestamp
scanned_at - : merge probe results (new
agents/available/detail) with preservedversionflagsdisabled
- Ensure directory exists (create if missing)
docs/ - Write with 2-space indentation
docs/environment_state.json - Validate written file against structure (key presence check)
references/environment_state_schema.json
Phase 3: Summary Report
Display results as a table:
Environment Scan Complete:
| Agent | Status | Detail |
|--------|-------------|---------------------------|
| Codex | available | 0.1.2503 |
| Gemini | unavailable | Command not found in PATH |
State written to: docs/environment_state.jsonIf any agent has , show status as (not available/unavailable).
disabled: truedisabledCritical Rules
- Probe all agents. This skill always probes ALL agents, regardless of existing state. It is the full rescan.
- Preserve . Never overwrite user's
disabledflags. Detection state updates, user preference stays.disabled: true - No side effects. This skill only writes . No other files modified.
docs/environment_state.json - Fail gracefully. Each probe is independent. One failure = one entry, scan continues.
available: false - No TTL. State file has no expiration. It is refreshed only by running this skill.
Anti-Patterns
| DON'T | DO |
|---|---|
| Skip probes for "known" agents | Always probe all agents — this is a full scan |
Delete | Merge: overwrite detection fields, preserve |
| Retry failed probes | One attempt per agent. Failure = |
| Probe MCP tools or platform | Only probe CLI agents (Codex, Gemini). MCP tools configured elsewhere |
| Add TTL or cache expiry logic | State is manual-refresh only |
Definition of Done
| # | Criterion |
|---|---|
| 1 | Both agents probed (Codex, Gemini) |
| 2 | |
| 3 | Existing |
| 4 | Summary table displayed to user |
Version: 2.0.0
Last Updated: 2026-03-08