Scaffold Persistence & Code Token Bump

Two targeted follow-ups to the May 12 developer toolkit: scaffold previews now survive page reloads, and the code! command gets a dedicated 32K token budget in private rooms.

After shipping the full developer toolkit on May 12, two reliability gaps surfaced immediately in testing. We addressed both the same day.

Scaffold metadata persistence

The scaffold code generator — triggered with the code! command — produces multi-file code structures that render as a previewer in chat. The problem: on page reload, those preview files vanished. The filenames, language annotations, and file contents were held only in memory on the client and were never written back to the database.

The fix was to include scaffoldFiles in the JSON blob stored in the RoomMessage metadata column when persistRoomMessage runs. When the room history is fetched on reconnect, the scaffold metadata comes back with the message and the preview panel renders correctly from persistent storage.

This is exactly the kind of bug that only surfaces under real usage — files disappearing on refresh would have been a serious productivity loss for anyone using the scaffold feature to generate and review multi-file projects.

code! max token cap for private rooms

The standard AI response cap (used for regular chat) is deliberately conservative to keep token costs manageable and responses snappy. But code! is different — users typing code! are asking for complete, multi-file implementations. Truncating a component library or an API scaffold at the standard cap is actively harmful.

Private rooms now get 32,768 max_tokens specifically for code! requests, matching the model's full context window. World chat keeps the lower cap to manage cost. The distinction is intentional: private rooms are a paid-tier feature, and code generation at full length is a meaningful value-add for users who have upgraded.

Why it matters

Scaffold files disappearing on refresh would have made the developer workflow feel unreliable — exactly the impression you don't want to give with a new feature. These two fixes made code generation actually trustworthy: the output persists, and it's complete. A developer should be able to generate a full application scaffold, close the tab, come back, and find everything exactly as they left it.