agentleFS
autonomous-aiautonomous-ai/autonomous-os/skills/habit/SKILL.md

habit

Skill494 starsChanged 7 months agoApache-2.0View on GitHub

Tracks and analyzes behavioral patterns (habits) for known users based on their wellbeing, presence, posture, and activity history. Use when answering questions about a user's routines ("What are Leo's habits?", "Has Leo been keeping to his routine?", "Notice anything about my patterns?"), or when invoked from wellbeing/SKILL.md or posture/SKILL.md on a threshold nudge to refresh patterns and provide habit-aware phrasing. Also feeds music-suggestion/SKILL.md with `music_patterns` for personalized genre. Habit does NOT fire its own standalone nudge — it enriches wellbeing/posture threshold-nudge phrasing.

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the invoking skill's short reply.

    line 16
  2. Very specific:

    All data lives in /root/local/users/{name}/:

    line 21
  3. Distinctive:

    Only log when user states intent NOW, not past tense or general talk.

    line 91
  4. Distinctive:

    Use direct file reads for multi-day pattern building (faster, no API pagination needed).

    line 107
  5. Very specific:

    From music-suggestion/SKILL.md: Read habit/patterns.json → music_patterns.

    line 120
  6. Distinctive:

    If data is insufficient: use default wellbeing thresholds / music genre table as fallback.

    line 130
  7. Very specific:

    When no data: silent (NO_REPLY) — never guess or fabricate habits

    line 139

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Habit Skill

Habits are repeating behavioral patterns derived from historical logs. This skill reads existing data (wellbeing, presence, mood, music, posture) to build patterns per user, then stores them for other skills to consume.

OUTPUT RULE: Reply is spoken VERBATIM. ONE short caring sentence. All computation, pattern math, and log lookups stay in thinking. NEVER output timestamps, deltas, frequency counts, or reasoning in the reply. (Exception: Flow E — open habit questions — see below.)

For a supporting habit lookup or refresh, return to the invoking skill without an additional spoken report. Keep pattern analysis in the provider's native thinking channel (or omit it if unavailable); do not narrate file reads or summarize the analysis in ordinary text. Preserve required refreshes and writes. Use the invoking skill's short reply; Flow E still allows enough detail to answer an explicit habit question.

Data Sources (Input)

All data lives in /root/local/users/{name}/:

FolderFile patternWhat it contains
wellbeing/YYYY-MM-DD.jsonldrink, break, celebrate, sedentary labels, enter/leave, nudge_* events with timestamps
mood/YYYY-MM-DD.jsonlsignal + decision rows with moods
music-suggestions/YYYY-MM-DD.jsonlsuggestion history + accepted/rejected status
posture/YYYY-MM-DD.jsonlposture_alert (ergo-risk events from camera) + nudge_posture / praise_posture rows

User names are lowercase folder names under /root/local/users/. Known users: leo, chloe, gray, lily. Strangers collapse to unknown — this is treated as a regular user with its own folder and its own habit patterns (aggregated across all strangers).

JSONL line example (wellbeing):

{"ts": 1776657145.05, "seq": 4, "hour": 10, "action": "drink", "notes": ""}

Storage (Output)

Computed patterns are stored per user at /root/local/users/{name}/habit/patterns.json.

Rebuild when:

  • File does not exist yet
  • File is older than 6 hours
  • User explicitly asks about their habits

What is a Habit?

A habit is a time-anchored action that repeats across multiple days. Strength labels:

FrequencyStrength
< 0.50weak (skip for nudging)
0.50 – 0.75moderate
> 0.75strong

Habits require at least 3 days of data to form. With fewer days, skip proactive nudging.

Workflow

FlowWhen to runDetails
A — Build patternsDiscovery / answering questions; wellbeing nudgereference/build-patterns.md
B — Habit matchHelper for wellbeing/SKILL.md Step 3breference/match-helper.md
C — Music personalizationBuild / consume music_patternsreference/music.md
D — Conversation intent loggingTriggered from SOUL when user states intent NOWinline below
E — Open habit questionUser asks about someone's habits / patterns / routinesreference/open-question.md

