hinge
Let coding agents like Claude Code and Codex fold iPhone Duo while they build and verify your app. hinge ships as an Agent Skill with a bundled CLI.
Ask the agent things like:
- "Fold the simulator to 90° and take a screenshot of each display."
- "Check how the onboarding screen looks on the cover and on the inner display."
- "Unfold the simulator, rotate it to landscape, and verify the sidebar layout."
Why
Xcode's Device Hub has a hidden hinge slider (hold Option), but nothing scriptable can fold the device, so an agent has no way to test the inner display. Worse, the closest tools exit 0 and change nothing, so an agent carries on as if they worked:
| You want to… | What Xcode offers | hinge |
|---|
| Fold or unfold | No simctl or devicectl command for the hinge | hinge close, open, half, hinge <degrees>, sweep |
| Know the fold happened | No public way to read the angle back; devicectl 651 has no motion command | Waits until CoreMotion reports the angle, and fails if it doesn't |
| Know which display shows the app | Nothing tells it apart from the hinge angle | hinge posture names the active display |
| Screenshot what's showing | simctl io screenshot fails with Invalid argument on a foldable | hinge screenshot captures the active display |
| Rotate | devicectl device orientation set reports success and is reverted | hinge rotate, orient |
| Target the right simulator | booted picks one of several booted simulators | Picks the only booted iPhone Duo, and never guesses |
Requirements
- macOS with Xcode 27.1 or later and a foldable iOS Simulator runtime
- A booted foldable simulator, such as iPhone Duo
Installation
skills/hinge is self-contained: it bundles the CLI, so the agent needs nothing else.
skills.sh (Claude Code, Codex, Cursor, and other agents):
npx skills add artemnovichkov/hinge
OpenSkills (any agent that reads AGENTS.md):
npx openskills install artemnovichkov/hinge
npx openskills sync
Claude Code plugin:
/plugin marketplace add artemnovichkov/hinge
/plugin install hinge@hinge
Manually:
git clone https://github.com/artemnovichkov/hinge.git
cp -R hinge/skills/hinge ~/.claude/skills/ # Claude Code
cp -R hinge/skills/hinge ~/.codex/skills/ # Codex
The first run compiles a small helper with Xcode's clang and caches it in ~/.cache/hinge.
The cache keeps one build per helper version and Xcode version, and nothing prunes it.
What the skill teaches the agent
A foldable has a few traps that make a naive agent report success when nothing changed. The skill covers them:
- Confirmed folds. Setting an angle waits until CoreMotion reports it, so a non-zero exit means the fold did not happen. The agent doesn't poll to check.
- Display switches. The angle and the active display are different things. The agent waits 1-2.5 s after a fold and checks which display hosts the UI with
posture instead of assuming.
- Screenshots. A foldable has two displays, and
simctl fails with Invalid argument unless it is told which one to capture. The agent uses hinge screenshot, which captures the display that hosts the UI.
- The right simulator. With several simulators booted,
hinge picks the only iPhone Duo and refuses to guess between several.
- Orientation.
devicectl reports success on a foldable but changes nothing. The agent rotates with Device Hub's own event.
- Protocol changes. When an angle is not confirmed, the agent reports that the private protocol has likely changed.
CLI
The same tool works without an agent: from the terminal, scripts, or CI.