Abilities API

WordPress 6.9 Abilities API provides standardized capability discovery and execution for Data Machine operations. All REST API, CLI, and Chat tool operations delegate to registered abilities.

Overview

The Abilities API in inc/Abilities/ provides a unified interface for Data Machine operations. Each ability implements execute_callback with permission_callback for consistent access control across REST API, CLI commands, and Chat tools.

Total registered abilities: 167

Multi-Agent Scoping

All abilities support agent_id and user_id parameters for multi-agent scoping. The PermissionHelper class resolves scoped agent and user IDs, enforces ownership checks via owns_resource() and owns_agent_resource(), and controls access grants via can_access_agent().

Registered Abilities

Pipeline Management (7 abilities)

AbilityDescriptionLocation
datamachine/get-pipelinesList pipelines with pagination, or get single by IDPipeline/GetPipelinesAbility.php
datamachine/create-pipelineCreate new pipelinePipeline/CreatePipelineAbility.php
datamachine/update-pipelineUpdate pipeline propertiesPipeline/UpdatePipelineAbility.php
datamachine/delete-pipelineDelete pipeline and associated flowsPipeline/DeletePipelineAbility.php
datamachine/duplicate-pipelineDuplicate pipeline with flowsPipeline/DuplicatePipelineAbility.php
datamachine/import-pipelinesImport pipelines from JSONPipeline/ImportExportAbility.php
datamachine/export-pipelinesExport pipelines to JSONPipeline/ImportExportAbility.php

Pipeline Steps (5 abilities)

AbilityDescriptionLocation
datamachine/get-pipeline-stepsList steps for a pipeline, or get single by IDPipelineStepAbilities.php
datamachine/add-pipeline-stepAdd step to pipeline (auto-syncs to all flows)PipelineStepAbilities.php
datamachine/update-pipeline-stepUpdate pipeline step config (system prompt, provider, model, tools)PipelineStepAbilities.php
datamachine/delete-pipeline-stepRemove step from pipeline (removes from all flows)PipelineStepAbilities.php
datamachine/reorder-pipeline-stepsReorder pipeline stepsPipelineStepAbilities.php

Flow Management (5 abilities)

AbilityDescriptionLocation
datamachine/get-flowsList flows with filtering, or get single by IDFlow/GetFlowsAbility.php
datamachine/create-flowCreate new flow from pipelineFlow/CreateFlowAbility.php
datamachine/update-flowUpdate flow propertiesFlow/UpdateFlowAbility.php
datamachine/delete-flowDelete flow and associated jobsFlow/DeleteFlowAbility.php
datamachine/duplicate-flowDuplicate flow within pipelineFlow/DuplicateFlowAbility.php

Flow Steps (4 abilities)

AbilityDescriptionLocation
datamachine/get-flow-stepsList steps for a flow, or get single by IDFlowStep/GetFlowStepsAbility.php
datamachine/update-flow-stepUpdate flow step configFlowStep/UpdateFlowStepAbility.php
datamachine/configure-flow-stepsBulk configure flow stepsFlowStep/ConfigureFlowStepsAbility.php
datamachine/validate-flow-steps-configValidate flow steps configurationFlowStep/ValidateFlowStepsConfigAbility.php

Queue Management (7 abilities)

AbilityDescriptionLocation
datamachine/queue-addAdd item to flow queueFlow/QueueAbility.php
datamachine/queue-listList queue entriesFlow/QueueAbility.php
datamachine/queue-clearClear queueFlow/QueueAbility.php
datamachine/queue-removeRemove item from queueFlow/QueueAbility.php
datamachine/queue-updateUpdate queue itemFlow/QueueAbility.php
datamachine/queue-moveReorder queue itemFlow/QueueAbility.php
datamachine/queue-settingsGet/set queue settingsFlow/QueueAbility.php

Webhook Triggers (5 abilities)

