<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.comfac.net/index.php?action=history&amp;feed=atom&amp;title=PAD-Driven_ERPNext_Strategy_260303</id>
	<title>PAD-Driven ERPNext Strategy 260303 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.comfac.net/index.php?action=history&amp;feed=atom&amp;title=PAD-Driven_ERPNext_Strategy_260303"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.comfac.net/index.php?title=PAD-Driven_ERPNext_Strategy_260303&amp;action=history"/>
	<updated>2026-06-05T10:00:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mediawiki.comfac.net/index.php?title=PAD-Driven_ERPNext_Strategy_260303&amp;diff=204&amp;oldid=prev</id>
		<title>Justinaquino: &quot;Add Inter-Company SOP, Team Roles Memo, and PAD ERPNext Strategy&quot;</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.comfac.net/index.php?title=PAD-Driven_ERPNext_Strategy_260303&amp;diff=204&amp;oldid=prev"/>
		<updated>2026-03-20T10:32:20Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;Add Inter-Company SOP, Team Roles Memo, and PAD ERPNext Strategy&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= PAD-Driven ERPNext Implementation Strategy for Comfac IT =&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Date:&amp;#039;&amp;#039;&amp;#039; 3 March 2026&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Drastically improve the speed of implementation, configuration, and deployment in Frappe ERPNext for the Comfac IT team using Procedural Agentic Development (PAD) tools (e.g., OpenCode, ClaudeCode).&lt;br /&gt;
