๐ค Claude Code Session Reset Scheduler
November 6, 2025 ยท View on GitHub
Automated session management system that ensures fresh Claude Code quotas during your working hours
A GitHub Actions-powered scheduler that automatically triggers Claude Code session resets at optimal times, maintaining a 5-hour countdown to ensure new quotas are available when you need them most. Features health monitoring through simple Q&A checks.
โจ Key Features
- ๐ Automatic Session Management - Triggers 4 daily resets aligned with work periods
- โฐ Smart Timing - 5-hour countdown ensures sessions refresh during productive hours
- ๐งช Health Monitoring - Built-in Q&A checks verify system functionality
- ๐ Multi-Token Support - Configure backup tokens for reliability
- ๐ Activity Logging - Track all resets in monthly CSV logs
- โก Fast Failure Protection - 5-minute job timeout prevents resource waste
๐ Default Schedule (UTC+8 Timezone)
The system triggers session resets 5 hours before your target work periods:
| ๐ Trigger | โฐ Session Resets | ๐ผ Work Period Coverage |
|---|---|---|
| 05:23 | 10:00 AM | Morning (8:00-12:00) |
| 10:23 | 3:00 PM | Afternoon (1:00-5:00) |
| 17:23 | 10:00 PM | Evening (8:00-12:00) |
| 22:23 | 3:00 AM (next) | Late night coverage |
๐ Quick Start
Step 1: Get the Repository
Choose one option:
Option A: Fork (Recommended for personal use)
# 1. Fork this repo on GitHub
# 2. Clone your fork
git clone https://github.com/codeotter0201/claude-daily-check-in.git
cd claude-daily-check-in
Option B: Clone directly
git clone https://github.com/codeotter0201/claude-daily-check-in.git
cd claude-daily-check-in
Step 2: Generate OAuth Token
claude setup-token
Copy the generated oauth_token_... value.
Step 3: Add to GitHub Secrets
- Navigate to: Settings โ Secrets and variables โ Actions
- Create new secrets:
| Secret Name | Value | Required |
|---|---|---|
CLAUDE_CODE_OAUTH_TOKEN_1 | Your first OAuth token | โ Yes |
CLAUDE_CODE_OAUTH_TOKEN_2 | Your second OAuth token | โญ Optional |
Step 4: Done!
โ The scheduler is now active and will run automatically based on the default schedule.
- First trigger will happen at the next scheduled time
- Check the Actions tab in your GitHub repository to monitor runs
- No push needed unless you modify the schedule
โ๏ธ Customizing Schedule Times
Understanding the Timing System
Each trigger initiates a 5-hour countdown. The formula is:
Trigger Time + 5 hours = Session Reset Time
Quick Examples
๐ Click for Common Schedule Configurations
Single Daily Reset (9:00 AM)
schedule:
- cron: "23 20 * * *" # Triggers at 4:23 AM โ Resets at 9:00 AM
Twice Daily (10:00 AM & 4:00 PM)
schedule:
- cron: "23 21,3 * * *" # Triggers at 5:23 AM & 11:23 AM
Business Hours (9:00 AM, 2:00 PM, 7:00 PM)
schedule:
- cron: "23 20,1,6 * * *" # Triggers 5 hours before each
How to Modify Schedule
- Edit
.github/workflows/auto-checkin.yml - Find the schedule line (~line 12):
- cron: "23 21,2,9,14 * * *" # Current schedule - Calculate your times:
- Choose reset times (in your timezone)
- Subtract 5 hours for trigger times
- Convert to UTC
- Use
:23minutes (avoids congestion)
- Push your changes to apply the new schedule:
git add .github/workflows/auto-checkin.yml git commit -m "Update schedule times" git push origin main
๐ Time Zone Conversion Helper
| Your Reset Time (UTC+8) | Trigger Time (UTC+8) | Cron Hour (UTC) |
|---|---|---|
| 9:00 AM | 4:23 AM | 20 |
| 10:00 AM | 5:23 AM | 21 |
| 2:00 PM | 9:23 AM | 1 |
| 3:00 PM | 10:23 AM | 2 |
| 7:00 PM | 2:23 PM | 6 |
| 10:00 PM | 5:23 PM | 9 |
๐งช Testing Your Setup
Via GitHub Actions (Recommended)
- Go to Actions tab
- Select "Claude Code Session Reset Scheduler"
- Click "Run workflow"
Local Testing
# Test Q&A functionality
uv run --python 3.13 python src/log_qa_check.py --token TOKEN_1
# View logs
cat logs/$(date +%Y%m)-session-log.csv
๐ Session Logs
Monthly CSV files track all activities:
Location: logs/YYYYMM-session-log.csv
Format:
timestamp,event_type,token_id,reset_time_utc8
2025-09-04 05:24:27,SESSION-RESET-TRIGGER,TOKEN_1,2025-09-04 18:24:27
๐ ๏ธ Architecture
System Flow
graph LR
A[GitHub Actions] -->|Scheduled Trigger| B[Claude Code]
B -->|"Q&A Check: 1+1=?"| C[Health Verification]
C -->|Log Event| D[CSV File]
D -->|Git Commit| E[Repository]
B -->|5-hour Countdown| F[Session Reset]
Project Structure
๐ claude-daily-check-in/
โโโ ๐ .github/workflows/
โ โโโ ๐ auto-checkin.yml # Scheduler configuration
โโโ ๐ src/
โ โโโ ๐ log_qa_check.py # Q&A & logging script
โโโ ๐ logs/ # Session records
โ โโโ ๐ YYYYMM-session-log.csv
โโโ ๐ README.md # This file
โโโ ๐ ADR-*.md # Architecture decisions
๐ง Advanced Configuration
Multiple Token Setup
Benefits of using multiple tokens:
- โ Redundancy - Backup if one fails
- โ Load Distribution - Parallel processing
- โ Tracking - Individual token monitoring
๐ Troubleshooting
โ OAuth Token Error
Error: Could not fetch an OIDC token or 401 Bad credentials
Solutions:
- Regenerate token:
claude setup-token - Verify secret names match exactly
- Check GitHub Actions has
id-token: writepermission - Update
CLAUDE_CODE_OAUTH_TOKEN_1andCLAUDE_CODE_OAUTH_TOKEN_2in GitHub Secrets
โฑ๏ธ Workflow Timeout (6 hours)
Status: Fixed in current version
Solution: The workflow now includes timeout protection:
- Job-level timeout: 5 minutes
- Step-level timeout: 2 minutes per action
If you still experience timeouts:
- Update to the latest
.github/workflows/auto-checkin.yml - Verify timeout configurations are present
- Check for authentication errors that may cause hanging
โฐ Wrong Reset Times
Checklist:
- GitHub Actions uses UTC (not local time)
- The 5-hour countdown is automatic
- GitHub may delay execution by several minutes
- Check timezone conversion calculations
๐ No Logs Created
Debug Steps:
# Check Claude status
claude --version
claude auth status
# Test locally
claude -p "1+1=?"
# Manual trigger
uv run --python 3.13 python src/log_qa_check.py --token TOKEN_1
๐ Monitoring
Health Checks
- โ GitHub Actions - Review workflow runs
- โ CSV Logs - Verify monthly records
- โ Git History - Check automated commits
- โ Session Availability - Monitor actual resets
Maintenance Tasks
- ๐ Monthly - Review log files
- ๐ Quarterly - Rotate OAuth tokens
- ๐ As Needed - Adjust schedule based on usage
๐ Security
โ ๏ธ Important Security Practices:
- Never hardcode tokens in code
- Use GitHub Secrets for sensitive data
- Rotate OAuth tokens regularly
- Limit repository access permissions
๐ค Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
๐ Version History
v2.3.0 (Current)
- โ Workflow timeout protection (5-minute job, 2-minute steps)
- โ Fast failure mechanism prevents 6-hour runaway executions
- โ Integrated Q&A health checks
- โ Enhanced logging with reset time calculations
- โ Local testing capabilities
- โ
Optimized cron timing (
:23minutes)
๐ Documentation
- ADR-001: Session Reset Schedule
- ADR-002: Timing Optimization
- ADR-003: Q&A Health Checks
- ADR-004: Workflow Timeout Configuration
- Official Documentation
- Product Requirements
Based on architecture decisions optimized for reliability and user convenience