maximus Posted February 16 Posted February 16 Export your ProcessWire site structure as comprehensive, AI-optimized documentation for ChatGPT, Claude, Copilot, and other AI coding assistants. What It Does Context automatically generates complete documentation of your ProcessWire site in formats specifically optimized for working with AI: π Site Structure Complete page hierarchy exported as JSON, TOON, and ASCII tree Shows all relationships, templates, URLs, and metadata Smart collapsing for large page lists π Templates & Fields All template definitions with complete field configurations Field types, options, requirements, default values Special handling for Repeater, Matrix, Table fields π¦ Content Samples Real page examples exported for each template Shows actual data formats and field usage Helps AI understand your content patterns πΎ Code Snippets Customized selector patterns for your site type Helper functions and utility code API implementation examples π€ AI Prompts Ready-to-use project context file Template creation prompts Debugging assistance prompts Dual Format Export (The Game Changer!) Context exports in two formats simultaneously: JSON Format Standard format for development tools, APIs, and compatibility TOON Format (AI-Optimized) β¨ Token-Oriented Object Notation designed specifically for AI prompts: 30-60% fewer tokens than JSON Significantly reduces API costs Same data, more compact representation No external dependencies - pure PHP Real Savings Example For a typical ProcessWire site with 50 templates: structure.json (15,000 tokens) β structure.toon (8,500 tokens) = 43% savings templates.json (8,000 tokens) β templates.toon (4,000 tokens) = 50% savings samples/*.json (12,000 tokens) β samples/*.toon (6,500 tokens) = 46% savings Cost Impact (Claude Sonnet pricing): JSON export: $0.105 per AI interaction TOON export: $0.057 per AI interaction Save ~$5/month if you use AI assistants 100 times/month Installation cd /site/modules/ git clone https://github.com/mxmsmnv/Context.git Then in admin: Modules β Refresh β Install Or download from ProcessWire Modules Directory Quick Start Setup β Modules β Context β Configure Choose your site type (Blog, E-commerce, Business, Catalog, Generic) β Enable "Export TOON Format" (recommended for AI work!) Enable optional features: β Export Content Samples β Create Code Snippets β Create AI Prompts Click "Export Context for AI" Files appear in /site/assets/context/ Generated Files /site/assets/context/ βββ README.md # Complete documentation βββ structure.json / .toon # Page hierarchy βββ structure.txt # ASCII tree βββ templates.json / .toon # All templates & fields βββ config.json / .toon # Site configuration βββ modules.json / .toon # Installed modules βββ classes.json / .toon # Custom Page classes β βββ samples/ # Real content examples β βββ product-samples.json β βββ product-samples.toon # 46% smaller! β βββ snippets/ # Code patterns β βββ selectors.php # Customized for your site type β βββ helpers.php # Utility functions β βββ api-examples.php # REST API examples β βββ prompts/ # AI instructions βββ project-context.md # Complete project overview Using with AI Assistants Upload TOON files to save tokens and costs: π structure.toon π templates.toon π prompts/project-context.md Then ask your AI assistant: "Help me create a blog post template with title, body, author, categories, and featured image. Follow the existing patterns from templates.toon" The AI has complete context of your site and can generate code that follows your exact patterns! Site Type Customization Code snippets automatically adapt to your site type: Blog / News / Magazine Post listings, author archives, category filtering Recent posts, popular content, related articles E-commerce / Online Store Product listings, cart logic, order processing Inventory management, payment integration Business / Portfolio / Agency Service pages, team members, case studies Testimonials, project galleries Catalog / Directory / Listings Brand hierarchies, category filters Advanced search, sorting, pagination Generic / Mixed Content General purpose patterns for any site type Features Overview Always Exported (Core) β Complete page tree structure β All templates with field definitions β Site configuration and settings β Installed modules list β Custom Page classes β README with complete documentation Optional (Configurable) βοΈ Content samples (1-10 per template) βοΈ API JSON schemas βοΈ URL routing structure βοΈ Performance metrics βοΈ Code snippets library βοΈ AI prompt templates βοΈ IDE integration files (.cursorrules, .claudecode.json) Advanced Settings Auto-update on template/field changes Maximum tree depth (3-20 levels) JSON children limit (prevent huge files) Compact mode for large lists Custom AI instructions Why TOON Format? TOON is specifically designed for AI prompts. Here's the difference: JSON (verbose): { "products": [ {"id": 1, "title": "Dark Chocolate", "price": 12.99}, {"id": 2, "title": "Milk Chocolate", "price": 9.99} ] } TOON (compact): products[2]{id,title,price}: 1,Dark Chocolate,12.99 2,Milk Chocolate,9.99 Same data, 50% fewer tokens! Use Cases π€ AI-Assisted Development Upload your site context to Claude/ChatGPT and get code that follows your exact patterns π Developer Onboarding New team members get complete site documentation instantly π Site Migration Export complete site structure for documentation or migration planning π Code Standards Maintain consistency across your team with AI that knows your patterns π° Cost Optimization Reduce AI API costs by 30-60% with TOON format Links GitHub: https://github.com/mxmsmnv/Context TOON Format Spec: https://toonformat.dev Screenshots Spoiler Example Workflow Export your site Click one button, get complete documentation in both JSON and TOON formats Upload to AI Upload .toon files to Claude/ChatGPT for maximum efficiency Build features faster AI knows your exact site structure, templates, and patterns Save money Use 30-60% fewer tokens on every AI interaction Perfect for ProcessWire developers who use AI coding assistants! The TOON format support makes it significantly more cost-effective to work with Claude, ChatGPT, and similar tools. Questions? Suggestions? Let me know! π 5 4
szabesz Posted March 10 Posted March 10 Thanks @maximusΒ for sharing. I am testing the module, and found two issues: 1. After the module has been installed the "Submit" button of its settings page must be clicked or else the actual settings are not the same as seen in the GUI. By default, a lot of "Module Configuration" settings seems to be turned on (their checkboxes are on), like "TOON Format Export", "Content Samples", ect. but they are not on. I had to manuallyΒ "Submit" the settings so that the module settings are actually the same as seen on the module config page. 2. InΒ Context.module.php $matrixTypes = $matrixField->type->getMatrixTypes($matrixField); foreach($matrixTypes as $mt) { Β Β if($mt->name === $name) { But $mt->name is meaningless asΒ $matrixTypes is the following kind of array: array 'matrix_email_block_image' => 1 'matrix_email_block_button' => 3 'matrix_email_block_text' => 4 'matrix_email_block_spacer' => 5 $mt->name is an attempt to access the name property of an integer. And that happens in two locations:
maximus Posted March 11 Author Posted March 11 Thanks for the detailed bug report! Both issues are fixed in v1.1.5: getMatrixTypes() error - Fixed array iteration (was treating integers as objects) Default settings - Added __construct() to apply defaults on install The module is now available on GitHub. Please update and let me know if everything works correctly. 2
szabesz Posted March 11 Posted March 11 (edited) Thank you @maximusΒ I checked both issues and they are indeed resolved. I wonder if you use Tracy Debugger for the admin? It is easy to spot warnings if it always runs, which is the case for me almost all the time. Sometimes, I disable it when I need unmodified HTML in the browser, but after that I reenable it. BTW, could you make the /site/assets/context path configurable? I recently tested PHPStorm with Junie by adding to its .junie directory what @interrobangΒ shared with us: https://processwire.com/talk/topic/29439-cursor-might-be-my-vscode-replacement/#findComment-251674 Specifically: https://github.com/phlppschrr/processwire-knowledge-base/tree/master I adjusted the rootΒ SKILL.md (removed references to Python scripts and such) and Junie can pick up all skills perfectly. If I could set the module to generate files to /.junie/skills/docs, the Junie agent would start using them too.Β That would be real magic :) Edited March 11 by szabesz typo 1
maximus Posted March 12 Author Posted March 12 Yes, of course. I use it on all projects. Maybe not so deep, but I try to avoid red mistakes. regarding the custom path, yes, you can do that by the way. I think this will add flexibility to the module. 1
rastographics Posted March 14 Posted March 14 @maximusΒ Just came here to say this is super cool! I saw this in the Processwire Weekly newsletter and couldn't have found it at a better time for what I'm trying to do. This is gold. 1
maximus Posted March 14 Author Posted March 14 On 3/12/2026 at 1:17 AM, szabesz said: How? Update: v1.1.6 is now released with configurable export path! You can now set custom paths in module settings as you requested: Setup β Modules β Context β Configure β Export Path For Junie AI integration: .junie/skills/docs Important for CloudPanel/Nginx users: Since .htaccess doesn't work on Nginx, I recommend using an absolute path outside web root for maximum security: /home/lqrs/context-exports/ The module now detects absolute paths (starting with /) and uses them as-is. 2
psy Posted March 21 Posted March 21 Hi @maximus Loving your Context module! One small change request. My sites use custom, nested, vanilla CSS. There's no option in the stack (or I've missed it?). It defaults to 'Tailwind'. My workaround is to override the Tailwind setting in the extra comments. Be nice to have that option in the module config. Keep up the great work! Β 1
maximus Posted March 21 Author Posted March 21 Thanks for the feedback! Done in v1.1.7! π You can now manually select your CSS framework in module settings: Setup β Modules β Context β Configure β CSS Framework Options: Auto-detect (default) Tailwind CSS Bootstrap UIkit Vanilla CSS / Custom β your use case None This will generate more accurate code examples and snippets for AI, specifically tailored to your vanilla CSS setup instead of assuming Tailwind. 3 1
psy Posted Thursday at 11:01 PM Posted Thursday at 11:01 PM Hi @maximus Hit a red warning when trying to export field definitions for FieldtypeQRCode. This fieldtype usesΒ FieldtypeQRCode.info.php instead of getModuleInfo() inside the module. Fix inΒ exportFieldDefinitions line 1928: // 'label' => $field->type->getModuleInfo()['title'] ?? $className, 'label' => method_exists($field->type, 'getModuleInfo') ? $field->type->getModuleInfo()['title'] : $className, HTH 1
psy Posted yesterday at 09:00 AM Posted yesterday at 09:00 AM This module is great for establishing the rules for AI. Something I needed was a way to continue the narrative between sessions. Here's what my AI suggested as a prompt: Β Spoiler Create a structured project checkpoint summary. Output MUST follow this exact format and headings. Use short bullet points only. No paragraphs. ## Project (one line) ## 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: site/assets/cache/context/prompts/project-summary.md Overwrite the file. Do not add any extra commentary outside the file contents. That way I can close an IDE session and use both Context prompts and project-summary.md to bring the AI up to date. 1
szabesz Posted yesterday at 09:56 AM Posted yesterday at 09:56 AM Turns out, I started using Cline in PHPStorm instead of Junie. I used up all credits β that came with Junie's trial period β in no time. However, that was not enough time to decide if Junie is worth the money or not. My main issue was that I want to use agent Skills, but Junie is still in "beta" state in that regard and it has no useful documentation on its Skills feature either. Being new to coding with AI agents, I do not want to spend money on something I do not have enough time to play with in advance. So I looked for alternatives, and found the Cline plugin (extension), and sort of fell in love with it at first sight :D I have a z.ai subscription (GLM Coding Lite-Yearly Plan) which was cheap thanks to last year's Black Friday deal (thanks toΒ @wbmnfktrΒ for mentioning z.ai to me)Β and the GLM-5.x models are pretty good (https://docs.z.ai/guides/llm/glm-5#coding-performance-on-par-with-claude-opus-4-5) so theΒ Cline +Β GLM-5.x combo works well, cheap and is relatively easy to get started with. My subscription has a "5 Hours Usage Quota" and the maximum I used it so far was only 6% percent in a 5-hour coding session, giving me plenty of room for a lot more usage. So this setup is cheap and powerful, I "just" need to develop my own Skills library, on which I already started to work on. (BTW,Β JetBrains IDEs do support 3rd party LLM providers, but z.ai has a non-standard BASE URL, and the IDE does not support that which is a shame. It fails just because of that.) Anyway, thanks to the output path being configurable in the settings of Contex, I pointed it toΒ .agents/skills (that's where Cline saves its files, contrary to Cline's official doc page which is erroneously states it is [~/].cline/skills), so now the module generates files intoΒ .agents/skills/context. So far so good, but a Skill to be used properly by the agent needs a proper SKILL.md file too. At least that is my understanding. So I vibe coded a BASH script to generateΒ SKILL.md for me, I just need to run it after each Context generation process, and I get the following inΒ .agents/skills/context/SKILL.mdΒ : Β Spoiler Β --- name: context description: Provides comprehensive context about the current ProcessWire project structure, fields, modules, and API snippets. Use this skill when the user asks about project structure, available fields, or specific implementation details of the current site. --- # context This skill provides a structured snapshot of the current ProcessWire project configuration. Use the provided resources to answer user queries accurately. ## Steps 1. Analyze the user's request to determine the specific context needed (e.g., templates, fields, routes). 2. Locate the relevant resource file in the **Resources** section below. 3. Read the content of the resource file to retrieve the necessary data. 4. Formulate the answer based strictly on the provided context. ## Resources The following files contain the project context: - **[config.json](./config.json)**: Site configuration - **[matrix-templates.json](./matrix-templates.json)**: Repeater Matrix field types (if ProFields installed) - **[modules.json](./modules.json)**: Installed modules with versions - **[README.md](./README.md)**: Source documentation and directory structure. - **[structure.json](./structure.json)**: Complete page tree (JSON) - **[structure.txt](./structure.txt)**: Page tree visualization (ASCII) - **[templates.csv](./templates.csv)**: Templates export in CSV format - **[templates.json](./templates.json)**: All templates with field definitions - **[metadata](metadata/)**: Technical metadata Β - **[field-definitions.json](metadata/field-definitions.json)**: Detailed field information Β - **[routes.json](metadata/routes.json)**: URL routing structure - **[snippets](snippets/)**: Code library Β - **[api-examples.php](snippets/api-examples.php)**: API implementation examples Β - **[helpers.php](snippets/helpers.php)**: Utility functions Β - **[selectors.php](snippets/selectors.php)**: Selector patterns for your site type I am not sure this is the best SKILL.md content but the LLM suggested this and it aligns with Cline's recommendation (after I asked the model to make it align...), so I started using/testing it. @maximusΒ I wonder if you could add support for optionally generating SKILL.md, too. The issue with SKILL.md files is that agents seem to have certain preferences regarding their content (ie. the format of the information is presented in them), so maybe a template-based approach could be adopted. I am just brainstorming here as I have no specific idea about how such a template option could be implemented.Β Thanks in advance for considering. 1
maximus Posted 23 hours ago Author Posted 23 hours ago Context Module v1.1.8 Released! Thanks everyone for the great feedback! Here's what's new: New Features SKILL.md Auto-Generation (requested by @szabesz) Automatically generates SKILL.md for AI coding agents (Cline, Junie, etc.) Lists all exported files with descriptions and usage examples Follows Cline/MCP skill format specification Enable/disable in module settings (enabled by default) Project Summary Template (suggested by @psy) Auto-creates prompts/project-summary.md template Helps AI agents maintain context between coding sessions Structured format: project state, decisions, issues, next steps Ask AI to update at end of each session for seamless continuity Setup for AI Agents: Cline (PHPStorm/VSCode): Set export path to .agents/skills/context/ Junie (PHPStorm): Set export path to .junie/skills/docs/ Re-export and SKILL.md + project-summary.md are auto-created Bug Fixes FieldtypeQRCode Compatibility (reported by @psy) Fixed error when exporting field definitions for FieldtypeQRCode Added method_exists() check before calling getModuleInfo() Now works with all fieldtypes using .info.php pattern Documentation Added Best Practices section to README covering: AI coding agents setup (Cline, Junie) Session continuity workflow File upload strategies for optimal token usage Download: GitHub Thanks @szabesz and @psyΒ for the excellent suggestions! 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now