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
1 change: 1 addition & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ make compare # Generate and compare Rust mapping exports
make jl-testdata # Regenerate Julia parity test data (requires julia)
make cli # Build the pred CLI tool (release mode)
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 release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
```
Expand Down
8 changes: 7 additions & 1 deletion .claude/skills/review-implementation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ Read the implementation files and assess:
3. **Example quality** -- Is it tutorial-style? Does it use the instance from the issue? Does the JSON export include both source and target data?
4. **Paper quality** -- Is the reduction-rule statement precise? Is the proof sketch sound? Is the example figure clear?

### Code Quality Principles (applies to both Models and Rules):
1. **DRY (Don't Repeat Yourself)** -- Is there duplicated logic that should be extracted into a shared helper, utility function, or common module? Check for copy-pasted code blocks across files (e.g., similar graph construction, weight handling, or solution extraction patterns). If duplication is found, suggest extracting shared logic.
2. **KISS (Keep It Simple, Stupid)** -- Is the implementation unnecessarily complex? Look for: over-engineered abstractions, convoluted control flow, premature generalization, or layers of indirection that add no value. The implementation should be as simple as possible while remaining correct and maintainable.

## Output Format

Present results as:
Expand All @@ -119,7 +123,9 @@ Present results as:
### Semantic Review
- evaluate() correctness: OK
- dims() correctness: OK
- [any issues found]
- DRY compliance: OK / [duplicated logic found in ...]
- KISS compliance: OK / [unnecessary complexity found in ...]
- [any other issues found]

### Summary
- X/Y structural checks passed
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Cargo.lock

# Developer-specific Claude Code settings
.claude/settings.local.json
.claude/mcp.json

# IDE
.idea/
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ endif
git push origin main --tags
@echo "v$(V) pushed — CI will publish to crates.io"

# Build the pred CLI tool
# Build and install the pred CLI tool
cli:
cargo build -p problemreductions-cli --release
cargo install --path problemreductions-cli

# Generate Rust mapping JSON exports for all graphs and modes
GRAPHS := diamond bull house petersen
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@ See the [Getting Started](https://codingthrust.github.io/problem-reductions/gett

## MCP Server (AI Integration)

The `pred` CLI includes a built-in [MCP](https://modelcontextprotocol.io/) server for AI assistant integration:
The `pred` CLI includes a built-in [MCP](https://modelcontextprotocol.io/) server for AI assistant integration (Claude Code, Cursor, Windsurf, OpenCode, etc.).

Add to your client's MCP config file:

```json
{"mcpServers": {"problemreductions": {"command": "pred", "args": ["mcp"]}}}
```

See the [MCP documentation](https://codingthrust.github.io/problem-reductions/mcp.html) for available tools, prompts, and configuration details.
| Client | Config file |
|--------|------------|
| Claude Code / Desktop | `.mcp.json` or `~/.claude/mcp.json` |
| Cursor | `.cursor/mcp.json` |
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
| OpenCode | `opencode.json` (use `{"mcp": {"problemreductions": {"type": "local", "command": ["pred", "mcp"]}}}`) |

See the [MCP documentation](https://codingthrust.github.io/problem-reductions/mcp.html) for available tools, prompts, and full configuration details.

## Contributing

Expand Down
134 changes: 134 additions & 0 deletions docs/plans/2026-02-22-mcp-prompts-redesign-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# MCP Prompts Redesign: Task-Oriented Prompts

## Problem

The current 3 MCP prompts (`analyze_problem`, `reduction_walkthrough`, `explore_graph`) are tool-centric — they list which tools to call rather than expressing what the user wants to accomplish. This makes them disconnected from how researchers, students, and LLM agents actually think about reductions.

## Design

Replace the 3 existing prompts with 7 task-oriented prompts. All prompt text frames requests as user questions. No tool names appear in prompt text — the LLM decides which tools to call.

### Prompt Inventory

| # | Name | Arguments | User question it answers |
|---|------|-----------|--------------------------|
| 1 | `what_is` | `problem` (req) | "What is MaxCut?" |
| 2 | `model_my_problem` | `description` (req) | "I have a scheduling problem — what maps to it?" |
| 3 | `compare` | `problem_a` (req), `problem_b` (req) | "How do MIS and Vertex Cover relate?" |
| 4 | `reduce` | `source` (req), `target` (req) | "Walk me through reducing MIS to QUBO" |
| 5 | `solve` | `problem_type` (req), `instance` (req) | "Solve this graph for maximum independent set" |
| 6 | `find_reduction` | `source` (req), `target` (req) | "What's the cheapest path from SAT to QUBO?" |
| 7 | `overview` | *(none)* | "Show me the full problem landscape" |

### Prompt Texts

#### 1. `what_is`

**Description:** Explain a problem type: what it models, its variants, and how it connects to other problems

```
Explain the "{problem}" problem to me.

