refactor(gestures): move gesture algorithms out of contracts into @agent-device/gestures
Summary
packages/contracts is the shared vocabulary package, but R18 only banned host, process, and timer calls, so pure logic lived there against the rule's own statement that contracts owns vocabulary only. Plugin bundling is unchanged: a plugin inlines every @agent-device/* package it imports.
This PR moves one slice: gesture payload reading, public gesture normalization, and gesture plan geometry now live in a new private package, @agent-device/gestures (depends only on contracts and kernel). The payload and plan types stay in contracts. Exported names are unchanged; consumers change only import specifiers. No behaviour or wire change, so this is not device-facing.
A new package is needed because ad-script (contracts + kernel only) and the platform packages call these functions, and no existing package is below both.
refactor(move):gesture-plan.ts,gesture-normalization.ts, tests, fixtures, package wiring. R13 names gestures as platform substrate.refactor(gestures):readGesturePayloadleavescontracts/gesture-input; types stay.docs(adr): ADR 0033 amendment with rejected alternatives and ordered follow-up slices.chore(gates): R18 rejects any function in a contracts gesture input, plan, or normalization module.
Value
| Measure (production files) | base c9cce06 | head 4ccfbbc |
|---|---|---|
| contracts lines | 26,736 | 25,187 |
| contracts function declarations | 621 | 552 |
| contracts files | 211 | 209 |
| depgraph modularity (declared / detected) | 0.367 / 0.542 | 0.367 / 0.542 |
R4 cycles 0 and R5 back-edges 0 at both.
Validation
At 4ccfbbc, locally: pnpm build, check:quick, check:layering (513 pass), check:fallow, check:production-exports, check:package, check:adr-citations, eager-closure budget test (no budget changed), pnpm format. Targeted vitest for gestures, contracts, ad-script, command-surface, command-runtime, daemon, maestro, replay-port, platform-android, platform-apple, platform-linux, provider-webdriver, src/mcp: all pass. The full unit suite and integration lanes are left to CI.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.