Documentation
Architecture
Data Flows

Data Flows

How data moves through the 88.pi ecosystem from session start to task completion.

Primary Flow

session_start

  ├─→ load brain (.voyager/brain.md)
  │     └─→ BrainManager.load() → inject into system context

  ├─→ recall episodes (similarity search)
  │     └─→ MemoryRecall.search() → inject relevant history

  ├─→ load ralph effectiveness matrix
  │     └─→ RalphUniversal.getReport() → inject adapter recommendations


task received

  ├─→ TaskAnalyzer.analyze(task)
  │     └─→ categorize: code | test | refactor | docs | research
  │     └─→ complexity: simple | moderate | complex
  │     └─→ skill: matched skill from registry

  ├─→ StrategyPlanner.plan(analysis)
  │     └─→ RalphUniversal.getRecommendation(category)
  │     └─→ select adapter + approach
  │     └─→ configure exit strategy

  ├─→ ExecutionRouter.route(plan)
  │     ├─→ [simple] → StandaloneRunner.execute()
  │     └─→ [complex] → LoopEngine.execute()
  │           ├─→ CircuitBreaker.check()
  │           ├─→ adapter call → response
  │           ├─→ ResponseAnalyzer.analyze(response)
  │           ├─→ CircuitBreaker.record(metrics)
  │           ├─→ ProgressTracker.stream(event)
  │           └─→ repeat until exit

  ├─→ QualityGates.validate(output)
  │     └─→ 7-dimension validation
  │     └─→ pass → continue | fail → back to loop

  ├─→ SelfReflection.reflect(result)
  │     └─→ extract learnings
  │     └─→ generate reflections

  ├─→ EpisodeRecorder.record(episode)
  │     └─→ SimpleMemBridge.store(episodes, id, data)

  ├─→ RalphUniversal.recordUsage(category, adapter, success)
  │     └─→ update effectiveness matrix

  ├─→ BrainManager.update(entry)
  │     └─→ append observation + loop status

  └─→ Bridge.stream(result)
        └─→ send to external client via WebSocket/SSE

Data Types by Stage

StageData InData Out
Brain Load.voyager/brain.mdBrainState
Episode Recallquery stringEpisode[]
Task Analysistask descriptionTaskAnalysis
Strategy Planninganalysis + ralph recExecutionPlan
Executionplan + contextIterationResult[]
Quality Gateoutput + criteriaValidationResult
Reflectionresult + contextReflection[]
Episode Recordall metadataEpisode
Ralph Updatecategory + outcomeUpdated matrix
Brain UpdateobservationsUpdated brain.md
Bridge Streamfinal resultClient event

Stream Events

The bridge streams events to external clients in real-time:

type StreamEvent =
  | { type: 'session_start'; sessionId: string }
  | { type: 'task_received'; task: string }
  | { type: 'plan_created'; plan: ExecutionPlan }
  | { type: 'iteration_start'; iteration: number }
  | { type: 'iteration_end'; iteration: number; result: IterationResult }
  | { type: 'circuit_update'; state: string }
  | { type: 'quality_check'; result: ValidationResult }
  | { type: 'episode_recorded'; episode: Episode }
  | { type: 'session_end'; summary: SessionSummary }

Every stage produces observable events. The bridge ensures external clients see the full execution trace, not just the final result. This is the Glass Box principle in action — complete transparency.

Error Flows

When an error occurs mid-flow:

error at any stage

  ├─→ CircuitBreaker.recordError(error)
  │     └─→ may trigger circuit open

  ├─→ ResponseAnalyzer.detectStuckLoop(errorHistory)
  │     └─→ may trigger stuck signal

  ├─→ bridge.stream({ type: 'error', error })

  └─→ either:
        ├─→ retry (loop continues)
        ├─→ exit (strategy decides)
        └─→ circuit open (immediate halt)