Day 01 / 04 Agentic Coding Tools for Researchers

Foundations &
First Workflow

Justin Frake

University of Michigan, Ross School of Business

Justin Frake
Instructor

Justin Frake

Assistant Professor of Strategy, Ross School of Business, University of Michigan

Research
I study labor markets, misconduct, and the role of politics in the workplace.
Methods
Causal inference and quasi-experimental designs.
Tools
Daily user of agentic coding tools for well over a year: Claude Code, Cursor, Codex, and Antigravity. Primarily Claude Code today.
Find me
justinfrake.com · jfrake@umich.edu

Agenda

§ I
Agentic coding tools, harness vs. model
Lecture
§ II
Setup & first conversation
Workshop
§ III
Context management
Lecture
§ IV
Permissions
Lecture
§ V
Slash commands
Lecture
§ VI
Tooling recommendations
Lecture
§ VII
Profile, clean, aggregate
Workshop
§ VIII
Making your global CLAUDE.md
Workshop
§ IX
Debrief & Day 2 preview
Discussion
Day 1 · Agenda3
§ I

What are agentic coding tools?

An agentic coding tool is a smart RA who can do real work

RA you can only text

chatgpt.com ChatGPT Help me fix the bug in my regression analysis code I need the code. Paste the regression code that is failing. Include: • Language and libraries • Error messages or warnings • What you expect vs. what you get If the bug is logical rather than syntactic, say what looks wrong and why.
  • Reads only what you paste in.
  • Can't see your files or run your code.
  • Can't change anything for you.

RA with your files and a computer

Your Notes Your Code Your Data Terminal Internet Papers Claude Code
  • Reads your project files directly.
  • Runs code, edits scripts, runs tests.
  • Stops to ask when it's not sure.

Both are smart AI. Only the second one is what we mean by "agentic."

Day 1 · Mental model4

The differences between Claude, Claude.ai, and Claude Code

Claude Claude.ai

The chat web app. claude.ai in a browser.

You type, the model answers. It cannot see your files, run your code, or save anything to your computer.

Same idea as ChatGPT, from Anthropic.
Claude Claude Code

An agentic command-line application. Lives in your terminal.

Reads your files. Runs commands. Edits code. Asks permission before each action.

We'll refer to this as the harness.
Foundation model
Claude
e.g., Opus 4.7

The Claude desktop and mobile apps also sit on this model. This week we work only with Claude Code.

Day 1 · The names5

What an agent does between your prompt and its reply

YOU User AGENT Claude Code decides what tools to call, reads results, decides what's next, repeats until the task is done. TOOLS on your machine read files edit files run shell run R / Python search the web ask you for permission 1 prompt 4 reply 2 tool call 3 result
Day 1 · The loop6

The harness is not the model

The customization stack hangs off the harness, not the model.

HARNESS Claude Code MODEL Claude generates language, reasons over context. What the harness does: · reads & edits files · runs tools / shells · asks permission · manages context · loads CLAUDE.md, skills · dispatches sub-agents CUSTOMIZATION STACK CLAUDE.md Memory Slash commands Skills Plugins MCP servers & hooks
Day 1 · Mental model7

Five levels of working with AI for code

1
Browser chat
Copy from ChatGPT or Claude.ai, paste into your editor.
2
Code completion
Inline suggestions and chat inside your editor.
3
IDE agent mode
“Agent mode” in Cursor, VS Code, or Zed reads files, runs tests, refactors.
4
Terminal agent
Claude Code or Codex CLI. The agent reads, edits, runs in your terminal.
5
Autonomous agents
Tasks complete without per-step approval. Scheduled jobs, sandboxed CI agents, background work.
Most researchers are here
You’ll be here today
Start here by end of workshop
Day 1 · The ladder8

Four major agentic coding tools; we will use Claude Code

Primary
Claude Code Anthropic
Terminal-native agent. Reads files, runs code, asks permission. Configured via CLAUDE.md. The tool I'll instruct with.
claude.com/code
Reasonable alt
Codex OpenAI
Terminal agent comparable to Claude Code. Most concepts this week port over directly.
openai.com/codex
Cursor Anysphere
Agent built into a VS Code fork. Different interaction model. Configured via agents.md.
cursor.com
Antigravity Google
Google's agentic IDE. Newest of the four; ecosystem still forming.
antigravity.google
Day 1 · Landscape9

Context is the single most important concept this week

1
Context is everything Claude can see right now. The model has no other memory between turns. If it isn't in context, it doesn't exist for Claude.
2
Context determines quality. Well-curated context produces careful answers. Cluttered context produces confused ones. Same model, different output.
3
Context is finite and it degrades. 200,000 tokens (about 150K words) fills faster than you'd think. As it fills, performance drops.

The mechanics of context, how it rots, and how to manage it come back in § III.

Day 1 · Why context10

If you haven't installed yet, one command does it

macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell
irm https://claude.ai/install.ps1 | iex
Verify it worked
claude --version

Self-contained installer; no Node.js needed. (Windows: install Git for Windows first.) R or Python: ask Claude Code to install them during § III.

Can't install locally? Use the Codespace fallback at socialscienceai.com/pre-workshop.
Day 1 · Install11

Which Claude tier you need

Pro
$20/mo
Very limited Claude Code access. You may not finish all exercises this week.
Max (5x)
$100/mo
The realistic floor for this workshop. Best place to start if you can afford it.
Max (20x)
$200/mo
Best deal for heavy daily users. This is what I use.
API
Pertoken
No caps; requires an API key. Most expensive way to use Claude Code daily.

tiers as of May 2026

Day 1 · Pricing12
§ II

Workshop · Set up & first conversation

Open Claude Code, then have it download the materials

1
Make a project folder named workshop.
Macin Finder Windowsin File Explorer
2
Open the terminal.
Mac⌘ Space → type Terminal → Enter WindowsStart menu → type PowerShell → Enter
3
Type cd + space, drag your folder onto the terminal, press Enter.
4
Type claude, press Enter.
5
Paste this prompt, press Enter:
Download everything at socialscienceai.com/materials/session_1/ into this folder. When you're done, describe the data to me.
6
Say yes to any permission prompts Claude asks you.
Day 1 · SetupII.1
§ III

Context management

Everything Claude has seen this session is one long document

SYSTEM INSTRUCTIONS CLAUDE.MD HIDDEN PREAMBLE loaded once at session start CLAUDE BUILT-IN TOOLS USER PROMPT YOUR PROMPT what you typed READ() WEB SEARCH() WRITE() TOOL CALLS files, web, shell, every result LLM MESSAGE LLM RESPONSE what Claude wrote back USER PROMPT READ() WRITE() LLM MESSAGE EACH TURN APPENDS prompts, tool calls, replies, all stacked USER PROMPT READ() WRITE() . . . until context fills.

Limit: 200,000 tokens (about 150,000 words). A token is roughly three-quarters of a word. Fills faster than you'd think.

Day 1 · Context windowIII.1

Context comes from three places. Claude can reach two of them.

ON YOUR COMPUTER files, code, data IN YOUR HEAD intent, what “good” looks like ON THE INTERNET docs, papers, search CONTEXT WINDOW SYSTEM CLAUDE.MD USER PROMPT READ() WEB SEARCH() LLM MESSAGE
Dictate it
When you know what to say but typing is slow. Wispr Flow, SuperWhisper, Aqua Voice.
Have Claude interview you
When you might not know what to say. Next slide.
Day 1 · Three sourcesIII.2

Drop everything Claude might need into your project folder

