Skip to main content

Context

Every agent reply is based on context — the text the model receives in that moment: your messages, open files, tool results, rules, and earlier turns. Context is the agent's working memory. It is powerful but not unlimited. This lesson explains what that means in 4RGE and how to work with it without micromanaging every file.

What this page is for

You want to…This page helps you…
Understand "context"Plain language — not a token math lecture
See what countsChat, files, tools, rules — what fills the window
Know when things get compressedWhy very long threads behave differently
Attach the right materialWhen to @ a file vs let the agent search
Stay accurate on big tasksWhen to continue vs start fresh
Part of 4RGED Learn

Pair with How AI models work and Tokens & pricing. For day-to-day @ mentions and the context ring in the app, see Prompting.

Who this page is for

You are…Focus on
New to AI codingWhat context means → Attach what matters
Daily developerHabits that keep context useful
Team leadShare habits; tie long threads to review quality
AdminContext drives usage — see Usage & billing

What context means

Context is everything the model reads before it answers. The model does not silently know your whole repo — it only works with what 4RGE puts in the prompt for that run.

IdeaPlain meaning
Working memoryRecent chat, files you attached, and tool output the agent just fetched
Fixed windowEach model has a maximum size; when it fills, something has to give
Not the same as "index"Search and tools can pull in files on demand — that still becomes context when used
Shared with costBigger context usually means more input tokens — Tokens & pricing

Think of context like desk space: you can spread out plans, logs, and notes — but only so much fits before you shuffle papers or start a clean pile.

What fills the window

In a typical 4RGE agent chat, context grows from several sources:

SourceWhat it isYou control it by…
Your messagesPrompts, follow-ups, clarificationsKeeping one clear goal per thread
Agent replies & tool outputDiffs, search hits, terminal logsNarrowing scope; approving only needed commands
Attached files & foldersWhat you add with @Mentioning only what matters — Prompting
Project rules & skillsTeam conventions injected automaticallyKeeping rules focused (admins / leads)
System & tool definitionsBuilt-in instructions and available toolsUsually fixed — grows with plugins and MCP

In the desktop app, the context ring next to the chat input shows how full the window is. Click it for a breakdown by category (conversation, rules, tools, summarized history, and more). You do not need to optimize every slice — use it when a run feels slow, forgetful, or expensive.

When the window fills up

When a conversation approaches the model's limit, 4RGE compresses older turns into a summary so new messages still fit. That keeps the agent running, but fine detail from early in the thread can fade.

SignalWhat to do
Agent forgets an earlier constraintRestate the rule in one line, or start a new run with a short recap
Repeating the same mistakesFresh conversation often beats another "remember when…" message
Context ring nearly fullFinish the current sub-task, then new run for the next piece
Huge tool outputAsk for a narrower command or point at one file instead of pasting everything

Compression is normal — not a bug. It is why short, focused threads often outperform one marathon chat for a whole feature.

Attach what matters

You have two good patterns — often combined:

You know…Do this
Exact files@ mention them — see Prompting
Area of the repo, not the pathDescribe the goal; let the agent search and read what it needs
Prior chat contextReference a past conversation when the product supports it
Visual or terminal evidenceAttach screenshots, diffs, or terminal output instead of retyping

More attachments is not always better. Irrelevant files can confuse the model the same way a cluttered desk makes it hard to find the right note. When exploratory work is enough, a clear sentence ("find where we validate JWTs") beats tagging half the monorepo.

Habits that keep context useful

  1. One main task per conversation — planning, implement, and polish can be separate runs.
  2. Say what "done" looks like — less back-and-forth means less context churn.
  3. Start fresh when you switch features — carry over a three-line summary, not the whole thread.
  4. Use @ for anchors, search for discovery — match the pattern in Prompting.
  5. Watch the context ring on long jobs — if quality slips, split the work before tokens spike.
  6. Verify after big edits — compressed history makes hallucination more likely on edge cases.

Leads: if reviews show "the agent forgot X from message 3," treat that as a context workflow issue — shorter runs and explicit acceptance criteria — not only a model problem.

Where to go next

Your goalNext step
@ mentions & context ring UIPrompting
Why long runs cost moreTokens & pricing
Model basicsHow AI models work
Trust but verifyHallucination & limitations
Run your first agentQuickstart

Questions about context?

QuestionAnswer
Does the model see my entire repo?No — only what search, tools, and you attach put in context.
Why did the agent "forget" something?Long threads get summarized; details drop off. Restate or start fresh.
Should I @ every related file?Only when you know they matter — otherwise describe the goal and let the agent search.
Does a fuller ring always mean higher cost?Usually yes for input tokens — see Tokens & pricing.
Is compression the same as deleting chat?No — work continues, but early detail may live only in summary form.
Where is the breakdown in the app?Click the context ring — Prompting.