apps/glyph Public The code is public; the app answers only to 1 person who can change it and the crew.

glyph: Claude draws SVG logos and icons #2

Merged opened this in answer to

shipped merged

opened this

Closes #1.

Type a prompt, pick a kind (logo mark · app icon · badge · spot illustration) and Claude draws four different SVG concepts in about a minute. Switch palette (Sage, Moss, Neon, Mono, Blueprint) to see them in any theme, then Copy the SVG or Save the file in that palette.

How it works

  • Claude Code runs as claude -p with no tools, on model claude-opus-5-5, using CLAUDE_CODE_OAUTH_TOKEN. It's the same runner as apps/radar, including passing the egress proxy through. forge.json declares egress to api.anthropic.com and claude.ai.
  • POST answers at once with status: drawing. The row fills in after the response, and the page updates live over /events with a seconds counter.
  • Safety: every SVG is rebuilt from an allowlist (src/glyph.ts sanitize): shapes, title and plain attributes only. No script, style, link, image, url() or handler survives. Previews are <img> data URIs, and downloads are served with a sandboxing CSP. Mutation-checked: removing any of the three main rules fails a test.
  • Claude draws in two placeholder colours, and a palette swaps those two. Downloads carry the palette's real colours.
  • Contract: a new drawing resource. Create needs a signed-in user. Read, list and delete are limited to the person who asked, and an admin sees everyone's. Update is nobody. This is tighter than the template's public note resource, which a migration drops. Strangers get no /api door, so /openapi.json is closed to them too.
  • Limits: one drawing at a time per person, three in flight overall. A restart marks half-done drawings failed, with a reason.
  • Also MCP tools draw / get_drawing / list_drawings / delete_drawing, and a terminal that lists drawings and takes a new prompt.

Verified

  • bun test: 57 pass. lint:design is clean, and a strict tsc is clean.
  • I ran it locally with real Claude (the Mac's login). It drew 4 concepts in about 40 s, all passed the sanitizer, and the palette swap was correct. I screenshotted the page at desktop width and as a 390 px phone with no horizontal scroll.

Needs before it draws on the forge

CLAUDE_CODE_OAUTH_TOKEN in Settings → App → Environment, for both production and the preview. Without it, a drawing fails immediately with a message saying exactly that.

Not done

  • No editing or refining a concept ("make #2 bolder"). It's a natural next step.
  • No gradients or text in drawings. That keeps the allowlist small and the palette swap exact.

🤖 Generated with Claude Code

merged this
Sign in to join this conversation.

↑↓ navigate ↵ open esc close

Keyboard shortcuts