feat: Oxide Forge — in-browser Claude code generation, hot-loaded as wasm#39
Conversation
… revisions Restructure the Forge knowledge base into an agentskills.io-compatible Agent Skill at forge/skills/oxide-wasm-app/ so the same prompts are reusable from Claude Code, Cursor, and other skills-aware clients. SYSTEM_PROMPT.md becomes SKILL.md (with YAML frontmatter); CAPABILITIES, PATTERNS, and RECIPES move under references/. Forge host changes (oxide-browser/src/forge.rs, ui.rs): - Build the system prompt by stripping SKILL.md frontmatter and concatenating every references/*.md file. - Persist generations in a list view; selecting an entry and prompting again sends the current src/lib.rs back to Claude for a revision and copies the rebuilt <slug>.wasm into that creation's folder. - Add a native "Choose folder" picker (and OXIDE_FORGE_DIR env var) so generated projects and wasm artifacts can live outside target/forge/. - Rewrite the copied oxide-sdk path dependency to an absolute path so projects build from any user-selected output folder. - Default model bumped to claude-opus-4-7 (override via OXIDE_FORGE_MODEL). Docs and assets: - Update README.md, claude-hackathon.md, and forge/README.md to describe the skill layout, revision flow, and folder picker. - Add examples/gradient-demo/ as a reference guest app. - Add content/video/oxide-promo/ with the Forge promo site, hyperframes, script, design notes, and rendered mp4 + frame stills. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR introduces Oxide Forge, an AI-native app generation system that enables users to describe WebAssembly applications in plain English via a ChangesOxide Forge Core Implementation & UI Integration
Forge Kit, Templates, Examples & Documentation
Sequence DiagramsequenceDiagram
actor User
participant Browser as Browser<br/>(oxide://forge)
participant ForgeState as ForgeState<br/>(Session Mgmt)
participant Anthropic as Anthropic<br/>API
participant Host as Host<br/>(cargo build)
participant Sandbox as Sandbox<br/>(WASM Runtime)
User->>Browser: Enter prompt + submit
Browser->>ForgeState: start(prompt)
ForgeState->>ForgeState: Scaffold Cargo project
ForgeState->>Anthropic: POST /messages<br/>stream=true<br/>system_prompt
loop Stream chunks
Anthropic-->>ForgeState: SSE delta
ForgeState->>ForgeState: Buffer code
ForgeState->>Browser: Update snapshot<br/>(streaming phase)
end
ForgeState->>ForgeState: Extract Rust block
ForgeState->>ForgeState: Write src/lib.rs
ForgeState->>Host: cargo build<br/>--target wasm32-unknown-unknown
alt Build success
Host-->>ForgeState: forge_app.wasm
ForgeState->>ForgeState: Copy artifact<br/>Set BuildOk phase
ForgeState->>Browser: Update snapshot
User->>Browser: Click "Run in new tab"
Browser->>Sandbox: Load WASM
Sandbox->>User: Display app
else Build failure
Host-->>ForgeState: stderr log
alt Auto-retry enabled & attempts remain
ForgeState->>Anthropic: Retry with<br/>build log context
loop Retry stream
Anthropic-->>ForgeState: SSE delta
end
ForgeState->>Host: cargo build
else No retries
ForgeState->>Browser: Show error + log
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes This PR spans multiple heterogeneous systems (streaming orchestration, async build execution, UI state management, keyboard routing) with significant logic density in Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
What's in this PR
Forge runtime (
oxide-browser/)src/forge.rs(new, ~1.2k lines): session state, Anthropic SSE streaming,template scaffolding, build pipeline with up to 3 auto-retry rounds that
feed
cargoerrors back to Claude, artifact path resolution.src/ui.rs: native GPUI Forge page — prompt box, list view of pastcreations, streaming code preview, build console, "Choose folder"
picker, and "Open in tab" / revise actions.
src/lib.rs: wiresoxide://forgeinto the URL router.claude-opus-4-7, override viaOXIDE_FORGE_MODEL.Output dir defaults to
target/forge/, override viaOXIDE_FORGE_DIRor the in-app folder picker.
Forge knowledge base (
forge/skills/oxide-wasm-app/)Packaged as an agentskills.io-compatible
Agent Skill so the same prompts can be reused from Claude Code,
Cursor, OpenCode, and any other skills-aware client.
SKILL.md— terse generation contract with YAML frontmatter (name,description).references/CAPABILITIES.md— every public SDK symbol with fullsignatures.
references/PATTERNS.md— idiomatic state, layout, and event patterns.references/RECIPES.md— 12 copy-pasteable snippets.forge/README.md— explains the skill layout and how external agentscan pick it up.
forge/DEMO_PROMPTS.md— 10 curated prompts for live demos.forge/templates/base/— minimalcdylibCargo scaffold copied forevery generation;
oxide-sdkpath is rewritten to an absolute path soprojects build from any user-selected output folder.
Revision flow
Every creation is persisted in a list view. Selecting one and prompting
again sends the current
src/lib.rsback to Claude, which rewrites it,rebuilds it, and copies the finished
<slug>.wasmback into thatcreation's folder.
Examples and content
examples/gradient-demo/— reference guest app showcasing canvas + state.content/video/oxide-promo/— Forge promo site, hyperframes, script,design notes, rendered mp4 (≈18 MB), and frame stills used in the
launch video. Also
content/video/video-demo.mdwriteup.Docs
README.mdandclaude-hackathon.mdupdated with the architecturediagram, folder-picker / revision flow, and skill layout.
Security
Forge adds no new host privileges. Generated
.wasmmodules loadthrough the existing wasmtime linker with the same capability set as any
other guest. The only privileged operation Forge itself performs is
shelling out to host
cargoto build the project — an explicit nativedeveloper workflow, not exposed to guests.
Configuration
ANTHROPIC_API_KEYOXIDE_FORGE_MODELclaude-opus-4-7OXIDE_FORGE_DIRtarget/forge/Test plan
cargo fmt --all && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspacecargo build -p oxide-browsercargo build --target wasm32-unknown-unknown --release -p gradient-democargo run -p oxide-browser→ URL bar →oxide://forgethe auto-retry loop surfaces the error after 3 rounds
confirm revision rebuilds and reloads the same slug
<slug>.wasmintothe selected directory
OXIDE_FORGE_DIR=/tmp/forge cargo run -p oxide-browserhonors the env varforge/DEMO_PROMPTS.mdprompts end-to-endNotes for reviewers
content/video/oxide-promo/renders/include two.mp4files (~10 MB and ~18 MB). They will be permanent in repohistory. If you'd prefer them out of git, happy to move them to LFS
or strip them from this PR before merge.
SKILL.md+references/per the agentskills.io spec, so symlinking/copying it into
~/.claude/skills/or.cursor/skills/should "just work" for thosehosts.
Summary by CodeRabbit
Release Notes
New Features
oxide://forge): Generate WebAssembly applications from natural language prompts with iterative revision and automatic rebuild on failures.Documentation
Chores