n8n Context Window Length: Messages vs. Model Tokens
The Context Window Length setting controls conversation history, not model capacity. Learn how to choose a useful value and check what the agent actually receives.
Updated 5 min read
In n8n, Context Window Length on Simple Memory means the number of previous interactions considered as conversation context. It does not set or enlarge the connected model’s token limit, which is the amount of text the model can handle in one request. Set the history length, then test the complete request that reaches your model.
A setting that works for short questions may fail when someone pastes a long document. fenbs can keep approved project decisions outside that conversation, so a person or supported connected assistant can prepare the relevant work context separately. fenbs does not connect to n8n.
How do you set and test the history length?
- Open the memory node attached to your AI Agent. Confirm which memory implementation you use before changing its settings.
- Set a session key that consistently identifies the intended conversation. Use separate test identities so unrelated users do not share a test history.
- Choose a small Context Window Length as a starting point. Write down the value, the model and the test messages so you can reproduce the result.
- Send a short sequence containing a harmless fact, several unrelated exchanges, and a final question about the fact. Inspect the memory and model input available in your execution details.
- Repeat with longer messages, tool results and any retrieved documents your real workflow uses. Increase history only when the added interactions improve a specific test.
The Simple Memory documentation (opens in a new tab) defines the setting in interactions and documents the Session Key parameter. Treat the observed messages sent by your installed workflow as the final check. A label alone cannot tell you how large those messages are.
Make the first test easy to judge. For example, say a fictional project uses the code word Cedar, then ask for that code word after a few turns. A correct answer is useful evidence, but inspecting the request is stronger: a model could guess a common word or answer from text supplied elsewhere.
Why are interactions different from tokens?
Tokens are pieces of text a model processes. An interaction is part of the conversation history selected by the memory component. Two interactions might contain a greeting and a short reply, or a long report and a detailed analysis. Equal interaction counts therefore do not mean equal token counts.
| Setting or record | What it controls | What it does not establish |
|---|---|---|
| Context Window Length | How much previous interaction history is considered | How many tokens the model accepts |
| Model context specification | The capacity documented for the chosen model and access route | How much history your workflow actually supplies |
| Session key | Which conversation the memory belongs to | Whether its content is current or approved |
Read what an AI context window contains for the underlying model concept. For your n8n test, account for the current question, instructions, selected history and other text added before the model answers. Leave room for the response according to the provider’s rules.
What should stay outside rolling conversation memory?
Keep facts that must survive a long conversation in a maintained project record. Examples include the approved scope, the source of a policy, an unresolved question and the next task. Conversation memory helps interpret “change that sentence”; it is a weak place to make the only copy of a lasting instruction.
Suppose a design team approved a rule against collecting phone numbers in a form. Later exchanges about layout should not determine whether that rule remains available. Supply a concise, current brief separately and label suggestions as suggestions. A discarded idea should not become the project’s policy because it happened to be recent.
In fenbs, people record approved instructions in Decisions and rules, and supported assistants read those rules first in the project context; how fenbs works explains that record.
Keep the rule after the conversation moves on
Create a project in fenbs and record the instructions a person has approved in Decisions and rules. Add the outstanding tests as tasks and save the current stopping point. Your supported connected assistant can read that record when helping you review or change the workflow.
Create a free accountFree for one person · No credit card · Works with Claude, ChatGPT, Cursor and more
Why does the agent forget despite a longer setting?
Check the conversation identity first. A new session key can select a different history; an accidentally shared key can select the wrong history. Then check whether the memory node is attached to the agent you are testing and whether another step supplies conflicting instructions.
Deployment also matters. n8n warns that Simple Memory should not be used for active production workflows in queue mode because calls may reach different workers. Its memory overview (opens in a new tab) lists other memory services and the Chat Memory Manager for more involved history management. Choose storage for your deployment rather than treating a larger history count as a storage fix.
Finally, distinguish missing text from an incorrect answer. If the fact never reached the model, fix selection or storage. If it did arrive, check conflicting content and your question. Broad context window management covers other ways to select useful input without turning this memory control into a universal solution.
How do you choose a value for real work?
Choose the smallest history that passes representative conversations. Include a follow-up that depends on the last reply, a correction to an earlier fact, a long input and a fresh conversation. Record answer accuracy, visible input size and response time. Change one variable per run so a result has an explanation.
A useful pass condition is more specific than “remembers well.” For example: the agent uses the corrected delivery address within the same fictional session, asks when an address is missing, and never retrieves another test session’s address. Use invented details for the test and check every intended separation.
MCP is a standard way for an AI app to use an outside tool. Changing how an assistant calls those tools is a separate topic from retaining its chat history; see n8n and MCP for that connection model.
How to do this with fenbs
- Create a free account and add a project for the workflow you are testing.
- Add a task describing the memory problem, the tested session behavior and the change you intend to make.
- Record the approved input rules and source links. Keep workflow credentials and private conversation content out of the project record.
- Connect a supported assistant using Integrations. Ask it to read the project context before helping you compare the test results, then save progress and the next check.
fenbs is useful for the decisions and handoff around this work. It is not the right fit for storing n8n chat sessions, calculating token usage or operating the workflow. Keep those functions in the workflow and its chosen services.
For more guides on selecting the input an assistant needs, use the context engineering hub. Begin with one repeatable test today; keep the value only if you can explain which conversation it improved.