Instructions file for your agent
Coding agents read a file of standing instructions from your repository at the start of every session: CLAUDE.md for Claude Code, AGENTS.md for Codex and most other tools. A short Flow section in that file is the biggest single improvement to how an agent works with Flow. It claims the right work, checks it before submitting, attaches what reviewers need and asks instead of guessing.
This page gives you a template to paste in and adapt.
What goes where
An agent working in Flow gets instructions from three places. Put each rule in the one that fits, and don't repeat it in the others.
| Layer | Who writes it | Put here |
|---|---|---|
| The task's contract | Whoever writes the task | What this task needs: acceptance criteria, expected outputs, context |
| Working agreement (Agent rules, Team plan) | Project admins, in Flow | Rules for every agent in the project, in any repo. For example: Keep pull requests under 400 lines. Never change database migrations. |
| Instructions file (this page) | Your team, in the repo | How to work in this codebase: branch names, the commands that check the work, how to format outputs, what never to touch |
Flow already sends the contract and the working agreement with every task it hands out, and the MCP server explains the basic loop to the agent. Your instructions file doesn't need to repeat them. It adds what only the repo knows.
Which file your tool reads
Keep the instructions in AGENTS.md, so every tool shares one copy. Point tool-specific files at it where your tool needs one.
| Tool | Reads | Set up |
|---|---|---|
| Claude Code (and the always-on agent, which runs it) | CLAUDE.md |
Put @AGENTS.md on a line of its own in CLAUDE.md to include it |
| OpenAI Codex | AGENTS.md |
Nothing more |
| Cursor | AGENTS.md, or rules in .cursor/rules/ |
Nothing more |
| GitHub Copilot (VS Code agent mode) | .github/copilot-instructions.md |
Paste the section there, or turn on AGENTS.md support in VS Code settings |
| Gemini CLI | GEMINI.md |
Paste the section there, or set contextFileName to AGENTS.md |
| Windsurf | .windsurf/rules/ |
Add a rule file with the section |
| Claude Desktop | Project instructions (no repo file) | Paste the section into the project's instructions |
File names change as tools evolve, so check your tool's docs if one doesn't pick up the file. Most also read a personal, global file (for example ~/.claude/CLAUDE.md). Keep team rules in the repo, where they're reviewed like code.
The template
Copy this into AGENTS.md. Replace everything in <angle brackets>, and delete the lines that don't apply to you.
## Work tracking: Hivantis Flow
Our work is tracked in Hivantis Flow, project <PROJECT_KEY>. Use the hivantis-flow MCP tools,
and always pass project="<PROJECT_KEY>".
### Getting work
- When asked to work on Flow tasks, call claim_next_task. If nothing is waiting, say so and stop.
Don't invent work.
- Read the whole contract before changing anything. Every acceptance criterion is a requirement.
Reviewer feedback and answers from earlier attempts come first.
- Stay inside the task. Sub-tasks and related tasks are separate work.
### Doing it
- Branch from <main>: agent/<task id in lower case>, for example agent/<PROJECT_KEY>-12 in lower case.
- Log a log_step for each meaningful step, one line each (use kind "tool_call" for commands you ran).
- Before submitting, run the checks for what you changed:
- <Tests: npm test / pytest -q / go test ./...>
- <Types and lint: npx tsc --noEmit and npx eslint <changed files>>
- <Migrations: python manage.py makemigrations --check --dry-run>
- Never claim a check you didn't run. If one can't run, say so in the summary.
### Handing it in
- Commit as "<TASK ID>: <what changed>", with a short body explaining why.
- <Push the branch and open a pull request against <main>. / Don't push. A person opens the PR.>
- Attach every expected output with attach_output:
- pr: the pull request URL
- commit: the commit URL, or "branch <name> @ <full sha>" if it isn't pushed
- test_report: the path of the saved test output, or a link to the CI run
- doc: write a Flow Docs page with create_doc_page (it attaches itself), not a file in the repo
- Then submit_run. In the summary, go criterion by criterion: how it's met and how you checked it.
It's shown as Markdown. Write: one line on the outcome; "## What I did" as a numbered list of
concrete steps; "## Acceptance criteria", one bullet per criterion with how you checked it; "## Checks"
with the commands you ran and their results. No wall of text.
Mention anything you're unsure about.
### When stuck
- A decision only a person can make: ask_human with one clear question and the options.
Keep working on anything that doesn't depend on the answer.
- Can't continue: commit what you have, then release_task saying what you're waiting for.
The task comes back with the answer.
- The task is bigger than its contract, or the contract looks wrong: release_task and explain why.
- Tests fail for reasons unrelated to your change: note it in the summary. Don't fix unrelated code.
### Never
- Mark a task done yourself, or edit a task's contract to make it easier.
- Approve your own work.
- <Touch: secrets and .env files, CI configuration, database migrations, vendored code>
Then add your repo's own conventions under it, such as code style, where the tests live and how to run the app. That's what helps the agent most once it's in the code.
Agents that run unattended
When a task starts an agent without anyone watching (always-on agent, webhooks or your own loop), nobody is there to answer in the chat. Add:
### Running unattended
- Nobody reads this session. Talk to people only through ask_human, add_comment and the run summary.
- Don't wait for an answer: ask_human, then carry on with anything else in the task, or release_task.
- One task per session. When it's submitted or released, stop.
- If a command is refused, use a simpler form instead of working around it, and mention the refusal
in the summary.
Limit what the agent can run with your tool's own permission settings as well, for example --allowedTools in the always-on agent's --exec command. An instructions file guides the agent; permissions enforce the limits.
Review agents
If a project uses an agent to review runs first (Project → Settings → Agent work), give it its own section:
## Reviewing runs in Hivantis Flow (project <PROJECT_KEY>)
- Call list_runs_to_review, then get_run for each run.
- Judge each acceptance criterion on the evidence: the outputs, the logged steps, and the code itself.
An unproven criterion isn't met.
- Approve only when every criterion is met. Otherwise request changes, untick the unmet criteria,
and say exactly what's missing.
- Run the checks yourself where you can: <npm test / pytest -q>. Never approve because the summary
says the tests pass.
A person still confirms or overrides each decision from the Inbox.
Tips
- Keep it short. Agents follow a page of clear rules better than five pages of advice. Put long references in a doc and link it.
- Use the real tool names (
claim_next_task,attach_output…). Agents match them exactly. What agents can do lists them all. - Test it. Ask the agent "What will you do when the tests fail for a reason that has nothing to do with your task?" and check that its answer matches your file.
- Change it when reviews repeat themselves. If you request the same change twice, it belongs in the instructions file or the working agreement.
- Never put secrets in it. The API key goes in the MCP config's environment (
FLOW_API_KEY), never in an instructions file.