GitHub Action that transforms vague issues and pull requests into detailed, code-ready specifications using AI CLI tools. It analyzes your codebase context and refines descriptions through conversation.
- One of the supported agent CLIs (
codex,claude,gemini) available on PATH (or installable viabunx) GITHUB_TOKENwithissues: writeandpull-requests: readpermissions
- When an issue or pull request is created (or
/spec-gardenercommand is used), the action gathers the title, body, and comments. - For pull requests, it also includes the list of changed files to ground the refinement.
- It sends the context to the configured AI CLI agent.
- The agent analyzes the codebase and either:
- Asks clarifying questions via a comment
- Updates the issue or pull request body with a refined specification (and optionally refines the title)
- The refined specification is written to the issue or pull request body.
- Use
/spec-gardenerin comments to continue the conversation and further refine the spec.
Create .github/workflows/spec-gardener.yml:
name: Spec Gardener
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
issue_comment:
types: [created]
jobs:
spec-gardener:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: read
contents: read
steps:
- uses: actions/checkout@v6
- name: Run Spec Gardener
uses: ponharu/spec-gardener@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
agent: "codex"
agent_timeout_ms: "120000"
custom_prompt: "Follow our API naming conventions and keep specs concise."Use these commands in issue and pull request comments to interact with Spec Gardener:
| Command | Description |
|---|---|
/spec-gardener |
Analyze the issue and continue refining the specification |
/spec-gardener reset |
Re-analyze from the original description and comments from the reset point onward |
/spec-gardener help |
Show available commands without running the agent |
| Input | Description | Required |
|---|---|---|
github_token |
Token to comment and update issues. | Yes |
agent |
Agent to execute (codex, claude, gemini). If the command is not on PATH, Spec Gardener runs it via bunx using mapped packages: claude → @anthropic-ai/claude-code, codex → @openai/codex, gemini → @google/gemini-cli. |
Yes |
agent_timeout_ms |
Timeout in milliseconds for the agent execution. | No (default: 120000) |
custom_prompt |
Custom instructions to append to the prompt. | No |
mention_on |
Comma-separated list of outcomes that should mention the issue author (question, complete, error). Set to empty to disable mentions. |
No (default: question,complete,error) |
With the example workflow above:
- New issue or pull request created - Automatically analyzed and refined
- Issue or pull request edited - Re-analyzed (skipped if already processed by Spec Gardener)
- Comment with
/spec-gardener- Continues the conversation to refine the spec - Comment with
/spec-gardener reset- Re-runs analysis using the original description and later comments - Comment with
/spec-gardener help- Posts command help without running the agent
The action prevents infinite loops by checking for its footer in the issue body and only responding to comments containing the /spec-gardener command.
When Spec Gardener updates an issue or pull request, it writes the refined specification:
[Refined specification from the agent]
---
🤖 Generated by Spec GardenerComments include available commands and mention the issue author:
💡 Type `/spec-gardener help` for available commands
@author [Agent's response or summary]
---
🤖 Generated by Spec GardenerBuilt-in adapters: codex, claude, gemini. Unknown agent names are rejected.
All agents receive the prompt via stdin and must return JSON.
title is optional and should only be provided when the existing issue title needs improvement.
{ "type": "question", "content": "..." }or
{
"type": "complete",
"body": "...",
"comment": "optional completion comment",
"title": "optional refined title"
}or
{ "type": "no_change" }bun install
bun run lint
bun run typecheck
bun run testApache-2.0
Contributions are welcome! Please open issues or pull requests for bugs, features, or improvements.