YAWN Context Composition

Build deterministic AI contexts with hierarchical inheritance

Loading...

The Context Composition Problem

The Challenge

AI agents struggle with context management. Current approaches scatter configuration across multiple files, lose state between sessions, and waste tokens on redundant information. This leads to:

  • ×Inconsistent behavior across sessions
  • ×Token limits hit due to redundant context
  • ×Configuration scattered across 10+ files
  • ×No deterministic reproduction of AI behavior

The YAWN Solution

YAWN provides a unified, deterministic context composition system that implements all four layers of the LangChain framework in a single, inheritable format:

  • 48% more token efficient than JSON
  • Single source of truth in one .yawn file
  • Hierarchical inheritance eliminates redundancy
  • 100% deterministic AI behavior

The Four Layers of Context Composition

1

Writing Context

Persistent state management across sessions

writing:
  scratchpad:
    location: "/.yawn-state/"
    persistence: session_and_long_term
  memory:
    user_preferences: "remembered"
    generation_history: "tracked"
2

Selecting Context

Intelligent retrieval of relevant information

selecting:
  tool_registry:
    max_tools: 5
    strategy: embedding_similarity
  knowledge_retrieval:
    primary: semantic_search
    fallback: keyword_matching
3

Compressing Context

Token optimization through smart summarization

compressing:
  triggers:
    context_usage: "> 80%"
    token_count: "> 50000"
  strategies:
    completed: aggressive_summary
    active: preserve_detail
4

Isolating Context

Multi-agent separation with sandboxing

isolating:
  ui_agent:
    context_limit: 50K_tokens
    focus: "interface"
  builder_agent:
    context_limit: 100K_tokens
    focus: "generation"

Hierarchical Inheritance: How YAWN Works

Parent Context

# base.yawn
colors:
  primary: blue
  secondary: gray
api:
  timeout: 30
  retries: 3

Child Context

# app.yawn
parent: base.yawn
colors:
  primary: purple  # overrides
  tertiary: pink   # extends
api:
  retries: 5       # overrides

Resolved Context

# Final result
colors:
  primary: purple
  secondary: gray
  tertiary: pink
api:
  timeout: 30
  retries: 5

YAWN's inheritance system allows you to build complex contexts from simple, reusable components. Child contexts inherit all parent properties, can override specific values, and add new properties. This eliminates redundancy and ensures consistency across your AI agents.

YAWN Component Architecture

The YAWN framework consists of five core components that work together to transform vague human inputs into deterministic applications. Each component inherits from the root dogfood.yawn configuration.

Input Analyzer

Transforms vague human language into structured specifications with confidence scoring.

# input_analyzer.yawn
parent: dogfood.yawn
version: 2.0

meta:
  component: "input_analyzer"
  purpose: "Transform vague human inputs into structured job specifications"
  confidence_target: 0.85

capabilities:
  - Natural language parsing
  - Intent classification
  - Requirement extraction
  - Confidence calculation
  - Missing information detection

Job Taxonomy

Defines standard job types and decomposition patterns for breaking down complex tasks.

# job_taxonomy.yawn
parent: dogfood.yawn
version: 2.0

meta:
  component: "job_taxonomy"
  purpose: "Define standard job types and decomposition patterns"

job_types:
  - analysis: Understand and document requirements
  - design: Create architecture and interfaces
  - implementation: Generate code and configurations
  - validation: Test and verify outputs

Confidence Scoring

Calculates and tracks confidence levels throughout the entire generation pipeline.

# confidence_scoring.yawn
parent: dogfood.yawn
version: 2.0

meta:
  component: "confidence_scoring"
  purpose: "Calculate and track confidence levels"

scoring_factors:
  - input_clarity: 0.3
  - domain_knowledge: 0.25
  - requirement_completeness: 0.25
  - implementation_feasibility: 0.2

Code Generator

Transforms YAWN specifications into deterministic, reproducible code.

# code_generator.yawn
parent: dogfood.yawn
version: 2.0

meta:
  component: "code_generator"
  purpose: "Transform YAWN specifications into deterministic code"

guarantees:
  - Identical inputs produce identical outputs
  - No random variations
  - Explicit version pinning
  - Reproducible builds

Feedback Loop

Learns from generation outcomes to continuously improve system performance.

# feedback_loop.yawn
parent: dogfood.yawn
version: 2.0

meta:
  component: "feedback_loop"
  purpose: "Learn from generation outcomes"

learning_mechanisms:
  - Success pattern extraction
  - Failure analysis
  - Confidence calibration
  - Template refinement