Directive.md -- Persistent Agent Instructions
Directive.md is a special file that lives at /Directive.md in the root of an agent's filesystem. When present, its content is automatically injected into the...
Directive.md is a special file that lives at /Directive.md in the root of an agent's filesystem. When present, its content is automatically injected into the agent's system message on every request. Think of it as a CLAUDE.md or Soul.md for your agent -- a persistent instruction file that shapes how the agent behaves across all conversations.
How it works
- The agent's filesystem must be enabled (see Enabling an Agent's Filesystem).
- When you first enable the filesystem, a starter
/Directive.mdis created automatically with a table of contents template. - On every request, the system reads
/Directive.mdand injects its content into the agent's system message. - Changes take effect immediately -- if the agent edits
/Directive.mdviafs_writeorfs_edit, the very next message in the same conversation uses the updated instructions.
Structure
Directive.md uses a file-based table of contents, similar to how CLAUDE.md works. Directive.md itself is the index, and each topic links to a separate file:
# Directive
## Usage
- Only this file (/Directive.md) is injected into the system prompt.
Linked files are reference material you can read with fs_read.
- Edit this file with fs_write or fs_edit.
- Add new entries to the table of contents as you create new files.
- Remove entries you do not need.
## Table of Contents
- [Identity](/instructions/identity.md)
- [Rules & Constraints](/instructions/rules.md)
- [Domain Knowledge](/instructions/domain.md)
- [Workflows & Procedures](/instructions/workflows.md)
- [Tools & Integrations](/instructions/tools.md)
- [Style & Formatting](/instructions/style.md)
- [Memory & Context](/instructions/memory.md)
Only /Directive.md is injected into the system prompt. The linked files are reference material the agent can read with fs_read when it needs the detail. This keeps the system prompt focused while letting you store extensive reference material in the filesystem.
What to put where
In Directive.md (injected every request):
- Identity, role, and tone -- kept brief
- Hard rules and constraints
- Short summaries and pointers to detailed files
- The table of contents
In linked files (read on demand):
- Detailed workflow procedures
- Large reference tables or domain data
- Style guides and formatting templates
- Running memory logs
Example
A research agent might have:
/Directive.md:
# Directive
## Usage
...
## Table of Contents
- [Identity](/instructions/identity.md)
- [Research Procedure](/instructions/research-procedure.md)
- [Source Policy](/instructions/sources.md)
- [Output Format](/instructions/format.md)
- [Completed Reports](/log/completed.md)
You are a senior market research analyst specializing in SaaS companies.
Never share customer PII in responses. Always anonymize names in examples.
/instructions/research-procedure.md:
# Research Procedure
1. Check /data/ for cached data before making new queries.
2. Prefer primary sources (SEC filings, earnings calls) over secondary analysis.
3. Save all research drafts to /drafts/ before finalizing.
4. Log completed analyses in /log/completed.md.
/instructions/format.md:
# Output Format
- Use structured markdown with headers for all reports.
- Include a "Key Findings" summary at the top of every report.
- Always note the date of data collection.
- Use tables for any comparison data.
The agent can update its own instructions
Because Directive.md and linked files are regular files in the agent's filesystem, the agent can read and modify them using fs_read, fs_write, and fs_edit. This means:
- You can ask the agent to add new rules: "Add a rule to your Directive.md that all currency values should be in USD."
- The agent can learn from corrections: "That output format was wrong. Update your format instructions to always use tables for comparison data."
- You can ask the agent to show its current instructions: "Read your Directive.md and tell me what rules you follow."
- The agent can create new instruction files and link them from the table of contents.
- Changes to Directive.md are picked up immediately -- no need to start a new chat.
Size limit
Directive.md content is capped at 100 KB when injected into the system message. If the file exceeds this limit, only the first 100 KB is used. This is why detailed material should go in linked files -- Directive.md stays lean and within the limit, while the agent reads linked files on demand.
Directive.md vs. the system message
The agent's system message (set in the agent edit page) and Directive.md serve complementary purposes:
| System Message | Directive.md | |
|---|---|---|
| Set by | Users via the agent edit page | The agent itself (or users through the agent) |
| Editable by the agent | No | Yes |
| Persists across chats | Yes | Yes |
| When changes apply | Immediately | Immediately |
| Best for | Initial identity, core capabilities | Evolving rules, learned preferences, workflow state |
Both are included in the agent's context. The system message comes first, followed by Directive.md content.
Troubleshooting
Directive.md is not taking effect
- Verify the filesystem is enabled for the agent.
- Check that the file is at exactly
/Directive.md(case-sensitive).
Directive.md content seems truncated
- The injection cap is 100 KB. Move detailed reference material into linked files and keep Directive.md as a concise index.