SearchBook a call

JOURNAL / Engineering

Deep Dexter skills: gource-trove and vortex

How we built two deep Dexter skills: gource-trove for semantic repository videos and HTML dossiers, and vortex for cron-backed eval-build loops.

Co-authored by Dexter and Anish Kr Singh. This essay documents two deep procedural skills we built and run inside Dexter to inspect codebases semantically and sustain unattended eval-driven engineering loops.

Most coding-agent skills fail for the same reason: they are glorified prompt templates. They tell a model to “be thorough” or “check the architecture,” and then leave the agent to improvise brittle one-line shell commands every time a session starts.

When we build skills inside Dexter for our own work at Velofy, we aim for the opposite pattern—deep skills that fit cleanly inside what an agent harness is made of. A deep skill pairs a tight SKILL.md decision tree with real, tested local tooling, explicit invariants, deterministic fallbacks, and machine-readable artifacts. The model provides judgment; the scripts handle state, locking, math, and media pipelines deterministically.

Two skills illustrate that architecture well: gource-trove, which fuses Trove’s layered repository memory with Gource’s force-directed animation engine, and vortex, a cron-backed eval-build loop with OS watchdogs, lease locks, and crash guards.

Why repository visualization needed semantic memory

Standard Gource animations look impressive in a keynote and are nearly useless in an architecture review. Out of the box, Gource reads raw git commits and colors every file solely by its filename extension. A security-critical authentication boundary in .ts gets the exact same color as a throwaway test helper in .ts. You see churn, not structure.

Meanwhile, Trove already computes a four-layer semantic model of a repository under .trove/:

  • L4 Architecture: repository-wide overview and top-level boundaries.
  • L3 Subsystems: coherent architectural clusters (subsystem:<name>).
  • L2 Modules: individual files with module-level risk metadata.
  • L1 Symbols: functions, types, and tests with per-symbol complexity (symbols.json), plus a cross-file dependency graph (graph.json) and progressive retrieval via trove query --json.

gource-trove bridges the two through Gource’s custom log format (timestamp|username|type|file|RRGGBB). Instead of letting Gource guess colors from file extensions, gource-trove joins git history against .trove/ and emits a validated custom log where every node’s hex color encodes a real architectural signal.

Inside gource-trove: five semantic visualization modes

Different engineering questions need different lenses, so gource-trove supports five modes behind one CLI (doctor, inspect, build, render):

Mode Signal source What it reveals
subsystem Trove L3 subsystem:<name> clusters How architectural boundaries form and drift across git history
risk Module risk + symbol complexity + graph degree Complexity hotspots and high-coupling hubs before they calcify
query Live trove query --json "<concept>" Exactly where a feature lives across L1, L2, and L3 layers
blast-radius Bidirectional BFS on .trove/graph.json Hop-by-hop impact rings before a risky refactor
trove-tree Synthetic L4 → L3 → L2 → L1 replay Full codebase anatomy even on single-commit or squashed repos

1. Subsystem coloring and virtual trees

In subsystem mode, the top twelve L3 subsystems (ordered by file count) get a curated high-contrast jewel-tone palette against a dark #0B0F19 canvas, while additional subsystems hash deterministically via FNV-1a so colors stay stable across reruns. Passing --virtual-tree rewrites paths to /<subsystem>/<relpath>, regrouping scattered files by logical ownership instead of legacy directory layout. If .trove/ has not been built yet, the script falls back gracefully to top-level directory inference (keeping monorepo paths like packages/<name>, crates/<name>, and apps/<name> two levels deep).

2. Composite risk heatmaps

In risk mode, each file gets a composite score in [0, 1] derived directly from Trove’s index:

complexitySignal = min(1, totalSymbolComplexity / 40)
couplingSignal   = min(1, (inDegree + outDegree) / 15)
compositeRisk    = min(1, max(troveModuleRisk, 0.65 * complexitySignal + 0.35 * couplingSignal))

