Skip to content

Agent files: admin-authored docs that customise agent behaviour#71

Merged
lezama merged 1 commit into
mainfrom
feat/agent-files
May 19, 2026
Merged

Agent files: admin-authored docs that customise agent behaviour#71
lezama merged 1 commit into
mainfrom
feat/agent-files

Conversation

@lezama
Copy link
Copy Markdown
Owner

@lezama lezama commented May 19, 2026

Summary

Adds an openclawp_agent_file CPT 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 the agent_slug meta) or apply globally.

Follow-up (NOT in this PR)

  • Wire the file contents into the runtime prompt assembler so the agent actually reads them. The CPT + admin UI lands first so admins can start authoring while the runtime side bakes.

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

  • On a fresh install, the "Agent files" submenu is hidden (no files yet).
  • Create one file via the admin → the submenu appears.
  • The Discover panel on the Chat page picks up the new surface and shows "1 registered".
  • Delete all files → the submenu disappears again.
  • PHPUnit unit suite still passes.

🤖 Generated with Claude Code

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>
@lezama lezama merged commit 9ed4ed2 into main May 19, 2026
5 of 6 checks passed
@lezama lezama deleted the feat/agent-files branch May 19, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant