titan_colossus 2.0.0 copy "titan_colossus: ^2.0.0" to clipboard
titan_colossus: ^2.0.0 copied to clipboard

Enterprise performance monitoring, AI testing, and MCP integration for Titan. Scry observation, Relay bridge, Blueprint generation, 48 MCP tools, and Lens debug overlay.

Titan Colossus #

Titan Banner

Enterprise-grade performance monitoring for the Titan ecosystem.

Colossus — named after the Colossus of Rhodes, a representation of the Titan Helios — stands watch over your app's performance, seeing every frame, every navigation, every allocation.

Pub Version License: MIT

Features #

Feature Titan Name What it does
Frame Monitoring Pulse FPS, jank detection, build/raster timing
Page Load Timing Stride Time-to-first-paint per route navigation
Memory Monitoring Vessel Pillar count, DI instance tracking, leak detection
Rebuild Tracking Echo Widget rebuild counting via wrapper widget
Performance Alerts Tremor Configurable threshold alerts via Herald
Performance Reports Decree Aggregated metrics with health verdict
Report Export Inscribe Export as Markdown, JSON, or HTML
Gesture Recording Shade Record user interactions as replayable macros
Gesture Replay Phantom Replay recorded sessions with synthetic events
Debug Overlay Lens In-app debug overlay with extensible plugin tabs
Lens Tabs Lens Tab Auto-registered "Perf", "Shade", and "Blueprint" tabs
Route Integration Atlas Observer Automatic page load timing via Atlas
AI Test Discovery Scout Passive session analyzer building a flow graph
Flow Graph Terrain Screen/transition map with dead-end & reliability detection
Edge-Case Tests Gauntlet Auto-generate targeted Stratagems for any screen
Test Execution Campaign Multi-route test orchestrator with setup/teardown
Test Results Verdict / Debrief Per-step results & aggregated analysis with fix suggestions
Blueprint Overlay Blueprint Tab Interactive Lens tab for AI-assisted test generation
Auto-Integration ColossusPlugin Zero-code Atlas + Shade → Scout wiring
Blueprint Export BlueprintExport Export Terrain, Stratagems & Verdicts to JSON/Markdown for AI assistants
Export CLI export_blueprint Offline Blueprint export from saved Shade sessions
MCP Server blueprint_mcp_server Model Context Protocol server for Copilot/Claude integration

Quick Start #

1. Add dependency #

dev_dependencies:
  titan_colossus: ^1.0.0
import 'package:titan_colossus/titan_colossus.dart';

void main() {
  runApp(
    Beacon(
      pillars: [MyPillar.new],
      plugins: [
        if (kDebugMode) ColossusPlugin(
          tremors: [Tremor.fps(), Tremor.leaks()],
          // AI Blueprint Generation — all enabled by default
          enableTableauCapture: true,   // Shade records screen metadata
          autoLearnSessions: true,      // Shade → Scout auto-feed
          autoAtlasIntegration: true,   // Auto-wire Atlas observer & routes
          // AI-Bridge Export — auto-save Blueprint on app shutdown
          blueprintExportDirectory: '.titan',
        ),
      ],
      child: MaterialApp.router(routerConfig: atlas.config),
    ),
  );
}

One line to add, one line to remove. ColossusPlugin handles Colossus.init(), wraps with Lens and ShadeListener, auto-wires Atlas observer, feeds Shade recordings into Scout, and calls Colossus.shutdown() on dispose.

Manual initialization (alternative) #

import 'package:titan_colossus/titan_colossus.dart';

void main() {
  if (kDebugMode) {
    Colossus.init(
      tremors: [
        Tremor.fps(),
        Tremor.leaks(),
        Tremor.pageLoad(),
      ],
    );
  }

  runApp(
    Lens(
      enabled: kDebugMode,
      child: MaterialApp.router(routerConfig: atlas.config),
    ),
  );
}

That's it. Colossus auto-registers its Lens tab and begins monitoring.

The Colossus Lexicon #

