agentsclimarketplace

Agent cli detection path

Skill kjuhwa/skills-hub/skills/agents/agent-cli-detection-path

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill agent-cli-detection-path

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Auto-detect which coding-agent CLIs (claude, codex, opencode, etc.) are installed on PATH and register a runtime per detected agent × watched workspace.

SKILL.md

3.4 KB, as published. Nobody here has run it

When to use

  • A local daemon needs to tell the server which agents it can actually execute.
  • Users install agents one-by-one over time; you want the daemon to pick up newly-installed ones without restart (or at next poll, depending on cost).

Steps

  1. Maintain a static list of supported agent types with their canonical PATH name and env override:
    type agentSpec struct {
        Name        string   // "claude"
        Command     string   // "claude"
        EnvPathVar  string   // "MYAPP_CLAUDE_PATH" to override
        EnvModelVar string   // "MYAPP_CLAUDE_MODEL" to override model
    }
    var supportedAgents = []agentSpec{
        {"claude", "claude", "MYAPP_CLAUDE_PATH", "MYAPP_CLAUDE_MODEL"},
        {"codex",  "codex",  "MYAPP_CODEX_PATH",  "MYAPP_CODEX_MODEL"},
        {"opencode", "opencode", "MYAPP_OPENCODE_PATH", "MYAPP_OPENCODE_MODEL"},
        // ...
    }
    
  2. Detect each agent by looking up its binary and running --version:
    for _, a := range supportedAgents {
        path := firstNonEmpty(os.Getenv(a.EnvPathVar), a.Command)
        resolved, err := exec.LookPath(path)
        if err != nil { continue }
        version, err := detectVersion(ctx, resolved)
        if err != nil { logger.Warn("version detect failed", "agent", a.Name); continue }
        detected[a.Name] = agentInfo{ Path: resolved, Version: version }
    }
    
  3. detectVersion is just agent --version with a 5s timeout; capture stdout, trim.
  4. Register one runtime per (agent × watched workspace). The runtime record on the server carries:
    {
      "runtime_id": "<uuid>",
      "daemon_id": "<host-or-uuid>",
      "workspace_id": "<uuid>",
      "provider": "claude",
      "cli_version": "0.121.0",
      "device_name": "alice-macbook"
    }
    
  5. Re-detect on the workspace-sync loop (every ~30s) so a newly-installed agent shows up without daemon restart. Skip detection on the hot path (task poll every 3s) — it's fine to lag by one sync interval.
  6. On shutdown, send an explicit deregister for every registered runtime so the server stops routing tasks immediately instead of waiting for heartbeat timeout.

Example

$ mycli daemon status
running (pid 12345, uptime 2h)

Detected agents:
  claude     0.121.0   /usr/local/bin/claude
  codex      0.45.0    /opt/homebrew/bin/codex
  opencode   2.1.3     /Users/alice/.local/bin/opencode

Registered runtimes: 6 (2 workspaces × 3 agents)

Caveats

  • Don't cache detection results across daemon restarts — users upgrade agents between restarts and you want the new version detected.
  • A failed --version call is not fatal; log WARN and skip that agent. Don't let one broken agent block registration of the others.
  • Per-agent env overrides (MYAPP_CLAUDE_PATH) matter for users with multiple installed versions (pnpm/npx fallbacks) or Windows where .exe suffixes differ.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.