Skill: ckchzh/sleepwell (version 2.0.1)

--- name: SleepWell description: "Track sleep habits and analyze rest patterns over time. Use when logging bedtimes, planning schedules, tracking streaks, reviewing weekly patterns." version: "2.0.0" author: "BytesAgain" homepage: https://bytesagain.com source: https://github.com/bytesagain/ai-skills tags: ["sleep","health","wellness","tracker","rest","habits","quality","bedtime"] categories: ["Health & Wellness", "Personal Management", "Productivity"] --- # SleepWell Productivity toolkit for managing tasks, plans, reviews, streaks, reminders, priorities, archives, tags, timelines, reports, and weekly reviews. Each command logs timestamped entries and lets you review past entries, search history, view statistics, and export data in multiple formats. ## Commands | Command | Description | |---------|-------------| | `sleepwell add <input>` | Add a new entry (or view recent add entries with no args) | | `sleepwell plan <input>` | Log a plan entry (or view recent plans with no args) | | `sleepwell track <input>` | Log a tracking entry (or view recent entries with no args) | | `sleepwell review <input>` | Log a review entry (or view recent reviews with no args) | | `sleepwell streak <input>` | Log a streak entry (or view recent streaks with no args) | | `sleepwell remind <input>` | Log a reminder (or view recent reminders with no args) | | `sleepwell prioritize <input>` | Log a priority entry (or view recent priorities with no args) | | `sleepwell archive <input>` | Archive an entry (or view recent archives with no args) | | `sleepwell tag <input>` | Tag an entry (or view recent tags with no args) | | `sleepwell timeline <input>` | Log a timeline entry (or view recent timeline with no args) | | `sleepwell report <input>` | Log a report entry (or view recent reports with no args) | | `sleepwell weekly-review <input>` | Log a weekly review (or view recent weekly reviews with no args) | | `sleepwell stats` | Show summary statistics across all log categories | | `sleepwell export <fmt>` | Export all data to json, csv, or txt format | | `sleepwell search <term>` | Search across all log files for a term | | `sleepwell recent` | Show the 20 most recent history entries | | `sleepwell status` | Health check: version, data dir, entry count, disk usage, last activity | | `sleepwell help` | Show help with all available commands | | `sleepwell version` | Show version number | ## How It Works Each productivity command (add, plan, track, review, etc.) works in two modes: - **With arguments**: Saves the input with a timestamp to a dedicated `.log` file and displays the total entry count - **Without arguments**: Shows the 20 most recent entries from that category's log file All actions are also recorded in a central `history.log` for unified tracking. ### Typical Workflow 1. **Plan your day**: `sleepwell plan "Focus on Q2 report, finish by 3pm"` 2. **Track tasks**: `sleepwell track "Started Q2 report — gathering data"` 3. **Set reminders**: `sleepwell remind "Send draft to team by 4pm"` 4. **Prioritize**: `sleepwell prioritize "Q2 report > email cleanup > meeting prep"` 5. **Review progress**: `sleepwell review "Completed 3/5 tasks, good day"` 6. **Weekly roundup**: `sleepwell weekly-review "Productive week, hit all deadlines"` ## Data Storage All data is stored in `~/.local/share/sleepwell/`. The directory contains: - `add.log`, `plan.log`, `track.log`, `review.log`, etc. — one log file per command category - `history.log` — central log of all actions with timestamps - `export.json`, `export.csv`, `export.txt` — generated export files The tool automatically creates the data directory on first run. ## Requirements - **Shell**: Bash 4+ - **No external dependencies** — uses only standard Unix utilities (`date`, `wc`, `du`, `grep`, `tail`, `head`) - **Works on**: Linux, macOS, any POSIX-compatible system ## When to Use 1. **Daily task management** — Use `sleepwell add "fix login bug"` and `sleepwell track "started debugging"` to log and track tasks throughout the day 2. **Sprint planning** — Run `sleepwell plan "Sprint 14: auth refactor, API docs, deploy"` to record sprint plans and reference them later 3. **Building accountability streaks** — Log daily wins with `sleepwell streak "Day 15: shipped feature"` and review your consistency over time 4. **Weekly retrospectives** — Use `sleepwell weekly-review "Good velocity, need to reduce meeting time"` for structured reflection 5. **Searching past decisions** — Run `sleepwell search "deploy"` to find all entries across every category mentioning deployments ## Examples ```bash # Add a new task sleepwell add "Refactor authentication module" # Plan tomorrow's work sleepwell plan "Morning: code review. Afternoon: API integration" # Track progress on current task sleepwell track "Auth module 60% complete, tests passing" # Set a reminder sleepwell remind "Team standup at 10:00 AM" # Prioritize tasks sleepwell prioritize "1. Deploy hotfix 2. Review PR #42 3. Update docs" # Tag an entry for easy retrieval sleepwell tag "urgent: production database migration" # Log a timeline milestone sleepwell timeline "v2.0 beta released to internal testers" # Generate a report sleepwell report "March metrics: 23 features, 8 bugs fixed, 99.5% uptime" # Archive completed items sleepwell archive "Q1 OKR tracking — completed and filed" # Weekly review sleepwell weekly-review "Shipped 3 features, resolved 2 blockers" # View statistics across all categories sleepwell stats # Export all data as CSV sleepwell export csv # Search for deployment-related entries sleepwell search "deploy" # View recent activity sleepwell recent # Health check sleepwell status ``` ## Export Formats The `export` command supports three formats: - **json** — Array of objects with `type`, `time`, and `value` fields - **csv** — Comma-separated with `type,time,value` header - **txt** — Plain text grouped by category Export files are saved to the data directory and the output shows the file path and size in bytes. ## Output All command output goes to stdout in plain text. Use shell redirection for saving: ```bash sleepwell stats > weekly-report.txt sleepwell export json sleepwell recent | head -5 ``` --- Powered by BytesAgain | bytesagain.com | [REDACTED_SECRET]