AbilityDescriptionLocation
datamachine/webhook-trigger-enableEnable webhook trigger for a flow and generate Bearer tokenFlow/WebhookTriggerAbility.php
datamachine/webhook-trigger-disableDisable webhook trigger, revoke tokenFlow/WebhookTriggerAbility.php
datamachine/webhook-trigger-regenerateRegenerate webhook token (old token immediately invalidated)Flow/WebhookTriggerAbility.php
datamachine/webhook-trigger-rate-limitSet rate limiting for flow webhook triggerFlow/WebhookTriggerAbility.php
datamachine/webhook-trigger-statusGet webhook trigger status for a flowFlow/WebhookTriggerAbility.php

Job Execution (9 abilities)

AbilityDescriptionLocation
datamachine/get-jobsList jobs with filtering, or get single by IDJob/GetJobsAbility.php
datamachine/get-jobs-summaryGet job status summary countsJob/JobsSummaryAbility.php
datamachine/delete-jobsDelete jobs by criteriaJob/DeleteJobsAbility.php
datamachine/execute-workflowExecute workflowJob/ExecuteWorkflowAbility.php
datamachine/get-flow-healthGet flow health metricsJob/FlowHealthAbility.php
datamachine/get-problem-flowsList flows exceeding failure thresholdJob/ProblemFlowsAbility.php
datamachine/recover-stuck-jobsRecover jobs stuck in processing stateJob/RecoverStuckJobsAbility.php
datamachine/retry-jobRetry a failed jobJob/RetryJobAbility.php
datamachine/fail-jobManually fail a processing jobJob/FailJobAbility.php

Engine (4 abilities)

Internal abilities for the pipeline execution engine.

AbilityDescriptionLocation
datamachine/run-flowRun a flowEngine/RunFlowAbility.php
datamachine/execute-stepExecute a pipeline stepEngine/ExecuteStepAbility.php
datamachine/schedule-next-stepSchedule the next step in pipeline executionEngine/ScheduleNextStepAbility.php
datamachine/schedule-flowSchedule a flow for executionEngine/ScheduleFlowAbility.php

Agent Management (6 abilities)

AbilityDescriptionLocation
datamachine/list-agentsList all registered agent identitiesAgentAbilities.php
datamachine/create-agentCreate a new agent identity with filesystem directory and owner accessAgentAbilities.php
datamachine/get-agentRetrieve a single agent by slug or ID with access grantsAgentAbilities.php
datamachine/update-agentUpdate an agent’s mutable fields (name, config, status)AgentAbilities.php
datamachine/delete-agentDelete an agent record and access grants, optionally remove filesystemAgentAbilities.php
datamachine/rename-agentRename an agent slug — updates database and moves filesystem directoryAgentAbilities.php

Agent Memory (4 abilities)

AbilityDescriptionLocation
datamachine/get-agent-memoryRead agent memory content — full file or a specific sectionAgentMemoryAbilities.php
datamachine/update-agent-memoryWrite to a specific section of agent memory — set (replace) or appendAgentMemoryAbilities.php
datamachine/search-agent-memorySearch across agent memory content, returns matching lines with contextAgentMemoryAbilities.php
datamachine/list-agent-memory-sectionsList all section headers in agent memoryAgentMemoryAbilities.php

Daily Memory (5 abilities)

AbilityDescriptionLocation
datamachine/daily-memory-readRead a daily memory file by date (defaults to today)DailyMemoryAbilities.php
datamachine/daily-memory-writeWrite or append to a daily memory fileDailyMemoryAbilities.php
datamachine/daily-memory-listList all daily memory files grouped by monthDailyMemoryAbilities.php
datamachine/search-daily-memorySearch across daily memory files with optional date rangeDailyMemoryAbilities.php
datamachine/daily-memory-deleteDelete a daily memory file by dateDailyMemoryAbilities.php

Agent Files (5 abilities)

AbilityDescriptionLocation
datamachine/list-agent-filesList memory files from agent identity and user layersFile/AgentFileAbilities.php
datamachine/get-agent-fileGet a single agent memory file with contentFile/AgentFileAbilities.php
datamachine/write-agent-fileWrite or update content for an agent memory fileFile/AgentFileAbilities.php
datamachine/delete-agent-fileDelete an agent memory file (protected files cannot be deleted)File/AgentFileAbilities.php
datamachine/upload-agent-fileUpload a file to the agent memory directoryFile/AgentFileAbilities.php