# your project folder
your-project/
├── CLAUDE.md
├── notes/
│ ├── research_questions.md
│ ├── data_dictionary.md
│ └── meeting_notes.md
├── papers/
│ ├── johnson-2023.pdf
│ └── li-and-smith-2024.pdf
├── code/
│ ├── 01_clean.R
│ └── 02_analyze.R
├── data/
│ └── ipeds_panel.csv
└── drafts/
└── outline.md
CLAUDE.md is special
Read automatically at session start. Project conventions, your preferences, anything Claude should always know.
Other .md files
Research questions, data dictionaries, meeting notes, drafts. Claude reads them when relevant.
Source materials
PDFs of papers you're citing, prior code, scratch analyses, codebooks. Drop them in. Claude reads them on demand.
Principle
Richer directory, richer context. If Claude might need it, drop it in.
Day 1 · Workspace setupIII.3

Have Claude interview you before you ask for something hard

01 Vague task
plan my talk
what you typed
02 Interview

Q1. How long is the talk?

A. 20 minutes.

Q2. Who is the audience?

A. Business-school faculty.

Q3. What do you want them to remember?

A. My main result is robust to alternative IVs.

questions you may not have thought to specify
03 Sharp task
draft a 20-min talk for business-school faculty; landing point = main result is robust to alternative IVs
what plan mode now has to work with

Prompt template: interview me about [task]. ask one question at a time.

Day 1 · Interview-meIII.4

Long sessions degrade. Fresh sessions don't.

The phenomenon

As context fills, Claude has more to keep track of and starts losing the thread. The signal-to-noise ratio drops.

Around turn 20–30 of a heavy session, performance is noticeably worse than turn 3.

What it looks like
  • · Claude misremembers earlier decisions
  • · Forgets constraints you set early in the session
  • · Goes in circles on a problem it would solve fresh
  • · Uses old patterns after you've corrected it
"The model has more to keep track of, and it starts losing the thread. This is the single most important thing to understand about working with AI coding tools."

— Paul Goldsmith-Pinkham

Day 1 · Context rotIII.5

When context fills, Claude summarizes older turns into a memory block

BEFORE SYSTEM INSTRUCTIONS CLAUDE.MD CLAUDE BUILT-IN TOOLS USER PROMPT READ() WEB SEARCH() WRITE() LLM MESSAGE USER PROMPT READ() WRITE() LLM MESSAGE USER PROMPT READ() WRITE() LLM MESSAGE older turns get summarized Recent turns and files you've written are preserved. Mid-session detail in older turns is lossy. AFTER SYSTEM INSTRUCTIONS CLAUDE.MD CLAUDE BUILT-IN TOOLS USER PROMPT MEMORIES

Auto-compact works fine for most research workflows when state is in files. Manual /compact gives you control over when and what to keep.

Day 1 · Auto-compactionIII.6

Three habits that keep context useful

01 Write state to files

Have Claude write progress, plans, and decisions to .md files in your project. Files persist across sessions; conversation context doesn't.

02 Keep sessions short

5–10 focused turns per session, then start fresh. Marathon sessions are where the rot happens.

03 Compact intentionally

Type /compact before context fills, with a hint about what to keep. Better than waiting for auto-compact to lose detail.

three rules via Paul Goldsmith-Pinkham

Day 1 · Managing contextIII.7

Plan mode is where you and Claude agree on the approach before any code runs.

Before Claude touches a file, it states what it intends to do. You read the steps, push back on the wrong ones, refine. By the time anything executes, the two of you have agreed on the approach.

Without plan mode Claude assumes

Claude reads your prompt and acts. It picks variable names, file paths, methods, and sequencing on its own.

By the time you see what it did, you are unwinding decisions that were never yours.

With plan mode you negotiate

Claude proposes the steps it would take, in order, before any of them run.

You approve, reject, or amend. The assumptions become visible and editable before they execute.

Day 1 · Plan modeIII.8

Every agentic task moves through three phases

Naming the rhythm matters. Once you've practiced Plan, Execute, Clear once, you can recognize which phase you're in mid-task. That recognition is the difference between using Claude Code well and getting lost in it.

01 Plan

Claude proposes what it would do, before it does anything. You read the plan, approve, reject, or amend.

Shift+Tab Tab to enter
02 Execute

Claude runs the plan: edits files, runs commands, asks permission as needed. You watch, and intervene if it drifts.

ESC to interrupt
03 Clear

When the task is done or context fills, compact or clear. Files persist; conversation context doesn't.

/compact or /clear

Same three phases every time, every day this week. Vocabulary we'll use through Days 2–4.

framing via Steve Pocock

Day 1 · Plan / Execute / ClearIII.9

What plan mode looks like in your terminal

Plan mode
1. Read codebook.md to confirm variable names
2. Load data/ipeds_panel.csv with read_csv
3. Profile: nrow, summary, missingness rates
4. Save profile to results/profile.txt
5. Report top findings inline
This plan requires approval
Do you want to proceed?
> 1. Yes, run the plan
2. No, let me give feedback to refine the plan
3. Cancel
Esc to cancel · Tab to amend · Shift+Tab+Tab toggles plan mode
What’s happening
You hit Shift+Tab+Tab to enter plan mode. Claude proposes the steps it would take, before doing any of them.
What you see
A numbered list of discrete actions. Each step is something you could approve or strike on its own.
What you do
1 approves the plan and exits plan mode into execute. 2 sends Claude back with your feedback. 3 cancels.
When to use it
Any task with more than one step. Cleaning a dataset, multi-file refactors, anything where the wrong first move sends Claude in a wrong direction.
Day 1 · Plan-mode anatomyIII.10
§ IV

Permissions

Claude Code asks before doing anything that changes your system

Reads
File contents, project structure, git status. Looks at things without changing them.
Runs silently. Reads do not change anything, so no prompt.
Edits
Creating, editing, or deleting files. Changes things on your computer.
Asks each time. Shows the proposed change first. Approve, decline, or always-approve for this project.
Shell
Runs terminal commands like Rscript, git, rm. (A shell is the program that runs your terminal commands.)
Asks before every command, including destructive ones like rm or git reset. Hit Ctrl+E to have Claude explain a command before you approve.

By default Claude Code asks before almost every action. Use /permissions to pre-approve commands as you build trust.

Day 1 · Permission modelIV.1

What a permission prompt looks like in your terminal

A terminal is the text-based interface to your computer. Claude Code prints prompts like this one when it needs your approval.

Bash command
Rscript code/01_clean.R
Run the data cleaning script
This command requires approval
Do you want to proceed?
> 1. Yes
2. Yes, and don't ask again for: Rscript *
3. No
Esc to cancel · Tab to amend · ctrl+e to explain
What's happening
Claude paused before running a Bash command and is asking for approval.
What you see
The exact command, then a one-line description of what it's for. Read both before approving.
What you do
1 runs once. 2 auto-allows the pattern (any Rscript *) for this project. 3 declines.
Shortcuts
Esc cancels. Tab lets you edit the command before approving. Ctrl+E asks Claude to explain what the command does.
Day 1 · AnatomyIV.2

Three layers from least to most permissive. Pick the lowest one that fixes the friction.

The annoyance of repeated prompts is a real cost. The right fix is to remove the prompts you do not need, not to remove all the gates.

Layer 1. Allowlist specific commands. permissions.allow
Stops prompts only for commands you list. Read-only or scoped enough that you would always approve: Read, Grep, Bash(git status), Bash(Rscript *). Risky commands (rm, git push --force, git reset --hard) still prompt.
Layer 2. Auto-approve file edits. defaultMode: "acceptEdits"
Edit and Write tools no longer prompt. Bash and other tools still prompt. Useful when edit prompts are the main annoyance and you trust your /rewind ability. Lint and Stop hooks still fire.
Layer 3. Auto mode. defaultMode: "auto" recommended starting point
Built-in classifier allows operations it judges safe and prompts on operations it judges risky. The classifier is decent but not perfect. Strictly better than skipping all gates, because it still gates the actually-dangerous calls.
Layer 4. Skip everything. --dangerously-skip-permissions not for routine work
Removes every gate: any shell command (rm, git push --force, sudo), any file write, and any instruction injected into a document Claude reads. Reserve for a worktree or sandbox where the blast radius is contained.
Day 1 · Graduated pathIV.3
§ V

Slash commands

Plain language goes to the model. Slash commands stop at the harness.

HARNESS Claude Code MODEL Claude generates language, reasons over context SLASH COMMAND /clear intercepted by the harness PLAIN LANGUAGE please clear our context passes through the harness; the model interprets it

Three things only slash commands can do: clear context, show your cost, edit permissions.

Day 1 · Why slash commandsV.1

The most important slash commands

/help
Show help and available commands.
/clear
Start a new conversation. Past sessions stay in /resume.
/compact
Summarize the conversation to free context.
/resume
Resume a previous conversation by name or picker.
/usage
Show session cost, plan limits, activity stats. /cost is an alias.
/model
Switch models for the current session.
/permissions
Manage allow / ask / deny rules for tool permissions.
/init
Initialize the project with a starter CLAUDE.md.
/exit
End the session.

+ advanced (later this week): /rewind · /loop · /rc

Day 1 · Slash commandsV.2
§ VI

Tooling recommendations

R and Python work better with Claude than Stata or SAS

R  /  Python

Plays well with Claude.

Training data
An enormous amount of R and Python code is on the public web, so Claude writes both fluently.
Terminal access
Both run from simple terminal commands. The agent can launch them, watch the output, and iterate on its own.
Lots of training data. Easy to drive from the terminal.
Stata · SAS · SPSS

Works, but less smoothly.

Training data
Less of this code lives on the public web, so Claude’s output is rougher and needs more correction.
Terminal access
These tools are built for clicking through menus. The agent can run a script but cannot drive the GUI.
Less training data. Harder to drive from the terminal.

You can still use Stata, SAS, or SPSS this week. Just expect rougher code and more cleanup work landing on you.

Day 1 · Language toolsVI.1

Two non-agentic tools worth installing this week

Dictation
Talk, don’t type
Hold a key, speak, release. Text drops into your prompt. About 3x faster for long instructions.
Wispr Flow Mac, Windows I use this wisprflow.ai
SuperWhisper Mac superwhisper.com
Built-in dictation free; built into the OS. Raw transcript.
Terminal
A better shell
A modern terminal adds quality-of-life features: tabs for multiple sessions, autocomplete on commands, split panes for side-by-side work, clickable links and file paths, and cleaner handling of long Claude Code output. The built-in Terminal.app still works.
Warp Mac, Windows, Linux I use this warp.dev
Ghostty Mac, Linux ghostty.org
iTerm2 Mac iterm2.com
Day 1 · Companion toolsVI.2
§ VII

Profile, clean, aggregate

Six habits that make Claude work like a good RA

1
Plan before you code
Use plan mode for non-trivial tasks. Read the plan; reject and re-plan if it's wrong.
2
Give it your files
Put notes, drafts, codebooks, and prior code in the project folder before you start.
3
Show, don’t tell
Drop a sample of your past work in the directory and tell Claude to mimic it.
4
Talk, don’t type
Use dictation software for long instructions. You’ll give more context without realizing.
5
Check its work
Treat its output like an RA’s first draft. Skim, spot-check numbers, look at the figure.
6
The first output is a draft
Iterate. Don’t hand-edit. If you keep correcting the same thing, encode it in CLAUDE.md.
Day 1 · HabitsVII.1
§ VIII

Making your global CLAUDE.md

§ IX

Debrief & Day 2 preview