Merge pull request 'Make the linked Homebrew OpenCode build the only OpenCode install' (#17) from fm/opencode-retire-v1 into main
This commit was merged in pull request #17.
This commit is contained in:
commit
5becfd69aa
6 files changed
+43
-48
No files matched your search
@@ -8,9 +8,9 @@ Deliberate decisions in this repo - do NOT silently revert them:
|
|||||||
- Pi is managed the same way: `home/.pi/agent/{settings,models}.json`, `themes/`, and custom extensions (`terminal-status-title`, `calm`). Do not symlink the whole `~/.pi/agent` tree - sessions, auth, npm cache, and herdr's `extensions/herdr-agent-state.ts` stay live.
|
- Pi is managed the same way: `home/.pi/agent/{settings,models}.json`, `themes/`, and custom extensions (`terminal-status-title`, `calm`). Do not symlink the whole `~/.pi/agent` tree - sessions, auth, npm cache, and herdr's `extensions/herdr-agent-state.ts` stay live.
|
||||||
- herdr stores runtime state beside its config, so `~/.config/herdr` stays a real directory and only `config.toml` is symlinked; `home.activation.herdrConfigDir` migrates the old whole-directory symlink and clears leaked artifacts. Do not symlink the whole directory - rationale and artifact list are in `home.nix`.
|
- herdr stores runtime state beside its config, so `~/.config/herdr` stays a real directory and only `config.toml` is symlinked; `home.activation.herdrConfigDir` migrates the old whole-directory symlink and clears leaked artifacts. Do not symlink the whole directory - rationale and artifact list are in `home.nix`.
|
||||||
- Codex runs on the OpenCode Go subscription. The ChatGPT app owns and rewrites the live `~/.codex/config.toml`, so it is NOT symlinked; `home.activation.codexOpenCodeGo` merges the repo fragment `home/.codex/config.toml` into it on every rebuild, and the app's own sections (`[desktop]`, `[plugins]`, `[mcp_servers]`, ...) survive. Auth is command-backed via `~/.local/bin/opencode-go-token` (prints the key from the opencode store), so `~/.codex/auth.json` stays in ChatGPT mode and ChatGPT sign-in coexists with Go. Only Go models that speak the Responses API work (`deepseek-v4.1-flash`, `gpt-6-luna`, `gpt-5.6-luna`, `grok-4.7/4.6`); GLM/Kimi/MiMo/LongCat are chat-completions-only and need a proxy. Desktop Codex is now the `chatgpt` cask - do not use the deprecated `codex-app` cask.
|
- Codex runs on the OpenCode Go subscription. The ChatGPT app owns and rewrites the live `~/.codex/config.toml`, so it is NOT symlinked; `home.activation.codexOpenCodeGo` merges the repo fragment `home/.codex/config.toml` into it on every rebuild, and the app's own sections (`[desktop]`, `[plugins]`, `[mcp_servers]`, ...) survive. Auth is command-backed via `~/.local/bin/opencode-go-token` (prints the key from the opencode store), so `~/.codex/auth.json` stays in ChatGPT mode and ChatGPT sign-in coexists with Go. Only Go models that speak the Responses API work (`deepseek-v4.1-flash`, `gpt-6-luna`, `gpt-5.6-luna`, `grok-4.7/4.6`); GLM/Kimi/MiMo/LongCat are chat-completions-only and need a proxy. Desktop Codex is now the `chatgpt` cask - do not use the deprecated `codex-app` cask.
|
||||||
- firstmate lives at `~/Documents/firstmate` as a mutable git clone (not in the Nix store). `home.activation.firstmate` clones it if missing and seeds `config/backend=herdr` + `config/crew-harness=opencode` only when those files are absent. Crew routing is `home/.config/firstmate/crew-dispatch.json` (symlinked in): per the captain's order 2026-10-21, coding crewmates and scouts use `opencode` + `opencode-go/deepseek-v4.1-flash` through the OpenCode CLI. Design, architecture, and design-review tasks are the exception: the file's first rule sends them to Pi with `openai-codex/gpt-6.1-sol` at `xhigh`, and implementation tasks re-resolve their profile instead of keeping that model. The free `deepseek-v4.1-flash-free` order of 2026-10-20 resumes when that lane resets. The validation pipeline stays on Pi with `opencode-go/deepseek-v4.1-flash` steps and the `opencode-go/glm-5.3-flash` reviewer. Avoid the `muse-spark-*-contributor` models, which train on prompts, and the `exo-free`, `mimo-*-free`, and `nemotron-*-free` models, whose data may be used to improve the model. `cat-jam-free` retains for 30 days. Crews inherit the primary's OpenCode login through the spawn-owned symlink (the isolated worker data root links the primary `<XDG_DATA_HOME>/opencode/auth.json`; no `~/.pi/agent/auth.json` reliance). Launch with shell alias `fm` (`cd` + `pi` with the two firstmate primary extensions); the primary runs Pi on the OpenCode Go subscription, while crews run on the opencode harness unless a dispatch rule selects another harness. `oc2` remains the isolated OpenCode 2 fallback. Self-update via `/updatefirstmate`, not rebuild.
|
- firstmate lives at `~/Documents/firstmate` as a mutable git clone (not in the Nix store). `home.activation.firstmate` clones it if missing and seeds `config/backend=herdr` + `config/crew-harness=opencode` only when those files are absent. Crew routing is `home/.config/firstmate/crew-dispatch.json` (symlinked in): per the captain's order 2026-10-21, coding crewmates and scouts use `opencode` + `opencode-go/deepseek-v4.1-flash` through the OpenCode CLI. Design, architecture, and design-review tasks are the exception: the file's first rule sends them to Pi with `openai-codex/gpt-6.1-sol` at `xhigh`, and implementation tasks re-resolve their profile instead of keeping that model. The free `deepseek-v4.1-flash-free` order of 2026-10-20 resumes when that lane resets. The validation pipeline stays on Pi with `opencode-go/deepseek-v4.1-flash` steps and the `opencode-go/glm-5.3-flash` reviewer. Avoid the `muse-spark-*-contributor` models, which train on prompts, and the `exo-free`, `mimo-*-free`, and `nemotron-*-free` models, whose data may be used to improve the model. `cat-jam-free` retains for 30 days. Crews inherit the primary's OpenCode login through the spawn-owned symlink (the isolated worker data root links the primary `<XDG_DATA_HOME>/opencode/auth.json`; no `~/.pi/agent/auth.json` reliance). Launch with shell alias `fm` (`cd` + `pi` with the two firstmate primary extensions); the primary runs Pi on the OpenCode Go subscription, while crews run on the opencode harness unless a dispatch rule selects another harness. `oc2` remains the isolated-config OpenCode launcher. Self-update via `/updatefirstmate`, not rebuild.
|
||||||
- OpenCode 2 is the isolated OpenCode harness behind `oc2`, not the firstmate primary. It is the stable Homebrew `opencode` formula, installed with `link = false` so the OpenCode 1.x CLI keeps `/opt/homebrew/bin/opencode`, and launched only through `home/bin/oc2` so `OPENCODE_CONFIG` stays at `home/.config/opencode2/opencode.json` and cannot rewrite OpenCode 1.x's `~/.config/opencode`. Switching between builds needs `opencode service restart`, because the client refuses a background service left over from the other build with `Background service uses an incompatible health protocol`. The npm beta package `@opencode-ai/cli` that `home.activation.opencode2` used to install is removed by `rebuild.sh` at rebuild time, so the stable formula is the only OpenCode 2 install. firstmate harness detection matches `*opencode*`, so it still classifies as OpenCode.
|
- OpenCode is one install: the stable Homebrew `opencode` formula, linked so `/opt/homebrew/bin/opencode` is that build. It is both the firstmate crew harness and the `oc2` binary. `oc2` only isolates the config: `OPENCODE_CONFIG` stays at `home/.config/opencode2/opencode.json` and cannot rewrite `~/.config/opencode`, and `OPENCODE2_BIN` overrides the binary. firstmate harness detection matches `*opencode*`, so it still classifies as OpenCode.
|
||||||
- Shell aliases: `cc` (Claude skip-permissions), `co` (Codex full-auto), `gb` (Grok --yolo), `fm` (firstmate via Pi), `oc2` (OpenCode 2, isolated). They are intentional high-agency shortcuts.
|
- Shell aliases: `cc` (Claude skip-permissions), `co` (Codex full-auto), `gb` (Grok --yolo), `fm` (firstmate via Pi), `oc2` (OpenCode with isolated config). They are intentional high-agency shortcuts.
|
||||||
- OpenSuperWhisper is installed by the `opensuperwhisper` cask, and `home.activation.openSuperWhisper` downloads its Whisper model (`ggml-large-v3-turbo.bin` under the app's Application Support directory, never the Nix store) and seeds the model selection only when it is missing or dangling. All other app settings (trigger, language, paste behavior) belong to the app and must not be rewritten by a rebuild, so `modifierOnlyHotkey = rightOption` on this machine stays the effective trigger. Microphone/Accessibility/Input Monitoring grants stay manual because macOS TCC cannot be declarative; do not kill a running app to apply defaults. The model is local-only.
|
- OpenSuperWhisper is installed by the `opensuperwhisper` cask, and `home.activation.openSuperWhisper` downloads its Whisper model (`ggml-large-v3-turbo.bin` under the app's Application Support directory, never the Nix store) and seeds the model selection only when it is missing or dangling. All other app settings (trigger, language, paste behavior) belong to the app and must not be rewritten by a rebuild, so `modifierOnlyHotkey = rightOption` on this machine stays the effective trigger. Microphone/Accessibility/Input Monitoring grants stay manual because macOS TCC cannot be declarative; do not kill a running app to apply defaults. The model is local-only.
|
||||||
|
|
||||||
## Maintaining this file
|
## Maintaining this file
|
||||||
|
|||||||
+4
-7
@@ -54,13 +54,10 @@
|
|||||||
# resolves on the normal PATH. No server, service, database, or
|
# resolves on the normal PATH. No server, service, database, or
|
||||||
# connection is configured.
|
# connection is configured.
|
||||||
{ name = "libpq"; link = true; }
|
{ name = "libpq"; link = true; }
|
||||||
"node" # required: opencode-ai, backpass, and acpx are npm globals,
|
"node" # required: backpass and acpx are npm globals, not formulae
|
||||||
# not formulae
|
# Unpinned: onActivation.upgrade refreshes formulae each rebuild, so the
|
||||||
# OpenCode 2 stable. Installed unlinked so it never replaces the
|
# linked binary tracks the latest opencode release. Crew harness and oc2.
|
||||||
# npm-installed OpenCode 1.x CLI at /opt/homebrew/bin/opencode (the crew
|
"opencode"
|
||||||
# harness); home/bin/oc2 runs this keg binary directly. `link = false`
|
|
||||||
# makes brew bundle unlink after install, which is deterministic.
|
|
||||||
{ name = "opencode"; link = false; }
|
|
||||||
"pi-coding-agent"
|
"pi-coding-agent"
|
||||||
"tea" # Gitea CLI - PRs for firstmate crewmates on unraid.local:3003
|
"tea" # Gitea CLI - PRs for firstmate crewmates on unraid.local:3003
|
||||||
"tmux"
|
"tmux"
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ in
|
|||||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/opencode/skills";
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/opencode/skills";
|
||||||
force = true;
|
force = true;
|
||||||
};
|
};
|
||||||
# OpenCode 2 isolated config - never share ~/.config/opencode with 1.x
|
# OpenCode isolated config - keep it separate from ~/.config/opencode
|
||||||
home.file.".config/opencode2/opencode.json" = {
|
home.file.".config/opencode2/opencode.json" = {
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/opencode2/opencode.json";
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/opencode2/opencode.json";
|
||||||
force = true;
|
force = true;
|
||||||
@@ -369,8 +369,9 @@ in
|
|||||||
"$HOME/.codex/config.toml"
|
"$HOME/.codex/config.toml"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# OpenCode 2 is the stable Homebrew `opencode` formula, declared unlinked in
|
# OpenCode is the stable Homebrew `opencode` formula, linked in
|
||||||
# configuration.nix; home/bin/oc2 runs its keg binary. Nothing to install here.
|
# configuration.nix; home/bin/oc2 runs its keg binary with an isolated config.
|
||||||
|
# Nothing to install here.
|
||||||
|
|
||||||
# backpass (kunchenguid/backpass) - gradient descent for agent memory: reads
|
# backpass (kunchenguid/backpass) - gradient descent for agent memory: reads
|
||||||
# the transcript stores of the harnesses this config already declares
|
# the transcript stores of the harnesses this config already declares
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Launch OpenCode 2 with an isolated config so it cannot rewrite
|
# Launch OpenCode with an isolated config so it cannot rewrite
|
||||||
# ~/.config/opencode/opencode.json (OpenCode 1 / firstmate).
|
# ~/.config/opencode/opencode.json (firstmate).
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
bin="${OPENCODE2_BIN:-/opt/homebrew/opt/opencode/bin/opencode}"
|
bin="${OPENCODE2_BIN:-/opt/homebrew/opt/opencode/bin/opencode}"
|
||||||
@@ -8,7 +8,7 @@ cfg="${OPENCODE_CONFIG:-$HOME/.config/opencode2/opencode.json}"
|
|||||||
|
|
||||||
if [ ! -x "$bin" ]; then
|
if [ ! -x "$bin" ]; then
|
||||||
echo "oc2: stable opencode not installed. Rebuild, or run:" >&2
|
echo "oc2: stable opencode not installed. Rebuild, or run:" >&2
|
||||||
echo " brew install opencode && brew unlink opencode" >&2
|
echo " brew install opencode" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ ! -e "$cfg" ]; then
|
if [ ! -e "$cfg" ]; then
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ The firstmate crew dispatch + Gitea PR helper are wired by `darwin-rebuild`, but
|
|||||||
cd ~/Documents/investor-flow
|
cd ~/Documents/investor-flow
|
||||||
git remote set-url origin http://unraid.local:3003/transnet/investor-flow
|
git remote set-url origin http://unraid.local:3003/transnet/investor-flow
|
||||||
|
|
||||||
Verify: `fm` launches Pi as the first mate (accept project trust once); `oc2 --version` prints an OpenCode 2 version; `pi --list-models mimo` shows `opencode-go/mimo-v2.5-pro`; `tea pulls list --repo transnet/investor-flow` works.
|
Verify: `fm` launches Pi as the first mate (accept project trust once); `oc2 --version` prints the Homebrew opencode version; `pi --list-models mimo` shows `opencode-go/mimo-v2.5-pro`; `tea pulls list --repo transnet/investor-flow` works.
|
||||||
|
|
||||||
## security-audit skill (agent security reviews)
|
## security-audit skill (agent security reviews)
|
||||||
|
|
||||||
|
|||||||
+28
-31
@@ -1,9 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Rebuild nix-darwin + home-manager. Rotates stale home-manager *.backup files
|
# Rebuild nix-darwin + home-manager. Rotates stale home-manager *.backup files
|
||||||
# so a second switch never fails with "would be clobbered".
|
# so a second switch never fails with "would be clobbered".
|
||||||
# Also updates flake inputs, upgrades grok-build, installs OpenCode 1.x
|
# Also updates flake inputs, upgrades grok-build, removes retired npm OpenCode
|
||||||
# (stable CLI for free-tier), removes the retired OpenCode 2 npm beta, updates
|
# packages, updates no-mistakes, and updates pi extensions.
|
||||||
# no-mistakes, and updates pi extensions.
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
ln -sfn "$DIR" ~/.dotfiles
|
ln -sfn "$DIR" ~/.dotfiles
|
||||||
@@ -17,36 +16,34 @@ else
|
|||||||
echo "==> WARNING: grok-build upgrade failed (network issue). Skipping."
|
echo "==> WARNING: grok-build upgrade failed (network issue). Skipping."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install OpenCode 1.x (stable CLI, binary "opencode") if absent.
|
# Remove retired npm OpenCode installs if an older rebuild installed them:
|
||||||
# Required for free-tier models; OpenCode 2 is the separate stable `oc2` build.
|
# the `@opencode-ai/cli` beta and the older `opencode-ai` CLI. The Homebrew
|
||||||
# Uses Homebrew's npm (not Nix's npm) to avoid EACCES on the store.
|
# `opencode` formula declared in configuration.nix is now the only OpenCode
|
||||||
# Skip if npm is unavailable (e.g., network issues preventing fetch).
|
# install, unpinned so it tracks the latest release. The guard is a local check
|
||||||
OPENCODE_BIN=/opt/homebrew/bin/opencode
|
# for npm, so a rebuild without npm skips this instead of failing.
|
||||||
if [ ! -x "$OPENCODE_BIN" ]; then
|
|
||||||
echo "==> Installing OpenCode 1.x (stable) via Homebrew npm..."
|
|
||||||
if /opt/homebrew/bin/npm install -g --allow-scripts=opencode-ai opencode-ai@1.18 2>&1; then
|
|
||||||
echo "==> OpenCode 1.x installed successfully"
|
|
||||||
else
|
|
||||||
echo "==> WARNING: OpenCode 1.x installation failed (network issue). Skipping."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "==> OpenCode 1.x already installed: $(${OPENCODE_BIN} --version)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the retired OpenCode 2 beta (@opencode-ai/cli, binary "opencode2") if
|
|
||||||
# an older rebuild installed it. The stable Homebrew `opencode` formula declared
|
|
||||||
# in configuration.nix is now the only OpenCode 2 install. Local check only, so
|
|
||||||
# an offline rebuild skips this instead of failing.
|
|
||||||
NPM=/opt/homebrew/bin/npm
|
NPM=/opt/homebrew/bin/npm
|
||||||
if [ -x "$NPM" ] && beta_root="$("$NPM" root -g 2>/dev/null)" && [ -d "$beta_root/@opencode-ai/cli" ]; then
|
if [ -x "$NPM" ] && npm_root="$("$NPM" root -g 2>/dev/null)"; then
|
||||||
echo "==> Removing retired OpenCode 2 beta (@opencode-ai/cli)..."
|
for pkg in @opencode-ai/cli opencode-ai; do
|
||||||
if "$NPM" uninstall -g @opencode-ai/cli 2>&1; then
|
if [ -d "$npm_root/$pkg" ]; then
|
||||||
echo "==> OpenCode 2 beta removed"
|
if "$NPM" uninstall -g "$pkg" >/dev/null 2>&1; then
|
||||||
else
|
echo "==> Removed retired npm package $pkg"
|
||||||
echo "==> WARNING: OpenCode 2 beta removal failed. Remove it manually:"
|
else
|
||||||
echo " $NPM uninstall -g @opencode-ai/cli"
|
echo "==> WARNING: $pkg removal failed. Remove it manually: $NPM uninstall -g $pkg"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
# `opencode` links without --overwrite, so any npm shim left in the Homebrew
|
||||||
|
# prefix aborts the switch's brew bundle link step. Drop the retired packages'
|
||||||
|
# shims directly, which also covers a failed uninstall and a missing npm.
|
||||||
|
for link in /opt/homebrew/bin/*; do
|
||||||
|
case "$(readlink "$link" 2>/dev/null || true)" in
|
||||||
|
*/node_modules/@opencode-ai/cli/* | */node_modules/opencode-ai/*)
|
||||||
|
rm -f "$link"
|
||||||
|
echo "==> Removed stale OpenCode npm shim $link"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo "==> Updating no-mistakes..."
|
echo "==> Updating no-mistakes..."
|
||||||
NO_MISTAKES_BIN="$HOME/.no-mistakes/bin/no-mistakes"
|
NO_MISTAKES_BIN="$HOME/.no-mistakes/bin/no-mistakes"
|
||||||
|
|||||||
Reference in new issue
Block a user