Export your ProcessWire site structure as AI-optimized context for ChatGPT, Claude, and other AI assistants.
Context automatically generates comprehensive documentation of your ProcessWire site in formats optimized for AI assistants. Export in both JSON (standard) and TOON (AI-optimized) formats.
Perfect for:
/site/classes/.cursorrules and .claudecode.json filesCode snippets are automatically customized for your site type:
/site/assets/context/ directorycd /site/modules/
git clone https://github.com/mxmsmnv/Context.git
Then refresh modules in admin and install.
/site/modules/Context/Setup → Modules → Context → Configure
Click “Re-Export Context for AI” or visit:
/processwire/module/?name=Context
Files are generated in: /site/assets/context/
Upload these files to your AI assistant:
For AI Development (Recommended - Use TOON):
structure.toon - Complete page hierarchy (30-60% smaller!)templates.toon - All templates and fields (optimized)config.toon - Site configurationprompts/project-context.md - Complete project overviewFor Development Tools (Use JSON):
structure.json - Standard JSON formattemplates.json - For IDE pluginsclasses.json - Custom Page classesExample prompt:
I've uploaded my ProcessWire site context in TOON format.
Please help me create a new template for blog posts with
title, body, author, and categories fields. Follow the
existing patterns in templates.toon.
/site/assets/context/
├── README.md # Documentation with format guide
├── SKILL.md # AI agent skill definition (for Cline, Junie, etc.)
├── tree.json # Complete site structure (templates + fields + pages)
├── tree.toon # Complete site structure (TOON - AI optimized!)
├── structure.json # Page tree (JSON)
├── structure.toon # Page tree (TOON - AI optimized!)
├── structure.txt # ASCII tree visualization
├── templates.json # Templates (JSON)
├── templates.toon # Templates (TOON - AI optimized!)
├── templates.csv # Templates in CSV
├── matrix-templates.json # Repeater Matrix types (ProFields) - if installed
├── matrix-templates.toon # Repeater Matrix types (TOON) - if installed
├── config.json # Configuration (JSON)
├── config.toon # Configuration (TOON)
├── modules.json # Installed modules (JSON)
├── modules.toon # Installed modules (TOON)
├── classes.json # Custom page classes (JSON)
├── classes.toon # Custom page classes (TOON)
│
├── samples/ # Content examples (optional)
│ ├── product-samples.json
│ └── product-samples.toon # AI-optimized samples!
├── api/ # API schemas (optional)
├── snippets/ # Code library (optional)
├── prompts/ # AI prompts (optional)
│ ├── project-context.md # Main project prompt
│ ├── create-template.md # Template creation guide
│ ├── create-api.md # API creation guide
│ ├── debug-issue.md # Debugging helper
│ └── project-summary.md # Session continuity template
└── metadata/ # Technical data (optional)
| File | JSON Size | TOON Size | Savings | Use For |
|---|---|---|---|---|
structure.* |
45 KB | 28 KB | ~38% | Page hierarchy |
templates.* |
12 KB | 6 KB | ~50% | Template definitions |
samples/* |
8 KB | 4 KB | ~50% | Content examples |
Tip: When uploading to AI, use .toon files to save tokens and reduce API costs!
TOON (Token-Oriented Object Notation) is a compact, human-readable format designed specifically for AI prompts. It represents the same data as JSON but uses 30-60% fewer tokens.
JSON (120 tokens):
{
"products": [
{
"id": 1045,
"title": "Dark Chocolate 70%",
"price": 12.99,
"category": "Dark"
},
{
"id": 1046,
"title": "Milk Hazelnut",
"price": 9.99,
"category": "Milk"
}
]
}
TOON (65 tokens - 46% savings!):
products[2]{id,title,price,category}:
1045,Dark Chocolate 70%,12.99,Dark
1046,Milk Hazelnut,9.99,Milk
Use TOON (.toon) for:
Use JSON (.json) for:
# Upload to Claude/ChatGPT (TOON format):
- structure.toon
- templates.toon
- samples/product-samples.toon
# Then ask:
"Create a product filter with price range, category, and brand
using the patterns from my site structure"
Result: Same quality response, but using 40% fewer tokens!
Share the /site/assets/context/ folder with new team members. They get:
# Upload (JSON format for technical work):
- api/schemas/product-schema.json
- snippets/api-examples.php
# Ask:
"Create a REST API endpoint for products with search and filtering"
# For big projects with lots of data:
- Use TOON format to fit more context in AI's window
- 100 products in JSON = ~15,000 tokens
- 100 products in TOON = ~7,000 tokens
- Difference: You can include 2x more examples!
Real savings example:
Your site: 50 templates, 500 pages to document
JSON export: ~85,000 tokens
TOON export: ~42,000 tokens
Savings: 43,000 tokens per prompt
With Claude Sonnet ($3 per million input tokens):
- JSON cost: $0.255 per prompt
- TOON cost: $0.126 per prompt
- Savings: $0.129 per prompt
If you use 100 prompts/month: Save ~$13/month
If you use 1000 prompts/month: Save ~$130/month
Enable Auto-Update on Changes to automatically regenerate context when you:
Hooks into:
Templates::savedFields::savedFieldgroups::saveReadyAuto-update exports both JSON and TOON formats if TOON export is enabled.
prompts/project-context.md - contains system instructions.toon files instead of .jsontemplates.toonstructure.toon or structure.txtsnippets/selectors.phpsamples/*-samples.toon.toon files to chat directly.toon files + specific sections/context/ folder.json files with IDEs and APIs.toon files alongside .json
Choose your site type to get customized code snippets:
.cursorrules, .claudecode.json/site/assets/context/site/assets/cache/context/ blocked in root .htaccess (Apache)/home/user/context-exports/ to store files outside web root (recommended for Nginx)/site/assets/cache/ (Apache only).htaccess auto-created as backup (Apache only)Server-Specific Setup:
Apache (HestiaCP, cPanel, etc.):
site/assets/cache/context/ works out of the boxNginx (CloudPanel, etc.):
/home/user/context-exports/location ~ ^/site/assets/cache/context/ {
deny all;
return 403;
}
Important: Update to v1.1.6+ for proper security. Versions < 1.1.6 used unprotected site/assets/context/ path.
/site/modules/Context//site/assets/cache/context/ (ProcessWire protected, Apache only)/home/user/context-exports/ (absolute path, outside web root - recommended)/site/modules/Context/ContextSnippets.phpsite/assets/cache/context/ - default, ProcessWire protected (Apache)/home/user/context-exports/ - absolute path outside web root (Apache + Nginx).junie/skills/docs - for Junie AI integration../../context-exports/ - relative path (two levels up)When TOON export is enabled, the module admin page shows a comparison table:
| File Type | JSON Size | TOON Size | Savings |
|---|---|---|---|
| structure | 45.2 KB | 27.8 KB | -38.5% |
| templates | 12.1 KB | 6.3 KB | -47.9% |
| config | 2.4 KB | 1.6 KB | -33.3% |
This helps you see the actual token/cost savings for your specific site!
Q: Do I need to install any external libraries for TOON support?
A: No! TOON conversion is built-in with pure PHP. No Composer packages or external dependencies required.
Q: Is TOON format lossless?
A: Yes! TOON contains exactly the same data as JSON, just in a more compact format. You can convert back and forth without any data loss.
Q: Which AI assistants support TOON?
A: Claude, ChatGPT, and most modern LLMs understand TOON natively. Just upload the .toon file as you would a .json file.
Q: Can I use both JSON and TOON formats?
A: Absolutely! Both formats are generated simultaneously. Use JSON for development tools and APIs, TOON for AI assistants.
Q: How much does TOON actually save?
A: Typically 30-60% fewer tokens. The exact savings depend on your data structure - uniform arrays see the biggest gains (up to 60%).
Q: Does TOON export slow down my site?
A: No. Export happens on-demand when you click the button, not on every page load. The TOON conversion adds < 0.5s to the export time.
Q: What if I disable TOON format later?
A: No problem! Simply uncheck “Export TOON Format” in settings. Your next export will only generate JSON files.
Q: Can I edit TOON files manually?
A: Yes, TOON files are plain text and human-readable. However, it’s easier to make changes in ProcessWire and re-export.
Q: Are there any file size limits?
A: TOON files follow the same limits as JSON. Both are text files with no artificial size restrictions.
Q: How do I view TOON files?
A: TOON files are plain text. Use any text editor. For syntax highlighting: VS Code/Cursor (install “TOON Language Support” extension) or PhpStorm (use YAML highlighting).
Q: Export failed with “permission denied”
A: Ensure /site/assets/ directory is writable by your web server user. Check file permissions (755 or 775).
Q: TOON files not being created
A: Check that “Export TOON Format” is enabled in module settings and you’ve clicked “Re-Export Context for AI” after enabling it.
Q: AI assistant doesn’t understand my TOON file
A: TOON is plain text - just upload it as you would any text file. Make sure the file has a .toon extension.
SKILL.md Auto-Generation
The module automatically generates SKILL.md for AI coding agents. This file helps agents understand how to use your ProcessWire context.
Setup for Cline (PHPStorm/VSCode):
.agents/skills/context/Setup for Junie (PHPStorm):
.junie/skills/docs/Problem: AI agents don’t remember previous sessions. Each new session starts from scratch.
Solution: Create a project checkpoint file at the end of each coding session.
Prompt template (suggested by @psy):
Create a structured project checkpoint summary.
Output MUST follow this exact format and headings. Use short bullet points only. No paragraphs.
## Project
(one line description)
## Current State
- ...
## Decisions Made
- ...
## Known Issues
- ...
## What We Tried
- ...
## Constraints
- ...
## Next Steps
1.
2.
3.
## Do NOT Do
- ...
Rules:
- Be concise and factual
- Do not explain reasoning unless critical
- Do not invent anything not discussed
- Prefer clarity over completeness
Save this as: [your-export-path]/prompts/project-summary.md
Overwrite the file.
Do not add any extra commentary outside the file contents.
Workflow:
prompts/project-summary.mdproject-summary.mdWhy this works:
project-summary.md provides session contextWhen working with AI assistants:
.toon files instead of .json for 30-60% token savingsSKILL.md first so AI understands available resourcesproject-summary.md for session continuityMIT License - see LICENSE file for details
Maxim Alex