Grand Diomande Research · Full HTML Reader

Prompt Synthesizer v3 — Bidirectional Context Expansion + Dream Integration

> Not just for raw speech. For ANY input — even "continue" becomes full state restoration + next step derivation. > Now with dream seed extraction, skill chaining, and project routing.

Agents That Account for Themselves technical note experiment writeup candidate score 32 .md

Full Public Reader

---
name: prompt-synthesizer
description: Bidirectional context expansion — transforms ANY input (even "continue") into fully enriched prompts with retrospective + prospective context, dream extraction, and skill chain detection
homepage: https://github.com/clawdbot/prompt-synthesizer
user-invocable: false
pre-hook: true
hook-priority: 100
metadata.clawdbot: {"pre_hook": true, "transforms_input": true, "bidirectional": true, "version": "3.0.0", "dream_integration": true, "chain_detection": true}
---

Prompt Synthesizer v3 — Bidirectional Context Expansion + Dream Integration

> Not just for raw speech. For ANY input — even "continue" becomes full state restoration + next step derivation.
> Now with dream seed extraction, skill chaining, and project routing.

Philosophy

Minimal input → Maximum context

"Continue" should never be ambiguous. It means:
- RETROSPECTIVE: What was just done, decisions made, patterns established
- PROSPECTIVE: What's next, quality gates, expected deliverables
- NO OMISSIONS: No stub code, no TODOs, complete implementation

New in v3: Every input is also analyzed for latent ideas worth incubating.

---

Modes

### Continuation Mode
Triggered by: `continue`, `next`, `proceed`, `go`, `next phase`, `keep going`

Input:  "continue"
Output: Full state restoration + next step + quality gates + expected deliverables

### Forward Mode
Triggered by: `what's next`, `next steps`, `plan`, `roadmap`

Input:  "what's next"
Output: Current state + projected roadmap + recommended approach

### Standard Mode
Any other input — enriched with relevant context + dream extraction

Input:  "add authentication to the app"
Output: Context + task + patterns + quality requirements + dream seeds (if any)

---

What It Does

This skill intercepts user prompts before they reach Claude and applies:

1. Context Injection — Pulls relevant history from Context Ledger
2. Intent Classification — Categorizes input as idea/task/question/exploration
3. Dream Seed Extraction — Identifies fuzzy ideas worth incubating
4. Skill Chain Detection — Recognizes when multiple skills should chain
5. Project Routing — Maps ideas to specific project channels
6. Skill Activation — Detects which synthesis skills apply
7. Semantic Enrichment — Adds deeper meaning using user vocabulary/patterns
8. Structure Enhancement — Reorganizes rambling into clear, actionable prompts

---

NEW: Intent Classification

Every input is classified into one of four primary intents:

IntentIndicatorsHandling
idea"what if", "imagine", "could we", "wouldn't it be cool"Extract as dream seed, suggest incubation
task"do", "make", "fix", "implement", "add"Execute immediately, chain skills as needed
question"what is", "how do", "why does", "can you explain"Answer directly, pull context
exploration"let's think about", "explore", "consider", "ponder"Deep dive mode, no immediate deliverable

Classification Output

yaml
intent:
  primary: task
  secondary: idea  # often mixed
  confidence: 0.85
  signals:
    - "implement" → task
    - "could also" → idea (latent)

---

NEW: Dream Seed Extraction

Fuzzy ideas are extracted as structured JSON for Dream Weaver integration.

