Automate Your Agent's Workflow
Claude Code's /loop command schedules a recurring prompt that fires in the background while your session stays open. Minolith's Tasks service gives your agent a structured list of work with priorities, statuses, and notes. Together they create an autonomous work cycle: the agent checks for new tasks on a schedule, picks up the highest priority one, works it, adds notes, and moves it to review. You come back to a queue of completed work ready for your review.
This guide walks through the setup, the commands, and what the workflow looks like in practice.
Prerequisites
Before you start, you need:
- Claude Code v2.1.72 or later. Check with
claude --version. The/loopcommand requires this version. - A Minolith account with a project. Sign up at app.minolith.io/register. The 14-day free trial includes 500 credits.
- An MCP connection with the X-Minolith-Agent header. This tells Minolith which agent is calling so it can filter tasks to the right assignee.
- At least one agent definition in your Minolith project (e.g., "riley").
Step 1: Connect Claude Code with Agent Identity
Add Minolith as an MCP server with both the API key and the agent identity header:
claude mcp add --transport http minolith https://mcp.minolith.io \
--header "Authorization: Bearer mlth_your_api_key" \
--header "X-Minolith-Agent: riley"
The X-Minolith-Agent header is what makes this work. When your agent calls get_my_tasks, Minolith reads this header, looks up the agent definition named "riley" in your project, and returns only the tasks assigned to that agent. Without this header, the system doesn't know who's asking.
Verify the connection:
claude
# Inside the session:
bootstrap
You should see your agent's identity, any assigned tasks, and the project workflow in the bootstrap response.
Step 2: Create Tasks in the Dashboard
Go to your project in the Minolith dashboard at app.minolith.io. Navigate to Tasks and create a few tasks:
Example tasks:
| Title | Category | Priority | Assignee |
|---|---|---|---|
| Add input validation to the registration form | feature | high | Riley |
| Fix timezone bug in export timestamps | bug | urgent | Riley |
| Write unit tests for the payment service | task | normal | Riley |
| Add rate limiting to public API endpoints | feature | high | Riley |
| Update README with new environment variables | task | low | Riley |
Each task costs 2 credits. Assign them all to your named agent (Riley in this example).
You can also create tasks via MCP from within Claude Code:
Create a task: "Add input validation to the registration form",
category: feature, priority: high, assign to you
The agent calls create_task and the task appears in the queue.
Step 3: Start the /loop
With tasks assigned and your session running, tell Claude Code to start polling for work:
/loop 5m check for new open tasks and work through them, add notes and change status to review when complete. Before starting a new task search context for relevant entries before starting work. Make notes detailed.
Claude parses the interval (every 5 minutes), converts it to a cron expression, and schedules the job. From this point, every 5 minutes the agent will:
- Call
get_my_tasksto see its assigned tasks grouped by status - If there are tasks in
open, pick the highest priority one - Load the task details including any notes from team members
- Search context for relevant entries matching the task's tags
- Work the task (write code, make changes, run tests)
- Add a detailed note to the task describing what was done (and optionally a commit reference)
- Move the task to
review
When the agent adds a note or changes a task's status, the API response includes a count of remaining open tasks assigned to the agent. If there are more open tasks, the agent can immediately pick up the next one without waiting for the loop interval to fire again. This means the /loop acts as a trigger to start working, and the open task count keeps the agent moving through the queue continuously until all tasks are in review.
If a new task is added to the queue while the agent is working through the list, the remaining count reflects it. The agent sees "2 open tasks remaining" instead of "1 open task remaining" and knows there's additional work without needing to poll.
Interval options
| Command | Behaviour |
|---|---|
/loop 5m check for open tasks |
Every 5 minutes |
/loop 15m check for open tasks |
Every 15 minutes |
/loop 1h check for open tasks |
Every hour |
/loop check for open tasks |
Default: every 10 minutes |
Shorter intervals mean the agent picks up new tasks faster. Longer intervals save tokens. For active development, 5-10 minutes is a good starting point. For background work, 30-60 minutes keeps costs low.
Important: 3-day expiry
Recurring /loop tasks automatically expire after 3 days. After that, the task fires one final time and deletes itself. If you need the loop to run longer, cancel and recreate it before it expires. For scheduling that survives session restarts, use Claude Code's Cloud scheduled tasks or Desktop scheduled tasks.
Step 4: Monitor and Review
While the loop runs, you can work on other things. The agent works in the background, checking for tasks and completing them autonomously.
Check what the agent is doing
Ask Claude Code at any time:
what scheduled tasks do I have?
Claude lists all active loops with their IDs, schedules, and prompts.
Review completed work
When you're ready to review, check the Minolith dashboard. Tasks that the agent has worked will be in the review column of the board view. Each task has:
- Notes from the agent describing what was done
- Commit references linking to the git commits
- Status history showing when the task moved from
opentoreview
You can also query the team feed from within Claude Code:
show me the team feed since this morning
The agent calls get_team_feed with a since parameter and returns a chronological log of all task activity: status changes, notes added, commits linked.
Send work back for revisions
If a task needs changes:
- Add a note on the task in the dashboard: "The validation should also check email format, not just presence"
- Move the task back to
open
On the next loop interval, the agent picks it up again, reads your feedback note, and makes the requested changes. No conversation required. The task and its notes are the communication channel.
The Full Autonomous Cycle
Here's what a typical session looks like:
Morning (5 minutes of your time):
- Open the Minolith dashboard
- Create 5-8 tasks for the day's work
- Assign them to your agent with appropriate priorities
- Start Claude Code and run the loop:
/loop 5m check for new open tasks and work through them, add notes and change status to review when complete. Before starting a new task search context for relevant entries. Make notes detailed.
During the day (zero time required):
- The agent works through tasks autonomously
- Each task gets notes, commit references, and a status change
- The team feed logs everything
Evening (10-15 minutes of your time):
- Open the dashboard
- Review tasks in the
reviewcolumn - Move good ones to
done(with a resolution like "implemented correctly") - Add feedback notes to ones that need changes, move back to
open - Create tomorrow's tasks if you're feeling productive
Next morning:
- Start a new session, run the loop again
- The agent picks up any tasks you sent back plus new ones
- The cycle continues
Tips for Effective Task Descriptions
The quality of the agent's work depends heavily on how you write the task. Good task descriptions include:
Be specific about what to do:
- "Add email format validation using a regex to the registration form at
src/Controllers/Auth/RegisterController.php" - Not: "fix registration"
Include acceptance criteria:
- "The validation should reject emails without an @ symbol and without a domain. Display the error below the field using the existing
form-errorclass."
Reference existing patterns:
- "Follow the same validation pattern used in
ProfileController::update()for consistency."
Set priority accurately:
urgent: blocking other work or affecting users nowhigh: important, should be done todaynormal: standard work, do when availablelow: nice to have, do when the queue is empty
Combining /loop with Context
The real power emerges when Tasks and Context work together. If your project has context entries tagged to match your task tags, the agent loads relevant rules and patterns before starting each task.
For example, a task tagged api, validation will benefit from context entries like:
- A
ruletaggedapi: "All API endpoints must return structured error responses with acode,message, anddocsfield" - A
patterntaggedvalidation: "Use the FormValidator class for all input validation. Never validate inline in the controller." - A
warningtaggedapi: "The rate limiter middleware must be applied before validation middleware in the route stack"
The agent loads these context entries because the task tags match, then applies the rules and patterns while working the task. The work follows project conventions automatically.
Managing the Loop
Cancel the loop
cancel the task checking loop
Or reference the job by ID (shown when you list scheduled tasks):
cancel job abc12345
Adjust the interval
Cancel the existing loop and create a new one with a different interval:
cancel the task loop
/loop 15m check for new open tasks and work through them, add notes and change status to review when complete. Search context before starting work. Make notes detailed.
Pause without cancelling
If you need the agent's full attention for something else, you can cancel the loop, do your work, and restart it when you're done. The tasks will still be in the queue waiting.
Session-Scoped vs Persistent Scheduling
The /loop command is session-scoped. When you close the terminal or exit Claude Code, all scheduled tasks stop. This is fine for active development sessions where you're at your machine.
For longer-running automation (overnight work, weekend tasks), use Claude Code's persistent scheduling options:
Cloud scheduled tasks run on Anthropic's infrastructure. They don't require your machine to be on. Set one up with:
/schedule every 30m check for open tasks on minolith and work through them
Desktop scheduled tasks run on your machine but persist across session restarts. Set them up in the Claude Code Desktop app under the scheduling interface.
Both options inherit your MCP configuration including the X-Minolith-Agent header, so task assignment filtering works the same way.
What This Replaces
Without this workflow, the typical process is:
- Open Claude Code
- Think about what needs doing
- Tell the agent what to work on
- Wait for it to finish
- Tell it the next thing
- Repeat until you're done
- Tomorrow, start from scratch
With Tasks and /loop:
- Plan work in the dashboard (create tasks with descriptions and priorities)
- Start the loop
- Do something else
- Review completed work when you're ready
- Send back what needs changes
- The agent handles the rest
The planning and review happen in the dashboard. The execution happens autonomously. The coordination happens through task notes. No conversation required for the work itself.
Reference
Minolith Tasks API: docs.minolith.io/api/tasks
Claude Code /loop documentation: code.claude.com/docs/en/scheduled-tasks
Key MCP tools used in this workflow:
| Tool | Purpose |
|---|---|
bootstrap |
Load agent identity and assigned tasks at session start |
get_my_tasks |
Get tasks assigned to the calling agent, grouped by status |
get_task |
Get a single task with all notes |
update_task_status |
Move a task to a new status (e.g., review, done) |
add_task_note |
Add a note to a task (progress update, commit link) |
get_team_feed |
See what the team (agents and humans) has been doing |
Built by Minolith. Persistent project memory for AI coding agents.