&lt;br /&gt;
== 1. Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Current State:&amp;#039;&amp;#039;&amp;#039; Implementation and configuration of Frappe/ERPNext are traditionally slow, requiring deep domain knowledge of both the business processes and the proprietary Frappe framework.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Objective:&amp;#039;&amp;#039;&amp;#039; Drastically improve the speed of implementation, configuration, and deployment in Frappe ERPNext for the Comfac IT team using PAD tools.&lt;br /&gt;
&lt;br /&gt;
== 2. Definition of Terms ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Term !! Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;PAD&amp;#039;&amp;#039;&amp;#039; (Procedural Agentic Development) || A workflow utilizing autonomous AI coding agents (e.g., OpenCode, ClaudeCode) to automate software development, configuration, and deployment. The process involves the agent continuously referencing a strict set of inputs — the PRD, System Prompt (SP), Notes, and Knowledge Base (KB) — to generate configurations or code. The user reviews the output and provides feedback (logged into Notes), creating an iterative, self-correcting loop that requires minimum human supervision to achieve the final target state.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;PRD&amp;#039;&amp;#039;&amp;#039; (Product Requirements Document) || A clear, human-readable document defining the business logic, required features, and specifications for a given customization.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;SP&amp;#039;&amp;#039;&amp;#039; (System Prompt) || The precise, technical instructions fed to the AI agent detailing exactly how to execute the PRD within the target environment.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Frappe Framework&amp;#039;&amp;#039;&amp;#039; || The underlying low-code, metadata-driven Python/JavaScript web framework that powers ERPNext.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;ERPNext&amp;#039;&amp;#039;&amp;#039; || The open-source enterprise resource planning suite built on the Frappe framework.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Frappe Cloud&amp;#039;&amp;#039;&amp;#039; || The managed Platform-as-a-Service (PaaS) hosting environment used to deploy and manage Frappe/ERPNext instances.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Bench&amp;#039;&amp;#039;&amp;#039; || The essential command-line utility (CLI) used to manage Frappe environments, install custom apps, and run database migrations.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;DocType&amp;#039;&amp;#039;&amp;#039; || The core building block in the Frappe ecosystem; it simultaneously represents a database table, a user interface web form, and its associated business logic.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Fixtures&amp;#039;&amp;#039;&amp;#039; || A Frappe mechanism used to export database-level configurations (like Custom Fields, Property Setters, and Workflows) into JSON files so they can be version-controlled in a Git repository.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 3. The PAD Workflow Methodology ==&lt;br /&gt;
&lt;br /&gt;
Every configuration or customization task is governed by the following four-pillar workflow, all documented and stored in the Comfac IT MediaWiki:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Pillar !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;#039;&amp;#039;&amp;#039;PRD&amp;#039;&amp;#039;&amp;#039; (Product Requirements Document) || Defines the business logic, required DocType changes, workflows, and print formats.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;#039;&amp;#039;&amp;#039;Knowledge Base&amp;#039;&amp;#039;&amp;#039; (Context) || Structured Markdown documentation of Frappe&amp;#039;s architecture, specific module logic, and Comfac&amp;#039;s historical implementation data. This is the &amp;quot;brain&amp;quot; fed to the AI.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;#039;&amp;#039;&amp;#039;System Prompt&amp;#039;&amp;#039;&amp;#039; (SP) || The exact instructions fed to the PAD agent detailing the Frappe-specific technical execution (e.g., &amp;quot;Using the attached Knowledge Base, create a custom app, add these fields via custom script, export fixtures&amp;quot;).&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;#039;&amp;#039;&amp;#039;Notes&amp;#039;&amp;#039;&amp;#039; (Feedback &amp;amp; Challenges) || The iterative log of what the agent got wrong, Frappe CLI (bench) errors, and workflow refinements to improve the next System Prompt and update the Knowledge Base.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 4. Core Concept: &amp;quot;Ansible for Frappe&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
Instead of humans clicking through the ERPNext UI to configure settings, create custom fields, or define workflows, the PAD toolset acts as an orchestration engine.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Target State Definition:&amp;#039;&amp;#039;&amp;#039; Using the PAD workflow to define a target state (e.g., &amp;quot;Company A needs Manufacturing and HR modules configured with X approval workflows&amp;quot;).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Agentic Execution:&amp;#039;&amp;#039;&amp;#039; The PAD SSHs into the environment, interacts with the bench CLI, or uses the Frappe REST API to mutate the system to match the target state.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Scalability:&amp;#039;&amp;#039;&amp;#039; Existing successful PAD workflows become reusable modules, allowing the Comfac IT team to rapidly deploy pre-configured &amp;quot;industry templates&amp;quot; to new Frappe Cloud sites.&lt;br /&gt;
&lt;br /&gt;
== 5. Critical Feedback &amp;amp; Predicted Problems ==&lt;br /&gt;
&lt;br /&gt;
=== A. Frappe Architecture Challenges (File vs. Database State) ===&lt;br /&gt;
&lt;br /&gt;
==== 1. The Metadata Trap ====&lt;br /&gt;
In Frappe, when you add a Custom Field or change a workflow via the UI, it saves to the database, not the codebase. If the PAD tries to act like Ansible and just writes Python/JSON files, the system will not recognize the changes.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; The PAD must be instructed to use Custom Apps and Fixtures. The agent must make changes, run &amp;lt;code&amp;gt;bench export-fixtures&amp;lt;/code&amp;gt;, and commit the resulting JSON files to Git.&lt;br /&gt;
&lt;br /&gt;
==== 2. Idempotency Issues ====&lt;br /&gt;
Ansible&amp;#039;s superpower is idempotency (running it 10 times results in the same state as running it once). Agents executing Python scripts or API calls often lack this. If a PAD agent runs a script to &amp;quot;create a Custom Field,&amp;quot; running it twice might throw an &amp;lt;code&amp;gt;IntegrityError&amp;lt;/code&amp;gt; (duplicate column).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; The PAD must wrap all configuration code in &amp;quot;Check before Execute&amp;quot; logic (e.g., &amp;lt;code&amp;gt;if not frappe.db.exists(&amp;#039;Custom Field&amp;#039;, ...): create_field()&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== B. Frappe Cloud Specific Constraints ===&lt;br /&gt;
&lt;br /&gt;
==== 1. Direct SSH Limitations ====&lt;br /&gt;
Frappe Cloud is a managed PaaS. Direct, persistent root/SSH access to live-edit files is heavily restricted to prevent drift between container orchestration and the site.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; Do not have the PAD &amp;quot;live-edit&amp;quot; production via SSH. Instead, have the PAD clone the custom app repository locally, write the code/fixtures, commit to GitHub/GitLab, and trigger a webhook to Frappe Cloud to rebuild and deploy the image.&lt;br /&gt;
&lt;br /&gt;
==== 2. bench migrate Downtime ====&lt;br /&gt;
Every time the PAD pushes a configuration change that alters the database schema, Frappe Cloud will run &amp;lt;code&amp;gt;bench migrate&amp;lt;/code&amp;gt;. If the PAD pushes micro-changes continuously, the site will experience frequent micro-downtimes.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; Batch PAD operations. The workflow should compile a complete &amp;quot;Configuration Release&amp;quot; before pushing to Frappe Cloud.&lt;br /&gt;
&lt;br /&gt;
=== C. PAD (Agentic) Limitations ===&lt;br /&gt;
&lt;br /&gt;
==== 1. Context Window Overwhelm ====&lt;br /&gt;
ERPNext is a massive monolith. If you tell an agent to &amp;quot;understand how customizing configuration impacts the system,&amp;quot; it will drown in millions of lines of code.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; Restrict the PAD&amp;#039;s operational scope using the specific Knowledge Base files from the MediaWiki (e.g., only provide the documentation for the &amp;lt;code&amp;gt;erpnext/manufacturing&amp;lt;/code&amp;gt; module).&lt;br /&gt;
&lt;br /&gt;
==== 2. Hallucinating Frappe APIs ====&lt;br /&gt;
Frappe has very specific ORM methods (&amp;lt;code&amp;gt;frappe.get_doc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;doc.insert()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;frappe.db.get_value&amp;lt;/code&amp;gt;). LLMs often hallucinate standard Django or SQLAlchemy syntax instead.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mitigation:&amp;#039;&amp;#039;&amp;#039; System Prompts must explicitly reference the MediaWiki &amp;quot;Frappe Cheat Sheet,&amp;quot; enforcing the correct ORM syntax and bench commands.&lt;br /&gt;
&lt;br /&gt;
== 6. Strategic Roadmap for Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Phase 0: Research and Context Mapping (The Foundation) ===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Action:&amp;#039;&amp;#039;&amp;#039; Clone the Frappe and ERPNext GitHub repositories locally.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Mapping:&amp;#039;&amp;#039;&amp;#039; Have an initial LLM parse and organize the repository logic (DocTypes, Controllers, Hooks) into AI- and human-readable Markdown files.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Education (Local Llama):&amp;#039;&amp;#039;&amp;#039; Load this mapped context into a local LLM (e.g., Llama 3). Use this instance to translate complex Frappe architecture into simple explanations for non-IT students and Comfac staff.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;MediaWiki Deployment:&amp;#039;&amp;#039;&amp;#039; Upload all generated PRD templates, System Prompts, Notes, and Knowledge Base Markdown files to the Comfac IT team&amp;#039;s MediaWiki as the central &amp;quot;source of truth&amp;quot; for all future PAD operations.&lt;br /&gt;
&lt;br /&gt;
=== Phase 1: Frappe Cloud Experiments &amp;amp; Change Detection (The Sandbox) ===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Action:&amp;#039;&amp;#039;&amp;#039; Setup a sandbox/test instance on Frappe Cloud.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Detection:&amp;#039;&amp;#039;&amp;#039; Perform manual configurations via the UI. Use the PAD to detect the underlying database or JSON changes (diffing the system state).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Instruction Validation:&amp;#039;&amp;#039;&amp;#039; Test the reverse workflow. Write System Prompts giving the PAD instructions to replicate those detected changes programmatically. Update the Notes and Knowledge Base in MediaWiki based on success or failure.&lt;br /&gt;
&lt;br /&gt;
=== Phase 2: The API Configurator (The &amp;quot;Ansible&amp;quot; MVP) ===&lt;br /&gt;
* Instead of SSH and CLI, use the Frappe REST API.&lt;br /&gt;
* Write PAD workflows that authenticate via API and send JSON payloads to configure basic things (e.g., System Settings, Company setup, Item Groups). The API naturally handles a lot of the database/state validation that SSH/CLI bypassing might miss.&lt;br /&gt;
&lt;br /&gt;
=== Phase 3: The Custom App Generator ===&lt;br /&gt;
* Task the PAD with scaffolding actual Frappe Custom Apps based on MediaWiki PRDs.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Workflow:&amp;#039;&amp;#039;&amp;#039; PRD specifies a new feature → PAD reads Knowledge Base &amp;amp; SP → Generates the &amp;lt;code&amp;gt;doctype.json&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;doctype.py&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;doctype.js&amp;lt;/code&amp;gt; files → Commits to Git → Deploys to Frappe Cloud.&lt;br /&gt;
&lt;br /&gt;
=== Phase 4: Full CI/CD Agentic Deployment ===&lt;br /&gt;
* Integrate test data. The PAD deploys a configuration, injects test data (e.g., creates 10 dummy Sales Invoices), and runs an automated script to verify the workflow behaves as expected. If it fails, the error goes back to the &amp;quot;Notes&amp;quot; section of the MediaWiki to trigger a self-correction loop.&lt;br /&gt;
&lt;br /&gt;
== Related Pages ==&lt;br /&gt;
&lt;br /&gt;
* [[Proceedural Agentic Development Methodology 260304]] — Broader PAD methodology for systematic agent use&lt;br /&gt;
* [[Project OpenCoder: AI Independence Initiative]] — Strategic roadmap for manufacturing intelligence&lt;br /&gt;
* [[Architecture and Structure Comfac ERPN Loc]] — Comfac ERPNext architecture and localization&lt;br /&gt;
* [[Frappe Links and References]] — Frappe/ERPNext reference documentation&lt;br /&gt;
* [[Memo: Team Roles &amp;amp; Reporting Process Clarification 260320]] — IT automation responsibilities aligned with this strategy&lt;br /&gt;
* [[Claude Code Isolation and Burner Workflow 260211]] — Secure AI development environment used in PAD workflows&lt;/div&gt;</summary>
		<author><name>Justinaquino</name></author>
	</entry>
</feed>