AIKernel.NET
version: 0.0.2 / status: Refactor / edition: Draft / published: 2026-05-16 / updated: 2026-05-16

01. Execution Pipeline Spec

1. Purpose

Define the execution contract and phase boundaries for Structure -> Generation -> Polish.

2. Scope

  • IThoughtProcess
  • IExecutionOutput
  • IOutputPolisher
  • IModelVectorRouter
  • IAttentionGuard
  • IPolisherValidator
  • IPipelineOrchestrator
  • ExecutionResult
  • IQueryAugmentor
  • IQueryDecomposer
  • IQueryRouter
  • QueryPart

3. Normative Requirements

  • EPS-001 IThoughtProcess MUST output structured artifacts only.
  • EPS-002 IExecutionOutput MUST NOT introduce new reasoning.
  • EPS-003 IOutputPolisher MUST NOT alter facts or conclusions.
  • EPS-004 Phase order is fixed and reverse flow is prohibited (MUST).
  • EPS-005 Inter-phase payload integrity MUST be verified by hash.
  • EPS-006 State Immutability: Once committed, phase outputs MUST NOT be overwritten by downstream phases. Required changes MUST be performed via branch-based re-execution from Replay Dump.
  • EPS-007 Buffer Mapping:
  • Structure extracts Thought from Orchestration and Material; Generation produces Expression from Thought; Polish refines Expression and finalizes IExecutionOutput (MUST).

  • EPS-008 Deterministic Scheduling: Before each phase, IModelVectorRouter MUST re-evaluate the phase model and record routing rationale in ExecutionResult metadata.
  • EPS-009 Phase 1 Query Processing: Query augmentation and decomposition MUST complete before ROM/CacheDB materialization and before Structure output is committed.
  • EPS-010 RAG Boundary: RAG MUST remain a provider or pipeline strategy for material supply. Core query abstractions MUST NOT implement knowledge retrieval.

4. Fail-Closed

  • EPS-F001 Abort when Structure schema validation fails.
  • EPS-F002 Abort on inter-phase hash mismatch.
  • EPS-F003 Abort on missing mandatory fields.
  • EPS-F004 Information Leakage Detection: If IAttentionGuard detects leakage from isolated context in Polish, execution MUST abort immediately.
  • EPS-F005 Logic Divergence Check: If Generation diverges from the Structure execution plan, Polish MUST be stopped and the pipeline MUST fail.
  • EPS-F006 Query Processing Failure: If query augmentation, decomposition, embedding conversion, or query routing cannot complete consistently, Phase 1 MUST abort without committing partial QueryPart state.

5. Acceptance Criteria

  • AC1: Generation does not start on invalid Structure schema.
  • AC2: Hash tampering returns Deny/Abort.
  • AC3: Normal runs preserve phase metadata in ExecutionResult.
  • AC4: Routing rationale is reproducible for identical inputs.
  • AC5: Semantic changes attempted in Polish are blocked by IPolisherValidator.
  • AC6: QueryPart generation is deterministic for identical input and KernelContext.
  • AC7: Provider routing records capability-based rationale without treating RAG as a Core retrieval implementation.

6. Phase Interface Details (ROM Representation)

Phase boundaries are represented as ROM entities and chained by hashes.

---\nid: "pipeline.exec.001"\ntype: "execution.contract"\nphases:\n  - id: "structure"\n    provider_id: [[provider.reasoning_model]]\n    output_hash: "sha256:..."\n  - id: "generation"\n    provider_id: [[provider.creative_model]]\n    output_hash: "sha256:..."\n  - id: "polish"\n    provider_id: [[provider.fast_model]]\n    output_hash: "sha256:..."\n---\n# Execution Policy\n* [isolation_level]: [[policy.strict]]\n* [retry_strategy]: [[policy.abort_on_fail]]

7. Pipeline Sequence

IPipelineOrchestrator guarantees atomic execution in the following order.

  1. Phase Initialization
  2. Validate pre-execution context hashes and confirm ISignatureTrustStore verification passed.

  3. Phase 1 Query Processing
  4. Run IQueryAugmentor to normalize and enrich query intent, run IQueryDecomposer to produce ordered QueryPart units, optionally use IEmbeddingProvider for semantic-space conversion, then run IQueryRouter against declared provider capabilities.

  5. Material Context Build
  6. Resolve ROM and CacheDB material through provider or pipeline strategies, quarantine material, and keep provenance separate from Orchestration and Expression.

  7. Structure Phase
  8. Use a reasoning model to decompose tasks into ContextFragment units and produce a thought blueprint.

  9. Handoff Validation
  10. Record Structure output hash as parent hash for Generation.

  11. Generation Phase
  12. Generate content from blueprint; Structure mutation is prohibited.

  13. Polish Phase
  14. Refine format/tone; semantic mutations are blocked by IPolisherValidator.

  15. Final Commitment
  16. Build ExecutionResult with full phase hash chain and commit to ConversationStore (Git).


Changelog

  • v0.0.0 / v0.0.0.0: Initial draft
  • v0.0.1 (2026-05-06): Version upgrade aligned with documentation guidelines
  • v0.0.1 (2026-05-09): Added Phase 1 Query Processing abstractions and RAG boundary
Source: specs/01.EXECUTION_PIPELINE_SPEC.md