You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turn Data Machine into agent infrastructure for WordPress. The agent — not the user — is the primary entity. Pipelines, flows, jobs, and memory files belong to agents. Users have access to agents (many-to-many). External runtimes (Kimaki, REST API clients, cron) execute as agents.
This enables:
Site-wide shared agents that multiple users can access
Personal agents per user for private workflows
External runtimes (Kimaki, CLI) that authenticate as a specific agent
Agent files (SOUL.md, MEMORY.md) are already filesystem-scoped by agent slug
Kimaki sessions already authenticate as a specific agent via AGENTS.md injection
Proposed Model
Agent (agent_id) — primary entity
├── pipelines (agent_id column)
├── flows (agent_id column, inherited from pipeline)
├── jobs (agent_id column, inherited from flow)
├── memory files (SOUL.md, MEMORY.md — already scoped by slug)
├── runtime config (endpoint, API keys, model preferences)
└── access grants (many-to-many with users)
├── User A → role: admin (full control)
├── User B → role: operator (run flows, view jobs)
└── User C → role: viewer (read-only)
Key Principles
Agent is the citizen — not a sub-object of a user. Agents have identity, memory, and workflows independent of any particular user.
Users access agents — a join table (datamachine_agent_access) maps users to agents with role-based permissions.
Runtimes execute as agents — CLI, REST API, Kimaki, Action Scheduler all authenticate as a specific agent. The agent_id is the scoping key, not user_id.
Backward compatible — agent_id = NULL or 0 means "unscoped / single-agent mode" (existing installs work without migration).
Vision
Turn Data Machine into agent infrastructure for WordPress. The agent — not the user — is the primary entity. Pipelines, flows, jobs, and memory files belong to agents. Users have access to agents (many-to-many). External runtimes (Kimaki, REST API clients, cron) execute as agents.
This enables:
Current State
datamachine_agentstable exists withid,agent_slug,owner_idpipelines,flows,jobshaveuser_idcolumns (added in multi-agent Phase 1)Proposed Model
Key Principles
datamachine_agent_access) maps users to agents with role-based permissions.agent_id = NULLor 0 means "unscoped / single-agent mode" (existing installs work without migration).Schema Changes
Modify existing tables
New table: agent access grants
Roles
admin— full control (create/edit/delete pipelines, manage agent settings, grant access)operator— run flows, view jobs, add to queuesviewer— read-only access to pipelines, flows, jobsImplementation Phases
Phase 1: Schema + DB layer
agent_idcolumns with migrationdatamachine_agent_accesstableagent_idfilteragent_idfrom the agent matchingowner_id = user_idPhase 2: Permission layer
PermissionHelper::resolve_scoped_agent_id($request)— resolve which agent the request is scoped toPermissionHelper::can_access_agent($agent_id, $role)— check if acting user has required role on this agentagent_idinstead of (or in addition to)user_idPhase 3: REST API + Admin UI
?agent_id=Xquery param on all list endpointsPhase 4: Runtime authentication
PermissionHelper::acting_agent_id()alongsideacting_user_id()Relationship to Existing PRs
user_idremains for "who created this" audit trail;agent_idbecomes the primary scoping key.Questions
user_idcolumns be kept alongsideagent_idfor audit trail ("who created this pipeline"), or replaced entirely?owner_idondatamachine_agentsbecome the default admin indatamachine_agent_access, or stay as a separate field?Depends on: #573 (user-level scoping — foundation)