$npm i habicron
$npx skills add imrim12/habicron
Then import from habicron, habicron/browser,
habicron/vue, habicron/react — or schedule
shell commands with the habit CLI.
import { useHabit } from 'habicron/vue' // remind me to drink water every hour useHabit(drinkWater, { every: '1h ~ 8m' }) // check my cat every 2 hours useHabit(checkCat, { every: '2h ~ 20m' }) // a whole routine, with controls const { nextRun, pause } = useHabit(routine, { controls: true, habits: [ { every: '20s', jitter: ['3s', '5s'] }, { times: 2, per: 'day', jitter: '2h' }, ], })
import { createHabit } from 'habicron' // poll a feed, roughly every 15 min const job = createHabit(syncFeed, { every: '15m ~ 2m', })
import { useHabit } from 'habicron/browser' // no framework — react via callbacks useHabit(refreshWidget, { every: '20s ~ 4s', onFire: n => badge.textContent = n, })
import { useHabit } from 'habicron/react' useHabit(runAgent, { controls: true, habits: [ { every: '2h ~ 20m' }, // check the cat { times: 2, per: 'day', jitter: '90m' }, ], })
<script setup lang="ts"> const { counter, pause } = useHabit(post, { controls: true, every: '20s ~ 4s', }) </script> <template> fired {{ counter }}× </template>
# start commands in the background, jittered so you don't look like a bot $ habit start --name stretch --every "10m ~ 2m" -- notify-send "Stretch" $ habit start --every 1h --jitter 12m -- node scrape.js # list what's running — and what each one runs $ habit list id name status schedule command runs next 1 stretch running every 10m~2m notify-send … 4 in 8m 2 scrape running every 1h~12m node scrape.js 1 in 47m $ habit logs stretch # stop · restart · update · delete · kill