Skip to content

Agent Instructions

An AI agent connected to Clarive knows the product: its tools, their parameters and the help docs. What it does not know is your installation: which category to use for a bug, which status starts a deploy, which rule builds the job, who approves a release to PROD, what is particular to each project. Every installation is different.

Agent Instructions tell it. They are short Markdown texts, called snippets, that describe how your installation is set up and used. A snippet is either global or assigned to one or more projects, and has a category (Workflow, Topics, Deploying / Ship, Rules, Security & Approvals...). An agent writes them for you from the configuration, or you write them by hand in Admin > AI > Agent Instructions (see Agent Instructions).

They are instructions for using Clarive. How to code in a repository stays in that repository's own AGENTS.markdown or CLAUDE.markdown.

What agents are told

When an MCP client connects, the server's instructions (what the client receives on initialize) depend on the installation and on the user:

Situation Every user Users who prepare the instructions
Agent Instructions are off nothing nothing
There are active snippets read them before working on a project the same
Never marked as prepared nothing more a warning: not prepared yet
Prepared, then the configuration changed nothing more a warning listing what changed (if Warn when the Clarive configuration changes is on)

The warnings only go to sessions that can write: not to read-only tokens or read_only MCP connections. Connections whose namespaces leave out ai get no notice at all, and compact ones are told to use clarive_call.

The users who prepare the instructions are the ones with the permission Prepare the AI Agent Instructions (action.ai.instruction_setup), for example administrators. The permission lets them read the configuration map of the whole installation (every project, rule, category and role), whatever their project roles, so give it to administrators only.

With a warning, the agent asks before doing anything else:

Prepare Clarive AI Instructions now, this operation will take a few minutes?

If the user agrees, the agent calls ai_setup_guide and follows it. The guide tells it to:

  1. read the configuration map (ai_config_map);
  2. read the rules that matter;
  3. look at a few recent topics and jobs;
  4. write the snippets (ai_save_snippet);
  5. finish with ai_mark_designed.

If the user says no, the agent goes on with what it was asked, and the warning comes back on the next connection.

Short instructions on purpose

Everything an agent reads goes into its context and costs tokens, every time. So the guide asks for snippets written like a note from a colleague: a title that says what to do, then one to six short lines with the real names of the installation. For example:

title: New work: topic first, then its branch
category: workflow
global: true
body:
  - Create a Feature or Bugfix topic in the project, Release in = the current release topic.
  - Move it to In Progress: that creates its git branch. Never push a branch made locally.
  - Work on that branch, rebased on the current release branch, so it merges cleanly.

ai_setup_guide (and ai_examples) return a handful of complete examples like this one, from an imaginary installation. The agent copies their shape and length, not their names. A snippet can be 4000 characters at most. Past 800 characters, ai_save_snippet answers with a hint that asks the agent to split or trim it. ai_instructions and ai_budget give the cost in tokens; ai_budget also gives a target for a project's instructions (2000 tokens), a guideline rather than a limit.

ai_config_map leaves out empty fields. In installations with more than 50 projects it groups them by pipelines and environments; projects: [names] gives the description and repositories of some, and detail: true every project in detail however many there are (the admin page lists them all).

Configuration changes

When the instructions are marked as prepared (ai_mark_designed), Clarive keeps a snapshot of the configuration:

  • rules
  • categories, with their workflows and fields
  • statuses
  • environments
  • projects

When any of them is added, changed or removed afterwards, the users who prepare the instructions get a warning that lists the changes, for example:

- Rules: 1 changed (Deploy Web); 1 added (Nightly Backup)
- Statuses: 1 changed (In Review)

The agent then asks "Update Clarive AI Instructions now, this operation will take a few minutes?". If the user agrees, it calls ai_setup_guide with update: true, which lists every change. The agent updates only the snippets those changes affect, then calls ai_mark_designed again. An administrator can also mark the instructions as up to date in the admin page, after checking them.

Snippets edited by hand

A snippet written or changed by a person in the admin page is marked as edited by hand. An agent can't change or delete it unless it passes overwrite_hand_edits: true, which the guide tells it to do only after the user agrees. Without that flag, the call fails with a conflict that says who edited the snippet and when.

The operations

Operation MCP tool CLI Who
ai.instructions ai_instructions clarive ai instructions [project] every user
ai.status ai_status clarive ai status preparers
ai.setup_guide ai_setup_guide clarive ai setup-guide preparers
ai.config_map ai_config_map clarive ai config-map preparers
ai.list_snippets, ai.get_snippet ai_list_snippets, ai_get_snippet clarive ai list-snippets preparers
ai.save_snippet, ai.delete_snippet ai_save_snippet, ai_delete_snippet clarive ai save-snippet preparers
ai.mark_designed ai_mark_designed clarive ai mark-designed preparers
ai.reset_design ai_reset_design clarive ai reset-design preparers
ai.set_settings ai_set_settings clarive ai set-settings preparers
ai.examples ai_examples clarive ai examples preparers
ai.budget ai_budget clarive ai budget preparers

ai.instructions returns the global snippets plus the ones of the given project as one Markdown text. Users only get the projects they can see. Without a project, it returns the global snippets and the list of projects that have their own.

Agents using the CLI

An agent that drives Clarive through the clarive CLI doesn't receive the MCP server's instructions. If the user can prepare the instructions and the token can write, the server sends one line with every command's answer, and the CLI prints it on stderr, where agents read it. Stdout keeps the command's output.

CRITICAL: the AI Agent Instructions of this Clarive installation are not prepared. Ask the user: "Prepare Clarive AI Instructions now, this operation will take a few minutes?" If yes, run: clarive ai setup-guide

After a configuration change the line says what changed and to run clarive ai setup-guide --update. Nobody else gets the line, and neither do read-only tokens, web sessions or clarive ai ... commands. It disappears when the instructions are prepared or turned off. Scripts that must keep stderr empty can set CLARIVE_NO_NOTICE=1.

Agents connected through clarive mcp get the MCP notices: the bridge keeps the server's MCP session, so the notice still comes once per session.

To make sure CLI agents read the instructions, tell them to run clarive ai instructions <project> before working on a project, for example with a line in the repository's AGENTS.markdown.