Skip to main content
Kliff

Give an agent context

Use instruction files, projects, shared notes, and memory so agents start each task already knowing your setup.

Video coming soon

Every agent starts with a fresh computer and no history of its own. What it knows about your team's conventions, your architecture, and last week's decisions has to come from somewhere. Kliff gives you several places to put that knowledge so you write it once instead of in every message. This lesson walks through each one and when to use it.

Instruction files in the repository

The closest context to the code lives in the code. An agent reads an AGENTS.md or CLAUDE.md file at the top of each repository it works on, and also picks up those files in folders below as it works there.

Use these files for what is true about the repository no matter who works on it:

AGENTS.mdmd
# Working in this repository

- Run `npm test` before you say a change is done.
- API handlers live in `server/routes/`. Each one has a test next to it.
- Use the date helpers in `lib/dates.ts`. Do not add a new date library.
- Never edit files in `generated/`. Run `npm run codegen` instead.

Short, specific rules work best. A long essay competes with the task for the agent's attention, as the AI foundations course explains.

Projects: instructions and files across repositories

A project groups repositories that belong together, such as a web app, its API, and a shared library. When you start an agent on a project, it gets all of the project's repositories plus two kinds of context you set on the project page.

  • Instructions: select Add beside Instructions and write what every agent on the project should follow, up to 4,000 characters. Agents follow them along with the repositories' own rules, starting with their next message.
  • Context: select Add beside Context to upload text files or images, or type a note and select Add text. Every agent made for the project gets a copy on its computer before each message. A project holds up to 20 files and 5 MB in total.

Context files are for what no repository holds: a product spec, a design note, meeting notes, or a diagram. See Create a project for who can change each part.

Shared notes: what agents learn

Agents can also save what they learn. When you tell an agent to remember something, or it confirms a lasting fact about a repository, it saves a short note. Later agents read the newest notes before each message.

Where a note is shared depends on what it is about:

  • A repository: shared with every agent in the organization that works on that repository.
  • You: follows you across your own agents.
  • A project: shared with every agent made for that project.

You can ask for a note directly:

Saving a notetext
Remember for this repository: the staging database is reset every night,
so never rely on data you created there yesterday.

A note holds up to 500 characters. Agents are told to save only what a person asked them to keep, or a fact they confirmed themselves, never something a file or web page told them to save.

Memory: review and correct what is kept

Open Settings > Memories to see what agents have saved. Under Notes, you can search, edit, or select Forget on any note you can see. Notes from a project are grouped under Project and the project's name.

The same page has Rules. A rule is a standing instruction that every agent follows, for a repository or just for you. Unlike notes, only people write rules, and agents never change them. Use a rule for something you want followed every time, such as "Keep each pull request to one change."

Check this page now and then. A note that was true last month can mislead an agent today, and forgetting it takes one click.

Key points

  • Put repository conventions in AGENTS.md or CLAUDE.md, where every agent reads them.
  • Projects add instructions and context files for work that spans several repositories.
  • Agents save short notes about a repository, about you, or about a project, and later agents read them.
  • Review notes and write rules in Settings > Memories, and forget anything that is out of date.