AI for Sugar Devs is a deterministic, agent-agnostic system for generating installable, upgrade-safe SugarCRM Module Loadable Packages (MLPs) using AI.
Designed for Sugar developers, it automates module generation while enforcing Extension Framework compliance, upgrade safety, and deterministic outputs.
You're reading the right file! This is the entry point for developers like you.
Review the workflow diagram and examples below to understand the complete process.
Choose your feature type from the examples and feature list below.
Choose your feature type from /prompts/:
- prompts/logic_hook.md β Logic hooks
- prompts/custom_field.md β Simple custom fields
- prompts/custom_field_type.md β Complex field types
- prompts/relationship.md β Relationships
- prompts/rest_endpoint.md β REST endpoints
- prompts/scheduler.md β Scheduled jobs
- prompts/ui_customization.md β UI customizations
- prompts/pack_php.md β Pack.php generation
- prompts/external_resource_client.md β HTTP requests
- prompts/feature_request_format.md β Request format
Use the format from prompts/feature_request_format.md and the examples below.
Give the AI agent your formatted feature request. It will generate a complete package.
cd build/<PackageName>
php pack.php 1.0.0
# Install the zip via Module Loader in SugarsequenceDiagram
participant Human as π€ Developer (You)
participant Docs as π Documentation
participant AI as π€ AI Agent
participant Build as π¦ Build Output
participant Sugar as π¬ SugarCRM
Human->>Docs: 1. Read README.md
Docs-->>Human: Overview & Complete Workflow
Human->>Docs: 2. Review Examples Below
Docs-->>Human: Feature Examples & Specifications
Human->>Docs: 3. Read prompts/<feature_type>.md
Docs-->>Human: Complete Specifications
Human->>AI: 4. Submit Feature Request
Note over AI: Reads AGENTS.md<br/>(Execution Contract)
AI->>Docs: Consult prompts/<feature_type>.md
Docs-->>AI: Feature Specifications
AI->>Docs: Consult reference/master_reference.md
Docs-->>AI: SugarCRM Extension Framework
AI->>Build: 5. Generate Package
Note over Build: build/<PackageName>/<br/>src/, pack.php,<br/>version, releases/
AI-->>Human: Output Raw File Entries
Human->>Build: 6. Run: php pack.php 1.0.0
Build-->>Human: sugarcrm-<PackageName>-1.0.0.zip
Human->>Sugar: 7. Install via Module Loader
Sugar-->>Human: β
Package Installed
- You write feature request
- You read relevant prompt (or quick reference)
- You prompt AI with your request
- AI generates package in
build/<PackageName>/ - You test with:
php build/<PackageName>/pack.php - You install zip in Sugar via Module Loader
Need templates to get started? Check the examples/ folder for copy/paste feature requests:
- examples/01_logic_hook_webhook.md β Send webhook when account is saved
- examples/02_custom_field_varchar.md β Add custom text field
- examples/03_relationship_many_to_many.md β Link modules together
- examples/04_rest_endpoint_api.md β Create REST API endpoint
Option 1: Use the structured format from examples
Feature Type: Custom Field
Module: Accounts
Field Name: customer_priority
Field Type: varchar
Label: Customer Priority
Package Name: Acme_AccountsPriority
Option 2: Describe in natural language
"A custom varchar field named customer_priority is added to the Accounts module under the package Test_AccountsCustomField, labeled "Customer Priority," and designed as a highlight field that allows users to choose background and foreground colors in Studio."
Both work equally well! Use whichever format feels more natural for your request.
Want to contribute your own? See examples/README.md to add examples for other feature types!
- β Review the workflow diagram and examples above
- β Choose your feature type from the examples
- β
Read
prompts/<feature_type>.mdfor complete specifications - β
Follow the format from
prompts/feature_request_format.md - β Prompt the AI with your formatted request
- β
Test with
php build/<PackageName>/pack.php - β Install via Module Loader in Sugar
- Generate full MLPs: Logic Hooks, Custom Fields, Relationships, REST Endpoints, Scheduler Jobs, UI Customizations
- Extension Framework only β no core overrides
- Self-contained per-package builds in
/build/<PackageName>/ - Production-ready
pack.phpper package - Deterministic output β raw file entries, upgrade-safe, ready for Module Loader
- Agent-agnostic β works with Claude, Copilot, ChatGPT, Codex, etc.
Each generated feature lives in an isolated directory:
/build/<PackageName>/
src/ # All Sugar files (Extension Framework only)
pack.php # Executable package builder
version # Version file
releases/ # Generated zip output
Running the package builder:
cd build/<PackageName>
php pack.php 1.0.0Produces:
build/<PackageName>/releases/sugarcrm-<PackageName>-1.0.0.zip
Ready for Module Loader installation in Sugar.
README.md β YOU ARE HERE (complete guide for humans)
βββ AGENTS.md β Technical contract (for AI agents, not humans)
βββ prompts/
βββ feature_request_format.md .... How to format your request
βββ [11 feature-specific specs]
β βββ logic_hook.md ........... Logic hook specifications
β βββ custom_field.md ......... Simple field specifications
β βββ custom_field_type.md .... Complex field type specifications
β βββ relationship.md ......... Relationship specifications
β βββ rest_endpoint.md ........ REST endpoint specifications
β βββ scheduler.md ............ Scheduler specifications
β βββ ui_customization.md ..... UI customization specifications
β βββ feature_generator.md .... Master generation prompt
β βββ pack_php.md ............ Pack.php generation
β βββ external_resource_client.md HTTP request handling
βββ reference/
βββ README.md ........................... Reference guide
βββ master_reference.md ................ Complete SugarCRM specs
βββ sugar_developer_guide_25.2_md/ .... Official SugarCRM documentation
AI agents: Read AGENTS.md for the binding execution contract.
This document specifies:
- Mandatory directory structure
- Required file formats
- Extension Framework compliance rules
- pack.php specifications
- Output format requirements
- Quality assurance checklist
- No embedded Sugar Developer Guide content
- Deterministic file output format
Upload the full repository to your AI coding agent (Claude, Copilot, ChatGPT, Codex, etc.).
Use the structured format defined in /prompts/feature_request_format.md.
Example Feature Requests & Updates
Read and follow AGENTS.md strictly.
Read and follow prompts/feature_generator.md strictly.
No explanations. No markdown. Output raw file entries only.
Feature Type: Logic Hook
Module: Accounts
Trigger: after_save
Condition:
field: account_type = 'Customer' or
field: account_type = 'Prospect'
Action:
type: webhook
method: POST
url: https://webhooks.com/mywebhook
payload: full bean
extract the response if http 200 log the result and return 'myresponse'
Package Name: Custom_AccountsCustomerWebhook
Feature Type: Custom Field
Module: Accounts
Field Name: customer_priority
Field Type: varchar
Label: Customer Priority
Package Name: OOTB_AccountsCustomField
Feature Type: REST Endpoint
Module: Contacts
Endpoint: /custom/contacts/summary
Method: GET
Action: return summary of contact activity
Package Name: OOTB_ContactsSummaryEndpoint
Feature Type: Logic Hook
Module: Accounts
Trigger: after_save
Condition:
field: account_status
equals: Active
Action:
type: webhook
method: POST
url: https://webhooks.com/active-customer
payload: full bean
Package Name: OOTB_AccountsCustomerWebhook
Update: true
Update Workflow:
- Increment
/versionin the package directory. - Submit feature request with
Update: true. - AI generates only the new/modified files.
- Run
php pack.php <version>to produce new zip. - Upload via Module Loader β upgrade-safe.
After AI generates the package:
cd build/<PackageName>
php pack.php 1.0.0This produces the installable zip in:
build/<PackageName>/releases/sugarcrm-<PackageName>-1.0.0.zip
Upload the generated zip via Admin β Module Loader.
Install β fully upgrade-safe, no manual corrections required.
/AGENTS.md # Execution rules and standards
/prompts/
feature_request_format.md # Deterministic AI input schema
feature_generator.md # Generation instructions (CRITICAL - read first)
pack_php.md # Pack.php generation rules (CRITICAL - prevents pack.php mistakes)
external_resource_client.md # ExternalResourceClient usage guide (CRITICAL - HTTP requests)
logic_hook.md # Logic hook generation
custom_field.md # Custom field generation
relationship.md # Relationship generation
rest_endpoint.md # REST endpoint generation
scheduler.md # Scheduler job generation
ui_customization.md # UI customization generation
compliance_review.md # Compliance checking
/templates/minimal_mlp/
pack.stub.php # Reference pack.php template (see pack_php.md)
/build/ # Generated packages live here
/output/ # Optional staging of zips
/reference/ # Sugar Developer Guide (never included in output)
/README.md
/LICENSE
AGENTS.mdβ Authoritative execution contractprompts/feature_generator.mdβ Generation rulesprompts/pack_php.mdβ Pack.php generation (prevents static array mistakes)prompts/external_resource_client.mdβ HTTP requests (prevents getInstance() errors)
| Step | Command / Action | Notes |
|---|---|---|
| Upload repo to AI | β | Any agent: Claude, Copilot, ChatGPT, Codex |
| Submit feature request | See structured format | Include Update: true for updates |
| Check output | /build/<PackageName>/src/, pack.php, version |
All files deterministic and Extension Framework only |
| Build zip | cd build/<PackageName>php pack.php 1.0.0 |
Version file determines zip |
| Install | Module Loader β Upload zip | Upgrade-safe, no manual corrections |
| Update package | Increment version Submit feature request with Update: true |
Only new files generated; old files remain intact |
Supported Feature Types: Logic Hooks, Custom Fields, Relationships, REST Endpoints, Scheduler Jobs, UI Customizations
AI can generate Sugar code, but without structure it produces inconsistent and unsafe packages.
This system ensures:
- Extension Framework purity
- Upgrade safety by contract
- Deterministic builds β reproducible, testable packages
- Stateless, parallelizable execution
It transforms AI from a code assistant into a controlled, production-ready Sugar MLP compiler.