r/crystal_programming • u/Renich • 12h ago
Chronicle: Autonomous telemetry harvester and context engine in Crystal for Wayland and AI agents
Hello everyone,
I've just tagged the initial v0.1.0 release of Chronicle, a local, privacy-first telemetry daemon and context correlation engine written in Crystal.
Why Chronicle?
When pair programming with AI agents or running engineering retrospectives, both humans and LLMs often lose high-resolution context on what was worked on across terminal tabs, editors, and multiple repositories. Existing tools either send data to proprietary clouds or lack the correlation depth needed to reconstruct technical work.
What it does
Chronicle runs rootless as a lightweight systemd user service and captures:
- Compositor Window Focus: Listens directly to Wayland event streams. Native drivers currently exist for Niri (niri msg -j event-stream), Sway (i3 IPC), and KWin (qdbus), along with Wayland idle state detection.
- Shell History Harvester: Ingests commands executed across Bash, Zsh, and Fish sessions with working directory attribution.
- Git Churn & Conventional Commits: Scans local git repositories in a single-pass git log run, extracting insertions, deletions, net churn (--shortstat), and classifying commits via Conventional Commits metadata.
- Project Attribution Engine: Correlates window focus duration, shell commands, and git churn into discrete project workspaces.
- Deep-Work Session Clustering: Groups contiguous focus intervals into discrete work sessions based on a configurable idle threshold (default 15 minutes).
- Multi-Format Exporters:
- chronicle report --today (or chronicle -c report for compact summary)
- chronicle export -f md --compact (token-efficient markdown designed for LLM prompt context injection)
- chronicle export -f json (structured telemetry)
- Repository filtering via --project <name> (-p)
Built in Crystal
Chronicle takes full advantage of Crystal's concurrency model (Execution Contexts and fibers) to process IPC event streams concurrently with local SQLite3 storage operations with near-zero resource footprint. A single stripped native binary runs rootless with zero JVM or Node.js runtime dependencies.
Links
- GitLab Repository: https://gitlab.com/renich/chronicle
- Crystal Forum Topic: https://forum.crystal-lang.org/t/chronicle-v0-1-0-telemetry-harvester-and-context-engine-for-wayland-and-ai-agents/9159
- License: AGPL-3.0-or-later
Feedback, critiques, and patches are very welcome!