Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e0bc81e85 | ||
|
|
1f13c6eb1a | ||
|
|
d61193561f | ||
|
|
65adb4cceb | ||
|
|
258dc2afa1 | ||
|
|
03e872eebc |
No files matched your search
@@ -6,7 +6,8 @@ Deliberate decisions in this repo - do NOT silently revert them:
|
|||||||
- Agent configs under `home/` are the source of truth. `home.nix` installs them with `mkOutOfStoreSymlink` + `force = true`, so edits to files in `home/` apply live after the first rebuild that creates the symlink. Prefer editing those paths, not the live `~/.claude` / `~/.grok` / `~/.pi` copies. `rebuild.sh` rotates stale `*.backup` files before switch so home-manager never fails with "would be clobbered".
|
- Agent configs under `home/` are the source of truth. `home.nix` installs them with `mkOutOfStoreSymlink` + `force = true`, so edits to files in `home/` apply live after the first rebuild that creates the symlink. Prefer editing those paths, not the live `~/.claude` / `~/.grok` / `~/.pi` copies. `rebuild.sh` rotates stale `*.backup` files before switch so home-manager never fails with "would be clobbered".
|
||||||
- Grok Build is first-class here: `home/.grok/config.toml` and `home/AGENTS.md` (linked as `~/.grok/AGENTS.md`). Claude, Codex, opencode, and Pi share the same `home/AGENTS.md` for multi-agent work.
|
- Grok Build is first-class here: `home/.grok/config.toml` and `home/AGENTS.md` (linked as `~/.grok/AGENTS.md`). Claude, Codex, opencode, and Pi share the same `home/AGENTS.md` for multi-agent work.
|
||||||
- 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.
|
||||||
- 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=pi` only when those files are absent. Launch with shell alias `fm` (`cd` + OpenCode 2 via `~/.local/bin/oc2`). Self-update via `/updatefirstmate`, not rebuild.
|
- 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. Launch with shell alias `fm` (`cd` + OpenCode 2 via `~/.local/bin/oc2`). Self-update via `/updatefirstmate`, not rebuild.
|
||||||
- OpenCode 2 is the firstmate primary. It is not a Homebrew formula: install `@opencode-ai/cli@beta` with Homebrew's npm (`home.activation.opencode2`). Launch through `home/bin/oc2` so `OPENCODE_CONFIG` stays at `home/.config/opencode2/opencode.json` and cannot rewrite OpenCode 1.x's `~/.config/opencode`. Do not add a brew `opencode` / `opencode2` formula; `zap` would fight the npm install. firstmate harness detection matches `*opencode*`, so the `opencode2` process name still classifies as OpenCode.
|
- OpenCode 2 is the firstmate primary. It is not a Homebrew formula: install `@opencode-ai/cli@beta` with Homebrew's npm (`home.activation.opencode2`). Launch through `home/bin/oc2` so `OPENCODE_CONFIG` stays at `home/.config/opencode2/opencode.json` and cannot rewrite OpenCode 1.x's `~/.config/opencode`. Do not add a brew `opencode` / `opencode2` formula; `zap` would fight the npm install. firstmate harness detection matches `*opencode*`, so the `opencode2` process name still classifies as OpenCode.
|
||||||
- Shell aliases: `cc` (Claude skip-permissions), `co` (Codex full-auto), `gb` (Grok --yolo), `fm` (firstmate via OpenCode 2), `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 OpenCode 2), `oc2` (OpenCode 2, isolated). They are intentional high-agency shortcuts.
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
"treehouse"
|
"treehouse"
|
||||||
];
|
];
|
||||||
casks = [
|
casks = [
|
||||||
|
# Codex desktop home: the standalone Codex.app was folded into the ChatGPT
|
||||||
|
# app (2026-07); the deprecated `codex-app` cask must not be used.
|
||||||
|
"chatgpt"
|
||||||
|
"codex" # Codex CLI; shares ~/.codex/config.toml with the desktop app
|
||||||
"docker-desktop"
|
"docker-desktop"
|
||||||
"grok-build"
|
"grok-build"
|
||||||
"puremac"
|
"puremac"
|
||||||
|
|||||||
@@ -107,6 +107,21 @@ in
|
|||||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md";
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md";
|
||||||
force = true;
|
force = true;
|
||||||
};
|
};
|
||||||
|
# Codex provider routing -> OpenCode Go. ~/.codex/config.toml is deliberately
|
||||||
|
# NOT symlinked: the ChatGPT desktop app owns and rewrites that file. The repo
|
||||||
|
# fragment home/.codex/config.toml is merged into it by
|
||||||
|
# home.activation.codexOpenCodeGo instead. The provider's command-backed auth
|
||||||
|
# runs this helper, which reads the key from the opencode store.
|
||||||
|
home.file.".local/bin/opencode-go-token" = {
|
||||||
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/bin/opencode-go-token";
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
|
# Codex 0.160+ profiles live in $CODEX_HOME/<name>.config.toml. The app does not
|
||||||
|
# touch these, so they can be symlinked normally.
|
||||||
|
home.file.".codex/luna.config.toml" = {
|
||||||
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.codex/luna.config.toml";
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
home.file.".config/opencode/AGENTS.md" = {
|
home.file.".config/opencode/AGENTS.md" = {
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md";
|
source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md";
|
||||||
force = true;
|
force = true;
|
||||||
@@ -246,6 +261,19 @@ in
|
|||||||
ln -sfn "${dotfiles}/home/bin/sync-music" "$HOME/.local/bin/sync-music"
|
ln -sfn "${dotfiles}/home/bin/sync-music" "$HOME/.local/bin/sync-music"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Codex (desktop app + CLI) -> OpenCode Go. The ChatGPT app owns and rewrites
|
||||||
|
# ~/.codex/config.toml, so it must not be a symlink into the repo. Merge the
|
||||||
|
# repo fragment into the live file on every activation instead; the app's own
|
||||||
|
# sections survive. See home/bin/codex-opencode-go-sync.
|
||||||
|
home.activation.codexOpenCodeGo = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
set -euo pipefail
|
||||||
|
mkdir -p "$HOME/.codex"
|
||||||
|
${pkgs.python3.withPackages (ps: [ ps.tomlkit ])}/bin/python3 \
|
||||||
|
"${dotfiles}/home/bin/codex-opencode-go-sync" \
|
||||||
|
"${dotfiles}/home/.codex/config.toml" \
|
||||||
|
"$HOME/.codex/config.toml"
|
||||||
|
'';
|
||||||
|
|
||||||
# OpenCode 2 is not on Homebrew (beta). Install via Homebrew's npm, never
|
# OpenCode 2 is not on Homebrew (beta). Install via Homebrew's npm, never
|
||||||
# Nix's npm (EACCES on the store). Skip when already present so a rebuild
|
# Nix's npm (EACCES on the store). Skip when already present so a rebuild
|
||||||
# does not pull a new beta under a live TUI.
|
# does not pull a new beta under a live TUI.
|
||||||
@@ -293,8 +321,10 @@ in
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
# kunchenguid/no-mistakes gate (git push no-mistakes) - declarative install + daemon + global config
|
# kunchenguid/no-mistakes gate (git push no-mistakes) - declarative install + daemon + global config
|
||||||
# Uses OpenCode only for pipeline steps (the opencode-go subscription), by the
|
# Uses Pi for pipeline steps (the opencode-go subscription), by the captain's
|
||||||
# captain's decision. Binary lives in ~/.no-mistakes/bin
|
# decision: Pi is a neutralization-capable gate agent, which opencode is not, so
|
||||||
|
# it is required to run the gate in firstmate's own checkout. Binary lives in
|
||||||
|
# ~/.no-mistakes/bin
|
||||||
# with symlink ~/.local/bin/no-mistakes (installer default). Do NOT npm install -g no-mistakes
|
# with symlink ~/.local/bin/no-mistakes (installer default). Do NOT npm install -g no-mistakes
|
||||||
# - that npm name is jonathanong's static-analysis tool (shadowing bug fixed 2026-09-21).
|
# - that npm name is jonathanong's static-analysis tool (shadowing bug fixed 2026-09-21).
|
||||||
home.activation.noMistakes = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.activation.noMistakes = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
@@ -308,22 +338,15 @@ in
|
|||||||
fi
|
fi
|
||||||
curl -fsSL https://raw.githubusercontent.com/kunchenguid/no-mistakes/main/docs/install.sh | sh
|
curl -fsSL https://raw.githubusercontent.com/kunchenguid/no-mistakes/main/docs/install.sh | sh
|
||||||
fi
|
fi
|
||||||
# Ensure global config selects OpenCode (idempotent - only writes if missing or still `agent: auto`)
|
# Ensure global config uses Pi (idempotent - only writes if missing or still `agent: auto`)
|
||||||
cfg="$HOME/.no-mistakes/config.yaml"
|
cfg="$HOME/.no-mistakes/config.yaml"
|
||||||
if [ -f "$cfg" ] && grep -qE '^\s*agent:\s*auto\s*$' "$cfg"; then
|
if [ -f "$cfg" ] && grep -qE '^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$' "$cfg"; then
|
||||||
tmp="$(mktemp)"
|
tmp="$(mktemp)"
|
||||||
awk '
|
sed 's|^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$|# Managed by dotfiles/home.nix home.activation.noMistakes\nagent: [pi]|' "$cfg" > "$tmp" && mv "$tmp" "$cfg"
|
||||||
/^\s*agent:\s*auto\s*$/ {
|
|
||||||
print "# Managed by dotfiles/home.nix home.activation.noMistakes";
|
|
||||||
print "agent: [opencode]";
|
|
||||||
next
|
|
||||||
}
|
|
||||||
{ print }
|
|
||||||
' "$cfg" > "$tmp" && mv "$tmp" "$cfg"
|
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$cfg" ]; then
|
if [ ! -f "$cfg" ]; then
|
||||||
mkdir -p "$(dirname "$cfg")"
|
mkdir -p "$(dirname "$cfg")"
|
||||||
printf 'agent: [opencode]\n' > "$cfg"
|
printf 'agent: [pi]\n' > "$cfg"
|
||||||
fi
|
fi
|
||||||
# Ensure daemon running (launchd on macOS)
|
# Ensure daemon running (launchd on macOS)
|
||||||
"$bin" daemon restart >/dev/null 2>&1 || "$bin" daemon start >/dev/null 2>&1 || true
|
"$bin" daemon restart >/dev/null 2>&1 || "$bin" daemon start >/dev/null 2>&1 || true
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Codex -> OpenCode Go subscription (fragment, NOT the live config).
|
||||||
|
#
|
||||||
|
# The ChatGPT desktop app owns and rewrites ~/.codex/config.toml, so home-manager
|
||||||
|
# must not symlink this file into place. Instead
|
||||||
|
# home.activation.codexOpenCodeGo merges the keys below into the live file on
|
||||||
|
# every rebuild (home/bin/codex-opencode-go-sync). The app's own sections
|
||||||
|
# ([desktop], [plugins], [mcp_servers], [marketplaces], ...) are preserved.
|
||||||
|
#
|
||||||
|
# No secret lives here. Auth is command-backed: the provider runs
|
||||||
|
# ~/.local/bin/opencode-go-token, which prints the key from the opencode auth
|
||||||
|
# store. That leaves ~/.codex/auth.json in ChatGPT mode, so the ChatGPT app and
|
||||||
|
# the Go subscription coexist in the same Codex install.
|
||||||
|
#
|
||||||
|
# Only models Go serves over the Responses API work here. Verified 2026-10-03:
|
||||||
|
# deepseek-v4.1-flash, gpt-6-luna, gpt-5.6-luna, grok-4.7, grok-4.6.
|
||||||
|
model = "deepseek-v4.1-flash"
|
||||||
|
model_provider = "opencode-go"
|
||||||
|
|
||||||
|
# Switch models with `codex --profile luna` (settings in luna.config.toml; Codex
|
||||||
|
# 0.160+ no longer accepts a [profiles.*] table here).
|
||||||
|
[model_providers.opencode-go]
|
||||||
|
name = "OpenCode Go"
|
||||||
|
base_url = "https://opencode.ai/zen/go/v1"
|
||||||
|
wire_api = "responses" # Codex only supports the Responses API
|
||||||
|
|
||||||
|
[model_providers.opencode-go.auth]
|
||||||
|
command = "/Users/laptran/.local/bin/opencode-go-token"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Codex profile: gpt-6-luna on OpenCode Go.
|
||||||
|
#
|
||||||
|
# Codex 0.160+ reads profiles from $CODEX_HOME/<name>.config.toml, so this file
|
||||||
|
# is symlinked in as ~/.codex/luna.config.toml. Select it with
|
||||||
|
# `codex --profile luna` (or `codex --profile luna exec ...`).
|
||||||
|
model = "gpt-6-luna"
|
||||||
|
model_provider = "opencode-go"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"lastChangelogVersion": "0.84.1",
|
"lastChangelogVersion": "0.87.1",
|
||||||
"theme": "rose-pine-moon",
|
"theme": "rose-pine-moon",
|
||||||
"defaultProvider": "omlx",
|
"defaultProvider": "opencode-go",
|
||||||
"defaultModel": "qwen3.6-35b",
|
"defaultModel": "deepseek-v4.1-flash",
|
||||||
"models": [
|
"models": [
|
||||||
{
|
{
|
||||||
"name": "Qwen 3.6 35B (o4-mtp)",
|
"name": "Qwen 3.6 35B (o4-mtp)",
|
||||||
|
|||||||
Executable
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Reconcile the OpenCode Go fragment into Codex's live config.
|
||||||
|
|
||||||
|
Codex (the ChatGPT desktop app and the CLI) both read ~/.codex/config.toml, and
|
||||||
|
the ChatGPT app owns and rewrites that file. So home-manager must not symlink it.
|
||||||
|
Instead this script merges the repo fragment (argv[1]) into the live file
|
||||||
|
(argv[2]) on every activation:
|
||||||
|
|
||||||
|
* only the keys the fragment defines are forced (fragment wins),
|
||||||
|
* the whole model_providers.opencode-go table is replaced, so stale keys such
|
||||||
|
as a previous `requires_openai_auth = true` are dropped,
|
||||||
|
* everything the app wrote itself ([desktop], [plugins], [mcp_servers],
|
||||||
|
[marketplaces], ...) is preserved.
|
||||||
|
|
||||||
|
Run with a Python that has tomlkit (home.activation.codexOpenCodeGo does).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import tomlkit
|
||||||
|
|
||||||
|
|
||||||
|
def _table(doc, key):
|
||||||
|
if key not in doc:
|
||||||
|
doc[key] = tomlkit.table()
|
||||||
|
return doc[key]
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
fragment_path, live_path = sys.argv[1], sys.argv[2]
|
||||||
|
|
||||||
|
with open(fragment_path) as fh:
|
||||||
|
fragment = tomlkit.parse(fh.read())
|
||||||
|
|
||||||
|
if os.path.exists(live_path):
|
||||||
|
with open(live_path) as fh:
|
||||||
|
live = tomlkit.parse(fh.read())
|
||||||
|
else:
|
||||||
|
live = tomlkit.document()
|
||||||
|
|
||||||
|
# Root keys the fragment owns.
|
||||||
|
for key in ("model", "model_provider"):
|
||||||
|
if key in fragment:
|
||||||
|
live[key] = fragment[key]
|
||||||
|
|
||||||
|
# Replace the fragment provider tables wholesale (drops stale keys).
|
||||||
|
incoming = fragment.get("model_providers") or {}
|
||||||
|
target = _table(live, "model_providers")
|
||||||
|
for name, table in incoming.items():
|
||||||
|
target[name] = copy.deepcopy(table)
|
||||||
|
|
||||||
|
# Codex 0.160+ rejects the legacy [profiles.*] table; profiles now live in
|
||||||
|
# $CODEX_HOME/<name>.config.toml. Drop one if an older config left it behind.
|
||||||
|
if "profiles" in live:
|
||||||
|
del live["profiles"]
|
||||||
|
|
||||||
|
with open(live_path, "w") as fh:
|
||||||
|
fh.write(tomlkit.dumps(live))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Print the OpenCode Go API key on stdout.
|
||||||
|
#
|
||||||
|
# Codex uses this as its command-backed provider auth
|
||||||
|
# ([model_providers.opencode-go.auth].command). That keeps ~/.codex/auth.json
|
||||||
|
# untouched in ChatGPT mode, so the ChatGPT desktop app and the OpenCode Go
|
||||||
|
# subscription coexist in the same Codex install. The key is never committed; it
|
||||||
|
# is read live from the opencode auth store (the same source oc2 and Hermes use).
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
auth="${XDG_DATA_HOME:-$HOME/.local/share}/opencode/auth.json"
|
||||||
|
py="$(command -v python3 || true)"
|
||||||
|
if [ -z "$py" ]; then
|
||||||
|
py=/usr/bin/python3
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$py" -c 'import json, sys; print(json.load(open(sys.argv[1]))["opencode-go"]["key"])' "$auth"
|
||||||
@@ -39,11 +39,13 @@ managed=(
|
|||||||
"$HOME/.claude/settings.json"
|
"$HOME/.claude/settings.json"
|
||||||
"$HOME/.claude/CLAUDE.md"
|
"$HOME/.claude/CLAUDE.md"
|
||||||
"$HOME/.codex/AGENTS.md"
|
"$HOME/.codex/AGENTS.md"
|
||||||
|
"$HOME/.codex/luna.config.toml"
|
||||||
"$HOME/.config/opencode/AGENTS.md"
|
"$HOME/.config/opencode/AGENTS.md"
|
||||||
"$HOME/.config/opencode/opencode.json"
|
"$HOME/.config/opencode/opencode.json"
|
||||||
"$HOME/.config/opencode2/opencode.json"
|
"$HOME/.config/opencode2/opencode.json"
|
||||||
"$HOME/.config/opencode2/AGENTS.md"
|
"$HOME/.config/opencode2/AGENTS.md"
|
||||||
"$HOME/.local/bin/oc2"
|
"$HOME/.local/bin/oc2"
|
||||||
|
"$HOME/.local/bin/opencode-go-token"
|
||||||
"$HOME/.pi/agent/settings.json"
|
"$HOME/.pi/agent/settings.json"
|
||||||
"$HOME/.pi/agent/models.json"
|
"$HOME/.pi/agent/models.json"
|
||||||
"$HOME/.pi/agent/AGENTS.md"
|
"$HOME/.pi/agent/AGENTS.md"
|
||||||
|
|||||||
Reference in new issue
Block a user