- Overview
- Core Principle
- Key Features
- Architecture
- Getting Started
- Building for Production
- Mobile Development
- Project Structure
- Tech Stack
- How It Works
- Contributing
- License
STABILITY OS is not a productivity tracker, habit streak app, or mood logger. It's a daily operating system that detects your mental-behavioral state at any given time and delivers the appropriate environment, task sequence, or protocol to maintain stability.
The app is designed to intercept behavioral failure points โ especially the vulnerable 4โ7 PM transition window โ with pre-programmed environment responses that replace oscillation (chaos โ guilt โ spike โ collapse) with a stable execution loop.
- โ A state-aware daily execution engine
- โ A rule compliance tracker (4 core rules)
- โ An urge interruption protocol
- โ A failure containment and re-entry system
- โ A weekly self-calibration loop
- โ An identity reinforcement layer (execution count, not streaks)
- โ Not a streak counter (streaks create shame on failure)
- โ Not a dopamine reward system (no badges, confetti, or points)
- โ Not a notification spammer (the system is calm and firm)
- โ Not a mood tracker (only execution count matters)
Environment > State > Action > Identity
Most behavioral failures happen not from lack of motivation but from unstructured transitions. STABILITY OS controls the environment to create stable behavioral loops.
OLD LOOP (Chaos):
Fatigue โ Bed โ Screen โ Relapse โ Guilt โ Night spike โ Sleep late
NEW LOOP (Stability):
Fatigue โ Movement โ Business โ Controlled reward โ Sleep early โ Stable morning
The app runs on a time-based state machine. You're always in exactly ONE of five states:
- Morning Activation (8:15โ9:00 AM) - Boot sequence with checklist
- External Demand (9:00 AMโ4:00 PM) - College/work hours, minimal interference
- Vulnerable Transition (4:00โ5:00 PM) - 6-step mandatory reset sequence
- Controlled Output (5:00โ9:45 PM) - Deep work + controlled reward windows
- Shutdown Protocol (9:45 PM+) - Hard close, wind-down mode
- Social media locked until morning checklist complete
- Social media locked during 4 PM reset sequence
- Adult content blocked at network level (DNS filtering)
- All features locked during shutdown mode
- Uses Dexie (IndexedDB) for local-first data storage
- Syncs with Supabase backend when online
- Zero-latency UI - works completely offline
- Background sync on reconnection
- Urge Overlay: 3-step interruption protocol when urges hit
- Failure Recovery: Containment system with 24h cooldown
- Sleep Mode: Enforced shutdown with limited functionality
- Web application (React + Vite)
- Android app (Capacitor)
- iOS ready (requires Xcode setup)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React UI Layer โ
โ (Views, Components, Overlays) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ State Management (Zustand) โ
โ - App State (tabs, overlays, modes) โ
โ - Auth State (user, profile, onboarding) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Business Logic Layer โ
โ - TimeEngine (state detection) โ
โ - SyncEngine (data synchronization) โ
โ - NotificationEngine (local notifications) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Layer โ
โ - Dexie (IndexedDB - offline storage) โ
โ - Supabase (PostgreSQL - cloud backend) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Ensure you have the following installed:
For mobile development:
- Clone the repository:
git clone https://github.com/yourusername/stability-os.git
cd stability-os- Install dependencies:
npm install- Create environment file:
# Copy the example environment file
cp .env.example .env.local- Configure Supabase:
You need a Supabase project for backend functionality. Get your credentials at supabase.com:
# .env.local
VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key- Database Setup:
The app uses the following Supabase tables:
users- User authentication datauser_profiles- Extended user profile informationtime_blocks- Daily execution blocks and checklistsrule_violations- Compliance trackingurge_logs- Urge protocol trackingfailure_logs- Failure recovery trackingweekly_closures- Weekly review data
See Database Schema Documentation for complete schema (if available)
Development server (web):
npm run devOpen http://localhost:5173 in your browser.
Preview production build:
npm run build
npm run previewBuild for web:
npm run buildThe production files will be in the dist/ directory.
This project uses Capacitor to deploy to iOS and Android.
- Build the web app:
npm run build- Sync with Capacitor:
npx cap sync android- Open in Android Studio:
npx cap open android- Run on device/emulator from Android Studio
- Build the web app:
npm run build- Sync with Capacitor:
npx cap sync ios- Open in Xcode:
npx cap open ios- Run on device/simulator from Xcode
# Run the provided batch script (Windows)
install_cap.bat
# Or manually install
npm install @capacitor/core @capacitor/cli
npx cap init
npx cap add android
npx cap add iosstability-os/
โโโ src/
โ โโโ components/ # React components
โ โ โโโ layout/ # PhoneFrame and layout components
โ โ โโโ logic/ # TimeEngine, business logic components
โ โ โโโ ui/ # Reusable UI components
โ โ โโโ views/ # Full-screen views (Home, Auth, Settings, etc.)
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useNotifications.js
โ โ โโโ useSyncEngine.js
โ โโโ lib/ # Utilities and libraries
โ โ โโโ db.js # Dexie database configuration
โ โโโ store/ # Zustand state management
โ โ โโโ useAppStore.js # App-level state
โ โ โโโ useAuthStore.js # Authentication state
โ โโโ App.jsx # Root application component
โ โโโ main.jsx # Application entry point
โ โโโ index.css # Global styles (Tailwind)
โโโ android/ # Android Capacitor project
โโโ dist/ # Production build output
โโโ public/ # Static assets
โโโ capacitor.config.json # Capacitor configuration
โโโ vite.config.js # Vite configuration
โโโ tailwind.config.js # Tailwind CSS configuration
โโโ package.json # Dependencies and scripts
โโโ README.md # This file
- React 18.3 - UI library
- Vite 6.0 - Build tool and dev server
- Tailwind CSS 3.4 - Utility-first CSS framework
- Lucide React - Icon library
- Zustand 5.0 - Lightweight state management
- Dexie 4.3 - IndexedDB wrapper for offline storage
- dexie-react-hooks - React hooks for Dexie
- Supabase - PostgreSQL backend, authentication, real-time sync
- @supabase/supabase-js - JavaScript client
- Capacitor 8.1 - Cross-platform native runtime
- @capacitor/android - Android platform
- @capacitor/local-notifications - Native notifications
- ESLint - JavaScript linting
- PostCSS - CSS processing
- Autoprefixer - CSS vendor prefixes
The TimeEngine component runs continuously and detects which of the 5 states you're in based on device time:
// Simplified logic
if (time >= 8:15 && time < 9:00) โ STATE 1: Morning Activation
if (time >= 9:00 && time < 16:00) โ STATE 2: External Demand
if (time >= 16:00 && time < 17:00) โ STATE 3: Vulnerable Transition
if (time >= 17:00 && time < 21:45) โ STATE 4: Controlled Output
if (time >= 21:45) โ STATE 5: Shutdown ProtocolCertain actions are locked until conditions are met:
- Morning: Social media locked until 5/5 checklist items complete
- 4 PM Reset: Social media locked until all 6 steps complete (including 30-min business block)
- Shutdown: All features except wind-down checklist locked
- First login: App syncs data from Supabase โ Dexie
- Subsequent logins: App loads from Dexie immediately (instant UI)
- Background sync: Syncs with Supabase silently in background
- Offline mode: App works fully offline, queues changes for next sync
Urge Protocol (when user hits "I'm feeling an urge"):
- Acknowledge the urge (no shame)
- 5-minute timer + physical reset (water, pushups, walk)
- Re-orient to current block task
Failure Recovery (after a rule violation):
- 24-hour cooldown period
- Reflection journal entry
- No shame messaging - just data logging
- Return to normal execution next day
We welcome contributions! STABILITY OS is built to help people create stable behavioral loops, and your input can make it better.
-
Fork the repository
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Follow existing code style
- Add comments for complex logic
- Test thoroughly
-
Commit your changes:
git commit -m "feat: add your feature description"Use conventional commits:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request:
- Describe what you changed and why
- Reference any related issues
- Include screenshots for UI changes
- Code Style: Follow the existing patterns in the codebase
- Component Structure: Use functional components with hooks
- State Management: Use Zustand stores for shared state
- Styling: Use Tailwind CSS utility classes
- Comments: Add
@intentcomments for complex components (see existing examples) - Testing: Test on both web and mobile (if possible)
- ๐จ UI/UX Design: Improving the interface while maintaining the "calm and firm" aesthetic
- ๐ฑ iOS Testing: We need iOS testers and developers
- ๐ Localization: Translating the app to other languages
- ๐ Documentation: Improving docs, tutorials, setup guides
- ๐ Bug Fixes: Check the Issues page
- โจ New Features: Propose new protocols or state detection improvements
- Be respectful and constructive
- Focus on the problem, not the person
- Assume good intent
- This app is about stability, not perfection - bring that energy to your contributions
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright ยฉ 2026 Priyanshu Thakare
- Built with the principle: Environment > State > Action > Identity
- Inspired by behavioral psychology and systems thinking
- Designed for people who want to replace chaos with stable execution
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built to replace oscillation with stability.
โญ Star this repo if it helps you build stable behavioral loops!
