Skip to content

Commit 7100754

Browse files
kochj23claude
andcommitted
docs: Thorough README audit and rewrite for v6.3.0 accuracy
Fixed inaccuracies: - Removed "No IDE integration" — Xcode Source Editor Extension ships in v6.3.0 - Removed "No internet access" — GitHub tool calls GitHub API - Removed stale Python Import Validation security bullet (Python is gone) - Removed stale cloud AI credential storage section (AIBackendManager deleted) - Opening line updated: "no cloud inference" not "no API keys" (GitHub API exists) Improved content: - Features section now has dedicated Xcode Integration section covering both the chat tools AND the Source Editor Extension - GitHub Integration gets its own section - Architecture diagram expanded with Views layer and XcodeActionHandler - Key design decisions updated (Jinja fallback, extension communication) - Security section rewritten to be accurate: no Python, no cloud AI, GitHub-only network - What It Doesn't Do: replaced IDE integration item with accurate extension caveat - Version history consolidated and cleaned up Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent a1e5fb3 commit 7100754

1 file changed

Lines changed: 75 additions & 92 deletions

File tree

README.md

Lines changed: 75 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
**Local AI coding assistant for macOS, powered by Apple MLX (Machine Learning eXtensions).**
88

9-
MLX Code runs language models directly on your Mac using Apple Silicon. No cloud, no API keys, no subscriptions. Your code stays on your machine.
9+
MLX Code runs language models directly on your Mac using Apple Silicon. No cloud inference, no subscriptions, no data leaving your machine. Integrates directly into Xcode via a Source Editor Extension.
1010

1111
---
1212

1313
## What It Does
1414

15-
MLX Code is a chat-based coding assistant with tool calling. You describe what you need, and the model reads files, searches code, runs commands, and builds your project — all locally.
15+
MLX Code is a chat-based coding assistant with tool calling and Xcode integration. You describe what you need, and the model reads files, searches code, runs commands, and builds your project — all locally.
1616

1717
**14 built-in tools:**
1818

@@ -24,7 +24,7 @@ MLX Code is a chat-based coding assistant with tool calling. You describe what y
2424
| **Glob** | Find files by pattern |
2525
| **Xcode** | Build, test, clean, archive, full deploy pipeline |
2626
| **Git** | Status, diff, commit, branch, log, push, pull |
27-
| **GitHub** | Issues, PRs (Pull Requests), branches, credential scanning |
27+
| **GitHub** | Issues, PRs, branches, credential scanning (calls GitHub API) |
2828
| **Code Navigation** | Jump to definitions, find symbols |
2929
| **Code Analysis** | Metrics, dependencies, lint, symbols, full analysis |
3030
| **Error Diagnosis** | Analyze and explain build errors |
@@ -78,21 +78,40 @@ Read-only tools (grep, glob, file read, code navigation) auto-approve. Write/exe
7878
## Features
7979

8080
### Xcode Integration
81+
82+
MLX Code integrates with Xcode at two levels:
83+
84+
**Chat-based tools (built-in):**
8185
- Build, test, clean, archive from chat
82-
- Full deploy pipeline: version bump, build, archive, DMG (Disk Image), install
86+
- Full deploy pipeline: version bump, build, archive, DMG, install
8387
- Error diagnosis with context-aware analysis
84-
- GitHub integration: issues, PRs, branches, credential scanning
8588
- Code analysis: metrics, dependencies, linting, symbol inspection
8689

90+
**Xcode Source Editor Extension:**
91+
- Select code in Xcode → **Editor > MLX Code** → choose a command
92+
- Five commands: Explain Selection, Refactor Selection, Generate Tests, Fix Issues, Ask MLX Code
93+
- Enable once in System Settings → Privacy & Security → Extensions → Xcode Source Editor
94+
95+
### GitHub Integration
96+
97+
The GitHub tool connects to the GitHub API to:
98+
- View and create issues
99+
- List and create pull requests
100+
- Manage branches
101+
- Scan for exposed credentials before pushing
102+
87103
### User Memories
104+
88105
- Persistent preferences that shape assistant behavior
89106
- 50+ built-in coding standards across 8 categories
90-
- Custom memories stored locally (~/.mlxcode/memories.json)
107+
- Custom memories stored locally
91108
- Categories: personality, code quality, security, Xcode, git, testing, docs, deployment
92-
- User-specific settings (name, paths) injected at runtime — never hardcoded
109+
- User-specific settings injected at runtime — never hardcoded
93110

