Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/feature-ideation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Feature Ideation Agent

on:
issues:
types: [labeled]
workflow_dispatch:
inputs:
issue_url:
description: "Issue URL to run ideation on"
required: true
type: string
dry_run:
description: "If true, never post comments or add labels"
required: false
default: "false"
type: string

permissions:
contents: read

concurrency:
group: feature-ideation-${{ github.event.issue.number || inputs.issue_url }}
cancel-in-progress: false

jobs:
ideate:
# Run when the 'feature-idea' label is added to an issue, or on manual dispatch.
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issues' && github.event.label.name == 'feature-idea')
runs-on: ubuntu-latest
timeout-minutes: 30
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# Default to dry-run unless LIVE_MODE is set (shares the same variable as
# the PR review agent so a single toggle controls both agents).
DRY_RUN: ${{ inputs.dry_run || (vars.LIVE_MODE == 'true' && 'false' || 'true') }}
ISSUE_URL_OVERRIDE: ${{ inputs.issue_url || github.event.issue.html_url }}

steps:
- name: Checkout agent repo
uses: actions/checkout@v5

- name: Install Claude Code CLI
run: npm install -g @anthropic-ai/claude-code

- name: Verify auth
run: |
gh auth status
gh api user --jq '.login'

- name: Run feature ideation
run: |
set -euo pipefail
echo "::group::Ideating $ISSUE_URL_OVERRIDE"
bash scripts/ideate-feature.sh \
|| echo "::warning::Ideation failed for $ISSUE_URL_OVERRIDE"
echo "::endgroup::"
104 changes: 98 additions & 6 deletions AGENT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# PR Review Agent
# Automation Agents

A scheduled GitHub Action that reviews open PRs on don-petry's behalf.
Runs hourly, classifies risk, auto-approves low/medium-risk PRs that pass all
quality gates, and escalates high-risk or gated PRs for human review.
Two automated GitHub Actions agents for don-petry's repos:

1. **PR Review Agent** — reviews open PRs on don-petry's behalf. Runs hourly,
classifies risk, auto-approves low/medium-risk PRs that pass all quality
gates, and escalates high-risk or gated PRs for human review.

2. **Feature Ideation Agent** — adversarially evaluates feature ideas posted
as GitHub issues. Add the `feature-idea` label to trigger a proposer →
challenger → synthesizer loop that produces a refined, implementation-ready
spec directly on the issue.

## How it works

Expand Down Expand Up @@ -66,6 +73,77 @@ quality gates, and escalates high-risk or gated PRs for human review.
knows the PR has new commits since the last review and runs the council
again — handling iterative review cycles cleanly.

## Feature Ideation Agent

Stress-tests feature ideas using an adversarial loop: Claude proposes a spec,
Codex challenges it, Claude refines, iterate until approved (max 5 rounds).

Pattern inspired by: <https://github.com/topics/adversarial-review>

### Two modes

| Mode | When to use |
|---|---|
| **Interactive (`SKILL.md`)** | Use during development — invoke `/ideate-feature` in Claude Code with any idea, issue URL, or spec file |
| **Automated (GitHub Actions)** | Use for GitHub issue triage — fires when the `feature-idea` label is added, posts a refined spec as an issue comment |

### Interactive mode (Claude Code skill)

Follow the install instructions in [`SKILL.md`](SKILL.md). Once installed:

```
/ideate-feature <description or issue URL>
```

Claude proposes a spec → Codex adversarially challenges it → Claude refines →
repeat up to 5 rounds until the spec is approved.

```
Claude (propose)
└─ Codex (adversarial challenge)
└─ Claude (refine spec)
└─ Codex (re-review)
└─ ... → VERDICT: APPROVED
```

### Automated mode (GitHub Actions)

1. **Trigger** — `.github/workflows/feature-ideation.yml` fires when the
`feature-idea` label is added to any issue, or on `workflow_dispatch` with
an explicit issue URL.
2. **Proposer (Sonnet)** — reads the issue title and body, scans the repo for
context, and writes a structured proposal JSON to
`/tmp/ideation/proposal.json` covering: problem statement, proposed
solution, implementation sketch, acceptance criteria, effort estimate, and
open questions.
3. **Challenger (Sonnet)** — reads the proposal and adversarially challenges
it across seven dimensions (value, feasibility, scope, risk, completeness,
alternatives, open questions). Outputs a critique JSON with per-dimension
severity ratings and suggested fixes.
4. **Synthesizer (Opus)** — reads both JSONs, reconciles valid challenges into
a refined spec, and posts a structured comment on the issue. Also adds the
`feature-spec-ready` label when the spec is actionable.

**Idempotency** — each posted comment starts with:

```
<!-- feature-ideation-agent v1 issue=<num> cycle=<N> -->
```

Re-labeling the issue after editing it triggers a new cycle (N+1).

```bash
# Automatically: add the 'feature-idea' label to an issue on any repo
gh issue edit <number> --repo owner/repo --add-label feature-idea

# Manually (ad-hoc):
gh workflow run feature-ideation.yml --repo don-petry/self \
-f issue_url=https://github.com/owner/repo/issues/42 \
-f dry_run=true
```

---

## Setup

### 1. Create a fine-grained PAT
Expand All @@ -77,7 +155,7 @@ Go to <https://github.com/settings/personal-access-tokens/new>. Settings:
agent to act on).
- **Repository permissions:**
- Contents: **Read**
- Issues: **Read and write** (needed to create labels and add `needs-human-review`)
- Issues: **Read and write** (needed for PR review labels and feature ideation comments/labels)
- Metadata: **Read** (auto)
- Pull requests: **Read and write**
- **Expiration:** as long as you're comfortable with. Set a calendar reminder
Expand Down Expand Up @@ -106,7 +184,21 @@ gh secret set CLAUDE_CODE_OAUTH_TOKEN --repo don-petry/self

(Paste the token when prompted, then Ctrl+D.)

### 3. Test with a dry run
### 3. Install the feature ideation skill (optional, for interactive use)

Requires [OpenAI Codex CLI](https://github.com/openai/codex):

```bash
npm install -g @openai/codex
# Set OPENAI_API_KEY in your environment

# Symlink the skill into Claude Code's skills directory
ln -s "$(pwd)" ~/.agents/skills/feature-ideation
```

After symlinking, invoke with `/ideate-feature` in Claude Code.

### 4. Test with a dry run

```
gh workflow run pr-review.yml --repo don-petry/self -f dry_run=true
Expand Down
Loading