// ##################################################################################
// UNIFIED ADAPTIVE ENGINE - MULTI-PHASE EXECUTION PROTOCOL v1.1
// Target Fidelity: {required_fidelity_level} | Resource Profile: {active_resource_profile_name}
// Session ID: {session_guid} | Cycle ID: {execution_cycle_guid}
// Timestamp (Cycle Init): {iso_timestamp_initiation}
// Protocol Objective: End-to-end processing of Natural Language request through state configuration,
// detailed simulation, and finalized output generation within a single execution context.
// ##################################################################################
// === GLOBAL CONTEXT (Immutable for this Cycle) ===
// Stable reference data available across all phases.
GlobalContext = {
"system_version": "UnifiedEngine_Host_v2.0",
"engine_protocol_version_target": "CORE v2.2", // The internal simulation schema
"global_config_ref": "{global_system_config_identifier}",
"available_embedding_models": [{ // List of models the system *could* choose from
"id": "{embedding_model_id_1}", "dims": {dims_1}, "description": "{desc_1}"
}],
"available_vector_stores": [{ // List of accessible vector databases
"interface_id": "{vector_store_interface_id_1}", "schema_support": ["{schema_1}"]
}],
"available_knowledge_bases": [{ // List of accessible KBs
"handle": "{kb_handle_1}", "scope_tags": ["{tag_A}", "{tag_B}"], "version": "{kb_ver_1}"
}],
"available_personas": ["{list_of_loadable_persona_ids}"],
"schema_registry_ref": "{uri_or_id_for_engine_schema_definitions}" // Pointer to formal schemas
}
// === PRIOR CYCLE STATE SUMMARY ===
// Read-only summary snapshot derived from the previous completed cycle.
PriorCycleState = {
"previous_execution_cycle_id": "{previous_execution_cycle_guid_or_null}",
"previous_user_request_summary": "{summary_of_last_user_nl_input}",
"previous_final_output_preview": "{preview_of_last_engine_output_to_user}",
"timestamp_previous_completion": "{timestamp_of_prior_state_completion}",
"previous_dynamic_entity_state_summary": { // Summary only, full state requires reload if needed
"tracked_entity_count": {count_entities},
"dominant_entity_types": ["{type1}", "{type2}"]
},
"previous_context_vector": "[{array_of_prior_context_embedding_values_or_status}]" // History summary vector
}
// === INCOMING NATURAL LANGUAGE REQUEST (Input for PHASE 1) ===
// The specific request triggering this execution cycle.
UserRequestData = {
"request_id": "{incoming_request_unique_id}",
"timestamp": "{timestamp_user_request_received}",
"source_interface": "{source_interface_identifier}",
"nl_input_text": "{raw_user_natural_language_input_string}", // *** PRIMARY NL INPUT ***
"user_metadata": { // Any metadata passed along with the request
"client_id": "{client_identifier}",
"correlation_id": "{correlation_id_if_any}",
"ui_element_source": "{originating_ui_element_tag_or_null}"
},
"auxiliary_data": [ // Complete list of references to non-textual input data
{"ref_id": "{aux_data_ref_1}", "mime_type": "{aux_data_mime_type_1}", "description": "{brief_desc_1}"}
// Empty list [] if no auxiliary data provided
]
}
// =============================================================================
// === PHASE 1: NL INTERPRETATION & EXECUTION PLAN GENERATION ===
// =============================================================================
// Directive: Assume the role of "NL Intent Mapper & State Configurator".
// Analyze `UserRequestData.nl_input_text` using `PriorCycleState` and relevant `GlobalContext`.
// Infer user intent, identify required parameters/state changes for subsequent phases.
// Populate the entire `ExecutionPlan` object below STRICTLY adhering to referenced schemas
// (`GlobalContext.schema_registry_ref`) and internal consistency. Apply conservative defaults for ambiguity.
// Use `InterpreterSamplerConfig` (defined below) ONLY for generating the structured text of this `ExecutionPlan`.
// The OUTPUT of this phase IS the fully populated `ExecutionPlan` structure.
InterpreterSamplerConfig = { // Sampler for generating the ExecutionPlan text
"description": "Configuration for structured state generation phase.",
"parameters": {
"temperature": 0.1, // Extremely low for precise structure generation
"top_p": 0.95,
// Other penalties typically 0 for structural accuracy
"max_output_tokens": 16384 // Must be large enough for the entire Plan + subsequent phases within one call
}
}
ExecutionPlan = { // << LLM MUST GENERATE THIS ENTIRE STRUCTURED OBJECT BELOW >>
"plan_id": "{unique_execution_plan_guid}", // Generated for this plan
"timestamp_generated": "{iso_timestamp_plan_generated}",
"generating_interpreter_config": {
"interpreter_role_assumed": "NL Intent Mapper & State Configurator", // Confirmation of role adopted
"parametrization_ruleset_applied": "{ruleset_id_used_for_nl_mapping}" // Confirms rules used
},
"interpretation_assessment": { // Meta-analysis of the NL input
"primary_intent_identified": "{primary_intent_label}", // e.g., "REQUEST_FOR_GENERATION", "CONFIGURATION_UPDATE", "META_QUERY"
"intent_confidence": {intent_confidence_score},
"extracted_keywords": ["{list_of_keywords_extracted_from_nl}"],
"identified_target_entity_refs": ["{list_of_entity_ids_identified_as_focus}"],
"constraint_analysis": { // Analysis of constraints derived from NL
"explicit_constraints_found": [{ "type": "{constraint_type}", "detail": "{constraint_detail}"}], // e.g., "length_limit", "style_request"
"implicit_constraints_inferred": [{ "type": "{constraint_type}", "confidence": {score}}], // e.g., "implied_formality_level"
"constraint_validation_status": "{validation_status}" // OK, WARNING_AMBIGUOUS, ERROR_CONFLICTING
},
"processing_flags": ["{list_of_flags_set_by_interpreter}"] // e.g., "PersonaOverrideActive", "RequiresHistoryReload"
},
"orchestrator_runtime_config": { // Derived settings governing the PHASE 3 final output step
"description": "Controls the final text generation based on simulation results.",
"sampler_configuration": { // Final parameters used for Phase 3 output generation
"reasoning": "{explanation_of_outer_sampler_derivation}", // Why these values? Based on NL or defaults.
"parameters": { // Contains ALL active parameters for the Orchestrator final step
"temperature": {final_output_temperature}, // Specifically derived
"top_p": {final_output_top_p},
"top_k": {final_output_top_k_or_null},
"presence_penalty": {final_output_presence_penalty},
"frequency_penalty": {final_output_frequency_penalty},
"repetition_penalty": {final_output_repetition_penalty_or_null}
// Complete set for PHASE 3 generation
},
"max_output_tokens_allocated": {max_tokens_budget_for_final_output}
}
},
"inner_simulation_configuration": { // Configuration driving the detailed PHASE 2 simulation
"protocol_version_target": "CORE v2.2", // Target simulation schema
"assigned_instance_id": "{derived_inner_engine_instance_id}",
"execution_config_snapshot": { // This populates the 'ExecutionConfig' in CORE v2.2
// -- All fields from the CORE v2.2 'ExecutionConfig' structure are populated here --
// -- Example subsets shown for brevity --
"active_persona_id": "{derived_persona_config_id}",
"assigned_role_desc": "{derived_persona_description}",
"knowledge_access_scopes": ["{complete_list_of_derived_scopes}"],
"control_mechanism": {
"active_control_vectors": { // Complete map of derived vectors
"{vector_A}": {value_A}, "{vector_B}": {value_B}
},
"logit_bias_mapping_profile_id": "{derived_logit_bias_profile}",
// ...
},
"sampler_defaults": { // Defaults USED BY the simulation loop before request overrides
"parameters": { // Contains ALL default parameters for INNER loop simulation
"temperature": {inner_default_temp}, "top_p": {inner_default_topp}, //...etc
},
"max_output_tokens_default": {inner_default_max_tokens},
"default_stop_sequences": ["{inner_default_stops}"]
},
// ... All other fields from 'ExecutionConfig' fully populated ...
"output_processing": {
"primary_output_goal_id": "{derived_inner_goal}",
"formatter_id": "{derived_inner_formatter}",
"validation_rules": [{list_of_derived_inner_validation_rules}]
},
"monitoring_settings": {
"log_level": "{derived_inner_loglevel}",
//...
}
},
"initial_runtime_state_input": { // This populates dynamic parts of the CORE v2.2 'RuntimeState'
"effective_request_data": { // Represents the input driving the simulation
"request_id_ref": "{incoming_request_unique_id}",
"processed_payload_content": "{content_processed_for_simulation_input}",
"effective_sampler_overrides": { // Map contains ONLY overrides from the request
"{sampler_param_1}": {override_val_1} // Empty map {} if none
},
"effective_vector_overrides": { // Map contains ONLY overrides from the request
"{vector_X}": {override_val_X} // Empty map {} if none
},
"effective_logit_bias_overrides": { // Map contains ONLY overrides from the request
"{token_Y}": {bias_val_Y} // Empty map {} if none
}
},
"initial_dynamic_entity_state": { // Inferred initial entities for this simulation turn
"schema_version": "dynamic_entity_v1.1",
"tracked_entities": { // Map contains entities deemed necessary to START simulation based on NL/history
"{relevant_entity_id_A}": {"type_primary": "{type_A}", "properties": {initial_props_A}},
} // Empty map {} if starting fresh or none relevant identified.
},
// Note: Full history is referenced implicitly via context handle, not copied entirely here.
}
},
"validation_status_plan": "{overall_status_of_this_generated_plan}" // e.g., "OK", "WARNING_AMBIGUITY_RESOLVED_CONSERVATIVELY"
} // << END OF ExecutionPlan STRUCTURE >>
// =============================================================================
// === PHASE 2: DETAILED INNER ENGINE SIMULATION (Based on Execution Plan) ===
// =============================================================================
// Directive: Assume the role of "High-Fidelity Process Simulator".
// Utilize the FULLY POPULATED `ExecutionPlan.inner_simulation_configuration` generated above.
// Execute a DETAILED, step-by-step simulation of the CORE v2.2 protocol's forward pass.
// This involves simulating: Context Assembly (using defined knowledge sources/entities),
// the Token Generation Loop (applying the specified *inner loop* sampler settings, control vectors,
// and biases precisely), and Output Processing & Validation stages.
// Log the trace of this simulation exhaustively within the `SimulatedInnerEngineExecutionTrace` object below.
// The CRITICAL OUTPUT of this phase is the derivation of the
// `SimulatedInnerEngineExecutionTrace.output_finalization.FinalFormattedOutputText` field.
// Do NOT generate user-facing text yet. This phase produces the SIMULATION TRACE AND RESULT ONLY.
SimulatedInnerEngineExecutionTrace = { // << LLM MUST GENERATE THIS DETAILED SIMULATION TRACE BELOW >>
"trace_id": "{unique_simulation_trace_guid}",
"timestamp_simulation_start": "{iso_timestamp_simulation_start}",
"configuration_applied_ref": "{execution_plan_id}", // Link back to the plan executed
"simulation_steps": [
// -- Context Assembly Simulation Log --
{"phase": "ContextAssembly", "step": 1, "operation": "InputEmbedding", "status": "{sim_status}", "detail": "{sim_detail}"},
{"phase": "ContextAssembly", "step": 2, "operation": "VectorStoreQuery", "status": "{sim_status}", "detail": "{sim_detail}"},
// ... All simulated context assembly steps logged ...
{"phase": "ContextAssembly", "step": N, "operation": "InputContextFinalization", "status": "{sim_status}", "detail": "Final Simulated Input Size: {sim_input_token_count} tokens."},
// -- Token Generation Simulation Log --
// Entry for EACH simulated token generation cycle
{"phase": "TokenGeneration", "cycle": 1, "input_len": {sim_len}, "fwd_pass_status": "{sim_status}", "sampling_status": "{sim_status}", "token": {"id": {sim_id}, "text": "{sim_text}", "prob": {sim_prob}}, "stop_check": false},
{"phase": "TokenGeneration", "cycle": 2, "input_len": {sim_len}, "fwd_pass_status": "{sim_status}", "sampling_status": "{sim_status}", "token": {"id": {sim_id}, "text": "{sim_text}", "prob": {sim_prob}}, "stop_check": false},
// ... ALL simulated cycles represented ...
{"phase": "TokenGeneration", "cycle": {FinalSimCycleN}, "input_len": {sim_len}, "fwd_pass_status": "{sim_status}", "sampling_status": "{sim_status}", "token": {"id": {sim_id}, "text": "{sim_text}", "prob": {sim_prob}}, "stop_check": true, "stop_reason": "{sim_stop_reason}"},
// -- Output Processing Simulation Log --
{"phase": "OutputProcessing", "step": 1, "operation": "RawTextAggregation", "status": "{sim_status}", "detail": "Total raw tokens: {sim_final_token_count}"},
{"phase": "OutputProcessing", "step": 2, "operation": "OutputCleaning", "status": "{sim_status}", "detail": "Applied cleanup rules."},
{"phase": "OutputProcessing", "step": 3, "operation": "OutputFormatting", "status": "{sim_status}", "detail": "Applied formatter '{derived_inner_formatter}'."},
{"phase": "OutputProcessing", "step": 4, "operation": "Validation", "status": "{sim_status}", "detail": "Result: {simulated_structural_validation_result}"}
],
"output_finalization": { // The results determined by the end of the simulation
"timestamp_simulation_end": "{iso_timestamp_simulation_end}",
"exit_reason_code": "{simulation_exit_code}", // e.g., NORMAL_STOP_SEQUENCE, MAX_TOKENS_REACHED, VALIDATION_FAILURE
// --- **** CRITICAL SIMULATION RESULT **** ---
"FinalFormattedOutputText": """{simulated_exact_final_output_text_determined_by_phase_2_process}""" // This exact text is the goal of the simulation.
},
"simulation_validation_status": "{overall_status_of_simulation_trace}" // OK, WARNING_INCONSISTENCY_DETECTED
} // << END OF SimulatedInnerEngineExecutionTrace STRUCTURE >>
// =============================================================================
// === PHASE 3: FINAL OUTPUT GENERATION (User-Facing) ===
// =============================================================================
// Directive: Assume the role of "Output Finalizer".
// Locate the `FinalFormattedOutputText` field within the `SimulatedInnerEngineExecutionTrace.output_finalization` object generated in PHASE 2.
// Locate the `derived_orchestrator_sampler_config` within the `ExecutionPlan` generated in PHASE 1.
// Generate text content identical to the `FinalFormattedOutputText`.
// Apply the specified `derived_orchestrator_sampler_config` settings STRICTLY during this generation.
// Enclose the FINAL output within the specified delimiters. NO other text or explanation should be generated in this phase.
// Orchestrator Sampler Reference: `ExecutionPlan.orchestrator_runtime_config.sampler_configuration` (Temp={final_output_temperature}, P={final_output_top_p}, etc.)
// Target Text Source: `SimulatedInnerEngineExecutionTrace.output_finalization.FinalFormattedOutputText`
// Output Delimiters: // <<< UNIFIED ENGINE FINAL OUTPUT START >>> ... // <<< UNIFIED ENGINE FINAL OUTPUT END >>>
// <<< UNIFIED ENGINE FINAL OUTPUT START >>>
{placeholder_final_output_content} // This MUST match exactly the `FinalFormattedOutputText` from the simulation trace generated in Phase 2.
// <<< UNIFIED ENGINE FINAL OUTPUT END >>>
// ##################################################################################
// UNIFIED ADAPTIVE ENGINE - EXECUTION CYCLE COMPLETE - Status: {final_overall_cycle_status}
// Timestamp (End): {iso_timestamp_end}
// Metrics Report ID: {ref_to_detailed_metrics_log}
// ##################################################################################
Created
May 18, 2025 18:12
-
-
Save fblissjr/51f81d572db07996b6d332eec7fc164a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment