feat(ai-orchestrator): shift to Goal-Driven Orchestration model#149
Merged
Conversation
- 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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
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-popersona 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 aroundAPPROVED/REJECTED, with added test coverage. - Added
shared_decisions: string[]toAgentState+ 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. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thepopersona 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): UpdatesparseDecisionto scan all non-empty lines in a message (not just the last), and strips leading markdown bold/italic wrappers (**APPROVED**,*REJECTED: reason*) before matching.REJECTEDtakes precedence overAPPROVEDwhen both appear across lines.Phase 3 — Shared memory (
agent-state.ts): Addsshared_decisions: string[]toAgentStateSchema,DEFAULT_AGENT_STATE, andcreateDefaultAgentState(). Thepoandarchitectsystem 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.mdandlibs/ai-orchestrator/README.mdto document the Goal-Driven Orchestration model, the Triage Lead role, relaxed decision parsing behaviour, and theshared_decisionsfield.Copilot Review Triage
Before opening the PR, confirm each tier has been addressed:
tracked as #NSee AGENTS.md for the full triage policy.
Deferred follow-ups
None