Component Symbol Purpose
Colossus 🏛️ Main Pillar — singleton orchestrator
Pulse 💓 Frame rendering metrics
Stride 🦶 Page load timing
Vessel 🏺 Memory monitoring & leak detection
Echo 🔁 Widget rebuild tracking
Tremor 🌍 Performance alert threshold
Decree 📜 Aggregated performance report
Inscribe ✍️ Export decree as Markdown, JSON, or HTML
InscribeIO 💾 Save export files to disk
Mark 📍 Base performance measurement
FrameMark 🎞️ Single frame timing
PageLoadMark 📄 Single page load timing
MemoryMark 🧠 Memory state snapshot
RebuildMark ♻️ Widget rebuild snapshot
LeakSuspect 💧 Suspected memory leak
Shade 👤 Gesture recording controller
Imprint 👣 Single recorded pointer event
ShadeSession 📼 Complete recorded interaction session
Phantom 👻 Replays sessions via handlePointerEvent
PhantomResult 📊 Replay outcome statistics
ShadeListener 👂 Transparent widget capturing pointer events
ColossusPlugin 🔌 One-line Beacon plugin for full Colossus integration
Scout 🔭 Passive session analyzer — builds flow graph from recordings
Terrain 🗺️ Screen/transition graph with dead-end & reliability detection
Outpost 🏕️ Single screen node in the Terrain graph
March 🚶 Directed edge between two Outposts (navigation transition)
Lineage 🧬 Resolves parameterized routes (e.g. /quest/:id/quest/42)
RouteParameterizer 📐 Registers known route patterns for Lineage resolution
Gauntlet ⚔️ Auto-generates edge-case Stratagems for any Outpost
Stratagem 📋 Single test scenario: steps, setup, teardown, expected outcomes
Campaign 🎯 Multi-route test orchestrator with setup/teardown lifecycle
Verdict ⚖️ Per-step test result with outcome and diagnostics
Debrief 📝 Aggregated campaign analysis with fix suggestions
Signet 🔖 Type-safe screen identifier for Outpost lookup
BlueprintLensTab 🗂️ Interactive Lens tab with 5 sub-tabs for Blueprint data
BlueprintExport 📦 Structured export container for Terrain, Stratagems & Verdicts
BlueprintExportIO 💾 File I/O for saving/loading Blueprint exports
BlueprintSaveResult Result object from saveAll() with JSON and prompt paths

Usage #

Pulse — Frame Monitoring #

Pulse automatically tracks every frame via Flutter's addTimingsCallback:

final colossus = Colossus.instance;
print('FPS: ${colossus.pulse.fps}');
print('Jank rate: ${colossus.pulse.jankRate}%');
print('Avg build: ${colossus.pulse.avgBuildTime.inMicroseconds}µs');

Stride — Page Load Timing #

Automatic with Atlas:

final atlas = Atlas(
  passages: [...],
  observers: [ColossusAtlasObserver()],
);

Manual timing:

final sw = Stopwatch()..start();
await loadHeavyData();
sw.stop();
Colossus.instance.stride.record('/data', sw.elapsed);

Vessel — Memory & Leak Detection #

Vessel periodically checks Titan's DI registry for Pillar lifecycle anomalies:

Colossus.init(
  vesselConfig: VesselConfig(
    leakThreshold: Duration(minutes: 3),
    exemptTypes: {'AuthPillar', 'AppPillar'}, // Long-lived, not leaks
  ),
);

Echo — Rebuild Tracking #

Wrap widgets to track their rebuild count:

Echo(
  label: 'QuestList',
  child: QuestListWidget(),
)

View rebuild data in the Lens "Perf" tab or via code:

final rebuilds = Colossus.instance.rebuildsPerWidget;
print(rebuilds); // {QuestList: 42, HeroProfile: 7}

Tremor — Performance Alerts #

Configure alerts that emit Herald events when thresholds are breached:

