Skip to content

Darribni: An AI Agent That Plans, Schedules and Reviews My Training

• 6 min read
Darribni AI coach reviewing a workout in Telegram, with the n8n workflow architecture behind it

Planning endurance training with AI sounds easy until you realize you’re explaining your whole situation every time. Your goal, your fitness, last week’s sessions, your schedule. Then you do it again the next day.

Darribni fixes that. It’s an AI coach that runs in Telegram, built with n8n, and it already knows my goal, my training phase, and everything I did on Strava this week. It plans my week, puts sessions in my calendar, and reviews every workout right after I upload it.

The name means “train me” in Arabic, and the full project is open source on GitHub.

Why I Built It

Every time I wanted a training plan, I’d lose a lot of time. I’d search around, ask different AI agents, and explain my whole context again from scratch: my goal, my current fitness, what I did last week, my schedule. That’s a known issue with general AI chat tools. They don’t keep your training history between chats, so you’re always starting over.

The other options weren’t great either. Most training apps give you a rigid plan that ignores real life, or a pile of raw data with no guidance. A human coach is expensive and can be slow to reply.

So I wanted something that would let me:

  • Chat with a coach by text about fatigue, rescheduling, or upcoming races
  • Get plans that adapt to what I actually did, not what I was supposed to do
  • Get feedback right after each session
  • Fit sessions into my calendar around client work

No app, no dashboard to check. Just a coach that already knows where I stand.

What Darribni Does

The coach knows my goal, my current training phase, my last 7 days of Strava activities, and our recent conversations. Here’s what it does with that.

1. Chat Coach on Telegram

When I send a message, the coach pulls my profile, my active goal, my last 7 days of activities, my planned workouts, and our last 10 messages. Replies stay under 150 words. If something changes, it rewrites the next 7 days and they show up in my Google Calendar. Tell it my knee hurts, and I get a lighter week, already scheduled.

2. Instant Workout Review

When I upload an activity to Strava, it gets saved and compared with that day’s plan. Then I get a 2 to 3 sentence review on Telegram: did I follow the plan, and did I push too hard?

3. Weekly Planner

Every Sunday at 6pm, the planner looks at last week’s volume per sport and my current training phase. It generates Monday to Sunday sessions, saves them, syncs them to Google Calendar, and sends me a short summary.

4. Google Calendar Sync

Each planned workout becomes an all-day event in a dedicated “Darribni” calendar. Events are color-coded by sport and include a description and target duration.

Bonus: Strava Social Manager. A small utility, not part of the coach. It renames new Strava activities with Arabic titles based on type (home session, ride, trail run, run, walk). For virtual sessions on Zwift or MyWhoosh, it keeps the original name as the description. It runs on a free AI model. Strava only allows one webhook subscription per app, so the Strava workflow receives each event once and passes it to both the coach review and this title manager.

How It Works Under the Hood

Darribni is four n8n workflows sharing one PostgreSQL database. The database is the coach’s long-term memory, and it gets read before every AI call.

WorkflowTriggerJob
Darribni – TelegramTelegram messageConversational coach, can replan the week
Darribni – StravaNew Strava activitySaves the activity, reviews it against the plan, notifies me
Darribni – Weekly PlannerEvery Sunday at 6pmGenerates the next 7 days of workouts
Darribni – Google Calendar SyncCalled by other workflowsCreates the calendar event and stores its ID

The Data Model

Six tables hold everything. The full schema is in schema.sql in the repo.

TableWhat it holds
athletesProfile, metrics, coach notes, Telegram and Strava IDs
goalsTarget race or objective, and its status
strategy_phasesTraining phases per goal, with end dates (base, build, taper, etc.)
activitiesStrava activities with distance, moving time, and average heart rate
workoutsPlanned sessions: date, sport, title, description, duration, calendar event ID
conversationsChat history, both my messages and the coach’s

How I Designed the AI Part

  • Context over model memory. Every call builds a fresh system prompt from the database. The model is stateless, but the system isn’t.
  • Structured output inside a normal reply. The coach writes a short answer and, when needed, a JSON block (new_workouts or update_coach_notes). A code node pulls out the JSON so I only see the reply. A fallback parser catches JSON that comes without code fences.
  • Different models for different jobs. Claude Opus (through OpenRouter) handles coaching chats and weekly planning. Kimi K2 handles quick post-workout reviews. Free models handle the Strava title utility.
  • Simple guardrails. Replies under 150 words, plans only for the next 7 days, exact JSON keys, and messages capped at Telegram’s 4,000 character limit.
  • One shared sub-workflow. The chat coach and the weekly planner save workouts the same way and call the same Calendar Sync sub-workflow, which writes the event ID back to the database.

Stack: n8n for the workflows · PostgreSQL for the database · OpenRouter for the AI models · Telegram for the chat (bot created with @BotFather) · Strava API for activity events (OAuth2) · Google Calendar for workout events (OAuth2)

Where It Runs

Darribni doesn’t run on n8n Cloud. I self-host n8n on my own Oracle Cloud server, so the workflows, credentials, and the coach’s data stay on infrastructure I control.

The server stays up around the clock, and the coach depends on that. The Strava webhook needs a public URL that’s always reachable. The Telegram bot has to reply at any hour. The weekly planner has to fire every Sunday at 6pm, whether my laptop is open or not.

Self-hosting also means no execution limits, so the coach can run as often as it needs to without a bill growing in the background.

Build Your Own

I exported all the workflows as importable JSON files, with IDs, credentials, and private values removed. Here’s how to set it up:

  1. Database: create a PostgreSQL database and run schema.sql. Add yourself to athletes (with your Telegram and Strava IDs), add an active row in goals, and add at least one row in strategy_phases.
  2. Import: in n8n, go to Workflows > Import from File and import the 5 files in the workflows/ folder.
  3. Credentials: create credentials for Postgres, Telegram (bot token), Strava OAuth2, Google Calendar OAuth2, and OpenRouter, then select them on each node.
  4. Link sub-workflows: on each Execute Workflow node, pick the matching workflow. After import they show a SELECT_... placeholder.
  5. Calendar: in Darribni – Google Calendar Sync, choose your target calendar.
  6. Activate: turn on the Telegram, Strava, and Weekly Planner workflows, then message your bot.

Get the Code

Workflows, database schema, and architecture diagram, all on GitHub. If you build your own version or have questions, feel free to reach out.

Let’s talk

Got a project in mind?

Tell me what you're working on and I'll let you know if I can help. Zero pressure, zero jargon.

Let’s get started

Typical reply within 1 business day.