# sokoban-solver

> Push-optimal Sokoban solver using room decomposition and BFS to solve complex spatial puzzles.

sokoban-solver is a paid AI agent skill on Agensi by Haiyang Lan, in Game Development. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Haiyang Lan](https://www.agensi.io/creators/haiyang-lan)
- Category: [Game Development](https://www.agensi.io/skills/game-development)
- Version: 1.0
- Last updated: 2026-11-24
- Security: scan passed (2026-11-24); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/sokoban-solver
- Tags: gaming, typescript, algorithms, pathfinding, puzzles

## About this skill

Solving Sokoban levels optimally is a PSPACE-complete problem that quickly exhausts memory and compute. This skill provides a specialized engine that handles complex spatial reasoning to find the minimum-push path to victory. It uses room decomposition and state pruning to stay efficient.

### What it does
- **Room decomposition** splits the map into navigable sectors to reduce the search space.
- **Push-optimal BFS** executes a breadth-first search specifically optimized for the fewest number of pushes.
- **Deadlock pruning** detects freeze states where boxes become unmovable, halting dead-end paths early.
- **Reachability checks** verify player movement between push points without re-simulating every step.
- **Standard notation** exports solutions in standard LURD/lurd format, distinguishing between walks and pushes.

### How it works
1. **Prepare input** by placing level text files in the standard Sokoban format into the input directory.
2. **Execute solver** by running the TypeScript engine via Node.js with the specified environment variables.
3. **Analyze states** as the engine performs room-based BFS and prunes deadlocks.
4. **Collect solutions** from the output directory, where each level receives a specific solution string.

### Frameworks & tools
This skill is built with TypeScript and designed for Node 22. It relies exclusively on the standard library, requiring no external NPM dependencies or network access.

### Why this beats prompting it yourself
LLMs struggle with the high-dimensional state space and long-term planning required for Sokoban. This engine uses discrete algorithmic search and pruning logic that outperforms raw probabilistic prompting on all 105 graded competition levels.

### Use cases
- **Game development** to verify level solvability during the design phase.
- **Benchmark testing** for pathfinding and spatial reasoning algorithms.
- **Puzzle verification** to ensure user-submitted levels have valid, optimal solutions.

### Known limitations
Limited to 2,000,000 states per room. Levels exceeding this complexity cap may return an empty solution file.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the sokoban-solver skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific problem does the Sokoban Solver solve?

This skill solves the PSPACE-complete problem of Sokoban puzzles by finding the path with the minimum number of pushes. It uses room decomposition and deadlock pruning to navigate complex spatial states that standard AI models typically struggle to calculate.

### Which AI agents or frameworks is this skill compatible with?

The skill is a standalone TypeScript engine designed for Node.js 22 and can be integrated into any AI agent workflow that supports local code execution. It uses no external dependencies, ensuring compatibility with secure, offline environments.

### What assets are included in the purchase of this skill?

You will receive the complete TypeScript source code, a comprehensive README with setup instructions, and sample level files to test the engine. The package is ready for immediate deployment in your local development environment.

### What format does the solver use for the final solution strings?

Solutions are exported in standard LURD/lurd format, where lowercase letters represent a move and uppercase letters represent a push. This format is the industry standard for Sokoban, making it easy to import results into game engines or level viewers.

### Are there any technical limitations I should be aware of before purchasing?

The solver is limited to 2,000,000 states per room to prevent memory overflow; if a puzzle exceeds this complexity, it will return an empty solution file. It is specifically optimized for push-optimality rather than move-optimality or pure speed.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