Colossus.init(
  tremors: [
    Tremor.fps(threshold: 50),                          // FPS < 50
    Tremor.jankRate(threshold: 10),                      // > 10% jank
    Tremor.pageLoad(threshold: Duration(seconds: 1)),    // > 1s load
    Tremor.memory(maxPillars: 30),                       // > 30 Pillars
    Tremor.rebuilds(threshold: 100, widget: 'QuestList'),// > 100 rebuilds
    Tremor.leaks(),                                      // Any leak suspect
  ],
);

// Listen for alerts via Herald
Herald.on<ColossusTremor>((event) {
  print('⚠️ ${event.message}');
});

Decree — Performance Reports #

Generate a comprehensive performance report:

final report = Colossus.instance.decree();

print(report.health);    // PerformanceHealth.good
print(report.summary);   // Full formatted report

// Drill into specifics
print(report.avgFps);
print(report.jankRate);
print(report.slowestPageLoad?.path);
print(report.topRebuilders(5));

Inscribe — Export Reports #

Export the Decree as Markdown, JSON, or a self-contained HTML dashboard:

final decree = Colossus.instance.decree();

// Markdown — great for GitHub issues, PRs, documentation
final md = Inscribe.markdown(decree);

// JSON — great for CI pipelines, dashboards, data analysis
final json = Inscribe.json(decree);

// HTML — self-contained visual dashboard (no external deps)
final html = Inscribe.html(decree);

Convenience methods on Colossus:

final md   = Colossus.instance.inscribeMarkdown();
final json = Colossus.instance.inscribeJson();
final html = Colossus.instance.inscribeHtml();

Save to Disk #

Use InscribeIO to persist reports to the file system (mobile, desktop, server — not web):

// Save individual formats
final path = await InscribeIO.saveHtml(decree, directory: '/tmp');
print('Report saved to $path');

// Save all three formats at once
final result = await InscribeIO.saveAll(decree, directory: '/reports');
print(result.markdown); // /reports/colossus-decree-20250115-100530.md
print(result.json);     // /reports/colossus-decree-20250115-100530.json
print(result.html);     // /reports/colossus-decree-20250115-100530.html

Lens Integration #

Colossus auto-registers two tabs in the Lens debug overlay:

Perf tab with sub-tabs:

  • Pulse — Real-time FPS, jank rate, frame bar chart
  • Stride — Page load history with timing
  • Vessel — Pillar count, instance count, leak suspects
  • Echo — Widget rebuild counts sorted by frequency
  • Export — Copy/save reports in Markdown, JSON, HTML

Shade tab with controls for:

  • Starting/stopping gesture recording
  • Viewing last recorded session info
  • Replaying sessions with progress tracking
  • Viewing replay results

Shade — Gesture Recording & Replay #

Record real user interactions, then replay them as automated macros:

final shade = Colossus.instance.shade;

// Start recording
shade.startRecording(name: 'checkout_flow');

// ... user interacts with the app ...

// Stop and get the session
final session = shade.stopRecording();
print('Recorded ${session.eventCount} events');

// Save for later
final json = session.toJson();

// Replay while monitoring performance
final result = await Colossus.instance.replaySession(session);
final decree = Colossus.instance.decree();
print(decree.summary);

Wrap your app with ShadeListener to capture all pointer events:

ShadeListener(
  shade: Colossus.instance.shade,
  child: MaterialApp(...),
)

Text Input Recording

For text input recording and replay, use Spark's useTextController hook. When Colossus.init() is called, it automatically registers a factory that creates ShadeTextController instances — recording-aware controllers that capture every text change during a Shade recording session.

// In a Spark widget — text input is automatically recorded
class MyForm extends Spark {
  @override
  Widget build(BuildContext context) {
    final nameController = useTextController(fieldId: 'user_name');
    final emailController = useTextController(fieldId: 'user_email');

    return Column(
      children: [
        TextField(controller: nameController),
        TextField(controller: emailController),
      ],
    );
  }
}

The fieldId parameter enables accurate text replay — Phantom matches recorded text events to the correct field by ID. Without fieldId, Phantom falls back to injecting text into the currently focused field.

