Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Morph Code** is a fast, local-first native macOS coding agent studio powered by a single-binary pure-Go daemon (`morphcode`).

No Electron. No Node.js runtime required. Instant SQLite startup, native SwiftUI rendering, built-in Live Web Preview, Git diff & worktree workflows, interactive PTY terminal, and first-class support for **Claude Code**, **OpenAI Codex**, **DeepSeek**, and any **OpenAI / Anthropic-compatible custom provider** (OpenRouter, Ollama, Groq, xAI, LM Studio, and more).
No Electron. No Node.js runtime required. Instant SQLite startup, native SwiftUI rendering, built-in Live Web Preview, Git diff & worktree workflows, interactive PTY terminal, and first-class support for **Antigravity (`agy`)**, **Claude Code**, **OpenAI Codex**, **DeepSeek**, and any **OpenAI / Anthropic-compatible custom provider** (OpenRouter, Ollama, Groq, xAI, LM Studio, and more).

---

Expand All @@ -19,8 +19,8 @@ Morph Code is built natively from the ground up in **SwiftUI + AppKit** and **pu
| **UI Stack** | Native macOS SwiftUI + AppKit (120Hz ProMotion) | Electron / Chromium renderer |
| **Backend Daemon** | Single zero-CGO pure-Go binary (`~22 MB` RSS) | Node.js runtime & dependency tree |
| **Live Web Preview** | Built-in native `WKWebView` + viewports + Element Picker + Console/Network | Chromium WebView / external browser |
| **Execution Engine** | Built-in pure-Go **Morph Harness** + official `claude` / `codex` CLIs | External CLI wrapper |
| **Model Providers** | Claude, Codex, DeepSeek, OpenRouter, Ollama, Groq, xAI, any custom endpoint | CLI-bound providers |
| **Execution Engine** | Built-in pure-Go **Morph Harness** + official `agy` / `claude` / `codex` CLIs | External CLI wrapper |
| **Model Providers** | Antigravity (`agy`), Claude, Codex, DeepSeek, OpenRouter, Ollama, Groq, xAI, any custom endpoint | CLI-bound providers |
| **Local Storage & Search** | Embedded SQLite WAL + FTS5 instant rendering | Web / Node state layer |
| **Parallel Orchestration** | Configurable Orchestrator + per-provider Worker harnesses & worktrees | Thread-level CLI execution |

Expand All @@ -29,7 +29,7 @@ Morph Code is built natively from the ground up in **SwiftUI + AppKit** and **pu
## Highlights

