Compress an entire repository into one AI-ready file. Let the AI edit it. Restore it back into real code.
Quick Start · GUI Mode · CLI Mode · Restore Mode · Features
You want an LLM to understand your entire codebase. Today that means manually copy-pasting files, fighting token limits, and losing structure. And once the AI hands back new code — you're pasting it back in, file by file.
P2M turns that into one command in, one command out.
project/ ──▶ p2m --cli ──▶ context.md ──▶ 🤖 paste into Claude / GPT / Gemini
├─ src/ │
├─ config/ ▼
└─ ... ◀── p2m --restore ◀── ai_output.xml ◀── AI rewrites your project
No cloning, no building — run it instantly from anywhere.
🍎 macOS / Linux
curl -fsSL https://raw.githubusercontent.com/nematollahshojaei/project2markdown/main/install.sh | bash🪟 Windows (PowerShell)
irm https://raw.githubusercontent.com/nematollahshojaei/project2markdown/main/install.ps1 | iex🐹 Go installed (cross-platform)
go run github.com/nematollahshojaei/project2markdown/v2/cmd/p2m@latest --cliOnce installed, type
p2mto launch the Web UI, orp2m --clito generate context directly in your terminal. That's it.
Run p2m with no flags and a local Glassmorphism dashboard opens in your browser automatically. Built for people who'd rather click than type.
- 📊 Live metrics — tokens/sec, elapsed time, file count, all updating in real time
- 🗂️ Smart file explorer — browse local drives or drop in a remote GitHub URL
- 🎛️ One-click toggles — strip comments, strip empty lines, custom AI prompts, and Allow Sensitive Files
- 📂 Smart Output & Open Folder — Auto-routes read-only paths to
Documents/Project2Markdownand highlights the generated file in your OS natively.
For terminal-first developers. Every example below is copy-paste ready.
💡 Tip: Run
p2m --helpat any time to see the full list of available flags, options, and examples directly in your terminal.
Basic generation (Markdown output)
p2m --cliAdvanced minification — XML, comments & empty lines stripped
p2m --cli --format=xml --remove-comments --remove-empty-linesProcess a remote GitHub repo — no git clone needed
p2m --cli --remote=yamadashy/repomix --format=jsonInclude only specific files or folders
p2m --cli --include="*.go, src/, config.json"Specify output directory & allow sensitive files (.env, keys)
p2m --cli --output="./my_exports" --allow-secretsGot a full project back from an AI as one Markdown/XML/JSON file? Rebuild every file and folder in one shot.
p2m --restore=my_project_context.xml🛡️ Bulletproof Path Traversal Protection — Malicious or hallucinated paths (../../etc/passwd, C:\Windows, etc.) are mathematically blocked (LFI/RFI safe) before a single file is written, even on Root directories.
| ⚡ Concurrency Engine | Uses every CPU core via a worker pool — thousands of files processed in milliseconds |
| 🧠 Built-in Tokenizer | Zero-dependency heuristic tokenizer — accurate AI token counts, no heavy ML libs |
| 🌐 Remote Fetching | Point it at any public GitHub URL — no local clone required |
| 🤖 AI-Optimized Formats | Export as Markdown, XML (best for Claude), or JSON (best for APIs) |
| 🛡️ Universal Ignore Engine | Auto-respects .gitignore, .p4ignore, and .p2mignore. Safely redacts .env and private keys by default. |
| 🔒 Enterprise Security | Hardened against SSRF, ZipSlip, LFI/RFI, and Memory/Goroutine Leaks. |
| 📂 Smart Output Routing | Automatically redirects outputs from Read-Only directories to a safe Documents/Project2Markdown workspace. |
| 🎮 UE5-Native Parsing | Understands .uproject, .uplugin, .t3d, .usf, .ush — skips Saved, Intermediate, Binaries, DerivedDataCache |
Manual build instructions (for contributors)
1. Clone the repository
git clone https://github.com/nematollahshojaei/project2markdown.git
cd project2markdown2. Build the CLI edition
go build -ldflags="-s -w" -o p2m-cli ./cmd/p2m3. Build the GUI edition (Windows, hides the console window)
go build -ldflags="-s -w -H=windowsgui" -o p2m-gui.exe ./cmd/p2mReleased under the MIT License — free for personal and commercial use.
Developed with 💙 by Nematollah Shojaei Unreal Engine Technical Specialist & Software Engineer
🌐 Website · ✉️ Email · 💼 LinkedIn
⭐ If P2M saves you time, consider starring the repo — it genuinely helps.