Implement prompt composition with conventions

t-396·WorkTask·
·
·
·Omni/Agent/Prompt/Compile.hs
Created3 months ago·Updated1 month ago·pipeline runs →

Description

Edit

Add a Compose operation to the free monad that combines prompts with predictable semantics.

Approach

Define conventions for how prompts combine, making composition predictable even without full Bayesian theory.

Conventions to Define

1. System prompt = hyperprior (sets the space of behaviors) 2. Skills = conditional priors (activated by context) 3. User messages = observations (data that updates the posterior) 4. Assistant messages = posterior samples (past behavior conditions future)

Implementation

1. Add Compose constructor to OpF 2. Define PromptComponent type (System | Skill | Message | Context) 3. Composition rules:

  • System prompts: last one wins? merge?
  • Skills: concatenate with separators
  • Context: append in order

4. Verify: composed prompt behaves as expected

Metrics & Verification

  • Predictability: does compose(A, B) behave as expected from A and B alone?
  • No interference: adding B doesn't break A's behavior
  • Order sensitivity: document when order matters

Test Cases

  • Compose two skills -> agent has both capabilities
  • Compose base + override -> override takes precedence
  • Compose context chunks -> coherent understanding

Notes

This is conventions, not calculus. The goal is predictable engineering, not mathematical composition laws. But conventions can evolve toward theory.

Git Commits

bd23ef65feat(prompt): add compose operation and composition conventions
Coder Agent8 weeks ago1 files

Timeline (9)

🔄[system]Open → InProgress1 month ago
💬[system]1 month ago

Pipeline: dev completed (run=dev-t-396-1771506378, cost=0.0c)

🔄[system]InProgress → Verified1 month ago
💬[system]1 month ago

Pipeline: build verification passed

🔄[system]Verified → Done1 month ago
💬[system]1 month ago

Pipeline: integrated into live at bd23ef658f117e79a720d719095bd4858163f106