Flint

What fills the AI agent context window and how Flint handles it

Every call to a language model sends the whole conversation again, so a session that has run for an hour costs more per turn than one that just started.

Short answer: The AI agent context window fills because every model call resends every prior message, tool result and file content from the session. Flint keeps long sessions usable with three mechanisms: context swap moves large and old tool results to disk and reads them back on demand, tool search loads only the tools the model asks for, and compression reduces what remains in the window. One switch, /spend, controls how early each mechanism engages.

Why a long session gets expensive

A turn is one request you type and everything the agent does to answer it. The answer is usually many steps, and each step is a call to the model. Every one of those calls sends the conversation so far: your messages, the model's replies, every tool result, every file Flint read. The provider bills the input it receives, so the tenth step of a turn pays for the first nine as well.

Nothing here is specific to Flint. It is how chat-style model APIs work. What you can control is how much of that history is still in the window when the next call goes out, and Flint has three mechanisms for it:

  • Tool search keeps the tool list out of the context until the model asks for a specific tool. When many MCP tools are connected, that list is large, and it would otherwise be resent on every call.
  • Swap moves big and old tool results, and old turns, to the session folder on disk. One line stays in their place, and the agent reads them back when it needs them.
  • Compression reduces what remains in the active window.

Swap is on by default, and the promise it makes is narrow enough to check: a tool result is never cut. It is whole, or it is in swap. Nothing is quietly dropped to make the numbers look better.

The footer is where you watch this. It shows the model, the cost, the context size, the care level and the spend level on every turn.

Tip: Check the footer's context size number at the start of a long session, before it gets expensive.

What swap looks like in a real session

Say you ask Flint to add a small feature to an existing project. Over a few turns it reads four source files, runs the test suite, edits two files, and runs the tests again.

Each file read enters the conversation as a tool result. A test run or a build command produces far more text than that. After three or four turns, the old file contents and the old shell output are the largest part of what gets resent on every call, and most of it has nothing to do with the step the agent is on.

Swap finds those results, picks the ones that are large and old, writes them to the session folder, and leaves a single line in their place in the conversation. The result is still on disk, whole. When the agent needs it again, a file it read three turns ago, it reads it back from disk and works from the full text, not a shortened version.

You can confirm it is working from the receipt printed at the end of each turn: tools used, files changed, tokens in, tokens out, time and cost. If tokens in rises turn after turn, the active context is still growing. If it holds roughly steady, swap and compression are doing their job. /budget shows the cumulative spend for the session.

How to control context in a running session

  1. Glance at the footer before you start a long task. It shows the context size and the spend level, so you know the state you are starting from.
  2. Run /spend to see and change the spend mode. Economy starts context management earliest, normal is the default, and generous starts it latest. If you expect a long session, set economy at the start rather than after the cost has climbed.
  3. Read the receipt after each turn. Tokens in is the number to watch: rising across turns means the active context is still growing, steady means swap and compression are holding it.
  4. Run /budget to see what the session has cost so far, then decide whether to keep going or start fresh.
  5. Run /new when a task is complete. A fresh session starts with an empty context, which is cheaper and faster than carrying the old one forward. Use /resume to return to a session saved earlier.

Mistakes that let context grow without limit

Warning: Setting /spend to generous for an all-day session means context management starts late, so costs climb before swap and compression engage. For a long session, start with economy or normal.

Free mode works, and /model free lists the free models that can call tools, with speed and uptime from OpenRouter's public stats. Two things to know before you point a long task at one. Free models are weaker and often rate-limited, and a large context makes every call slower, so the rate limit is more likely to bite in the middle of the work. The list of free models changes without notice.

Warning: Do not confuse /rewind with /new. /rewind undoes file changes made during the session. It does not clear the context. To start with a clean context, run /new.

Frequently asked questions

Does Flint lose anything when it swaps old results to disk?

No. The tool result is written to the session folder whole, and the agent reads it back when it needs it. What stays in the conversation is a single line in its place, not a summary of the content.

What is the difference between swap and compression?

Swap moves specific large and old results out of the conversation and onto disk intact, so they can be read back on demand. Compression reduces what remains in the active window. The two are complementary, and /spend sets how early each of them starts.

How do I see how much context the session is using?

The footer shows the context size on every turn. The receipt at the end of a turn shows tokens in and tokens out, which is the more useful pair over a long task, because tokens in is what grows as the context grows.

Can I use free models for long sessions?

You can, but go in with the trade-off in view. Free models are weaker and often rate-limited, and a large context makes each call slower, so a limit is more likely to interrupt a long run. /model free shows what is available now, with speed and uptime from OpenRouter's public stats. The list changes, so check it before a long task rather than after.

If I start a new session with /new, do I lose the edits Flint made to my files?

No. /new clears the session context, and the edits Flint already wrote to disk are untouched. /rewind is the command that undoes file changes made during a session, so reach for that one if undoing edits is what you want.

Where to go next

Set up Flint covers the install, the provider choice and the first task.