Scout — AI Test Discovery #

Scout passively analyzes Shade sessions to build a Terrain — a live map of every screen the user visited and every transition between them:

final scout = Scout.instance;

// Analyze a completed recording session
scout.analyzeSession(session);

// Access the discovered terrain
final terrain = scout.terrain;
print(terrain.outposts.length);  // Number of unique screens
print(terrain.marches.length);   // Number of transitions

// Export as Mermaid diagram or AI-ready map
final mermaid = terrain.toMermaid();
final aiMap = terrain.toAiMap();

Scout learns incrementally — each new session enriches the existing Terrain with new routes, transitions, and reliability data.

Terrain — Flow Graph #

Terrain is a directed graph of Outposts (screens) connected by Marches (transitions). It auto-detects dead-ends, low-reliability edges, and orphaned screens:

final terrain = scout.terrain;

// Find a specific screen
final quest = terrain.findOutpost('/quest/details');

// Check screen health
print(quest?.deadEnd);         // true if no outgoing transitions
print(quest?.visitCount);     // How many times the screen was visited
print(quest?.reliability);    // Transition success rate (0.0 → 1.0)

Gauntlet — Edge-Case Test Generation #

Gauntlet auto-generates Stratagems (test plans) targeting weak spots discovered by Scout:

final gauntlet = Gauntlet(terrain: scout.terrain);

// Generate stratagems for a specific screen
final stratagems = gauntlet.forOutpost('/quest/details');

// Generate stratagems for the entire terrain
final all = gauntlet.forAll();

for (final s in all) {
  print('${s.name}: ${s.steps.length} steps');
}

Campaign — Test Execution #

Campaign orchestrates multi-step test runs with lifecycle management:

final campaign = Campaign(
  stratagems: gauntlet.forAll(),
  onSetup: () async => initTestEnvironment(),
  onTeardown: () async => cleanupTestEnvironment(),
);

final debrief = await campaign.execute();

print(debrief.passRate);           // e.g. 0.85
print(debrief.failedVerdicts);     // List of failed step results
print(debrief.fixSuggestions);     // AI-ready fix recommendations

Lineage — Route Resolution #

Lineage resolves parameterized routes back to their registered patterns:

final parameterizer = RouteParameterizer();
parameterizer.registerPattern('/quest/:id');
parameterizer.registerPattern('/hero/:heroId/quest/:questId');

final resolved = parameterizer.resolve('/quest/42');
print(resolved); // '/quest/:id'

Zero-Code Integration #

With ColossusPlugin, everything wires itself automatically:

  1. Shade → Scout: Every completed recording is auto-fed to Scout
  2. Atlas → Scout: Route patterns are pre-seeded from Atlas's trie
  3. Atlas Observer: Page-load timing via ColossusAtlasObserver
  4. Shade.getCurrentRoute: Auto-wired from Atlas for screen identification
  5. Terrain Notifier: UI auto-refreshes when new sessions are analyzed
// That's it — one plugin, zero manual wiring
ColossusPlugin(
  tremors: [Tremor.fps(), Tremor.leaks()],
)

Blueprint Lens Tab #

The Blueprint tab adds a 5-sub-tab interactive interface to the Lens overlay:

  • Terrain — Mermaid graph visualization, AI map export, conflict detection
  • Stratagem — Browse auto-generated test plans with expandable detail cards
  • Verdict — Step-by-step test results with pass/fail/skip rows
  • Lineage — Route resolution metrics and Signet analysis
  • Campaign — Campaign execution details with debrief summaries

BlueprintExport — AI-Bridge Export #

Export the complete Blueprint (Terrain + Stratagems + Verdicts) to disk so AI assistants like Copilot and Claude can consume it at IDE time:

// Live export from the current Scout state
final export = BlueprintExport.fromScout(scout: Scout.instance);

