AI agent: Add modification workflow, quality verification, and git safety#2820
Draft
lezama wants to merge 2 commits intoAutomattic:trunkfrom
Draft
AI agent: Add modification workflow, quality verification, and git safety#2820lezama wants to merge 2 commits intoAutomattic:trunkfrom
lezama wants to merge 2 commits intoAutomattic:trunkfrom
Conversation
… agent The AI agent currently only has a creation workflow — it builds sites from scratch but has no methodology for modifying existing sites. This adds: - A dedicated modification workflow that analyzes the existing site (theme.json, active plugins, content structure) before making changes - Git version control as safety checkpoints, enabling undo/revert - Quality verification steps (PHP error checking, site health, block validation) - Before/after screenshot comparison for visual regression detection - Corresponding guidance in the AGENTS.md template for external agents
Verify the new modification workflow, quality verification, git safety instructions, and that existing sections are preserved in both the system prompt and AGENTS.md template.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The AI agent's system prompt currently only covers building sites from scratch. When users ask to modify an existing site ("change the colors", "add a blog section", "install WooCommerce"), the agent has no methodology for understanding what's already there, making safe changes, or verifying it didn't break anything.
This PR adds three capabilities through prompt instructions alone — no new tools or dependencies:
theme.json, installed plugins, existing content structure, andstyle.csspatterns. It respects the existing design system rather than overriding it..gitignorefor Studio sites.debug.logfor PHP errors, verifies the site is responding, and validates block content — before taking final screenshots.Both the built-in
studio aiagent (viasystem-prompt.ts) and external agents like Claude Code or Cursor (via theAGENTS.mdtemplate) benefit from these changes.Changes
apps/cli/ai/system-prompt.ts— Split the single workflow into Creation and Modification workflows. Added Quality Verification section.tools/common/lib/agents-md.ts— Added Version Control and Quality Checks sections to the AGENTS.md template.How to test
npm install && npm run cli:buildstudio aiand create a site: "Create a site called test-cafe"theme.jsonand existing styles before making changesdebug.logfor errorsPre-merge Checklist
npx eslint --fixon changed files)npm run typecheck)npm test -- apps/cli/ai/tests/)studio ai