diff --git a/home/default.nix b/home/default.nix index a2afd14..1770066 100644 --- a/home/default.nix +++ b/home/default.nix @@ -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 {}) diff --git a/home/modules/opencode.nix b/home/modules/opencode.nix new file mode 100644 index 0000000..c32e3e0 --- /dev/null +++ b/home/modules/opencode.nix @@ -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"; }; + }; + }; + }; + }; +}