Docs › Context

How context works

Attaching files with @, what the agent remembers, project rules, and how AstraCode keeps a long run from filling the window.

Attaching things

Type @ to attach a file, a folder, or the whole workspace. You can also drag files in from the explorer, or use the + button. Attachments appear as cards above the composer. The card shows the file's name, not its whole path.

Anything you highlight can be attached where you highlighted it, as a card, without copying and pasting:

WhereHowWhat the card says
The chatHighlight text in any answer or command output, then **Attach**.The first words and the line count.
The editorSelect lines, then **Add to chat** above the selection, or Opt+K (Alt+K).`receipt.ts#12-40`
The terminalSelect output, then Cmd+L (Ctrl+L), Opt+K (Alt+K), or right click and **Add to Chat**.`zsh · 12 lines`, with the command that printed them and its exit code when AstraCode can tell.
The Problems panelRight click a problem or a file, then **Add to Chat**.The problem, or every problem in that file.

@terminal attaches the last command in your terminal and its output; @problems attaches every error and warning the editor is showing. Text attached from the chat reaches the model marked as output to look at, not as instructions.

Project rules

A repository can ship conventions it wants followed, in AGENTS.md or .astracode/rules.md. They are read on every run in that project and layered under your own instructions. Rules are never read in a folder you have not trusted.

Memories

The agent can ask to remember a durable fact about your project: that the dev server runs on port 3001, say. Memories live outside the repository, keyed to the folder, and are never committed. You approve every one, and you can delete any of them from settings.

When the window fills

A long run accumulates a great deal of finished tool output: files read thirty steps ago, searches already acted on. Left alone that crowds out the work, and the steps that get dropped are the ones at the end: run the tests, check the build.

So two things happen automatically. At half the window, AstraCode clears finished tool results, keeping the twenty most recent intact; a cleared result says so, and the agent can re-run anything it needs. At 70%, the conversation is compacted into a summary. The first costs nothing and is tried first; the second costs a model call.

Both can be turned off: astracode.agent.contextEditing and astracode.compact.auto.

All documentation

Get started

Agent

Context

Workspaces

Connectors

Extending AstraCode

CLI

Reference