Skip to content

Morning/Nightly Routines

PopKit provides day-bracketing workflows that check project health at the start and end of each day. Routines are programmatic workflows with predictable, deterministic steps - not AI-generated guesses.

Morning and nightly are two built-in routines (ID: pk). You can also create custom routines for your specific workflow needs.

TypeBuilt-in IDPurposeOutput
MorningpkStart-of-day health checkReady to Code Score
NightlypkEnd-of-day cleanup & saveSleep Score
Custom<prefix>-NProject-specific workflowsCustom score

Command: /popkit-dev:routine morning

The morning routine executes a 5-step deterministic pipeline:

What it does: Reads STATUS.json to restore previous context

Programmatic:

# Reads STATUS.json from project root
status = json.load("STATUS.json")
session_data = {
"last_nightly_score": status["last_nightly_routine"]["sleep_score"],
"last_work_summary": status["git_status"]["action_required"],
"previous_branch": status["git_status"]["current_branch"],
}

What it does: Runs shell commands to gather current project state

Programmatic:

Terminal window
# Git state
git fetch --prune
git status --porcelain
git rev-list --count HEAD..origin/main
git stash list
# GitHub state (if gh CLI available)
gh pr list --state open --json number,title,reviewDecision
gh issue list --state open --json number,title,assignees,labels
# Service health (platform-specific)
pgrep -f node
pgrep -f redis-server
pgrep -f postgres

What it does: Applies deterministic scoring formula

Programmatic:

CheckPointsCriteria
Clean working directory25No uncommitted changes
Tests passing25All tests pass
CI status20Last run successful
Dependencies15No critical vulnerabilities
Documentation15CLAUDE.md up to date

Score interpretation:

  • 90-100: Green - All systems go
  • 70-89: Yellow - Minor issues
  • < 70: Red - Critical issues need attention

What it does: Formats collected data into readable output

Uses templates from packages/popkit-dev/output-styles/morning-dashboard.md

What it does: Writes current state to STATUS.json for tomorrow

Programmatic:

# Writes to STATUS.json
{
"session_id": "morning-2024-01-15-083045",
"timestamp": "2024-01-15T08:30:45Z",
"last_morning_routine": {
"executed_at": "2024-01-15T08:30:45Z",
"ready_to_code_score": "87/100",
"breakdown": {...}
},
"recommendations": {
"before_coding": ["Sync with remote: git pull (3 commits behind)"],
"todays_focus": ["Review 2 pending PRs"]
}
}

Command: /popkit-dev:routine nightly

CheckPointsCriteria
Uncommitted work saved25No unsaved changes or committed
Branches cleaned20No stale branches
Issues updated20Today’s issues have status
CI passing15Last run successful
Services stopped10Dev services shut down
Logs archived10Session logs saved

☀️ Morning Routine Report
Ready to Code Score: 92/100 ✅
✅ Git Status: Clean working tree
✅ Dependencies: Up to date
✅ Tests: All passing
⚠️ Security: 2 low-severity vulnerabilities
📋 Today's Priorities:
1. Complete PR #123 (Code review feedback)
2. Work on Issue #456 (User authentication)
3. Update documentation for v2.0
🎯 Next Steps:
- Fix security vulnerabilities (low priority)
- Continue work on feat/auth branch
- Review open PRs
🌙 Nightly Routine Report
Sleep Score: 88/100 ✅
📊 Today's Activity:
- 5 commits created
- 12 files modified
- +324 lines added, -87 lines removed
✅ State captured for tomorrow
✅ Branches cleaned up
⚠️ Uncommitted changes stashed
💤 Tomorrow's Context:
- Resume work on feat/auth branch
- Review PR feedback on #123
- Continue with Issue #456
🎯 Recommended Actions:
- Push feat/auth branch (recommended)
- Other

Pre-configured flag combinations for common use cases:

ProfileSpeedFlags Applied
minimal< 10s--quick --skip-tests --skip-services --skip-deployments
standard~20s(defaults)
thorough~60s--full --measure
civaries--optimized --measure --simple --no-cache
Terminal window
# Fast morning check
/popkit-dev:routine morning --profile minimal
# Deep analysis with metrics
/popkit-dev:routine morning --profile thorough

FlagEffect
--quickOne-line summary instead of full report
--measureTrack performance metrics
--optimizedUse caching for efficiency
--no-cacheForce fresh execution, bypass cache
--simpleMarkdown tables instead of ASCII dashboard
--skip-testsSkip test execution
--skip-servicesSkip service health checks
--skip-deploymentsSkip deployment status check
--fullInclude all checks (slower)
--no-nightlySkip “From Last Night” section
--no-upstreamSkip Anthropic upstream update check
  • --measure automatically enables --simple for parseable output
  • --full overrides --optimized (thorough checks can’t be cached)

Create project-specific routines beyond pk.

Each project can have up to 5 custom routines per type (morning/nightly).

IDs use your project prefix: rc-1, rc-2, maa-1, etc.

Terminal window
/popkit-dev:routine generate

This creates:

.claude/popkit/routines/morning/<prefix>-1/
├── routine.md # Routine definition with checks
├── config.json # Score weights and settings
└── checks/ # Custom check scripts
Terminal window
/popkit-dev:routine list

Output:

Morning Routines
| ID | Name | Default | Created |
|-------|-----------------------|---------|------------|
| pk | PopKit Standard | yes | (built-in) |
| rc-1 | Full Stack Check | | 2024-01-15 |
Slots available: 4 of 5
Terminal window
/popkit-dev:routine set rc-1
Terminal window
/popkit-dev:routine morning run rc-1

Location: .claude/popkit/config.json

{
"project_name": "Reseller Central",
"prefix": "rc",
"defaults": {
"morning": "pk",
"nightly": "pk"
},
"routines": {
"morning": [
{
"id": "rc-1",
"name": "Full Stack Check",
"description": "Includes database and Redis health",
"created": "2024-01-15T08:00:00Z",
"based_on": "pk"
}
],
"nightly": []
}
}

Location: STATUS.json (project root)

This file persists across sessions and enables context restoration.

See Configuration Reference for complete schema documentation.


Track routine efficiency with --measure:

Terminal window
/popkit-dev:routine morning --measure

View measurements:

Terminal window
/popkit-core:stats routine
/popkit-core:stats routine morning --all

Measurements include:

  • Duration (ms)
  • Tool calls
  • Token usage (input/output)
  • Cost estimate (USD)
  • Per-check breakdown

  1. Run Morning Routine First: Start each day with health check
  2. Run Nightly Routine Last: End each day with cleanup
  3. Address Red Scores: Fix critical issues before coding
  4. Use Profiles: Match routine depth to your time
  5. Create Custom Routines: Tailor checks to your stack

Symptom: Low Ready to Code score

Solutions:

  • Fix test failures
  • Update dependencies
  • Address security issues
  • Clean git state

Symptom: Low Sleep score

Solutions:

  • Commit or stash changes
  • Push completed work
  • Close or save work-in-progress
  • Clean up temporary files

Symptom: Morning routine doesn’t restore previous work

Solution:

  • Ensure nightly routine ran successfully
  • Check STATUS.json exists in project root
  • Manually run: /popkit-core:project restore