Bamboo is a macOS browser with three layers:
- WebKit renders pages. Each tab is a
WKWebView; WebKit runs page content in its own sandboxed processes and shares one copy of the engine with the system, which is why Bamboo uses far less memory than Chromium-based browsers. - A Swift app (AppKit windows, SwiftUI views) is the browser itself: windows, tabs, the address bar, settings, the Claude panel.
- A Rust core does the work that doesn't need AppKit: ad blocking, the history and bookmarks database, importing from other browsers, and the MCP server agents connect to. Swift calls it through bindings generated by UniFFI.
┌──────────────────────────── Bamboo.app ────────────────────────────┐
│ Swift (app/Bamboo) │
│ App/ lifecycle, menus, settings, services, updater │
│ Browser/ Tab, BrowserWindowModel, WindowManager, delegates │
│ UI/ SwiftUI views │
│ Shields/ content rule lists, cosmetic filtering, privacy │
│ Import/ import wizard, cookie + password hand-off │
│ Passwords/ Keychain-backed password manager and autofill │
│ Agent/ MCP tool implementations (snapshot, click, type, …) │
│ Assistant/ Claude side panel (Messages API, same tools) │
│ │ UniFFI (Generated/*.swift + target/bamboo-out/include) │
│ Rust (crates/) → libbamboo_core.a │
│ bamboo-store SQLite: history, bookmarks, site settings, stats │
│ bamboo-shields adblock-rust → WebKit rules, cosmetics, checks │
│ bamboo-import Brave/Chrome/Edge/Arc/Vivaldi/Opera/Firefox/Safari│
│ bamboo-agent MCP server on a Unix socket + tool registry │
│ bamboo-core links the four into one static library │
│ Contents/MacOS/bamboo-mcp stdio ↔ socket bridge for MCP clients │
└────────────────────────────────────────────────────────────────────┘
| Path | What |
|---|---|
crates/ |
Rust workspace. Each component crate has its own UniFFI namespace and error type. |
app/project.yml |
XcodeGen spec. app/Bamboo.xcodeproj is generated and not committed. |
app/Bamboo/ |
Swift sources by layer (table above). |
app/Bamboo/Generated/ |
UniFFI Swift bindings (generated, not committed). |
scripts/build-core.sh |
Builds the Rust core and bindings; Xcode runs it as a pre-build phase. |
.github/workflows/ |
CI, releases, Sparkle appcast publishing. |
brew install xcodegen # once
make run # build Rust core + app, launch debug build
make test # cargo test + XCTest
make lint # rustfmt + clippyscripts/build-core.sh --universal builds arm64 + x86_64 for releases (needs rustup targets).
Hibernating tabs. A Tab owns its web view lazily. Restored tabs start with no web view and load when selected. Background tabs idle for hibernateAfterMinutes (default 30) drop their web view; WKWebView.interactionState keeps back/forward history and scroll position. Tabs using the camera, microphone or playing media are never hibernated.
Tab extensions. Features that hook into every web view (history, shields, privacy, site permissions, password autofill, agent tools) implement TabExtension and are registered in AppServices.start(). Script message handlers must look the tab up from message.webView because popups share their opener's WKUserContentController.
Tab-modal dialogs. JavaScript alert/confirm/prompt become Tab.pendingDialog and render inside the tab, so a page can't block the window and agents can answer dialogs.
Shields. Enabled filter lists (EasyList, EasyPrivacy, uBlock Origin lists, Peter Lowe, annoyances, custom) are converted by adblock-rust into WebKit content-rule-list JSON and compiled by WKContentRuleListStore, so network blocking happens inside WebKit at no cost to the app. The in-process engine adds per-site cosmetic filtering and scriptlets at document start, and classifies the requests a page made for the "trackers blocked" count. Lists update daily; downloads happen in Swift (URLSession) and the text is handed to Rust.
Agents. bamboo-agent serves MCP over ~/Library/Application Support/Bamboo/agent.sock (mode 0600, so only the user's own processes can connect, and web pages can't reach it at all). MCP clients launch Bamboo.app/Contents/MacOS/bamboo-mcp, which pipes stdio to the socket and starts Bamboo if needed. By default agents only control tabs they opened or that the user hands over (Tab ▸ Let Agents Control This Tab); agent tabs are outlined in the sidebar. JavaScript evaluation and history access are off unless enabled in Settings.
Claude panel. The side panel talks to the Claude Messages API directly (URLSession, streaming SSE) with the user's API key from the Keychain, and can use the same browser tools as MCP clients through one shared registry (tool_specs()).
Updates. Sparkle 2 checks https://github.com/jackh54/bamboo/releases/latest/download/appcast.xml every 6 hours and installs signed (EdDSA) updates. release-please cuts versions from Conventional Commits; the release workflow builds, signs, notarizes (when Apple credentials are configured), and publishes the DMG, the update archive and the appcast.
- Rust: one error enum per crate; no
unwrap()outside tests; timestamps arei64milliseconds since the Unix epoch, passed in by the caller. - Swift: Swift 6 strict concurrency. UI state is
@Observableand@MainActor. Failures the browser can carry on through go toAppServices.reportNonFatal(logged, asserts in debug); everything else throws or crashes loudly. - Commits follow Conventional Commits; release-please derives versions and the changelog from them.