Skip to content

Consolidate claude and codex Into One Managed Copy in install-agents #4158

Open

Description

@ptr727

Problem

install-agents.sh and install-agents.ps1 now carry a per-tool managed-copy record, and only opencode declares one. Any other opencode copy found first on PATH is consolidated into it. The report names it, and the upgrade removes it through its owner after a prompt, then installs the managed copy.

claude and codex ship from more than one source too, and so carry the same multi-copy problem:

  • claude: the native installer (https://claude.ai/install.sh, https://claude.ai/install.ps1) or the npm package @anthropic-ai/claude-code.
  • codex: the native installer (https://chatgpt.com/codex/install.sh, https://chatgpt.com/codex/install.ps1), the npm package @openai/codex, or Homebrew.

Today an npm copy of either is upgraded through npm, and a native copy behind it on PATH is left as it is. So a host can carry two copies that drift apart, with PATH order deciding which one runs.

Proposal

Declare a managed copy for claude and codex, from the native installer on both platforms. The existing consolidation then removes an npm or Homebrew copy found ahead of it.

Before writing it, decide two things:

  • Where each native installer writes, which sets the managed path the record compares against on Linux. On Windows the record currently names an npm package, so it would need a path form.
  • Whether a scheduled -Yes run should remove an npm copy of claude or codex. For opencode it does, since opencode 1 to 2 was a package move.

Context

The mechanism landed with the opencode 2 move. That change scoped it to opencode, so each tool's move off npm can be reviewed on its own.

Activity

  1. added
    enhancement
    script
    decision
    on Nov 13, 2026
  2. ptr727 commented on Nov 13, 2026

    @ptr727
    OwnerAuthor

    Question for the maintainer (backlog-burndown planner, away mode, round 5). This issue says two things must be decided before it is written, so the away run holds it.

    The first item, where each native installer writes, is a fact the implementing change reads from the installer scripts. It needs no decision. The second item is a policy choice, and it is asked here:

    When install-agents finds an npm or Homebrew copy of claude or codex ahead of the managed native copy, should a scheduled -Yes run remove it?

    1. Recommended: no. Remove it only after the interactive prompt, and have a -Yes run report the duplicate and leave it. Reason: opencode's removal under -Yes rests on its 1 to 2 package move. claude and codex are still published on npm, so an unattended removal deletes a working install that may have been chosen on purpose. The report still surfaces the drift, and the next attended run consolidates it.
    2. Yes, as for opencode. A -Yes run removes the npm or Homebrew copy through its owner, then installs the managed copy. This gives one behavior across all three tools, at the cost of unattended removals.
    3. Do not declare a managed copy for claude or codex. Keep today's per-source upgrade, and accept that two copies can drift with PATH order deciding which one runs.
  3. ptr727 commented on Nov 16, 2026

    @ptr727
    OwnerAuthor

    Answered by the maintainer, 2026-11-15: report only. When install-agents finds an npm or Homebrew copy of claude or codex ahead of the managed native copy, it detects the duplicate and tells the user to correct it by hand. It writes no removal code, not even behind the interactive prompt. The maintainer stated the reason as a standing rule: code written to correct a one-off is not worth it when it never runs again, so detect and notify instead. That applies to anything, such as a wrong install method or a path that can be fixed by hand. The rule is filed for governance separately. This is now work.

  4. removed
    decision
    on Nov 16, 2026
  5. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-25): this group merged into develop as #4456 and its branch and worktree were cleaned up, so the claim holds no files.

    Backlog burndown claim (away run 2026-11-24, round 2, group 6): branch burndown/claude-codex-managed-copy, issues #4158 and #4210.

    #4210's one remaining item is #4158 implemented as detect-and-report, so the same change closes both.

    Predicted files:

    • host-setup/linux/install-agents.sh, a managed-copy record for claude and codex from each native installer, beside opencode's, with any other copy ahead of it on PATH reported and never removed.
    • host-setup/windows/install-agents.ps1, the same, with the record taking a path form where it now names an npm package.
    • tests/test_install_agents.py, the report path for each new managed copy on both scripts.
    • host-setup/linux/README.md, the install-agents.sh bullet that says opencode keeps the one managed copy.
    • host-setup/windows/README.md, the install-agents.ps1 bullet that says the same.
    • docs/host-setup.md, the agent-tools paragraph that says "opencode is the one that does".

    Per the maintainer's answer of 2026-11-15 on #4158: report only. No removal code, not even behind the interactive prompt.

    Parked (2026-11-24): waiting on decision #4402. Branch burndown/claude-codex-managed-copy holds no commits and is not pushed, and its worktree is left standing. State is on #4158.

    Resuming (2026-11-25, away run round 1, group F): decision #4402 is answered (closed, the maintainer's answer recorded on it 2026-11-24: option 1, mirror opencode exactly, report only). The group resumes on this branch with the same predicted files. The two README files feature/wsl-2299 once held were released by the maintainer on #2299 (2026-11-22). Per #4402, the worker also files the removal of the npm and bun upgrade paths as its own issue and lists it in its pull request body.

  6. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Parked (away run 2026-11-24, round 2, group 6): waiting on #4402.

    Done:

    • Read both native installers. Each runs on its own platform, so no Windows npm fallback is needed. Locations: Linux claude ~/.local/bin/claude, Linux codex ${CODEX_INSTALL_DIR:-$HOME/.local/bin}/codex, Windows codex %LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe (a junction to the current release), Windows claude not named by install.ps1, which runs claude.exe install. Decide Whether a claude or codex With No Native Copy Is a Stray Once install-agents Records the Native Copy #4402 has the detail.
    • Measured the exact opencode mirror on install-agents.sh: adding claude_managed and codex_managed alone fails 30 of the 61 Linux tests, and leaves the Linux npm and bun upgrade paths reaching no tool.

    State:

    • Branch burndown/claude-codex-managed-copy, based on origin/develop at b324fd8, holds no commits and is not pushed. No pull request is open.
    • Worktree left standing at ~/repos/worktrees/ProjectTemplate-claude-codex-managed-copy, clean.

    Remaining: implement the option #4402 settles in host-setup/linux/install-agents.sh, host-setup/windows/install-agents.ps1 (a path form for the managed record, since today it names an npm package), tests/test_install_agents.py, and the install-agents bullets in both host-setup/*/README.md files and docs/host-setup.md. Report only, per the 2026-11-15 answer above. #4210 closes with this change.

  7. ptr727 commented on Nov 25, 2026

    @ptr727
    OwnerAuthor

    Resumed and merged into develop as #4456 (squash 18920f4). Closes on promotion with #4210. The npm and bun upgrade-path removal is filed as #4450.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions