Skip to content

Commit 1883011

Browse files
committed
Merge branch 'main' of github.com:CodingThrust/problem-reductions
2 parents 81fe03f + de6757f commit 1883011

20 files changed

+1193
-534
lines changed

.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ make compare # Generate and compare Rust mapping exports
3333
make jl-testdata # Regenerate Julia parity test data (requires julia)
3434
make cli # Build the pred CLI tool (release mode)
3535
make cli-demo # Run closed-loop CLI demo (exercises all commands)
36+
make mcp-test # Run MCP server tests (unit + integration)
3637
make run-plan # Execute a plan with Claude autorun
3738
make release V=x.y.z # Tag and push a new release (CI publishes to crates.io)
3839
```

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Cargo.lock
66

77
# Developer-specific Claude Code settings
88
.claude/settings.local.json
9+
.claude/mcp.json
910

1011
# IDE
1112
.idea/

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ endif
144144
git push origin main --tags
145145
@echo "v$(V) pushed — CI will publish to crates.io"
146146

147-
# Build the pred CLI tool
147+
# Build and install the pred CLI tool
148148
cli:
149-
cargo build -p problemreductions-cli --release
149+
cargo install --path problemreductions-cli
150150

151151
# Generate Rust mapping JSON exports for all graphs and modes
152152
GRAPHS := diamond bull house petersen

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,22 @@ See the [Getting Started](https://codingthrust.github.io/problem-reductions/gett
4444

4545
## MCP Server (AI Integration)
4646

47-
The `pred` CLI includes a built-in [MCP](https://modelcontextprotocol.io/) server for AI assistant integration:
47+
The `pred` CLI includes a built-in [MCP](https://modelcontextprotocol.io/) server for AI assistant integration (Claude Code, Cursor, Windsurf, OpenCode, etc.).
48+
49+
Add to your client's MCP config file:
4850

4951
```json
5052
{"mcpServers": {"problemreductions": {"command": "pred", "args": ["mcp"]}}}
5153
```
5254

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

5564
## Contributing
5665

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# MCP Prompts Redesign: Task-Oriented Prompts
2+
3+
## Problem
4+
5+
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.
6+
7+
## Design
8+
9+
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.
10+
11+
### Prompt Inventory
12+
13+
| # | Name | Arguments | User question it answers |
14+
|---|------|-----------|--------------------------|
15+
| 1 | `what_is` | `problem` (req) | "What is MaxCut?" |
16+
| 2 | `model_my_problem` | `description` (req) | "I have a scheduling problem — what maps to it?" |
17+
| 3 | `compare` | `problem_a` (req), `problem_b` (req) | "How do MIS and Vertex Cover relate?" |
18+
| 4 | `reduce` | `source` (req), `target` (req) | "Walk me through reducing MIS to QUBO" |
19+
| 5 | `solve` | `problem_type` (req), `instance` (req) | "Solve this graph for maximum independent set" |
20+
| 6 | `find_reduction` | `source` (req), `target` (req) | "What's the cheapest path from SAT to QUBO?" |
21+
| 7 | `overview` | *(none)* | "Show me the full problem landscape" |
22+
23+
### Prompt Texts
24+
25+
#### 1. `what_is`
26+
27+
**Description:** Explain a problem type: what it models, its variants, and how it connects to other problems
28+
29+
```
30+
Explain the "{problem}" problem to me.
31+
32+
What does it model in the real world? What are its variants (graph types,
33+
weight types)? What other problems can it reduce to, and which problems
34+
reduce to it?
35+
36+
Give me a concise summary suitable for someone encountering this problem
37+
for the first time, then show the technical details.
38+
```
39+
40+
#### 2. `model_my_problem`
41+
42+
**Description:** Map a real-world problem to the closest NP-hard problem type in the reduction graph
43+
44+
```
45+
I have a real-world problem and I need help identifying which NP-hard
46+
problem type it maps to.
47+
48+
Here's my problem: "{description}"
49+
50+
Look through the available problem types in the reduction graph and
51+
identify which one(s) best model my problem. Explain why it's a good fit,
52+
what the variables and constraints map to, and suggest how I could encode
53+
my specific instance.
54+
```
55+
56+
#### 3. `compare`
57+
58+
**Description:** Compare two problem types: their relationship, differences, and reduction path between them
59+
60+
```
61+
Compare "{problem_a}" and "{problem_b}".
62+
63+
How are they related? Is there a direct reduction between them, or do they
64+
connect through intermediate problems? What are the key differences in
65+
what they model? If one can be reduced to the other, what is the overhead?
66+
```
67+
68+
#### 4. `reduce`
69+
70+
**Description:** Step-by-step reduction walkthrough: create an instance, reduce it, solve it, and map the solution back
71+
72+
```
73+
Walk me through reducing a "{source}" instance to "{target}", step by step.
74+
75+
1. Find the reduction path and explain the overhead.
76+
2. Create a small, concrete example instance of "{source}".
77+
3. Reduce it to "{target}" and show what the transformed instance looks like.
78+
4. Solve the reduced instance.
79+
5. Explain how the solution maps back to the original problem.
80+
81+
Use a small example so I can follow each transformation by hand.
82+
```
83+
84+
#### 5. `solve`
85+
86+
**Description:** Create and solve a problem instance, showing the optimal solution
87+
88+
```
89+
Create a {problem_type} instance with these parameters: {instance}
90+
91+
Solve it and show me:
92+
- The problem instance details (size, structure)
93+
- The optimal solution and its objective value
94+
- Why this solution is optimal (briefly)
95+
```
96+
97+
#### 6. `find_reduction`
98+
99+
**Description:** Find the best reduction path between two problems, with cost analysis
100+
101+
```
102+
Find the best way to reduce "{source}" to "{target}".
103+
104+
Show me the cheapest reduction path and explain the cost at each step.
105+
Are there alternative paths? If so, compare them — which is better for
106+
small instances vs. large instances?
107+
```
108+
109+
#### 7. `overview`
110+
111+
**Description:** Explore the full landscape of NP-hard problems and reductions in the graph
112+
113+
```
114+
Give me an overview of the NP-hard problem reduction landscape.
115+
116+
How many problem types are registered? What are the major categories
117+
(graph, SAT, optimization)? Which problems are the most connected hubs?
118+
Which problems can reach the most targets through reductions?
119+
120+
Summarize the structure so I understand what's available and where to
121+
start exploring.
122+
```
123+
124+
## Scope
125+
126+
- **Changed:** `problemreductions-cli/src/mcp/prompts.rs` (prompt definitions)
127+
- **Changed:** `problemreductions-cli/src/mcp/tests.rs` (prompt tests)
128+
- **Unchanged:** All 10 MCP tools, tool handlers, server infrastructure
129+
130+
## Testing
131+
132+
- Unit tests: verify `list_prompts` returns 7 prompts with correct names/arguments
133+
- Unit tests: verify `get_prompt` returns correct message text for each prompt
134+
- Integration test: call each prompt via JSON-RPC and verify response structure

0 commit comments

Comments
 (0)