> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_32/session_02_preference_contract.md).

# Session 02: Preference Contract

**Session ID**: `phase32-session02-preference-contract` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Add a durable `auto` preference while keeping runtime-facing APIs on concrete input modes.

***

## Scope

### In Scope (MVP)

* Extend AI Rogue preferences to support `auto | keyboard | compact`.
* Change fresh and missing preference defaults from `keyboard` to `auto`.
* Preserve explicit saved `keyboard` and `compact` values during parse and migration.
* Add or expose a separate effective input mode type for `keyboard | compact`.
* Add a pure input-mode resolver that accepts injected capabilities.
* Add a mounted browser hook or utility that reads pointer/hover media queries after mount.
* Subscribe to relevant media query changes when supported.
* Keep browser global reads out of schema, persistence, and save-state modules.
* Preserve lazy runtime import boundaries.
* Add unit tests for defaults, migration, explicit overrides, and resolver cases.

### Out of Scope

* Wiring effective mode through Runtime Canvas.
* Settings segmented-control UI changes.
* Playwright mobile gameplay tests.
* Changing AI Rogue extension enablement.

***

## Prerequisites

* [ ] Session 01 validates the heuristic or records a defensible fallback.
* [ ] Current `save-schema.ts`, persistence, and save-state default behavior is understood.
* [ ] Runtime import-boundary tests are identified before placing the resolver.

***

## Deliverables

1. Updated durable AI Rogue preference schema/default/migration behavior.
2. Pure resolver for raw preference plus browser capabilities.
3. Browser/view hook or utility for effective input mode.
4. Focused unit tests for schema, migration, resolver, and fallback behavior.

***

## Success Criteria

* [ ] Empty or malformed preferences produce raw `inputMode: "auto"`.
* [ ] Explicit saved `keyboard` and `compact` parse unchanged.
* [ ] Resolver maps `auto` plus coarse/no-hover to `compact`.
* [ ] Resolver maps `auto` plus fine/hover or unavailable browser APIs to `keyboard`.
* [ ] Runtime-facing types and runtime modules do not accept raw `auto`.
* [ ] New input-mode utilities do not import PixiJS or AI Rogue runtime code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_32/session_02_preference_contract.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
