Billy Engine Architecture
Relevant source files
The following files were used as context for generating this wiki page:The Billy Engine serves as the central orchestration and companion runtime within the GestaltView system. It coordinates user requests, manages personal context through an embodiment profile, and routes tasks to specialized Digital Intelligences (DI). The architecture prioritizes continuity, ensuring that a person's identity and memory remain intact across different work surfaces.
Sources: build_story_artifact.py:53-57, diagram_inventory.json:chapter_id "companions"
Core Components and Runtime
The engine operates across a server-side execution environment and a client-side communication wrapper. These components manage context assembly and session continuity while adhering to strict prompt injection rules.
Server and Client Interface
- BillyEngine.ts: Handles the primary server-side execution logic and context assembly.
- billyApi.ts: Provides client-side wrappers for invoking captures and streaming synthesis.
- llmRouter.ts: Directs requests based on cost, latency, and capability requirements.
Sources: diagram_inventory.json:figure-p048-1-bridging-natural-language-space-to-code-enti, diagram_inventory.json:figure-p046-2-orchestration-api-pipeline-execution
The diagram shows the synchronous flow from the user interface through the API wrapper to the core engine and subsequent routing.
Sources: diagram_inventory.json:curated-06, diagram_inventory.json:figure-p048-1-bridging-natural-language-space-to-code-enti
Embodiment Schema Architecture
Billy utilizes a structured JSON-adjacent schema to define its behavior and relationship with the user. This schema consists of four distinct layers that govern how the agent perceives and interacts with information.
| Layer | Description | Key Fields |
|---|---|---|
| immutableCore | Foundational identity and archetypal truths. | archetype, foundationalTruth, voiceTone |
| livingMemory | Active context and constitutive memory types. | memoryType, recentObservations |
| skillGraph | Map of current and potential capabilities. | existingSkills, pathwayMarkers |
| woundLayer | Historical constraints or sensitivity parameters. | constraintMarkers, sensitiveContext |
Sources: diagram_inventory.json:figure-p049-2-structure-of-billy-s-embodiment-schema, build_story_artifact.py:126-132
The class diagram represents the composition of the Embodiment Schema used by the Billy Engine.
Sources: diagram_inventory.json:figure-p049-2-structure-of-billy-s-embodiment-schema
Intelligence Orchestration and Routing
The orchestration layer classifies user intent before dispatching work. It uses a "Tribunal" pattern for forensic analysis and consensus checking between multiple models.
Orchestration Pipeline
- Request Dispatch: Accepts JSON payloads containing task context and token bounds.
- State Hydration: Pulls user identity and active memory frames.
- Intent Classification: Analyzes the input to determine the required specialized DI.
- Execution and Telemetry: Records latency and token consumption for auditability.
Sources: diagram_inventory.json:figure-p046-2-orchestration-api-pipeline-execution, diagram_inventory.json:figure-p107-2-tribunal-multi-model-forensic-analysis-flow
Specialized Digital Intelligences
The engine routes work to specific roles based on the task:
- Capture/Curation: Manages "Bucket Drops" and raw information intake.
- Integrity/Evaluation: Validates outputs against constitutional invariants.
- Engineering/Creation: Handles artifact generation through the
gestaltview_generative_engine.py.
Sources: build_story_artifact.py:118-124, diagram_inventory.json:curated-06
Memory and Continuity Pipeline
Continuity distinguishes between raw material and knowledge fragments. The engine rejects a simple "vector search = memory" model, instead utilizing temporal arcs and context assembly.
The sequence diagram illustrates the zero-friction ingestion of a "Bucket Drop" into persistent storage.
Sources: diagram_inventory.json:figure-p050-3-bucket-drop-capture-pipeline-from-stream-of-, diagram_inventory.json:natural-language-code-entity-mapping
The Billy Engine remains constrained by Constitutional Governance. Ten invariants, such as "Never Look Away" and "Identity is Real Here," sit above the technical configuration to ensure user safety and dignity.
Sources: build_story_artifact.py:158-164, diagram_inventory.json:curated-11