// Save to .titan/ directory
await BlueprintExportIO.saveAll(export, directory: '.titan');
// → .titan/blueprint.json       (structured data)
// → .titan/blueprint-prompt.md  (AI-ready Markdown summary)

Auto-Export on App Shutdown

Set blueprintExportDirectory on ColossusPlugin and Blueprint data is automatically exported when the app shuts down:

ColossusPlugin(
  blueprintExportDirectory: '.titan',
)

Offline Export from Saved Sessions

Use the CLI tool to build a Blueprint from previously saved Shade sessions:

cd packages/titan_colossus

# Basic export
dart run titan_colossus:export_blueprint

# With options
dart run titan_colossus:export_blueprint \
  --sessions-dir .titan/sessions \
  --output-dir .titan \
  --patterns /quest/:id,/hero/:heroId \
  --intensity thorough

# AI prompt only
dart run titan_colossus:export_blueprint --prompt-only

Blueprint MCP Server

Expose Blueprint data to AI assistants via the Model Context Protocol:

{
  "github.copilot.chat.mcpServers": {
    "titan-blueprint": {
      "command": "dart",
      "args": ["run", "titan_colossus:blueprint_mcp_server"],
      "cwd": "${workspaceFolder}/packages/titan_colossus"
    }
  }
}

Available MCP tools:

  • get_terrain — Full navigation graph (json, mermaid, or ai_map format)
  • get_stratagems — Generated test plans (filterable by route)
  • get_ai_prompt — AI-ready Markdown summary
  • get_dead_ends — Screens with no outgoing transitions
  • get_unreliable_routes — Transitions with low reliability scores
  • get_route_patterns — Registered parameterized route patterns

Ecosystem Integration #

System Integration
Titan DI Self-registers via Titan.put()
Herald Emits ColossusTremor events for alerts
Chronicle Logs performance events and alerts
Vigil Reports alert violations with severity
Lens Auto-registered "Perf", "Shade", and "Blueprint" tabs
Atlas Auto-wired observer, route pre-seeding, getCurrentRoute
Shade Auto-feeds completed recordings into Scout
Scout Builds Terrain from sessions, triggers terrainNotifier
BlueprintExport Bridges runtime data to IDE-time AI assistants
MCP Server Exposes Blueprint tools to Copilot/Claude

Architecture #

┌─────────────────────────────────────────────┐
│                 Colossus                     │
│              (Pillar singleton)              │
├──────────┬──────────┬──────────┬────────────┤
│  Pulse   │  Stride  │  Vessel  │   Echo     │
│  (FPS)   │ (Loads)  │ (Memory) │ (Rebuilds) │
├──────────┴──────────┴──────────┴────────────┤
│  Shade (Record & Replay) │ Inscribe (Export)│
├──────────────────────────┴──────────────────┤
│            AI Blueprint Generation           │
│  Scout → Terrain → Gauntlet → Campaign       │
│  Lineage │ Stratagem │ Verdict │ Debrief     │
├─────────────────────────────────────────────┤
│              AI-Bridge Export                 │
│  BlueprintExport │ ExportIO │ MCP Server     │
│  CLI Tool │ Auto-Export │ AI Prompt          │
├──────────┬──────────┬──────────┬────────────┤
│  Herald  │Chronicle │  Vigil   │   Lens     │
│ (Events) │ (Logs)   │ (Errors) │  (UI Tab)  │
└──────────┴──────────┴──────────┴────────────┘

License #

MIT — see LICENSE.

1
likes
70
points
244
downloads

Publisher

verified publisherikolvi.com

Weekly Downloads

Enterprise performance monitoring, AI testing, and MCP integration for Titan. Scry observation, Relay bridge, Blueprint generation, 48 MCP tools, and Lens debug overlay.

Homepage
Repository (GitHub)
View/report issues

Topics

#performance #monitoring #flutter #devtools #profiling

Documentation

API reference

License

MIT (license)

Dependencies

flutter, titan, titan_argus, titan_atlas, titan_basalt, titan_bastion, titan_envoy, web

More

Packages that depend on titan_colossus