94111
### Context Management
112+
95113
- Token budgeting with automatic message compaction
114+
- Real-time context window usage bar (synced to actual model context size)
96115
- Project context auto-include when workspace is open
97116
- Two tool tiers: core (always available) and development (when project is open)
98117

@@ -111,7 +130,7 @@ MLX Code uses [mlx-community](https://huggingface.co/mlx-community) models from
111130
| DeepSeek Coder 6.7B | ~4 GB | 16K | Code-specific tasks |
112131
| Qwen 2.5 14B | ~8 GB | 32K | Best quality (needs 16GB+ RAM) |
113132

114-
Models download automatically on first use. You can also add custom models from any mlx-community repo.
133+
Models download automatically on first use via the native Hub Swift API. You can also add custom models from any mlx-community repo.
115134

116135
---
117136

@@ -121,6 +140,7 @@ Models download automatically on first use. You can also add custom models from
121140
- **Apple Silicon** (M1, M2, M3, M4)
122141
- **8 GB RAM** minimum (16 GB recommended for 7B models)
123142
- **No Python required** — inference and downloads are pure Swift
143+
- **Xcode 15+** — only required for the Source Editor Extension feature
124144

125145
---
126146

@@ -135,68 +155,64 @@ See **[INSTALLATION.md](INSTALLATION.md)** for the full setup guide, including m
135155
3. Launch the app → Settings → Models → download a model
136156
4. Load the model and start chatting
137157

138-
No Python required. MLX Code is fully self-contained.
139-
140158
---
141159

142160
## Architecture
143161

144162
```
145-
MLX Code (SwiftUI)
163+
MLX Code (SwiftUI macOS app)
146164
|
147165
|-- ChatViewModel # Conversation management, tool execution loop
148-
|-- MLXService # Native MLX Swift inference via mlx-swift-lm
166+
|-- MLXService # Native MLX Swift inference (mlx-swift-lm actor)
149167
|-- ContextManager # Token budgeting, message compaction
150168
|-- ToolRegistry # 14 registered tools (2 tiers)
151-
|-- SystemPrompts # Compact prompt with few-shot examples + user memories
152-
|-- UserMemories # Persistent coding standards and preferences
169+
|-- SystemPrompts # Compact prompt with tool descriptions + user memories
170+
|-- XcodeActionHandler # Handles incoming requests from the Xcode extension
153171
|
154172
|-- Services/
155-
| |-- GitHubService # GitHub API: issues, PRs, branches, credentials scan
173+
| |-- GitHubService # GitHub API: issues, PRs, branches, credential scan
156174
| |-- ContextAnalysis # Project structure and dependency analysis
157-
| `-- UserMemories # Configurable standards, custom memory persistence
175+
| `-- UserMemories # Built-in standards + custom memory persistence
176+
|
177+
|-- Views/
178+
| |-- ChatView # Main chat UI, input area, context bar
179+
| |-- MessageRowView # Per-message rendering with syntax highlighting
180+
| |-- CodeBlockView # Syntax-highlighted code blocks with copy button
181+
| `-- CollapsibleToolResultView # Collapsed tool call/result chips
158182
|
159183
|-- ViewModels/
160184
| |-- ProjectViewModel # Build operations and project management
161185
| |-- GitHubViewModel # GitHub panel state
162-
| `-- CodeAnalysis VM # Code metrics and analysis state
186+
| `-- CodeAnalysisViewModel # Code metrics and analysis state
163187
|
164-
`-- MLX Code Extension/ # Xcode Source Editor Extension (5 commands)
188+
`-- MLX Code Extension/ # Xcode Source Editor Extension (5 commands)
165189
```
166190

167191
**Key design decisions:**
168-
- Chat templates applied natively by `mlx-swift-lm` tokenizer — no Python required for inference
192+
- Inference via `mlx-swift-lm` Swift framework — no Python required
193+
- Chat templates applied natively by the tokenizer; falls back to flat format for unsupported models
169194
- Tool prompt is ~500 tokens (not 4000) — leaves room for actual conversation
170-
- Context budget system allocates tokens: system prompt, messages, project context, output reservation
195+
- Context budget system allocates tokens: system prompt, messages, project context, output
171196
- Two tool tiers: core (always available) and development (when project is open)
172197
- User memories injected at runtime from AppSettings — no personal data in source code
198+
- Xcode extension communicates via shared App Group container + `mlxcode://` URL scheme
173199

174200
---
175201

176202
## Security
177203

178204
### Shell Execution Safety
179205
- **Command Validation**: All bash commands pass through `CommandValidator` with regex word-boundary matching before execution, blocking dangerous patterns (rm -rf /, fork bombs, etc.)
180-
- **Python Import Validation (v6.1.0)**: Regex-based validation with comment filtering prevents bypass via inline comments
181-
- **No Shell Interpolation**: Git and build tools use `process.currentDirectoryURL` instead of `cd` string interpolation, preventing directory traversal and injection attacks
206+
- **No Shell Interpolation**: Git and build tools use `process.currentDirectoryURL` instead of string interpolation, preventing directory traversal and injection attacks
182207
- **Tool Approval Flow**: Write and execute tools (bash, file write, xcode build) require user confirmation before running
183208
- **Read-Only Auto-Approve**: Only safe, read-only tools (grep, glob, file read) auto-approve without user interaction
184-
- **Permission Checks (v6.1.0)**: File permission validation before script execution in CommandValidator
185-
186-
### Credential Security (v6.1.0)
187-
- **macOS Keychain Storage**: All API keys (OpenAI, Anthropic, Google, AWS, Azure, IBM) stored in macOS Keychain using `SecItemAdd`/`SecItemCopyMatching`
188-
- **Automatic Migration**: Existing UserDefaults-stored keys automatically migrated to Keychain on first launch
189-
- **No Plaintext Secrets**: Non-secret config only (region, model names) stored in UserDefaults
190-
191-
### Model Security (v6.1.0)
192-
- **SHA256 Hash Verification**: Downloaded models verified against expected hashes using CryptoKit
193-
- **Secure Logging**: All debug output routed through `SecureLogger` instead of `print()` — no sensitive data in console
194209

195210
### Data Privacy
196-
- **100% Local**: All model inference runs on-device via Apple MLX -- no data leaves your machine
197-
- **No Telemetry**: No analytics, crash reporting, or usage tracking
198-
- **No API Keys Required**: No cloud services, no subscriptions, no accounts
199-
- **Local Memory Storage**: User memories stored in `~/.mlxcode/memories.json`, never transmitted
211+
- **100% Local Inference**: All model inference runs on-device via Apple MLX — no prompts or responses leave your machine
212+
- **No Telemetry**: No analytics, crash reporting, or usage tracking of any kind
213+
- **No Cloud AI**: No OpenAI, Anthropic, or other cloud AI services — the model runs on your GPU
214+
- **GitHub API only**: The only external network calls are to the GitHub API (via the GitHub tool), which you explicitly invoke
215+
- **Local Memory Storage**: User memories stored locally, never transmitted
200216

201217
### Thread Safety
202218
- **Actor isolation**: `MLXService` is a Swift actor — all model state is automatically serialized
@@ -209,98 +225,65 @@ MLX Code (SwiftUI)
209225

210226
- **Deeper Xcode integration** — write responses back into the editor buffer without switching apps
211227
- **Structured output** — grammar-constrained generation to guarantee well-formed tool calls from smaller models
212-
- **Streaming progress UI** — real-time download progress bar for model downloads
228+
- **Streaming download progress** — real-time progress bar for model downloads
213229

214230
---
215231

216232
## What It Doesn't Do
217233

218234
Being honest about limitations:
219235

220-
- **No web browsing** — can't fetch arbitrary URLs or browse the internet (GitHub API is the exception)
236+
- **No web browsing** — can't fetch arbitrary URLs or browse the internet
221237
- **No image/video/audio generation** — this is a code assistant, not a media tool
222238
- **Small model constraints** — 3-14B parameter models make mistakes, especially with complex multi-step reasoning
223-
- **No IDE integration**standalone app, not an Xcode plugin (yet)
224-
- **Tool calling is imperfect**local models sometimes format tool calls incorrectly
239+
- **Tool calling is imperfect**local models sometimes format tool calls incorrectly (auto-retry helps but isn't perfect)
240+
- **Extension requires app switch**the Xcode extension opens MLX Code in a separate window rather than responding inline
225241

226242
---
227243

228244
## Version History
229245

230246
### v6.3.0 (March 4, 2026) — Current
231-
- **Xcode Source Editor Extension** — 5 commands in Editor > MLX Code menu (Explain, Refactor, Generate Tests, Fix Issues, Ask). Communicates with main app via shared App Group + `mlxcode://` URL scheme
232-
- **Native model downloads** — replaced Python `huggingface_downloader.py` with `Hub.HubApi.snapshot()`. Python fully eliminated from the app
247+
- **Xcode Source Editor Extension** — 5 commands in Editor > MLX Code menu (Explain, Refactor, Generate Tests, Fix Issues, Ask). Communicates via shared App Group + `mlxcode://` URL scheme
248+
- **Native model downloads** — replaced Python downloader with `Hub.HubApi.snapshot()`. Python fully eliminated
233249
- **Syntax highlighting** — Swift, Python, JS/TS, Bash, JSON, Objective-C in all code blocks
234-
- **Collapsed tool calls** — raw `<tool>` assistant messages now show as a compact chip; expand to inspect
250+
- **Collapsed tool calls** — raw `<tool>` assistant messages show as a compact chip; expand to inspect
235251
- **Accurate context bar** — syncs to model's actual context window on load; tracks conversation totals
236252
- **Resume generation** — Continue button on last assistant message after stopping
237253
- **Tool call reliability** — JSON auto-repair, retry-on-failure loop, stricter system prompt rule
238254
- **Default temperature 0.2** — reduced from 0.7 to cut hallucinations in code analysis
239-
- **Jinja template fallback** — models with unsupported chat templates (e.g. Mistral 7B) now fall back gracefully to flat prompt format instead of crashing
255+
- **Jinja template fallback** — models with unsupported chat templates fall back to flat prompt format
240256

241257
### v6.2.0 (March 4, 2026)
242-
**Native MLX Swift — Python dependency eliminated for inference**
243-
244-
- Replaced Python subprocess daemon (`mlx_daemon.py`) with native `mlx-swift-lm` framework
245-
- Model loading now uses `LLMModelFactory` + `ModelContainer` directly in Swift — no Python process
246-
- Chat generation uses `MLXLMCommon.UserInput` + `AsyncStream<Generation>` for streaming
247-
- Tokenizer chat templates applied natively (Llama, Qwen, Mistral, etc.)
248-
- Python still used only for initial model download (`huggingface_downloader.py`)
249-
- Removed 2,726 lines of dead code: `EthicalAIGuardian`, `AIBackendStatusMenu`, all 4 `AIBackendManager` files
250-
- `mlx_daemon.py` no longer bundled in the app
251-
252-
### v6.1.1 (March 4, 2026)
253-
- Removed dead `ContentView.swift` (deprecated stub, never referenced anywhere)
254-
- Removed dead `MLXSwiftBackend.swift` (class was never instantiated — entire file was unused)
255-
- Removed `handleDirectToolInvocation()` in ChatViewModel, which always returned `false`
256-
- Removed debug code that was writing to `/tmp/mlx_debug.log` on every message send in production
257-
- Fixed force unwrap on `FileManager.urls().first!` in ChatViewModel and ConversationManager
258-
- Replaced bare `print()` with `LogManager` in ConversationManager for consistent error logging
259-
- Stripped ~15 noisy trace-level log calls from `generateResponse()` (per-token logging, emoji-prefixed step tracing)
260-
- Removed redundant inline comments that restated what the adjacent code already said
261-
262-
### v6.1.0 (February 26, 2026)
263-
- Comprehensive security audit: 31 findings resolved (2 CRITICAL, 8 HIGH, 10 MEDIUM, 9 LOW, 1 INFO)
264-
- API keys migrated from UserDefaults to macOS Keychain with automatic migration
265-
- Command validator hardened with NSRegularExpression word-boundary matching
266-
- Python import validator hardened with regex matching and comment filtering
267-
- SHA256 model hash verification using CryptoKit
268-
- Buffered 4096-byte I/O replacing byte-by-byte daemon communication
269-
- Task cancellation (`while !Task.isCancelled`) replacing infinite loops
270-
- Bundle-relative paths replacing hardcoded file paths
271-
- Multi-version Python path lookup (3.13 down to 3.9)
272-
- Serial queues for thread-safe MLX service operations
273-
- SecureLogger replacing all `print()` statements
274-
- Async logging via serial queue in CommandValidator
275-
- `localizedCaseInsensitiveContains()` for proper Unicode search
276-
- O(n) context management replacing O(n^2) insert-at-zero pattern
277-
- 1MB file content cap for memory management in codebase indexer
278-
- Implemented Clear Conversations confirmation dialog in Settings
279-
- Force unwrap elimination in MLXService
280-
- NSString cast chains replaced with URL API across 3 files
281-
- Named constants for context budget ratios
258+
- Replaced Python subprocess daemon with native `mlx-swift-lm` framework for inference
259+
- Model loading via `LLMModelFactory` + `ModelContainer` — no Python process
260+
- Chat generation via `MLXLMCommon.UserInput` + `AsyncStream<Generation>`
261+
- Removed 2,726 lines of dead code (`EthicalAIGuardian`, `AIBackendStatusMenu`, all `AIBackendManager` files)
262+
263+
### v6.1.x (March 4, 2026)
264+
- Comprehensive security audit: 31 findings resolved
265+
- API key storage migrated to macOS Keychain
266+
- Dead code removal, debug artifact cleanup, force unwrap fixes
267+
- Consistent logging via SecureLogger throughout
282268

283269
### v6.0.0 (February 20, 2026)
284270
- GitHub integration: issues, PRs, branches, credential scanning
285271
- Code analysis: metrics, dependencies, lint, symbols
286272
- Xcode full deploy pipeline: build, archive, DMG, install
287273
- User memories system — persistent coding standards and preferences
288-
- Context analysis service for project structure inspection
289-
- Project dashboard, GitHub panel, code analysis panel, build panel views
290274
- 14 tools (up from 11)
291275

292276
### v5.0.0 (February 2026)
293277
- Major simplification: deleted 41 files (~16,000 lines) of unused features
294-
- Rewrote system prompt to be honest and compact
278+
- Rewrote system prompt to be compact and honest
295279
- Default model: Qwen 2.5 7B
296-
- 11 focused tools
297280

298281
### v4.0.0 (February 2026)
299-
- Phase 1: Chat template support, structured message passing, tool tier system
300-
- Phase 2: Context budget system, smart token estimation, project context auto-include
282+
- Chat template support, structured message passing, tool tier system
283+
- Context budget system, smart token estimation, project context auto-include
301284
- Tool approval flow with auto-approve for read-only operations
302285

303-
### v1.x (January-February 2026)
286+
### v1.x (JanuaryFebruary 2026)
304287
- Initial release with MLX backend
305288
- Desktop widget extension
306289
- Basic chat interface
@@ -309,7 +292,7 @@ Being honest about limitations:
309292

310293
## License
311294

312-
MIT License - Copyright 2026 Jordan Koch
295+
MIT License Copyright 2026 Jordan Koch
313296

314297
See [LICENSE](LICENSE) for details.
315298

0 commit comments

Comments
 (0)