---
title: "Local agent CLI instructions"
audience: "Operators who use Claude Code / Codex / Gemini CLI / Cursor / Cline / Aider / Grok-Coder in a MeshKore project, and want a single source of truth instead of N hand-maintained instruction files."
status: stable
updated: 2026-06-09
---

# Local agent CLI instructions

You run AI agent CLIs in your project (Claude Code, Codex, Gemini
CLI, Cursor, Cline, Aider, Grok-Coder, …). Each one reads a
different file for your project's rules — `CLAUDE.md`, `AGENTS.md`,
`GEMINI.md`, `.cursor/rules/*`, `.clinerules`. Hand-maintaining N
files is a path to drift.

Standard §17 (v18+) fixes this with **one canonical source and a
daemon-managed render**.

## The single source

```
.meshkore/public/AGENT_INSTRUCTIONS.md
```

Two regions, marked with HTML comments:

```text
<!-- MESHKORE_PREAMBLE_BEGIN — managed by the daemon, do not hand-edit -->
... a verbatim copy of https://meshkore.com/standard/agent-instructions.md ...
<!-- MESHKORE_PREAMBLE_END -->

<!-- OPERATOR_CONTENT_BEGIN — this is your project. Edit freely. -->
... your project's rules ...
<!-- OPERATOR_CONTENT_END -->
```

The daemon owns the preamble block — it refreshes it whenever the
standard version bumps. **You own the operator block** — it survives
every refresh, untouched.

## What the daemon does for you

On either of these triggers:

- Standard version bump (`STANDARD_VERSION` < canonical online), or
- You edit `.meshkore/public/AGENT_INSTRUCTIONS.md`,

the daemon writes the full content of `AGENT_INSTRUCTIONS.md` (both
blocks) to each render target at the repo root, with a one-line
auto-render header. Mandated targets in v18:

| File | Audience |
|---|---|
| `CLAUDE.md`  | Claude Code (Anthropic) |
| `AGENTS.md`  | Codex / Aider / general convention |
| `GEMINI.md`  | Gemini CLI (Google) |

Mandated from v19 (optional in v18):

| File | Audience |
|---|---|
| `.cursor/rules/meshkore.mdc` | Cursor (Anysphere) |
| `.clinerules` | Cline (VSCode extension) |

## What goes in the preamble (you don't touch this)

The canonical preamble at
<https://meshkore.com/standard/agent-instructions.md> includes:

- Pointer to `.meshkore/public/RESOURCES.md` (network resources from
  §16).
- The canonical standard URL + how to upgrade.
- Folder-layout invariants (`public/` committed, tasks under
  `modules/<m>/tasks/`, logs under `log/`).
- Commit-attribution rule (§9.1).
- Standard-evolution protocol pointer.
- Brief mention of the mesh primitives the agent can call (Oracle,
  hub, `meshkore.com/agent/<id>` pattern).

Updates flow centrally. When the standard bumps and the preamble
changes, every cluster on the network picks it up on next refresh.
No coordination needed from you.

## What goes in the operator block (you own this)

Anything project-specific:

- Coding conventions ("use 2-space indent", "no `any` in TypeScript").
- Test rules ("run `make test` before committing").
- Deploy boundaries ("never push to main without operator approval").
- Security rules ("never commit anything under `credentials/`").
- Project map ("the api/ folder is Rust; the webapp/ folder is
  static HTML; …").

The daemon ships this block into every rendered file unchanged. All
your agent CLIs will see the same project rules.

If you outgrow a single block, the standard lets you keep it under
8 KB without warnings — most CLIs truncate context past that.

## Example: a minimal `AGENT_INSTRUCTIONS.md`

```markdown
<!-- MESHKORE_PREAMBLE_BEGIN -->
(daemon fills this in — leave empty on first creation)
<!-- MESHKORE_PREAMBLE_END -->

<!-- OPERATOR_CONTENT_BEGIN -->

# My project

This is a Next.js + tRPC project that deploys to Fly.io.

## Rules for any AI agent working here

- Always run `pnpm typecheck` before committing.
- Never edit `pnpm-lock.yaml` by hand.
- The `api/` folder is server-only — never import anything from it
  into `app/`.

<!-- OPERATOR_CONTENT_END -->
```

After the daemon's next refresh, `CLAUDE.md`, `AGENTS.md`,
`GEMINI.md` at the repo root will all carry both blocks.

## When you should hand-edit a rendered file

**Never.** Rendered files are derived artifacts. Hand edits are
overwritten on next refresh. If you find yourself wanting to edit
`CLAUDE.md` directly, edit `.meshkore/public/AGENT_INSTRUCTIONS.md`
instead and let the daemon re-render.

The exception: if the daemon isn't running (manual repo bootstrap,
operator working offline), you may render by hand — copy
`AGENT_INSTRUCTIONS.md` to each target with the auto-render header.
The daemon will reconcile on next start.

## Verification

```bash
# Source exists with both markers.
test -f .meshkore/public/AGENT_INSTRUCTIONS.md
grep -q "MESHKORE_PREAMBLE_BEGIN" .meshkore/public/AGENT_INSTRUCTIONS.md
grep -q "OPERATOR_CONTENT_BEGIN"  .meshkore/public/AGENT_INSTRUCTIONS.md

# Rendered targets exist and match (modulo the leading comment).
for f in CLAUDE.md AGENTS.md GEMINI.md; do
  test -f "$f" || { echo "missing $f"; exit 1; }
  diff <(tail -n +2 "$f") .meshkore/public/AGENT_INSTRUCTIONS.md \
    > /dev/null || { echo "$f drifted from source"; exit 1; }
done
echo "ok — all agent CLI files in sync with the source"
```

## TL;DR

```
Edit:    .meshkore/public/AGENT_INSTRUCTIONS.md    (you own OPERATOR_CONTENT)
Read:    CLAUDE.md · AGENTS.md · GEMINI.md         (rendered, do not hand-edit)
Source:  https://meshkore.com/standard/agent-instructions.md (the preamble, owned by the standard)
Spec:    https://meshkore.com/standard#17-local-agent-cli-instructions-v18
```

One file. Every agent CLI. Compatibility for free.
