Skip to content

Commit 7037fde

Browse files
authored
feat(developer): add opencode w/ some custom agents (#68)
1 parent a8f1b5d commit 7037fde

File tree

2 files changed

+172
-11
lines changed

2 files changed

+172
-11
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}:
6+
let
7+
cfg = config.feltnerm.developer.ai;
8+
in
9+
{
10+
# Only apply when developer and AI are enabled
11+
config = lib.mkIf cfg.enable {
12+
13+
services = {
14+
ollama = {
15+
# fails on aarm64-darwin
16+
enable = lib.mkDefault false;
17+
};
18+
};
19+
20+
programs = {
21+
# OpenCode CLI configuration and agents
22+
opencode = {
23+
enable = lib.mkDefault true;
24+
agents = {
25+
explain = ''
26+
---
27+
temperature: 0.3
28+
tools:
29+
write: false
30+
edit: false
31+
patch: false
32+
---
33+
You are an expert explainer of complex technical concepts.
34+
Your goal is to break down complicated ideas into clear, concise, and easily understandable explanations.
35+
Use analogies and examples where appropriate.
36+
'';
37+
deep_thinker = ''
38+
---
39+
temperature: 0.1
40+
maxSteps: 15
41+
tools:
42+
write: false
43+
edit: false
44+
patch: false
45+
---
46+
You are a methodical and rigorous expert problem solver.
47+
For every request, you must first create a detailed, numbered step-by-step reasoning plan before arriving at a final, thoroughly checked answer.
48+
Show your work.
49+
'';
50+
code_reviewer = ''
51+
---
52+
description: Reviews code for quality and best practices.
53+
temperature: 0.05
54+
tools:
55+
write: false
56+
edit: false
57+
patch: false
58+
---
59+
60+
You are a meticulous, objective Code Reviewer.
61+
Analyze the provided code for quality, performance, maintainability, and architectural fit.
62+
Provide a clear summary, then a line-by-line critique.
63+
Your tone must be constructive and professional.
64+
'';
65+
security_auditor = ''
66+
---
67+
description: Audits and reviews code for security best practices.
68+
temperature: 0.0
69+
tools:
70+
write: false
71+
edit: false
72+
patch: false
73+
---
74+
75+
You are an expert Security Auditor specializing in OWASP Top 10 and language-specific vulnerabilities.
76+
Review the code for security flaws, buffer overflows, injection risks, and inadequate authentication/authorization.
77+
If a flaw is found, provide a fix and a detailed explanation of the vulnerability.
78+
'';
79+
technical_writer = ''
80+
---
81+
description: Review and create documentation.
82+
temperature: 0.5
83+
---
84+
85+
You are a professional Technical Writer.
86+
Your goal is to generate clear, well-structured, and accurate documentation, comments, or explanations for the code or concept provided.
87+
Use appropriate Markdown headings and formatting.
88+
'';
89+
quick_thinker = ''
90+
---
91+
description: Get a simple answer fast.
92+
temperature: 0.4
93+
tools:
94+
write: false
95+
edit: false
96+
patch: false
97+
---
98+
99+
You are a fast, high-level consultant.
100+
Provide concise, immediate feedback or a quick solution path, focusing on speed and simplicity.
101+
Limit your response to 3-5 sentences.
102+
'';
103+
creative_thinker = ''
104+
---
105+
description: Suggest new ideas and approaches.
106+
temperature: 0.8
107+
tools:
108+
write: false
109+
edit: false
110+
patch: false
111+
---
112+
113+
You are a generative ideator and lateral thinker.
114+
Your primary goal is to provide at least three diverse and unconventional options for the user's request.
115+
Focus on architectural possibilities, creative solutions, and innovative approaches.
116+
Be bold.
117+
'';
118+
};
119+
settings = {
120+
model = lib.mkDefault "github-copilot/gpt-5";
121+
small_model = lib.mkDefault "github-copilot/claude-sonnet-4";
122+
agent = {
123+
build = { };
124+
plan = {
125+
model = lib.mkDefault "github-copilot/claude-sonnet-4.5";
126+
};
127+
explore = {
128+
model = lib.mkDefault "github-copilot/gpt-4o";
129+
};
130+
general = {
131+
model = lib.mkDefault "github-copilot/gpt-5";
132+
};
133+
explain = {
134+
mode = "primary";
135+
model = lib.mkDefault "github-copilot/gpt-5";
136+
reasoningEffort = lib.mkDefault "high";
137+
textVerbosity = lib.mkDefault "low";
138+
};
139+
deep_thinker = {
140+
mode = "subagent";
141+
model = lib.mkDefault "github-copilot/claude-sonnet-4.5";
142+
};
143+
code_reviewer = {
144+
mode = "subagent";
145+
model = lib.mkDefault "github-copilot/claude-sonnet-4.5";
146+
};
147+
security_auditor = {
148+
mode = "subagent";
149+
model = lib.mkDefault "github-copilot/gpt-5";
150+
};
151+
technical_writer = {
152+
mode = "subagent";
153+
model = lib.mkDefault "github-copilot/claude-sonnet-4.5";
154+
};
155+
quick_thinker = {
156+
mode = "subagent";
157+
model = lib.mkDefault "github-copilot/claude-sonnet-4";
158+
};
159+
creative_thinker = {
160+
mode = "subagent";
161+
model = lib.mkDefault "github-copilot/gpt-4o";
162+
};
163+
};
164+
};
165+
};
166+
};
167+
};
168+
}

modules/home-manager/feltnerm/developer.nix

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ let
4242
};
4343
in
4444
{
45+
imports = [
46+
./ai.nix
47+
];
48+
4549
options.feltnerm.developer = {
4650
enable = lib.mkEnableOption "developer";
4751
codeHome = lib.mkOption {
@@ -74,13 +78,6 @@ in
7478

7579
config = lib.mkIf cfg.enable {
7680

77-
services = {
78-
ollama = lib.mkIf cfg.ai.enable {
79-
# fails on aarm64-darwin
80-
enable = lib.mkDefault false;
81-
};
82-
};
83-
8481
programs = {
8582
zsh.initContent = lib.mkIf (
8683
config.programs.zsh.enable && config.programs.fzf.enable
@@ -106,10 +103,6 @@ in
106103
};
107104
};
108105

109-
opencode = lib.mkIf cfg.ai.enable {
110-
enable = lib.mkDefault true;
111-
};
112-
113106
nixvim = {
114107
extraPlugins = [ ];
115108
plugins = {

0 commit comments

Comments
 (0)