Urgent.News

What's breaking now, across thousands of outlets.

Tech

How I built Ankita's proactive loop: scheduled routines, page watches, and a Telegram inbox

Most desktop assistants wait for you to type. I wanted Ankita, my open-source desktop AI assistant, to also act on its own: brief me every morning, keep an eye on pages I care about, and let me talk to the same agent from my phone through a Telegram inbox. This is how the proactive loop works, in the releases that are out today. One JSON file of intentions Everything Ankita does on its own lives…

Ankita, the open-source desktop AI assistant, has been designed to proactively brief the user every morning and monitor specific pages for changes. All of its independent actions are stored in a single JSON file managed by a class called RoutineStore. There are three types of routines included in this file: scheduled routines, URL watches, and a Telegram inbox.

Scheduled routines, URL watches, and the Telegram inbox all have their own separate RoutineStore instances. This ensures that if a watch is created mid-routine, it won't be erased later by the daemon's bookkeeping write. The fix for this issue is a three-line _fresh() method that reloads before mutating the routines.

URL watches are defined by a URL and either a regex or a CSS selector. A pure function called extractValue pulls the value out of the page text, matching the regex and taking the first capture group as the digest source. Selector watches go through the same scrape tiers as the rest of the app, allowing blocked or JS-heavy pages to still work. Change detection is kept small, using SHA-256 hashing and numeric deltas to detect changes.

The assistant also has a Telegram inbox with some discipline built in. Messages are batched together, so there are no duplicate replies or unintended replies due to late approvals. The assistant checks for changes in the watched pages, and only notifies when there is a significant change, using a cooldown period between notifications.

The assistant's design is centered around state management and a few paranoid decisions. It uses a shared checker to ensure consistency, and all side effects are injected, making the whole loop testable without a network or terminal. The assistant's implementation is open source and can be found on GitHub.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 29 September →