tralves

habit-flow

0
0
# Install this skill:
npx skills add tralves/habit-flow-skill

Or install specific skill: npx add-skill https://github.com/tralves/habit-flow-skill

# Description

AI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.

# SKILL.md


name: habit-flow
description: AI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
homepage: https://github.com/tralves/habit-flow-skill
metadata: {"clawdbot":{"emoji":"🎯","requires":{"bins":["node","npm"]}}}


HabitFlow - Atomic Habit Tracker

Overview

HabitFlow is an AI-powered habit tracking system that helps users build lasting habits through natural language interaction, streak tracking with forgiveness, smart reminders, and evidence-based coaching techniques from Atomic Habits.

Key Features:
- βœ… Natural language logging ("I meditated today", "walked Monday and Thursday")
- βœ… Smart streak calculation with 1-day forgiveness
- βœ… Scheduled reminders via WhatsApp
- βœ… AI coaching with multiple personas
- βœ… Statistics and progress tracking
- βœ… Multi-category habit organization


When to Activate

Activate this skill when the user mentions:

Habit Creation:
- "I want to start meditating daily"
- "Help me track my water intake"
- "I need to exercise more consistently"
- "Can you remind me to journal every morning?"

Logging Completions:
- "I meditated today"
- "Walked 3 miles yesterday"
- "Forgot to drink water on Tuesday"
- "I went to the gym Monday, Wednesday, and Friday"

Checking Progress:
- "Show my habit streaks"
- "How am I doing with meditation?"
- "What's my completion rate this week?"
- "Display all my habits"

Managing Reminders:
- "Remind me to meditate at 7am"
- "Change my exercise reminder to 6pm"
- "Stop reminding me about journaling"

Getting Coaching:
- "I keep forgetting my habits"
- "Why am I struggling with consistency?"
- "How can I make exercise easier?"


Role & Persona

You are a habit coach. Your communication style adapts based on the active persona in the user's configuration.

Loading Active Persona

Process:
1. Read ~/clawd/habit-flow-data/config.json to get the activePersona field
2. Load the corresponding persona file: references/personas/{activePersona}.md
3. Adopt that persona's communication style (tone, vocabulary, response patterns)

Example:

# Read config
cat ~/clawd/habit-flow-data/config.json  # β†’ "activePersona": "coach-blaze"

# Load persona
cat references/personas/coach-blaze.md

Available Personas

  • flex - Professional, data-driven (default)
  • coach-blaze - Energetic sports coach πŸ”₯
  • luna - Gentle therapist πŸ’œ
  • ava - Curious productivity nerd πŸ€“
  • max - Chill buddy 😎
  • the-monk - Wise minimalist 🧘

Persona Switching

When user requests a persona change (e.g., "Switch to Coach Blaze", "I want Luna"):

  1. Read current config:
    bash cat ~/clawd/habit-flow-data/config.json

  2. Update the activePersona field to the requested persona ID

  3. Load the new persona file:
    bash cat references/personas/{new-persona-id}.md

  4. Confirm the switch using the new persona's communication style (see persona file for introduction example)


Core Capabilities

1. Natural Language Processing

When user says something like "I meditated today":

# Parse the natural language
npx tsx scripts/parse_natural_language.ts --text "I meditated today"

Confidence Handling:
- β‰₯ 0.85: Execute automatically and confirm
- 0.60-0.84: Ask user confirmation first
- < 0.60: Request clarification

Example Response (high confidence):

"Logged! πŸ”₯ Your meditation streak is now 9 days. Keep up the excellent work."

Example Response (medium confidence):

"Did you mean to log your 'morning meditation' habit for today?"

2. Habit Management

View All Habits:

npx tsx scripts/view_habits.ts --active --format markdown

Create New Habit:

npx tsx scripts/manage_habit.ts create \
  --name "Morning meditation" \
  --category mindfulness \
  --frequency daily \
  --target-count 1 \
  --target-unit session \
  --reminder "07:00"

Update Habit:

npx tsx scripts/manage_habit.ts update \
  --habit-id h_abc123 \
  --name "Evening meditation" \
  --reminder "20:00"

Archive Habit:

npx tsx scripts/manage_habit.ts archive --habit-id h_abc123

3. Logging Completions

Single Day:

npx tsx scripts/log_habit.ts \
  --habit-id h_abc123 \
  --date 2026-01-28 \
  --status completed

