feat: editable system task prompts (#636)#795
Merged
Conversation
Extracts hardcoded AI prompts from 4 system tasks into a configurable template framework. Prompts are stored as overrides in wp_options with automatic fallback to defaults. Each prompt declares its template variables so users know what placeholders are available. Tasks refactored: AltTextTask (1 prompt), MetaDescriptionTask (1), InternalLinkingTask (1), DailyMemoryTask (2 — daily_summary and memory_cleanup). Adds REST endpoints (GET/PUT/DELETE) at /system/tasks/prompts and CLI subcommands (prompts, prompt-get, prompt-set, prompt-reset) to SystemCommand. Closes #636
Homeboy Results —
|
Removes chubes.net-specific guidance from the default prompt (PR histories, version number rules, Lessons Learned sprawl) and replaces with principle-driven language that works for any site. The old specific guidance is now set as a site-level override on chubes.net via the prompt override system.
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
Makes all AI prompts in system tasks editable — users can override defaults via REST API or CLI without touching PHP code.
SystemTaskbase class:getPromptDefinitions(),resolvePrompt(),interpolatePrompt(),buildPromptFromTemplate(), plus static CRUD methods for overrides stored inwp_optionsAltTextTask—generatepromptMetaDescriptionTask—generatepromptInternalLinkingTask—insert_linkpromptDailyMemoryTask—daily_summary+memory_cleanupprompts/datamachine/v1/system/tasks/prompts— GET (list all), GET/PUT/DELETE per task/promptwp datamachine system—prompts,prompt-get,prompt-set,prompt-resetHow it works
Each task declares prompts with
getPromptDefinitions()— key, label, description, default template, and{{variable}}descriptions. At runtime,resolvePrompt()checks for a user override indatamachine_task_promptsoption, falls back to the default.interpolatePrompt()replaces{{variable}}placeholders with runtime values.Override storage:
wp_optionskeydatamachine_task_prompts→[task_type][prompt_key] => string. Empty string removes the override (reverts to default).Testing
All endpoints and CLI commands tested on live site:
wp datamachine system prompts— lists all 5 prompts across 4 taskswp datamachine system prompt-get <task> <key>— shows effective prompt with override statuswp datamachine system prompt-set <task> <key> "..."— sets override, verified in subsequent getwp datamachine system prompt-reset <task> <key>— clears override, reverts to defaulthomeboy build data-machine)Closes #636