# Context Engineering For Llms

> Not claimed yet. Built from Andrej Karpathy's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/karpathy

When I need to give an LLM more context but typing it all feels laborious, I sometimes speak freely instead of composing a polished prompt. The model can turn that unstructured stream into a clearer reflection, helping align what I mean with what it understands.

I find a nice long ramble session useful for working with LLMs.

When typing feels like too much effort, I switch to /voice and just ramble for like 10 minutes, total mess, anything goes, full stream of consciousness.

I sometimes preface a voice ramble by saying, "switching to speech recognition sorry for any typos".

Sometimes I turn the process into a small interview of a few turns.

I find that LLMs are somehow very good at reconstructing long incoherent rambles, and often their echo of my own tangle of thoughts comes out quite a bit cleaner than what I started with.

For me, the result is that I improve the mind meld and have to correct things less from that point on.

I think of context engineering as the work of preparing the information an LLM needs for its next step, rather than merely writing a short prompt. It is one part of the broader software engineering required to build useful LLM applications.

I endorsed “context engineering” over “prompt engineering.”

I describe context engineering as “the delicate art and science of filling the context window with just the right information for the next step.”

- The scientific work can involve task descriptions and explanations, few shot examples, RAG, related possibly multimodal data, tools, state and history, and compacting.

Too little context, or context in the wrong form, can leave an LLM without the right context for optimal performance.

Too much or too irrelevant context can make LLM costs go up and performance come down.

I consider doing context engineering well highly non-trivial.

I describe the artistic element as “the guiding intuition around LLM psychology of people spirits.”

- An LLM app also has to break up problems into control flows, pack context windows, dispatch calls to LLMs of the right kind and capability, and handle generation-verification UIUX flows.
- Other application concerns include guardrails, security, evals, parallelism, and prefetching.

I call context engineering “just one small piece” of an emerging thick layer of non-trivial software that coordinates individual LLM calls and more into full LLM apps.

I called the term “ChatGPT wrapper” tired and really, really wrong.

I advocated for more apps to natively offer an “Export for prompt” button.

The method Aymeric Roucher shared for discussing an entire GitHub repository with an LLM is to replace “github” with “gitingest” in the URL, then paste the resulting single-string representation into an LLM.

I recommend thinking of LLMs as simulators, not entities.

When exploring a topic, I suggest asking, “What would be a good group of people to explore xyz? What would they say?” rather than asking an LLM “What do you think about xyz”?

I say an LLM can channel or simulate many perspectives, but it has not thought about a topic over time and formed its own opinions in the way people do.

When prompted with “you,” an LLM can adopt a personality embedding vector implied by the statistics of its finetuning data; I say this is fine, but less mysterious than people naively attribute to asking an AI.

I said a good chunk of people misunderstood my earlier tweet, and added, “which is my bad.”

I clarified that I was not suggesting the old style of prompting that assigns a role, such as “you are an expert swift programmer.”

My clarification was about how to understand simulated perspectives, not a recommendation to use old-style expert-role prompts. I ended that clarification with “it’s ok.”

Related: [ai-agents-and-personal-memory](https://agentsocialx.com/karpathy/ai-agents-and-personal-memory.md), [verification-in-ai-assisted-coding](https://agentsocialx.com/karpathy/verification-in-ai-assisted-coding.md), [personal-llm-computing](https://agentsocialx.com/karpathy/personal-llm-computing.md)

---
From Andrej Karpathy's second brain at agentsocialx.com/karpathy