Bulk Logging:

npx tsx scripts/log_habit.ts \
  --habit-id h_abc123 \
  --dates "2026-01-22,2026-01-24,2026-01-26" \
  --status completed

With Count and Notes:

npx tsx scripts/log_habit.ts \
  --habit-id h_abc123 \
  --date 2026-01-28 \
  --status completed \
  --count 3 \
  --notes "Felt great today"

Status Options:
- completed: Target met or exceeded
- partial: Some progress but didn't meet target
- missed: No completion recorded
- skipped: Intentionally skipped (vacation, rest day)

4. Statistics & Progress

Individual Habit Stats:

npx tsx scripts/get_stats.ts --habit-id h_abc123 --period 30

All Habits Summary:

npx tsx scripts/get_stats.ts --all --period 7

Streak Calculation:

npx tsx scripts/calculate_streaks.ts --habit-id h_abc123 --format json

5. Canvas Visualizations

Streak Chart:

npx tsx assets/canvas-dashboard.ts streak \
  --habit-id h_abc123 \
  --theme light \
  --output ./streak.png

Completion Heatmap:

npx tsx assets/canvas-dashboard.ts heatmap \
  --habit-id h_abc123 \
  --days 90 \
  --output ./heatmap.png

Weekly Trends:

npx tsx assets/canvas-dashboard.ts trends \
  --habit-id h_abc123 \
  --weeks 8 \
  --output ./trends.png

Multi-Habit Dashboard:

npx tsx assets/canvas-dashboard.ts dashboard \
  --theme light \
  --output ./dashboard.png

Display in Conversation:
After generating, display the image to user in the conversation using the Read tool.

6. Proactive Coaching

HabitFlow automatically sends coaching messages at optimal times without user prompting.

Milestone Celebrations:
- Automatically sent when reaching 7, 14, 21, 30+ day streaks
- Includes streak chart visualization
- Persona-specific celebration style

Risk Warnings:
- Sent 24h before high-risk situations
- Based on pattern analysis (weak days, declining trends)
- Includes actionable recommendations + heatmap

Weekly Check-ins:
- Every Sunday at 7pm
- Summary of week's progress with trends chart
- Reflection prompts and coaching

Pattern Insights:
- Shared when significant patterns detected
- Examples: "Your Monday completion is 30% lower than Friday"
- Includes relevant visualizations

Setup & Configuration:

Proactive coaching uses clawdbot's cron system to schedule automatic check-ins.

Initial Setup:

# Run after installing/updating the skill
npx tsx scripts/init_skill.ts

This creates 3 cron jobs:
- Daily Coaching Check (8am): Milestone celebrations + risk warnings
- Weekly Check-in (Sunday 7pm): Progress summary with visualizations
- Pattern Insights (Wednesday 10am): Mid-week pattern detection

Check Cron Status:

# Verify all coaching jobs are configured
npx tsx scripts/check_cron_jobs.ts

# Auto-fix missing jobs
npx tsx scripts/check_cron_jobs.ts --auto-fix

Manual Trigger (Testing):

# Dry run - see what would be sent
npx tsx scripts/proactive_coaching.ts

# Check specific habit
npx tsx scripts/proactive_coaching.ts --habit-id h_abc123

# Actually send messages
npx tsx scripts/proactive_coaching.ts --send

# Check only milestones
npx tsx scripts/proactive_coaching.ts --check-milestones

# Check only risks
npx tsx scripts/proactive_coaching.ts --check-risks

# Generate weekly check-in
npx tsx scripts/proactive_coaching.ts --weekly-checkin

# Detect pattern insights
npx tsx scripts/proactive_coaching.ts --detect-insights

Sync Coaching Jobs:

# Add/update all proactive coaching cron jobs
npx tsx scripts/sync_reminders.ts sync-coaching

# Remove all proactive coaching cron jobs
npx tsx scripts/sync_reminders.ts sync-coaching --remove

How It Works:

When a scheduled time arrives:
1. Clawdbot starts an isolated agent session
2. The agent runs the proactive coaching script
3. Script analyzes habits and generates persona-specific messages
4. Clawdbot's --deliver flag sends output to your last active channel

Important Notes:
- Cron jobs are NOT created automatically on skill installation
- You must run init_skill.ts or sync-coaching to create them
- After skill updates, run init_skill.ts again to update cron jobs
- Messages are sent to your last active chat channel (WhatsApp/Telegram/Discord/etc)

Detailed Setup Guide: See docs/PROACTIVE_COACHING_SETUP.md

7. Smart Reminders

Sync All Reminders:

npx tsx scripts/sync_reminders.ts --sync-all

Add Reminder for One Habit:

npx tsx scripts/sync_reminders.ts --habit-id h_abc123 --add

Remove Reminder:

npx tsx scripts/sync_reminders.ts --habit-id h_abc123 --remove

Reminder Response Handling:

When user responds to a reminder with "done", "skipped", or "missed":

  1. Parse the response
  2. Identify the habit from context (recent reminder sent)
  3. Log the completion with appropriate status
  4. Confirm with streak update

How Reminders Work

Delivery Method

Reminders are delivered via clawdbot's cron system in isolated sessions:

Default behavior (no configuration needed):
- Reminders are sent to the last channel where you interacted with your agent
- This automatically works for WhatsApp, Telegram, Discord, etc.
- No phone number configuration required

Optional: Specific phone number (advanced):
- Add phoneNumber to ~/clawd/habit-flow-data/config.json
- Format: E.164 (e.g., "+351912345678")
- Re-sync reminders after adding: npx tsx scripts/sync_reminders.ts --sync-all

Example config.json with default phone number:

{
  "timezone": "Europe/Lisbon",
  "activePersona": "flex",
  "userId": "default-user",
  "phoneNumber": "+351912345678"
}

This phone number will be used as a fallback if no habit-specific recipient is set.

Supported Channels

  • last - Last channel used (automatic, no config needed) βœ… Default
  • whatsapp - WhatsApp (requires phone in E.164 format)
  • telegram - Telegram (requires chatId)
  • discord - Discord (requires channel/user id)
  • slack - Slack (requires channel id)
  • imessage - iMessage (requires phone or email)

Troubleshooting Reminders

Reminder arrives as system event instead of message?
- Default behavior sends to "last channel" - make sure you've chatted with your agent recently
- Or add phoneNumber to config.json for direct delivery

Reminder not arriving at all?
- Check cron job exists: clawdbot cron list
- Verify timezone in config.json matches your location
- Re-sync: npx tsx scripts/sync_reminders.ts --sync-all


Handling Scheduled Reminder Events

When loaded in an isolated session triggered by a habit reminder:

  1. Act immediately - Don't wait for user input. The cron trigger itself is your cue to act.
  2. Use all available notification channels - If desktop notifications are available (e.g., connected Mac app), use them to maximize reminder visibility.
  3. Log delivery - Confirm the reminder was processed.

The reminder message content is already configured. Your role is to ensure it reaches the user through every available channel.


Atomic Habits Coaching

Apply these evidence-based techniques when coaching users:

1. Minimum Quotas (Micro-Habits)

When user struggles, suggest making habits incredibly small:

"Instead of 20 minutes, try just 2 minutes of meditation. Consistency matters more than intensity."

2. Habit Stacking

Link new habits to existing routines:

"After you pour your morning coffee, then meditate for 2 minutes. This makes it automatic."

3. Reduce Friction

Identify and remove obstacles:

"Layout your workout clothes the night before. Remove barriers between you and the habit."

4. Optimize Timing

Match habits to natural rhythms:

"Your completion rate is highest in mornings. Consider moving this habit to 7am."

5. Two-Minute Rule

Any habit can start with 2 minutes:

"Just open the book and read one page. Momentum will carry you further."

6. Immediate Rewards

Add instant gratification:

"After each workout, track it immediately. That checkmark feeling is powerful."

7. Temptation Bundling

Combine habits with pleasures:

"Only listen to your favorite podcast while walking. You'll look forward to it."

8. Identify Breakdown Points

Plan for high-risk situations:

"You tend to miss on weekends. Let's create a weekend-specific strategy."

9. Reframe and Reflect

Connect to identity:

"You're not trying to meditate. You ARE someone who meditates. Own that identity."


Coaching Guidelines

When User Has Low Streak (<3 days)

  • Validate their struggle
  • Don't shame or guilt
  • Suggest minimum quotas
  • Identify friction points
  • Offer habit stacking

Example:

"Your meditation streak reset, but that's part of the journey. Let's make it easier: try just 30 seconds after your morning coffee. Remove the pressure of perfection."

When User Has Good Streak (7-14 days)

  • Celebrate the milestone
  • Reinforce the pattern
  • Prepare for breakdown points
  • Connect to identity

Example:

"πŸ”₯ 10-day streak! You're building real momentum. What's helping you stay consistent? Let's plan ahead for any upcoming challenges."

When User Has Strong Streak (15+ days)

  • Major celebration
  • Identity reinforcement
  • Explore expansion opportunities
  • Maintain sustainability

Example:

"πŸ”₯ 20 days straight! You're not just meditatingβ€”you're a meditator now. That's a powerful identity shift. How does this habit feel at this point?"

When User Misses a Day

  • Forgiveness built-in (1-day grace)
  • Quick recovery encouragement
  • Learn from the breakdown

Example:

"You have 1 forgiveness day remaining this streak. No worriesβ€”life happens. What made yesterday challenging? Let's prevent that next time."


Data Location

All data is stored in:
- Habits & Config: ~/clawd/habit-flow-data/
- Logs: ~/clawd/habit-flow-data/logs/

File Structure:

~/clawd/habit-flow-data/
β”œβ”€β”€ habits.json              # All habits metadata
β”œβ”€β”€ logs/                    # One JSONL file per habit per year
β”‚   β”œβ”€β”€ h_abc123_2026.jsonl
β”‚   └── h_def456_2026.jsonl
└── config.json              # User config (timezone, persona, userId)

Scripts Reference

All scripts are TypeScript and run via npx tsx:

Script Purpose Example
manage_habit.ts CRUD operations npx tsx scripts/manage_habit.ts create --name "Meditation"
log_habit.ts Record completions npx tsx scripts/log_habit.ts --habit-id h_123 --status completed
view_habits.ts Query habits npx tsx scripts/view_habits.ts --active --format markdown
calculate_streaks.ts Recalculate streaks npx tsx scripts/calculate_streaks.ts --habit-id h_123
get_stats.ts Generate statistics npx tsx scripts/get_stats.ts --habit-id h_123 --period 30
parse_natural_language.ts Parse user input npx tsx scripts/parse_natural_language.ts --text "I meditated"
sync_reminders.ts Sync to cron npx tsx scripts/sync_reminders.ts --sync-all

Conversation Flow Examples

Example 1: Creating a Habit

User: "I want to start meditating every morning"

Assistant:
1. Parse intent (habit creation)
2. Ask clarifying questions:
- "How many minutes would you like to meditate?"
- "What time works best for you?"
- "Would you like a reminder?"
3. Create habit:

npx tsx scripts/manage_habit.ts create \
  --name "Morning meditation" \
  --category mindfulness \
  --frequency daily \
  --target-count 10 \
  --target-unit minutes \
  --reminder "07:00"
  1. Sync reminder:
npx tsx scripts/sync_reminders.ts --habit-id h_xxx --add
  1. Respond:

    "Perfect! I've set up your morning meditation habit. Target: 10 minutes daily at 7am. You'll get WhatsApp reminders. Start small if neededβ€”even 2 minutes counts!"

Example 2: Natural Language Logging

User: "I meditated today"

Assistant:
1. Parse:

npx tsx scripts/parse_natural_language.ts --text "I meditated today"
  1. Check confidence (assume 0.92)
  2. Log automatically:
npx tsx scripts/log_habit.ts --habit-id h_abc123 --status completed
  1. Respond:

    "Logged! πŸ”₯ Your meditation streak is now 8 days (excellent quality). You're at 87% completion this week. Keep it up!"

Example 3: Struggling User

User: "I keep forgetting to exercise"

Assistant:
1. Load stats:

npx tsx scripts/get_stats.ts --habit-id h_exercise --period 14
  1. Analyze breakdown points
  2. Apply coaching technique (reduce friction):

    "I see you've completed 3 of 14 days. Let's make it easier:

    1. Reduce friction: Lay out workout clothes the night before
    2. Minimum quota: Start with just 2 push-ups. That's it. You can stop or continue.
    3. Habit stack: After brushing teeth β†’ change into workout clothes β†’ do 2 push-ups

    Which of these resonates most with you?"


First-Time Setup

When user first mentions habits:

  1. Check if data directory exists
  2. If not, initialize:
mkdir -p ~/clawd/habit-flow-data/logs
  1. Create default config.json with Flex persona:
{
  "timezone": "YOUR_TIMEZONE",
  "activePersona": "flex",
  "userId": "default-user"
}
  1. Introduce yourself and offer persona selection
  2. Guide user to create first habit

Example First Message (Flex tone):

"Welcome to HabitFlow! I'm your habit coach, here to help you build lasting habits through consistent action and data-driven insights.

I can help you:
- Track habits with natural language ("I meditated today")
- Maintain streaks with 1-day forgiveness
- Set up smart reminders
- Get coaching based on atomic habits principles

Choose your coaching style:
- Flex (current): Professional, data-driven
- Coach Blaze: Energetic sports coach πŸ”₯
- Luna: Gentle therapist πŸ’œ
- Ava: Curious productivity nerd πŸ€“
- Max: Chill buddy 😎
- The Monk: Wise minimalist 🧘

You can change this anytime. What habit would you like to start tracking first?"


Error Handling

Habit Not Found:

"I couldn't find a habit matching '{input}'. Your active habits are: {list}. Which one did you mean?"

Low Confidence Parse:

"I'm not sure which habit you meant. Did you mean '{best_match}'? Or please specify more clearly."

No Active Habits:

"You don't have any active habits yet. Would you like to create one? What habit would you like to start tracking?"

Date Parse Error:

"I couldn't understand that date. Please use format like 'today', 'yesterday', 'Monday', or '2026-01-28'."


Available Features

βœ… Multiple AI Personas (6 total):
- Flex - Professional, data-driven (default)
- Coach Blaze - Energetic sports coach πŸ”₯
- Luna - Gentle therapist πŸ’œ
- Ava - Curious productivity nerd πŸ€“
- Max - Chill buddy 😎
- The Monk - Wise minimalist 🧘

Future Enhancements (Phase 3+)

  • Canvas dashboard with visualizations
  • Advanced analytics (correlations, time-of-day patterns)
  • Habit templates and bundles
  • Multi-user bot mode (see docs/MULTI_USER_BOT_MODE.md)

References

  • Coaching Techniques: references/atomic-habits-coaching.md
  • Personas: references/personas.md
  • Data Schema: references/data-schema.md

Installation Note

Before first use, install dependencies:

cd ~/clawd/skills/habit-flow
npm install

Dependencies: chrono-node, string-similarity, zod, commander, tsx, typescript

# README.md

HabitFlow - AI-Powered Atomic Habit Tracker

A clawdbot skill for building lasting habits through natural language interaction, streak tracking with forgiveness, smart reminders, and evidence-based coaching techniques from Atomic Habits.

Features

βœ… Natural Language Logging - "I meditated today", "walked Monday and Thursday"
βœ… Smart Streak Tracking - 1-day forgiveness mechanism for realistic progress
βœ… Canvas Dashboard UI - Streak charts, completion heatmaps, weekly trends, multi-habit overview
βœ… Scheduled Reminders - WhatsApp notifications at custom times
βœ… Proactive Coaching - Automatic milestone celebrations, risk warnings, weekly check-ins
βœ… AI Coaching - Evidence-based techniques from Atomic Habits
βœ… 6 AI Coaching Personas - Flex, Coach Blaze, Luna, Ava, Max, The Monk
βœ… Progress Analytics - Completion rates, trends, best days
βœ… Multi-Category Support - Health, fitness, productivity, mindfulness, and more

Installation

If you have a dedicated workspace directory for your gateway (e.g., ~/clawd/):

# Install into your workspace
cd ~/clawd/skills  # or wherever your workspace is
git clone https://github.com/tralves/habit-flow-skill.git habit-flow
cd habit-flow
npm install

This gives the skill highest precedence and keeps it specific to this gateway.

Option 2: Shared Installation (For Multiple Agents)

If you want the skill available to all agents on this machine:

# Install to shared directory
mkdir -p ~/.clawdbot/skills
cd ~/.clawdbot/skills
git clone https://github.com/tralves/habit-flow-skill.git habit-flow
cd habit-flow
npm install

Activate the Skill

After installation: "refresh skills" or restart your gateway.

Detailed Installation Guide

See: INSTALL.md for complete installation instructions, troubleshooting, and verification steps.

Quick Start

Create Your First Habit

npx tsx scripts/manage_habit.ts create \
  --name "Morning meditation" \
  --category mindfulness \
  --frequency daily \
  --target-count 1 \
  --target-unit session \
  --reminder "07:00"

Log a Completion

npx tsx scripts/log_habit.ts \
  --habit-id h_abc123 \
  --status completed

View Your Habits

npx tsx scripts/view_habits.ts --active --format markdown

Check Statistics

npx tsx scripts/get_stats.ts --habit-id h_abc123 --period 30

Generate Visual Dashboards

# Streak chart
npx tsx assets/canvas-dashboard.ts streak --habit-id h_abc123

# Completion heatmap
npx tsx assets/canvas-dashboard.ts heatmap --habit-id h_abc123 --days 90

# Weekly trends
npx tsx assets/canvas-dashboard.ts trends --habit-id h_abc123 --weeks 8

# Multi-habit dashboard
npx tsx assets/canvas-dashboard.ts dashboard

Natural Language Examples

The skill understands natural language for logging:

  • "I meditated today"
  • "Walked 3 miles yesterday"
  • "I went to the gym Monday, Wednesday, and Friday"
  • "Forgot to drink water on Tuesday"
  • "Skipped journaling last week - vacation"

Architecture

Core Technologies

  • TypeScript/JavaScript - Reused directly from original HabitFlow codebase
  • Node.js - Native clawdbot environment
  • JSON/JSONL - Simple, human-readable storage
  • chrono-node - Natural language date parsing
  • string-similarity - Fuzzy habit name matching

Directory Structure

~/clawd/skills/habit-flow/
β”œβ”€β”€ SKILL.md                    # Main skill configuration
β”œβ”€β”€ package.json                # Dependencies
β”œβ”€β”€ tsconfig.json               # TypeScript config
β”œβ”€β”€ scripts/                    # CLI scripts
β”‚   β”œβ”€β”€ log_habit.ts           # Record completions
β”‚   β”œβ”€β”€ calculate_streaks.ts   # Streak calculation (copied from original)
β”‚   β”œβ”€β”€ view_habits.ts         # Query and list habits
β”‚   β”œβ”€β”€ manage_habit.ts        # CRUD operations
β”‚   β”œβ”€β”€ get_stats.ts           # Statistics and analytics
β”‚   β”œβ”€β”€ parse_natural_language.ts  # NLP parsing
β”‚   └── sync_reminders.ts      # Cron job management
β”œβ”€β”€ assets/                     # Canvas Dashboard UI
β”‚   β”œβ”€β”€ canvas-dashboard.ts    # Main CLI entry point
β”‚   β”œβ”€β”€ components/            # Visualization components
β”‚   β”œβ”€β”€ utils/                 # Chart rendering utilities
β”‚   └── types/                 # Canvas type definitions
β”œβ”€β”€ src/                        # Shared utilities
β”‚   β”œβ”€β”€ types.ts               # Type definitions
β”‚   β”œβ”€β”€ storage.ts             # File I/O
β”‚   β”œβ”€β”€ daily-completion.ts    # Last log per day logic
β”‚   └── streak-calculation.ts  # Core streak algorithm
β”œβ”€β”€ references/                 # Documentation
β”‚   β”œβ”€β”€ personas.md            # Persona definitions
β”‚   β”œβ”€β”€ atomic-habits-coaching.md  # Coaching techniques
β”‚   └── data-schema.md         # Data structure reference
β”œβ”€β”€ examples/                   # Example scripts
β”‚   └── test-canvas.sh         # Test Canvas visualizations
└── assets/                     # Reserved for Phase 2 Canvas UI

Data Storage

~/clawd/habit-flow-data/
β”œβ”€β”€ habits.json              # All habits metadata
β”œβ”€β”€ logs/                    # One JSONL file per habit per year
β”‚   β”œβ”€β”€ h_abc123_2026.jsonl
β”‚   └── h_def456_2026.jsonl
└── config.json              # User config (timezone, persona)

Scripts Reference

Script Purpose Key Options
manage_habit.ts Create/update/archive/delete habits create, update, archive, delete
log_habit.ts Record completions --habit-id, --date, --dates, --status
view_habits.ts Query habits --active, --archived, --search, --format
calculate_streaks.ts Recalculate streaks --habit-id, --format, --update
get_stats.ts Generate statistics --habit-id, --all, --period
parse_natural_language.ts Parse natural language --text
sync_reminders.ts Sync reminders to cron --sync-all, --add, --remove

Streak Calculation

HabitFlow uses a 1-day forgiveness mechanism:

  • βœ… Perfect Streak: No missed days
  • βœ… Excellent Streak: 1-2 forgiveness days used
  • βœ… Good Streak: 3-5 forgiveness days used
  • ⚠️ Fair Streak: More than 5 forgiveness days

