Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Rust library for NP-hard problem reductions. Implements computational problems w
- [check-issue](skills/check-issue/SKILL.md) -- Quality gate for `[Rule]` and `[Model]` issues. Checks usefulness, non-triviality, correctness of literature, and writing quality. Posts structured report and adds failure labels.
- [check-rule-redundancy](skills/check-rule-redundancy/SKILL.md) -- Check if a reduction rule (source-target pair) is redundant, i.e., dominated by a composite path through other rules.
- [meta-power](skills/meta-power/SKILL.md) -- Batch-resolve all open `[Model]` and `[Rule]` issues autonomously: plan, implement, review, fix CI, merge — in dependency order (models first).
- [project-pipeline](skills/project-pipeline/SKILL.md) -- Pick a Ready issue from the GitHub Project board, move it through In Progress -> issue-to-pr --execute -> review-agentic.
- [review-pipeline](skills/review-pipeline/SKILL.md) -- Pick a PR from review-agentic column, fix Copilot review comments, fix CI, run agentic feature tests, move to In Review.

## Commands
```bash
Expand Down Expand Up @@ -42,6 +44,10 @@ make cli-demo # Run closed-loop CLI demo (exercises all commands)
make mcp-test # Run MCP server tests (unit + integration)
make run-plan # Execute a plan with Claude autorun
make run-issue N=42 # Run issue-to-pr --execute for a GitHub issue
make run-pipeline # Pick next Ready issue from project board, implement, move to review-agentic
make run-pipeline N=97 # Process a specific issue from the project board
make run-review # Pick next PR from review-agentic column, fix Copilot comments, fix CI, run agentic tests
make run-review N=570 # Process a specific PR from the review-agentic column
make copilot-review # Request Copilot code review on current PR
make release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
```
Expand Down
61 changes: 6 additions & 55 deletions .claude/skills/issue-to-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,62 +203,13 @@ git push
make copilot-review
```

#### 7e. Fix Loop (max 3 retries)

```bash
REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
```

For each retry:

1. **Wait for CI to complete** (poll every 30s, up to 15 minutes):
```bash
for i in $(seq 1 30); do
sleep 30
HEAD_SHA=$(gh api repos/$REPO/pulls/$PR | python3 -c "import sys,json; print(json.load(sys.stdin)['head']['sha'])")
STATUS=$(gh api repos/$REPO/commits/$HEAD_SHA/check-runs | python3 -c "
import sys,json
runs = json.load(sys.stdin)['check_runs']
if not runs:
print('PENDING') # CI hasn't registered yet
else:
failed = [r['name'] for r in runs if r.get('conclusion') not in ('success', 'skipped', None)]
pending = [r['name'] for r in runs if r.get('conclusion') is None and r['status'] != 'completed']
if pending:
print('PENDING')
elif failed:
print('FAILED')
else:
print('GREEN')
")
if [ "$STATUS" != "PENDING" ]; then break; fi
done
```

- If `GREEN` on the **first** iteration (before any fix-pr): skip the fix loop, done.
- If `GREEN` after a fix-pr pass: break, done.
- If `FAILED`: continue to step 2.
- If still `PENDING` after 15 min: treat as `FAILED`.

2. **Invoke `/fix-pr`** to address review comments, CI failures, and coverage gaps.

3. **Push fixes:**
```bash
git push
```

4. Increment retry counter. If `< 3`, go back to step 1. If `= 3`, give up.

**After 3 failed retries:** leave PR open, report to user.

#### 7f. Done
#### 7e. Done

Report final status:
- PR URL
- CI status (green / failed after retries)
- Any unresolved review items
- PR URL and number
- Implementation summary

The PR is **not merged** — the user or `meta-power` decides when to merge.
The PR is **not merged** and CI/review fixes are **not** handled here. The separate `review-pipeline` skill picks up PRs from the `review-agentic` board column to handle Copilot review comments, CI fixes, and agentic testing.

## Example

Expand Down Expand Up @@ -286,9 +237,9 @@ Executing plan via subagent-driven-development...
[Subagents implement the plan steps]
[Runs review-implementation — all checks pass, auto-fixes applied]
[Pushes + requests Copilot review]
[Polls CI... GREEN on first pass]

PR #45: CI green, ready for merge.
PR #45 created and pushed. Copilot review requested.
Run /review-pipeline to process Copilot comments, fix CI, and run agentic tests.
```

## Common Mistakes
Expand Down
175 changes: 175 additions & 0 deletions .claude/skills/project-pipeline/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
name: project-pipeline
description: Pick a Ready issue from the GitHub Project board, move it through In Progress -> issue-to-pr -> review-agentic
---

# Project Pipeline

Pick a "Ready" issue from the [GitHub Project board](https://github.com/orgs/CodingThrust/projects/8/views/1), move it to "In Progress", run `issue-to-pr --execute`, then move it to "review-agentic". The separate `review-pipeline` handles Copilot comments, CI fixes, and agentic testing.

## Invocation

- `/project-pipeline` -- pick the next Ready issue (first Model, then Rule, by issue number)
- `/project-pipeline 97` -- process a specific issue number from the Ready column
- `/project-pipeline --all` -- batch-process all Ready issues (Models first, then Rules)

## Constants

GitHub Project board IDs (for `gh project item-edit`):

| Constant | Value |
|----------|-------|
| `PROJECT_ID` | `PVT_kwDOBrtarc4BRNVy` |
| `STATUS_FIELD_ID` | `PVTSSF_lADOBrtarc4BRNVyzg_GmQc` |
| `STATUS_READY` | `61e4505c` |
| `STATUS_IN_PROGRESS` | `47fc9ee4` |
| `STATUS_REVIEW_AGENTIC` | `b2f16561` |
| `STATUS_IN_REVIEW` | `df73e18b` |
| `STATUS_DONE` | `98236657` |

## Autonomous Mode

This skill runs **fully autonomously** — no confirmation prompts, no user questions. It picks the next issue and processes it end-to-end. All sub-skills (`issue-to-pr`, `check-issue`, `add-model`, `add-rule`, etc.) should also auto-approve any confirmation prompts.

## Steps

### 0. Discover Ready Issues

```bash
gh project item-list 8 --owner CodingThrust --format json
```

Filter items where `status == "Ready"`. Partition into `[Model]` and `[Rule]` buckets, sort each by issue number ascending. Final order: **all Models first, then all Rules** (so dependencies are satisfied).

Print the list for visibility (no confirmation needed):

```
Ready issues:
Models:
#129 [Model] MultivariateQuadratic
#117 [Model] GraphPartitioning
Rules:
#97 [Rule] BinPacking to ILP
#110 [Rule] LCS to ILP
#126 [Rule] KSatisfiability to SubsetSum
#130 [Rule] MultivariateQuadratic to ILP
```

**If a specific issue number was provided:** verify it is in the Ready column. If not, STOP with a message.

**If `--all`:** proceed immediately with all Ready issues in order (no confirmation).

**Otherwise (no args):** pick the first issue in the ordered list (Models before Rules, lowest number first) and proceed immediately (no confirmation).

### 1. Create Worktree

Create an isolated git worktree for this issue so the main working directory stays clean:

```bash
git fetch origin main
BRANCH="issue-<number>-<slug>"
WORKTREE_DIR=".worktrees/$BRANCH"
mkdir -p .worktrees
git worktree add "$WORKTREE_DIR" -b "$BRANCH" origin/main
cd "$WORKTREE_DIR"
```

All subsequent steps run inside the worktree. This ensures the user's main checkout is never modified.

### 2. Move to "In Progress"

Extract the project item ID for the chosen issue from the JSON output (the `id` field of the matching item).

```bash
gh project item-edit \
--id <ITEM_ID> \
--project-id PVT_kwDOBrtarc4BRNVy \
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
--single-select-option-id 47fc9ee4
```

### 3. Run issue-to-pr --execute

Invoke the `issue-to-pr` skill with `--execute` (working directory is the worktree):

```
/issue-to-pr <number> --execute
```

This handles the full pipeline: fetch issue, verify Good label, research, write plan, create PR, implement, review, fix CI.

**If `issue-to-pr` fails:** record the failure, but still move the issue to "In Review" so it's visible for human triage. Report the failure to the user.

### 4. Move to "review-agentic"

After `issue-to-pr` completes (success or failure with a PR created), move the issue to the `review-agentic` column for the second-stage review pipeline:

```bash
gh project item-edit \
--id <ITEM_ID> \
--project-id PVT_kwDOBrtarc4BRNVy \
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
--single-select-option-id b2f16561
```

**If no PR was created** (issue-to-pr failed before creating a PR): move the issue back to "Ready" instead:

```bash
gh project item-edit \
--id <ITEM_ID> \
--project-id PVT_kwDOBrtarc4BRNVy \
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
--single-select-option-id 61e4505c
```

### 5. Clean Up Worktree

After the issue is processed (success or failure), clean up the worktree:

```bash
cd /Users/liujinguo/rcode/problemreductions
git worktree remove "$WORKTREE_DIR" --force
```

### 6. Report (single issue)

Print a summary:

```
Pipeline complete:
Issue: #97 [Rule] BinPacking to ILP
PR: #200
Status: Awaiting agentic review
Board: Moved Ready -> In Progress -> review-agentic
```

### 7. Batch Mode (`--all`)

If `--all` was specified, repeat Steps 1-6 for each issue in order. Each issue gets its own worktree (created and cleaned up per issue).

After all issues, print a batch report:

```
=== Project Pipeline Batch Report ===

| Issue | Title | PR | Status | Board |
|-------|------------------------------------|------|-------------|-------------|
| #129 | [Model] MultivariateQuadratic | #201 | CI green | review-agentic |
| #97 | [Rule] BinPacking to ILP | #202 | CI green | review-agentic |
| #110 | [Rule] LCS to ILP | #203 | fix failed | review-agentic |
| #126 | [Rule] KSat to SubsetSum | - | plan failed | Ready |

Completed: 2/4 | In Review: 3 | Returned to Ready: 1
```

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Issue not in Ready column | Verify status before processing; STOP if not Ready |
| Missing project scopes | Run `gh auth refresh -s read:project,project` |
| Forgetting to move back to Ready on total failure | Only move to In Review if a PR exists |
| Processing Rules before Models | Always sort Models first — Rules may depend on them |
| Not syncing main between batch issues | Each issue gets a fresh worktree from `origin/main` |
| Worktree left behind on failure | Always clean up with `git worktree remove` in Step 5 |
| Working in main checkout | All work happens in `.worktrees/` — never modify the main checkout |
Loading
Loading