Skip to content

KPI Pipeline

Mundo edited this page Apr 7, 2026 · 1 revision

KPI Pipeline

Overview

Every day at 5pm Sydney time, the KPI pipeline fetches your GitHub activity, asks for manual input, and generates a professional daily report.

Pipeline Flow

Phase 1 (parallel):   cleanupAgent + githubAgent
Phase 2 (sequential): manualKpiAgent ← waits for your input
Phase 3 (sequential): diaryAgent ← writes report from Phase 1+2 data

Step-by-Step

Phase 1: Cleanup + GitHub (parallel)

Two agents run simultaneously via Promise.allSettled():

  • cleanupAgent — deletes stale records from the company database (older than 30 days)
  • githubAgent — fetches all commits and pull requests for the day using the GitHub API (Octokit)

If cleanup fails, the pipeline continues. If GitHub fetch fails, the pipeline stops (no data to report on).

Phase 2: Manual Input (interactive)

The manualKpiAgent prompts you to enter activities that GitHub doesn't capture:

  • Meetings, code reviews, planning sessions
  • Documentation, mentoring, design work
  • Anything else worth recording

If no manual activities are provided, the pipeline skips the diary and saves GitHub data only.

Phase 3: Diary Report (sequential)

The diaryAgent combines GitHub activity + manual input and generates a professional KPI report:

  • One-sentence summary of the day
  • GitHub contributions (commits and PRs with context)
  • Manual activities
  • Short closing note on progress or impact

The report is saved to both the diary database table and a local markdown file (data/diary/YYYY-MM-DD.md).

Data Saved

Table Data
kpi GitHub summary, commit count, PR count, manual activities
diary Full AI-generated KPI report text
cleanup_log Cleanup results (deleted count, errors, status)

Running Manually

pnpm start

This is interactive — it will prompt for manual input in the terminal.

Running via GitHub Actions

The daily-kpi.yml workflow uses workflow_dispatch with an input form — enter comma-separated activities before clicking Run.

Clone this wiki locally