Add opencode config with custom agent definitions

This commit is contained in:
2026-04-10 16:49:04 +02:00
parent 8d3e555dc7
commit 18d9f5c98a
2 changed files with 54 additions and 0 deletions
+2
View File
@@ -7,6 +7,7 @@
./modules/git.nix
./modules/tmux.nix
./modules/scripts.nix
./modules/opencode.nix
];
# ============================================
@@ -32,6 +33,7 @@
podman-compose
# AI
claude-code
opencode
# Custom packages
(pkgs.callPackage ../pkgs/ax {})
+52
View File
@@ -0,0 +1,52 @@
{ config, ... }:
{
xdg.configFile."opencode/opencode.json".text = builtins.toJSON {
"$schema" = "https://opencode.ai/config.json";
agent = {
commit = {
description = "Creates a one-line git commit describing the changes";
mode = "subagent";
model = "openai/gpt-oss-120b:nitro";
prompt = ''
You are a git commit agent. When invoked:
1. Run `git status` and `git diff` to understand all changes
2. Stage appropriate files with `git add`
3. Create a single one-line commit message that clearly describes the changes
4. Never push to remote
5. Never use --no-verify or --force flags
'';
permission = {
bash = {
"git *" = "allow";
};
edit = "allow";
};
};
compact = {
description = "Compacts and summarizes conversation context to reduce token usage";
mode = "subagent";
model = "moonshotai/kimi-k2.5:nitro";
prompt = ''
You are a context compaction specialist. Your job is to summarize and compress the conversation history while preserving:
1. Key decisions and their rationale
2. Important code changes and their purposes
3. Unresolved issues or TODOs
4. File paths and line references that are still relevant
Be extremely concise. Remove:
- Redundant explanations
- Already-applied code diffs
- Exploration steps that didn't lead anywhere
- Verbose tool outputs
Output a dense, information-rich summary that captures the essential state of the conversation.
'';
permission = {
edit = "deny";
bash = { "*" = "deny"; };
};
};
};
};
}