Local Claude Code for Mac
Project description
mlx-code: Local Claude Code for Mac
Quick Start
brew install --cask claude-code
pip install mlx-code
Commands
| Command | What it does | Example |
|---|---|---|
mlx-code |
Start interactive mode | mlx-code |
mlx-code "task" |
Run a one-time task | mlx-code "fix the build error" |
mlx-code -p "query" |
Run one-off query, then exit | mlx-code -p "explain this function" |
mlx-code -c |
Continue most recent conversation in current directory | mlx-code -c |
mlx-code -r |
Resume a previous conversation | mlx-code -r |
mlx-code commit |
Create a Git commit | mlx-code commit |
/clear |
Clear conversation history | /clear |
/help |
Show available commands | /help |
exit or Ctrl+C |
Exit Claude Code | exit |
Click to expand
╭─── Claude Code v2.1.74 ────────────────────────────────────────────────────────────────────────────────╮ │ │ Tips for getting started │ │ Welcome back! │ Run /init to create a CLAUDE.md file with instru… │ │ │ ───────────────────────────────────────────────── │ │ ▐▛███▜▌ │ Recent activity │ │ ▝▜█████▛▘ │ No recent activity │ │ ▘▘ ▝▝ │ │ │ │ │ │ mlx-community/Qwen3.5-4B-Opti… · API Usage Billing │ │ │ /…/T/tmpg4sztu_h/workspace │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯❯ explain the folder structure
⏺
⏺ Searched for 1 pattern (ctrl+o to expand)
⏺ Here's the folder structure of your workspace:
workspace/ ├── .DS_Store ├── cache/ │ └── cache.safetensors ├── cc/ │ ├── .DS_Store │ ├── mlx-code-v1.py │ └── mlx-code-v2.py ├── cyberpunk/ │ ├── build.zig │ ├── help.py │ ├── map.c │ └── main.zig ├── rag/ │ └── jina.py ├── rts/ │ ├── build.zig │ ├── main.zig │ └── battle_sim.c ├── splat_zig_raylib/ │ ├── README.md │ ├── .DS_Store │ ├── build.zig │ ├── build_web.sh │ ├── index.html │ ├── main.zig │ ├── gsplat_transform.py │ ├── src/ │ │ └── main.zig │ └── splat_zig/ │ ├── .DS_Store │ ├── build.zig │ ├── build_web.sh │ ├── gsplat_transform.py │ ├── index.html │ ├── main.zig │ └── splat/ │ └── build.zig ├── tarot/ │ ├── index.html │ └── tarot.py └── tmp.md
Summary of projects:
┌───────────────────┬────────────────────────────────────────────┐ │ Folder │ Purpose │ ├───────────────────┼────────────────────────────────────────────┤ │ cc/ │ MLX code versions (v1, v2) │ ├───────────────────┼────────────────────────────────────────────┤ │ cyberpunk/ │ Zig game project with C map integration │ ├───────────────────┼────────────────────────────────────────────┤ │ rag/ │ RAG (Retrieval-Augmented Generation) setup │ ├───────────────────┼────────────────────────────────────────────┤ │ rts/ │ Real-time strategy battle simulation │ ├───────────────────┼────────────────────────────────────────────┤ │ splat_zig_raylib/ │ Raylib game with splat transform features │ ├───────────────────┼────────────────────────────────────────────┤ │ tarot/ │ Tarot card application │ ├───────────────────┼────────────────────────────────────────────┤ │ cache/ │ Model cache files │ ├───────────────────┼────────────────────────────────────────────┤ │ tmp.md │ Temporary notes │ └───────────────────┴────────────────────────────────────────────┘
❯ how is output parsed in mlx-code.py?
⏺
⏺ Read 1 file (ctrl+o to expand)
⏺ Based on the code, here's how output is parsed in mlx-code.py:
Output Parsing Flow
- decode() function (lines 109-143)
This is the core parsing function that converts raw model output into structured blocks:
- Input: Raw text from the model
- Output: List of blocks with types: thinking, text, or tool_use
Key parsing logic:
- Splits text by `
⏺ ` markers for thinking content
- Extracts tool calls wrapped in <tool_call>...</tool_call> tags
- Parses function name and parameters from XML-like tags
- Tool Call Extraction (lines 125-141)
When parsing tool calls: tool_pattern = re.compile(r'<tool_call>(.*?)</tool_call>', re.DOTALL)
- Matches content between <tool_call> and </tool_call>
- Extracts function name: <function=name>
- Extracts parameters: <parameter=name>value
- Creates tool_use block with:
- type: "tool_use"
- id: UUID
- name: function name
- input: params dict
- blocks_to_sse() function (lines 145-177)
Converts parsed blocks to Server-Sent Events (SSE) format:
def event(name: str, data: dict) -> bytes: return f"event: {name}\ndata: {json.dumps(data)}\n\n".encode()
Event types sent:
- message_start - Initial message header
- content_block_start - Start of a content block
- content_block_delta - Streaming content (text/thinking/tool)
- content_block_stop - End of block
- message_delta - Stop reason
- message_stop - End of message
- HTTP Response (lines 288-297)
Sends SSE stream with headers: self.send_header("Content-Type", "text/event-stream") self.send_header("Cache-Control", "no-cache")
- Endpoint (/v1/messages)
- POST request with JSON body
- Returns streaming SSE response
- Supports max_tokens parameter
- Stop Reason Detection
- tool_use - If tool calls were generated
- end_turn - If just text/thinking was generated
✻ Brewed for 35s
❯ cool mate, bye
⏺ Got it! Feel free to come back anytime if you need help. Have a great day! 👋
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlx_code-0.0.1.tar.gz.
File metadata
- Download URL: mlx_code-0.0.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0098f3b7a760f8dd32538dd79811205f5f0f80d8c86edf606dfd21b65942d01f
|
|
| MD5 |
e7a3713dcd2d8a87cfe0ac3dcd77ebcd
|
|
| BLAKE2b-256 |
49259b388fd5306eed384df1d8e8a177d9168d19a3604983b38aa70c63d164bb
|
File details
Details for the file mlx_code-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mlx_code-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
698b998fdec1592f4439f40db260440d2d1e1b643823b8d4e23fbc98be633d92
|
|
| MD5 |
b2513a381d6c3fccff9623f11a71874e
|
|
| BLAKE2b-256 |
7ac8efa5192a731c20a85ee10708ed753ef30aecb2ab74a2d5c192ae23211835
|