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
2 changes: 1 addition & 1 deletion .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ make release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
- `misc/` - Unique input structures
- Run `pred list` for the full catalog of problems, variants, and reductions; `pred show <name>` for details on a specific problem
- `src/rules/` - Reduction rules + inventory registration
- `src/solvers/` - BruteForce solver, ILP solver (feature-gated)
- `src/solvers/` - BruteForce solver, ILP solver (feature-gated). To check if a problem supports ILP solving (via reduction path), run `pred path <ProblemName> ILP`
- `src/traits.rs` - `Problem`, `OptimizationProblem`, `SatisfactionProblem` traits
- `src/rules/traits.rs` - `ReduceTo<T>`, `ReductionResult` traits
- `src/registry/` - Compile-time reduction metadata collection
Expand Down
2 changes: 2 additions & 0 deletions .claude/skills/add-model/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ The body goes AFTER auto-generated sections (complexity table, reductions, schem

**Evaluation:** Show the objective/verifier computed on the example solution (can be woven into example text).

**Reproducibility:** The example section must include a `pred-commands()` call showing the create/solve/evaluate pipeline. See `write-model-in-paper` skill for the full pattern.

### 6d. Build and verify

```bash
Expand Down
2 changes: 2 additions & 0 deletions .claude/skills/add-rule/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ Step-by-step walkthrough with concrete numbers from JSON data. Required steps:

Use `graph-colors`, `g-node()`, `g-edge()` for graph visualization — see reference examples.

**Reproducibility:** The `extra:` block must start with a `pred-commands()` call showing the create/reduce/solve/evaluate pipeline. See `write-rule-in-paper` skill for the full pattern.

### 5d. Build and verify

```bash
Expand Down
13 changes: 3 additions & 10 deletions .claude/skills/final-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,27 +400,20 @@ Use `AskUserQuestion` only when needed:
```bash
gh pr review <number> --approve || true
```
5. Post a community call validation checklist as a comment on the **linked issue** (not the PR). All CLI commands must be copy-pastable — substitute actual problem names from the PR diff (no angle-bracket placeholders). Example for a rule PR adding `Satisfiability` → `MaximumIndependentSet`:
5. Post a community call validation checklist as a comment on the **linked issue** (not the PR). Substitute actual problem names from the PR diff (no angle-bracket placeholders). Example for a rule PR adding `Satisfiability` → `MaximumIndependentSet`:
````bash
COMMENT_FILE=$(mktemp)
cat > "$COMMENT_FILE" <<'EOF'
Please kindly check the following items (PR #123):
- [ ] **Paper** ([PDF](https://github.com/CodingThrust/problem-reductions/blob/main/docs/paper/reductions.pdf)): check definition, proof sketch, and example figure
- [ ] **CLI demo** (build from source: `cargo install --path problemreductions-cli`):
```bash
pred show Satisfiability
pred create --example Satisfiability -o instance.json
pred reduce instance.json Satisfiability MaximumIndependentSet -o reduced.json
pred solve reduced.json MaximumIndependentSet
```
- [ ] **Paper** ([PDF](https://github.com/CodingThrust/problem-reductions/blob/main/docs/paper/reductions.pdf)): check definition, proof sketch, example figure, and reproducible `pred` commands
- [ ] **Implementation (Optional)**: spot-check the source files changed in this PR for correctness

💬 Join the discussion on [Zulip](https://julialang.zulipchat.com/#narrow/channel/365542-problem-reductions) — feel free to ask questions or leave feedback there.
EOF
gh issue comment <ISSUE_NUMBER> --body-file "$COMMENT_FILE"
rm -f "$COMMENT_FILE"
````
For model PRs, omit the `pred reduce` / `pred solve` lines. If there is no linked issue, post the checklist as a PR comment instead.
If there is no linked issue, post the checklist as a PR comment instead.
6. Present the PR link for the reviewer to merge:
> CI green, commits pushed, PR approved. Community call checklist posted on #<ISSUE_NUMBER>. Please merge when ready:
> **<PR URL>**
Expand Down
50 changes: 41 additions & 9 deletions .claude/skills/fix-issue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Tag each issue as:
|--------------|-------------|
| Undefined symbol in overhead/algorithm | Add definition derived from context (e.g., "let n = \|V\|") |
| Inconsistent notation across sections | Standardize to the most common usage in the issue |
| Missing/wrong code metric names | Look up correct names via `pred show <target> --json` → `size_fields` |
| Missing/wrong code metric names | Look up correct names via `pred show <target> --json` → `size_fields`. If `size_fields` is empty, use the plain-text `pred show <target>` output which lists Fields directly |
| Formatting issues (broken tables, missing headers) | Reformat to match issue template |
| Incomplete `(TBD)` in fields derivable from other sections | Fill from context |
| Incorrect DOI format | Reformat to `https://doi.org/...` |
Expand Down Expand Up @@ -158,16 +158,46 @@ For each `mechanical` issue:
2. Apply the fix
3. Record what was changed (for presenting to human in Step 4)

Use `pred show <problem> --json` to look up:
Use `cargo run -p problemreductions-cli --bin pred -- show <problem>` (or `./target/debug/pred show <problem>` after `make cli`) to look up:
- Valid problem names and aliases
- `size_fields` for correct metric names
- `size_fields` for correct metric names (via `--json`); if empty, use plain-text output which lists Fields directly
- Existing variants and fields

**Do NOT edit the issue on GitHub yet** — collect all fixes (mechanical + substantive) first.

---

## Step 4: Present Auto-Fixes to Human
## Step 4: Present Full Context and Auto-Fixes to Human

**IMPORTANT: Show all context BEFORE asking for any decisions.** The human needs full visibility into the check report findings, research results, and classification before being asked to choose.

### 4a: Show the check report summary

Print the parsed check report summary table (from Step 2) so the human can see the starting state:

```
## Check Report Summary (Issue #<NUMBER>)

| Check | Result | Details |
|-------|--------|---------|
| Usefulness | ✅ Pass | ... |
| Non-trivial | ✅ Pass | ... |
| Correctness | ⚠️ Warn | ... |
| Well-written | ⚠️ Warn | ... |
```

For each `Fail` or `Warn` result, include the key details from the check report's detailed section (not just the one-liner — include the specific sub-issues identified).

### 4b: Show research results

If web searches, `pred show` lookups, or other research was performed during classification (Step 2–3), present those findings now. For example:
- Web search results that confirm or contradict references
- `pred show` output for source/target problems
- Companion issue status (exists / missing)

This ensures the human has all the evidence before any decisions.

### 4c: Show auto-fixes and substantive issues

Print a summary of all mechanical fixes applied:

Expand All @@ -179,12 +209,13 @@ Print a summary of all mechanical fixes applied:
| 1 | Size Overhead | Symbol `m` undefined | Added ... |
```

Then present the substantive issues that need discussion:
Then list the substantive issues that need discussion:

```
## Issues requiring your input

1. **Decision vs optimization:** ...
2. **Reference accuracy:** ...
```

---
Expand All @@ -193,10 +224,11 @@ Then present the substantive issues that need discussion:

For each substantive issue, present it to the human **one at a time**:

1. State the problem clearly
2. Offer 2-3 concrete options when possible (with your recommendation)
3. Wait for the human's response
4. Apply the chosen fix to the draft issue body
1. **Show the evidence first** — quote the relevant check report section, web research results, or `pred show` output that informs this decision. The human should be able to evaluate the options based on the evidence shown, not just the option labels.
2. State the problem clearly
3. Offer 2-3 concrete options when possible (with your recommendation)
4. Wait for the human's response
5. Apply the chosen fix to the draft issue body

Use web search if needed to help resolve issues:
- Literature search for correct complexity bounds
Expand Down
17 changes: 17 additions & 0 deletions .claude/skills/write-model-in-paper/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,22 @@ caption: [Caption describing the figure with key parameters],
) <fig:problem-example>
```

#### Reproducibility Commands

Add a `pred-commands()` block after the `*Example.*` paragraph and before the `#figure`. Commands are constructed dynamically from loaded example data:

```typst
#pred-commands(
"pred create --example <ALIAS> -o <name>.json",
"pred solve <name>.json",
"pred evaluate <name>.json --config " + x.optimal_config.map(str).join(","),
)
```

Where `<ALIAS>` is the shortest alias for the problem (e.g., `MIS`, `MVC`, `SAT`). Use the bare alias when the default variant matches the loaded example; use the full variant path (e.g., `MIS/SimpleGraph/i32`) when a non-default variant is needed. Check `pred list` for available aliases.

For satisfaction problems, replace `pred solve` with `pred solve <name>.json --solver brute-force` if the problem has no ILP reduction path.

**For graph problems**, use the paper's existing graph helpers:
- `petersen-graph()`, `house-graph()` or define custom vertex/edge lists
- `canvas(length: ..., { ... })` with `g-node()` and `g-edge()`
Expand Down Expand Up @@ -189,4 +205,5 @@ make paper
- [ ] **Evaluation shown**: objective/verifier computed on the example solution
- [ ] **Diagram included**: figure with caption and label for graph/matrix/set visualization
- [ ] **Paper compiles**: `make paper` succeeds without errors
- [ ] **Pred commands present**: `pred-commands()` block after example text, before figure, with create/solve/evaluate pipeline
- [ ] **Complexity consistency**: written complexity and auto-generated variant table are compatible (note any discrepancies for later review)
25 changes: 25 additions & 0 deletions .claude/skills/write-rule-in-paper/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ Detailed by default. Only use a brief example for trivially obvious reductions (
example: true,
example-caption: [Description ($n = ...$, $|E| = ...$)],
extra: [
#pred-commands(
"pred create --example <ALIAS> -o <name>.json",
"pred reduce <name>.json --to " + target-spec(src_tgt) + " -o bundle.json",
"pred solve bundle.json",
"pred evaluate <name>.json --config " + src_tgt_sol.source_config.map(str).join(","),
)

// Optional: graph visualization
#{
// canvas code for graph rendering
Expand All @@ -163,6 +170,23 @@ Detailed by default. Only use a brief example for trivially obvious reductions (
)
```

### 4a2. Reproducibility Commands

Add a `pred-commands()` block at the top of the `extra:` content, before any data display or visualization. Commands are constructed dynamically from loaded example data:

```typst
#pred-commands(
"pred create --example <SOURCE_ALIAS> -o <source>.json",
"pred reduce <source>.json --to " + target-spec(src_tgt) + " -o bundle.json",
"pred solve bundle.json",
"pred evaluate <source>.json --config " + src_tgt_sol.source_config.map(str).join(","),
)
```

Where `<SOURCE_ALIAS>` is the shortest alias for the source problem (e.g., `MVC`, `MIS`, `SAT`). Use the bare alias when the default variant matches; use the full variant path (e.g., `MIS/SimpleGraph/i32`) when a non-default variant is needed. Check `pred list` for available aliases.

The `target-spec()` helper handles empty variant dicts automatically. The `--config` is composed from `src_tgt_sol.source_config`.

### 4b. Step-by-Step Content

Each step should:
Expand Down Expand Up @@ -232,6 +256,7 @@ make paper
- [ ] **Example uses JSON data**: concrete values come from `load-example`/`load-results`, not hardcoded
- [ ] **Solution verified**: at least one solution checked end-to-end in the example
- [ ] **Witness semantics**: text treats `solutions.at(0)` as the canonical witness; any multiplicity claim is derived mathematically, not from fixture length
- [ ] **Pred commands present**: `pred-commands()` block at top of example with create/reduce/solve/evaluate pipeline
- [ ] **Paper compiles**: `make paper` succeeds without errors
- [ ] **Completeness check**: no new warnings about missing edges in the paper

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ claude-output.log
docs/test-reports/
docs/superpowers/
*.log
docs/src/reductions/*.json
docs/src/reductions/*.json
.claude/projects/
Loading
Loading