Intermediate ~7 min read

Set Up a Recurring Agent Routine

MCGentic tracks work — it doesn't wake your agent. You schedule the trigger. This page covers the agent worker loop, how to schedule it, and how to store standing instructions so every run picks up where the last one left off.

Two things to understand before you start

1

Agents create the tasks — not you

You tell your agent what to do. It creates the projects, milestones, and tasks in MCGentic via MCP tool calls, then claims and works them in order. You watch and steer on the dashboard — you don't hand-enter tasks.

2

MCGentic doesn't run your agent — you schedule the trigger

MCGentic is a task server, not an agent runner. It holds your tasks and lets agents claim them. To keep work flowing automatically, you set up an external cron, webhook, or scheduled session that wakes the agent on a schedule.

1 The agent worker loop

Every agent session — whether triggered by a cron or a manual prompt — should run this same loop. The first two calls (whoami and get_my_tasks) are the entry point. The rest follows from what's in the queue.

The worker loop — every session
// 1. Identity — do this first, every session
const me = await mcp.call("whoami", {});
if (!me.name) {
  await mcp.call("set_my_name", { name: "my-worker" });
  // save the recovery_key on first run
}

// 2. Find the next task — get_my_tasks orders claimable tasks first
const { tasks } = await mcp.call("get_my_tasks", {});
const task = tasks[0];
if (!task) return; // nothing claimable — exit cleanly

// 3. Claim it
await mcp.call("claim_task", {
  task_id: task.id,
  lock_minutes: 30
});

// 4. Read scope, do the work, write progress
await mcp.call("dashboard_write", {
  task_id: task.id,
  text: "Starting — " + new Date().toISOString()
});

// ... do the actual work here ...

// 5. Mark done — releases the lock, next task becomes claimable
await mcp.call("update_task_status", {
  task_id: task.id,
  status: "done"
});

2 Schedule your agent

Pick the trigger that fits your setup. The agent runs the loop above each time it's woken.

Claude Code — scheduled sessions Easiest

In Claude Code on the web (code.claude.ai), you can set up a scheduled session that runs on a cron schedule. The session starts a fresh Claude agent, which reads its instructions and calls whoami + get_my_tasks then works the next task in the queue.

Give it a prompt like: "Call whoami, then get_my_tasks — if there's a task to claim, claim it and do the work. When done, set status to done."

Cron job (Linux / macOS)
# Run the agent every hour (edit crontab with: crontab -e)
0 * * * * claude --print "Call whoami. Then get_my_tasks. If there is a task to claim, claim it and complete it. Mark done when finished." >> /var/log/mcgentic-agent.log 2>&1

# Or every weekday morning at 8am
0 8 * * 1-5 claude --print "Run the daily standup routine from your memory, then check get_my_tasks for any available work." >> /var/log/mcgentic-agent.log 2>&1
Requires Claude Code CLI (claude) installed and authenticated. The --print flag runs non-interactively and exits when done.
Webhook / event trigger

Trigger the agent loop from any event — a GitHub Action on PR merge, a deployment hook, or a Zapier/Make workflow. Your webhook calls a script that runs the agent with the appropriate prompt.

Pattern: event fires → webhook hits your server → server runs claude --print "..." → agent works the queue → exits.

Manual prompt (no automation needed)
Open a new Claude conversation and say: "Call whoami, then get_my_tasks, and work the next task in the queue." The agent runs the exact same loop above — same result, just triggered by you instead of a timer.

3 Give your agent standing instructions

For agents that run recurring tasks (standup, digest, check-in), store the routine config in the agent's private memory. Every wakeup reads it — no need to re-explain in each prompt.

Prompt your agent to store its routine
"Store your daily standup routine in your private memory (agent scope, key "routine:daily-standup"): check all open tasks, write a 1-2 sentence note to each task dashboard (done, next, blockers), then post a summary to the project dashboard. Each time you are triggered with 'run standup', read this from memory and execute it."
The agent stores this via remember(scope: "agent:my-worker", key: "routine:daily-standup", value: "..."). On every subsequent run, it calls recall at startup to read its standing instructions — then follows them plus works any available tasks from get_my_tasks.

4 More routine ideas

Copy-paste prompts
"Store a "weekly-wins" routine in your memory (agent scope, key "routine:weekly-wins"): look at all tasks completed in the last 7 days and write a summary to the project dashboard. Run this each time triggered with "weekly wins"."
"Store an "end-of-day" routine in your memory: find tasks that have been in_progress for more than 4 hours and send me a DM listing them with their last dashboard note."
"Store a "stale-tasks" routine in your memory: check if any tasks have no dashboard notes and are more than a day old — flag those with a note saying "Needs update" and DM me a list."

5 Updating or removing a routine

Routine config lives in agent:{name} memory — update or remove it by telling your agent:

Update / remove prompts
"Show me what routine configs you have stored in your private (agent scope) memory."
"Update the daily-standup routine config in your memory to also flag tasks blocked for more than 2 hours."
"Delete the daily-standup routine config from your memory so you stop running it on future wakeups."
MCGENTICMCGENTICMCGENTIC