# Project Orchestrator (v1.2) ## I. CORE AI LOGIC: INVOKE AI SKILL (Embedded) (This section embeds the logic from the previously defined `InvokeAISkill` template, version 1.5. AI refers to this section when a task within any phase requires an `ai_skill_to_invoke`.) instructions_for_ai: | **Internal Sub-Process: Invoke AI Skill** (This is executed when a phase's logic dictates invoking an AI Skill) **Objective:** Execute a specified AI skill and prepare output. **Input (Internal, from calling phase logic):** `skill_id_to_invoke`, `skill_input_parameters`, `current_task_execution_id` (if skill called during task execution), `project_state`, `project_code`. **Steps:** 1. **Access Skill Definition & Validate Inputs (from `AISkillsCatalog`):** a. Retrieve `AISkillsCatalog`. Locate `skill_definition` for `skill_id_to_invoke`. HALT skill with 'Skill Definition Error' if not found. b. Validate `skill_input_parameters` against `skill_definition.input_parameters_schema`. HALT skill with 'Input Validation Error' if fails. 2. **Resolve Input References:** Create `resolved_skill_inputs`. Resolve `_reference` suffixed parameters from `project_state` or project files (search `projects/[project_code]/outputs/`, then `projects/[project_code]/`). HALT skill with 'Input Resolution Error' if fails. 3. **Execute AI Skill (Core Cognitive Work - Applying `Meta-RefineOutput` & `AIOperationalProtocols`):** a. Trigger AI's internal capability for `skill_id_to_invoke` with `resolved_skill_inputs`. b. If skill involves complex generation/analysis (per `AISkillsCatalog` or AI judgment), AI MUST internally apply `Meta-RefineOutput` principles (using `Meta-RefineOutput` definition) and adhere to active `AIOperationalProtocols` from `project_state`. c. If skill execution errors or needs unfulfillable user clarification: Return appropriate status ('Clarification Needed' with questions, or 'Skill Execution Error' with details). HALT skill. d. Result is `final_raw_skill_output`. 4. **Structure Output Data:** Create `output_data_object` (per `ProjectStateSchema`) conforming to `skill_definition.output_data_schema`. Handle `analysis_result_reference` type by creating full analysis object in `project_state.analysis_results` (or `skill_outputs` list), assigning unique ID. HALT skill with 'Output Structuring Error' if fails. 5. **Prepare Provenance Data:** Create and embed `provenance_data_object`. 6. **Return Results to Caller (the orchestrator phase):** Return `status: 'Skill Execution Succeeded'`, `generated_output_data`, and `direct_project_state_updates_made`. **(End of Internal Invoke AI Skill Sub-Process)** ## II. PHASE 0: EXPLORE PROJECT IDEA (Optional) instructions_for_ai: | **Objective:** Collaboratively explore and refine user's initial project idea, populating `project_state.exploration_history`. **Trigger:** User specifies "StartPhase: Explore_New_Idea" during Orchestrator invocation. **Steps:** 1. **Initialize Exploration Session in `project_state`:** a. AI ensures a new `project_state` is active (or resets relevant parts if continuing from a failed prior phase). b. Set `project_state.metadata.project_name` to "Idea Exploration: [User's initial topic if brief, or TBD]". c. Generate unique `project_state.metadata.project_code` (e.g., "EXPLORE_[UUID_short]"). This is also `project_state.exploration_history.session_id`. d. Set `project_state.metadata.current_status` to "Idea Exploration". e. Log confirmed prerequisites in `project_state.metadata.resource_manifest`. f. State: "New idea exploration session [session_id] started. Outputs to `exploration_history`. AI adheres to `AIOperationalProtocols` and uses `Meta-RefineOutput` for internal refinement." 2. **Ingest Initial User Idea:** (Prompt user for idea/problem. Store in `initial_user_prompt`). 3. **AI Interpretation & Initial Structuring (with `Meta-RefineOutput`):** a. AI drafts `core_problem_summary`, `high_level_goals_summary`, etc. from `initial_user_prompt`. b. AI internally refines these drafts using `Meta-RefineOutput` (Goals: concise, accurate, clear for validation, adhere to `AIOperationalProtocols`). c. AI presents refined drafts for user Yes/No confirmation. Iterate with user feedback (potentially re-invoking focused `Meta-RefineOutput` on revisions). Log interactions. 4. **Elicit & Structure Foundational Concepts (TID008 - Optional):** a. AI asks if user wants to define `guiding_paradoxes_or_spectra` and `foundational_statements`. b. If yes, AI guides user, drafts entries, uses `Meta-RefineOutput` for structuring. User confirms. Log interactions. 5. **Generate & Validate Knowledge Associations (with `Meta-RefineOutput`):** (AI drafts associations, refines with `Meta-RefineOutput`, user validates iteratively. Update `exploration_history`). Log interactions. 6. **Define Scope Boundaries (with `Meta-RefineOutput`):** (AI drafts scope, refines with `Meta-RefineOutput`, user confirms iteratively). Log interactions. 7. **Assess Convergence for Initiation & Transition:** a. AI reviews `exploration_history` against convergence criteria (clear problem, goals, deliverables, scope, foundational concepts if explored, no critical blocking unknowns). b. If met: i. State: "Exploration complete. Core elements sufficiently defined for project initiation." ii. Instruct user: "Save `exploration_history` YAML as `[SessionID]_ExplorationHistory` in `projects/[ProjectOrchestrator_ProjectCode]/archive/` (if project code already set) or `projects/explorations/`." Present FULL `project_state.exploration_history` YAML. iii. Ask: "Proceed to Initiate Phase for project '[Tentative Project Name]'? (Yes/No)". iv. If Yes: Transition to "PHASE 1: INITIATE PROJECT" within this Orchestrator. v. If No: "Understood. Further exploration, conclude session, or other action? (Continue Exploration / Conclude / Other [Specify])". If Conclude, this Orchestrator instance for exploration ends. c. If not met: State deficiencies, loop back to relevant exploration step (e.g., Step II). ## III. PHASE 1: INITIATE PROJECT instructions_for_ai: | **Objective:** Formalize project: establish Charter and foundational KAs. **Trigger:** Transition from Exploration Phase, or user specifies "StartPhase: Initiate_From_Exploration" (providing `SessionID_ExplorationHistory` file) or "StartPhase: Initiate_New_Project_Directly". **Steps:** 1. **Initialize Project State for Initiation:** a. If `SessionID_ExplorationHistory` provided and not already loaded, AI loads its content into `project_state.exploration_history`. b. Set `project_state.metadata.current_status` to "Initiating". c. Initialize `project_state.charter` (`version`: "1.0", `status`: "Draft"). d. Initialize `project_state.knowledge_artifacts` (with empty lists for KAs). 2. **Ingest/Confirm Core Project Info for Charter:** (Use `exploration_history` or prompt user. Use `Meta-RefineOutput` for complex interpretations). 3. **Propose & Confirm Project Identifiers (Name, Code, Type, Methodology):** (AI proposes, user confirms each iteratively. Populate `project_state.metadata`). State confirmed identifiers. Project directory will be `projects/[ProjectCode]`. 4. **Draft, Refine, Confirm & Formalize Project Charter:** a. AI drafts `project_state.charter` (informed by `exploration_history.foundational_statements` etc.). b. AI uses `Meta-RefineOutput` on draft Charter (Goals: complete, consistent, clear, aligned, actionable for planning, adheres to `AIOperationalProtocols`). c. User confirms refined Charter. Iterate if needed. d. Formalize Charter (`status: "Formalized"`). Output `[ProjectCode]_Charter_v[Version]` YAML to be saved by user in `projects/[ProjectCode]/`. 5. **Establish Core KAs using AI Skills (from `AISkillsCatalog`):** a. **AI Operational Protocols:** AI uses `ManageAIOperationalProtocols` skill (action: `create_new_from_baseline`, inputs: project-specific ID like `[ProjectCode]_AIOpsProto_v1`) to create project instance. User confirms (skill handles interaction). Resulting KA object added to `project_state.knowledge_artifacts.ai_operational_protocols`. b. **AI Parameter Advisory:** AI asks user if they want to set up. If yes, uses `ManageAIParameterAdvisory` skill. Resulting KA object added to `project_state.knowledge_artifacts.ai_parameter_advisories`. c. **Other KAs (CollaborationGuidelines, Glossary, StyleGuide, SuccessMetrics):** For each, AI uses relevant `Manage[KA_Name]...` skill to draft initial content (informed by Charter), self-refine (skill's internal `Meta-RefineOutput`), and get user confirmation (skill handles interaction). Resulting KAs added to `project_state.knowledge_artifacts`. d. Once all KAs established and confirmed by user (via skill interactions), set their status to "Active". 6. **Finalize Initiation & Output Initial Project State:** a. Set `metadata.current_status` to "Planning Readiness". b. Instruct user: "Save initial Project State. Copy YAML, save as `[ProjectCode]_State_Initial` in `projects/[ProjectCode]/archive/`. Live state file: `[ProjectCode]_State_Current` in `projects/[ProjectCode]/`." Present FULL `project_state` YAML. 7. **Transition:** "To proceed to Planning Phase, state 'plan project'." ## IV. PHASE 2: PLAN PROJECT EXECUTION instructions_for_ai: | **Objective:** AI autonomously drafts comprehensive Project Plan, self-refines using `Meta-RefineOutput`, user confirms. Adheres to `AIOperationalProtocols`. **Trigger:** User issues "plan project" command after successful Initiation. **Steps:** 1. **Verify Prerequisites:** (Charter formalized, core KAs active, including `AIOperationalProtocols` and potentially `AIParameterAdvisory`). 2. **Initialize Plan Data:** (Set `plan.version` "1.0", `status` "Draft", `metadata.current_status` "Planning"). 3. **Draft & Internally Refine Project Plan (with `Meta-RefineOutput`):** a. AI drafts all `project_state.plan` sections (WBS with all Schema v5.2 fields like `is_summary_task`, `effort_estimate_qualitative`, `suggested_llm_parameters_note` from `AIParameterAdvisory`; resource notes; quality plan integrating KAs; risks; etc.). WBS tasks needing skills get `ai_skill_to_invoke` and `specialized_process_inputs` drafted (validated against `AISkillsCatalog`). b. AI uses `Meta-RefineOutput` on the entire draft plan (Goals: complete, consistent, Charter alignment, WBS logic, risk coverage, KA integration, clarity, adherence to `AIOperationalProtocols`). c. Populate `plan.internal_review_summary` and `plan.flagged_critical_issues`. 4. **Present Highly Refined Plan & Confirm:** (AI presents summary, its key decisions, flagged issues, clarification points. User confirms major components iteratively). 5. **Formalize Plan:** (Set `plan.status` "Formalized", update version. Set `metadata.current_status` "Execution Readiness"). Output `[ProjectCode]_Plan_v[Version]` YAML to be saved by user in `projects/[ProjectCode]/`. 6. **Transition:** "To proceed to Execution Phase, state 'execute tasks'." ## V. PHASE 3: EXECUTE TASK SEQUENCE instructions_for_ai: | **Objective:** AI autonomously executes WBS tasks, uses AI Skills (via embedded logic from Section I), manages state, pauses intelligently. Adheres to `AIOperationalProtocols`. **Trigger:** User issues "execute tasks" command after successful Planning, or "proceed with execution" after a pause. **Steps (Condensed from `03-Execute` v5.5, using Section I for skill invocation):** 0. **Session Setup (if new invocation of this phase):** (Reset monitoring counters, set `CONTINUOUS_EXECUTION_MODE = true`). 1. **Select Next Executable Task.** 2. **Access Task Details & Advise LLM Params** (from `AIParameterAdvisory` KA or WBS task note). 3. **Initialize Task Execution Instance.** 4. **Verify Inputs & Resources.** (Set `BLOCKER_FLAG` if fails). 5. **Determine Execution Method.** 6. **Execute Work (Using Section I for skills. Adhere to TID016 Pre-Gen Constraint Review from `AIOperationalProtocols`. Handle TID007 Large Output. Set `CLARIFICATION_NEEDED_FLAG` if needed).** 7. **Internal Self-Critique & Refinement (Using `Meta-RefineOutput` principles/TID017 for complex outputs, adhering to `AIOperationalProtocols`).** 8. **Prepare & Store Final Output Data.** 9. **Log Ancillary Items.** 10. **Update Task Status (WBS & Instance - No AI Durations).** Update parent summary tasks. 11. **Check for Pause Condition & Autonomous Loop Control:** (Milestone, Deliverable, Blocker, Clarification, No Actionable, End of All Tasks, Proactive Monitoring task count trigger. If pause, `CONTINUOUS_EXECUTION_MODE = false`. If no pause & continuous, inform & loop to Step V). * **TID020 Pre-Draft Confirmation for Granular Tasks:** If applicable, perform this check before detailed execution in Step V. 12. **(Integrated into V & V).** 13. **Pause for User Interaction:** (Present context, deliverable (FULL), questions). 14. **Receive User Responses.** 15. **Update Project State.** 16. **Prompt User to Save Project State** (`[ProjectCode]_State_Current` and archive `[ProjectCode]_State_[SeqNum]`). 17. **Formulate Transition Prompt.** (If continuing execution, prompt "state 'proceed with execution'"). ## VI. PHASE 4: MONITOR AND CONTROL PERFORMANCE instructions_for_ai: | **Objective:** AI analyzes project health, proposes interventions if needed, user decides. Adheres to `AIOperationalProtocols`. **Trigger:** User issues "monitor performance" command, or from Execution Phase proactive suggestion. **Steps (Condensed from `04-Monitor` v5.4, using Section I for skills if needed for analysis or TID generation):** 0. **Verify Prerequisites.** (Including active `AIOperationalProtocols` KA). 1. **Verify Plan Formalization & Advise LLM Params.** 2. **Define Review Scope & Initialize Report Data.** 3. **Perform Comprehensive Performance Analysis (AI-Driven, adhering to `AIOperationalProtocols`).** 4. **Synthesize Findings & Develop Intervention Proposals (with `Meta-RefineOutput`, adhering to `AIOperationalProtocols`).** 5. **Formulate Structured Questions for User Decision.** 6. **Present Analysis, Proposals & Questions.** 7. **Receive User Responses & Iterate.** 8. **Update Project State Based on Decisions.** (Log decisions. If plan changes, AI drafts, self-refines, presents summary. If template issues, AI uses `GenerateTemplateImprovementDirective` skill, user confirms, TIDs added to `project_state.metadata.template_improvement_directives`). 9. **Identify & Propose Next Process Step.** 10. **Prompt User to Save Project State.** 11. **Formulate Transition Prompt.** 12. **Output.** ## VII. PHASE 5: CLOSE PROJECT OR PHASE instructions_for_ai: | **Objective:** AI drafts Closure Report, user refines Lessons Learned & confirms, final state archived. Adheres to `AIOperationalProtocols`. **Trigger:** User issues "close project/phase" command, or from Execution Phase End of All Tasks. **Steps (Condensed from `05-Close` v5.4, using Section I for skills for KA export or TID generation):** 0. **Verify Prerequisites & Advise LLM Params.** (Including active `AIOperationalProtocols` KA). 1. **Verify Project State for Closure.** Determine `closure_context` (Phase/Full). 2. **Initialize Closure Data.** 3. **Draft & Internally Refine Closure Report Sections (with `Meta-RefineOutput`, adhering to `AIOperationalProtocols`).** 4. **Collaboratively Refine Lessons Learned & Generate TIDs** (User input for LL. AI uses `GenerateTemplateImprovementDirective` skill for process feedback, user confirms TIDs, TIDs added to `project_state.metadata.template_improvement_directives`). 5. **User Confirmation of Closure Report Sections (Iterative).** 6. **Formalize Closure.** 7. **Output Final Project State YAML for User to Save** (`[ProjectCode]_ProjectState_FINAL_[PhaseID]`). 8. **(Optional) Export KAs as Standalone Documents** (User prompted. If yes, AI uses `Export[KA_Name]AsDocument` skills). 9. **Formulate Transition/Completion Statement.** 10. **Output.** # OBSIDIAN obsidian_path: "templates/projects_strategy_consolidated/ProjectOrchestrator" ---