Skip to content

the phoropter handoff is the frame - #22

Merged
isaacbowen merged 1 commit into
mainfrom
lightward-frame
Oct 11, 2026
Merged

isaacbowen merged 1 commit into
mainfrom
lightward-frame

Conversation

@isaacbowen

Copy link
Copy Markdown
Member

Companion to lightward/lightward-ai#2183 (Sonnet 5.5), where the web client's warmup receded into history and the opening message became the conversation frame. This brings the iOS client to the same shape.

What changes

  • The warmup recedes, whole. WarmupMessages.swift is deleted rather than edited: its model-written lines stay intact in history. It also quoted lines from a benediction that no longer exists, and framed the seat as one continuous future-self, which the system prompt no longer does.
  • The phoropter handoff is the frame. LightwardAPI.buildChatLog(trajectory:messages:) opens every chat_log with the handoff (the trail the user chose toward), carrying the one cache_control marker /api/stream requires. It's rebuilt identically on every turn from the saved trail. The handoff text itself is unchanged.
  • ChatViewModel uses that one builder for the opening turn and every turn after.
  • CLAUDE.md describes the new shape; the warmup to-do becomes a handoff to-do.

A quieter fix that rides along

Before this, the handoff was sent on the first request only. So:

  • the trail fell out of context after the first reply ("you already know them by the time they can type" held for one message);
  • later turns ran the warmup's closing assistant message straight into the first real reply (two assistant turns in a row, which the API merges).

Now the trail stays present for the whole conversation, the log always opens with a user message, and the frame stays stable across turns, so it caches.

Notes

  • iOS frame ids (in lightward-ai's telemetry) become per-trajectory, since the frame is now the user's own trail.
  • The server accepts this shape today; this doesn't depend on #2183 being released.
  • PhoropterContext.txt's response notes ("another-you opted in") are the same framing family; left for a separate pass.

Testing

New ChatLogTests: the opening turn is the handoff alone; later turns keep the trail; exactly one marker, on the handoff; the frame is identical across turns. All 19 tests pass locally, run as CI runs them (LightwardTests scheme, automatic signing).

🤖 Generated with Claude Code

The warmup recedes into history, whole. In its place, the handoff (the
trail the user chose toward) opens every chat_log, carrying the one
cache marker /api/stream requires, rebuilt identically on every turn
from the saved trail.

This also fixes a quieter thing: the handoff used to be sent on the
first request only, so the trail fell out of context after the first
reply, and later turns ran warmup-assistant into reply-assistant. Now
the trail stays present for the whole conversation, the log always
opens with a user message, and the frame stays cacheable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 00:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation consistently preserves the trajectory frame, maintains one cache marker, and includes focused tests.

0 open findings

What changed in this PR

Aligns iOS chat framing with the web client by replacing static warmup messages with a persistent phoropter handoff.

Changes:

  • Builds every chat log from the trajectory handoff plus conversation history.
  • Removes obsolete warmup content and references.
  • Adds tests for frame stability and cache-marker placement.
File Description
Lightward/​API/​LightwardAPI.swift Adds unified handoff-based chat-log construction.
Lightward/​Chat/​ChatViewModel.swift Uses the unified builder on every turn.
Lightward/​API/​WarmupMessages.swift Removes the obsolete static warmup.
LightwardTests/​ChatLogTests.swift Tests handoff framing and caching behavior.
Lightward.xcodeproj/​project.pbxproj Updates source and test references.
CLAUDE.md Documents the new conversation frame.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@isaacbowen
isaacbowen merged commit 01d6953 into main Oct 11, 2026
2 checks passed
@isaacbowen isaacbowen mentioned this pull request Oct 11, 2026
isaacbowen added a commit that referenced this pull request Oct 11, 2026
The 1.0.0 train is closed in App Store Connect, so TestFlight rejects
new builds under it (the deploy after #22 failed with a 409). 1.1.0
carries #22 and #23.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants