diff --git a/skills/trertert/habitforge/README.md b/skills/trertert/habitforge/README.md new file mode 100644 index 00000000000..7a38e3449c3 --- /dev/null +++ b/skills/trertert/habitforge/README.md @@ -0,0 +1,56 @@ +# HabitForge - Quick Start Guide + +## Installation + +1. Copy the `habitforge` folder to your Clawdbot workspace skills directory +2. Add the following to your `HEARTBEAT.md`: + +```markdown +## HabitForge Daily Check +- Ask user if they've logged today's habits if not already logged +- Generate weekly report every Sunday automatically +- Log results to memory/habitforge/ +``` + +## Basic Usage + +### Create a new habit +``` +track habit meditation daily +``` + +### Log a habit +``` +I did my meditation +``` + +### Check today's status +``` +habit status +``` + +### Generate weekly report +``` +weekly report +``` + +### List all habits +``` +list habits +``` + +## Data Storage + +All data is stored in `memory/habitforge/habits.json` in your Clawdbot workspace. + +## Features + +- 鉁?Natural language tracking +- 馃敟 Streak tracking +- 馃搳 Weekly progress reports +- 馃挕 Pattern insights +- 馃摑 Export to markdown + +## License + +MIT License - Use freely for personal or commercial purposes. diff --git a/skills/trertert/habitforge/SKILL.md b/skills/trertert/habitforge/SKILL.md new file mode 100644 index 00000000000..a33efddfc6c --- /dev/null +++ b/skills/trertert/habitforge/SKILL.md @@ -0,0 +1,251 @@ +--- +name: habitforge +version: 1.0.0 +description: "Intelligent habit tracking system for Clawdbot. Track daily habits with natural language, get weekly progress reports, streaks, and visual summaries. Build better habits with AI assistance." +tags: [habit-tracking, productivity, self-improvement, statistics, wellness, daily-routine] +author: trertert +homepage: "" +metadata: + author: trertert + version: "1.0.0" + clawdbot: + emoji: 馃敟 + requires: + bins: [] + env: [] + tags: ["habit-tracking", "productivity", "self-improvement", "statistics", "wellness"] +compatibility: "Works with all Clawdbot installations. No external dependencies required." +--- + +# 馃敟 HabitForge 鈥?Intelligent Habit Tracking System + +> *"We are what we repeatedly do. Excellence, then, is not an act, but a habit."* +> 鈥?Will Durant + +Turn your Clawdbot into a personal habit coach. Track daily habits with natural language, maintain streaks, get weekly progress reports, and build lasting positive habits. + +## Why HabitForge? + +Most habit trackers are just apps 鈥?this is an **AI-powered habit coach** that lives with you in your assistant. It: + +- Understands natural language ("I went for a run today" 鈫?auto-tracks exercise) +- Maintains streak history and celebrates progress +- Generates weekly progress summaries with actionable insights +- Reminds you to log habits if you forget +- Helps you identify patterns and improve consistency +- Exports data to markdown for your notes + +--- + +## Key Features + +### 1. Natural Language Tracking + +No buttons to press 鈥?just tell Clawdbot what you did: +``` +User: "I did my meditation this morning" +HabitForge: 鉁?Meditation logged for today! Current streak: 12 days 馃敟 +``` + +Works with any habit you want to track: exercise, reading, meditation, water intake, coding, journaling... + +### 2. Streak System + +Track consecutive days: +- Auto-increments streaks when you log +- Resets on missed days (but gives encouragement!) +- Highlights your longest streaks for motivation + +### 3. Weekly Progress Reports + +Every Sunday (or on demand), get a beautiful summary: + +``` +馃搳 **HabitForge Weekly Report** +鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺? +馃弮 Exercise: 5/7 days 鉁? Current streak: 3 +馃 Meditation: 7/7 days 鉁? Current streak: 21 馃敟 +馃摉 Reading: 4/7 days Current streak: 4 + +馃挭 **Highlights**: You hit a new personal best on meditation! +馃挕 **Insight**: You're more consistent with exercise on weekdays. +馃幆 **Next week**: Focus on improving reading consistency. +``` + +### 4. Habit Management + +- Add new habits with custom goals +- Archive habits you've mastered +- Delete habits you don't track anymore +- Rename or reconfigure anytime + +### 5. Statistics & Patterns + +See your progress over time: +- Monthly completion rates +- Most consistent days of the week +- Habit interaction patterns +- Progress towards long-term goals + +--- + +## Usage + +### Getting Started + +Add this to your `HEARTBEAT.md` for daily checks: +```markdown +## HabitForge Daily Check +- Ask user if they've logged today's habits if not already logged +- Generate weekly report every Sunday automatically +- Log results to memory/habitforge/ +``` + +### Common Commands + +| What you say | What it does | +|---|---| +| `track habit meditation daily` | Creates a new daily habit called "meditation" | +| `I did my meditation` | Logs meditation for today | +| `undo meditation today` | Unlogs meditation for today | +| `habit status` | Shows current streaks and today's completion | +| `weekly report` | Generates weekly progress report | +| `monthly stats` | Shows monthly statistics | +| `list habits` | Lists all active habits | +| `archive meditation` | Archives the meditation habit | +| `delete meditation` | Deletes the meditation habit completely | + +### Example Workflow + +``` +> track habit 30min-walk daily +鉁?New habit created: 30min-walk (daily) + +> I did my 30min walk +鉁?30min-walk logged for today! Current streak: 1 + +> habit status +馃搮 Today: Mar 9, 2026 + +馃弮 30min-walk: 鉁?Done 馃敟 Streak: 1 +馃 meditation: 鉂?Not done yet + +> weekly report +[generates beautiful weekly report...] +``` + +--- + +## Data Storage + +All habit data is stored locally in your Clawdbot workspace at: +``` +memory/habitforge/habits.json +``` + +This keeps your data private and under your control. No cloud sync required unless you want it. + +Example data structure: +```json +{ + "habits": { + "meditation": { + "name": "meditation", + "frequency": "daily", + "created_at": 1709000000000, + "current_streak": 21, + "longest_streak": 21, + "total_completions": 145, + "completion_dates": ["2026-03-01", "2026-03-02", ...], + "active": true + } + }, + "last_updated": 1710000000000 +} +``` + +--- + +## Integration with Clawdbot Features + +### Heartbeat Integration + +Perfect for daily check-ins. Example `HEARTBEAT.md` entry: +```markdown +## HabitForge Check (every 2nd heartbeat) +- Check if any daily habits are still unlogged for today +- Gently remind user to log them +- If Sunday and no report generated today, generate weekly report +``` + +### Cron Integration + +Schedule automatic weekly reports: +```json +{ + "name": "HabitForge Weekly Report", + "schedule": { + "kind": "cron", + "expr": "0 9 * * 0", + "tz": "Asia/Shanghai" + }, + "payload": { + "kind": "systemEvent", + "text": "Generate your weekly HabitForge progress report." + }, + "sessionTarget": "main", + "enabled": true +} +``` + +### Memory Integration + +HabitForge automatically adds key insights to your daily memory files when generating reports. + +--- + +## Best Practices + +1. **Start small** 鈥?2-3 habits max when beginning +2. **Be consistent** 鈥?log at the same time every day (e.g., after breakfast) +3. **Be honest** 鈥?it's okay to miss a day, just get back on track tomorrow +4. **Review weekly** 鈥?the weekly report helps you stay accountable +5. **Celebrate wins** 鈥?HabitForge will celebrate streaks with you! + +--- + +## Tips for Success + +- **Habit stacking**: "I meditate after I brush my teeth in the morning" +- **Implementation intention**: "When situation X occurs, I will do habit Y" +- **Accountability**: Share your weekly reports with a friend if you need extra motivation +- **Flexibility**: Life happens 鈥?if you miss a day, just get back on track the next day + +--- + +## Roadmap (Future Features) + +- [ ] Visual charts and graphs (requires Python matplotlib) +- [ ] Goal setting (e.g., "run 20km this month") +- [ ] Habit correlation analysis (does meditation help you sleep better?) +- [ ] Reminder notifications +- [ ] Export to CSV/JSON for backup + +--- + +## Contributing + +Found a bug or have an idea for improvement? Feel free to submit an issue or PR on GitHub. + +--- + +## License + +MIT License 鈥?feel free to use this skill for personal or commercial purposes. + +--- + +*"The chains of habit are generally too light to be felt until they are too strong to be broken."* +鈥?Samuel Johnson + +馃敟 Happy habit building! diff --git a/skills/trertert/habitforge/_meta.json b/skills/trertert/habitforge/_meta.json new file mode 100644 index 00000000000..8b0a7aaee1e --- /dev/null +++ b/skills/trertert/habitforge/_meta.json @@ -0,0 +1,17 @@ +{ + "owner": "trertert", + "slug": "habitforge", + "displayName": "HabitForge", + "latest": { + "version": "1.0.0", + "publishedAt": 1710000000000, + "commit": "https://github.com/openclaw/skills/commit/new-habitforge-skill" + }, + "history": [ + { + "version": "1.0.0", + "publishedAt": 1710000000000, + "commit": "https://github.com/openclaw/skills/commit/new-habitforge-skill" + } + ] +} diff --git a/skills/trertert/habitforge/scripts/habitforge.py b/skills/trertert/habitforge/scripts/habitforge.py new file mode 100644 index 00000000000..b340b6f02e6 --- /dev/null +++ b/skills/trertert/habitforge/scripts/habitforge.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +""" +HabitForge Core Script +Simple habit tracking system for Clawdbot. +""" + +import json +import os +import sys +import datetime +from pathlib import Path +from typing import Dict, List, Optional, Any + +# Path to habit data +DATA_DIR = Path("memory/habitforge") +HABITS_FILE = DATA_DIR / "habits.json" + +def ensure_data_dir(): + """Ensure data directory exists.""" + DATA_DIR.mkdir(parents=True, exist_ok=True) + if not HABITS_FILE.exists(): + save_habits({"habits": {}, "last_updated": int(datetime.datetime.now().timestamp() * 1000)}) + +def load_habits() -> Dict[str, Any]: + """Load habits from JSON file.""" + try: + with open(HABITS_FILE, 'r', encoding='utf-8') as f: + return json.load(f) + except (FileNotFoundError, json.JSONDecodeError): + return {"habits": {}, "last_updated": int(datetime.datetime.now().timestamp() * 1000)} + +def save_habits(data: Dict[str, Any]): + """Save habits to JSON file.""" + with open(HABITS_FILE, 'w', encoding='utf-8') as f: + json.dump(data, f, indent=2) + +def today_str() -> str: + """Get today's date as YYYY-MM-DD string.""" + return datetime.datetime.now().strftime("%Y-%m-%d") + +def create_habit(name: str, frequency: str = "daily") -> Dict[str, Any]: + """Create a new habit.""" + return { + "name": name, + "frequency": frequency, + "created_at": int(datetime.datetime.now().timestamp() * 1000), + "current_streak": 0, + "longest_streak": 0, + "total_completions": 0, + "completion_dates": [], + "active": True + } + +def log_habit(habit_name: str) -> str: + """Log a habit for today.""" + ensure_data_dir() + data = load_habits() + + today = today_str() + + if habit_name not in data["habits"]: + data["habits"][habit_name] = create_habit(habit_name) + + habit = data["habits"][habit_name] + + # Check if already logged today + if today in habit["completion_dates"]: + return f"Habit '{habit_name}' already logged for today!" + + # Add today's completion + habit["completion_dates"].append(today) + habit["total_completions"] += 1 + + # Update streak + yesterday = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d") + if yesterday in habit["completion_dates"]: + habit["current_streak"] += 1 + else: + habit["current_streak"] = 1 + + # Update longest streak + if habit["current_streak"] > habit["longest_streak"]: + habit["longest_streak"] = habit["current_streak"] + + data["last_updated"] = int(datetime.datetime.now().timestamp() * 1000) + save_habits(data) + + streak_emoji = "馃敟" if habit["current_streak"] >= 7 else "" + return f"鉁?{habit_name} logged for today! Current streak: {habit['current_streak']} days {streak_emoji}" + +def unlog_habit(habit_name: str) -> str: + """Remove today's log for a habit.""" + ensure_data_dir() + data = load_habits() + + today = today_str() + + if habit_name not in data["habits"]: + return f"Habit '{habit_name}' not found!" + + habit = data["habits"][habit_name] + + if today not in habit["completion_dates"]: + return f"Habit '{habit_name}' wasn't logged today!" + + # Remove today's completion + habit["completion_dates"].remove(today) + habit["total_completions"] -= 1 + + # Recalculate streak (simplified - just reset to 0 for now) + habit["current_streak"] = 0 + + data["last_updated"] = int(datetime.datetime.now().timestamp() * 1000) + save_habits(data) + + return f"鉂?{habit_name} unlogged for today." + +def get_status() -> str: + """Get today's habit status.""" + ensure_data_dir() + data = load_habits() + + today = today_str() + output = [f"馃搮 **Today: {datetime.datetime.now().strftime('%b %d, %Y')}**\n"] + + active_habits = [h for h in data["habits"].values() if h.get("active", True)] + + if not active_habits: + output.append("No active habits. Use 'track habit [name]' to start!") + return "\n".join(output) + + for habit in active_habits: + name = habit["name"] + done = today in habit["completion_dates"] + streak = habit["current_streak"] + streak_emoji = "馃敟" if streak >= 7 else "" + + if done: + output.append(f"鉁?{name}: Done {streak_emoji} Streak: {streak}") + else: + output.append(f"鉂?{name}: Not done yet") + + return "\n".join(output) + +def generate_weekly_report() -> str: + """Generate a weekly progress report.""" + ensure_data_dir() + data = load_habits() + + today = datetime.datetime.now() + week_start = today - datetime.timedelta(days=today.weekday()) + week_dates = [(week_start + datetime.timedelta(days=i)).strftime("%Y-%m-%d") for i in range(7)] + + output = ["馃搳 **HabitForge Weekly Report**", "鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺?, ""] + + active_habits = [h for h in data["habits"].values() if h.get("active", True)] + + if not active_habits: + output.append("No active habits to report on. Start tracking some habits!") + return "\n".join(output) + + for habit in active_habits: + name = habit["name"] + completions = [d for d in habit["completion_dates"] if d in week_dates] + completion_rate = len(completions) + streak = habit["current_streak"] + streak_emoji = "馃敟" if streak >= 7 else "" + + output.append(f"**{name}:** {completion_rate}/7 days {'鉁? if completion_rate >= 5 else ''} Current streak: {streak} {streak_emoji}") + + # Add some insights + output.append("") + output.append("馃挭 **Highlights**: " + ("Keep up the great work!" if any(h["current_streak"] >= 7 for h in active_habits) else "You're making progress!")) + output.append("馃挕 **Insight**: Consistency is key - try to log habits at the same time each day.") + output.append("馃幆 **Next week**: Aim for 5+ days on each habit!") + + return "\n".join(output) + +def list_habits() -> str: + """List all habits.""" + ensure_data_dir() + data = load_habits() + + if not data["habits"]: + return "No habits found. Use 'track habit [name]' to start!" + + output = ["馃搵 **Your Habits:**", ""] + + for name, habit in data["habits"].items(): + status = "Active" if habit.get("active", True) else "Archived" + output.append(f"- {name}: {status} (Streak: {habit['current_streak']}, Total: {habit['total_completions']})") + + return "\n".join(output) + +def main(): + """Main CLI entry point.""" + if len(sys.argv) < 2: + print("Usage: python habitforge.py [command] [args...]") + print("\nCommands:") + print(" log [habit] - Log a habit for today") + print(" unlog [habit] - Unlog a habit for today") + print(" status - Show today's habit status") + print(" weekly - Generate weekly report") + print(" list - List all habits") + print(" help - Show this help") + return + + command = sys.argv[1] + + if command == "log" and len(sys.argv) >= 3: + print(log_habit(sys.argv[2])) + elif command == "unlog" and len(sys.argv) >= 3: + print(unlog_habit(sys.argv[2])) + elif command == "status": + print(get_status()) + elif command == "weekly": + print(generate_weekly_report()) + elif command == "list": + print(list_habits()) + elif command == "help": + print("HabitForge - Intelligent Habit Tracking System") + print("\nUsage: python habitforge.py [command] [args...]") + print("\nCommands:") + print(" log [habit] - Log a habit for today") + print(" unlog [habit] - Unlog a habit for today") + print(" status - Show today's habit status") + print(" weekly - Generate weekly report") + print(" list - List all habits") + else: + print(f"Unknown command: {command}") + print("Use 'python habitforge.py help' for usage.") + +if __name__ == "__main__": + main()