Managing Agent Context with Folders
One of the most important shifts when moving from a chat interface (like ChatGPT) to an agent like Cosine is understanding context persistence. In a chat, every conversation starts from zero. With the Cosine CLI, your agent’s memory lives on disk — inside folders.
Folders as Projects
Section titled “Folders as Projects”Think of each folder on your machine as a project for a specific agent. When you run cos inside a folder, the agent can read everything in that directory. Any research it saves, notes it writes, or files it creates become part of its persistent context for all future sessions in that folder.
This means:
- You can close the CLI and come back days later.
- The agent picks up exactly where it left off.
- You don’t have to re-explain your preferences or context every time.
Setting Up a New Agent Folder
Section titled “Setting Up a New Agent Folder”-
Create a folder for your project:
Terminal window mkdir ~/social-postscd ~/social-posts -
Run
cos initto create anagent.mdfile in that folder:Terminal window cos initThe
agent.mdfile defines the rules, persona, and behaviour for the agent whenever you work in this folder. Think of it as the agent’s standing instructions. See Quickstart if you haven’t set up the CLI yet. -
Open the CLI inside that folder:
Terminal window cos
The agent is now configured for this specific project context. Any work it does — research files, notes, drafts — will be saved here and available in every future session.
Telling the Agent to Save Its Research
Section titled “Telling the Agent to Save Its Research”A key technique for maximising future value is explicitly instructing the agent to persist its work to disk. For example:
“During research, save your findings as
.mdfiles in this folder so I can retrieve them later.”
You can add this instruction directly to your agent.md, so the agent always does this automatically — you never have to ask again.
Key Takeaways
Section titled “Key Takeaways”- Each folder is a self-contained agent with its own memory and context.
cos initcreates anagent.mdthat defines the agent’s behaviour for that folder.- Saving research and notes to disk means your context accumulates over time rather than resetting.
- When you return to a folder weeks later, the agent remembers everything.