What does it model in the real world? What are its variants (graph types,
weight types)? What other problems can it reduce to, and which problems
reduce to it?

Give me a concise summary suitable for someone encountering this problem
for the first time, then show the technical details.
```

#### 2. `model_my_problem`

**Description:** Map a real-world problem to the closest NP-hard problem type in the reduction graph

```
I have a real-world problem and I need help identifying which NP-hard
problem type it maps to.

Here's my problem: "{description}"

Look through the available problem types in the reduction graph and
identify which one(s) best model my problem. Explain why it's a good fit,
what the variables and constraints map to, and suggest how I could encode
my specific instance.
```

#### 3. `compare`

**Description:** Compare two problem types: their relationship, differences, and reduction path between them

```
Compare "{problem_a}" and "{problem_b}".

How are they related? Is there a direct reduction between them, or do they
connect through intermediate problems? What are the key differences in
what they model? If one can be reduced to the other, what is the overhead?
```

#### 4. `reduce`

**Description:** Step-by-step reduction walkthrough: create an instance, reduce it, solve it, and map the solution back

```
Walk me through reducing a "{source}" instance to "{target}", step by step.

1. Find the reduction path and explain the overhead.
2. Create a small, concrete example instance of "{source}".
3. Reduce it to "{target}" and show what the transformed instance looks like.
4. Solve the reduced instance.
5. Explain how the solution maps back to the original problem.

Use a small example so I can follow each transformation by hand.
```

#### 5. `solve`

**Description:** Create and solve a problem instance, showing the optimal solution

```
Create a {problem_type} instance with these parameters: {instance}

Solve it and show me:
- The problem instance details (size, structure)
- The optimal solution and its objective value
- Why this solution is optimal (briefly)
```

#### 6. `find_reduction`

**Description:** Find the best reduction path between two problems, with cost analysis

```
Find the best way to reduce "{source}" to "{target}".

Show me the cheapest reduction path and explain the cost at each step.
Are there alternative paths? If so, compare them — which is better for
small instances vs. large instances?
```

#### 7. `overview`

**Description:** Explore the full landscape of NP-hard problems and reductions in the graph

```
Give me an overview of the NP-hard problem reduction landscape.

How many problem types are registered? What are the major categories
(graph, SAT, optimization)? Which problems are the most connected hubs?
Which problems can reach the most targets through reductions?

Summarize the structure so I understand what's available and where to
start exploring.
```

## Scope

- **Changed:** `problemreductions-cli/src/mcp/prompts.rs` (prompt definitions)
- **Changed:** `problemreductions-cli/src/mcp/tests.rs` (prompt tests)
- **Unchanged:** All 10 MCP tools, tool handlers, server infrastructure

## Testing

- Unit tests: verify `list_prompts` returns 7 prompts with correct names/arguments
- Unit tests: verify `get_prompt` returns correct message text for each prompt
- Integration test: call each prompt via JSON-RPC and verify response structure
Loading