D — Conversation intent logging (triggered from SOUL)

SOUL instructs the device to call this flow when user expresses intent for a daily activity NOW.

Intent → action mapping:

User saysAction to log
"lunch", "dinner", "going to eat", "grab food"meal
"coffee break", "grab a coffee", "getting coffee"coffee
"good night", "going to sleep", "heading to bed"sleep
"gym", "exercise", "workout", "going for a run"exercise

How to log:

[HW:/wellbeing/log:{"action":"meal","notes":"user said: going to lunch","user":"<current_user>"}]

Emit the marker at the start of the normal reply; the runtime forwards it to the same wellbeing log API. Do not also send a curl POST for that intent. If the runtime explicitly rejects the marker, use the wellbeing skill's documented log fallback with the same payload.

Rules:

  • Log silently — do NOT tell the user you're logging. Just respond naturally.
  • Only log when user states intent NOW, not past tense or general talk.
  • One log per intent per conversation turn — no duplicates.
  • notes field stores the original phrase for debugging.

API Calls

Read wellbeing history (via API)

curl -s "http://127.0.0.1:5000/api/openclaw/wellbeing-history?user={name}&date=YYYY-MM-DD&last=100"

Read from file directly (for multi-day analysis)

cat /root/local/users/{name}/wellbeing/YYYY-MM-DD.jsonl

Use direct file reads for multi-day pattern building (faster, no API pagination needed).

Check today's activity (quick presence check)

curl -s "http://127.0.0.1:5000/api/openclaw/wellbeing-history?user={name}&last=50"

Integration Points

From wellbeing/SKILL.md: When wellbeing's Step 3 fires a threshold nudge, it invokes Flow A (which self-throttles via the freshness guard). Flow A returns the current wellbeing_patterns; wellbeing uses any matching pattern for the nudge action to enrich Step 4's phrasing (e.g. "you usually drink around now"). No separate habit-only nudge — habit context piggybacks on the threshold nudge. This keeps bootstrap cost on the rare nudge path, not on every motion.activity tick.

From posture/SKILL.md: Same pattern. When posture decides to nudge AND its context block has bootstrap_needed=true, it invokes Flow A. Flow A returns posture_patterns (peak hour, side bias, typical risk) which the posture coach uses to phrase pattern-aware nudges (e.g. "around this hour you usually slip").

From music-suggestion/SKILL.md: Read habit/patterns.json → music_patterns. If habit data exists and current hour matches, use preferred genre instead of default genre table.

Minimum Data Requirements

PurposeMin daysMin occurrences
Habit detection32
Proactive nudging53
Music personalization32 accepted

If data is insufficient: use default wellbeing thresholds / music genre table as fallback. Never fabricate patterns.

Output Examples

Nudge enrichment (Flow A → wellbeing Step 3b):

  • Habit break: "You usually have water around now — everything okay?"
  • Habit confirmed: "Back at your desk right on schedule. [chuckle]" — only say this if it feels natural
  • Music: "It's your usual coding time — want some lo-fi?"
  • Posture: "Around this hour you usually slip — sit up from the start."
  • When no data: silent (NO_REPLY) — never guess or fabricate habits

Open habit question (Flow E):

  • Pattern mode: "Leo usually arrives around 8:30 with breakfast, settles at the computer through the morning, and wraps up close to 5. Lo-fi tends to land between 2 and 4. Pretty steady the last week."
  • Narrative mode: "I've only got two real days on Chloe so far — April 28 was an evening at the computer with a lot of water breaks, and April 29 ran late, working past midnight. Not enough days yet to call it a habit, but that's what I've seen."
  • Honest-gap mode: "Honestly, I haven't seen Leo much lately — just one short session yesterday. The patterns I have are from two weeks ago, so I'd rather not pretend they're still true."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.