Text & documents
Numbers & maths
Data & formats
Security
Development & DevOps
Artificial Intelligence
Finance
Health & Wellness
Productivity
Games & Entertainment
Multimedia & design
Business
How to use
What this is

The journey of a request to an AI, end to end: what is already loaded before you type, how the context window is assembled, which filters check it in your app and in the gateway, the model, an agent’s loop and what is checked on the way out. Pick a scenario, click a stage and edit the pieces where they come in.

The tabs

Journey: the eleven stages and the context window. Tools, MCP and skills: what each definition costs, skills in three levels and a tool call control by control (schema, hooks, permissions as in Claude Code, person, sandbox). Context: what comes in through RAG, what is lost when compacting and what can be cached, with real prices. IDE agent: what runs without asking depending on the mode, what can be undone and what subagents save (or not). Lab: what each layer stops over the /agents attack catalogue, measured, and the failures that are not attacks.

The bar at the top is the context window

It is everything the model reads at THAT stage, piece by piece, with its tokens actually counted using OpenAI’s o200k tokenizer (other models count somewhat differently). Tool definitions are counted as the JSON that describes them; each provider wraps them its own way, so it is an approximation. Notice how much is there before you type anything.

What is real and what is simulated

The filters use the app’s secret and personal data detectors and the injection phrase list from /agents: what they find is real, and everything runs in your browser. The gateway is simulated: its policies exist (Azure API Management has llm-token-limit, llm-content-safety and semantic caching; LiteLLM, guardrails before and after the call), but here the content filter is done by our detectors. A phrase list catches the textbook order and not the disguised one: that is what happens with real list-based filters.

What nobody saw

Remove layers and look at the box at the bottom: what was there and no active layer looked at. The indirect injection lesson shows itself: the app’s filter does not see the retrieved document or a tool’s output, because they arrive later. No single layer is enough.

From prompt to responseWhat happens to your AI request, stage by stage
From prompt to responseWhat happens to your AI request, stage by stage
Context window at “Assembling the context”0 tokens · 0% of the window
  • System prompt 0
  • Conversation history 0
  • Your prompt 0
  • Retrieved documents (RAG) 0

Assembling the context

What happens. The request is assembled: the history (or its summary, if it no longer fits), the documents the RAG retrieves and your prompt, in a fixed order. A prefix that does not change between requests can be cached and costs less.

What can go wrong. A retrieved document can carry a hidden order: that is indirect injection. Compacting the history can lose one of your instructions. And a change at the start of the request breaks the cache.

In depth:/embeddings/llm-costs/context-forge

The journey stops at “AI gateway”.

Everything the detectors found was seen by some layer.