Skip to content

feat: Add automatic ingestion scheduling#104

Merged
evansenter merged 1 commit into
mainfrom
feat/auto-ingestion-issue-103
Feb 7, 2026
Merged

feat: Add automatic ingestion scheduling#104
evansenter merged 1 commit into
mainfrom
feat/auto-ingestion-issue-103

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • Adds FastMCP lifespan with background asyncio task that ingests local JSONL files on startup and every 5 minutes
  • Adds client-side push scheduling (LaunchAgent for macOS, systemd timer for Linux) wired into make install-client
  • Server no longer depends on lazy ensure_fresh_data() as sole ingestion trigger

Problem: Ingestion only ran when query tools were called. If no queries were made, data went stale — last ingestion was Jan 31 despite the server being active for a week.

Test plan

  • make check passes (395 tests, lint, format)
  • Restart server, verify "Startup ingestion complete" in logs
  • After 5 min, verify "Background ingestion complete" in logs
  • get_status() shows last_ingestion within seconds of server start

Fixes #103

🤖 Generated with Claude Code

Server was only ingesting when query tools were called (lazy via
ensure_fresh_data). If no queries were made, data went stale
indefinitely — last ingestion was a week old.

Changes:
- Add FastMCP lifespan with background asyncio task for periodic ingest
  (every 5 min + initial ingest on startup)
- Add client-side push schedule templates (LaunchAgent + systemd timer)
- Add install/uninstall scripts for push schedule
- Wire push schedule into `make install-client`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Feb 7, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

This PR adds automatic ingestion scheduling: a FastMCP lifespan with background asyncio task for server-side periodic ingestion (startup + every 5 min), and client-side push scheduling via LaunchAgent/systemd timer templates wired into make install-client. The ensure_fresh_data() fallback is retained in query tools.

Issues Found

Critical

None

Important

None

Suggestions

  • scripts/install-push-schedule.sh:8 - PROJECT_DIR is defined but never used. Remove the dead variable.
  • src/agent_session_analytics/server.py:43 - The server parameter in server_lifespan(server) is unused. Consider naming it _server to signal it's intentionally ignored (consistent with Python convention for unused parameters).
  • src/agent_session_analytics/guide.md - The updated documentation says "The server automatically ingests local JSONL files on startup and every 5 minutes" but doesn't mention the new client-side push scheduling. Since this is a user-facing guide, it would be helpful to mention that client machines can be configured to push data to the server on a schedule (via make install-client).

Verdict

REQUEST_CHANGES - Three minor suggestions: unused variable in install script, unused parameter naming convention, and documentation gap for the new client push feature.


Automated review by Claude Code

@evansenter evansenter merged commit 0c59782 into main Feb 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automatic ingestion scheduling (server-side + client push)

1 participant