Advisory AI Orchestration Pipeline (Planning Notes)

Status: In progress – orchestration metadata and cache-key wiring underway for AIAI-31-004.
Audience: Advisory AI guild, WebService/Worker guilds, CLI guild, Docs/QA support teams.

1. Goal

Wire the deterministic pipeline (Summary / Conflict / Remediation flows) into the Advisory AI service, workers, and CLI with deterministic caching, prompt preparation, and guardrail fallback. This document captures the pre-integration checklist and task breakdown so each guild understands their responsibilities before coding begins.

2. Prerequisites

AreaRequirementOwnerStatus
ToolsetDeterministic comparators, dependency analyzer (IDeterministicToolset, AdvisoryPipelineOrchestrator)Advisory AI✅ landed (AIAI-31-003)
SBOM contextReal SBOM context client delivering timelines + dependency pathsSBOM Service Guild✅ typed client and DI helper ready; supply host BaseAddress at integration time
Prompt artifactsLiquid/Handlebars prompt templates for summary/conflict/remediationAdvisory AI Docs Guild⏳ authoring needed
Cache strategyDecision on DSSE or hash-only cache entries, TTLs, and eviction policyAdvisory AI + Platform⏳ hash-only plan keys implemented; persistence decision outstanding
Auth scopesConfirm service account scopes for new API endpoints/worker-to-service callsAuthority Guild🔲 define

Blocking risk: SBOM client and prompt templates must exist (even stubbed) before the orchestrator can produce stable plans.

3. Integration plan (high-level)

  1. Service layer (WebService / Worker)
    • Inject IAdvisoryPipelineOrchestrator via AddAdvisoryPipeline.
    • Define REST endpoint POST /v1/advisories/{key}/pipeline/{task} (task ∈ summary/conflict/remediation).
    • Worker consumes queue messages (advisory.pipeline.execute) -> fetches plan -> executes prompt -> persists output & provenance.
    • Add metrics: advisory_pipeline_requests_total, advisory_pipeline_plan_cache_hits_total, advisory_pipeline_latency_seconds.
  2. CLI
    • New command stella advise run <task> with flags for artifact id, profile, policy version, --force-refresh.
    • Render JSON/Markdown outputs; handle caching hints (print cache key, status).
  3. Caching / storage
    • Choose storage (Mongo collection vs existing DSSE output store).
    • Persist AdvisoryTaskPlan metadata + generated output keyed by cache key + policy version.
    • Expose TTL/force-refresh semantics.
  4. Docs & QA
    • Publish API spec (docs/modules/advisory-ai/guides/api.md) + CLI docs.
    • Add golden outputs for deterministic runs; property tests for cache key stability (unit coverage landed for cache hashing + option clamps).

4. Task Breakdown

AIAI-31-004A (Service orchestration wiring)

AIAI-31-004B (Prompt assembly & cache persistence)

2025-11-03: Prompt assembler now emits deterministic JSON payloads, guardrail pipeline wiring is stubbed for upcoming security hardening, and outputs persist with DSSE-ready provenance metadata plus golden test coverage.

AIAI-31-004C (CLI integration & docs)

AIAI-31-006 (Service API surface)

2025-11-03: Initial REST surface shipped – direct execution runs through guardrail pipeline, outputs persist with DSSE-ready provenance, metrics advisory_outputs_stored/advisory_guardrail_blocks emit, and cache retrieval endpoint exposes stored artefacts (RBAC/header enforcement pending scope delivery).

Supporting tasks (other guilds)

5. Acceptance checklist (per task)

ItemNotes
Cache key stabilityAdvisoryPipelineOrchestrator hash must remain stable under re-run of identical inputs.
Metrics & loggingRequest id, cache key, task type, profile, latency; guardrail results logged without sensitive prompt data.
Offline readinessAll prompt templates bundled with Offline Kit; CLI works in air-gapped mode with cached data.
Policy awarenessPlans encode policy version used; outputs reference policy digest for audit.
TestingUnit tests (plan generation, cache keys, DI), integration (service endpoint, worker, CLI), deterministic golden outputs.

6. Next steps

  1. Finalize SBOM context client (AIAI-31-002) and prompt templates.
  2. Create queue schema spec (docs/modules/advisory-ai/queue-contracts.md) if not already available.
  3. Schedule cross-guild kickoff to agree on cache store & DSSE policy.

7. Recent updates

Last updated: 2025-11-04