Flow Files (5 abilities)

AbilityDescriptionLocation
datamachine/list-flow-filesList uploaded files for a flow stepFile/FlowFileAbilities.php
datamachine/get-flow-fileGet metadata for a single flow fileFile/FlowFileAbilities.php
datamachine/delete-flow-fileDelete an uploaded file from a flow stepFile/FlowFileAbilities.php
datamachine/upload-flow-fileUpload a file to a flow stepFile/FlowFileAbilities.php
datamachine/cleanup-flow-filesCleanup data packets and temporary files for a job or flowFile/FlowFileAbilities.php

Workspace (16 abilities)

AbilityDescriptionLocation
datamachine/workspace-pathGet the agent workspace directory pathWorkspaceAbilities.php
datamachine/workspace-listList repositories in the agent workspaceWorkspaceAbilities.php
datamachine/workspace-showShow detailed repo info (branch, remote, latest commit, dirty status)WorkspaceAbilities.php
datamachine/workspace-readRead a text file from a workspace repositoryWorkspaceAbilities.php
datamachine/workspace-lsList directory contents within a workspace repositoryWorkspaceAbilities.php
datamachine/workspace-cloneClone a git repository into the workspaceWorkspaceAbilities.php
datamachine/workspace-removeRemove a repository from the workspaceWorkspaceAbilities.php
datamachine/workspace-writeCreate or overwrite a file in a workspace repositoryWorkspaceAbilities.php
datamachine/workspace-editFind-and-replace text in a workspace repository fileWorkspaceAbilities.php
datamachine/workspace-git-statusGet git status for a workspace repositoryWorkspaceAbilities.php
datamachine/workspace-git-logRead git log entriesWorkspaceAbilities.php
datamachine/workspace-git-diffRead git diff outputWorkspaceAbilities.php
datamachine/workspace-git-pullRun git pull –ff-onlyWorkspaceAbilities.php
datamachine/workspace-git-addStage repository paths with git addWorkspaceAbilities.php
datamachine/workspace-git-commitCommit staged changesWorkspaceAbilities.php
datamachine/workspace-git-pushPush commitsWorkspaceAbilities.php

Chat Sessions (4 abilities)

AbilityDescriptionLocation
datamachine/create-chat-sessionCreate a new chat session for a userChat/CreateChatSessionAbility.php
datamachine/list-chat-sessionsList chat sessions with pagination and context filteringChat/ListChatSessionsAbility.php
datamachine/get-chat-sessionRetrieve a chat session with conversation and metadataChat/GetChatSessionAbility.php
datamachine/delete-chat-sessionDelete a chat session after verifying ownershipChat/DeleteChatSessionAbility.php

GitHub (6 abilities)

AbilityDescriptionLocation
datamachine/list-github-issuesList issues from a GitHub repository with optional filtersFetch/GitHubAbilities.php
datamachine/get-github-issueGet a single GitHub issue with full detailsFetch/GitHubAbilities.php
datamachine/update-github-issueUpdate a GitHub issue (title, body, labels, assignees, state)Fetch/GitHubAbilities.php
datamachine/comment-github-issueAdd a comment to a GitHub issueFetch/GitHubAbilities.php
datamachine/list-github-pullsList pull requests from a GitHub repositoryFetch/GitHubAbilities.php
datamachine/list-github-reposList repositories for a user or organizationFetch/GitHubAbilities.php

Handler Execution (9 abilities)

AbilityDescriptionLocation
datamachine/fetch-rssFetch items from RSS/Atom feedsFetch/FetchRssAbility.php
datamachine/fetch-filesProcess uploaded filesFetch/FetchFilesAbility.php
datamachine/fetch-wordpress-apiFetch posts from WordPress REST APIFetch/FetchWordPressApiAbility.php
datamachine/fetch-wordpress-mediaQuery WordPress media libraryFetch/FetchWordPressMediaAbility.php
datamachine/get-wordpress-postRetrieve single WordPress post by ID/URLFetch/GetWordPressPostAbility.php
datamachine/query-wordpress-postsQuery WordPress posts with filtersFetch/QueryWordPressPostsAbility.php
datamachine/publish-wordpressCreate WordPress postsPublish/PublishWordPressAbility.php
datamachine/update-wordpressUpdate existing WordPress postsUpdate/UpdateWordPressAbility.php
datamachine/fetch-redditFetch posts from Reddit APIFetch/FetchRedditAbility.php

