Merge pull request 'Add security-audit skill install and restore paid Go crew dispatch' (#9) from fm/dotfiles-security-audit-skill into main

This commit was merged in pull request #9.
This commit is contained in:
hermes committed 2026-10-24 20:45:55 -04:00
commit d01d13ff1c
4 files changed
+81 -14

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ 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.
- 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.
- 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-20, every coding crewmate and scout uses `opencode` + `opencode/deepseek-v4.1-flash-free` through the OpenCode CLI, because the paid Go subscription was close to emptying its monthly window. The validation pipeline stays on Pi with `opencode-go/deepseek-v4.1-flash` steps and the `opencode-go/glm-5.3-flash` reviewer. The free tier rate-limits under heavy parallel work, so a stalled worker falls back to the paid Go model only on the captain's word. 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` + OpenCode 2 via `~/.local/bin/oc2`); the primary stays OpenCode 2, only crews run on the opencode harness. 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, every coding crewmate and scout uses `opencode` + `opencode-go/deepseek-v4.1-flash` through the OpenCode CLI. 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` + OpenCode 2 via `~/.local/bin/oc2`); the primary stays OpenCode 2, only crews run on the opencode harness. 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.
- 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.
- 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.
+53 -8
View File
@@ -317,19 +317,20 @@ in
# 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
# does not pull a new beta under a live TUI.
# does not pull a new beta under a live TUI. Activation blocks are inlined
# into one flat script, so never `exit 0` here: that would skip every later
# block (securityAuditSkill, setupLaunchAgents, syncMusic).
home.activation.opencode2 = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
npm=/opt/homebrew/bin/npm
bin=/opt/homebrew/bin/opencode2
if [ -x "$bin" ]; then
exit 0
if [ ! -x "$bin" ]; then
if [ ! -x "$npm" ]; then
echo "opencode2: /opt/homebrew/bin/npm missing (declare node in homebrew.brews)" >&2
exit 1
fi
"$npm" install -g --allow-scripts=@opencode-ai/cli @opencode-ai/cli@beta
fi
if [ ! -x "$npm" ]; then
echo "opencode2: /opt/homebrew/bin/npm missing (declare node in homebrew.brews)" >&2
exit 1
fi
"$npm" install -g --allow-scripts=@opencode-ai/cli @opencode-ai/cli@beta
'';
# backpass (kunchenguid/backpass) - gradient descent for agent memory: reads
@@ -402,6 +403,50 @@ in
"$bin" daemon restart >/dev/null 2>&1 || "$bin" daemon start >/dev/null 2>&1 || true
'';
# cloudflare/security-audit - vulnerability-hunting skill for the coding agents.
# Installed by the upstream Skills CLI through Homebrew's npx, because the skill
# is a multi-file bundle and an upstream refresh must stay byte-identical.
# Scope: the CLI's "universal" target is ~/.agents/skills, which Codex, Pi, and
# OpenCode read as a user-level skill directory; Claude Code reads
# ~/.claude/skills, so the CLI also links the skill there. Grok Build is out of
# scope for this install: its skill directory is ~/.grok/skills, and the CLI
# only populates it when `grok` is named in --agent. Never target
# ~/.config/opencode/skills: home-manager owns that path with force = true and
# mkOutOfStoreSymlink into the mutable dotfiles checkout, so a rebuild would
# clobber the CLI's link and CLI writes would land in the git checkout. Skip
# when installed, like opencode2/backpass, so a rebuild never pulls a new skill
# version mid-session. The skill's own README still requires an OS-enforced
# sandbox before it may run target-controlled builds, tests, browsers, or
# fuzzers; this machine has none, so those leads stay `needs_validation`.
# Install and refresh commands, plus the sandbox note, are in readme.md.
home.activation.securityAuditSkill = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
# Activation PATH lacks /opt/homebrew/bin, so npx's `#!/usr/bin/env node`
# shebang fails. Prepend only - replacing PATH breaks the rest of the HM
# activation (nix-env, gettext).
export PATH="/opt/homebrew/bin:$PATH"
npx=/opt/homebrew/bin/npx
# Canonical copy plus the Claude Code link: rerun when either is missing so a
# half-removed install heals, then skip while both exist. No `exit 0` here:
# activation blocks are inlined into one flat script, and later blocks must
# still run.
if [ ! -f "$HOME/.agents/skills/security-audit/SKILL.md" ] \
|| [ ! -e "$HOME/.claude/skills/security-audit" ]; then
if [ ! -x "$npx" ]; then
echo "securityAuditSkill: /opt/homebrew/bin/npx missing (declare node in homebrew.brews)" >&2
exit 1
fi
# A rebuild must not fail when GitHub or npm is unreachable: the skill is an
# enhancement, so warn and keep the rest of the switch going.
if ! "$npx" --yes skills add https://github.com/cloudflare/security-audit-skill \
--skill security-audit --global \
--agent claude-code codex pi opencode --yes; then
echo "securityAuditSkill: WARNING: skill install failed (network or Skills CLI unavailable); rebuild continues." >&2
echo "securityAuditSkill: rerun ./rebuild.sh or install manually with the command in readme.md." >&2
fi
fi
'';
# OpenSuperWhisper - local voice-first prompting (cask in configuration.nix).
# The app reads its model from its own Application Support directory, so the
# 1.6 GB Whisper model is downloaded here once and kept outside the Nix store.
+5 -5
View File
@@ -5,18 +5,18 @@
"use": [
{
"harness": "opencode",
"model": "opencode/deepseek-v4.1-flash-free",
"provider": "opencode"
"model": "opencode-go/deepseek-v4.1-flash",
"provider": "opencode-go"
}
],
"why": "Captain's order 2026-10-20: every coding crewmate and scout runs DeepSeek V4.1 Flash Free through the OpenCode CLI, which answers this model (verified with a one-shot probe the same day). The paid Go subscription was at 6 percent of its monthly window and projected to empty the next evening. The validation pipeline stays on Pi with paid deepseek-v4.1-flash and the glm-5.3-flash reviewer. Known risk: the free tier rate-limits under heavy parallel work, so a stalled worker falls back to the paid Go model on the captain's word."
"why": "Captain's order 2026-10-21: paid Go for every crewmate and scout after the free lane hit 'Free usage exceeded' with a 10.5 hour retry, which ended five sessions in forty minutes. The free deepseek-v4.1-flash-free order of 2026-10-20 resumes when that lane resets; paid Go had 5 percent of its monthly window left, projected empty 2026-10-22T05:43Z."
}
],
"default": [
{
"harness": "opencode",
"model": "opencode/deepseek-v4.1-flash-free",
"provider": "opencode"
"model": "opencode-go/deepseek-v4.1-flash",
"provider": "opencode-go"
}
]
}
+22
View File
@@ -15,6 +15,28 @@ The firstmate crew dispatch + Gitea PR helper are wired by `darwin-rebuild`, but
Verify: `fm` launches OpenCode 2 as the first mate (isolated `~/.config/opencode2`); `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.
## security-audit skill (agent security reviews)
`home.activation.securityAuditSkill` installs Cloudflare's `security-audit` skill from `https://github.com/cloudflare/security-audit-skill` so the coding agents can run a structured vulnerability audit. The exact command:
```bash
/opt/homebrew/bin/npx --yes skills add https://github.com/cloudflare/security-audit-skill \
--skill security-audit --global \
--agent claude-code codex pi opencode --yes
```
The install needs Homebrew's `node`, which `configuration.nix` already declares. Renew or update the skill by hand with:
```bash
/opt/homebrew/bin/npx --yes skills update security-audit --global --yes
```
Agent scope: the Skills CLI installs the bundle once under `~/.agents/skills/security-audit`, the universal user-level directory that Codex, Pi, and OpenCode read, and it links that directory into `~/.claude/skills` for Claude Code. Grok Build is out of scope for this install: its skill directory is `~/.grok/skills`, and the CLI only populates it when `grok` is named in `--agent`. The install leaves `~/.config/opencode/skills` alone because home-manager owns that path with `force = true` and `mkOutOfStoreSymlink` into the mutable dotfiles checkout: a rebuild would clobber the CLI's link, and CLI writes would land in the git checkout. That is why the install uses the shared directory instead.
The activation is idempotent and non-interactive: it skips the install when both the canonical copy and the Claude Code link exist, and a failed download only warns so the rebuild still completes. Trigger it in an agent with "security audit this codebase".
Sandbox limitation: the skill's README requires an OS-enforced sandbox (no external network, sanitized environment, resource limits, scratch-only writes) before it may run target-controlled builds, tests, browser automation, emulators, fuzzers, or fixtures. This Nix setup installs the skill only and creates no sandbox. Without one, the workflow keeps such leads as `needs_validation` rather than executing target code.
## OpenSuperWhisper (local voice input)
Hold a shortcut, speak, release, and the transcript pastes into the focused app. Everything runs on the Mac: no audio or transcript leaves the machine.