Named for the Ophanim — the "wheels within wheels" covered in eyes. Nested structures that see.
A layout specification language that LLMs can actually see.
"I see nobody on the road," said Alice. "I only wish I had such eyes," the King remarked in a fretful tone. "To be able to see Nobody! And at that distance, too!"
— Lewis Carroll, Through the Looking-Glass
Read the theory → Why spatial text encoding might matter beyond layout.
LLMs are bad at frontend layout. Not because they can't write CSS — they can. They're bad because they can't see what they're building. Layout is a spatial problem, and LLMs think in text.
What if the spec is the layout?
┌─────────────────────────────────────────────┐
│ ◆Navbar │
├────────────┬────────────────────────────────┤
│ ◆Sidebar │ ◆ContentArea │
└────────────┴────────────────────────────────┘
Fixed-width Unicode box-drawing characters encode proportional spatial relationships in plain text. An LLM can read and write this natively — no spatial reasoning required.
Core toolchain complete. Parser, React adapter, reverse adapter, and Figma import are functional.
- Parser — read box-drawing characters, emit layout IR
- React adapter — generate components from IR
- Reverse adapter — generate diagrams from existing React/CSS
- Figma import — generate diagrams from design files
# With pipx (recommended)
pipx install git+https://github.com/KohlJary/ophanic.git
# Or with pip
pip install git+https://github.com/KohlJary/ophanic.git
# For development
git clone https://github.com/KohlJary/ophanic.git
cd ophanic
pipx install -e .# Clone the repo
git clone https://github.com/KohlJary/ophanic.git
# Symlink the plugin to Claude Code's plugin directory
mkdir -p ~/.claude/plugins/cache/local
ln -s /path/to/ophanic/plugin ~/.claude/plugins/cache/local/ophanic
# Register the plugin (add to installed_plugins.json)
# Or just use the /diagram command after symlinking# Parse and output JSON IR
ophanic parse layout.oph --pretty
# Parse specific breakpoint
ophanic parse layout.oph --breakpoint mobile# Generate React/Tailwind components
ophanic generate layout.oph --target react
# Without Tailwind classes
ophanic generate layout.oph --target react --no-tailwind
# Output to file
ophanic generate layout.oph --target react -o components.jsx# Generate diagram from React component
ophanic reverse src/components/Dashboard.tsx
# With explicit CSS file
ophanic reverse src/components/Dashboard.tsx --css src/components/Dashboard.css
# Custom diagram width
ophanic reverse src/components/Dashboard.tsx --width 100
# Output to file
ophanic reverse src/components/Dashboard.tsx -o dashboard.oph# Set your Figma token (get from Figma > Settings > Security > Personal access tokens)
export FIGMA_TOKEN=your_token_here
# Import from Figma URL
ophanic figma "https://www.figma.com/file/abc123XYZ/MyDesign"
# Or use the file key directly
ophanic figma abc123XYZ
# Custom diagram width
ophanic figma abc123XYZ --width 100
# Filter to specific pages
ophanic figma abc123XYZ --page "Desktop" --page "Mobile"
# Limit traversal depth (faster for large files)
ophanic figma abc123XYZ --depth 3
# Output to file
ophanic figma abc123XYZ -o design.ophThe plugin provides a /diagram command for generating layout diagrams from your codebase.
/diagram src/pages/Dashboard.tsx
This will:
- Analyze the React component and its CSS
- Generate an Ophanic diagram showing the layout structure
- Display it in your terminal
# Dashboard
@desktop
┌────────────────────────────────────────────────────────────────────────────┐
│┌─────────────────────┐ ┌─────────────────────────┐ ┌──────────────────────┐│
││ ◆SchedulePanel │ │ Dashboard | overview │ │ ◆ChatWidget ││
│└─────────────────────┘ └─────────────────────────┘ └──────────────────────┘│
└────────────────────────────────────────────────────────────────────────────┘
Ophanic files (.oph) use box-drawing characters to define layouts:
# PageName
@desktop
┌────────────────────────────────────────────┐
│┌──────────┐ ┌─────────────────────────────┐│
││ Sidebar │ │ Main Content ││
│└──────────┘ └─────────────────────────────┘│
└────────────────────────────────────────────┘
@mobile
┌────────────────────┐
│ Sidebar │
├────────────────────┤
│ Main Content │
└────────────────────┘
## ◆Sidebar
@default
┌────────────────┐
│ ◆NavLinks │
│ ◆UserProfile │
└────────────────┘
Key elements:
# Title— Document title@breakpoint— Responsive breakpoint (desktop, tablet, mobile, or custom)◆ComponentName— Reference to a component## ◆ComponentName— Component definition section- Box proportions are determined by character widths
- SPEC.md — Full concept specification
- ab-test/RESULTS.md — A/B test results and analysis
# Run tests
cd ophanic
pytest
# Run specific test file
pytest tests/test_parser.py -vHippocratic License 3.0 — An ethical open source license.