Duplicate Check (2 abilities)

AbilityDescriptionLocation
datamachine/check-duplicateCheck if similar content exists as published post or in queueDuplicateCheck/DuplicateCheckAbility.php
datamachine/titles-matchCompare two titles for semantic equivalence using similarity engineDuplicateCheck/DuplicateCheckAbility.php

Post Query (2 abilities)

AbilityDescriptionLocation
datamachine/query-postsFind posts created by Data Machine, filtered by handler/flow/pipelinePostQueryAbilities.php
datamachine/list-postsList Data Machine posts with combinable filtersPostQueryAbilities.php

Content / Block Editing (3 abilities)

AbilityDescriptionLocation
datamachine/get-post-blocksGet Gutenberg blocks from a postContent/GetPostBlocksAbility.php
datamachine/edit-post-blocksUpdate Gutenberg blocks in a postContent/EditPostBlocksAbility.php
datamachine/replace-post-blocksReplace specific blocks in a postContent/ReplacePostBlocksAbility.php

Media (7 abilities)

AbilityDescriptionLocation
datamachine/generate-alt-textQueue system agent generation of alt text for imagesMedia/AltTextAbilities.php
datamachine/diagnose-alt-textReport alt text coverage for image attachmentsMedia/AltTextAbilities.php
datamachine/generate-imageGenerate images using AI models via Replicate APIMedia/ImageGenerationAbilities.php
datamachine/upload-mediaUpload or fetch a media file (image/video), store in repositoryMedia/MediaAbilities.php
datamachine/validate-mediaValidate a media file against platform-specific constraintsMedia/MediaAbilities.php
datamachine/video-metadataExtract video metadata (duration, resolution, codec) via ffprobeMedia/MediaAbilities.php
datamachine/render-image-templateGenerate branded graphics from registered GD templatesMedia/ImageTemplateAbilities.php

Image Templates (1 ability)

AbilityDescriptionLocation
datamachine/list-image-templatesList all registered image generation templatesMedia/ImageTemplateAbilities.php

Image Optimization (2 abilities)

AbilityDescriptionLocation
datamachine/diagnose-imagesScan media library for oversized images, missing WebP, missing thumbnailsMedia/ImageOptimizationAbilities.php
datamachine/optimize-imagesCompress oversized images and generate WebP variantsMedia/ImageOptimizationAbilities.php

Internal Linking (6 abilities)

AbilityDescriptionLocation
datamachine/internal-linkingQueue system agent insertion of semantic internal linksInternalLinkingAbilities.php
datamachine/diagnose-internal-linksReport internal link coverage across published postsInternalLinkingAbilities.php
datamachine/audit-internal-linksScan post content for internal links, build link graphInternalLinkingAbilities.php
datamachine/get-orphaned-postsReturn posts with zero inbound internal linksInternalLinkingAbilities.php
datamachine/check-broken-linksHTTP HEAD check links to find broken URLsInternalLinkingAbilities.php
datamachine/inject-category-linksDeterministic keyword-matching link injection (no AI)InternalLinkingAbilities.php

SEO — Meta Descriptions (2 abilities)

AbilityDescriptionLocation
datamachine/generate-meta-descriptionQueue system agent generation of meta descriptionsSEO/MetaDescriptionAbilities.php
datamachine/diagnose-meta-descriptionsReport post excerpt (meta description) coverageSEO/MetaDescriptionAbilities.php

SEO — IndexNow (4 abilities)