That score drives a five-stop linear RGB ramp from cool sky (#38BDF8) for simple leaf modules, through emerald (#34D399) and amber (#FBBF24), up to coral (#FB7185) and crimson (#EF4444) for critical hotspots. Watching a repo replay in risk mode immediately distinguishes healthy feature growth from a single God-file absorbing every incoming dependency.

3. Query spotlights and bidirectional blast radius

Two modes answer targeted pre-change questions:

  • query mode runs trove --repo <dir> query --budget <N> --json "<text>" and colors files by retrieval depth: electric gold (#FACC15) for L1 active symbol hits, vivid cyan (#22D3EE) for L2 module hits, soft indigo (#818CF8) for L3 subsystem siblings, and dim slate (#334155) for unrelated files so spatial orientation stays intact without visual clutter.
  • blast-radius mode runs a bidirectional BFS (both outbound imports and inbound callers) over .trove/graph.json from a --seed file or subsystem up to --max-hops (default 2). Hop 0 glows radiant rose (#F43F5E), direct hop-1 neighbors render bright amber (#F59E0B), hop-2 transitive impact renders sky blue (#38BDF8), outer rings render teal (#2DD4BF), and unaffected nodes fade to slate.

4. Trove-tree synthetic bloom

Many repositories have squashed histories or a single initial import commit where git-based Gource produces one meaningless flash. trove-tree bypasses commit history and synthesizes staggered chronological events straight from .trove/: L4 architecture root first, then L3 subsystems, then L2 modules, and finally L1 symbols colored by kind (functions, types, tests).

Headless rendering without disk bloat—and HTML dossiers

Running Gource on a headless Linux box or CI runner has a notorious trap: setting SDL_VIDEODRIVER=dummy fails immediately because SDL’s dummy driver provides no OpenGL context. gource-trove’s renderer defaults to SDL_VIDEODRIVER=offscreen on Linux, which uses Mesa EGL with zero X11 or Xvfb server overhead (falling back to xvfb-run only on older SDL2 builds, and using native SDL2 on macOS).

Equally important is memory and disk discipline. One minute of uncompressed 1080p60 PPM video is roughly 22 GB. Writing intermediate frames to disk will fill a runner before the first encode finishes. Instead, gource-trove streams Gource’s --output-ppm-stream - stdout straight into ffmpeg -f image2pipe -vcodec ppm -i - stdin across five named presets (quick-preview, cinematic-1080p, social-vertical, architectural-audit, darkroom-4k) and five output formats (mp4 with yuv420p + +faststart and auto-extracted poster.png, webm, single-pass palette-optimized gif, 3x2 PNG storyboard, and raw ppm).

Every build or render run emits a complete artifact bundle:

  • gource.log — validated custom Gource log
  • captions.txt — chronological architectural milestone captions
  • legend.svg — standalone dark-card SVG color key (which can also be composited onto video via rsvg-convert + ffmpeg overlay)
  • report.json — machine-readable Trove + Git analytics (subsystems, hotspots, coupling hubs, churn)
  • dossier.html — a self-contained HTML Architectural Dossier embedding the rendered video or poster alongside hotspot and coupling tables

That last artifact matters most in practice: you can hand dossier.html to a teammate in a PR review without asking them to install Gource, FFmpeg, or Trove.

Vortex: the cron-backed eval-build loop

Visualizing a codebase helps you plan a change. vortex solves the opposite half of engineering: keeping an agent honestly grinding on a measurable goal until the tests actually pass, even if the terminal closes, an API call times out, or a context window fills up.

The loop itself is deliberately strict:

  1. Load GOAL.md and lock in an honest evaluation harness before touching code (an existing npm test / benchmark suite, or a committed .dexter/vortex/eval.sh).
  2. Arm a per-repo OS schedule via vortex-cron.mjs arm, writing .dexter/vortex/state.json, keeping machine-local runtime files out of git via .dexter/vortex/.gitignore, and registering a 30-minute watchdog (*/30 * * * * in Linux crontab or StartInterval: 1800 in macOS launchd, keyed by repository hash so multiple repos never collide).
  3. Iterate with discipline: refresh the session heartbeat, run the eval harness, append one structured JSON line to .dexter/vortex/log.jsonl (iteration, ts, exitCode, score, summary, source), diagnose the smallest concrete root causes, apply minimal fixes, commit as vortex(i<N>): <what changed>, and re-evaluate.

Hard rules are baked into the contract: never weaken the eval to force a green run, never fabricate a score, revert (git revert) any iteration that regresses metrics, and if the iteration budget is exhausted without passing, write .dexter/vortex/POSTMORTEM.md honestly instead of claiming victory.

Session leases, 30-minute watchdogs, and crash guards

Unattended agent loops fail in two symmetric ways: either they die silently at 2 a.m. when an SSH session drops, or they double-spawn and corrupt the working tree while burning through an API budget. vortex-cron.mjs prevents both with four lightweight mechanisms:

  • One-writer session lease locks: Each active iteration calls heartbeat --iteration <N>. When the 30-minute cron tick fires, it checks whether another cron worker PID is alive, or whether the interactive session PID is alive and its heartbeat/log was updated within --stale-minutes (default 25). If so, the tick exits cleanly without touching the repo.
  • Zero-token eval pre-check: When a session has died or gone stale, tick acquires the lock and runs the eval command directly before spawning an LLM. If the repo already passes (for instance, the interactive session fixed the bug right before disconnecting), vortex marks the run done and disarms the OS schedule with zero tokens spent.
  • Re-entry safe headless resume: If the eval still fails, tick spawns a headless dexter -p worker with DEXTER_VORTEX_CRON_WORKER=1, passing the captured eval failure tail and .dexter/vortex/log.jsonl so work resumes from the exact last iteration instead of restarting at zero. Inside a cron worker, the skill knows not to re-arm cron or delete the active lock.
  • Crash guards and operator PAUSE files: If headless dexter fails three consecutive times without appending log progress, tick automatically writes .dexter/vortex/PAUSE to stop burning retries. Operators can also drop a repo-local .dexter/vortex/PAUSE or a global ~/.dexter/agent/PAUSE file to freeze every loop immediately without losing the underlying schedule.

What makes a skill actually durable

Across both gource-trove and vortex, the lesson has been consistent. Language models are great at deciding which mode to inspect, why a test failed, and what minimal patch fixes a root cause. They are terrible at remembering to stream raw PPM frames over stdin, computing FNV-1a hashes consistently, or managing POSIX PID leases by hand.

Moving the state machines, math, locks, and OS scheduling into small, tested Node scripts—and giving the agent a concise SKILL.md interface over them—turns fragile agent sessions into repeatable engineering infrastructure.

← All journal entries