feat(agents): switch to opencode2, drop oh-my-openagent, add paperclip
- opencode.nix: configure programs.opencode directly for OpenCode 2 (package llm-agents.opencode2, v2.0.16). v2 reads opencode.json and normalizes the v1 config format internally, so provider/permission/ formatter keys stay valid. The m3ta-nixpkgs coding.opencode wrapper (v1-only, hardcodes oh-my-openagent) is no longer used. - remove oh-my-openagent plugin and ohMyOpencodeSettings model matrix - drop programs.opencode.tui: v2 owns cli.json at runtime and would re-import a managed tui.json into it on every start, clobbering runtime prefs - agents.nix: opencode-desktop -> llm-agents.opencode2-desktop (2.0.16), add llm-agents.paperclip (control plane for AI agent teams) - rofi: terminalCommand opencode2 %a
This commit is contained in:
1 parent
5e90261036
commit
4ef99db31d
3 files changed
+223
-244
No files matched your search
@@ -201,7 +201,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
terminal = pkgs.ghostty;
|
terminal = pkgs.ghostty;
|
||||||
terminalCommand = "opencode %a";
|
terminalCommand = "opencode2 %a";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -80,10 +80,11 @@
|
|||||||
vulkanSupport = videoDrivers == ["amdgpu"];
|
vulkanSupport = videoDrivers == ["amdgpu"];
|
||||||
cudaSupport = videoDrivers == ["nvidia"];
|
cudaSupport = videoDrivers == ["nvidia"];
|
||||||
})
|
})
|
||||||
opencode-desktop
|
llm-agents.opencode2-desktop
|
||||||
openshell
|
openshell
|
||||||
llm-agents.openspec
|
llm-agents.openspec
|
||||||
openwork
|
openwork
|
||||||
|
llm-agents.paperclip
|
||||||
talk
|
talk
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,257 +1,235 @@
|
|||||||
{lib, ...}: {
|
# OpenCode 2 (TUI) configuration.
|
||||||
coding.opencode = {
|
#
|
||||||
|
# v2 (pkgs.llm-agents.opencode2) reads ~/.config/opencode/opencode.json and
|
||||||
|
# normalizes the v1 config format internally: provider/permission/formatter
|
||||||
|
# keys written below are migrated on load, so the v1-style schema stays valid.
|
||||||
|
#
|
||||||
|
# TUI preferences live in cli.json, which v2 owns at runtime:
|
||||||
|
# - do NOT manage cli.json here (home-manager symlinks would break v2's
|
||||||
|
# runtime writes), and
|
||||||
|
# - do NOT set programs.opencode.tui (tui.json is a legacy source that v2
|
||||||
|
# re-imports into cli.json on every start, clobbering runtime prefs).
|
||||||
|
#
|
||||||
|
# The m3ta-nixpkgs `coding.opencode` wrapper is intentionally NOT used: it is
|
||||||
|
# v1-only (hardcodes the oh-my-openagent plugin and oh-my-openagent.json).
|
||||||
|
{pkgs, ...}: {
|
||||||
|
programs.opencode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
enableMcpIntegration = true;
|
||||||
|
package = pkgs.llm-agents.opencode2;
|
||||||
|
|
||||||
ohMyOpencodeSettings = {
|
settings = {
|
||||||
agents = {
|
formatter = {
|
||||||
# Primary worker: GLM-5.3 (1M ctx, beats Opus 4.8 on token efficiency).
|
alejandra = {
|
||||||
sisyphus.model = "zai-coding-plan/glm-5.3";
|
command = ["alejandra" "-q" "-"];
|
||||||
# Planning + deep analysis: strongest reasoning tier.
|
extensions = [".nix"];
|
||||||
prometheus.model = "litellm/claude-opus-4-8";
|
};
|
||||||
metis.model = "litellm/claude-opus-4-8";
|
|
||||||
# Verification + docs research: best tool-use quality.
|
|
||||||
oracle.model = "litellm/claude-sonnet-5";
|
|
||||||
librarian.model = "litellm/claude-sonnet-5";
|
|
||||||
# High-volume parallel codebase scans: speed-tuned GLM on flat rate.
|
|
||||||
explore.model = "zai-coding-plan/glm-5-turbo";
|
|
||||||
# Vision: GLM-5.3 is text-only -> cheap capable Claude Haiku.
|
|
||||||
multimodal-looker.model = "litellm/claude-haiku-4-5";
|
|
||||||
# Critic + navigator: flagship GLM on flat rate.
|
|
||||||
momus.model = "zai-coding-plan/glm-5.3";
|
|
||||||
atlas.model = "zai-coding-plan/glm-5.3";
|
|
||||||
};
|
|
||||||
categories = {
|
|
||||||
# Volume categories -> flat-rate GLM-5.3 (1M ctx).
|
|
||||||
visual-engineering.model = "zai-coding-plan/glm-5.3";
|
|
||||||
artistry.model = "zai-coding-plan/glm-5.3";
|
|
||||||
writing.model = "zai-coding-plan/glm-5.3";
|
|
||||||
# Long deep-work sessions -> GLM-5.3 1M ctx beats Sonnet 200k.
|
|
||||||
deep.model = "zai-coding-plan/glm-5.3";
|
|
||||||
# Deliberately pay-per-token for top quality:
|
|
||||||
ultrabrain.model = "litellm/claude-opus-4-8";
|
|
||||||
unspecified-high.model = "litellm/claude-opus-4-8";
|
|
||||||
unspecified-low.model = "litellm/claude-sonnet-5";
|
|
||||||
quick.model = "litellm/claude-haiku-4-5";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Keep TUI settings in programs.opencode.tui to satisfy OpenCode v1.2.15+.
|
|
||||||
programs.opencode.tui.theme = "opencode";
|
|
||||||
|
|
||||||
# Override legacy default settings to avoid deprecated TUI keys in settings.
|
|
||||||
programs.opencode.settings = lib.mkForce {
|
|
||||||
plugin = ["oh-my-openagent"];
|
|
||||||
formatter = {
|
|
||||||
alejandra = {
|
|
||||||
command = ["alejandra" "-q" "-"];
|
|
||||||
extensions = [".nix"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Security: permission hardening for OpenCode
|
|
||||||
# Last matching rule wins. Glob patterns: * = any chars, ? = single char.
|
|
||||||
# ~ and $HOME are expanded to the user's home directory.
|
|
||||||
# external_directory gates paths outside the working directory.
|
|
||||||
permission = {
|
|
||||||
# External directory access: ask by default, allow safe paths
|
|
||||||
"external_directory" = {
|
|
||||||
"*" = "ask";
|
|
||||||
"/nix/store/**" = "allow";
|
|
||||||
"/tmp/**" = "allow";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Read access: allow by default, deny sensitive paths
|
# Security: permission hardening for OpenCode
|
||||||
"read" = {
|
# Last matching rule wins. Glob patterns: * = any chars, ? = single char.
|
||||||
"*" = "allow";
|
# ~ and $HOME are expanded to the user's home directory.
|
||||||
"~/.ssh/**" = "deny";
|
# external_directory gates paths outside the working directory.
|
||||||
"~/.gnupg/**" = "deny";
|
permission = {
|
||||||
"~/.aws/**" = "deny";
|
# External directory access: ask by default, allow safe paths
|
||||||
"~/.kube/**" = "deny";
|
"external_directory" = {
|
||||||
"~/.config/gh/**" = "deny";
|
"*" = "ask";
|
||||||
"~/.config/gcloud/**" = "deny";
|
"/nix/store/**" = "allow";
|
||||||
"~/.config/op/**" = "deny";
|
"/tmp/**" = "allow";
|
||||||
"~/.config/sops/**" = "deny";
|
};
|
||||||
"/run/agenix/**" = "deny";
|
|
||||||
"~/.pi/agent/auth.json" = "deny";
|
# Read access: allow by default, deny sensitive paths
|
||||||
"~/.pi/agent/sessions/**" = "deny";
|
"read" = {
|
||||||
"*.env" = "deny";
|
"*" = "allow";
|
||||||
"*.env.*" = "deny";
|
"~/.ssh/**" = "deny";
|
||||||
"*.pem" = "deny";
|
"~/.gnupg/**" = "deny";
|
||||||
"*.key" = "deny";
|
"~/.aws/**" = "deny";
|
||||||
"*.p12" = "deny";
|
"~/.kube/**" = "deny";
|
||||||
"*.pfx" = "deny";
|
"~/.config/gh/**" = "deny";
|
||||||
"*id_rsa*" = "deny";
|
"~/.config/gcloud/**" = "deny";
|
||||||
"*id_ed25519*" = "deny";
|
"~/.config/op/**" = "deny";
|
||||||
"*id_ecdsa*" = "deny";
|
"~/.config/sops/**" = "deny";
|
||||||
"*.example.env" = "allow";
|
"/run/agenix/**" = "deny";
|
||||||
"*.sample.env" = "allow";
|
"~/.pi/agent/auth.json" = "deny";
|
||||||
"*.test.env" = "allow";
|
"~/.pi/agent/sessions/**" = "deny";
|
||||||
".env.example" = "allow";
|
"*.env" = "deny";
|
||||||
".env.sample" = "allow";
|
"*.env.*" = "deny";
|
||||||
".env.test" = "allow";
|
"*.pem" = "deny";
|
||||||
"~/.ssh/*.pub" = "allow";
|
"*.key" = "deny";
|
||||||
"*.pub" = "allow";
|
"*.p12" = "deny";
|
||||||
"*.csr" = "allow";
|
"*.pfx" = "deny";
|
||||||
|
"*id_rsa*" = "deny";
|
||||||
|
"*id_ed25519*" = "deny";
|
||||||
|
"*id_ecdsa*" = "deny";
|
||||||
|
"*.example.env" = "allow";
|
||||||
|
"*.sample.env" = "allow";
|
||||||
|
"*.test.env" = "allow";
|
||||||
|
".env.example" = "allow";
|
||||||
|
".env.sample" = "allow";
|
||||||
|
".env.test" = "allow";
|
||||||
|
"~/.ssh/*.pub" = "allow";
|
||||||
|
"*.pub" = "allow";
|
||||||
|
"*.csr" = "allow";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Edit access: ask by default, deny sensitive paths
|
||||||
|
"edit" = {
|
||||||
|
"*" = "ask";
|
||||||
|
"~/.ssh/**" = "deny";
|
||||||
|
"~/.gnupg/**" = "deny";
|
||||||
|
"~/.aws/**" = "deny";
|
||||||
|
"~/.kube/**" = "deny";
|
||||||
|
"~/.config/gh/**" = "deny";
|
||||||
|
"~/.config/gcloud/**" = "deny";
|
||||||
|
"~/.config/op/**" = "deny";
|
||||||
|
"~/.config/sops/**" = "deny";
|
||||||
|
"/run/agenix/**" = "deny";
|
||||||
|
"~/.pi/agent/auth.json" = "deny";
|
||||||
|
"~/.pi/agent/sessions/**" = "deny";
|
||||||
|
"*.env" = "deny";
|
||||||
|
"*.env.*" = "deny";
|
||||||
|
"*.pem" = "deny";
|
||||||
|
"*.key" = "deny";
|
||||||
|
"*.p12" = "deny";
|
||||||
|
"*.pfx" = "deny";
|
||||||
|
"*id_rsa*" = "deny";
|
||||||
|
"*id_ed25519*" = "deny";
|
||||||
|
"*id_ecdsa*" = "deny";
|
||||||
|
"~/.ssh/*.pub" = "allow";
|
||||||
|
"*.pub" = "allow";
|
||||||
|
"*.csr" = "allow";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Glob patterns: same rules as read for file matching
|
||||||
|
"glob" = {
|
||||||
|
"*" = "allow";
|
||||||
|
"~/.ssh/**" = "deny";
|
||||||
|
"~/.gnupg/**" = "deny";
|
||||||
|
"/run/agenix/**" = "deny";
|
||||||
|
"*.env" = "deny";
|
||||||
|
"*.env.*" = "deny";
|
||||||
|
"*.pem" = "deny";
|
||||||
|
"*.key" = "deny";
|
||||||
|
"*.p12" = "deny";
|
||||||
|
"*.pfx" = "deny";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Grep: allow search, but deny searching for secrets
|
||||||
|
"grep" = {
|
||||||
|
"*" = "allow";
|
||||||
|
"~/.ssh/**" = "deny";
|
||||||
|
"~/.gnupg/**" = "deny";
|
||||||
|
"/run/agenix/**" = "deny";
|
||||||
|
"*PASSWORD*" = "ask";
|
||||||
|
"*SECRET*" = "ask";
|
||||||
|
"*API_KEY*" = "ask";
|
||||||
|
"*PRIVATE_KEY*" = "ask";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Bash: ask by default, deny dangerous and env-leak commands
|
||||||
|
"bash" = {
|
||||||
|
"*" = "ask";
|
||||||
|
"git status*" = "allow";
|
||||||
|
"git diff*" = "allow";
|
||||||
|
"git log*" = "allow";
|
||||||
|
"git branch*" = "allow";
|
||||||
|
"git show*" = "allow";
|
||||||
|
"git remote*" = "allow";
|
||||||
|
"nix --version" = "allow";
|
||||||
|
"nix eval*" = "allow";
|
||||||
|
"nix build*" = "allow";
|
||||||
|
"nix develop*" = "allow";
|
||||||
|
"nix shell*" = "allow";
|
||||||
|
"nix search*" = "allow";
|
||||||
|
"alejandra*" = "allow";
|
||||||
|
"git add*" = "allow";
|
||||||
|
"git commit*" = "allow";
|
||||||
|
"git push*" = "ask";
|
||||||
|
"git pull*" = "allow";
|
||||||
|
"rm *" = "ask";
|
||||||
|
"rm -rf *" = "deny";
|
||||||
|
"sudo *" = "ask";
|
||||||
|
"env" = "deny";
|
||||||
|
"printenv" = "deny";
|
||||||
|
"cat /proc/*/environ" = "deny";
|
||||||
|
"gpg *--export-secret*" = "deny";
|
||||||
|
"ssh-add -D" = "deny";
|
||||||
|
"docker run --privileged*" = "deny";
|
||||||
|
"curl *| *sh" = "deny";
|
||||||
|
"wget *| *sh" = "deny";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Web fetch: allow by default
|
||||||
|
"webfetch" = "allow";
|
||||||
|
|
||||||
|
# Doom loop guard
|
||||||
|
"doom_loop" = "ask";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Edit access: ask by default, deny sensitive paths
|
# AZ-Gruppe LiteLLM endpoint + available models
|
||||||
"edit" = {
|
provider = {
|
||||||
"*" = "ask";
|
litellm = {
|
||||||
"~/.ssh/**" = "deny";
|
npm = "@ai-sdk/openai-compatible";
|
||||||
"~/.gnupg/**" = "deny";
|
name = "LiteLLM (AZ-Gruppe)";
|
||||||
"~/.aws/**" = "deny";
|
options.baseURL = "https://llm.az-gruppe.com/v1";
|
||||||
"~/.kube/**" = "deny";
|
models = {
|
||||||
"~/.config/gh/**" = "deny";
|
"gpt-5.2" = {
|
||||||
"~/.config/gcloud/**" = "deny";
|
name = "GPT-5.2";
|
||||||
"~/.config/op/**" = "deny";
|
limit = {
|
||||||
"~/.config/sops/**" = "deny";
|
context = 400000;
|
||||||
"/run/agenix/**" = "deny";
|
output = 128000;
|
||||||
"~/.pi/agent/auth.json" = "deny";
|
|
||||||
"~/.pi/agent/sessions/**" = "deny";
|
|
||||||
"*.env" = "deny";
|
|
||||||
"*.env.*" = "deny";
|
|
||||||
"*.pem" = "deny";
|
|
||||||
"*.key" = "deny";
|
|
||||||
"*.p12" = "deny";
|
|
||||||
"*.pfx" = "deny";
|
|
||||||
"*id_rsa*" = "deny";
|
|
||||||
"*id_ed25519*" = "deny";
|
|
||||||
"*id_ecdsa*" = "deny";
|
|
||||||
"~/.ssh/*.pub" = "allow";
|
|
||||||
"*.pub" = "allow";
|
|
||||||
"*.csr" = "allow";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Glob patterns: same rules as read for file matching
|
|
||||||
"glob" = {
|
|
||||||
"*" = "allow";
|
|
||||||
"~/.ssh/**" = "deny";
|
|
||||||
"~/.gnupg/**" = "deny";
|
|
||||||
"/run/agenix/**" = "deny";
|
|
||||||
"*.env" = "deny";
|
|
||||||
"*.env.*" = "deny";
|
|
||||||
"*.pem" = "deny";
|
|
||||||
"*.key" = "deny";
|
|
||||||
"*.p12" = "deny";
|
|
||||||
"*.pfx" = "deny";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Grep: allow search, but deny searching for secrets
|
|
||||||
"grep" = {
|
|
||||||
"*" = "allow";
|
|
||||||
"~/.ssh/**" = "deny";
|
|
||||||
"~/.gnupg/**" = "deny";
|
|
||||||
"/run/agenix/**" = "deny";
|
|
||||||
"*PASSWORD*" = "ask";
|
|
||||||
"*SECRET*" = "ask";
|
|
||||||
"*API_KEY*" = "ask";
|
|
||||||
"*PRIVATE_KEY*" = "ask";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Bash: ask by default, deny dangerous and env-leak commands
|
|
||||||
"bash" = {
|
|
||||||
"*" = "ask";
|
|
||||||
"git status*" = "allow";
|
|
||||||
"git diff*" = "allow";
|
|
||||||
"git log*" = "allow";
|
|
||||||
"git branch*" = "allow";
|
|
||||||
"git show*" = "allow";
|
|
||||||
"git remote*" = "allow";
|
|
||||||
"nix --version" = "allow";
|
|
||||||
"nix eval*" = "allow";
|
|
||||||
"nix build*" = "allow";
|
|
||||||
"nix develop*" = "allow";
|
|
||||||
"nix shell*" = "allow";
|
|
||||||
"nix search*" = "allow";
|
|
||||||
"alejandra*" = "allow";
|
|
||||||
"git add*" = "allow";
|
|
||||||
"git commit*" = "allow";
|
|
||||||
"git push*" = "ask";
|
|
||||||
"git pull*" = "allow";
|
|
||||||
"rm *" = "ask";
|
|
||||||
"rm -rf *" = "deny";
|
|
||||||
"sudo *" = "ask";
|
|
||||||
"env" = "deny";
|
|
||||||
"printenv" = "deny";
|
|
||||||
"cat /proc/*/environ" = "deny";
|
|
||||||
"gpg *--export-secret*" = "deny";
|
|
||||||
"ssh-add -D" = "deny";
|
|
||||||
"docker run --privileged*" = "deny";
|
|
||||||
"curl *| *sh" = "deny";
|
|
||||||
"wget *| *sh" = "deny";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Web fetch: allow by default
|
|
||||||
"webfetch" = "allow";
|
|
||||||
|
|
||||||
# Doom loop guard
|
|
||||||
"doom_loop" = "ask";
|
|
||||||
};
|
|
||||||
|
|
||||||
# AZ-Gruppe LiteLLM endpoint + available models
|
|
||||||
provider = {
|
|
||||||
litellm = {
|
|
||||||
npm = "@ai-sdk/openai-compatible";
|
|
||||||
name = "LiteLLM (AZ-Gruppe)";
|
|
||||||
options.baseURL = "https://llm.az-gruppe.com/v1";
|
|
||||||
models = {
|
|
||||||
"gpt-5.2" = {
|
|
||||||
name = "GPT-5.2";
|
|
||||||
limit = {
|
|
||||||
context = 400000;
|
|
||||||
output = 128000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"gpt-5.6-sol" = {
|
|
||||||
name = "GPT-5.6 Sol";
|
|
||||||
limit = {
|
|
||||||
context = 400000;
|
|
||||||
output = 128000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"gpt-5.3-codex" = {
|
|
||||||
name = "GPT-5.3 Codex";
|
|
||||||
limit = {
|
|
||||||
context = 400000;
|
|
||||||
output = 128000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"claude-haiku-4-5" = {
|
|
||||||
name = "Claude Haiku 4.5";
|
|
||||||
options = {
|
|
||||||
thinking = {
|
|
||||||
type = "enabled";
|
|
||||||
budget_tokens = 16000;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
limit = {
|
"gpt-5.6-sol" = {
|
||||||
context = 200000;
|
name = "GPT-5.6 Sol";
|
||||||
output = 64000;
|
limit = {
|
||||||
};
|
context = 400000;
|
||||||
};
|
output = 128000;
|
||||||
"claude-sonnet-5" = {
|
|
||||||
name = "Claude Sonnet 5";
|
|
||||||
options = {
|
|
||||||
thinking = {
|
|
||||||
type = "adaptive";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
limit = {
|
"gpt-5.3-codex" = {
|
||||||
context = 200000;
|
name = "GPT-5.3 Codex";
|
||||||
output = 64000;
|
limit = {
|
||||||
};
|
context = 400000;
|
||||||
};
|
output = 128000;
|
||||||
"claude-opus-4-8" = {
|
|
||||||
name = "Claude Opus 4.8";
|
|
||||||
options = {
|
|
||||||
thinking = {
|
|
||||||
type = "adaptive";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
limit = {
|
"claude-haiku-4-5" = {
|
||||||
context = 200000;
|
name = "Claude Haiku 4.5";
|
||||||
output = 128000;
|
options = {
|
||||||
|
thinking = {
|
||||||
|
type = "enabled";
|
||||||
|
budget_tokens = 16000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
limit = {
|
||||||
|
context = 200000;
|
||||||
|
output = 64000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"claude-sonnet-5" = {
|
||||||
|
name = "Claude Sonnet 5";
|
||||||
|
options = {
|
||||||
|
thinking = {
|
||||||
|
type = "adaptive";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
limit = {
|
||||||
|
context = 200000;
|
||||||
|
output = 64000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"claude-opus-4-8" = {
|
||||||
|
name = "Claude Opus 4.8";
|
||||||
|
options = {
|
||||||
|
thinking = {
|
||||||
|
type = "adaptive";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
limit = {
|
||||||
|
context = 200000;
|
||||||
|
output = 128000;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user