AbilityDescriptionLocation
datamachine/indexnow-submitSubmit URLs to IndexNow for instant search engine indexingSEO/IndexNowAbilities.php
datamachine/indexnow-statusGet IndexNow integration status (enabled, API key, endpoint)SEO/IndexNowAbilities.php
datamachine/indexnow-generate-keyGenerate a new IndexNow API keySEO/IndexNowAbilities.php
datamachine/indexnow-verify-keyVerify that the IndexNow key file is accessibleSEO/IndexNowAbilities.php

Analytics (4 abilities)

AbilityDescriptionLocation
datamachine/bing-webmasterFetch search analytics from Bing Webmaster Tools APIAnalytics/BingWebmasterAbilities.php
datamachine/google-search-consoleFetch search analytics from Google Search Console APIAnalytics/GoogleSearchConsoleAbilities.php
datamachine/google-analyticsFetch visitor analytics from Google Analytics (GA4) Data APIAnalytics/GoogleAnalyticsAbilities.php
datamachine/pagespeedRun Lighthouse audits via PageSpeed Insights APIAnalytics/PageSpeedAbilities.php

Taxonomy (5 abilities)

AbilityDescriptionLocation
datamachine/get-taxonomy-termsList taxonomy termsTaxonomy/GetTaxonomyTermsAbility.php
datamachine/create-taxonomy-termCreate a taxonomy termTaxonomy/CreateTaxonomyTermAbility.php
datamachine/update-taxonomy-termUpdate a taxonomy termTaxonomy/UpdateTaxonomyTermAbility.php
datamachine/delete-taxonomy-termDelete a taxonomy termTaxonomy/DeleteTaxonomyTermAbility.php
datamachine/resolve-termResolve a term by name or slugTaxonomy/ResolveTermAbility.php

Settings (7 abilities)

AbilityDescriptionLocation
datamachine/get-settingsGet plugin settings including AI settings and masked API keysSettingsAbilities.php
datamachine/update-settingsPartial update of plugin settingsSettingsAbilities.php
datamachine/get-scheduling-intervalsGet available scheduling intervalsSettingsAbilities.php
datamachine/get-tool-configGet AI tool configuration with fields and current valuesSettingsAbilities.php
datamachine/save-tool-configSave AI tool configurationSettingsAbilities.php
datamachine/get-handler-defaultsGet handler default settings grouped by step typeSettingsAbilities.php
datamachine/update-handler-defaultsUpdate defaults for a specific handlerSettingsAbilities.php

Authentication (3 abilities)

AbilityDescriptionLocation
datamachine/get-auth-statusGet OAuth connection statusAuthAbilities.php
datamachine/disconnect-authDisconnect OAuth providerAuthAbilities.php
datamachine/save-auth-configSave OAuth API configurationAuthAbilities.php

Logging (5 abilities)

AbilityDescriptionLocation
datamachine/write-to-logWrite log entry with level routingLogAbilities.php
datamachine/clear-logsClear logs by agent typeLogAbilities.php
datamachine/read-logsRead logs with filtering and paginationLogAbilities.php
datamachine/get-log-metadataGet log entry counts and time rangeLogAbilities.php
datamachine/read-debug-logRead PHP debug.log entriesLogAbilities.php

Local Search (1 ability)

AbilityDescriptionLocation
datamachine/local-searchSearch WordPress site for posts by title or contentLocalSearchAbilities.php

Handler Discovery (5 abilities)

AbilityDescriptionLocation
datamachine/get-handlersList available handlers, or get single by slugHandlerAbilities.php
datamachine/validate-handlerValidate handler configurationHandlerAbilities.php
datamachine/get-handler-config-fieldsGet handler configuration fieldsHandlerAbilities.php
datamachine/apply-handler-defaultsApply default settings to handlerHandlerAbilities.php
datamachine/get-handler-site-defaultsGet site-wide handler defaultsHandlerAbilities.php

Step Types (2 abilities)

AbilityDescriptionLocation
datamachine/get-step-typesList available step types, or get single by slugStepTypeAbilities.php
datamachine/validate-step-typeValidate step type configurationStepTypeAbilities.php

Processed Items (3 abilities)

AbilityDescriptionLocation
datamachine/clear-processed-itemsClear processed items for flow (resets deduplication)ProcessedItemsAbilities.php
datamachine/check-processed-itemCheck if item was processedProcessedItemsAbilities.php
datamachine/has-processed-historyCheck if flow has processed historyProcessedItemsAbilities.php