- **Bring Your Own CLI or API Keys**
- Works out of the box with your locally installed **`claude`** (Claude Code) and **`codex`** (`codex app-server`) CLIs using your own local authentication.
- Works out of the box with your locally installed **`agy`** (Antigravity ACP), **`claude`** (Claude Code), and **`codex`** (`codex app-server`) CLIs using your own local authentication.
- Or run directly through Morph Code's built-in pure-Go agent harness (**Morph Harness**) using `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `DEEPSEEK_API_KEY`, or custom OpenAI/Anthropic-compatible endpoints (OpenRouter, Ollama, Groq, xAI, etc.).
- **Parallel Multi-Thread & Worktree Workspace**
- Run independent coding threads across multiple local repositories and isolated Git worktrees in parallel.
Expand Down Expand Up @@ -63,7 +63,7 @@ morph-code/
├─ agent/ # Built-in pure-Go coding agent loop, tools, compaction, MCP client
├─ checkpoint/ # Automatic per-turn workspace checkpoints and revert
├─ gitops/ # Git status, diff, worktrees, commits, GitHub PR ops
├─ harness/ # Official Claude CLI, Codex app-server, and built-in Morph Harness adapters
├─ harness/ # Official Agy ACP, Claude CLI, Codex app-server, and built-in Morph Harness adapters
├─ model/ # Shared workspace & streaming event schema
├─ router/ # Single-user local API key & custom provider configuration
├─ schedule/ # Persistent RRULE scheduler
Expand All @@ -80,7 +80,7 @@ morph-code/
- **macOS 15.0+** and **Xcode 16.4+**
- **Go 1.25+**
- **XcodeGen** (`brew install xcodegen`)
- Optional: official [`claude`](https://docs.anthropic.com/en/docs/claude-code) and/or [`codex`](https://github.com/openai/codex) CLI installed locally, or API keys configured in **Settings → Providers & Models**.
- Optional: official `agy` (Antigravity CLI), [`claude`](https://docs.anthropic.com/en/docs/claude-code), and/or [`codex`](https://github.com/openai/codex) CLI installed locally, or API keys configured in **Settings → Providers & Models**.

### 1. Run `morphcode` Daemon Tests & Build

Expand Down
4 changes: 2 additions & 2 deletions apple/Apps/Shared/MorphAppState+Accounts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extension MorphAppState {
if let map = cfg.providerHarnesses, !map.isEmpty {
providerHarnesses = map
} else {
providerHarnesses = ["claude": "morphcode", "codex": "morphcode"]
providerHarnesses = ["claude": "morphcode", "codex": "morphcode", "agy": "native"]
}
if let orchModel = cfg.orchestratorModel?.trimmingCharacters(in: .whitespacesAndNewlines), !orchModel.isEmpty {
orchestratorModel = orchModel
Expand All @@ -96,7 +96,7 @@ extension MorphAppState {
if let workers = cfg.workerHarnesses, !workers.isEmpty {
workerHarnesses = workers
} else {
workerHarnesses = ["claude": "morphcode", "codex": "morphcode"]
workerHarnesses = ["claude": "morphcode", "codex": "morphcode", "agy": "native"]
}
nativeCliAvailable = cfg.nativeCliAvailable ?? [:]
} catch {
Expand Down
105 changes: 63 additions & 42 deletions apple/Apps/Shared/MorphCustomProvidersSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ struct MorphProviderHarnessesSection: View {
let title: String
let cliName: String
let brand: MorphBrand
let nativeOnly: Bool
}

private let providers: [ProviderSpec] = [
ProviderSpec(id: "claude", title: "Claude", cliName: "claude", brand: .claude),
ProviderSpec(id: "codex", title: "Codex", cliName: "codex", brand: .openai),
ProviderSpec(id: "claude", title: "Claude", cliName: "claude", brand: .claude, nativeOnly: false),
ProviderSpec(id: "codex", title: "Codex", cliName: "codex", brand: .openai, nativeOnly: false),
ProviderSpec(id: "agy", title: "Antigravity (Agy)", cliName: "agy", brand: .gemini, nativeOnly: true),
]

private func concreteModelSections(selection: String) -> CodeModelMenu.Sections {
Expand All @@ -39,9 +41,12 @@ struct MorphProviderHarnessesSection: View {
"Orchestrator",
footnote: "When you pick Orchestrator in the model menu, the selected model decomposes and verifies tasks and dispatches worker subagents."
) {
let isAgyOrch = state.orchestratorModel.lowercased().hasPrefix("agy/")
MorphSettingsRow(
"Orchestrator Model",
detail: "\(providerDisplayName(for: state.orchestratorModel)) · morphcode Go harness"
detail: isAgyOrch
? "\(providerDisplayName(for: state.orchestratorModel)) · Official agy CLI (ACP)"
: "\(providerDisplayName(for: state.orchestratorModel)) · morphcode Go harness"
) {
EmptyView()
} trailing: {
Expand Down Expand Up @@ -157,77 +162,93 @@ struct MorphProviderHarnessesSection: View {
}

ForEach(providers) { spec in
let workerMode = CodeProviderHarnessMode(
rawValue: (state.workerHarnesses[spec.id] ?? "morphcode").lowercased()
) ?? .morphcode
let workerMode: CodeProviderHarnessMode = spec.nativeOnly
? .native
: (CodeProviderHarnessMode(
rawValue: (state.workerHarnesses[spec.id] ?? "morphcode").lowercased()
) ?? .morphcode)
let cliInstalled = state.nativeCliAvailable[spec.id]
let cliLabel: String = {
if let installed = cliInstalled {
return installed ? "\(spec.cliName) CLI installed" : "\(spec.cliName) CLI not found"
}
return "Checking \(spec.cliName) CLI"
}()
let detail = workerMode == .morphcode
? "Worker: built-in morphcode Go harness · \(cliLabel)"
: "Worker: official \(spec.cliName) CLI · \(cliLabel)"
let detail = spec.nativeOnly
? "Worker: official \(spec.cliName) CLI (ACP) · \(cliLabel)"
: (workerMode == .morphcode
? "Worker: built-in morphcode Go harness · \(cliLabel)"
: "Worker: official \(spec.cliName) CLI · \(cliLabel)")

MorphSettingsRow("\(spec.title) Worker", detail: detail) {
MorphServiceIcon(brand: spec.brand)
} trailing: {
AnymorphSegmentControl(
items: CodeProviderHarnessMode.allCases,
selection: Binding(
get: { workerMode },
set: { newMode in
guard newMode != workerMode else { return }
Task {
await state.setWorkerHarness(provider: spec.id, mode: newMode)
if spec.nativeOnly {
AnymorphBadge("Native CLI")
} else {
AnymorphSegmentControl(
items: CodeProviderHarnessMode.allCases,
selection: Binding(
get: { workerMode },
set: { newMode in
guard newMode != workerMode else { return }
Task {
await state.setWorkerHarness(provider: spec.id, mode: newMode)
}
}
}
),
label: { $0.label }
)
.disabled(state.isSavingProviderHarnesses)
),
label: { $0.label }
)
.disabled(state.isSavingProviderHarnesses)
}
}
}
}

MorphSettingsGroup(
"Default Provider Harness",
footnote: "Choose whether Claude and Codex run through morphcode's built-in Go harness (zero external CLI dependency) or proxy through their official local CLI."
footnote: "Choose whether Claude and Codex run through morphcode's built-in Go harness (zero external CLI dependency) or their official local CLI. Antigravity (Agy) runs exclusively via the official local agy CLI (ACP)."
) {
ForEach(providers) { spec in
let currentMode = CodeProviderHarnessMode(
rawValue: (state.providerHarnesses[spec.id] ?? "morphcode").lowercased()
) ?? .morphcode
let currentMode: CodeProviderHarnessMode = spec.nativeOnly
? .native
: (CodeProviderHarnessMode(
rawValue: (state.providerHarnesses[spec.id] ?? "morphcode").lowercased()
) ?? .morphcode)
let cliInstalled = state.nativeCliAvailable[spec.id]
let cliState: String = {
if let installed = cliInstalled {
return installed ? "\(spec.cliName) CLI installed" : "\(spec.cliName) CLI not found"
}
return "Checking \(spec.cliName) CLI"
}()
let statusDetail = currentMode == .morphcode
? "Built-in morphcode Go harness · \(cliState)"
: "Official \(spec.cliName) CLI proxy · \(cliState)"
let statusDetail = spec.nativeOnly
? "Official \(spec.cliName) CLI (ACP) · \(cliState)"
: (currentMode == .morphcode
? "Built-in morphcode Go harness · \(cliState)"
: "Official \(spec.cliName) CLI · \(cliState)")

MorphSettingsRow(spec.title, detail: statusDetail) {
MorphServiceIcon(brand: spec.brand)
} trailing: {
AnymorphSegmentControl(
items: CodeProviderHarnessMode.allCases,
selection: Binding(
get: { currentMode },
set: { newMode in
guard newMode != currentMode else { return }
Task {
await state.setProviderHarness(provider: spec.id, mode: newMode)
if spec.nativeOnly {
AnymorphBadge("Native CLI")
} else {
AnymorphSegmentControl(
items: CodeProviderHarnessMode.allCases,
selection: Binding(
get: { currentMode },
set: { newMode in
guard newMode != currentMode else { return }
Task {
await state.setProviderHarness(provider: spec.id, mode: newMode)
}
}
}
),
label: { $0.label }
)
.disabled(state.isSavingProviderHarnesses)
),
label: { $0.label }
)
.disabled(state.isSavingProviderHarnesses)
}
}
}
}
Expand Down
47 changes: 32 additions & 15 deletions apple/Apps/Shared/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public struct SettingsView: View {
VStack(alignment: .leading, spacing: 24) {
MorphSettingsGroup(
"Built-In Providers & Local CLIs",
footnote: "Morph Code automatically uses your locally installed Claude Code or Codex CLI authentication. You can also configure API keys stored locally in ~/.morph-code/providers.json (0600) or via standard environment variables."
footnote: "Morph Code automatically uses your locally installed Antigravity (agy), Claude Code, or Codex CLI authentication. You can also configure API keys stored locally in ~/.morph-code/providers.json (0600) or via standard environment variables."
) {
Button {
Task {
Expand Down Expand Up @@ -287,13 +287,17 @@ public struct SettingsView: View {

private func builtinProviderRow(_ choice: LocalProviderChoice) -> some View {
let hasCLI = choice.supportsLocalCLI && (state.nativeCliAvailable[choice.rawValue] == true)
let hasKey = state.providerKeyStatus[choice.rawValue] == true
let hasKey = choice.supportsAPIKey && (state.providerKeyStatus[choice.rawValue] == true)
let detail: String = {
var parts: [String] = []
if choice.supportsLocalCLI {
parts.append(hasCLI ? "Local \(choice.cliBinaryName) CLI detected" : "\(choice.cliBinaryName) CLI not found")
}
parts.append(hasKey ? "API key configured" : "Env: \(choice.envKeyName)")
if choice.supportsAPIKey {
parts.append(hasKey ? "API key configured" : "Env: \(choice.envKeyName)")
} else {
parts.append("Official \(choice.cliBinaryName) CLI (ACP)")
}
return parts.joined(separator: " · ")
}()

Expand All @@ -304,18 +308,22 @@ public struct SettingsView: View {
if hasCLI || hasKey {
AnymorphBadge(hasKey ? "API Key" : "Local CLI")
}
Button(hasKey ? "Update Key" : "Set API Key") {
editingProviderKey = choice
}
.anymorphButton(size: .inline, appearance: .secondary)
if hasKey {
Button {
Task { await state.clearProviderKey(provider: choice.rawValue) }
} label: {
Image(systemName: "trash")
if choice.supportsAPIKey {
Button(hasKey ? "Update Key" : "Set API Key") {
editingProviderKey = choice
}
.anymorphButton(size: .inline, appearance: .secondary)
if hasKey {
Button {
Task { await state.clearProviderKey(provider: choice.rawValue) }
} label: {
Image(systemName: "trash")
}
.morphRound(diameter: 24)
.help("Clear saved API key")
}
.morphRound(diameter: 24)
.help("Clear saved API key")
} else if !hasCLI {
AnymorphBadge("Not Installed")
}
}
}
Expand Down Expand Up @@ -364,6 +372,7 @@ private struct SettingsNavRow: View {
// MARK: - Add Local Provider Account / Key Sheet

private enum LocalProviderChoice: String, CaseIterable, Identifiable {
case agy
case claude
case codex
case deepseek
Expand All @@ -372,18 +381,24 @@ private enum LocalProviderChoice: String, CaseIterable, Identifiable {

var title: String {
switch self {
case .agy: return "Antigravity (Agy)"
case .claude: return "Claude"
case .codex: return "Codex"
case .deepseek: return "DeepSeek"
}
}

var supportsLocalCLI: Bool {
self == .claude || self == .codex
self == .agy || self == .claude || self == .codex
}

var supportsAPIKey: Bool {
self != .agy
}

var cliBinaryName: String {
switch self {
case .agy: return "agy"
case .claude: return "claude"
case .codex: return "codex"
case .deepseek: return ""
Expand All @@ -392,6 +407,7 @@ private enum LocalProviderChoice: String, CaseIterable, Identifiable {

var envKeyName: String {
switch self {
case .agy: return ""
case .claude: return "ANTHROPIC_API_KEY"
case .codex: return "OPENAI_API_KEY"
case .deepseek: return "DEEPSEEK_API_KEY"
Expand All @@ -400,6 +416,7 @@ private enum LocalProviderChoice: String, CaseIterable, Identifiable {

var brand: MorphBrand {
switch self {
case .agy: return .gemini
case .claude: return .claude
case .codex: return .openai
case .deepseek: return .deepseek
Expand Down
Loading
Loading