Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,6 @@ This file provides a concise, present-tense technical reference for contributors
- Ability execution: Each ability implements `execute_callback` with `permission_callback` (checks `manage_options` or WP_CLI)
- REST API endpoints, CLI commands, and Chat tools delegate to abilities for business logic

Build system

- **Homeboy** is used for all build operations (versioning, packaging, deployment)
- Homeboy provides full WordPress test environment for running tests (no local WordPress setup required)
- Build command: `homeboy build data-machine` - runs tests, lints code, builds frontend, creates production ZIP
- Test command: `homeboy test data-machine` - runs PHPUnit tests using homeboy's WordPress environment
- Lint command: `homeboy lint data-machine` - runs PHP CodeSniffer with WordPress coding standards
- Auto-fix: `homeboy lint data-machine --fix` - runs PHPCBF to auto-fix formatting issues before validating

Testing

- PHPUnit tests located in `tests/Unit/` directory
- Tests use `WP_UnitTestCase` with homeboy's WordPress test environment
- Run tests: `homeboy test data-machine` (uses homeboy's WordPress installation)
- Run build: `homeboy build data-machine` (runs tests, lints code, builds frontend assets, creates production ZIP)

Abilities API

- WordPress 6.9 Abilities API provides standardized capability discovery and execution for all Data Machine operations
- Ability classes in `inc/Abilities/`: PipelineAbilities, PipelineStepAbilities, FlowAbilities, FlowStepAbilities, JobAbilities, FileAbilities, ProcessedItemsAbilities, SettingsAbilities, AuthAbilities, LogAbilities, HandlerAbilities, StepTypeAbilities, PostQueryAbilities, LocalSearchAbilities
- Category registration: `datamachine` category registered via `wp_register_ability_category()` on `wp_abilities_api_categories_init` hook
- Ability execution: Each ability implements `execute_callback` with `permission_callback` (checks `manage_options` or WP_CLI)
- REST API endpoints, CLI commands, and Chat tools delegate to abilities for business logic

Engine & execution

Expand Down Expand Up @@ -118,6 +95,7 @@ Agent guidance (for automated editors)
- Use present-tense language and remove references to deleted functionality or historical counts.
- Do not modify source code when aligning documentation unless explicitly authorized.
- Do not create new top-level documentation directories. Creating or updating `.md` files is allowed only within existing directories.
- **Extension-based commands**: The `wp datamachine workspace` and `wp datamachine github` commands have been moved to the `data-machine-code` extension plugin. Core documentation should not reference these commands.

Agent orchestration patterns

Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Data Machine turns a WordPress site into an agent runtime — persistent identit
- **Abilities API** — Typed, permissioned functions that agents and extensions call (`datamachine/upload-media`, `datamachine/validate-media`, etc.)
- **Agent memory** — Layered markdown files (SOUL.md + MEMORY.md in agent layer, USER.md in user layer) injected into every AI context
- **Multi-agent** — Multiple agents with scoped pipelines, flows, jobs, and filesystem directories
- **Workspace** — Managed directory for repo clones and file operations with security sandboxing
- **Workspace** — Managed directory for repo clones and file operations with security sandboxing (CLI commands in data-machine-code extension)
- **Self-scheduling** — Agents schedule their own recurring tasks using flows, prompt queues, and Agent Pings

## Architecture
Expand All @@ -35,7 +35,7 @@ One agent, three operational modes — same identity and memory, different tools
|---------|---------|-------|
| **Pipeline** | Automated workflow execution | Handler-specific tools scoped to the current step |
| **Chat** | Conversational interface in wp-admin | 30+ management tools (flows, pipelines, jobs, logs, memory, content) |
| **System** | Background infrastructure tasks | Alt text, daily memory, image generation, internal linking, meta descriptions, GitHub issues |
| **System** | Background infrastructure tasks | Alt text, daily memory, image generation, internal linking, meta descriptions (GitHub issues in data-machine-code extension) |

Configure AI provider and model per context in Settings. Each context falls back to the global default if no override is set.

Expand Down Expand Up @@ -88,8 +88,8 @@ Pipelines are built from **step types**. Some use pluggable **handlers** — int

| Step Type | Core Handlers | Extension Handlers |
|-----------|---------------|-------------------|
| **Fetch** | RSS, WordPress (local posts), WordPress API (remote), WordPress Media, Files, GitHub | Google Sheets, Reddit, social platforms |
| **Publish** | WordPress, Workspace | Twitter, Instagram, Facebook, Threads, Bluesky, Pinterest, Google Sheets, Slack, Discord |
| **Fetch** | RSS, WordPress (local posts), WordPress API (remote), WordPress Media, Files | GitHub, Google Sheets, Reddit, social platforms (in extensions) |
| **Publish** | WordPress, Workspace (in data-machine-code extension) | Twitter, Instagram, Facebook, Threads, Bluesky, Pinterest, Google Sheets, Slack, Discord (in extensions) |
| **Update** | WordPress posts with AI enhancement | — |

### Self-contained steps
Expand Down Expand Up @@ -131,7 +131,7 @@ Background AI tasks that run on hooks or schedules:
| **Daily Memory** | Consolidate MEMORY.md, archive to daily files |
| **Internal Linking** | AI-powered internal link suggestions |
| **Meta Descriptions** | Generate SEO meta descriptions |
| **GitHub Issues** | Create issues from pipeline findings |
| **GitHub Issues** | Create issues from pipeline findings (in data-machine-code extension) |

Tasks support undo via the Job Undo system (revision-based rollback for post content, meta, attachments, featured images).

Expand All @@ -158,7 +158,6 @@ wp datamachine settings # Plugin settings
wp datamachine posts # Query Data Machine-created posts
wp datamachine logs # Log operations
wp datamachine memory # Agent memory read/write
wp datamachine workspace # Workspace file operations
wp datamachine handlers # List registered handlers
wp datamachine step-types # List registered step types
wp datamachine chat # Chat agent interface
Expand All @@ -167,7 +166,6 @@ wp datamachine links # Internal linking
wp datamachine blocks # Gutenberg block operations
wp datamachine image # Image generation
wp datamachine meta-description # SEO meta descriptions
wp datamachine github # GitHub integration
wp datamachine auth # OAuth provider management
wp datamachine taxonomy # Taxonomy operations
wp datamachine batch # Batch operations
Expand Down
5 changes: 2 additions & 3 deletions data-machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,12 @@ function datamachine_load_handlers() {
new \DataMachine\Core\Steps\Fetch\Handlers\Email\Email();
new \DataMachine\Core\Steps\Fetch\Handlers\Files\Files();
// GitHub handler moved to data-machine-code extension.
new \DataMachine\Core\Steps\Fetch\Handlers\Workspace\Workspace();
// Workspace fetch handler moved to data-machine-code extension.

// Update Handlers
new \DataMachine\Core\Steps\Update\Handlers\WordPress\WordPress();

// Workspace publish handler
new \DataMachine\Core\Steps\Publish\Handlers\Workspace\Workspace();
// Workspace publish handler moved to data-machine-code extension.
}

/**
Expand Down
15 changes: 5 additions & 10 deletions docs/ai-tools/tools-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,17 @@ Available to all AI agents (pipeline + chat + standalone) via `datamachine_globa
- **Features**: Post type and category filtering, force rebuild option, internal/external/all scope for broken link checks, configurable result limits
- **Use Cases**: SEO link auditing, orphaned content discovery, broken link detection

**GitHub Tools** — multi-tool class (@since v0.33.0)
**GitHub Tools** — multi-tool class (@since v0.24.0, **moved to data-machine-code extension**)
- `create_github_issue` — Create a GitHub issue in a repository. Async — uses System Agent for execution.
- `list_github_issues` — List issues from a GitHub repository with state, label, and pagination filters
- `get_github_issue` — Get a single GitHub issue with full details including body, labels, and comments
- `manage_github_issue` — Update, close, or comment on a GitHub issue
- `list_github_pulls` — List pull requests from a repository with state filtering
- `list_github_repos` — List GitHub repositories for a user or organization
- **Configuration**: GitHub PAT required
- **Use Cases**: Issue tracking, PR monitoring, repository discovery

**GitHub Issue Creator** (`create_github_issue`) (@since v0.24.0)
- **Purpose**: Create a GitHub issue in a repository. Async — uses System Agent for execution.
- **Configuration**: GitHub PAT required
- **Features**: Supports title, body (GitHub Markdown), labels, and repo selection from configured defaults
- **Use Cases**: Bug reports, feature requests, task tracking from AI workflows

**Workspace Tools** — multi-tool class (@since v0.37.0)
**Workspace Tools** — multi-tool class (@since v0.37.0, **moved to data-machine-code extension**)
- `workspace_path` — Get the Data Machine workspace path, optionally ensure it exists
- `workspace_list` — List repositories currently present in the workspace
- `workspace_show` — Show detailed repo info (branch, remote, latest commit, dirty count)
Expand Down Expand Up @@ -353,10 +348,10 @@ Global tools are located in `/inc/Engine/AI/Tools/Global/`:
- `QueueValidator.php` - Flow queue duplicate validation before content generation
- `WebFetch.php` - Web page content retrieval
- `WordPressPostReader.php` - Single post analysis
- `WorkspaceTools.php` - Workspace repository operations (list, show, read, browse — multi-tool)
- `WorkspaceTools.php` - Workspace repository operations (**moved to data-machine-code extension**)

Additional global tools outside the Global directory:
- `GitHubIssueTool.php` (`/inc/Engine/AI/Tools/`) - GitHub issue creation (async, System Agent)
- `GitHubIssueTool.php` (`/inc/Engine/AI/Tools/`) - GitHub issue creation (**moved to data-machine-code extension**)

Analytics abilities are located in `/inc/Abilities/Analytics/`:
- `GoogleSearchConsoleAbilities.php` - GSC API integration and JWT auth
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ GitHubIssueTask MetaDescriptionTask

### Workspace System

Secure file management outside the web root for agent operations:
Secure file management outside the web root for agent operations. **Moved to data-machine-code extension.**

- **Location**: `/var/lib/datamachine/workspace/` (or `DATAMACHINE_WORKSPACE_PATH`)
- **Git-aware**: Clone, status, pull, add, commit, push, log, diff
- **File ops**: Read (with pagination), write, edit (find-replace), list directory
- **Security**: Outside web root; mutating ops are CLI-only (not REST-exposed)
- **CLI**: `wp datamachine workspace {path,list,clone,remove,show,read,ls,write,edit,git}`
- **CLI**: `wp datamachine-code workspace {path,list,clone,remove,show,read,ls,write,edit,git}`

### Engine Data Architecture

Expand Down Expand Up @@ -296,7 +296,7 @@ Data Machine v0.2.0 introduced a universal Engine layer (`/inc/Engine/AI/`) that
**Tool Categories**:
- Handler-specific tools for publish/update operations
- Global tools for search and analysis (GoogleSearch, LocalSearch, WebFetch, WordPressPostReader)
- Workspace-scoped tools (WorkspaceTools, WorkspaceScopedTools) for agent file operations
- Workspace-scoped tools (WorkspaceTools, WorkspaceScopedTools) for agent file operations (**moved to data-machine-code extension**)
- Agent memory tools (AgentMemory, AgentDailyMemory) for runtime memory access
- Chat-only tools for workflow building (@since v0.4.3):
- AddPipelineStep, ApiQuery, AuthenticateHandler, ConfigureFlowSteps, ConfigurePipelineStep, CopyFlow, CreateFlow, CreatePipeline, CreateTaxonomyTerm, ExecuteWorkflowTool, GetHandlerDefaults, ManageLogs, ReadLogs, RunFlow, SearchTaxonomyTerms, SetHandlerDefaults, UpdateFlow
Expand Down
30 changes: 15 additions & 15 deletions docs/core-system/wordpress-as-agent-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,23 +441,24 @@ This makes WordPress the single source of truth for agent memory, regardless of

### Reading Memory via WP-CLI

Agents with shell access can use workspace commands for structured access:
Agents with shell access can use the `agent` command for structured access:

```bash
# Discover file paths (canonical command for external consumers)
wp datamachine agent paths --allow-root

# Read memory file via workspace
wp datamachine workspace read MEMORY.md --allow-root
# Read memory file
wp datamachine agent files read SOUL.md --allow-root
wp datamachine agent files read MEMORY.md --allow-root

# List agent directory contents
wp datamachine workspace ls agents/my-agent/ --allow-root
wp datamachine agent files list --allow-root

# Read daily memory
wp datamachine memory daily read --date=2026-03-15 --allow-root
wp datamachine agent daily read 2026-03-15 --allow-root

# Search daily memory
wp datamachine memory daily search --query="deployment" --allow-root
wp datamachine agent daily search "deployment" --allow-root
```

### The Key Principle
Expand Down Expand Up @@ -638,19 +639,18 @@ wp datamachine agents create --slug=bot --name="My Bot" --allow-root
wp datamachine agents rename old-slug new-slug --allow-root
```

### Workspace Commands
### Agent File Commands

```bash
wp datamachine workspace path --allow-root
wp datamachine workspace list --allow-root
wp datamachine workspace read <file> --allow-root
wp datamachine workspace ls <dir> --allow-root
wp datamachine workspace write <file> --content="..." --allow-root
wp datamachine workspace edit <file> --old="..." --new="..." --allow-root
wp datamachine workspace clone <repo-url> --allow-root
wp datamachine workspace git status --repo=<name> --allow-root
wp datamachine agent paths --allow-root
wp datamachine agent files list --allow-root
wp datamachine agent files read <file> --allow-root
wp datamachine agent files write <file> --content="..." --allow-root
wp datamachine agent files edit <file> --old="..." --new="..." --allow-root
```

> **Note:** For workspace/git operations, install the `data-machine-code` extension and use `wp datamachine-code workspace`.

## Extending the Memory System

### Register Custom Memory Files
Expand Down
8 changes: 6 additions & 2 deletions docs/core-system/workspace-system.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Workspace System

> **Important:** The workspace system has been moved to the `data-machine-code` extension plugin as of v0.45.0. This documentation is preserved for reference. Install the extension to use workspace functionality.

The workspace system provides a managed external directory where Data Machine agents can clone, read, write, and perform Git operations on repositories. Unlike agent memory files (which live inside `wp-content/uploads/`), workspace repos live **outside the web root** for security and to support build tooling that shouldn't be publicly accessible.

## Overview
Expand All @@ -11,7 +13,7 @@ The workspace system consists of:
3. **WorkspaceAbilities** — WordPress 6.9 Abilities API (16 abilities)
4. **WorkspaceTools / WorkspaceScopedTools** — AI chat tools for global and handler-scoped access
5. **Fetch and Publish handlers** — pipeline integration for reading from and writing to workspace repos
6. **CLI** — full `wp datamachine workspace` command set
6. **CLI** — full `wp datamachine-code workspace` command set (in extension)

## Workspace Directory

Expand Down Expand Up @@ -164,7 +166,9 @@ Read-only abilities have `show_in_rest: true`. Mutating abilities have `show_in_

### Global Tools (WorkspaceTools)

**Source:** `inc/Engine/AI/Tools/Global/WorkspaceTools.php`
> **Note:** WorkspaceTools have been moved to the `data-machine-code` extension plugin.

**Source:** `inc/Engine/AI/Tools/Global/WorkspaceTools.php` (in extension)
**Tool ID:** Various (`workspace_path`, `workspace_list`, `workspace_show`, `workspace_ls`, `workspace_read`)
**Contexts:** `chat`, `pipeline`, `standalone`

Expand Down
97 changes: 3 additions & 94 deletions docs/core-system/wp-cli.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# WP-CLI Commands

Data Machine provides 25 WP-CLI command namespaces for managing pipelines, flows, jobs, agents, workspace, and more from the command line. All commands are registered under the `datamachine` namespace via `inc/Cli/Bootstrap.php`.
Data Machine provides 23 WP-CLI command namespaces for managing pipelines, flows, jobs, agents, and more from the command line. All commands are registered under the `datamachine` namespace via `inc/Cli/Bootstrap.php`.

> **Note:** The `wp datamachine workspace` and `wp datamachine github` commands have been moved to the `data-machine-code` extension plugin.

## Available Commands

Expand Down Expand Up @@ -249,56 +251,6 @@ wp datamachine agent paths
wp datamachine agent paths --agent=my-agent --format=json
```

**Options**: `--user`, `--agent`, `--format`, `--relative`

### datamachine workspace

Manage the agent workspace (cloned repositories). **Since**: 0.31.0

```bash
# Show workspace path
wp datamachine workspace path
wp datamachine workspace path --ensure # create if missing

# List repos
wp datamachine workspace list

# Clone a repository
wp datamachine workspace clone https://github.com/user/repo.git
wp datamachine workspace clone https://github.com/user/repo.git --name=my-repo

# Show repo info (branch, remote, dirty status)
wp datamachine workspace show my-repo

# Read a file
wp datamachine workspace read my-repo src/index.php
wp datamachine workspace read my-repo src/index.php --offset=10 --limit=50

# List directory contents
wp datamachine workspace ls my-repo src/

# Write a file
wp datamachine workspace write my-repo src/config.php --content="<?php // config"
echo "content" | wp datamachine workspace write my-repo src/file.txt

# Edit a file (find and replace)
wp datamachine workspace edit my-repo src/file.php --old="oldText" --new="newText"
wp datamachine workspace edit my-repo src/file.php --old="oldText" --new="newText" --replace-all

# Git operations
wp datamachine workspace git status my-repo
wp datamachine workspace git pull my-repo
wp datamachine workspace git add my-repo --path=src/
wp datamachine workspace git commit my-repo "commit message"
wp datamachine workspace git push my-repo
wp datamachine workspace git log my-repo --limit=10
wp datamachine workspace git diff my-repo --staged

# Remove a repo
wp datamachine workspace remove my-repo --yes
```

### datamachine system

System tasks and health checks. **Since**: 0.41.0

Expand Down Expand Up @@ -335,37 +287,6 @@ wp datamachine batch status 42

# Cancel a running batch
wp datamachine batch cancel 42
```

### datamachine github

GitHub integration. **Since**: 0.33.0

```bash
# Check integration status
wp datamachine github status

# List issues
wp datamachine github issues --repo=user/repo --state=open --labels=bug

# View an issue
wp datamachine github view 42 --repo=user/repo

# Close an issue
wp datamachine github close 42 --repo=user/repo --comment="Fixed in v1.2"

# Comment on an issue
wp datamachine github comment 42 "Working on this" --repo=user/repo

# List pull requests
wp datamachine github pulls --repo=user/repo --state=open

# List repos for a user/org
wp datamachine github repos Extra-Chill
```

**Options**: `--repo`, `--state`, `--labels`, `--assignee`, `--per_page`, `--page`, `--format`

### datamachine image

Image generation and optimization. **Since**: 0.33.0
Expand Down Expand Up @@ -754,15 +675,3 @@ fi
wp datamachine agent read
wp datamachine agent write "## Status" "All systems operational"
wp datamachine agent search "operational"
```

### Workspace git workflow

```bash
# Clone, edit, commit, push
wp datamachine workspace clone https://github.com/user/repo.git
wp datamachine workspace edit repo src/config.php --old="v1.0" --new="v1.1"
wp datamachine workspace git add repo --path=src/config.php
wp datamachine workspace git commit repo "bump version to 1.1"
wp datamachine workspace git push repo
```
Loading
Loading