How to build an LLM context pack from local files
Most bad LLM answers are not caused by a missing magic prompt. They are caused by messy context.
You upload one PDF, paste half a README, forget the support log, accidentally include an API key, and then ask the model to make a good decision. That is not prompt engineering. That is feeding a filing cabinet through a mail slot.
A better workflow is to build an LLM context pack: one structured Markdown file that combines the relevant sources, labels them clearly, warns about sensitive data, and gives the model something it can actually use.
Why LLMs struggle with messy files
LLMs can work well with long, mixed context, but only when that context is readable. The workflow usually breaks before the model ever answers:
- Files are uploaded one by one, so source boundaries disappear.
- Important metadata such as file name, type, and purpose is missing.
- Private data, API keys, or credentials get pasted accidentally.
- The context becomes too long to inspect or too expensive to send.
- The model cannot tell which source a detail came from.
- Duplicate boilerplate crowds out the parts that matter.
The result is a vague answer from a vague pile of input. The model may be smart. The handoff is not.
What is an LLM context pack?
An LLM context pack is a single Markdown file that combines multiple sources into a structured, readable handoff for an AI model or coding agent.
A strong context pack usually includes:
- A task section that says what the context should be used for.
- A short pack summary.
- A source metadata table.
- Secret or privacy warnings.
- One clearly marked section per source file.
The goal is not to make the prompt fancy. The goal is to make the evidence clean.
Why context.md is a good format
A context.md file works because it is boring in exactly the right way. Markdown is plain text, easy to inspect, and readable by both humans and machines.
It also travels well. You can paste it into ChatGPT, Claude, Gemini, a coding agent, an internal assistant, or a local model. You can save it in a project folder, diff it in Git, attach it to a ticket, or review it before sending anything outside your machine.
A context.md file is not tied to one AI provider. It is a portable handoff.
What files should go into an LLM context pack?
Use a context pack for the files that help the model understand the task. That might include:
- Product briefs and project specs.
- Support logs and customer feedback exports.
- Meeting notes and research notes.
- README files and architecture notes.
- JSON API responses.
- YAML configs.
- CSV feedback or analytics exports.
- PDF reports.
- DOCX specs.
- Bug reports and implementation notes.
The right files depend on the question. For a feature decision, include user feedback and product notes. For a code review, include the relevant README, architecture notes, and error logs. For a market or research summary, include reports and notes with clear source labels.
What to remove or redact first
Before you paste context into any LLM, you should be able to review what is included. That means checking for:
- API keys and bearer tokens.
- Private keys and certificates.
- Passwords and database URLs.
- Customer personal data.
- Sensitive internal URLs.
- Irrelevant boilerplate.
- Duplicate content.
Redaction is not just a compliance ritual. It also improves the context. Removing secrets, duplicates, and irrelevant noise makes the final pack easier to read and cheaper to send.
How to build a context pack manually
You can build a context pack by hand. The process is straightforward, just tedious:
- Collect the relevant files.
- Extract readable text from each file.
- Add file names and source boundaries.
- Add a short metadata table.
- Scan for secrets.
- Estimate the token count.
- Review the final Markdown before sending it to an LLM.
The key detail is source boundaries. Do not pour everything into one unlabeled blob. Mark where each source starts and ends, so the model can cite, compare, and reason from the right material.
Faster way: use a local AI context builder
Instead of building the file by hand, you can use MarkDone's AI Context Builder to generate a private context.md locally in your browser.
It can:
- Read PDF, DOCX, Markdown, JSON, YAML, CSV, and text files.
- Extract readable text locally.
- Detect common secrets.
- Optionally redact sensitive values.
- Estimate token count.
- Generate one portable
context.mdfile. - Copy the result for any LLM.
The important part is local review. You can inspect the Markdown before using it, instead of blindly uploading a messy bundle of files into a chat window.
Open AI Context Builder
Example context.md format
A simple LLM context pack might look like this:
# LLM Context Pack ## Use This Context For - Review this product idea and suggest the strongest next feature. ## Pack Summary | # | Source | Type | Tokens | |---|---|---|---:| | 1 | product-brief.md | Markdown | 840 | | 2 | support-log.txt | Text | 420 | ## Source 1: product-brief.md --- BEGIN SOURCE: product-brief.md --- ... --- END SOURCE: product-brief.md --- ## Source 2: support-log.txt --- BEGIN SOURCE: support-log.txt --- ... --- END SOURCE: support-log.txt ---
The exact format can vary. The important parts are task, summary, metadata, source boundaries, and reviewability.
Token count still matters
A context pack can still be too long. Token limits are larger than they used to be, but that does not make every file worth including. Long context can become expensive, slow, and harder for a model to use well.
Use a token counter before sending a large pack. If the context is mostly structured data, formats like TOON can sometimes reduce token cost compared with verbose JSON. For a deeper comparison, read what JSON really costs in LLM prompts.
Privacy is part of context preparation
Local preparation matters because the risky moment often happens before the model answers. It happens when you upload a file without checking what is inside it.
If you work with contracts, configs, customer notes, internal docs, or repository files, make review part of the workflow. Read what really happens when you upload a file if you want the broader privacy angle.
Final takeaway
An LLM context pack is not a fancy prompt trick. It is a clean handoff.
When your context is structured, complete, and easy to inspect, almost any LLM becomes more useful. The prompt still matters. But the context is where the answer starts.