# Stop Re-Explaining Your Project to Your AI Every Single Morning

> If you paste the same project context into your AI agent every day, you are doing it wrong. A guide to AGENTS.md, template variables, commands and prompts.

I used to start every session the same way: "This is a Rust project. We use the repository pattern. Don't touch the generated files. Run `cargo fmt` before you finish. The API lives in `src/api`." Every. Single. Time. Like introducing myself to a colleague with amnesia.

At some point I realized I was doing the AI's onboarding by hand, daily, for free. Octomind has a whole layer designed to kill that ritual — project context the agent loads automatically and keeps through even the longest sessions, plus reusable commands and prompts so you stop retyping the same instructions. Set it up once, and you never have to give that speech again.

## One File That Does the Onboarding for You

Octomind auto-loads **`AGENTS.md`** from your project root as a user message at the start of every new session — following the [AGENTS.md standard](https://agents.md), so it's the same file your other AI tools already read. No config, no flag: if the file exists, it's loaded. This is your project's orientation, the same material you'd give a new hire on day one:

```markdown
# Project: Acme API

- Rust workspace. API in `src/api`, domain logic in `src/domain`.
- We use the repository pattern. Don't put DB queries in handlers.
- Generated files in `src/gen/` are off-limits — never edit them by hand.
- Run `cargo fmt` and `cargo clippy` before declaring work done.
```

Drop that in your repo root and every session starts already knowing your conventions. (If this looks familiar, it's the same idea as a project README for humans — except the agent actually reads it every time.)

One detail matters more than it looks. The file is injected wrapped in `<instructions>` tags, and Octomind's context compression treats that message as its **anchor** — when a long session gets compressed to stay affordable, the instructions are kept, not summarized away. Rules can drift out of a model's attention as a conversation grows — that's the [context rot](https://octomind.run/blog/what-is-context-rot) problem — but they can't silently vanish from the context: the conventions you set before message one are still literally present at message fifty.

## Let the Agent Read Its Own Environment

Half of what I used to type was just facts about the machine and repository: the working directory, the branch, the git status. Octomind exposes those as template variables you can drop into a role's system prompt — or straight into `AGENTS.md` itself — and it fills them in at runtime:

| Variable         | Resolves to                              |
| ---------------- | ---------------------------------------- |
| `{{CWD}}`        | Current working directory                |
| `{{GIT_STATUS}}` | Git status (empty outside a repo)        |
| `{{GIT_TREE}}`   | Project file tree                        |
| `{{README}}`     | Your README.md contents                  |
| `{{CONTEXT}}`    | README + git status + git tree, combined |
| `{{SYSTEM}}`     | Date, shell, OS, available binaries, CWD |

So a role's system prompt can say `Working directory: {{CWD}}. Current state:\n{{GIT_STATUS}}` and the agent always knows where it is and what's changed — without you pasting `git status` output. Curious what these actually expand to on your machine? Check before you rely on them:

```bash
octomind vars --expand
```

The ones that depend on a git repo or a README resolve to an empty string when those don't exist, so prompts using them stay valid everywhere. Full list in the [Configuration doc](/docs/usage/03-configuration).

## Reusable Prompts: Stop Retyping the Same Request

You have prompts you send constantly — "review this for security," "write tests for this," "explain this module." Define them once as `[[prompts]]` and fire them by name:

```toml
[[prompts]]
name = "review"
prompt = """Please review the code above focusing on:
- Code quality and best practices
- Security considerations
- Performance implications"""

[[prompts]]
name = "test"
prompt = """Help create comprehensive tests:
- Unit test cases
- Edge cases and error conditions
- Integration test considerations"""
```

Then in any session, `/prompt review` queues that text as your next message. It's a small thing that compounds — the twentieth time you don't retype your review checklist, you feel it.

## Reusable Commands: Package a Whole Workflow

Prompts are text you send. **Commands** (`[[commands]]`) are whole orchestration steps you trigger with `/run`. The shipped config includes one — `reduce`, which compresses session history on demand:

```
/run            # list available commands
/run reduce     # compress the session to cut cost mid-task
```

You can define your own commands for repeatable multi-step actions — an analysis pass, a summarization stage, a reducer — each backed by a role with its own model and tools. They're the building block for turning "the way I always do X" into a one-word invocation. The mechanics — input/output modes, how commands map to roles — are in [Commands and Layers](/docs/usage/10-commands-and-layers).

## Organize Config by Concern

One more quality-of-life note. Your config doesn't have to be one monolithic file. Octomind merges every `*.toml` in the config directory, so you can split by concern:

```
~/.local/share/octomind/config/
  config.toml          # core settings
  mcp-github.toml      # the GitHub MCP server
  roles-custom.toml    # project-specific roles
```

Later files win on conflicts, and `mcp-*.toml` files load last as overrides — handy for layering a machine-specific tweak on top of a shared base. Run `octomind config --show` to see the merged, effective result, and `octomind config --validate` to catch mistakes before they bite.

## The Payoff

Set this up once per project and the daily ritual disappears. The agent opens already knowing it's a Rust repository with the repository pattern and off-limits generated files — and compression can't squeeze that knowledge out mid-session. `git status` is in the prompt without you pasting it. Your review checklist is `/prompt review`.

It took me twenty minutes the first time. I've saved that twenty minutes back roughly every day since. The agent stops being a colleague with amnesia and starts being one who actually remembers where they work.

**[Get Octomind](https://octomind.run)** — teach it your project once.
