Skip to content

Deploy agent-session-analytics to speck-vm with Tailscale #93

Description

@evansenter

Summary

Set up agent-session-analytics on speck-vm for multi-machine access, mirroring the agent-event-bus deployment pattern.

Tasks

Makefile targets (mirror agent-event-bus)

  • Add install-server target (service + dependencies + MCP config)
  • Add install-client target (CLI + MCP config with REMOTE_URL param)
  • Add backwards-compatible install: install-server alias

Remote ingestion (push-based)

Session JSONL files live on each machine locally. Clients need to push their data to the central server.

New MCP tool:

  • upload_session(session_id, entries: list[dict]) - accepts parsed entries, writes to DB
  • Batch support for large sessions (chunk if needed)
  • Deduplication via existing UUID logic

New CLI command:

  • agent-session-analytics-cli push [--days N] - reads local JSONL, calls remote MCP
  • Uses AGENT_SESSION_ANALYTICS_URL env var for server URL
  • Progress output for large uploads

Hook integration:

  • Update SessionStart:compact hook to call push after compaction events
  • Or: periodic sync via cron/launchd

Documentation

  • Create docs/TAILSCALE_SETUP.md (adapt from agent-event-bus)
  • Document push-based ingestion workflow

Deployment

  • Clone repo on speck-vm
  • Run make install-server
  • Transfer database from local (~245MB)
  • Set up tailscale serve --bg 8081
  • Run make install-client REMOTE_URL=https://speck-vm.tailac7b3c.ts.net/mcp on laptop

Design Notes

Why push-based?

  • ingest_logs() reads from ~/.claude/projects/*.jsonl which are local to each machine
  • Can't have server read client files without file sync infrastructure
  • Push over MCP HTTP uses existing auth (Tailscale) and transport

Flow

[Client Machine]                    [Server (speck-vm)]
~/.claude/projects/*.jsonl  --->    upload_session() MCP tool
        |                                   |
   CLI reads local files              Writes to SQLite
   Parses entries                     Dedupes by UUID
   Calls remote MCP                   Updates session stats

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions