Skip to main content

AI prompt composition — horizontal surface

Tier: Public
Status: Shipped at public-alpha hardening (2026-05)
Audience: module authors, API maintainers, AI consultant implementors, reviewers
Related: AI-CONSULTANT.md, PLATFORM-ARCHITECTURE.md §4.3, packages/sdk/module-sdk/README.md


1. Summary

LayerOwnerStatus at public α
Base + platform overlaysAPI promptComposerShipped
Module overlaysregisterModule({ aiPrompts })Shipped
Route overlaysaiPrompts.routes + optional routeId on chatShipped
Static knowledge snippetsaiPrompts.knowledgeShipped (2 KB cap per module)
Workspace memoryWorkspaceAiMemoryServiceShipped (v0)
Semantic reporting DSLPlatform Layer BShipped MVPcanonical-ai-reporting-dsl-surface.md
pgvector RAGPlatform Layer CD1 shippedcanonical-ai-rag-surface.md; D2–D3 deferred
Propose-write (human confirm)Platform + modulesShippedcanonical-ai-propose-write-surface.md
Managed-AI creditsPlatform §7.3Deferred H1 2027; multi-provider BYOK router shipped

Every model call composes a system prompt in this order:

  1. BASE — neutral operational-workspace framing
  2. PLATFORM_OVERLAY — cross-module safety and tool discipline
  3. Module overlays — one section per registered module (alphabetical by module code)
  4. Route overlay — optional hint when the client sends routeId
  5. Workspace memory — per-workspace facts and recurring issues

Tools are unchanged: still registered via registerModule({ registerAiTools }) and invoked by the orchestrator.


2. SDK contract (registerModule)

registerModule(app, {
code: "mrp",
registerAiTools(registry, hostApp) { /* ... */ },
aiPrompts: {
module: "MRP module overlay text…",
routes: {
productionOrders: "User is on production orders; prefer mrp.* tools.",
},
knowledge: "Optional static reference bullets (max 2048 chars).",
},
});

Validation (boot-time)

FieldMax lengthRules
aiPrompts.module4_000 charsNon-empty if present
aiPrompts.routes[<routeId>]1_500 chars eachKeys must be unique across all modules
aiPrompts.knowledge2_048 charsNon-empty if present

Duplicate routes keys across modules → registerModule throws at boot.

Registry helpers (@umbraculum/module-sdk)

  • collectRegisteredModulePromptOverlays() — sorted module entries for composition
  • resolveRoutePromptOverlay(routeId) — lookup route hint; unknown routeIdundefined (ignored)

3. Chat API

POST /ai/chat body (see @umbraculum/contracts AiChatRequestBody):

FieldRequiredNotes
messageyes1–8000 chars
sessionIdnoConversation continuity
routeIdnoRouteId from @umbraculum/navigation; unknown values are ignored (forward compat)

Web clients may pass routeId via query ?fromRoute=productionOrders on /ai.


4. Sibling surfaces (post-α H2)

CapabilitySurface doc
Propose-writecanonical-ai-propose-write-surface.md
Reporting DSLcanonical-ai-reporting-dsl-surface.md
RAGcanonical-ai-rag-surface.md
H2 build logai-consultant-post-alpha-h2-build-log.md

5. What remains deferred

  • Full RAG — per-workspace activity timelines + memory unify (Layer C D2–D3).
  • Managed-AI credits — Umbraculum-resold tokens (WorkspaceBillingAddon).
  • Autonomous domain writes — only human-confirmed proposals + render_document job submit.
  • Per-workspace module entitlements — deploy profile (UMBRACULUM_MODULE_PROFILE) filters boot-registered modules; workspace add-on rows (WorkspaceBillingAddon) gate per-workspace omit when ENTITLEMENTS_ENFORCEMENT_MODE=tier_and_addons. Full purchase UI still deferred.

6. Maintenance

  • When adding a module overlay or route map, update the module's services/api/src/services/ai/prompts/<code>.ts and services/api/src/modules/<code>/index.ts.
  • When adding a new RouteId with a dedicated AI hint, extend the module's aiPrompts.routes and packages/platform/navigation.
  • Operator-facing examples: help/asking-umbraculum.md.
  • Feature-level explainer: AI-CONSULTANT.md.

7. Build logs