opencode-gemiterm-skills 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,66 @@
1
+ # AGENTS.md - opencode-gemiterm-skills
2
+
3
+ <critical_rules priority="highest">
4
+ 1. The bundled `debate-with-gemini` skill depends on the `gemiterm` Python CLI being installed and authenticated on the host.
5
+ 2. This package ships a real installer (`src/installer.ts`) that copies skill assets to the consumer's `.opencode/skills/` and registers them in `opencode.json`. The `src/cli.ts` is the CLI entry point (install/uninstall/status subcommands), resolved by `package.json#bin`. Only add code under `src/` that supports the install/uninstall/status commands.
6
+ 3. Skill frontmatter is the source of truth. Do not edit `assets/skills/*/SKILL.md` frontmatter in ways that break the `name` / `description` contract.
7
+ 4. The `metadata.requires: gemiterm` link on `debate-with-gemini` must remain so consumers know to install the Python CLI first.
8
+ </critical_rules>
9
+
10
+ <context_hierarchy>
11
+ <system>OpenCode plugin loader</system>
12
+ <domain>OpenCode skill packaging</domain>
13
+ <task>Bundle markdown skills into a publishable plugin package</task>
14
+ <execution>npm distribution (opencode-gemiterm-skills) with file:// reference as a development fallback</execution>
15
+ </context_hierarchy>
16
+
17
+ <role>
18
+ <identity>opencode-gemiterm-skills package maintainer</identity>
19
+ <scope>This repository only</scope>
20
+ <constraints>Markdown-only bundle, no build step, no runtime dependencies</constraints>
21
+ </role>
22
+
23
+ <bundled_skills>
24
+ <skill name="gemiterm" path="assets/skills/gemiterm/SKILL.md" requires="Python CLI gemiterm" />
25
+ <skill name="debate-with-gemini" path="assets/skills/debate-with-gemini/SKILL.md" requires="gemiterm skill + Python CLI gemiterm" />
26
+ </bundled_skills>
27
+
28
+ <self_config>
29
+ <location>.opencode/opencode.json</location>
30
+ <purpose>Register assets/skills/ as a skill path and pre-allow both skills</purpose>
31
+ <pointer_in_package_json>opencode.plugin → .opencode/opencode.json</pointer_in_package_json>
32
+ </self_config>
33
+
34
+ <consumer_install>
35
+ <npm>
36
+ <command>npm install opencode-gemiterm-skills</command>
37
+ <opencode_json_snippet>
38
+ {
39
+ "plugins": [
40
+ "opencode-gemiterm-skills"
41
+ ]
42
+ }
43
+ </opencode_json_snippet>
44
+ </npm>
45
+ <file_fallback>
46
+ <opencode_json_snippet>
47
+ {
48
+ "plugins": [
49
+ "file:///ABSOLUTE/PATH/TO/opencode-gemiterm-skills"
50
+ ]
51
+ }
52
+ </opencode_json_snippet>
53
+ <use_case>Local development against a checkout of this repo</use_case>
54
+ </file_fallback>
55
+ <prerequisites>
56
+ - pip install gemiterm
57
+ - gemiterm install-browser
58
+ - gemiterm auth
59
+ </prerequisites>
60
+ </consumer_install>
61
+
62
+ <testing>
63
+ <runner>bun test</runner>
64
+ <file>tests/skills.test.ts</file>
65
+ <coverage>Frontmatter validation, skill-path self-config, package.json pointer, cross-skill dependency link</coverage>
66
+ </testing>
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to `opencode-gemiterm-skills` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.5.0] - 2026-06-07
8
+
9
+ _Initial public release._
10
+
11
+ ### Added
12
+ - npm distribution support: `bin` field exposes `opencode-gemiterm-skills` CLI via `bunx` / `npx` (`install`, `uninstall`, `status` subcommands)
13
+ - `engines: { "bun": ">=1.0.0" }` and `sideEffects: false` metadata in `package.json`
14
+ - `homepage` and `author` fields in `package.json`
15
+ - `prepublishOnly` script that runs `tsc --noEmit` and `bun test` before publish
16
+ - Bun shebang (`#!/usr/bin/env bun`) on `index.ts` so the CLI stub is executable
17
+ - README: **Example use cases** section demonstrating both `gemiterm` and `debate-with-gemini` skills with sample prompts and agent responses
18
+ - README: introduction blurb linking to the [`gemiterm` CLI repository](https://github.com/Expert-Vision-Software/gemiterm)
19
+ - README: `gemiterm` CLI link in the Requirements table
20
+
21
+ ### Changed
22
+ - `package.json` `files` array whitelists `.opencode/opencode.json` instead of the entire `.opencode/` directory, preventing dev-only artifacts from shipping
23
+ - `.opencode/opencode.json` (self-config) stripped of dev-only entries (extra skills path, plugin array, empty MCP block)
24
+ - Module/CLI refactor: `index.ts` is a one-line re-export of `plugin.ts`; CLI entry moved to `src/cli.ts` with dynamic version read from `package.json`; `package.json#bin` points at `./src/cli.ts`; `package.json#files` includes `"src"`; `tsconfig.json#include` includes `"src/**/*.ts"`
25
+ - `package.json` version bumped to `0.5.0`
26
+
27
+ ## [0.1.0] - 2026-06-06
28
+
29
+ ### Added
30
+ - Initial bundle of the `gemiterm` skill (SKILL.md + REFERENCE.md)
31
+ - Initial bundle of the `debate-with-gemini` skill (SKILL.md + REFERENCE.md)
32
+ - Self-config at `.opencode/opencode.json` registering `assets/skills/` as a skill path
33
+ - Pre-configured `permission.skill` entries for both bundled skills
34
+ - `opencode.plugin` pointer in `package.json` to `.opencode/opencode.json`
35
+ - Minimal `plugin.ts` and `index.ts` stubs (markdown-only, no TypeScript logic)
36
+ - Smoke test suite at `tests/skills.test.ts` validating frontmatter and self-config
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 opencode-gemiterm-skills contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # opencode-gemiterm-skills
2
+
3
+ [![OpenCode Plugin](https://img.shields.io/badge/OpenCode-Plugin-blue?link=https://opencode.ai)](https://opencode.ai)
4
+ [![npm version](https://img.shields.io/npm/v/opencode-gemiterm-skills?label=npm)](https://www.npmjs.com/package/opencode-gemiterm-skills)
5
+ [![MIT License](https://img.shields.io/badge/License-MIT-green?link=LICENSE)](LICENSE)
6
+
7
+ Local OpenCode plugin package that bundles the `gemiterm` and `debate-with-gemini` skills for OpenCode agents. Install once and the skills are available to every OpenCode session on the machine.
8
+
9
+ [`gemiterm`](https://github.com/Expert-Vision-Software/gemiterm) is a CLI for interacting with Google Gemini from the terminal — listing, fetching, exporting, and managing Gemini chat history. This plugin wraps it into OpenCode skills so agents can use Gemini conversational data directly in workflows.
10
+
11
+ ## Bundled skills
12
+
13
+ | Skill | Purpose |
14
+ |-------|---------|
15
+ | `gemiterm` | Google Gemini Terminal CLI wrapper for listing, fetching, exporting, and managing Gemini chat history. |
16
+ | `debate-with-gemini` | Conducts structured multi-turn technical debates with Gemini AI via the `gemiterm` CLI, delegating the back-and-forth to a subagent. |
17
+
18
+ Both skills are loaded on demand via the native `skill` tool. The metadata of each skill (name + description) is pre-loaded at session start; the full `SKILL.md` body is loaded only when the agent decides the skill is relevant.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ # Install skills and register them with OpenCode
24
+ bunx opencode-gemiterm-skills install
25
+
26
+ # Or globally (for all projects on this machine)
27
+ bunx opencode-gemiterm-skills install --scope global
28
+ ```
29
+
30
+ That's it. After install, both `gemiterm` and `debate-with-gemini` appear in the `skill` tool's `<available_skills>` list. No restart needed — OpenCode loads skills on demand.
31
+
32
+ For global install, skills are placed in `~/.config/opencode/skills/`. For local install (default), they are placed in `{project}/.opencode/skills/`.
33
+
34
+ ## Example use cases
35
+
36
+ ### List and search Gemini chats (`gemiterm` skill)
37
+
38
+ > **You:** "Find my Gemini chats about React Server Components and export them."
39
+
40
+ Agent loads the `gemiterm` skill, then:
41
+
42
+ ```bash
43
+ gemiterm list --all-profiles --format json
44
+ # → filters chats by title/keyword "React Server Components"
45
+ gemiterm export <chat_id> --output ./exports/rsc-chat.md
46
+ ```
47
+
48
+ **Agent:** "Found 3 matching chats. Exported all to `./exports/` — here's a summary of each…"
49
+
50
+ ---
51
+
52
+ ### Bulk export for analysis (`gemiterm` skill)
53
+
54
+ > **You:** "Export all my recent Gemini chats so I can grep through them."
55
+
56
+ Agent loads the `gemiterm` skill, then:
57
+
58
+ ```bash
59
+ gemiterm list --limit 20 --sort recent --format json
60
+ gemiterm export-all --output ./gemini-exports --format md --parallel 4
61
+ ```
62
+
63
+ **Agent:** "Exported 18 chats to `./gemini-exports/` in Markdown. You can search them with `grep -r "topic" ./gemini-exports/`."
64
+
65
+ ---
66
+
67
+ ### Structured debate with Gemini (`debate-with-gemini` skill)
68
+
69
+ > **You:** "Debate Gemini for/against using SQLite as the primary database for a SaaS app. Context: docs/arch.md. 5 turns."
70
+
71
+ Agent loads both skills, verifies auth, reads context, seeds a new Gemini chat with the opposing stance, and spawns a subagent that runs 5 rounds of back-and-forth autonomously.
72
+
73
+ **Agent:** "Debate complete (5 turns). Gemini argued **for** SQLite (simplicity, zero-config, adequate for early-stage). I argued **against** (concurrency limits, no network access, scaling ceiling). Key agreements: fine for prototyping, migrate to Postgres before 100+ concurrent users. Full transcript saved via `gemiterm export`."
74
+
75
+ ---
76
+
77
+ ### Continue a previous debate (`debate-with-gemini` skill)
78
+
79
+ > **You:** "Continue that SQLite debate for 3 more turns. Here's the chat_id: c_abc123."
80
+
81
+ Agent loads the `debate-with-gemini` skill, fetches the existing chat to resume context, and picks up where the last round left off.
82
+
83
+ **Agent:** "Resumed debate on chat `c_abc123`. Ran 3 additional turns. Gemini conceded on the replication point but raised WAL-mode mitigations. Updated debate report ready."
84
+
85
+ ## Requirements
86
+
87
+ | | Component | Notes |
88
+ | --- | --- | --- |
89
+ | **Runtime** | [`gemiterm`](https://github.com/Expert-Vision-Software/gemiterm) CLI | Must be installed and authenticated. Both bundled skills depend on it. |
90
+ | **Optional** | Bun `>=1.0.0` | Required only for the CLI installer (`bunx opencode-gemiterm-skills install`) and the test suite (`bun test`). |
91
+
92
+ ## Troubleshooting
93
+
94
+ | Symptom | Likely cause | Fix |
95
+ | --- | --- | --- |
96
+ | Skill not in `<available_skills>` list | Not installed yet | Run `bunx opencode-gemiterm-skills install` (or `--scope global`) |
97
+ | Skill not in `<available_skills>` list after install | `gemiterm` auth expired or incomplete | Run `gemiterm status` and re-authenticate if needed |
98
+ | `bunx opencode-gemiterm-skills` not found | Bun `<1.0.0` or package not in PATH | Ensure Bun `>=1.0.0` is installed; try `npx opencode-gemiterm-skills` as fallback |
99
+
100
+ ## Install (file:// reference)
101
+
102
+ For local development against a checkout of this repo, reference the package directory directly from the consumer's `opencode.json`:
103
+
104
+ ```json
105
+ {
106
+ "$schema": "https://opencode.ai/config.json",
107
+ "plugins": [
108
+ "file:///absolute/path/to/opencode-gemiterm-skills"
109
+ ]
110
+ }
111
+ ```
112
+
113
+ This skips the npm install. OpenCode will auto-install skills from the local checkout on first load.
114
+
115
+ ## File layout
116
+
117
+ ```
118
+ opencode-gemiterm-skills/
119
+ ├── .opencode/
120
+ │ └── opencode.json # self-config: skills.paths + permission.skill
121
+ ├── assets/
122
+ │ └── skills/
123
+ │ ├── gemiterm/
124
+ │ │ ├── SKILL.md
125
+ │ │ └── REFERENCE.md
126
+ │ └── debate-with-gemini/
127
+ │ ├── SKILL.md
128
+ │ └── REFERENCE.md
129
+ ├── src/
130
+ │ ├── cli.ts # CLI entry: install / uninstall / status
131
+ │ ├── commands/
132
+ │ │ ├── install.ts
133
+ │ │ ├── uninstall.ts
134
+ │ │ └── status.ts
135
+ │ └── installer.ts # core install logic
136
+ ├── tests/
137
+ │ └── skills.test.ts # smoke test
138
+ ├── .gitignore
139
+ ├── AGENTS.md
140
+ ├── CHANGELOG.md
141
+ ├── LICENSE
142
+ ├── README.md
143
+ ├── index.ts # module entry: re-exports plugin.ts
144
+ ├── package.json
145
+ ├── plugin.ts # plugin entry with config hook (auto-install on load)
146
+ └── tsconfig.json
147
+ ```
148
+
149
+ ## How it works
150
+
151
+ ### Install command
152
+
153
+ `bunx opencode-gemiterm-skills install` copies skill files to the target `skills/` directory and registers the package in `opencode.json`:
154
+
155
+ - **Local** (default): copies to `{project}/.opencode/skills/{gemiterm,debate-with-gemini}/` and updates `{project}/.opencode/opencode.json`
156
+ - **Global**: copies to `~/.config/opencode/skills/{gemiterm,debate-with-gemini}/` and updates `~/.config/opencode/opencode.json`
157
+
158
+ It also pre-grants `permission.skill: "allow"` for both skills and writes a `.version` marker to skip re-install on subsequent loads.
159
+
160
+ ### Plugin auto-install
161
+
162
+ When OpenCode loads the package via `opencode.json` plugins array, `plugin.ts` runs the same (local) install logic with a version-marker check — so the package auto-installs skills on first use if not already installed.
163
+
164
+ ### CLI commands
165
+
166
+ | Command | Description |
167
+ | --- | --- |
168
+ | `bunx opencode-gemiterm-skills install` | Install skills locally (or `--scope global`) |
169
+ | `bunx opencode-gemiterm-skills uninstall` | Remove installed skills |
170
+ | `bunx opencode-gemiterm-skills status` | Check install status and version |
171
+
172
+ `index.ts` is the module entry, a one-line re-export of `plugin.ts`.
173
+
174
+ ## Development
175
+
176
+ Run the test suite:
177
+
178
+ ```bash
179
+ bun test
180
+ ```
181
+
182
+ The smoke test verifies:
183
+
184
+ - Both `assets/skills/*/SKILL.md` files exist and parse as valid YAML frontmatter.
185
+ - `name` matches the directory name.
186
+ - `description` is non-empty and within the 1024-character limit.
187
+ - The `metadata.requires: gemiterm` link on `debate-with-gemini` is preserved.
188
+ - The `metadata.tool: gemiterm` link on `gemiterm` is preserved.
189
+ - `.opencode/opencode.json` exists and registers at least one skill path.
190
+ - `package.json` points `opencode.plugin` at `.opencode/opencode.json`.
191
+
192
+ ## Notes for consumers
193
+
194
+ - The `metadata.requires: gemiterm` field is preserved verbatim on `debate-with-gemini`. OpenCode does not enforce skill-to-skill dependencies — the agent must check `metadata.requires` and the prerequisites above before invoking `debate-with-gemini`.
195
+ - The `metadata.tool`, `metadata.requires`, and `metadata.workflow` fields are stored under the `metadata` map (which OpenCode recognises). Sub-keys beyond `metadata` itself are not formally specified in the OpenCode skill schema, so they may be ignored by some agents — this package treats them as documentation only.
196
+ - The CLI is exposed as `opencode-gemiterm-skills` via the `bin` field, implemented in `src/cli.ts`. Run it with `bunx opencode-gemiterm-skills` or `npx opencode-gemiterm-skills`.
197
+
198
+ ## Acknowledgments
199
+
200
+ - [OpenCode](https://opencode.ai) — plugin architecture and skill loader
201
+ - [Bun](https://bun.sh) — fast JS runtime used as the package's CLI host
202
+ - [DeepWiki](https://deepwiki.com) — research and context tool for codebase exploration
203
+
204
+ ## Publishing
205
+
206
+ This package is published to npm as `opencode-gemiterm-skills`. To cut a new release:
207
+
208
+ ```bash
209
+ npm version patch # or minor / major
210
+ npm publish --access public
211
+ ```
212
+
213
+ The `prepublishOnly` script runs `tsc --noEmit` and `bun test` before publishing.
214
+
215
+ ## License
216
+
217
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,119 @@
1
+ # Debate with Gemini — Reference
2
+
3
+ Subagent prompt template, tactical patterns, and report format for the `debate-with-gemini` skill.
4
+
5
+ ---
6
+
7
+ ## Subagent Prompt Template
8
+
9
+ Copy this template when spawning the `<SUBAGENT_TYPE>` subagent. Fill all `{{...}}` slots.
10
+
11
+ > Replace `<SUBAGENT_TYPE>` with the subagent type defined in your `opencode.json` (default: `general`).
12
+
13
+ ```
14
+ You are arguing {{AGENT_STANCE}} the following topic: "{{TOPIC}}"
15
+
16
+ ## Conversation
17
+ - Gemini chat_id: "{{GEMINI_CHAT_ID}}"
18
+ - Your stance: "{{AGENT_STANCE}}"
19
+ - Gemini's stance: "{{GEMINI_STANCE}}"
20
+ - Turn limit: {{TURN_LIMIT}}
21
+
22
+ ## Context
23
+ {{BG_CONTEXT_SUMMARY}}
24
+
25
+ ## Your Opening Argument
26
+ {{OPENING_ARGUMENT}}
27
+
28
+ ## Execution Loop
29
+ For each turn:
30
+ 1. Send your message:
31
+ gemiterm continue "{{GEMINI_CHAT_ID}}" "your message here"
32
+
33
+ Wait for Gemini's response written to the console.
34
+ 2. Analyze the response — concessions? New arguments? Weaknesses?
35
+ 3. Craft next response using Tactical Patterns below
36
+ 4. Repeat until turn limit or stop condition
37
+
38
+ Prefer `gemiterm continue` because it returns Gemini's last response inline and avoids an extra round-trip.
39
+
40
+ Use `gemiterm fetch "{{GEMINI_CHAT_ID}}" --format json` ONLY if console output has parsing issues or times out.
41
+
42
+ ## Stopping Criteria
43
+ - {{TURN_LIMIT}} turns completed
44
+ - Gemini explicitly concedes the core question
45
+ - Gemini repeats the same argument twice (declare convergence, summarize)
46
+ - New factual information emerges that changes the calculus (return to user with the info)
47
+
48
+ ## Tactical Patterns
49
+
50
+ | Pattern | When to Use | How It Works |
51
+ |---------|-------------|-------------|
52
+ | **Concede-and-Counter** | Opponent has a valid minor point | Concede the minor point explicitly (builds credibility), then counter-attack on the main argument with stronger evidence |
53
+ | **Force Concrete Example** | Opponent argues hypothetically | Demand production evidence: "Do you have a concrete example where X caused Y?" If they can't produce one, their argument is hypothetical |
54
+ | **Decision Matrix** | Debate going in circles | Force a comparison table on specific dimensions: "Let's lock the comparison on [criteria]" |
55
+ | **Reframe the Question** | Opponent frames debate on their terms | Change the frame: "The real question isn't X, it's Y" — shift to ground where your evidence is strongest |
56
+ | **Line-in-the-Sand** | Need a quantifiable claim to test | Pick a number/claim and dare the opponent to break it: "X costs Y lines of code. Prove otherwise" |
57
+
58
+ ## Rules
59
+ - Stay technical and concrete — no marketing language
60
+ - If Gemini makes a valid point, concede it explicitly, then counter on the main argument
61
+ - Token budget: 300-500 words per turn, no essays
62
+ - Do not re-argue points already conceded by either side
63
+ - Do not be sycophantic
64
+ - Run autonomously — do NOT ask the user questions mid-debate
65
+
66
+ ## Return Format
67
+ After completing the debate (or hitting a stop condition), return the Debate Report as your final message (format below).
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Debate Report Format
73
+
74
+ The subagent MUST return this structured report:
75
+
76
+ ```markdown
77
+ ## Debate Report — {{TOPIC}}
78
+
79
+ ### 1. Turns Completed
80
+ <number> of <limit> turns. <early stop reason if applicable>
81
+
82
+ ### 2. Final Opponent Position
83
+ <What the opponent conceded / held firm on>
84
+
85
+ ### 3. Verbatim Transcript (Last 2 Turns)
86
+ <Your last message> → <Opponent's last reply>
87
+
88
+ ### 4. Tactical Assessment
89
+ **Won on:** <points where opponent conceded>
90
+ **Conceded:** <points where you accepted opponent's argument>
91
+ **Lost ground:** <points where opponent strengthened their position>
92
+ **Key turning point:** <which move shifted the debate>
93
+
94
+ ### 5. Recommendation
95
+ <One paragraph: what should the human do next?>
96
+
97
+ ### 6. New Evidence
98
+ <Any new factual information the opponent introduced>
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Permissions
104
+
105
+ If the opencode config lacks bash permissions for `gemiterm`, add:
106
+
107
+ ```json
108
+ {
109
+ "permission": {
110
+ "bash": {
111
+ "gemiterm *": "allow"
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ This allows the subagent to run `gemiterm new`, `gemiterm continue`, `gemiterm fetch`, and `gemiterm list` without prompting.
118
+
119
+ Drop this into the top-level `permission` object in `opencode.json`. For per-agent override, nest it under `agent.<name>.permission`.
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: debate-with-gemini
3
+ description: Conduct structured multi-turn technical debates with Gemini AI via gemiterm CLI. Delegates a subagent to argue a position (for/against) autonomously for up to N turns. Use when user says "debate gemini", "argue with gemini", "have gemini defend/attack X", "continue debate", or wants a technical position stress-tested against Gemini. Triggers on: debate, argue, gemini, position, for/against, stress-test, counter-argument. Requires gemiterm CLI installed and authenticated.
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ requires: gemiterm
8
+ workflow: debate
9
+ ---
10
+
11
+ # Debate with Gemini
12
+
13
+ ## Quick Start
14
+
15
+ ```
16
+ User: "Debate gemini on for/against using X. Context: docs/arch.md. 5 turns."
17
+
18
+ 1. skill("gemiterm") — load CLI commands
19
+ 2. gemiterm status — verify auth
20
+ 3. Read docs/arch.md, build seeding prompt
21
+ 4. gemiterm new "You argue AGAINST X. [context]" — seed Gemini, capture chat_id
22
+ 5. Build opening argument for the FOR position
23
+ 6. Spawn subagent with template from REFERENCE.md
24
+ 7. Subagent runs N turns, returns Debate Report
25
+ ```
26
+
27
+ ## Prerequisites
28
+
29
+ ```bash
30
+ gemiterm status
31
+ ```
32
+
33
+ If not connected: `pipx install gemiterm && gemiterm install-browser && gemiterm auth`
34
+
35
+ ## Inputs
36
+
37
+ If any required input is missing, ask the user via the standard opencode chat interface before continuing.
38
+
39
+ | Input | Required | Description |
40
+ |-------|----------|-------------|
41
+ | `{{TOPIC}}` | Yes | Two-sided topic (e.g., "for/against using Mastra as foundation SDK") |
42
+ | `{{BG_CONTEXT}}` | Yes | File paths, URLs, or text for debate context |
43
+ | `{{GEMINI_CHAT_ID}}` | No | Existing chat_id. If absent, create a new chat. |
44
+ | `{{AGENT_STANCE}}` | No | "for" or "against". Randomly assigned if omitted. |
45
+ | `{{GEMINI_STANCE}}` | No | Opposite of `{{AGENT_STANCE}}` if omitted. Inferred from transcript if chat_id provided. |
46
+ | `{{TURN_LIMIT}}` | No | Max rounds. Default: 10. |
47
+
48
+ ## Phase 1: Setup
49
+
50
+ ### Flow A — New Chat (no chat_id)
51
+
52
+ 1. Read `{{BG_CONTEXT}}` (files, URLs, text)
53
+ 2. Build the seeding prompt with these parts:
54
+ - Share context (≤2000 words)
55
+ - Assign Gemini its stance
56
+ - Set debate rules (technical claims only, acknowledge valid points, numbered arguments)
57
+ - Request an opening argument
58
+ 3. `gemiterm new "seeding prompt"` — creates a chat, sends the first message, writes the response to the console, and returns the chat_id (`c_XXXXXXXXXXXX`); read Gemini's opening response from the same console output
59
+
60
+ **Fallback:** If `gemiterm new` fails, ask the user to create a chat in the Gemini UI, paste the seeding prompt, and provide the chat_id. Then continue with Flow B.
61
+
62
+ ### Flow B — Existing Chat (chat_id provided)
63
+
64
+ 1. `gemiterm fetch {{GEMINI_CHAT_ID}} --format json`
65
+ 2. Parse Gemini's position (last model message)
66
+ 3. Read `{{BG_CONTEXT}}`
67
+ 4. Build position map: what Gemini argues, evidence for/against
68
+
69
+ ## Phase 2: Strategy & Execution
70
+
71
+ 1. **Analyze** — identify opponent's main arguments, evidence, weaknesses
72
+ 2. **Build opening argument** — address each opponent point, cite `{{BG_CONTEXT}}` evidence
73
+ 3. **Spawn subagent** — see [REFERENCE.md](REFERENCE.md) for the prompt template
74
+
75
+ Fill template slots: `{{TOPIC}}`, `{{AGENT_STANCE}}`, `{{GEMINI_STANCE}}`, `{{GEMINI_CHAT_ID}}`, `{{TURN_LIMIT}}`, `{{BG_CONTEXT_SUMMARY}}`, `{{OPENING_ARGUMENT}}`.
76
+
77
+ The subagent runs autonomously. It returns a structured Debate Report (format in REFERENCE.md).
78
+
79
+ **Stopping criteria** (hardcoded in template):
80
+ - Turn limit reached
81
+ - Opponent concedes core question
82
+ - Opponent repeats same argument twice → declare convergence, summarize
83
+ - New factual information changes the calculus → stop, return to user
84
+
85
+ **No pre-planned counter-responses.** Debate proceeds in real-time.
86
+
87
+ ## Edge Cases
88
+
89
+ | Situation | Action |
90
+ |-----------|--------|
91
+ | `gemiterm new` fails | User creates a chat in the Gemini UI, provides the chat_id |
92
+ | chat_id not in `gemiterm list` | Ask user to verify; may need a moment to appear |
93
+ | Gemini concedes turn 1-2 | Accept, produce short report, stop |
94
+ | New factual information | Stop, return to user with info + recommendation |
95
+ | Auth expired | Stop, user runs `gemiterm auth` |
96
+ | Rate limits | Wait 10s between turns; if persistent, stop and report |