From 16340374c8ee3195c062c6fab553ae3e3c47d048 Mon Sep 17 00:00:00 2001 From: Fred DE MATOS Date: Wed, 14 Jan 2026 10:42:42 +0100 Subject: [PATCH 1/2] feat: add /agent-demote command and make grade optional in /agent-promote - Grade defaults to 'primary' when not specified - Fix empty string grade bug - Add /agent-demote command to quickly demote agents to subagent - Bump version to 0.5.1 --- README.md | 19 ++++++++++--------- command/agent-demote.md | 5 +++++ command/agent-promote.md | 4 ++-- package.json | 2 +- src/tools/agent-promote.ts | 7 ++++--- 5 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 command/agent-demote.md diff --git a/README.md b/README.md index e57bdbe..0871c80 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,8 @@ Alternatively, clone or copy the plugin files to one of these directories: | Command | Description | Agent | |---------|-------------|-------| -| `/agent-promote ` | Change the type of a plugin agent at runtime. Grades: `subagent`, `primary`, `all` | - | +| `/agent-promote [grade]` | Promote an agent to primary (default) or specify grade: `subagent`, `primary`, `all` | - | +| `/agent-demote ` | Demote an agent to subagent | - | | `/commit-push` | Stage, commit, and push changes with user confirmation | `build` | | `/diff-summary [source] [target]` | Show working tree changes or diff between branches | - | | `/doc-changes` | Update documentation based on uncommitted changes (new features only) | `doc-writer` | @@ -232,34 +233,34 @@ Child sessions (2): ### agent-promote -Change the type of a plugin agent at runtime. Promotes subagents to primary agents (visible in Tab selection) or demotes them back. +Promote an agent to primary (default) or specify a grade. #### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `name` | `string` | Yes | Name of the plugin agent (e.g., `rubber-duck`, `architect`) | -| `grade` | `string` | Yes | Target type: `subagent`, `primary`, or `all` | +| `grade` | `string` | No | Target type: `subagent`, `primary`, or `all` (default: `primary`) | #### Grade Types | Grade | Effect | |-------|--------| -| `subagent` | Available only as a subagent (default for most agents) | +| `subagent` | Available only as a subagent | | `primary` | Appears in Tab selection for direct use | | `all` | Available both as primary and subagent | #### Usage Examples ```bash -# Promote rubber-duck to use it directly via Tab -/agent-promote rubber-duck primary +# Promote rubber-duck to primary (default) +/agent-promote rubber-duck -# Make architect available everywhere +# Promote with explicit grade /agent-promote architect all -# Revert code-reviewer to subagent only -/agent-promote code-reviewer subagent +# Demote back to subagent +/agent-demote rubber-duck ``` #### Notes diff --git a/command/agent-demote.md b/command/agent-demote.md new file mode 100644 index 0000000..48ab08b --- /dev/null +++ b/command/agent-demote.md @@ -0,0 +1,5 @@ +--- +description: Demote an agent to subagent +--- + +Use the agent-promote tool with name=$1 and grade=subagent. diff --git a/command/agent-promote.md b/command/agent-promote.md index 77b1556..b296304 100644 --- a/command/agent-promote.md +++ b/command/agent-promote.md @@ -1,5 +1,5 @@ --- -description: Change the type of an agent to primary, subagent or all +description: Promote an agent to primary (or specify grade) --- -Use the agent-promote tool to change agent $1 to grade $2. +Use the agent-promote tool to change agent $1 to grade $2. If no grade is provided, use primary. diff --git a/package.json b/package.json index f974ddc..ee25f04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencode-froggy", - "version": "0.5.0", + "version": "0.5.1", "description": "OpenCode plugin with a hook layer (tool.before.*, session.idle...), agents (code-reviewer, doc-writer), and commands (/review-pr, /commit)", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/tools/agent-promote.ts b/src/tools/agent-promote.ts index f9f352f..2cfaf24 100644 --- a/src/tools/agent-promote.ts +++ b/src/tools/agent-promote.ts @@ -23,7 +23,7 @@ type Client = ReturnType export interface AgentPromoteArgs { name: string - grade: string + grade?: string } export function createAgentPromoteTool(client: Client, pluginAgentNames: string[]) { @@ -31,10 +31,11 @@ export function createAgentPromoteTool(client: Client, pluginAgentNames: string[ description: "Change the type of an agent to primary, subagent or all", args: { name: tool.schema.string().describe("Name of the agent"), - grade: tool.schema.string().describe("Target type: 'subagent', 'primary', or 'all'"), + grade: tool.schema.string().optional().describe("Target type: 'subagent', 'primary', or 'all' (default: primary)"), }, async execute(args: AgentPromoteArgs, _context: ToolContext) { - const { name, grade } = args + const { name } = args + const grade = args.grade?.trim() || "primary" if (!validateGrade(grade)) { return `Invalid grade "${grade}". Valid grades: ${VALID_GRADES.join(", ")}` From bc0238bb043357eb65eb963517e051d5ed2d5f76 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Wed, 14 Jan 2026 09:44:24 +0000 Subject: [PATCH 2/2] PR approved; suggest adding tests Co-authored-by: fdematos --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 016f05b..c653df1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "opencode-froggy", - "version": "0.4.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "opencode-froggy", - "version": "0.4.0", + "version": "0.5.1", "license": "MIT", "dependencies": { "js-yaml": "^4.1.0",