Skip to content

charan74/LifeOS-365

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

LifeOS 365

An offline-first personal operating system that tracks, scores, and improves your behavior across three life domains — powered by a deterministic engine and an LLM intelligence layer.


What Is LifeOS 365?

LifeOS 365 is a fully offline behavioral system built in Python and SQLite. It measures how consistently you execute on your goals, tracks discipline decay over time, and uses Claude as an intelligence layer to interpret patterns and generate actionable insights.

Three domains. One system. Zero cloud.

Domain What It Tracks
Execution Tasks, focus, daily performance score
Habits & Wellbeing Consistency, decay, energy, mood, sleep
Goals & Learning Goal adherence, study progress, trajectory

How It Works

You log your day
        ↓
SQLite stores everything locally
        ↓
Behavior Engine computes your scores (ER + SI + DF + GA)
        ↓
Analytics Engine finds cross-domain patterns
        ↓
Claude reads structured summaries via tool interface
        ↓
You get insights, nudges, and a daily briefing
        ↓
Annual archive → new cycle begins

The math runs offline. The AI reads summaries — never your raw logs.


The Core Algorithm: Behavioral Decay Factor (BDF)

Most habit apps use streaks. A streak resets to zero the moment you miss a day — which is both punishing and inaccurate. BDF models decay continuously and recovers gradually, the way real consistency actually works.

BDF(h, t) = [ Σ w_r(i) × c(h, t-i) × w_imp(h) ]
            ÷ [ f_target(h) × Σ w_r(i) ]
Symbol Meaning
c(h, t-i) Completion: 1.0 full · 0.6 partial · 0.0 missed
w_r(i) Recency weight (recent days count more)
w_imp(h) Habit importance, set by you (0.1 – 3.0)
f_target(h) Your target frequency per week

BDF Score Ranges:

Score Status
≥ 0.85 Elite
0.70 – 0.84 Consistent
0.50 – 0.69 Degrading
< 0.50 Critical — AI nudge triggered

Daily Score

Every day gets a composite score built from four components:

Daily Score = ER × 0.40 + SI × 0.25 + (1 − DF) × 0.20 + GA × 0.15
Component What It Measures
ER — Execution Rate Tasks completed + focus time vs target
SI — Stability Index Consistency of scores over 14 days
DF — Decay Factor Habit degradation (BDF aggregated)
GA — Goal Adherence Actual vs expected effort per goal domain

Domain 1 — Execution Engine

Daily input:

  • Planned tasks vs completed tasks
  • Focus minutes vs target
  • Self-rating (1–10)

What you get:

  • ER score per day
  • Stability Index over rolling 14 days
  • Burnout flag when ER < 45% for 14+ consecutive days
  • Rolling analysis at 3 / 6 / 9 / 12 months
  • Milestone evaluations: IMPROVING · FLAT · DECLINING

Domain 2 — Habits & Wellbeing

Habit tracking:

  • Define habits with frequency targets and importance weights
  • Log daily: full / partial / missed
  • BDF computed per habit, aggregated into system DF
  • AI nudge when a habit drops below 0.60 BDF
  • Weekly habit narrative generated by Claude

Wellbeing tracking:

  • Log energy, mood, and sleep quality (1–5 each)
  • 14-day and 30-day pattern detection
  • Cross-correlations surfaced automatically:
    • Sleep quality × Execution Rate
    • Mood × Stability Index
    • Exercise × Focus minutes

Domain 3 — Goals & Learning

Goal Manager:

  • Define goals per domain: Health · Work · Learning · Personal
  • Set importance weight (0.1 – 3.0) and weekly effort target
  • Log daily effort per goal
  • AI-generated trajectory analysis: on track / at risk / critical
  • Deadline risk alerts at 7-day and 30-day lookahead

Study Engine:

  • Topic-based question generation via Claude
  • Interactive quiz mode with per-question feedback
  • Weak topic detection from session history
  • Adaptive difficulty based on your performance trend
  • All session data stored locally in SQLite

AI Intelligence Layer

Claude reads pre-aggregated structured data through a tool interface — not your raw logs. This keeps your data private even when the AI layer is active.

Tool Interface (MCP-style)

get_bdf_scores(habit_id, window=14)
get_execution_trend(window=30)
get_goal_trajectory(goal_id)
get_weak_topics(subject)
get_cross_domain_correlations()

3-Layer Prompt Architecture

Base Layer     →  Behavioral profile + rolling metrics snapshot
Module Layer   →  Context for the active module (study / habit / goal)
Task Layer     →  Specific instruction (quiz / nudge / briefing)

Daily Briefing

One API call. Five lines. 30 seconds to know where you stand.

📌 PRIORITY    — top goal action for today
⚠️  HABIT       — habit with lowest BDF this week
🎯 GOAL        — goal closest to deadline risk
💛 WELLBEING   — flag if 3-day energy/mood average drops below 2.5
⚡ ACTION      — one concrete next step

Validation Layer

