Skip to content

cli: unify datamachine agent / agents — one noun, one class#1174

Merged
chubes4 merged 1 commit intomainfrom
unify-agent-cli
Apr 23, 2026
Merged

cli: unify datamachine agent / agents — one noun, one class#1174
chubes4 merged 1 commit intomainfrom
unify-agent-cli

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 23, 2026

Closes #1172.

Summary

Realigns datamachine agent / datamachine agents with the project's singular/plural aliasing convention. Every other DM noun (flow/flows, pipeline/pipelines, post/posts, handler/handlers, job/jobs, block/blocks, step-type/step-types, processed-item/processed-items, setting/settings, log/logs, link/links) routes both forms to the same class. agent was the lone outlier, routing to MemoryCommand instead of the AgentsCommand that agents routes to.

Change

One-line swap in inc/Cli/Bootstrap.php:

-WP_CLI::add_command( 'datamachine agent', Commands\MemoryCommand::class );
+WP_CLI::add_command( 'datamachine agent', Commands\AgentsCommand::class );
 WP_CLI::add_command( 'datamachine agents', Commands\AgentsCommand::class );

-// Backwards-compatible alias: `wp datamachine memory` → agent.
+// Canonical home for agent memory-file operations.
 WP_CLI::add_command( 'datamachine memory', Commands\MemoryCommand::class );

Post-fix command map:

Command Routes to
wp datamachine agent <verb> AgentsCommand (new — aliased to plural)
wp datamachine agents <verb> AgentsCommand (unchanged)
wp datamachine memory <verb> MemoryCommand (unchanged — canonical home for memory ops)

Users can now reflexively type wp datamachine agent list, agent show, agent create — matching the muscle memory from every other noun — and get the expected dispatch instead of Error: 'list' is not a registered subcommand of 'datamachine agent'.

Breaking change

The singular memory-verb forms are gone:

wp datamachine agent read      → use wp datamachine memory read
wp datamachine agent write     → use wp datamachine memory write
wp datamachine agent search    → use wp datamachine memory search
wp datamachine agent paths     → use wp datamachine memory paths
wp datamachine agent sections  → use wp datamachine memory sections
wp datamachine agent compose   → use wp datamachine memory compose
wp datamachine agent daily ... → use wp datamachine memory daily ...
wp datamachine agent files ... → use wp datamachine memory files ...

Low blast radius per #1172's analysis: wp datamachine memory <verb> has been a registered alias for MemoryCommand since day one, so every caller has a stable replacement; the agent singular was never intuitive for memory ops (natural English is "agent's memory", not "agent read"); and external callers are small in number today.

Docs swept

  • README.md — discovery command updated
  • docs/overview.md — discovery command updated
  • docs/core-system/wp-cli.mdagent section renamed to memory, alias list updated, workflow example migrated
  • docs/core-system/wordpress-as-agent-memory.md — all path-discovery and memory-access snippets migrated (17 refs)
  • docs/core-system/daily-memory-system.md — daily-memory CLI section migrated (6 refs)
  • docs/core-system/ephemeral-workflows.md — stale reference fixed (agentchat)
  • inc/Cli/Commands/MemoryCommand.php — all 52 docblock examples + WP_CLI::error() usage strings migrated
  • inc/Engine/AI/ComposableFileInvalidation.php — comment updated

docs/CHANGELOG.md left untouched per repo convention (homeboy generates it at release time from git commits).

Acceptance criteria

  • wp datamachine agent list|create|show|delete|rename|access|config|export|import|token|cleanup-legacy-context-files route to AgentsCommand (aliased to plural)
  • wp datamachine agents ... continues to work unchanged
  • wp datamachine memory ... continues to work unchanged and is the canonical home for memory-file ops
  • README + doc references to wp datamachine agent <memory-verb> updated to wp datamachine memory <verb>
  • CHANGELOG left alone (generated from commit messages)

Commit message covers the breaking rename + points to the replacement; that becomes the user-facing changelog entry on release.

AI assistance

Realigns 'agent' with the project's singular/plural aliasing convention
(flow/flows, pipeline/pipelines, post/posts, handler/handlers, etc.).

Before:
  datamachine agent  → MemoryCommand
  datamachine agents → AgentsCommand
  datamachine memory → MemoryCommand

After:
  datamachine agent  → AgentsCommand (aliased to plural)
  datamachine agents → AgentsCommand (unchanged)
  datamachine memory → MemoryCommand (canonical home for memory ops)

Users can now reflexively type 'wp datamachine agent list' (like every
other DM noun) and get the expected AgentsCommand dispatch instead of
'Error: list is not a registered subcommand of datamachine agent'.

Breaking: 'wp datamachine agent <memory-verb>' (read, write, search,
paths, sections, compose, daily, files) no longer works — callers
migrate to 'wp datamachine memory <verb>', which has been a registered
alias for the same class since day one.

Docs + MemoryCommand docblocks/usage strings updated to use the
canonical 'wp datamachine memory' form throughout. Historical CHANGELOG
entries left untouched.

Closes #1172

AI assistance: Yes
Tool(s): Claude Code (Opus 4.7)
Used for: drafted the Bootstrap.php swap, swept doc references from
'wp datamachine agent <memory-verb>' to 'wp datamachine memory <verb>',
and updated MemoryCommand docblocks/error strings. Chris reviewed
the plan in issue #1172 and greenlit the hard-swap path.
@chubes4 chubes4 merged commit 4ac1a87 into main Apr 23, 2026
1 check passed
@chubes4 chubes4 deleted the unify-agent-cli branch April 23, 2026 23:29
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.

CLI: unify datamachine agent / datamachine agents — one noun, one class (like every other DM noun)

1 participant