Codex for Researchers: From Data to Figures to a Written Report in Seconds
The most expensive equipment in my research group is not the cluster. It is the hours I lose to work a script should have done.
A reviewer asked me to replot one figure in a different colour scale. I had the data. I had done the analysis. I still lost an afternoon, because the plotting lived in a half-finished notebook and my memory. Multiply that by every revision and every resubmission, and you have the quiet tax on a mid-career research life.
Nobody puts that tax in a job description. You are hired to think. You spend the time on plumbing: pulling numbers out of a portal, cleaning columns, rebuilding figures, recompiling the same document for the fifth time. The thinking gets whatever hours are left.
I run a research group, teach, supervise, review, and write proposals and papers. I have moved simulation workflows between a German cluster and a laptop in Tabuk. The pattern I see in mid-career researchers is not a lack of skill. It is a backlog of small, repetitive, file-shaped tasks that never quite justify the time they take. So I put an AI agent in a folder on my laptop and pointed it at that backlog. Install it once, and most of what I used to do by hand becomes a paragraph of instructions.
I have been telling people to put Codex CLI on their Windows laptops for a while. Most never install it. The first ten minutes look like developer work, and the payoff is invisible until you have seen it run on your own files. This post removes that excuse. It gives you the install, one reusable starter kit, and three runs that show the whole shape: pull real data from the web, turn it into figures, then write a short report from it.
What Codex Is, and What It Is Not
Codex CLI is a program that runs in your terminal, which on Windows means the PowerShell window. It can read files, write files, and run commands on your machine. You talk to it in plain language, the same way you would brief a new research assistant. The difference is that it does not just answer. It acts, then checks its own work.
That last part matters more than it sounds. When you ask a chat window to write a plotting script, you get text. You then copy it, run it, hit an error, paste the error back, and iterate. Codex runs the script itself, sees the traceback, rewrites the line, and runs it again. By the time it reports back, the figure usually exists on disk.
It is not a search engine, and it is not a co-author. It is closer to a folder with hands. Everything it produces lands in files you can open, inspect, and keep. If you dislike what it wrote, you delete it like any other file.
Two dials control what it is allowed to do. The sandbox decides what it can technically touch. The approval policy decides when it must stop and ask you. In the default workspace-write mode it can work inside the folder you opened, but it cannot write outside it, and command network access stays off until you approve it. You change both mid-session with the /permissions command.
That is the whole safety model in one sentence: a bounded folder, plus a person who says yes or no. You can tighten it to read-only when you just want questions answered, and you should leave it tight until you have watched it work for a week.
The One-Time Setup on Your Windows Laptop
You need a recent Windows 10 or Windows 11 machine, and a paid ChatGPT plan or an OpenAI API key. Everything below is copy and paste. You do not need to understand the commands to run them.
If you have never used PowerShell, read this first
PowerShell is the plain text window where you type commands. It is already installed on Windows. Three things are worth knowing now, because almost every confusing step later comes from missing one of them.
How to open it. Click Start, type PowerShell, and press Enter.
How to open it as an administrator. Do the same, but right-click the PowerShell result and choose "Run as administrator", then click Yes. The window title will say "Administrator". Installing software system-wide needs this.
How to open it already inside a folder. This is the one that saves the most confusion. In File Explorer, go to the folder you want. Right-click on an empty area inside it and choose "Open in Terminal" (Windows 11) or "Open PowerShell window here" (Windows 10). If you do not see either, hold Shift while you right-click. PowerShell opens pointing at that folder, so you never type a long path.
Two kinds of windows, and it matters. Codex installs into your own user account, so a normal window is enough for it. Python, Git and LaTeX install system-wide, so that step needs the administrator window. When a heading below says administrator, use the right-click method.
To run any command: copy it, click into the PowerShell window, paste with right-click or Ctrl+V, and press Enter.
Step 1: make a test folder and open PowerShell in it
We will do everything inside one folder, so nothing is scattered across the machine. Right-click an empty part of your Desktop, choose New, then Folder, and name it codex-test.
Now right-click the codex-test folder itself and choose "Open in Terminal" (Windows 11) or "Open PowerShell window here" (Windows 10). A PowerShell window opens, already inside that folder. Leave it open.
Step 2: install Codex CLI in that window
A normal window is fine here. No administrator rights are needed. Paste this line and press Enter. It downloads the official installer from OpenAI and runs it.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
If Windows asks whether to allow the app, click Yes. When the command finishes, check that Codex is there:
codex --version
You should see a version number. If it says codex is not recognized, close this window, open a new one in the same folder using the Step 1 method, and run it again. A new window picks up the installation.
Already a Node.js user? There is a second way to install it, npm install -g @openai/codex, which needs Node 22 LTS or newer. If that sentence means nothing to you, ignore it and use the installer above.
Step 3: sign in once
In the same window, type this and press Enter:
codex
Codex starts and opens a browser window. Sign in with your ChatGPT account, or paste an API key if you have one. When it is done, you are back at a Codex prompt inside the terminal. Type /quit and press Enter to leave for now.
Step 4: let Codex install the research tools
I put the dependency installer, the workspace rules, and the three prompts into a small public folder on GitHub. A repository is just a shared folder with a history, and this one is at github.com/fysalqayyum/codex-research-starter. It installs Python, the analysis libraries, and a LaTeX toolchain, then leaves you a folder structure for data, figures, and reports.
In the same window, start Codex again and paste this prompt.
Clone https://github.com/fysalqayyum/codex-research-starter into a folder called
research-starter inside my current directory.
Read AGENTS.md and README.md there, then run the installer for my platform
(install/setup-windows.ps1 on Windows, install/setup-mac-linux.sh otherwise).
Report exactly what was installed, with version numbers for python, git, pdflatex
and bibtex. If a step needs administrator rights, needs the network, or cannot run
inside your sandbox, stop and give me the single command to run myself in an
elevated PowerShell window. Do not skip or silently swallow an error.
Here is exactly what will happen, so nothing surprises you.
- Codex asks permission to reach the internet, because copying a repository needs it. Approve it.
- It copies the starter folder into your
codex-testfolder and reads the instructions inside. - It reaches the part that installs Python, Git and LaTeX. Those install system-wide, so Codex stops and gives you one command to run yourself.
When it stops, open a second PowerShell window as administrator: click Start, type PowerShell, right-click the result, choose "Run as administrator", and click Yes. Paste the single command Codex gave you and press Enter. It takes a few minutes, mostly for LaTeX.
Close the administrator window when it finishes, return to the Codex window, and tell it to continue. It will check the installation and print the version numbers.
Do not widen the sandbox to full access to avoid that administrator step. It looks faster. It is how people end up with an agent that can write anywhere on the machine. Run the one administrator command yourself, then let Codex continue in its normal, bounded sandbox.
If you would rather not use Codex for the setup
You can do the same thing by hand in two short steps. First, open a PowerShell window as administrator (the method above) and paste this one line. It installs Python, Git, MiKTeX and the GitHub CLI, then adds the Python libraries. You do not need Git installed first, because this command uses what Windows already has.
irm https://raw.githubusercontent.com/fysalqayyum/codex-research-starter/main/install/setup-windows.ps1 | iex
You can read that script before you run it here: setup-windows.ps1 on GitHub. Nothing runs until you press Enter.
Second, get the starter folder. On that GitHub page, click the green Code button and choose Download ZIP. Unzip it into your codex-test folder, then open Codex inside the unzipped folder. This route needs no Git commands at all.
Step 5: check everything is in place
Open a fresh PowerShell window and run these two commands. You want a version number from each.
python --version
pdflatex --version
If LaTeX reports as not found, close the window and open one more new window. MiKTeX only appears on a window opened after it finished installing.
Three Runs That Show the Whole Shape
The best way to understand an agent is to watch it carry one object through three transformations: raw data, then a figure, then a document. I use World Bank Open Data for this because it needs no key, no account, and no scraping. The prompts below are the ones in the starter kit, so you can copy them as they are.
Run 1: pull real data into a folder
Open PowerShell in the folder that holds the starter kit (use the Step 1 right-click method), type codex, and press Enter. Then paste this.
Using the World Bank Open Data API, download two indicators for Germany, Saudi Arabia,
Pakistan, Japan and South Korea, for the years 2000 to 2023:
1. Research and development expenditure (% of GDP) - indicator GB.XPD.RSDV.GD.ZS
2. Researchers in R&D (per million people) - indicator SP.POP.SCIE.RD.P6
Endpoint pattern:
https://api.worldbank.org/v2/country/{codes}/indicator/{indicator}?format=json&per_page=500&date=2000:2023
Use country codes DEU;SAU;PAK;JPN;KOR in a single request per indicator.
Save each indicator as data/raw/<indicator>.csv with columns:
country, country_code, year, value
Then print, for each file: the row count, the number of non-null values, and the
year range. Do not interpolate, fill forward, or drop missing years. Leave them
missing. Print the exact URLs you fetched.
At the time of writing, that pull returns 100 non-null values for R&D spending and 86 for researchers per million, both covering 2000 to 2023. The counts will drift as the World Bank updates its series, which is exactly why the prompt asks for a printed summary. You now have two plain CSV files on your disk, and you can open them and check them by hand.
This is the moment the exercise stops being a demo. The data is local, in a folder you control, in a format you can cite.
Run 2: turn the files into figures
Read the two CSV files in data/raw/ and create three figures in figures/ as PNG,
200 dpi, no wider than 1600 pixels:
1. R&D expenditure (% of GDP) over time, one line per country.
2. Researchers in R&D (per million people) over time, one line per country.
3. A bar chart comparing both indicators for the latest year that has data for
all five countries, with two panels sharing a country axis.
For every figure: a title, axis labels with units, a legend, and a source note
naming the World Bank indicator code. Write the plotting code to
scripts/make_figures.py so I can re-run it.
Print the exact path of each figure, the number of data points actually plotted,
and the latest year plotted for each country. If a country has no data for the
comparison year, name it and do not invent a value.
You should get three PNG files in figures/ and a summary that names the year used for the bar chart. Open the files. If an axis has no units, or a line stops early without explanation, say so. Codex edits the script and re-renders.
The habit worth noticing is that the figure is produced by a script, not by hand. Ask for the Germany line in a different colour. It changes one line in scripts/make_figures.py and re-runs it. That is the difference between a picture and a workflow.
Run 3: write the report
Write a two-page LaTeX brief in report/ that summarises the three figures for a
non-specialist research audience.
Requirements:
- Use report/report-template.tex as the starting point and report/references.bib
for citations.
- Include the three figures from figures/ with captions.
- Add a short methods paragraph that explains the World Bank API, the indicator
codes, the years covered, and how missing values were handled.
- Cite both World Bank indicator pages as @misc entries in BibTeX.
- Every number in the prose must match the CSV files in data/raw/. Do not round,
invent, or estimate a value. If you cannot trace a number to a file, do not
write it.
- Compile with pdflatex and bibtex (run pdflatex twice after bibtex) and leave
the final PDF at reports/rd-capacity-brief.pdf.
Print the page count, the PDF path, and the source of every number you quoted.
The result is a two-page PDF with the figures, a methods paragraph, and a reference list that cites the two indicator pages. Then do the one thing this workflow exists for. Pick two numbers from the prose and check them against the CSV by hand. If they disagree, you have found the exact failure mode you are trying to avoid, and the prompt already told Codex to prove its numbers rather than assert them.
On the first run, most people are surprised by how ordinary the whole thing feels. No dramatic moment. A folder fills with files, a figure appears, a PDF opens. The surprise arrives a week later, when a reviewer asks for the same comparison with one more country, and the answer is a single sentence and ninety seconds instead of another Saturday.
Why This Beats a Chat Window
The obvious objection is that a chatbot can do all of this. It cannot, and the reasons are structural rather than a matter of model quality.
First, files persist. A chat window forgets your folder between sessions. The agent reads the same data/raw/ files you have, yesterday and today, and it reads the same rules every time.
Second, it executes. It runs the script, reads the error, and fixes it. You are not the loop between the tool and the traceback anymore. For anyone who has spent an afternoon on a single pandas column-name error, that is the entire value proposition.
Third, it inherits your standards. The starter kit carries an AGENTS.md file, and Codex reads it before every task. Ours says figures need units and a source note, raw files are never edited, missing values stay missing, and derived tables go somewhere else. Correct it once, and the correction persists for every future session. This is the same discipline that makes a computational workflow survive review, and it is the reason I keep pointing people at it.
If that instinct is new to you, it is the same argument I make in the guide to DAMASK crystal plasticity documentation: a result only becomes evidence when the workflow behind it is written down and repeatable. An agent that reads your rules is one more way to make that routine.
Fourth, it is scriptable. The interactive view is what you will use most, but the same engine runs non-interactively:
codex exec --sandbox workspace-write "Regenerate every figure in figures/ from data/raw/ and print the paths."
That line is what turns a one-off demo into a monthly report. Put it in a scheduled task, and the update happens without you. This is not a theoretical feature. It is how I would keep a funding or output dashboard current across a semester.
Where It Earns Its Place in Your Week
The temptation is to point an agent at everything. That is how you get plausible mistakes at scale. A better filter is to sort tasks by how confidently you can check the output. If you can verify it cheaply, delegate it. If you cannot, keep it or narrow it.
| Task | Good fit for the agent | Your job remains |
|---|---|---|
| Pulling public data | Fetch, reshape, and save to CSV with a printed row count | Confirm the indicator means what you think it means |
| Figure regeneration | Rewrite the plotting script and re-render every version | Decide what the figure is allowed to claim |
| Messy instrument data | Split columns, flag outliers, and log every change it makes | Decide whether an outlier is an error or a result |
| Literature triage | Build a table of candidates from a defined set of sources | Read the papers that matter and judge them |
| First drafts | Structure a methods paragraph or a response outline from your notes | The scientific claims, and the sentence you sign your name to |
| Teaching material | Turn a lecture outline into worked examples and a problem set | Whether the examples are correct and at the right level |
The pattern in the middle column is always the same: transformation, regeneration, and structuring. The pattern in the right column is always judgement. An agent is excellent at the first and dangerous at the second.
There is a practical consequence for a mid-career workload. The tasks you should hand over are rarely the ones that define your reputation, and they are almost always the ones that eat the hours you would rather spend on the work that does. That trade is worth making deliberately, once, rather than resenting it every week.
The Rules That Keep You Out of Trouble
Every powerful tool for a researcher comes with the same failure mode: it makes a confident mistake in a format that looks finished. A wrong number inside a clean PDF is more dangerous than a wrong number in a scratch file. Five rules keep that from happening.
Verify anything that leaves your machine. Open the CSV and check the numbers in the abstract. The prompt in Run 3 orders Codex to print the source of every number it quotes for exactly this reason. Use that habit every time.
Keep confidential and unpublished data out of it. Prompts and relevant file content are sent to OpenAI to do the work. Embargoed manuscripts, confidential industrial data, student records, grant material under review, and anything covered by a data agreement should not go in without checking with the data owner and your institution. For sensitive work, keep the agent on published or synthetic data, or on the code alone.
Leave the approvals on. Approving a network call or a file write takes a second. Turning approvals off to save that second is how a typo in a folder path becomes an afternoon of recovery. Watch it work for a week before you loosen anything.
Check what you are allowed to use. If the agent pulls in a dataset, a figure, or a library with a restrictive license, that restriction travels with your paper. Read the license on anything it downloads, the same way you would if you had downloaded it yourself.
It is not a co-author. It does not take responsibility for a claim, cannot consent to authorship, and should not appear in an author list or an acknowledgements section styled as a person. Use it, check it, and own what you publish.
The one test that matters. Before you rely on any output, ask yourself whether you could defend it if a reviewer asked where it came from. If the answer is a file path you can open and a source you can cite, you are fine. If the answer is "the agent said so", you are not finished yet.
One more practical note on cost. Codex is included with paid ChatGPT plans and can also run on a metered API key. Short tasks are cheap. A long autonomous run that reads a hundred files is not, so check the usage view in your first week and learn what your normal workload costs before you schedule anything monthly.
Where to Point It Next
Once the three runs feel normal, four uses tend to pay off fastest for a mid-career researcher. Each one is a single prompt away once the workspace exists.
Turn a folder of PDFs into a reading table. Point it at a folder of papers and ask for a CSV with columns for year, journal, method, material system, and the one number each paper reports. You still decide which papers matter, but the first sort stops being manual.
Clean a messy instrument export. Ask it to split merged columns, flag impossible values, write every change to a log, and leave the original file untouched. The log is the point. You want a record of what was changed, not just a cleaner file.
Regenerate a figure set for a resubmission. When a reviewer wants every figure in a different style, that is a script edit, not a week of work. Keep the plotting code in one file and this becomes a ten-minute job.
Draft outreach and administrative text from your own notes. A workshop description, a session abstract, a short brief for a collaborator. It is weakest when you ask it to invent, and strongest when you hand it your own bullet points and ask it to structure them.
For anyone working without a large group or a shared lab, this is also a way to buy back capacity that others get from colleagues. If that is your situation, the argument in building a research profile with no lab and no network is the same one: use the tools that exist to close the gap instead of waiting for the gap to close itself.
Final Thought
The researchers who will get the most from this are not the ones who adopt every new tool. They are the ones who already run a disciplined workflow and are tired of the manual steps around it. If your figures already have units and your data already has a home, an agent slots in without changing how you think.
The reason I keep telling people to install it is not that it writes well. It is that it removes the friction between an idea and a tested result. You ask, it builds, it runs, it checks, and you decide. The decisions stay yours.
Start with the World Bank run. It takes one afternoon to install and one evening to see the whole shape. After that, the question stops being whether it is worth it and becomes which of your recurring tasks you hand over first. Pick the one that has quietly annoyed you for a year. That is usually the right one.
Want Your Team Working This Way?
Book a 15-minute call. We will look at where the manual steps sit in your research workflow, decide which ones are safe to hand to an agent, and I will tell you honestly whether this is worth your time or whether you do not need it.
Book a 15-Minute Call See Courses & WorkshopsIf You Are Still Deciding How to Spend the Time
Saving hours is only useful if you point the hours somewhere. For a mid-career researcher sitting on a good opportunity and unable to commit, The Mid-Career Opportunity You Are Overthinking is the companion conversation. And if the work this frees up is a simulation campaign, the workflows in numerical simulations for additive manufacturing of aluminum alloys show where the saved time tends to go.
Get the next post by email
A few posts a month on research careers, simulation consulting, and building a life abroad. No spam, and you can unsubscribe with a single reply.
Prefer LinkedIn? Follow me there — every post is shared on LinkedIn.