Skip to content

feat: Multi-agent Phase 2 — directives resolve user context from execution#572

Merged
chubes4 merged 6 commits intomainfrom
feature/multi-agent-phase2-directives
Mar 4, 2026
Merged

feat: Multi-agent Phase 2 — directives resolve user context from execution#572
chubes4 merged 6 commits intomainfrom
feature/multi-agent-phase2-directives

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 3, 2026

Summary

Phase 2 of multi-agent support (#560). Directives now resolve user_id from execution context so each agent's files (SOUL.md, MEMORY.md, etc.) are read from the correct per-user directory.

Changes

7 files changed, 31 insertions, 9 deletions

Pipeline path

  • RunFlowAbility — propagates flow's user_id to job record and engine snapshot
  • AIStep — extracts user_id from engine snapshot into the payload passed to directives

Chat path

  • ChatOrchestrator — threads user_id through options into loop_context
  • All three callers (processChat, processContinue, processPing) pass user_id

Directives

  • CoreMemoryFilesDirective — resolves user_id from $payload, passes to DirectoryManager::get_agent_directory()
  • MemoryFilesReader::read() — accepts $user_id param (default 0 for backward compat)
  • PipelineMemoryFilesDirective / FlowMemoryFilesDirective — pass user_id through to MemoryFilesReader

Data flow

Pipeline:  Flow (user_id) → RunFlowAbility → engine snapshot → AIStep → payload → Directives
Chat:      ChatOrchestrator (user_id) → options → loop_context → payload → Directives
System:    SystemAgent → user_id=0 (global, no agent scoping)

Backward Compatibility

All user_id parameters default to 0 — existing single-agent installs get the legacy shared agent directory with zero configuration changes.

Refs

Closes #565
Parent: #560

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Homeboy Results — data-machine

lint (changed files only)

test

  • PHPCS: LINT SUMMARY: 233 errors, 199 warnings
  • Fixable: 176 | Files with issues: 109 of 346
Top violations
  WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine    93
  WordPress.DB.PreparedSQL.NotPrepared                       73
  Generic.CodeAnalysis.UnusedFunctionParameter.Found         36
  Generic.Formatting.MultipleStatementAlignment.NotSameWarning    35
  WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned    35
- PHPStan: PHPSTAN SUMMARY: 135 errors at level 5 - BUILD FAILED: PHPUnit tests

audit


Homeboy Action v1 — homeboy 0.53.0

chubes4 added 6 commits March 4, 2026 05:16
…chemas

Both abilities return different fields depending on the execution path
(single vs bulk, with/without flow). Fields like flow_id are null when
no flow_config is provided, but the output schema declared them as
strict 'integer', causing WP_Ability::validate_output() to reject the
result with ability_invalid_output. Use array('integer', 'null') union
types per JSON Schema spec to allow null values.
…nt (#565)

Phase 2 of multi-agent support: directives now read the correct agent's
files based on user_id from the execution context.

Pipeline path:
- RunFlowAbility propagates flow's user_id to job record and engine snapshot
- AIStep extracts user_id from engine snapshot into payload

Chat path:
- ChatOrchestrator threads user_id through options into loop_context
- All three callers (processChat, processContinue, processPing) pass user_id

Directives:
- CoreMemoryFilesDirective resolves user_id from payload, passes to
  DirectoryManager::get_agent_directory()
- MemoryFilesReader::read() accepts user_id param (default 0 for compat)
- PipelineMemoryFilesDirective and FlowMemoryFilesDirective pass user_id
  through to MemoryFilesReader

All changes default to user_id=0 — existing single-agent installs keep
working without configuration.

Refs: #565, #560
…oader

Homeboy's WP test bootstrap loads the plugin on plugins_loaded, but
the plugin requires vendor/autoload.php (PSR-4 autoloader). Without
running composer install, no DataMachine classes are autoloadable,
causing 'Class not found' fatals in PHPUnit.
BaseCommand extends WP_CLI_Command, which isn't available in the
test environment without this dependency. WordPress core doesn't
include WP-CLI.
@chubes4 chubes4 force-pushed the feature/multi-agent-phase2-directives branch from 06be5dc to fd967c1 Compare March 4, 2026 05:17
@chubes4 chubes4 merged commit e071588 into main Mar 4, 2026
1 check failed
@chubes4 chubes4 deleted the feature/multi-agent-phase2-directives branch March 4, 2026 05:50
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.

Multi-agent: directives resolve user context from execution

1 participant