Get the FREE Ultimate OpenClaw Setup Guide →

coding-agent-maintenance

npx machina-cli add skill kaichen/agent-skillset/coding-agent-maintenance --openclaw
Files (1)
SKILL.md
6.3 KB

Coding Agent Maintenance

⚠️ Self-Update Limitation

A coding agent cannot update itself from within its own session. The native self-updater replaces the running binary in-place, which kills the parent process (exit 137 / SIGKILL).

Detect which agent you're currently inside

Walk up the process tree from the current shell — the agent binary will appear as a parent process:

pid=$$
while [ "$pid" -gt 1 ]; do
  comm=$(ps -p "$pid" -o comm= 2>/dev/null | tr -d ' ')
  echo "$pid $comm"
  ppid=$(ps -p "$pid" -o ppid= 2>/dev/null | tr -d ' ')
  [ "$ppid" = "$pid" ] && break
  pid=$ppid
done | grep -iE 'claude|codex|droid|amp|gemini|copilot|jules'

Example output when inside Claude Code:

15876 claude

This works universally across all agents — no env var knowledge needed. The agent binary name in the process tree is the ground truth.

If the matched agent name == the agent you're about to update → exit this session first, then run the update from a plain terminal.


Quick Reference

# Check versions
claude --version ; codex --version ; gemini --version ; copilot --version ; jules version ; amp --version

# Built-in self-updaters — run from a plain terminal, NOT from inside the same agent
claude update ; codex update ; amp update ; droid update

# Update the rest via bun
bun add -g @augmentcode/auggie @github/copilot @google/gemini-cli @google/jules happy-coder opencode-ai @mariozechner/pi-coding-agent

Agents Overview

AgentBinaryPackageUpdater
Claude Codeclaude@anthropic-ai/claude-codeclaude update / native installer
Codexcodex@openai/codexcodex update
Ampamp@sourcegraph/ampamp update
Factory Droiddroid@factory-ai/clidroid update
Gemini CLIgemini@google/gemini-clibun/npm
GitHub Copilotcopilot@github/copilotbun/npm
Google Julesjules@google/julesbun/npm
Augmentauggie@augmentcode/auggiebun/npm
pipi@mariozechner/pi-coding-agentbun/npm
Happy Coderhappyhappy-coderbun/npm
Opencodeopencodeopencode-aibun/npm

Install & Update

Claude Code

# Native installer (recommended — avoids node path issues):
curl -fsSL https://claude.ai/install.sh | bash

# Migrate from npm to native:
claude migrate-installer        # or: npm uninstall -g @anthropic-ai/claude-code first

# Update:
claude update
/Users/kaichen/.claude/local/claude update   # if binary not in PATH

# Pin a specific version:
npm i -g @anthropic-ai/claude-code@2.0.23

# Health check:
claude doctor

Factory Droid

# Install:
curl -fsSL https://app.factory.ai/cli | sh

# Update:
droid update

All others — bun (preferred) / npm

# Install / upgrade via bun:
bun add -g @openai/codex @sourcegraph/amp @google/gemini-cli @github/copilot @google/jules @augmentcode/auggie

# Switching from npm → bun (run once):
npm uninstall -g @anthropic-ai/claude-code @augmentcode/auggie @github/copilot @google/gemini-cli @google/jules @sourcegraph/amp happy-coder opencode-ai
bun add -g @augmentcode/auggie @github/copilot @google/gemini-cli @google/jules happy-coder opencode-ai @mariozechner/pi-coding-agent

# oh-my-opencode — installs & configures multiple agents at once:
bunx oh-my-opencode install --no-tui --claude=max20 --chatgpt=yes --gemini=yes

MCP Management

MCP servers are shared across agents (same URLs), but each agent has its own CLI syntax.

Claude

# HTTP transport (remote, no local process):
claude mcp add --transport http context7 https://mcp.context7.com/mcp
claude mcp add --transport http exa_websearch 'https://mcp.exa.ai/mcp?tools=web_search_exa'
claude mcp add --transport http grep https://mcp.grep.app

# stdio transport (local process):
claude mcp add --scope project --transport stdio codex -- codex mcp-server
claude mcp add playwright -- npx @playwright/mcp@latest
claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key <KEY>

