Skip to content

Commit 31d51be

Browse files
GiggleLiuclaude
andauthored
feat: display Big O notation in CLI output (#592)
* feat: display Big O notation in CLI for complexity and overhead Use asymptotic_normal_form to show simplified Big O notation alongside exact formulas in `pred show` (variant complexity + reduction overhead) and `pred path` (step overhead + composed overall). Also included in JSON output as a `big_o` field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: show only Big O notation, remove raw formulas, DRY helpers Replace inline overhead display with shared big_o_of(), fmt_overhead_parts(), and overhead_to_json() helpers. Display only asymptotic notation (no constant factors) for complexity, reduction overhead, and path overhead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a0fb111 commit 31d51be

13 files changed

Lines changed: 986 additions & 121 deletions

File tree

.claude/CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Rust library for NP-hard problem reductions. Implements computational problems w
1515
- [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.
1616
- [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.
1717
- [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).
18+
- [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.
19+
- [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.
1820

1921
## Commands
2022
```bash
@@ -42,6 +44,10 @@ make cli-demo # Run closed-loop CLI demo (exercises all commands)
4244
make mcp-test # Run MCP server tests (unit + integration)
4345
make run-plan # Execute a plan with Claude autorun
4446
make run-issue N=42 # Run issue-to-pr --execute for a GitHub issue
47+
make run-pipeline # Pick next Ready issue from project board, implement, move to review-agentic
48+
make run-pipeline N=97 # Process a specific issue from the project board
49+
make run-review # Pick next PR from review-agentic column, fix Copilot comments, fix CI, run agentic tests
50+
make run-review N=570 # Process a specific PR from the review-agentic column
4551
make copilot-review # Request Copilot code review on current PR
4652
make release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
4753
```

.claude/skills/issue-to-pr/SKILL.md

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -203,62 +203,13 @@ git push
203203
make copilot-review
204204
```
205205

206-
#### 7e. Fix Loop (max 3 retries)
207-
208-
```bash
209-
REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
210-
```
211-
212-
For each retry:
213-
214-
1. **Wait for CI to complete** (poll every 30s, up to 15 minutes):
215-
```bash
216-
for i in $(seq 1 30); do
217-
sleep 30
218-
HEAD_SHA=$(gh api repos/$REPO/pulls/$PR | python3 -c "import sys,json; print(json.load(sys.stdin)['head']['sha'])")
219-
STATUS=$(gh api repos/$REPO/commits/$HEAD_SHA/check-runs | python3 -c "
220-
import sys,json
221-
runs = json.load(sys.stdin)['check_runs']
222-
if not runs:
223-
print('PENDING') # CI hasn't registered yet
224-
else:
225-
failed = [r['name'] for r in runs if r.get('conclusion') not in ('success', 'skipped', None)]
226-
pending = [r['name'] for r in runs if r.get('conclusion') is None and r['status'] != 'completed']
227-
if pending:
228-
print('PENDING')
229-
elif failed:
230-
print('FAILED')
231-
else:
232-
print('GREEN')
233-
")
234-
if [ "$STATUS" != "PENDING" ]; then break; fi
235-
done
236-
```
237-
238-
- If `GREEN` on the **first** iteration (before any fix-pr): skip the fix loop, done.
239-
- If `GREEN` after a fix-pr pass: break, done.
240-
- If `FAILED`: continue to step 2.
241-
- If still `PENDING` after 15 min: treat as `FAILED`.
242-
243-
2. **Invoke `/fix-pr`** to address review comments, CI failures, and coverage gaps.
244-
245-
3. **Push fixes:**
246-
```bash
247-
git push
248-
```
249-
250-
4. Increment retry counter. If `< 3`, go back to step 1. If `= 3`, give up.
251-
252-
**After 3 failed retries:** leave PR open, report to user.
253-
254-
#### 7f. Done
206+
#### 7e. Done
255207

256208
Report final status:
257-
- PR URL
258-
- CI status (green / failed after retries)
259-
- Any unresolved review items
209+
- PR URL and number
210+
- Implementation summary
260211

261-
The PR is **not merged** — the user or `meta-power` decides when to merge.
212+
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.
262213

263214
## Example
264215

@@ -286,9 +237,9 @@ Executing plan via subagent-driven-development...
286237
[Subagents implement the plan steps]
287238
[Runs review-implementation — all checks pass, auto-fixes applied]
288239
[Pushes + requests Copilot review]
289-
[Polls CI... GREEN on first pass]
290240
291-
PR #45: CI green, ready for merge.
241+
PR #45 created and pushed. Copilot review requested.
242+
Run /review-pipeline to process Copilot comments, fix CI, and run agentic tests.
292243
```
293244

294245
## Common Mistakes
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
name: project-pipeline
3+
description: Pick a Ready issue from the GitHub Project board, move it through In Progress -> issue-to-pr -> review-agentic
4+
---
5+
6+
# Project Pipeline
7+
8+
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.
9+
10+
## Invocation
11+
12+
- `/project-pipeline` -- pick the next Ready issue (first Model, then Rule, by issue number)
13+
- `/project-pipeline 97` -- process a specific issue number from the Ready column
14+
- `/project-pipeline --all` -- batch-process all Ready issues (Models first, then Rules)
15+
16+
## Constants
17+
18+
GitHub Project board IDs (for `gh project item-edit`):
19+
20+
| Constant | Value |
21+
|----------|-------|
22+
| `PROJECT_ID` | `PVT_kwDOBrtarc4BRNVy` |
23+
| `STATUS_FIELD_ID` | `PVTSSF_lADOBrtarc4BRNVyzg_GmQc` |
24+
| `STATUS_READY` | `61e4505c` |
25+
| `STATUS_IN_PROGRESS` | `47fc9ee4` |
26+
| `STATUS_REVIEW_AGENTIC` | `b2f16561` |
27+
| `STATUS_IN_REVIEW` | `df73e18b` |
28+
| `STATUS_DONE` | `98236657` |
29+
30+
## Autonomous Mode
31+
32+
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.
33+
34+
## Steps
35+
36+
### 0. Discover Ready Issues
37+
38+
```bash
39+
gh project item-list 8 --owner CodingThrust --format json
40+
```
41+
42+
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).
43+
44+
Print the list for visibility (no confirmation needed):
45+
46+
```
47+
Ready issues:
48+
Models:
49+
#129 [Model] MultivariateQuadratic
50+
#117 [Model] GraphPartitioning
51+
Rules:
52+
#97 [Rule] BinPacking to ILP
53+
#110 [Rule] LCS to ILP
54+
#126 [Rule] KSatisfiability to SubsetSum
55+
#130 [Rule] MultivariateQuadratic to ILP
56+
```
57+
58+
**If a specific issue number was provided:** verify it is in the Ready column. If not, STOP with a message.
59+
60+
**If `--all`:** proceed immediately with all Ready issues in order (no confirmation).
61+
62+
**Otherwise (no args):** pick the first issue in the ordered list (Models before Rules, lowest number first) and proceed immediately (no confirmation).
63+
64+
### 1. Create Worktree
65+
66+
Create an isolated git worktree for this issue so the main working directory stays clean:
67+
68+
```bash
69+
git fetch origin main
70+
BRANCH="issue-<number>-<slug>"
71+
WORKTREE_DIR=".worktrees/$BRANCH"
72+
mkdir -p .worktrees
73+
git worktree add "$WORKTREE_DIR" -b "$BRANCH" origin/main
74+
cd "$WORKTREE_DIR"
75+
```
76+
77+
All subsequent steps run inside the worktree. This ensures the user's main checkout is never modified.
78+
79+
### 2. Move to "In Progress"
80+
81+
Extract the project item ID for the chosen issue from the JSON output (the `id` field of the matching item).
82+
83+
```bash
84+
gh project item-edit \
85+
--id <ITEM_ID> \
86+
--project-id PVT_kwDOBrtarc4BRNVy \
87+
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
88+
--single-select-option-id 47fc9ee4
89+
```
90+
91+
### 3. Run issue-to-pr --execute
92+
93+
Invoke the `issue-to-pr` skill with `--execute` (working directory is the worktree):
94+
95+
```
96+
/issue-to-pr <number> --execute
97+
```
98+
99+
This handles the full pipeline: fetch issue, verify Good label, research, write plan, create PR, implement, review, fix CI.
100+
101+
**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.
102+
103+
### 4. Move to "review-agentic"
104+
105+
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:
106+
107+
```bash
108+
gh project item-edit \
109+
--id <ITEM_ID> \
110+
--project-id PVT_kwDOBrtarc4BRNVy \
111+
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
112+
--single-select-option-id b2f16561
113+
```
114+
115+
**If no PR was created** (issue-to-pr failed before creating a PR): move the issue back to "Ready" instead:
116+
117+
```bash
118+
gh project item-edit \
119+
--id <ITEM_ID> \
120+
--project-id PVT_kwDOBrtarc4BRNVy \
121+
--field-id PVTSSF_lADOBrtarc4BRNVyzg_GmQc \
122+
--single-select-option-id 61e4505c
123+
```
124+
125+
### 5. Clean Up Worktree
126+
127+
After the issue is processed (success or failure), clean up the worktree:
128+
129+
```bash
130+
cd /Users/liujinguo/rcode/problemreductions
131+
git worktree remove "$WORKTREE_DIR" --force
132+
```
133+
134+
### 6. Report (single issue)
135+
136+
Print a summary:
137+
138+
```
139+
Pipeline complete:
140+
Issue: #97 [Rule] BinPacking to ILP
141+
PR: #200
142+
Status: Awaiting agentic review
143+
Board: Moved Ready -> In Progress -> review-agentic
144+
```
145+
146+
### 7. Batch Mode (`--all`)
147+
148+
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).
149+
150+
After all issues, print a batch report:
151+
152+
```
153+
=== Project Pipeline Batch Report ===
154+
155+
| Issue | Title | PR | Status | Board |
156+
|-------|------------------------------------|------|-------------|-------------|
157+
| #129 | [Model] MultivariateQuadratic | #201 | CI green | review-agentic |
158+
| #97 | [Rule] BinPacking to ILP | #202 | CI green | review-agentic |
159+
| #110 | [Rule] LCS to ILP | #203 | fix failed | review-agentic |
160+
| #126 | [Rule] KSat to SubsetSum | - | plan failed | Ready |
161+
162+
Completed: 2/4 | In Review: 3 | Returned to Ready: 1
163+
```
164+
165+
## Common Mistakes
166+
167+
| Mistake | Fix |
168+
|---------|-----|
169+
| Issue not in Ready column | Verify status before processing; STOP if not Ready |
170+
| Missing project scopes | Run `gh auth refresh -s read:project,project` |
171+
| Forgetting to move back to Ready on total failure | Only move to In Review if a PR exists |
172+
| Processing Rules before Models | Always sort Models first — Rules may depend on them |
173+
| Not syncing main between batch issues | Each issue gets a fresh worktree from `origin/main` |
174+
| Worktree left behind on failure | Always clean up with `git worktree remove` in Step 5 |
175+
| Working in main checkout | All work happens in `.worktrees/` — never modify the main checkout |

0 commit comments

Comments
 (0)