Agent Ping (1 ability)

AbilityDescriptionLocation
datamachine/send-pingSend agent ping notificationAgentPing/SendPingAbility.php

System Infrastructure (4 abilities)

AbilityDescriptionLocation
datamachine/generate-session-titleGenerate AI-powered title for chat sessionSystemAbilities.php
datamachine/system-health-checkUnified health diagnostics for Data Machine and extensionsSystemAbilities.php
datamachine/create-github-issueCreate GitHub issues programmaticallySystemAbilities.php
datamachine/run-taskManually trigger a registered system task for immediate executionSystemAbilities.php

Category Registration

The datamachine category is registered via wp_register_ability_category() on the wp_abilities_api_categories_init hook:

php
wp_register_ability_category(
    'datamachine',
    array(
        'label' => 'Data Machine',
        'description' => 'Data Machine flow and pipeline operations',
    )
);

Permission Model

All abilities support both WordPress admin and WP-CLI contexts via the shared PermissionHelper:

php
// Standard permission check
PermissionHelper::can_manage(); // WP-CLI always returns true; web requires manage_options

// Multi-agent scoped permission check
PermissionHelper::can_access_agent($agent_id);
PermissionHelper::owns_resource($resource_user_id);
PermissionHelper::resolve_scoped_agent_id($params);
PermissionHelper::resolve_scoped_user_id($params);

Architecture

Delegation Pattern

REST API endpoints, CLI commands, and Chat tools delegate to abilities for business logic. Abilities are the canonical, public-facing primitive; service classes are considered an internal implementation detail and are being phased out as abilities become fully self-contained.

REST API Endpoint → Ability → (Service layer used during migration) → Database
CLI Command → Ability → (Service layer used during migration) → Database
Chat Tool → Ability → (Service layer used during migration) → Database

Note: many ability implementations are already self-contained and do not call service managers. Where services remain, they are transitional and will be migrated into abilities per the migration plan.

Facade Pattern

Several top-level ability classes serve as facades that instantiate sub-ability classes from subdirectories:

  • ChatAbilities.phpChat/CreateChatSessionAbility.php, etc.
  • EngineAbilities.phpEngine/RunFlowAbility.php, etc.
  • FlowAbilities.phpFlow/QueueAbility.php, Flow/WebhookTriggerAbility.php, etc.

Ability Registration

Each abilities class registers abilities on the wp_abilities_api_init hook:

php
public function register(): void {
    add_action( 'wp_abilities_api_init', array( $this, 'register_abilities' ) );
}

Testing

Unit tests in tests/Unit/Abilities/ verify ability registration, schema validation, permission checks, and execution logic:

  • AuthAbilitiesTest.php – Authentication abilities
  • FileAbilitiesTest.php – File management abilities
  • FlowAbilitiesTest.php – Flow CRUD abilities
  • FlowStepAbilitiesTest.php – Flow step abilities
  • JobAbilitiesTest.php – Job execution abilities
  • LogAbilitiesTest.php – Logging abilities
  • PipelineAbilitiesTest.php – Pipeline CRUD abilities
  • PipelineStepAbilitiesTest.php – Pipeline step abilities
  • PostQueryAbilitiesTest.php – Post query abilities
  • ProcessedItemsAbilitiesTest.php – Processed items abilities
  • SettingsAbilitiesTest.php – Settings abilities

WP-CLI Integration

CLI commands execute abilities directly. See individual command files in inc/Cli/Commands/ for available commands.

Post Tracking

The PostTracking class in inc/Core/WordPress/PostTracking.php provides post tracking functionality for handlers creating WordPress posts.

Meta Keys:

  • _datamachine_post_handler: Handler slug that created the post
  • _datamachine_post_flow_id: Flow ID associated with the post
  • _datamachine_post_pipeline_id: Pipeline ID associated with the post

Usage:

php
use DataMachineCoreWordPressPostTracking;

// After creating a post
$this->storePostTrackingMeta($post_id, $handler_config);