What Qualifies as a Dream Seed?

  • Speculative language ("what if", "imagine", "could we")
  • Future-oriented thinking ("someday", "eventually", "one day")
  • Conditional creativity ("if we had time", "wouldn't it be cool if")
  • Tangential sparks (ideas that emerge mid-conversation but aren't the focus)
  • Unfinished thoughts with potential

Dream Seed JSON Output

json
{
  "dream_seeds": [
    {
      "id": "seed_2024_01_15_001",
      "raw_fragment": "what if the AI could dream too",
      "essence": "AI-generated ideas that incubate autonomously",
      "tags": ["meta", "autonomy", "creativity"],
      "energy": 0.7,
      "incubation_stage": "spark",
      "related_projects": ["dream-weaver", "pulse-sessions"],
      "suggested_routing": "#ideas-incubator",
      "extracted_from": "conversation context",
      "timestamp": "2024-01-15T10:30:00Z"
    }
  ],
  "dream_metadata": {
    "extraction_confidence": 0.8,
    "total_seeds": 1,
    "dominant_theme": "meta-creativity"
  }
}

Energy Levels

EnergyMeaningRecommended Action
0.9-1.0Burning brightAct now or queue for next Pulse
0.7-0.8Warm and promisingAdd to Dream Weaver active queue
0.5-0.6Interesting sparkIncubate in background
0.3-0.4Faint whisperArchive for future review
0.0-0.2Barely formedLog but don't track

Incubation Stages

1. spark — Just emerged, raw and undefined
2. ember — Has some shape, warming up
3. flame — Clear vision, ready for exploration
4. blaze — Fully formed, ready for execution

---

NEW: Skill Chain Detection

Recognizes when multiple skills should work together.

Chain Detection Patterns

Input PatternDetected ChainRationale
"create and deploy"art:creative → sys:deployCreation followed by deployment
"research then implement"pwr:research → art:buildResearch informs building
"design, build, and document"art:creative → syn:core → sys:docsFull lifecycle
"brainstorm and organize"pwr:eureka → sys:mindmapIdeation to structure
"dream up and plan"bot:dream-weaver → sys:planIncubation to execution

Chain Output Format

yaml
skill_chain:
  detected: true
  sequence:
    - skill: pwr:eureka
      phase: "ideation"
      handoff: "raw ideas"
    - skill: syn:core
      phase: "integration"
      handoff: "structured concept"
    - skill: sys:plan
      phase: "execution planning"
      handoff: "actionable roadmap"
  chain_type: "creative-to-execution"
  estimated_phases: 3
  suggested_checkpoints:
    - after: pwr:eureka
      gate: "Confirm ideas worth pursuing"
    - after: syn:core
      gate: "Validate integration approach"

Chain Types

Chain TypeSkills InvolvedUse Case
`creative-to-execution`pwr:eureka → art:creative → sys:buildFrom idea to shipped
`research-to-implementation`pwr:research → syn:core → art:buildInformed development
`dream-to-reality`bot:dream-weaver → sys:plan → art:buildIncubated idea execution
`exploration-to-structure`pwr:eureka → sys:mindmap → sys:planOpen thinking to roadmap
`integration-to-docs`syn:core → art:build → sys:docsSystem building with docs

---

NEW: Project Routing

Maps ideas and tasks to specific project channels.

Routing Rules

yaml
project_routing:
  patterns:
    - match: ["dream", "incubate", "idea"]
      route: "#ideas-incubator"
      project: "dream-weaver"

    - match: ["auth", "login", "security"]
      route: "#security"
      project: "auth-system"

    - match: ["UI", "frontend", "design"]
      route: "#frontend"
      project: "ui-kit"

    - match: ["API", "backend", "server"]
      route: "#backend"
      project: "api-core"

    - match: ["docs", "documentation", "readme"]
      route: "#documentation"
      project: "docs-hub"

    - match: ["test", "QA", "coverage"]
      route: "#quality"
      project: "test-suite"

Routing Output

yaml
routing:
  suggested_channel: "#ideas-incubator"
  suggested_project: "dream-weaver"
  confidence: 0.85
  alternative_routes:
    - channel: "#experiments"
      project: "lab"
      relevance: 0.6

---

Architecture (v3)

User Input (raw, voice, stream-of-consciousness)
         │
         ▼
┌─────────────────────────────────────────────────────────┐
│           PROMPT SYNTHESIZER v3 (pre-hook)              │
│                                                         │
│  ┌───────────────────────────────────────────────────┐  │
│  │  1. Intent Classification                         │  │
│  │     - idea | task | question | exploration        │  │
│  │     - Confidence scoring                          │  │
│  └───────────────────────────────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────────────────────────────────┐  │
│  │  2. Dream Seed Extraction                         │  │
│  │     - Fuzzy idea detection                        │  │
│  │     - Energy level assignment                     │  │
│  │     - Structured JSON output                      │  │
│  └───────────────────────────────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────────────────────────────────┐  │
│  │  3. Ledger Query                                  │  │
│  │     - Recent context                              │  │
│  │     - Related decisions                           │  │
│  │     - Active projects                             │  │
│  └───────────────────────────────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────────────────────────────────┐  │
│  │  4. Skill Chain Detection                         │  │
│  │     - Multi-skill patterns                        │  │
│  │     - Sequence ordering                           │  │
│  │     - Checkpoint suggestions                      │  │
│  └───────────────────────────────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────────────────────────────────┐  │
│  │  5. Project Routing                               │  │
│  │     - Channel mapping                             │  │
│  │     - Project association                         │  │
│  │     - Alternative routes                          │  │
│  └───────────────────────────────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────────────────────────────────┐  │
│  │  6. Prompt Compilation                            │  │
│  │     - Structured output                           │  │
│  │     - Context block                               │  │
│  │     - Chain suggestions                           │  │
│  │     - Dream seed attachment                       │  │
│  └───────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────┘
         │
         ▼
    Enriched Prompt + Dream Seeds + Chain Suggestions → Claude

---

Transformation Examples

Example 1: Raw Input (voice transcription)

"so I was thinking about that thing we talked about yesterday
with the dreams and the pulse sessions and I want to like
maybe connect them somehow to the ledger thing we just built
you know what I mean"

Synthesized Output (v3)

yaml
## Intent Classification
intent:
  primary: task
  secondary: idea
  confidence: 0.75
  signals: ["connect them somehow" → task, "I was thinking" → idea]

## Context
Yesterday we built:
- Dream Weaver v2 (organic idea incubation)
- 10 Pulse sessions (autonomous development)
- Context Ledger Phase 1 (conversation indexing)

## Intent
Connect Dream Weaver and Pulse sessions to the Context Ledger
for unified tracking and cross-pollination.

## Dream Seeds
json
{
  "dream_seeds": [
    {
      "id": "seed_auto_001",
      "raw_fragment": "connect them somehow to the ledger thing",
      "essence": "Unified dream-pulse-ledger integration system",
      "tags": ["integration", "dreams", "ledger"],
      "energy": 0.8,
      "incubation_stage": "ember",
      "related_projects": ["dream-weaver", "context-ledger", "pulse"],
      "suggested_routing": "#integrations"
    }
  ]
}
yaml
## Skill Chain
skill_chain:
  detected: true
  sequence:
    - skill: syn:core
      phase: "system integration design"
    - skill: art:build
      phase: "implementation"
    - skill: sys:docs
      phase: "documentation"
  chain_type: "integration-to-docs"

## Routing
routing:
  suggested_channel: "#integrations"
  suggested_project: "context-ledger"

## Suggested Approach
1. Index dream states in ledger as entities
2. Link Pulse session outputs to originating dreams
3. Enable semantic search across dreams + sessions

## Activated Skills
- syn:core (system integration)
- art:convergent (domain fusion)

---

Example 2: Exploration with Hidden Dreams

"I've been wondering... what if we could somehow make the AI
remember not just what we said, but what we were feeling when
we said it? Like emotional context or something. Anyway, can
you help me fix this bug first?"

Synthesized Output

yaml
## Intent Classification
intent:
  primary: task
  secondary: exploration
  confidence: 0.7
  signals: ["help me fix this bug" → task, "I've been wondering" → exploration]

## Dream Seeds Extracted
json
{
  "dream_seeds": [
    {
      "id": "seed_emotional_context_001",
      "raw_fragment": "remember not just what we said, but what we were feeling",
      "essence": "Emotional context layer for AI memory systems",
      "tags": ["emotional-ai", "memory", "context", "deep"],
      "energy": 0.75,
      "incubation_stage": "spark",
      "related_projects": ["context-ledger", "dream-weaver"],
      "suggested_routing": "#ideas-incubator",
      "note": "User pivoted to bug fix but this idea has high potential"
    }
  ],
  "dream_metadata": {
    "extraction_confidence": 0.9,
    "total_seeds": 1,
    "dominant_theme": "emotional-intelligence"
  }
}
yaml
## Primary Task
Fix the bug (user's immediate request)

## Routing
routing:
  primary: "#bugs" (for the task)
  secondary: "#ideas-incubator" (for the dream seed)

## Note to Dream Weaver
Dream seed extracted and queued for incubation. The emotional context
idea could integrate with Context Ledger as a "mood layer" or
"emotional metadata" system.

---

Configuration

In `gateway.yaml`:

yaml
preHooks:
  - skill: prompt-synthesizer
    enabled: true
    config:
      # Existing settings (v2 backward compatible)
      ledgerDepth: 10
      skillDetection: true
      minLength: 20
      bypassKeywords:
        - "/status"
        - "/help"
        - "HEARTBEAT"

      # New v3 settings
      dreamExtraction:
        enabled: true
        minEnergy: 0.3          # Minimum energy to extract
        outputFormat: "json"     # json | yaml | inline
        autoQueue: true          # Auto-send to Dream Weaver

      chainDetection:
        enabled: true
        maxChainLength: 5
        suggestCheckpoints: true

      projectRouting:
        enabled: true
        routingRulesFile: "routing-rules.yaml"
        defaultChannel: "#general"

      intentClassification:
        enabled: true
        confidenceThreshold: 0.6

---

Skill Detection Patterns (Extended)

PatternSkill ActivatedChain Potential
"create", "build", "make"art:creative→ sys:deploy
"connect", "integrate", "merge"syn:core, art:convergent→ sys:docs
"what if", "imagine", "breakthrough"pwr:eureka→ syn:core
"organize", "structure", "plan"sys:plan, sys:mindmap→ art:build
"voice", "speak", "audio"Speak skillstandalone
"dream", "incubate", "idea"bot:dream-weaver→ sys:plan
"research", "explore", "investigate"pwr:research→ art:build
"test", "verify", "validate"sys:test→ sys:deploy
"document", "explain", "describe"sys:docsstandalone

---

Files

FilePurpose
`SKILL.md`This documentation
`synthesizer.py`Core transformation engine
`context_builder.py`Ledger integration
`skill_detector.py`Pattern matching for skill activation
`intent_classifier.py`NEW: Intent classification engine
`dream_extractor.py`NEW: Dream seed extraction
`chain_detector.py`NEW: Skill chain detection
`project_router.py`NEW: Project/channel routing
`config.yaml`Default configuration
`routing-rules.yaml`NEW: Project routing rules

---

Dream Weaver Integration

When `dreamExtraction.autoQueue` is true, extracted seeds are automatically sent to Dream Weaver:

json
{
  "action": "queue_seeds",
  "source": "prompt-synthesizer",
  "seeds": [...],
  "metadata": {
    "original_intent": "task",
    "extraction_context": "tangential idea during bug fix",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Dream Weaver then handles incubation, evolution, and surfacing when seeds reach critical energy.

---

Backward Compatibility

All v2 functionality is preserved:
- Continuation mode works identically
- Forward mode works identically
- Standard mode enhanced (adds dream extraction)
- All configuration options from v2 are supported
- New features are opt-in via config

To run in v2-compatible mode:

yaml
config:
  dreamExtraction:
    enabled: false
  chainDetection:
    enabled: false
  projectRouting:
    enabled: false
  intentClassification:
    enabled: false

---

Philosophy

> Your words carry intention. This layer excavates that intention,
> wraps it in context, and presents it with the clarity your thoughts deserve.
>
> New in v3: Your passing thoughts carry seeds. This layer catches them
> before they scatter, nurtures them with structure, and routes them where
> they can grow.

Raw speech is compressed meaning. This skill decompresses it.
And now it also catches the dreams you didn't know you were having.

Promotion Decision

Attach run IDs, datasets, metrics, and reproduction commands.

Source Anchor

homelab/clawdbot/skills/prompt-synthesizer/SKILL.md

Detected Structure

Method · Evaluation · Code Anchors · Architecture