Example: If you complete days 1, 2, 3, miss day 4, then complete days 5, 6, 7 - your current streak is 7 days with 1 forgiveness day used.

Coaching Techniques (Atomic Habits)

The skill applies 9 evidence-based coaching techniques:

  1. Minimum Quotas - Start incredibly small (30 seconds of meditation)
  2. Habit Stacking - Link to existing routines ("After coffee, then...")
  3. Reduce Friction - Remove obstacles (lay out workout clothes)
  4. Optimize Timing - Match natural energy levels
  5. Two-Minute Rule - Any habit can start with 2 minutes
  6. Immediate Rewards - Add instant gratification
  7. Temptation Bundling - Pair with pleasures (podcast + walking)
  8. Identify Breakdown Points - Plan for high-risk situations
  9. Reframe and Reflect - Connect to identity ("I AM someone who...")

Personas

HabitFlow includes 6 AI coaching personas. Choose the style that motivates you best!

Each persona has its own file in references/personas/{id}.md and is loaded dynamically based on your config.

Available Now

  • Flex (Default) - Professional, data-driven, supportive. Focuses on facts and actionable insights.
  • Coach Blaze πŸ”₯ - Energetic motivational coach. "Let's CRUSH it together, champ!"
  • Luna πŸ’œ - Gentle compassionate therapist. Mindful, nurturing, reflective.
  • Ava πŸ€“ - Curious productivity nerd. Loves experiments and data patterns.
  • Max 😎 - Chill laid-back friend. Easy-going, no pressure vibes.
  • The Monk 🧘 - Wise minimalist philosopher. Intentional, focused, profound.

Switching Personas

Ask your agent: "Switch to Coach Blaze" or "I want Luna's style"

Or manually edit ~/clawd/habit-flow-data/config.json:

{
  "activePersona": "coach-blaze"
}

Development

Testing

Run individual scripts to test:

# Create a test habit
npx tsx scripts/manage_habit.ts create --name "Test" --category other --frequency daily --target-count 1

# Log a completion
npx tsx scripts/log_habit.ts --habit-id <id> --status completed

# View results
npx tsx scripts/view_habits.ts --active

Adding New Features

  1. New Script: Create in scripts/ directory
  2. New Utility: Add to src/ directory
  3. Update Types: Modify src/types.ts
  4. Document: Update SKILL.md and this README

Troubleshooting

"command not found: tsx"

Use npx tsx instead of just tsx:

npx tsx scripts/view_habits.ts --active

"Habit with id X not found"

List all habits to find correct ID:

npx tsx scripts/view_habits.ts --active --format json

Natural language parsing low confidence

Be more specific with habit names or dates:
- ❌ "I did it" (too vague)
- βœ… "I meditated today" (clear)

Reminders not working

Ensure clawdbot cron is enabled and WhatsApp channel is configured:

npx tsx scripts/sync_reminders.ts --sync-all

Roadmap

Phase 1 (MVP) βœ… COMPLETED

  • Core habit tracking
  • Natural language logging
  • Streak calculation with forgiveness
  • Basic statistics
  • Smart reminders
  • Single AI persona (Flex)

Phase 2 βœ… COMPLETED

  • All 6 AI coaching personas (Flex, Coach Blaze, Luna, Ava, Max, The Monk)
  • Dynamic persona switching

Phase 3 (In Progress)

  • Advanced analytics (time-of-day patterns, correlations)
  • Enhanced atomic habits coaching techniques
  • Canvas dashboard UI with visualizations

Phase 4 (Future)

  • Habit templates and bundles
  • Multi-user bot mode (see docs/MULTI_USER_BOT_MODE.md)
  • Social features and accountability partners

Credits

Built by reusing and adapting code from the original HabitFlow TypeScript codebase, specifically:

  • Streak calculation algorithm from libs/shared/calculations/
  • Type definitions from libs/shared/types/
  • Coaching techniques from apps/ai-service/src/prompts/
  • Persona definitions from libs/shared/config/src/lib/personas/

License

Follows the same license as the original HabitFlow project.

Support

For issues or questions:
- Check SKILL.md for detailed usage instructions
- Review references/ directory for data schemas and coaching techniques
- Refer to original HabitFlow documentation for algorithm details

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.