Agent files: admin-authored docs that customise agent behaviour#71
Merged
Conversation
Adds an `openclawp_agent_file` CPT and a wp-admin → openclaWP → Agent files surface for authoring markdown documents (AGENTS.md, SOUL.md, BOOTSTRAP.md, …) that customise agent behaviour without touching PHP. Files target a specific agent via the `agent_slug` meta, or apply globally when that meta is empty. The new submenu is hide-when-empty (PR #68 pattern) and the Discover panel (PR #69) picks up the new surface automatically through the shared `OpenclaWP_Admin_Menu_Visibility::surface_count()` helper. A follow-up PR will wire the file contents into the runtime prompt assembler so the agent actually reads them — this PR ships the CPT + admin UI first so admins can start authoring while the runtime side bakes (TODO note in the store class header). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds an
openclawp_agent_fileCPT and a wp-admin → openclaWP → Agent files surface for authoring markdown documents that customise agent behaviour without touching PHP. Files can target a specific agent (via theagent_slugmeta) or apply globally.OpenclaWP_Agent_Files_Storeregisters the CPT and exposes the read API.OpenclaWP_Agent_Files_Adminprovides the list + edit pages, hide-when-empty in the sidebar (PR wp-admin: hide-when-empty submenu items #68 pattern).OpenclaWP_Admin_Menu_Visibility::surface_count()helper.Follow-up (NOT in this PR)
Why
Today the only way to shape an agent's behaviour is to register it via PHP (
wp_register_agent). Authors who aren't comfortable with PHP have no path. This CPT is that path — author markdown, save, and (once the runtime is wired) the agent picks it up.Test plan
🤖 Generated with Claude Code