← back to Daily Reporting

QUICK-START.md

355 lines

# Quick Start Guide - Daily Reporting System

Get up and running with automated daily reports in 5 minutes.

## Prerequisites

- DW-Agents system running
- PM2 managing agents
- Node.js and npm installed
- Slack workspace access (for notifications)

## Installation (5 Minutes)

### Step 1: Install Dependencies (1 min)

```bash
cd /root/DW-Agents
npm install node-fetch @types/node-fetch
```

### Step 2: Configure Slack (2 min)

#### A. Create Slack Webhook

1. Go to: https://api.slack.com/messaging/webhooks
2. Click "Create New App" > "From scratch"
3. Name: "DW-Agents Reporter"
4. Click "Incoming Webhooks" > Toggle ON
5. Click "Add New Webhook to Workspace"
6. Select channel: **#morning-report** (create if needed)
7. Copy webhook URL

#### B. Set Environment Variable

```bash
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
export SLACK_CHANNEL="#morning-report"

# Make it persistent
echo 'export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"' >> ~/.bashrc
echo 'export SLACK_CHANNEL="#morning-report"' >> ~/.bashrc
source ~/.bashrc
```

### Step 3: Run Setup Script (2 min)

```bash
cd /root/.claude/skills/daily-reporting
chmod +x setup-cron.sh
./setup-cron.sh
```

This will:
- Verify dependencies
- Install cron jobs (6:00 AM and 5:00 PM)
- Run a test report
- Send test message to Slack

## Verify Installation

### Check Cron Jobs

```bash
crontab -l | grep daily-report
```

Should show:
```
0 6 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts morning >> /root/DW-Agents/logs/morning-report.log 2>&1
0 17 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts eod >> /root/DW-Agents/logs/eod-report.log 2>&1
```

### Test Report Generation

```bash
cd /root/.claude/skills/daily-reporting
tsx daily-report-runner.ts morning
```

Expected output:
```
============================================================
🤖 DW-AGENTS DAILY REPORTING SYSTEM
============================================================

📊 Report Type: MORNING
⏰ Started at: ...

📋 Step 1: Generating report...
✅ Report generated successfully

💾 Step 2: Saving report to file...
✅ Report saved: /root/DW-Agents/reports/morning-report-...json

📤 Step 3: Sending report to Slack...
✅ Report sent to Slack channel: #morning-report

📊 REPORT SUMMARY:
   System Health: 95%
   Agents Online: 14/15
   Tasks Completed: 127
   Critical Issues: 0
   Q&A Readiness: 85%

✅ Daily report completed successfully!
```

### Check Slack

Go to **#morning-report** channel in Slack. You should see the report!

## Manual Usage

### Generate Reports Manually

```bash
cd /root/.claude/skills/daily-reporting

# Morning report
tsx daily-report-runner.ts morning

# End-of-day report
tsx daily-report-runner.ts eod

# Test Slack connection
tsx daily-report-runner.ts test

# Show help
tsx daily-report-runner.ts help
```

### View Logs

```bash
# Real-time monitoring
tail -f /root/DW-Agents/logs/morning-report.log

# Last 50 lines
tail -50 /root/DW-Agents/logs/eod-report.log

# View saved reports
ls -lh /root/DW-Agents/reports/
```

## What You Get

### Morning Report (6:00 AM)

```
☀️ MORNING STANDUP REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 EXECUTIVE SUMMARY
- System health percentage
- Agents online/offline
- Critical issues
- Top achievements

🏢 DEPARTMENT REPORTS
For each department:
- Agent status
- Tasks completed
- Issues detected
- Highlights

🚨 ISSUES REQUIRING ATTENTION
- Critical: Offline agents
- High: Error rates
- Medium: Performance issues
- Low: Warnings

✅ ACTION ITEMS
- Prioritized next steps

💬 Q&A READINESS
- Agent status scores
- Recent activities
```

### End-of-Day Report (5:00 PM)

Same structure, with full day statistics.

## Troubleshooting

### Problem: No Slack messages

**Solution**:
```bash
# Test webhook
tsx daily-report-runner.ts test

# Check environment variable
echo $SLACK_WEBHOOK_URL

# Verify network
curl -I https://hooks.slack.com
```

### Problem: Cron not running

**Solution**:
```bash
# Check cron service
systemctl status cron

# Verify crontab
crontab -l

# Check logs
tail -f /var/log/syslog | grep CRON
```

### Problem: Agents showing offline

**Solution**:
```bash
# Check PM2
pm2 list

# Restart all agents
pm2 restart all

# Check specific agent
curl http://45.61.58.125:9878/api/metrics
```

## Customization

### Change Report Times

```bash
crontab -e

# Change 6:00 AM to 7:00 AM
0 7 * * * ...

# Change 5:00 PM to 6:00 PM
0 18 * * * ...
```

### Change Slack Channel

```bash
export SLACK_CHANNEL="#operations"

# Update in crontab
crontab -e
# Add: SLACK_CHANNEL=#operations
```

### Disable @channel Mentions

Edit `/root/.claude/skills/daily-reporting/daily-report-runner.ts`:

```typescript
const slackConfig = {
  // ...
  mentionChannelOnIssues: false
};
```

## Daily Workflow

### 6:00 AM - Morning Standup
1. Report automatically generates
2. Sent to #morning-report
3. Team reviews overnight activities
4. Action items prioritized

### Throughout the Day
- Agents collect metrics
- Issues auto-detected
- Reports saved to files

### 5:00 PM - End-of-Day
1. Full day report generates
2. Sent to #morning-report
3. Review accomplishments
4. Plan for tomorrow

## Next Steps

1. **Invite team to #morning-report**:
   ```
   /invite @teammate
   ```

2. **Customize agent metrics**:
   - Edit `/root/.claude/skills/daily-reporting/agent-hierarchy.ts`
   - Add custom metrics per agent

3. **Set up multiple channels**:
   - Create separate webhooks
   - Send executive summary to #leadership
   - Send IT metrics to #ops

4. **Add visualizations**:
   - Integrate with Grafana
   - Create custom dashboards
   - Export to Google Sheets

## Cheat Sheet

```bash
# Test connection
tsx daily-report-runner.ts test

# Generate morning report
tsx daily-report-runner.ts morning

# Generate EOD report
tsx daily-report-runner.ts eod

# View logs
tail -f /root/DW-Agents/logs/morning-report.log

# Check cron
crontab -l

# Check PM2
pm2 list

# View reports
ls -lh /root/DW-Agents/reports/
```

## Support

### Documentation
- **Full README**: `/root/.claude/skills/daily-reporting/README.md`
- **Slack Setup**: `/root/.claude/skills/daily-reporting/SLACK-SETUP-GUIDE.md`
- **Hierarchy**: `/root/.claude/skills/daily-reporting/HIERARCHY-DIAGRAM.md`

### Commands
```bash
# Help
tsx daily-report-runner.ts help

# Test
tsx daily-report-runner.ts test

# Manual run
tsx daily-report-runner.ts morning
```

### Common Paths
- **Skill directory**: `/root/.claude/skills/daily-reporting/`
- **Reports**: `/root/DW-Agents/reports/`
- **Logs**: `/root/DW-Agents/logs/`

---

**🎉 You're all set!** Reports will now run automatically at 6:00 AM and 5:00 PM daily.