Every AI output is checked before display:

  • Catches values that contradict the actual data snapshot
  • Detects generic or non-actionable responses
  • Triggers regeneration if check fails

Annual Cycle

At year-end, LifeOS generates a full report and archives the year.

Report metrics:

  • Average Execution Rate (annual)
  • Stability Variance (annual CV)
  • Max Decay Depth reached
  • Recovery Time Index (days from critical BDF back to consistent)
  • Self vs System Delta (your self-rating vs computed score)
  • Discipline Trajectory (slope across 365 days)

Outputs: .txt report · .json full export · SQLite archive snapshot

New cycle starts fresh with the archive preserved.


Project Structure

lifeos365/
│
├── app/
│   └── main.py                   # Entry point
│
├── core/
│   ├── execution_rate.py         # ER computation
│   ├── stability_index.py        # SI computation
│   ├── decay_factor.py           # BDF algorithm
│   ├── goal_adherence.py         # GA computation
│   └── daily_score.py            # Composite score
│
├── database/
│   ├── schema.sql                # Table definitions
│   ├── db_manager.py             # CRUD layer
│   └── lifeos.db                 # Local SQLite file (gitignored)
│
├── logging/
│   ├── daily_logger.py           # Task + focus input
│   ├── habit_logger.py           # Habit completion input
│   ├── goal_logger.py            # Goal effort input
│   └── wellbeing_logger.py       # Energy + mood + sleep input
│
├── analysis/
│   ├── rolling_windows.py        # 3/6/9/12 month windows
│   ├── milestone_evaluator.py    # Checkpoint evaluation
│   ├── annual_report.py          # Year-end summary
│   └── insight_rules.py          # Deterministic rules engine
│
├── features/
│   ├── study_engine.py           # Quiz + weak topic detection
│   ├── habit_ai.py               # BDF nudges + weekly report
│   ├── goal_ai.py                # Trajectory + deadline alerts
│   ├── wellbeing.py              # Pattern detection
│   └── daily_briefing.py         # 5-bullet daily summary
│
├── analytics/
│   └── analytics_engine.py       # Cross-domain correlations
│
├── ai/
│   ├── ai_engine.py              # Claude API wrapper
│   ├── prompt_library.py         # 3-layer prompts
│   ├── mcp_tools.py              # Structured data tool interface
│   └── validation_layer.py       # Output quality check
│
├── ui/
│   ├── cli.py                    # Command-line interface
│   └── dashboard.py              # Streamlit dashboard
│
├── archive/
│   ├── export_json.py            # JSON export
│   └── cycle_manager.py          # Annual reset + archive
│
├── .env.example                  # API key template
├── requirements.txt
└── README.md

Database Schema

daily_log        (date, planned_tasks, completed_tasks, focus_minutes,
                  sleep_hours, exercise_minutes, water_count, steps, self_rating)
 
goals            (id, name, domain, weight, expected_weekly_effort)
goal_progress    (goal_id, date, effort_logged)
 
habits           (id, name, frequency_target, importance_weight)
habit_log        (habit_id, date, status)
 
wellbeing_log    (date, energy, mood, sleep_quality, notes)
 
study_sessions   (id, topic, score, difficulty, timestamp)
 
annual_summary   (year, avg_er, avg_si, avg_df, avg_ga,
                  final_score, trajectory, recovery_index)

Tech Stack

Layer Tool
Language Python 3.10+
Storage SQLite (local only)
LLM Claude API (claude-sonnet-4)
UI Streamlit
CLI argparse

Getting Started

1. Clone

git clone https://github.com/your-username/lifeos365.git
cd lifeos365

2. Install

pip install -r requirements.txt

3. Configure

cp .env.example .env
# Add your ANTHROPIC_API_KEY

4. Initialize database

python database/db_manager.py --init

5. Run

# CLI
python app/main.py
 
# Dashboard
streamlit run ui/dashboard.py

Build Roadmap

  • Database schema + manager
  • Daily logging CLI
  • Behavior Engine — ER, SI, DF, GA
  • Daily score + deterministic insight rules
  • Rolling window analysis (3 / 6 / 9 / 12 months)
  • Milestone evaluator + annual report
  • MCP tool interface
  • Study engine (quiz + weak topic detection)
  • Habit AI + BDF nudges
  • Goal intelligence + deadline alerts
  • Wellbeing module + cross-domain correlation
  • Daily briefing (5-bullet Claude summary)
  • Validation layer
  • Streamlit dashboard
  • Annual archive + cycle manager

Privacy

  • Everything lives in a local SQLite file — no cloud, no sync
  • Claude API calls receive structured aggregates only, never raw log entries
  • API key stored in .env, never committed
  • System runs fully offline except during AI feature calls

Limitations

  • Single-user only (current version)
  • Self-reported data — accuracy depends on honest logging
  • AI features require an active internet connection and API key
  • English-only prompts

License

This project is licensed under the MIT License.


LifeOS 365 — Track what matters. Measure consistency. Understand yourself.

About

Python-based offline behavioral system for execution, habits, and goals with scoring engine + LLM insights.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors