Set Up Claude Code in Ollama

Install Claude Code and use AI to organize files with plain English prompts.

Introduction

30 Second Summary

Claude Code is an AI assistant that runs in your terminal. You type plain English, and it executes tasks on your computer. No coding experience required.

In this project, you will install Claude Code as an add-on to Ollama, an open-source platform for running LLMs locally. You run AI models without relying on cloud services, enhancing privacy and control over your data.

As part of Getting Started with Claude Code, we learn its safety modes and prompting patterns, and use it to organize real files on your computer. By the end, you'll have a working setup of Claude Code, a personalized preferences file, and reusable commands you can run anytime.

Issues in Windows Operating Systems

There seems to be "Tool loop" problems in the Ollama/Claude integration.

If you want the full agentic AI experience where it edits code and loops properly on its own, you must use Windows Subsystem for Linux (WSL2). Claude Code is built explicitly for POSIX terminal architecture. In WSL2, the tool-calling loops, file manipulation, and Ollama streams function exactly like they do on Linux

Trying to force an engineering-centric CLI tool designed for Linux software development (Claude Code) to act as a general-purpose Windows file manager via local Ollama models hits an architectural wall.

Claude Code is fundamentally sandboxed to treat folders as code repositories. When you try to make a local model structure multi-step commands for organizing a standard Windows Downloads folder, the JSON tool-calling syntax, Windows line endings, and file type structures break the model's reasoning loop, causing it to freeze entirely.

If your primary goal is to let AI agents automatically organize files in your Windows Downloads folder, you can bypass Claude Code and achieve a smooth, zero-headache setup using alternatives such as having an AI generate a python script that you manually execute.

While that seems a reasonable workaround, it defeats the purpose

of this project. I'm truly sorry.

I did spend quite a lot of time in a Windows 11 OS (I dual boot with Ubuntu) only to find that tool loop just isn't going to work unless you use WSL.

What You'll Build

You'll go from never having opened a terminal to confidently using Claude Code as your personal AI assistant for file management, organization, and automation.

By the end of this project, you'll have:

  • A working Claude Code installation, fully authenticated and ready to use.
  • A personalized CLAUDE.md preferences file and a reorganized folder as proof that Claude Code works for you.
  • A mental model of how to prompt Claude Code effectively for any task, with a library of reusable prompt patterns and use cases to explore next.
  • Secret Mission: Build a multi-step "digital audit" command that analyzes storage, finds duplicates, identifies forgotten files, and produces a readable report.

Want a complete demo of how to do this project, from start to finish? Check out our 🎬 walkthrough with Maya.

Are there any prerequisites?

You need a computer that can run a local coding model and enough free storage for the download. Ollama and the local model used in this project do not require a paid Claude subscription.

If you're on a Windows-based computer, you may want to first install and configure WSL (Windows Subsystem for Linux) before doing this project. Otherwise you can likely run into tool loop issues as mentioned earlier.

Get Access to Claude Code

Run Claude Code with Ollama

Claude Code is the terminal interface that reads files and runs tasks. Ollama supplies the local model that generates each response.

Keeping the model on your computer removes subscription and API charges. In this step, you'll install both tools and confirm that Claude Code can use a local model.

In this step, get ready to:
  • Install Ollama on your computer.
  • Install the Claude Code terminal interface.
  • Launch Claude Code with a local Ollama model.
Install Ollama
  • Check whether Ollama is already available by running this command:
ollama ls

Choose the tab that matches what you see.

✔️ I see the model list

Ollama is ready. An empty model list is expected before your first model download.

ⓧ Command not found

Install Ollama using the instructions for your operating system.

macOS
  • Open the Ollama download page in your browser.
  • Download the macOS installer.
  • Open the downloaded ollama.dmg file.
  • Drag Ollama into your Applications folder.
  • Press Cmd+Space to open Spotlight.
  • Type Ollama and press Enter to open it.
  • Allow Ollama to add its command-line tool if macOS asks for permission.
  • Confirm the installation by running:
ollama ls

You'll see the model list or an empty table.

Windows
  • Open the Ollama download page in your browser.
  • Download the Windows installer.
  • Open OllamaSetup.exe from your downloads.
  • Complete the installation prompts.
  • Press the Windows key to open Search.
  • Type Ollama and press Enter to open it.
  • Confirm the installation in PowerShell by running:
ollama ls

You'll see the model list or an empty table.

Linux
  • Install Ollama by running this command:
curl -fsSL https://ollama.com/install.sh | sh
  • Confirm the installation by running:
ollama ls

You'll see the model list or an empty table.

Ollama still unavailable?

Close your terminal and open a new one so it reloads the command path. If the command still fails, help me troubleshoot my Ollama installation.

Navigate in the terminal to your Downloads folder.

cd ~/Downloads
Install Claude Code
  • Check whether Claude Code is already installed by running this command:
claude --version

Choose the tab that matches the result.

✔️ I see a version number

Claude Code is installed and ready to connect to Ollama.

ⓧ Command not found

Install Claude Code using the command for your operating system.

macOS
  • Install Claude Code by running this command:
curl -fsSL https://claude.ai/install.sh | bash
Windows
  • Install Claude Code in PowerShell by running this command:
irm https://claude.ai/install.ps1 | iex
Linux
  • Install Claude Code by running this command:
curl -fsSL https://claude.ai/install.sh | bash
  • Close your terminal after the installer finishes.
  • Open a new terminal.
  • Confirm the installation by running:
claude --version

You'll see the installed Claude Code version.

Claude command still unavailable?

A new terminal usually picks up the installed command. If it remains unavailable, help me troubleshoot the Claude Code installation.

Launch a local model

The first launch downloads the local qwen3.5 model if it's not already on your computer. Expect this to take a few minutes. Ollama shows the download progress.

Due to performance concerns and possible RAM/VRAM/GPU limitations your system may have, we will use a small-size qwen model with 4 Billion parameters.

  • Launch Claude Code with the local model by running this command:
ollama launch claude --model qwen3.5
  • Approve the model download if Ollama asks for confirmation.
  • Select Yes, I trust this folder if Claude Code shows a folder trust prompt.

Before you test it, do you think the response comes from Anthropic's cloud or the model on your computer?

  • Test the local model by entering this prompt:
Hello. Tell me which model is answering and what you can do in this folder.

You'll see a response inside Claude Code. That response confirms the terminal interface is using your local Ollama model without a paid Claude subscription.

Local model not responding?

Keep the Ollama app running while Claude Code is open. Local coding models can also require substantial memory, so close other demanding apps before retrying.

If the launch still fails, help me troubleshoot Claude Code with Ollama.

Your local AI assistant is running without subscription charges. Next, you'll see how Claude Code protects your files before making changes.

Understand Your Safety Net

Give Claude Your First Task

Claude Code is installed and responding. Time to give it a real task with real files on your computer.

Your Downloads folder is probably full of random files that have piled up over weeks or months. In this step, you will ask Claude to analyze that folder, propose an organization plan, and sort everything into subfolders. Along the way, you will learn how Claude asks for your permission before doing anything.

In this step, get ready to:
  • Ask Claude to analyze your Downloads folder.
  • Learn how to approve or reject Claude's actions.
  • Watch Claude organize your files into subfolders.
Ask Claude to look at your Downloads folder

Before organizing anything, you want to understand what is in there. You will ask Claude to scan your Downloads folder and report back what it finds.

  • Make sure Claude Code is open in your terminal. If you closed it, type claude and press Enter to start a new session.
  • Type the following prompt and press Enter:
Look at my Downloads folder and tell me: how many files are there, what types of files do you see, and what is the oldest file?
  • If Claude Code shows a Permissions dialog listing the command it wants to run, press Enter to approve it.

How do I decide whether to approve?

Read actions are always safe. If Claude says it wants to move, rename, or delete something, read the details first. If you are unsure, deny it and Claude will explain what it needs.

On macOS, you may also see a system popup asking whether to allow Claude Code access to your Downloads folder. Click Allow. This is a one-time macOS permission, separate from Claude's own dialogs.

Take a moment to read Claude's summary. You now know what is in your Downloads folder without opening a single file yourself.

Tell Claude to organize it

Now that you know what is in there, tell Claude how you want it organized. Be specific about which file types go into which folders.

  • Type the following prompt and press Enter. Customize the categories to match the file types Claude found:
My Downloads folder is a mess. Can you organize it into subfolders by file type? Show me your plan before you move anything.

Why ask Claude to show its plan first?

Including "show me your plan first" in your prompt forces Claude to stop and explain before acting. You get to see exactly how many files will move and where they will go. This is a habit worth building: always ask Claude to show its work before making changes.

  • Claude presents a plan showing how many files it will move to each subfolder. Read through it.
  • If the plan looks good, type yes and press Enter to approve.
  • Claude starts moving files. It asks permission for each mv (move) command. Approve each one by pressing Enter.

Too many permission prompts?

If Claude asks permission for every single file move and you are tired of pressing Enter, look for the option that says Always approve mv or similar. Selecting it lets Claude run all mv commands for the rest of this session without asking each time.

Help me manage Claude Code's permission prompts

💡 Use Plan Mode when you just want ideas

If you ever want Claude to think through a problem without touching any files, press Shift+Tab twice to enter Plan Mode. In this mode, Claude reads and analyzes but never moves, renames, or deletes anything.

Press Shift+Tab twice again to return to normal mode when you are ready to let Claude act.

💡 Three habits for better prompts

These three patterns work for any task you give Claude Code, not just file organization.

  • Be specific: name the folder path, file types, and destination. Vague prompts produce vague results.
  • Ask for a plan first: include "show me your plan before you start" so you always know what will happen before it happens.
  • Build on results: after Claude finishes, refine with follow-ups like "also sort by date" or "undo that and try organizing by project instead." Claude remembers the full conversation.
Check what Claude did

Claude reports a summary when it finishes. But you should always verify with your own eyes.

  • Open your Downloads folder in Finder (macOS) or File Explorer (Windows).
  • You should see new subfolders: Documents, Images, Videos, and Misc.
  • Open each subfolder and spot-check that the right files landed in the right places.
  • Back in Claude Code, type /cost and press Enter to see how many tokens that task used.

What is /cost?

The /cost command shows how much of your subscription's usage you have consumed this session. It is a handy way to track how "expensive" different tasks are. Simple file organization typically uses very little.

Files ended up in the wrong folder?

No problem. This is normal. Just ask Claude to fix it. For example: "Move the PDFs from Misc into Documents." Claude remembers what it did and can correct individual files without re-running the whole organization.

Help me move files that Claude put in the wrong folder

  • Press Esc to dismiss the permission overlay and return to the main input where you can type your next prompt.

Your Downloads folder is organized and you have seen how Claude asks permission before every action. Next up, you will teach Claude your preferences so it remembers how you like things done across every session.

Set Up CLAUDE.md

You just organized a real folder using nothing but plain English prompts. That proves Claude Code works.

But right now, every time you start a new session, Claude forgets everything about you. Your preferences, your naming style, which folders are off-limits. In this step, you will create a CLAUDE.md file that teaches Claude your preferences once so it remembers them automatically in every future session.

In this step, get ready to:
  • Create a CLAUDE.md preferences file using the /init command.
  • Fill it with your personal rules and organization style.
  • Test that Claude remembers your preferences across sessions.
Create your preferences file

Claude Code has a memory system built on a file called CLAUDE.md. This is a plain text file that Claude reads at the start of every session. Whatever instructions you write in it, Claude follows automatically without you needing to repeat yourself.

  • In your terminal (with Claude Code still running), type the following command and press Enter:
/init

What does /init do?

The /init command creates a CLAUDE.md file in the current folder. Claude Code reads this file at the start of every session and treats the contents as persistent instructions.

For personal preferences that apply everywhere, the file lives at ~/.claude/CLAUDE.md (your user-level preferences). For folder-specific preferences, it lives in the folder where you ran the command.

Claude Code will ask you a few questions about how you like to work. Answer them honestly. If you prefer a more guided experience, try this alternative approach instead:

  • Type the following prompt into Claude Code:
Help me create a CLAUDE.md for my personal file management. Ask me questions about my preferences so you can write it for me.

Ask the AI to interview you

When you don't know what you don't know, ask the AI to interview you. Instead of staring at a blank screen trying to think of every preference upfront, you hand that job to Claude.

Use this pattern anytime you need something personalized: writing a resume, configuring a tool, drafting project requirements. Say what you want to end up with and ask Claude to ask you the questions.

  • Review the final CLAUDE.md by asking Claude to display it:
show me the final CLAUDE.md

Make sure it captures your actual preferences and remove anything generic.

Test that your preferences work

The real test is whether Claude remembers your preferences after you reset the conversation. A fresh session forces Claude to re-read CLAUDE.md from scratch.

  • Clear your current conversation by typing this command:
/clear
  • Now ask Claude something about your files without mentioning your preferences. For example:
I want to reorganize my Desktop. What's your plan?
  • Check Claude's response. It should already reflect your preferences (showing a plan first, asking before deleting, using your preferred organization style) without you having to remind it.

What should I see?

Claude's response should show that it already knows your rules. If you said "always show a plan before making changes," Claude should present a plan and ask for approval rather than jumping straight into moving files.

If you said "never touch my Work folder," Claude should either skip that folder or mention it as excluded.

🙋‍♀️ Claude ignored my preferences?

Make sure you ran /init from the same folder where you are now working. Claude Code only reads CLAUDE.md files from the current directory or from ~/.claude/CLAUDE.md (your global user preferences).

Try running /init again from the same folder to regenerate the file. Then run /clear and test again.

Help me figure out why Claude isn't reading my CLAUDE.md preferences

Your CLAUDE.md is set. From now on, every Claude Code session starts with your personal rules already loaded. You have a working AI assistant that knows how you like things done.

Secret mission

Digital Storage Audit

You've organized one folder. But what about the big picture? Build a multi-step audit command that scans multiple folders, finds duplicates, identifies forgotten files, and produces a readable report you can act on every month.

Clean Up Your Resources

Clean Up Your Resources

Decide whether to keep your local resources, pause the running apps, or delete them entirely. This project uses a local Ollama model, so there are no subscription or API charges.

Resources you used:

  • Ollama application and the local qwen3.5 model.
  • Claude Code installation and local configuration files.
  • CLAUDE.md preferences file.
  • Custom commands stored in the .claude/commands/ directory.
  • storage-audit.md report saved to your Desktop.
  • Organized folder and the subfolders created during the project.

Keep everything running

No action is needed. Choose this if you plan to keep using Claude Code with your local Ollama model.

  • Keep Ollama and Claude Code installed.
  • Keep the qwen3.5 model downloaded for future sessions.
  • Keep your CLAUDE.md, custom commands, and project files in place.
  • Expect no subscription or API charges from this local setup.

Pause - I'll come back to this later

Shut down the running tools to free memory while keeping the model and files for later. Your local setup remains free while paused.

  • Exit Claude Code by pressing Ctrl+C in its terminal.
  • Pause Ollama using the instructions for your operating system.

macOS

  • Click the Ollama icon in the macOS menu bar.
  • Select Quit Ollama.

Windows

  • Right-click the Ollama icon in the Windows system tray.
  • Select Quit Ollama.

Linux

  • Stop the Ollama service by running:
sudo systemctl stop ollama

Your downloaded model, settings, and project files remain ready for your next session.

Delete - I don't want to use this again

Deleting the local tools removes the downloaded model and your Claude Code settings. Your personal organized folder stays untouched so you can review its files safely.

  • Remove the local model by running this command:
ollama rm qwen3.5
  • Confirm the model is gone by running:
ollama ls

You should no longer see qwen3.5 in the model list.

Remove Claude Code, Ollama, and the generated files using the instructions for your operating system.

macOS

  • Remove the Claude Code native installation by running:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
  • Remove Claude Code settings and generated project files by running:
rm -rf ~/.claude
rm -f ~/.claude.json
rm -f ~/CLAUDE.md
rm -f ~/Desktop/storage-audit.md
  • Remove Ollama and its remaining local data by running:
sudo rm -rf /Applications/Ollama.app
sudo rm -f /usr/local/bin/ollama
rm -rf ~/.ollama

Windows

  • Remove the Claude Code native installation in PowerShell by running:
Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force
  • Remove Claude Code settings and generated project files by running:
Remove-Item -Path "$env:USERPROFILE\.claude" -Recurse -Force
Remove-Item -Path "$env:USERPROFILE\.claude.json" -Force
Remove-Item -Path "$env:USERPROFILE\CLAUDE.md" -Force
Remove-Item -Path "$env:USERPROFILE\Desktop\storage-audit.md" -Force
  • Press the Windows key and type Add or remove programs.
  • Open Add or remove programs.
  • Find Ollama in the installed apps list.
  • Click Uninstall for Ollama.

Linux

  • Remove the Claude Code native installation by running:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
  • Remove Claude Code settings and generated project files by running:
rm -rf ~/.claude
rm -f ~/.claude.json
rm -f ~/CLAUDE.md
rm -f ~/Desktop/storage-audit.md
  • Remove the Ollama service by running:
sudo systemctl stop ollama
sudo systemctl disable ollama
sudo rm /etc/systemd/system/ollama.service
  • Remove the Ollama libraries, binary, and local service data by running:
sudo rm -r $(which ollama | tr 'bin' 'lib')
sudo rm $(which ollama)
sudo userdel ollama
sudo groupdel ollama
sudo rm -r /usr/share/ollama
  • Review your organized folder in Finder or File Explorer.
  • Delete only the project-created subfolders you no longer want.

That's a Wrap!

That's a Wrap!

You've gone from never having opened a terminal to having an AI-powered personal assistant at your fingertips!

You've learned how to:

  • Installed and authenticated Claude Code on your system, and learned Plan Mode for safe exploration and Normal Mode for supervised actions.
  • Mastered three prompting patterns that work for any task: specificity with variables, plan-before-action, and building on results.
  • Created a CLAUDE.md memory file for persistent preferences and built reusable custom commands for ongoing file maintenance.
  • Built a comprehensive storage audit command that finds duplicates, large forgotten files, and wasted space across multiple folders.

Ready to quiz yourself?