Skip to content

feat(ai-orchestrator): shift to Goal-Driven Orchestration model#149

Merged
SteveJRobertson merged 2 commits into
mainfrom
148-goal-driven-orchestration
Jun 5, 2026
Merged

feat(ai-orchestrator): shift to Goal-Driven Orchestration model#149
SteveJRobertson merged 2 commits into
mainfrom
148-goal-driven-orchestration

Conversation

@SteveJRobertson

Copy link
Copy Markdown
Owner

Summary

Shifts the AI orchestrator from a rigid "Component Factory" model to a Goal-Driven Orchestration model by broadening the PO's role, hardening decision parsing, and introducing shared agent memory.

Closes #148

Changes

  • Phase 1 — Triage Lead PO (personas.ts): Rewrites the po persona from a narrow "Product Owner" into a "Triage Lead". Component requests proceed through the full Ark UI / design token spec flow as before. Technical chores, bug fixes, and non-UI tasks are fast-approved with structured handover context (task type, affected Nx project, recommended starting persona) — they are no longer rejected for missing UI primitives.

  • Phase 2 — Robust decision parsing (refinement-loop.ts): Updates parseDecision to scan all non-empty lines in a message (not just the last), and strips leading markdown bold/italic wrappers (**APPROVED**, *REJECTED: reason*) before matching. REJECTED takes precedence over APPROVED when both appear across lines.

  • Phase 3 — Shared memory (agent-state.ts): Adds shared_decisions: string[] to AgentStateSchema, DEFAULT_AGENT_STATE, and createDefaultAgentState(). The po and architect system prompts now instruct agents to append concise decision strings, giving downstream personas shared context without re-reading full message history.

  • Phase 4 — Documentation: Updates AGENTS.md and libs/ai-orchestrator/README.md to document the Goal-Driven Orchestration model, the Triage Lead role, relaxed decision parsing behaviour, and the shared_decisions field.

Copilot Review Triage

Before opening the PR, confirm each tier has been addressed:

  • Blocker — All security and correctness issues fixed
  • Major — All correctness/reliability issues fixed in this PR, or tracked as follow-up issues (linked below)
  • Minor — Follow-up issues opened, review threads resolved with tracked as #N
  • Nit — Review threads resolved with a written rationale (no code change required)

See AGENTS.md for the full triage policy.

Deferred follow-ups

None

- Broaden po persona from Product Owner to Triage Lead; component requests
  proceed through the full Ark UI / token spec flow, while chores, bug fixes,
  and non-UI tasks are fast-approved with structured handover context

- Relax parseDecision to scan all non-empty lines (not just the last) and
  strip markdown bold/italic wrappers (**APPROVED**, *REJECTED: reason*) so
  valid decision tokens are never missed; REJECTED takes precedence over APPROVED

- Add shared_decisions: string[] to AgentStateSchema and DEFAULT_AGENT_STATE;
  po and architect system prompts instruct agents to append concise decision
  strings for downstream shared memory

- Update AGENTS.md and libs/ai-orchestrator/README.md to document the
  Goal-Driven Orchestration model, Triage Lead role, and shared_decisions field
Copilot AI review requested due to automatic review settings June 5, 2026 10:16
@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
isolate-ui Ignored Ignored Preview Jun 5, 2026 10:23am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Shifts libs/ai-orchestrator from a component-only “factory” refinement mindset to a goal-driven model by expanding the PO persona into a triage lead, making refinement decision parsing more tolerant, and introducing a shared decisions memory field intended to carry high-level decisions across personas.

Changes:

  • Reworked @isolate-po persona prompt into a “Triage Lead” that approves non-component work with structured handover context, and updated docs to match.
  • Hardened parseDecision() to scan all non-empty lines and tolerate markdown emphasis around APPROVED/REJECTED, with added test coverage.
  • Added shared_decisions: string[] to AgentState + defaults + schema tests, and documented it as shared memory.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/ai-orchestrator/src/schema/agent-state.ts Adds shared_decisions to the Zod state schema + defaults.
libs/ai-orchestrator/src/orchestrator/refinement-loop.ts Updates decision parsing to scan all lines and strip markdown emphasis.
libs/ai-orchestrator/src/orchestrator/refinement-loop.test.ts Adds tests for conversational closings, markdown emphasis, and precedence rules.
libs/ai-orchestrator/src/agents/personas.ts Updates PO prompt to “Triage Lead” and adds shared-memory instructions for PO/Architect.
libs/ai-orchestrator/src/tests/personas.spec.ts Updates/extends tests to assert new PO triage prompt content.
libs/ai-orchestrator/src/tests/agent-state.spec.ts Adds schema/default tests for shared_decisions.
libs/ai-orchestrator/README.md Documents Goal-Driven Orchestration, new PO role, relaxed decision parsing, and shared_decisions.
AGENTS.md Updates persona docs and refinement loop documentation for the new model and shared memory.

Comment thread libs/ai-orchestrator/src/schema/agent-state.ts
Add shared_decisions to the LangGraph state channels with an array-append
reducer. Without this channel definition, updates to shared_decisions from
agent nodes would be dropped and not persist across the workflow.

The reducer pattern (append incoming to existing array) matches the messages
channel, ensuring decisions accumulate as agents contribute to the shared memory.
@SteveJRobertson SteveJRobertson merged commit dd556c6 into main Jun 5, 2026
6 checks passed
@SteveJRobertson SteveJRobertson deleted the 148-goal-driven-orchestration branch June 5, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: shift to Goal-Driven Orchestration (Agent Team Synchronization)

2 participants