path: scripts/script.sh
content: #!/usr/bin/env bash
# Sleepwell — productivity tool
# Powered by BytesAgain | bytesagain.com | [REDACTED_SECRET]
set -euo pipefail

DATA_DIR="${HOME}/.local/share/sleepwell"
mkdir -p "$DATA_DIR"

_log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }

_version() { echo "sleepwell v2.0.0"; }

_help() {
    echo "Sleepwell v2.0.0 — productivity toolkit"
    echo ""
    echo "Usage: sleepwell <command> [args]"
    echo ""
    echo "Commands:"
    echo "  add                Add"
    echo "  plan               Plan"
    echo "  track              Track"
    echo "  review             Review"
    echo "  streak             Streak"
    echo "  remind             Remind"
    echo "  prioritize         Prioritize"
    echo "  archive            Archive"
    echo "  tag                Tag"
    echo "  timeline           Timeline"
    echo "  report             Report"
    echo "  weekly-review      Weekly Review"
    echo "  stats              Summary statistics"
    echo "  export <fmt>       Export (json|csv|txt)"
    echo "  status             Health check"
    echo "  help               Show this help"
    echo "  version            Show version"
    echo ""
    echo "Data: $DATA_DIR"
}

_stats() {
    echo "=== Sleepwell Stats ==="
    local total=0
    for f in "$DATA_DIR"/*.log; do
        [ -f "$f" ] || continue
        local name=$(basename "$f" .log)
        local c=$(wc -l < "$f")
        total=$((total + c))
        echo "  $name: $c entries"
    done
    echo "  ---"
    echo "  Total: $total entries"
    echo "  Data size: $(du -sh "$DATA_DIR" 2>/dev/null | cut -f1)"
    echo "  Since: $(head -1 "$DATA_DIR/history.log" 2>/dev/null | cut -d'|' -f1 || echo 'N/A')"
}

_export() {
    local fmt="${1:-json}"
    local out="$DATA_DIR/export.$fmt"
    case "$fmt" in
        json)
            echo "[" > "$out"
            local first=1
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                local name=$(basename "$f" .log)
                while IFS='|' read -r ts val; do
                    [ $first -eq 1 ] && first=0 || echo "," >> "$out"
                    printf '  {"type":"%s","time":"%s","value":"%s"}' "$name" "$ts" "$val" >> "$out"
                done < "$f"
            done
            echo "" >> "$out"
            echo "]" >> "$out"
            ;;
        csv)
            echo "type,time,value" > "$out"
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                local name=$(basename "$f" .log)
                while IFS='|' read -r ts val; do
                    echo "$name,$ts,$val" >> "$out"
                done < "$f"
            done
            ;;
        txt)
            echo "=== Sleepwell Export ===" > "$out"
            for f in "$DATA_DIR"/*.log; do
                [ -f "$f" ] || continue
                echo "--- $(basename "$f" .log) ---" >> "$out"
                cat "$f" >> "$out"
                echo "" >> "$out"
            done
            ;;
        *) echo "Formats: json, csv, txt"; return 1 ;;
    esac
    echo "Exported to $out ($(wc -c < "$out") bytes)"
}

_status() {
    echo "=== Sleepwell Status ==="
    echo "  Version: v2.0.0"
    echo "  Data dir: $DATA_DIR"
    echo "  Entries: $(cat "$DATA_DIR"/*.log 2>/dev/null | wc -l) total"
    echo "  Disk: $(du -sh "$DATA_DIR" 2>/dev/null | cut -f1)"
    local last=$(tail -1 "$DATA_DIR/history.log" 2>/dev/null || echo "never")
    echo "  Last activity: $last"
    echo "  Status: OK"
}

_search() {
    local term="${1:?Usage: sleepwell search <term>}"
    echo "Searching for: $term"
    local found=0
    for f in "$DATA_DIR"/*.log; do
        [ -f "$f" ] || continue
        local matches=$(grep -i "$term" "$f" 2>/dev/null || true)
        if [ -n "$matches" ]; then
            echo "  --- $(basename "$f" .log) ---"
            echo "$matches" | while read -r line; do
                echo "    $line"
                found=$((found + 1))
            done
        fi
    done
    [ $found -eq 0 ] && echo "  No matches found."
}

_recent() {
    echo "=== Recent Activity ==="
    if [ -f "$DATA_DIR/history.log" ]; then
        tail -20 "$DATA_DIR/history.log" | while IFS='' read -r line; do
            echo "  $line"
        done
    else
        echo "  No activity yet."
    fi
}

# Main dispatch
case "${1:-help}" in
    add)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent add entries:"
            tail -20 "$DATA_DIR/add.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell add <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/add.log"
            local total=$(wc -l < "$DATA_DIR/add.log")
            echo "  [Sleepwell] add: $input"
            echo "  Saved. Total add entries: $total"
            _log "add" "$input"
        fi
        ;;
    plan)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent plan entries:"
            tail -20 "$DATA_DIR/plan.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell plan <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/plan.log"
            local total=$(wc -l < "$DATA_DIR/plan.log")
            echo "  [Sleepwell] plan: $input"
            echo "  Saved. Total plan entries: $total"
            _log "plan" "$input"
        fi
        ;;
    track)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent track entries:"
            tail -20 "$DATA_DIR/track.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell track <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/track.log"
            local total=$(wc -l < "$DATA_DIR/track.log")
            echo "  [Sleepwell] track: $input"
            echo "  Saved. Total track entries: $total"
            _log "track" "$input"
        fi
        ;;
    review)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent review entries:"
            tail -20 "$DATA_DIR/review.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell review <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/review.log"
            local total=$(wc -l < "$DATA_DIR/review.log")
            echo "  [Sleepwell] review: $input"
            echo "  Saved. Total review entries: $total"
            _log "review" "$input"
        fi
        ;;
    streak)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent streak entries:"
            tail -20 "$DATA_DIR/streak.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell streak <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/streak.log"
            local total=$(wc -l < "$DATA_DIR/streak.log")
            echo "  [Sleepwell] streak: $input"
            echo "  Saved. Total streak entries: $total"
            _log "streak" "$input"
        fi
        ;;
    remind)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent remind entries:"
            tail -20 "$DATA_DIR/remind.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell remind <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/remind.log"
            local total=$(wc -l < "$DATA_DIR/remind.log")
            echo "  [Sleepwell] remind: $input"
            echo "  Saved. Total remind entries: $total"
            _log "remind" "$input"
        fi
        ;;
    prioritize)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent prioritize entries:"
            tail -20 "$DATA_DIR/prioritize.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell prioritize <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/prioritize.log"
            local total=$(wc -l < "$DATA_DIR/prioritize.log")
            echo "  [Sleepwell] prioritize: $input"
            echo "  Saved. Total prioritize entries: $total"
            _log "prioritize" "$input"
        fi
        ;;
    archive)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent archive entries:"
            tail -20 "$DATA_DIR/archive.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell archive <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/archive.log"
            local total=$(wc -l < "$DATA_DIR/archive.log")
            echo "  [Sleepwell] archive: $input"
            echo "  Saved. Total archive entries: $total"
            _log "archive" "$input"
        fi
        ;;
    tag)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent tag entries:"
            tail -20 "$DATA_DIR/tag.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell tag <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/tag.log"
            local total=$(wc -l < "$DATA_DIR/tag.log")
            echo "  [Sleepwell] tag: $input"
            echo "  Saved. Total tag entries: $total"
            _log "tag" "$input"
        fi
        ;;
    timeline)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent timeline entries:"
            tail -20 "$DATA_DIR/timeline.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell timeline <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/timeline.log"
            local total=$(wc -l < "$DATA_DIR/timeline.log")
            echo "  [Sleepwell] timeline: $input"
            echo "  Saved. Total timeline entries: $total"
            _log "timeline" "$input"
        fi
        ;;
    report)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent report entries:"
            tail -20 "$DATA_DIR/report.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell report <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/report.log"
            local total=$(wc -l < "$DATA_DIR/report.log")
            echo "  [Sleepwell] report: $input"
            echo "  Saved. Total report entries: $total"
            _log "report" "$input"
        fi
        ;;
    weekly-review)
        shift
        if [ $# -eq 0 ]; then
            echo "Recent weekly-review entries:"
            tail -20 "$DATA_DIR/weekly-review.log" 2>/dev/null || echo "  No entries yet. Use: sleepwell weekly-review <input>"
        else
            local input="$*"
            local ts=$(date '+%Y-%m-%d %H:%M')
            echo "$ts|$input" >> "$DATA_DIR/weekly-review.log"
            local total=$(wc -l < "$DATA_DIR/weekly-review.log")
            echo "  [Sleepwell] weekly-review: $input"
            echo "  Saved. Total weekly-review entries: $total"
            _log "weekly-review" "$input"
        fi
        ;;
    stats) _stats ;;
    export) shift; _export "$@" ;;
    search) shift; _search "$@" ;;
    recent) _recent ;;
    status) _status ;;
    help|--help|-h) _help ;;
    version|--version|-v) _version ;;
    *)
        echo "Unknown command: $1"
        echo "Run 'sleepwell help' for available commands."
        exit 1
        ;;
esac

path: scripts/sleep_diary.sh
content: #!/usr/bin/env bash
# Original implementation by BytesAgain (bytesagain.com)
# License: MIT — independent, not derived from any third-party source
# Sleep diary — track sleep quality and patterns
set -euo pipefail
SLEEP_DIR="${SLEEP_DIR:-$HOME/.sleep}"
mkdir -p "$SLEEP_DIR"
DB="$SLEEP_DIR/sleep.json"
[ ! -f "$DB" ] && echo '[]' > "$DB"
CMD="${1:-help}"; shift 2>/dev/null || true
case "$CMD" in
help) echo "Sleep Diary — track sleep quality & patterns
Commands:
  log <hours> [quality]    Log sleep (quality 1-5)
  bedtime <HH:MM>          Log bedtime
  wakeup <HH:MM>           Log wake time
  today                    Last night's sleep
  week                     Weekly sleep summary
  history [n]              Sleep history (default 7)
  stats                    Sleep statistics
  trend                    Sleep trend chart
  tips                     Sleep improvement tips
  score                    Sleep health score
  info                     Version info
Powered by BytesAgain | bytesagain.com";;
log)
    hours="${1:-7}"; quality="${2:-3}"
    python3 << PYEOF
import json, time
with open("$DB") as f: data = json.load(f)
stars = "⭐" * int("$quality")
data.append({"date":time.strftime("%Y-%m-%d"),"hours":float("$hours"),
             "quality":int("$quality"),"bedtime":"","wakeup":"",
             "notes":""})
with open("$DB","w") as f: json.dump(data, f, indent=2)
rating = "Poor" if int("$quality") <= 2 else ("OK" if int("$quality") == 3 else ("Good" if int("$quality") == 4 else "Great"))
print("😴 Sleep logged: {}h {} {}".format("$hours", stars, rating))
PYEOF
;;
bedtime)
    t="${1:-}"; [ -z "$t" ] && { echo "Usage: bedtime <HH:MM>"; exit 1; }
    echo "$(date +%Y-%m-%d)|bedtime|$t" >> "$SLEEP_DIR/times.csv"
    echo "🌙 Bedtime: $t";;
wakeup)
    t="${1:-}"; [ -z "$t" ] && { echo "Usage: wakeup <HH:MM>"; exit 1; }
    echo "$(date +%Y-%m-%d)|wakeup|$t" >> "$SLEEP_DIR/times.csv"
    echo "☀️ Wakeup: $t";;
today)
    python3 << PYEOF
import json, time
with open("$DB") as f: data = json.load(f)
today = time.strftime("%Y-%m-%d")
for d in reversed(data):
    if d["date"] == today or d["date"] == time.strftime("%Y-%m-%d", time.localtime(time.time()-86400)):
        stars = "⭐" * d["quality"]
        print("😴 Last night ({})".format(d["date"]))
        print("   Hours: {}h".format(d["hours"]))
        print("   Quality: {} ({}/5)".format(stars, d["quality"]))
        if d.get("bedtime"): print("   Bedtime: {}".format(d["bedtime"]))
        if d.get("wakeup"): print("   Wakeup: {}".format(d["wakeup"]))
        break
else: print("No sleep data for today")
PYEOF
;;
week)
    python3 << PYEOF
import json, time
with open("$DB") as f: data = json.load(f)
cutoff = time.strftime("%Y-%m-%d", time.localtime(time.time()-7*86400))
week = [d for d in data if d["date"] >= cutoff]
if week:
    avg_hours = sum(d["hours"] for d in week) / len(week)
    avg_quality = sum(d["quality"] for d in week) / len(week)
    print("📊 This Week ({} nights):".format(len(week)))
    for d in week:
        bar = "█" * int(d["hours"]) + "░" * max(0, 8-int(d["hours"]))
        print("  {} [{}] {:.1f}h {}".format(d["date"], bar, d["hours"], "⭐"*d["quality"]))
    print("\n  Avg: {:.1f}h sleep, {:.1f}/5 quality".format(avg_hours, avg_quality))
    if avg_hours < 7: print("  ⚠ Below recommended 7-9 hours")
    else: print("  ✅ Good sleep duration")
else: print("No data this week")
PYEOF
;;
history)
    n="${1:-7}"
    python3 << PYEOF
import json
with open("$DB") as f: data = json.load(f)
print("📋 Sleep History:")
for d in data[-int("$n"):][::-1]:
    print("  {} {:.1f}h quality:{}/5".format(d["date"], d["hours"], d["quality"]))
PYEOF
;;
stats)
    python3 << PYEOF
import json
with open("$DB") as f: data = json.load(f)
if not data: print("No data yet"); exit()
avg_h = sum(d["hours"] for d in data) / len(data)
avg_q = sum(d["quality"] for d in data) / len(data)
best = max(data, key=lambda x: x["hours"])
worst = min(data, key=lambda x: x["hours"])
print("📊 Sleep Stats ({} nights):".format(len(data)))
print("  Avg hours: {:.1f}h".format(avg_h))
print("  Avg quality: {:.1f}/5".format(avg_q))
print("  Best night: {}h ({})".format(best["hours"], best["date"]))
print("  Worst night: {}h ({})".format(worst["hours"], worst["date"]))
good = len([d for d in data if d["hours"] >= 7 and d["quality"] >= 4])
print("  Good nights: {}/{} ({:.0f}%)".format(good, len(data), good*100/len(data)))
PYEOF
;;
trend)
    python3 << PYEOF
import json
with open("$DB") as f: data = json.load(f)
print("📈 Sleep Trend (last 14 nights):")
for d in data[-14:]:
    bar = "█" * int(d["hours"]*2) + "░" * max(0, 18-int(d["hours"]*2))
    ok = "✅" if d["hours"] >= 7 else "⚠"
    print("  {} [{}] {:.1f}h {}".format(d["date"], bar, d["hours"], ok))
PYEOF
;;
tips)
    python3 -c "
import random
tips = [
    '🌙 Keep a consistent bedtime — even on weekends',
    '📱 No screens 1 hour before bed',
    '🌡 Keep bedroom cool (18-20°C / 65-68°F)',
    '☕ No caffeine after 2 PM',
    '🏃 Exercise regularly, but not too close to bedtime',
    '🍷 Limit alcohol — it disrupts sleep quality',
    '📖 Read a book instead of scrolling',
    '🧘 Try deep breathing or meditation before sleep',
    '🌅 Get morning sunlight to set circadian rhythm',
    '🛏 Use bed only for sleep (not work/TV)',
    '🔇 Use white noise or earplugs for noise',
    '🥗 Avoid heavy meals 3 hours before bed',
]
selected = random.sample(tips, min(5, len(tips)))
print('💡 Sleep Tips:')
for t in selected: print('  ' + t)
";;
score)
    python3 << PYEOF
import json
with open("$DB") as f: data = json.load(f)
if len(data) < 3:
    print("Need at least 3 nights of data")
    exit()
recent = data[-7:]
avg_h = sum(d["hours"] for d in recent) / len(recent)
avg_q = sum(d["quality"] for d in recent) / len(recent)
consistency = 1 - (max(d["hours"] for d in recent) - min(d["hours"] for d in recent)) / 10
duration_score = min(avg_h / 8 * 40, 40)
quality_score = avg_q / 5 * 40
consistency_score = consistency * 20
total = int(duration_score + quality_score + consistency_score)
grade = "A" if total >= 80 else ("B" if total >= 60 else ("C" if total >= 40 else "D"))
print("💤 Sleep Health Score: {}/100 ({})".format(total, grade))
print("   Duration: {:.0f}/40 (avg {:.1f}h)".format(duration_score, avg_h))
print("   Quality: {:.0f}/40 (avg {:.1f}/5)".format(quality_score, avg_q))
print("   Consistency: {:.0f}/20".format(consistency_score))
PYEOF
;;
info) echo "Sleep Diary v1.0.0"; echo "Track sleep quality and patterns"; echo "Powered by BytesAgain | bytesagain.com";;
*) echo "Unknown: $CMD"; exit 1;;
esac


path: tips.md
content: # Tips for Sleep Diary

## Getting Started
1. Run `help` to see all available commands
2. Start with the basics — add your first entry
3. Build the habit of logging daily

## Best Practices
- Log consistently for meaningful insights
- Use export to back up your data regularly
- Check stats periodically to see your progress

---
Powered by BytesAgain | bytesagain.com


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)