# JSON (advanced):
claude mcp add-json auggie-mcp --scope user '{"type":"stdio","command":"auggie","args":["--mcp"]}'

claude mcp list
claude mcp remove context7

Codex

# HTTP transport only (--url flag):
codex mcp add context7 --url https://mcp.context7.com/mcp
codex mcp add exa_websearch --url 'https://mcp.exa.ai/mcp?tools=web_search_exa'
codex mcp add grepapp --url https://mcp.grep.app
codex mcp list

Droid

droid mcp    # interactive MCP management

Config Files

# Claude
~/.claude/settings.json
~/.claude/CLAUDE.md              # global instructions

# Codex
~/.codex/config.toml             # main config
~/.codex/AGENTS.md               # default instructions
~/.codex/auth.json               # auth token

# Multiple Codex accounts
mkdir -p ~/.codex/accounts
cp ~/.codex/auth.json ~/.codex/accounts/myaccount.json

# Gemini
~/.gemini/antigravity/skills/    # skills directory

Skills & Plugins

# Claude
ls ~/.claude/skills/
claude plugin install <name>@<marketplace>
claude plugin marketplace add <org/repo>
git clone https://github.com/<user>/<repo>.git ~/.claude/skills/<name>   # direct from GitHub

# Codex
ls ~/.codex/skills/

# Copy a skill between agents
cp -r ~/.codex/skills/brainstorming ~/.claude/skills/

Troubleshooting

# Binary not found after install
which claude
ls -l ~/.local/bin/claude
ls ~/.local/share/claude/versions/

# Force reinstall claude (remove npm version first)
rm -rf ~/.nvm/versions/node/v22.14.0/bin/claude
rm -rf ~/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code
curl -fsSL https://claude.ai/install.sh | bash

# Check running processes
ps aux | grep -E 'claude|codex|gemini|droid'

Source

git clone https://github.com/kaichen/agent-skillset/blob/main/plugins/coding-agent-maintenance/skills/coding-agent-maintenance/SKILL.mdView on GitHub

Overview

Coding Agent Maintenance keeps all AI coding agents up to date on macOS, covering install, upgrade, version checks, MCP server management, and troubleshooting health or reinstall scenarios for Claude Code, Codex, Gemini CLI, GitHub Copilot, Amp, Augment, Jules, Factory Droid, and more.

How This Skill Works

The skill identifies the active agent by walking the parent process tree and then guides updates from a plain terminal. Use built-in updaters like claude update, codex update, amp update, and droid update, or switch to bun/npm for other agents; it also helps migrate package managers and manage agent skills/plugins. Note the self-update limitation: an agent cannot update itself from within its own session.

When to Use It

  • Upgrade a specific agent to the latest version or install a new agent on macOS
  • Check versions of installed agents to confirm they are current
  • Manage MCP servers or monitor agent health and performance
  • Migrate from npm to bun or switch to a native installer to resolve path issues
  • Troubleshoot issues, reinstall agents, or answer questions about updating Claude, Codex, Gemini, AMP, or Droid

Quick Start

  1. Step 1: Determine the active agent by inspecting the process tree to find claude, codex, gemini, copilot, amp, jules, or droid
  2. Step 2: Run the appropriate installation or update command from a plain terminal (e.g., claude update or bun add -g ...)
  3. Step 3: Verify the update and health with a version check and health command (e.g., claude --version; claude doctor)

Best Practices

  • Identify the exact agent in use by inspecting the process tree before updating
  • Run updates from a plain terminal, not from inside the agent session
  • Prefer native installers when available to avoid path problems
  • Pin or specify target versions when compatibility matters
  • Follow with a health check using claude doctor or equivalent health commands

Example Use Cases

  • Upgrade Claude Code using the native installer and then claude update
  • Migrate from npm to bun for all agents and re-install with bun add -g @openai/codex @sourcegraph/amp @google/gemini-cli @github/copilot @google/jules @augmentcode/auggie
  • Check versions of claude, codex, gemini, copilot, and jules to verify updates
  • Reinstall Factory Droid after a failed update to restore functionality
  • Use oh-my-opencode to install and configure multiple agents at once

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers