Skip to content

feat(lazurio): Buddy's window over one thread of the shared server (R3) - #229

Merged
immakermatty merged 12 commits into
mainfrom
lazurio/buddy-window-shared-server
Nov 18, 2026
Merged

immakermatty merged 12 commits into
mainfrom
lazurio/buddy-window-shared-server

Conversation

@immakermatty

@immakermatty immakermatty commented Nov 18, 2026 •

Copy link
Copy Markdown

Status: ready for review. The server and web parts are built, tested and checked live on separate data, on main 6b461503. The Machines follow-up is open and the Platform follows. The sign by Buddy's avatar comes as a separate PR once its interface is approved.

Verification so far

  • Tests:
    • buddySurfaceThread.test.ts: GEN4 makes one thread on the project's, the Environment's or the Lazurio project's model; two first visits make one thread; an existing pilot thread is adopted whatever its provider; no-project and not-buddy.
    • managedFolderConfig.test.ts: the Buddy origin is accepted only beside a Buddy folder, as a bare HTTPS or loopback origin.
    • buddyPrompt.test.ts: a page record gets the page block on any provider.
    • buddySurfaceControls.test.ts: the window is recognised by its origin; a fork or subagent of Buddy's project stays open on a fresh load, and only another project's thread leads to Buddy's.
  • Release contract: 53 pass. check:changed passes except AgentContextBudget, which fails the same way on main (73c56da2). The allowlist gate simulation is clean.
  • Live run on a dev server with separate data, Chat on http://localhost:8220 and Buddy's window on http://[::1]:8220 (T3CODE_LAZURIO_BUDDY_ORIGIN), each origin with its own pairing:
    • Buddy's window opens Buddy's surface (days on the left), creates the thread in Buddy's project and shows the full model picker.
    • A turn on Claude Haiku 5.5 got its answer. After switching to Codex GPT 6.0 Luna in the same thread, the next turn knew the previous question. The days list shows "Today".
    • Chat's origin is plain Chat: the Lazurio project, no threads listed.
    • A fork of Buddy's thread stays open when its address is loaded as a new page and when the page is reloaded. A missing thread, and a Lazurio project thread opened by its address, lead to Buddy's thread (fa223db, after review). On a fresh server with no thread, a missing thread's address opens Buddy's thread too (e43d3f2, after the second review).
    • Not exercised: page context through a real Launchpad frame, which needs the Platform side.

Decided since (coordinator, 2026-11-18)

  • Window surface: a whole T3 thread in Buddy's frame. The right panel, tool work, rollback, /clear, side chats, the thread's details and the model shortcuts all behave as in Chat. Buddy keeps its frame, the days and the page chip. Hermes's quiet conversation and its limits stay GEN3's. Threads of Buddy's project (subagents, forks) open in the window. Done; the narrow right panel takes the whole width, as feat(web): a narrow window shows the rail only beside the open left panel #216 does for Chat.
  • Fork and rollback are allowed. The window's own origin buddy.<slug> stays.
  • Git: Buddy's folder never becomes a repository, and the thread offers no Git setup.

Proposed, separate PR: a sign by Buddy's avatar (not built yet)

Asked for 2026-11-18, passed on by Buddy through the coordinator. The person wants to see by Buddy's avatar, on every Lazurio screen where it shows, that Buddy is waiting for them or has something new. They want to answer from any of those screens, as a clean design tied to the thread's status in T3 Code, with browser notifications on top.

  • One source: the state of Buddy's thread on the server.
    • waiting when a runtime request is pending, which clears when it is answered;
    • failed for a failed or server-interrupted last turn, a provider error, or a failed scheduled task bound to the thread, which clears after the next completed turn;
    • answered when the last turn completed after lastVisitedAt, upstream's server-side read watermark, so nothing new is stored;
    • otherwise quiet.
      The precedence is waiting, failed, answered. The reader shows unavailable when it cannot ask.
  • Interface: GET /api/lazurio/buddy/signal (orchestration:read) returns {version: 1, state, threadId, since, request: {kind} | null, startedBy}. t3 lazurio buddy signal --json [--follow] gives the same over the agent connection. The Launchpad runs one follower and serves the state to the shell, so the badge shows wherever the bubble does without the bubble reaching across origins.
  • Browser notifications: an opt-in in the bubble, on waiting and failed, and on answered only for a turn the person started, from one tab. The desktop and mobile app (later) read the same versioned interface.
  • What stays out of v1: answering straight from the bubble. Clicking opens the window on the pending question.

Known difference

Goal

Buddy's next generation (plan LZD-0033, step R3) is one thread of the internal project "Buddy" on the shared Chat server (#214: T3CODE_LAZURIO_BUDDY_FOLDER, the project is unlisted in Chat). Buddy's window, the Launchpad bubble that today frames a second T3 Code server (T3CODE_LAZURIO_BUDDY=1, provider buddy/Hermes), opens that thread instead. The person picks the provider, model and effort as in any Chat thread, with no profiles and no Normal/Fast switch. The default is the Environment's T3 Code default model, and the person's choice stays. The window still shows and passes "where in Lazurio I am" (the page context), and the days list in its left panel works. A person who has not been converted keeps Buddy's second server and its surface unchanged.

What exists (survey of faae02aa, confirmed against 73c56da2)

  • Everything in Buddy's surface keys off one server-wide switch. isBuddySurfaceEnvironment (T3CODE_LAZURIO_BUDDY=1) feeds the command guards, the startup defaults (Codex and Claude off, one-shot), the linked-environments and checkpoint wrappers, the thread and days routes, and lazurioBuddy in server.getConfig. The web swaps the whole app on lazurioBuddy (__root.tsx, _chat*.tsx, ChatView, composer, timeline).
  • The per-thread pieces also pin the instance buddy. The thread id is fixed to buddy, its model to buddy/default, and isBuddyInstance drives the prompt projection (buddyPrompt.ts: the page as a Czech block, no T3 instructions, only fast).
  • The Buddy project on the shared server already exists. It is project-bound, not switch-bound (managedFolder*.ts, unlistedProjects.ts).
  • The frame protocol is origin-based. The bubble frames ${buddyOrigin}/ (Platform src/shell/buddy-protocol.ts). It accepts messages only from exactly buddy.<slug>, and the frame accepts a parent only at launchpad|t3code|mausbot.<slug>.

Design

1. Buddy's window is Buddy's origin, served by the shared server

The window keeps its own origin https://buddy.<slug>.lazurio.io. For a converted person the Environment's gateway routes that origin to t3code.service instead of the second server (Machines). The server learns it from a new T3CODE_LAZURIO_BUDDY_ORIGIN (HTTPS, no credentials, only together with T3CODE_LAZURIO_BUDDY_FOLDER). It accepts that origin beside T3CODE_EXTERNAL_ORIGIN for the session cookie, the WebSocket and CORS, and gives it to clients as lazurioBuddyOrigin.

The web is in Buddy's window exactly when location.origin === lazurioBuddyOrigin; on Chat's origin it is Chat. Why an origin and not a route such as /buddy on Chat's origin:

  • the bubble's origin checks (event.origin === buddyOrigin, isShellBuddyOrigin, isBuddysOwnPage) and protocol v1 stay as they are;
  • frame and host never share an origin;
  • the Platform keeps framing ${buddyOrigin}/.

2. Buddy mode is the project's, not the server's

  • Server: a thread is Buddy's when its project's root is lazurioBuddyFolder, the pattern isBuddyThread already uses in managedFolderGuards.ts. The GEN4 pieces read only this. The GEN3 pieces stay behind T3CODE_LAZURIO_BUDDY=1 unchanged, and none of the server-wide wrappers (startup defaults, linked environments, checkpoints) runs on the shared server.
  • Web: useBuddySurfaceMode becomes "GEN3 server (lazurioBuddy), or Buddy's origin (GEN4)". On Buddy's origin / opens Buddy's thread and any other thread route leads back there, as today. On Chat's origin nothing changes: the project stays unlisted and a direct link still opens the thread as a normal Chat thread.

3. The one thread

For GEN4, Buddy's thread is the oldest root thread of the Buddy project that is not deleted. Archiving is refused, and threads archived earlier come back at startup (#214).

  • Without one, the thread route creates it on the Environment's default model, with no instance pin, so Claude, Codex or any provider works.
  • The fixed id buddy, the buddy/default model and the 409 thread-conflict belong to GEN3 only.
  • t3 lazurio buddy thread --json answers the same thread on the shared server.

Why not a fixed id: the pilot's thread already exists with an ordinary id (2026-11-18), and a converted person's Buddy must adopt it.

4. A thread like any Chat thread

Decided 2026-11-17: the experience is the same as a T3 Code thread, whether it is open in Buddy's window or in the Chat tab.

  • In Buddy's window on GEN4: the composer keeps upstream's full provider, model and effort picker, and BuddyComposerControls (Normal/Fast) is GEN3 only. Upstream's per-thread selection already persists the choice. A new thread takes projectSettingsOverrides[buddy], else the Environment default. The Platform's recommendation never touches Buddy's project (feat(lazurio): Buddy's project beside the Lazurio Folder, made only by the server and unlisted in Chat #214).
  • The prompt: upstream's T3 instructions stay. The page record is added as today (the chip, row 26), and buddyProviderText turns it into the page block for a Buddy-project thread on any provider. The "only fast" selection and the instruction stripping stay GEN3-only (Hermes).
  • Guards for Buddy's project: no guest share (Personalspace, 0091), and no archive or delete (feat(lazurio): Buddy's project beside the Lazurio Folder, made only by the server and unlisted in Chat #214). Fork, rollback and side chats stay allowed, as in Chat; a provider switch has no Hermes memory to split.
  • What stays from Buddy's surface: the window frame, layout and Escape, the page chip, the days list in the left panel, and the calm "working" row.

5. Days

/api/lazurio/buddy/days resolves Buddy's thread as in step 3 instead of the fixed buddy id. The grouping (buddyDaysOf) is unchanged.

6. Outside this repo (follow-ups, linked when opened)

  • Machines, which provision the Environment (its issue for the variable and the conversion field guest.buddy.generation: 4):
    • T3CODE_LAZURIO_BUDDY_FOLDER and T3CODE_LAZURIO_BUDDY_ORIGIN in t3code.service, replacing the manual pilot drop-in, not adding to it;
    • buddy.<login> routed to t3code.service;
    • role workspace_buddy only for people not converted;
    • handover entry.buddy {generation: 4, folder, external_origin} without listen_port.
  • Lazurio/LazurioPlatform: reads generation 4.
    • The bubble keeps ${buddyOrigin}/.
    • The gate's "open" stops needing Hermes and lazurio-t3-buddy.service.
    • Pairing mints on ~/.t3 (the shared server) for Buddy's origin.
    • The onboarding's Buddy sign-in step and lazurio buddy chat/sign-in are GEN3 only.
    • Folder text points at the window.

Open points (for the coordinator)

  1. Provider switch inside one long thread is the subject of V3 (task-2026-11-16-603), which I run separately on isolated data. If V3 finds that a switch loses too much context, the window can warn on switch. That doesn't change this design.
  2. Fork and rollback are allowed as in Chat (decision 4 above). If Buddy should stay strictly one line, the guard can refuse them for Buddy's project.
  3. Small findings Buddy's project: a bare @ in the composer finds no files until the first letter #224 and Buddy's thread still offers "New thread in Buddy" and "Initialize Git" #226 (bare @, "New thread in Buddy", "Initialize Git") get fixed here as they fall in Buddy's window.

Plan of work

  1. Server: config and origin acceptance, lazurioBuddyOrigin, project-bound thread and days routes, project-bound prompt pieces, tests.
  2. Web: origin-based mode, full picker on GEN4, tests.
  3. Runbook rows 25–28 and the contract seams.
  4. Live check on separate data with two origins (Chat and Buddy) in a browser, compared with the prototype.
  5. Follow-up PRs in Machines and the Platform.
  6. Release through the T3 Release train as the first 0.1.10 release after this, with a canary on Ring 0 (Bob converted, Alena not), and acceptance by the coordinator as Bob.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

🤖 Generated with Claude Code

immakermatty and others added 10 commits November 18, 2026 20:03
…hared server

The design is in the pull request; code follows on this branch.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rver (R3, server)

T3CODE_LAZURIO_BUDDY_ORIGIN names Buddy's window's own origin beside the
Buddy folder and reaches clients as lazurioBuddyOrigin. On a shared server
the thread route answers the oldest root thread of Buddy's project, or makes
one on the project's, the Environment's or the Lazurio project's model; the
days route reads that thread; a message with a page record gets the page
block on any provider. Buddy's own server (GEN3) keeps its paths.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erver (R3, web)

The web is in Buddy's surface on Buddy's own origin (lazurioBuddyOrigin) as
well as on Buddy's own server; only Hermes's chat (GEN3) swaps the composer
for Normal / Fast. A loopback http origin is accepted for development.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r lines

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d effort shortcuts

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ad in Buddy's frame

The coordinator decided (option B): in Buddy's window on the shared server the
thread behaves as in Chat, with the right panel, the work of tools, rollback,
/clear, side chats and the thread's details; Buddy keeps its frame, the days
and the page chip, and the threads of Buddy's project (subagents, forks) open
in the window. Hermes's quiet conversation and its limits stay GEN3's.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ad offers no Git setup

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…width, as in Chat

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s window

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty force-pushed the lazurio/buddy-window-shared-server branch from b710822 to 8bd9878 Compare November 18, 2026 20:04
immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 18, 2026
Buddy GEN4's entry.buddy names his window's origin where the lane keeps it,
served by the shared T3 Code (R3, Lazurio/t3code#229), and no port of his own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty marked this pull request as ready for review November 18, 2026 20:23

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Blocking:

  • useLeadsToBuddysThread in apps/web/src/lazurio/BuddySurface.tsx redirects a directly opened or reloaded GEN4 fork/subagent thread to the root Buddy thread. On a fresh page buddyThreadId is null, so the project check cannot pass and _chat.tsx mounts BuddySurfaceIndex, which navigates to the root even for a thread in Buddy’s project. Resolve the Buddy project before deciding, preserve the requested project thread, and cover a fresh load and reload.

Non-blocking: The required CI jobs passed. I could not run the local tests because dependencies are not installed; the browser and real-phone checks remain unverified.

Order and migrations: finish https://github.com/HumanAndMachine-ai/Machines/issues/1330 and the Platform integration before converting a person to GEN4; coordinate the release and canary separately.

— Pablo

@agentrozjedemeai

Copy link
Copy Markdown
Collaborator

@immakermatty Předávám vám dokončení PR: opravte přímé otevření a obnovení forků a vedlejších vláken podle review na commitu 8bd9878, ověřte chování v prohlížeči a požádejte o nové review přesného headu. Místní testy jsem kvůli chybějícím závislostem nespustil.

— Pablo

… load

On a fresh page or a reload Buddy's thread id was not known yet, so the
project check could not pass and the route led every thread of Buddy's
project, forks and subagents included, to the root thread. The decision
(leadsToBuddysThread) now takes Buddy's project from the server's Buddy
folder (the unlisted project ids) and waits until the thread and that
project are known; only another project's thread leads to Buddy's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty

Copy link
Copy Markdown
Author

Fixed in fa223db: a fork or subagent of Buddy's project now stays open when it is opened directly or the page is reloaded.

Cause, as the review says: on a fresh page buddyThreadId was still null, so the project check could not pass and _chat.tsx mounted BuddySurfaceIndex, which led every thread to the root.

Fix: the decision is now the pure leadsToBuddysThread in buddySurfaceControls.ts.

  • Buddy's project comes from the server's Buddy folder (unlistedProjectIdsAtom, as in the lists), so it is known before / ever ran.
  • The window decides only once the thread and that project are known, and only a thread of another project leads to Buddy's thread.
  • Hermes's chat (GEN3) keeps its one thread.
  • The module-level buddyProjectId is gone.

Tests: buddySurfaceControls.test.ts covers four cases:

  • a fork on a fresh load, before Buddy's thread is known;
  • waiting for the thread and the project;
  • another project's thread;
  • GEN3.

Live check: a dev server with separate data and Buddy's window on its own origin (http://[::1]:8220).

  1. In Buddy's thread, "Fork from this response" opens "Buddy fork".
  2. Loading the fork's address as a new page keeps "Buddy fork", and so does a reload.
  3. A missing thread's address leads to the "Buddy" thread.
  4. A thread of the Lazurio project made in Chat (localhost:8220), opened by its address in Buddy's window, leads to the "Buddy" thread.

Checks: check:changed passes format, lint, knip, typecheck and react compiler; the release contract passes. The ChatView browser tests time out on this machine on 8bd9878 too, whose CI was green. AgentContextBudget fails on main as well (#167).

I'll ask for a new review on this head once CI is green.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Blocking:

  • On a fresh GEN4 server with no threads, opening a missing thread URL in Buddy's window leaves a blank view. leadsToBuddysThread returns false while the missing shell has no project ID; ThreadRouteView navigates home only when environmentHasAnyThreads is true. Thus / never runs to create and open Buddy's thread. Distinguish a confirmed missing thread from one still loading and route it to Buddy even when the server has no threads; cover that case.

Non-blocking: The previous finding about fresh-loading forks and subagents is addressed. The new head's CI is still running. Local tests could not run: vp and dependencies are absent; browser and real-phone checks were not performed.

Order and migrations: finish https://github.com/HumanAndMachine-ai/Machines/issues/1330 and the Platform integration before converting a person to GEN4; coordinate the release and canary separately.

— Pablo

immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 18, 2026
Buddy GEN4's entry.buddy names his window's origin where the lane keeps it,
served by the shared T3 Code (R3, Lazurio/t3code#229), and no port of his own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 18, 2026
Buddy GEN4's entry.buddy names his window's origin where the lane keeps it,
served by the shared T3 Code (R3, Lazurio/t3code#229), and no port of his own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on an empty server

On a fresh GEN4 server with no threads, a missing thread's address in
Buddy's window left a blank view: the route waited for a project that the
missing thread never has, and Chat's own redirect home runs only where the
environment has threads. The window now takes the route's own "missing"
(resolveThreadRouteRenderState over the shell status and the thread's
detail) and leads such a thread to Buddy's, which `/` then makes; a thread
still loading still waits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty

Copy link
Copy Markdown
Author

Fixed in e43d3f2: on a GEN4 server with no threads, a missing thread's address in Buddy's window now opens Buddy's thread.

Cause, as the review says: the window waited for the thread's project. A missing thread never has one, and ThreadRouteView leads home only where the environment has threads, so / never ran.

Fix:

  • useLeadsToBuddysThread now computes the route's own "missing" state: resolveThreadRouteRenderState over the shell status (isThreadRouteSnapshotAuthoritative), the thread's detail and a draft, as ThreadRouteView does.
  • In GEN4, leadsToBuddysThread leads a confirmed missing thread to Buddy's thread, and BuddySurfaceIndex makes it.
  • A thread still loading keeps waiting.
  • ThreadRouteView itself is unchanged.

Tests: buddySurfaceControls.test.ts covers three cases:

  • confirmed missing, with and without a known Buddy project;
  • still loading, which waits;
  • the earlier fork and subagent cases, which stay as they were.

Live check: a fresh dev server with separate data and no thread, Buddy's window on http://[::1]:8220.

  1. During pairing I aborted /api/lazurio/buddy/thread in the browser, so / could not make Buddy's thread and the server stayed without threads. The server log shows no request on that route.
  2. I removed the block and opened /<environment>/no-such-thread in Buddy's window.
  3. The window called the thread route twice (the server log shows 2 requests) and landed on /<environment>/lazurio-buddy:<project> with the heading "Buddy" and its composer.

Checks:

  • check:changed: format, knip, typecheck and react compiler pass. Lint passes after shortening one comment.
  • The release contract passes 53 out of 53.
  • The ChatView browser tests time out on this machine on 8bd9878 too, whose CI was green. AgentContextBudget fails on main as well (Agent context budget test fails on current main #167).

I'll ask for a new review on this head once CI is green.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread 72068f77-568a-48aa-aa8a-108c03b29972

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Blocking: None. The previous finding is resolved: a confirmed missing thread now leads to Buddy’s thread even on an empty server, while a thread still loading waits.

Non-blocking: CI is still running on this head. I could not run the local tests because vp and dependencies are absent; I did not independently verify the browser or a real phone. The author reports a successful isolated browser check for the empty-server case.

Order and migrations: finish https://github.com/HumanAndMachine-ai/Machines/issues/1330 and the Platform integration before converting a person to GEN4; coordinate the release and canary separately.

— Pablo

immakermatty added a commit to Lazurio/LazurioPlatform that referenced this pull request Nov 18, 2026
… (LZD-0033 R2) (#1072)

* Buddy GEN4: AGENTS.md and skills of Buddy's folder, two profiles (LZD-0033 R2)

Renders the coordinator's instructions for ~/Buddy (one AGENTS.md, no
CLAUDE.md; each skill in .agents/skills and .claude/skills) in the
profiles buddy and employee, with the persona from Settings → Buddy, and
writes them into Buddy's folder under the Folder's lock. Not wired yet:
the Folder starts writing it once the Machines handover carries
entry.buddy.generation 4 (HumanAndMachine-ai/Machines#1330).

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread d27e5511-ab1d-4892-a9a9-0ec9646d4834

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: read entry.buddy.generation and write ~/Buddy for a converted person (LZD-0033 R2)

The vendored lazurio.machine.v1 schema takes Buddy GEN4's member of
entry.buddy (Machines#1398): generation 4, Buddy's folder and profile, the
origin only while Buddy's own T3 is routed. The binding records buddyFolder
and buddyProfile on a personal VM only, and every change of the Folder
writes the Folder's sibling ~/Buddy with the persona instead of Buddy GEN3's
layer, which is kept, not removed. Without the conversion nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder: say where Buddy GEN4 lives on a converted person's Environment (LZD-0033 R2)

Only where the binding records Buddy's folder: Buddy is a thread of the Buddy
project in the shared T3 Code with ~/Buddy, Lazurio writes its AGENTS.md and
skills, agents never edit them, and Buddy reads and watches the threads
himself. Every other Folder renders the same bytes (the pinned digest of
base-instructions-139 is unchanged); a person converted later gets the line
through the rebound binding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: answer a pending question elsewhere directly (pilot finding, LZD-0033 R2)

The threads skill tells Buddy to answer a thread's pending question in
another Environment himself, over the link with t3_pending_request or over
SSH with t3 request list and t3 request respond, never through a handover
thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: vendor Machines#1398's member without a port (LZD-0033 R2)

Buddy GEN4's entry.buddy names his window's origin where the lane keeps it,
served by the shared T3 Code (R3, Lazurio/t3code#229), and no port of his own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: refuse another home, a symlinked ancestor, CLAUDE.md and files of another account (LZD-0033 R2, review)

- writeBuddyLocked writes the handover's buddyFolder only when it is exactly
  Buddy of the Folder's home, which must be its own canonical path and a
  directory of this account (buddyFolderTarget); a hosted Folder's home is
  its operator's, checked by bindMachineOperator. A mismatch, a nested path
  or a symlinked ancestor is refused and nothing is written.
- An existing CLAUDE.md or .claude/CLAUDE.md in Buddy's folder is reported
  and kept, and nothing is written beside it.
- inspectOutput refuses a file of another account in the whole Folder.
- buddyGeneration(entry): 3 | 4 | undefined, the one rule for every reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: check ~/Buddy before the Folder change commits; tests through init and refresh (LZD-0033 R2, review)

checkBuddyLocked runs before the initialization's and the change's
transaction: another home, a symlinked ancestor, a CLAUDE.md or an unsafe
file in ~/Buddy refuses the operation with the Folder, its binding and its
entry as they were, so a retry after the fix sees the change anew and the
Launchpad's restart follows. The binding records buddyFolder as an absolute,
normalized path ending in /Buddy (the handover's schema keeps
/home/<user>/Buddy), which lets the tests convert a Folder in a temporary
home through initializeMachineFolder, refreshMachineFolder and
refreshMachineFolderAndLaunchpad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: writeBuddyLocked checks ~/Buddy itself before writing (LZD-0033 R2)

A caller outside a Folder change, such as a change of the persona, is
refused before anything is written, as a change is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: the check before the change uses the writer's directory rule; a late failure still restarts the Launchpad (LZD-0033 R2, review)

checkOutputDirectories applies ensureOutputDirectories' own rule (a real
directory of this account on the folder's filesystem) to every existing
directory on an output's way, without creating anything, and
checkBuddyLocked runs it for each of Buddy's files. A failure the check
cannot foresee after the change is recorded, such as a directory that does
not let the account write, still restarts the Launchpad on the new entry in
refreshMachineFolderAndLaunchpad; the failure is reported as it was and the
next refresh writes the folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Machine schema: pin Machines#1398's merge commit d114214f (LZD-0033 R2)

The vendored bytes are unchanged; only the provenance names the merge commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Format output-directories (biome)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder refresh: a late failure reports the Launchpad restart's result (LZD-0033 R2, review)

When a refresh fails after the Folder recorded a new entry,
refreshMachineFolderAndLaunchpad restarts the Launchpad on it and throws
RefreshFailedAfterEntry: the original failure with `launchpad` restarted,
restart-failed or not-supervised, as a successful refresh reports it. That a
failed restart is not retried by a later refresh is the same for a successful
refresh and is tracked in #1082.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: a late write of ~/Buddy is reported in the answer, a refusal is blocked (LZD-0033 R2, review)

A write of Buddy GEN4's folder that fails after the Folder's change is
recorded no longer throws: initialization and every refresh answer it in
"buddyFolder": {"state":"failed","error"}, the change and its entry stand,
the Launchpad restarts on them as after any refresh (its result in
"launchpad"), the exit code stays the refresh's, and the next refresh writes
~/Buddy again. A refusal found before anything changed is BuddyFolderRefused,
which the machine command answers as blocked with exit 2 and its reason
(buddy-folder-mismatch, buddy-folder-claude-md, buddy-folder-unsafe) instead
of an internal failure. RefreshFailedAfterEntry is gone with the throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buddy GEN4: an owed Launchpad restart is made on retry; late refusals and update report (LZD-0033 R2, review)

- The Launchpad's health answer reports the digest of the entry it started
  with (entryDigest). refreshMachineFolderAndLaunchpad restarts the
  supervised Launchpad also when the Folder is unchanged but the Launchpad
  reports another entry than the recorded one, so a failed restart is made by
  the next refresh. An older Launchpad that reports none owes nothing.
- writeBuddyLocked reports everything after the change, a refusal found by
  its own check included (a CLAUDE.md that appeared after the check before
  the change), as buddyFolder {state: failed, reason?, error}; only a lost
  lock stops the operation.
- lazurio update reports a refresh whose ~/Buddy write failed as a failure
  with its reason, and neededRefresh asks the operator's refresh while a
  converted person's ~/Buddy lacks what the product renders, so the next
  update writes it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder refresh: a failed Launchpad restart is kept as owed and retried, also by lazurio update (LZD-0033 R2, review)

refreshMachineFolderAndLaunchpad keeps a failed restart as owed in the
install base (update/launchpad-restart-owed.json, owner-only, written
atomically) and the next refresh restarts it whatever the Launchpad reports
of its entry, an older release or one that does not answer included; a
restart that succeeds, or finds no unit, clears it. lazurio update reports a
refresh whose restart failed as launchpad-restart-failed and runs the
operator's refresh again while a restart is owed, even with the Folder
current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder refresh: the owed restart is recorded ahead and survives an unknown supervision (LZD-0033 R2, review)

refreshMachineFolderAndLaunchpad records the restart as owed before the
refresh, so no failure or interruption between the recorded entry and the
restart can lose it, and clears it when none was owed or a restart succeeds
or finds the Launchpad unsupervised. A debt that cannot be recorded blocks
the refresh with launchpad-restart-unrecordable before anything changes. A
service lookup that fails is no longer taken as unsupervised: the restart is
restart-failed and stays owed until a lookup works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* CLI: the owed-restart path never fails a machine invocation (LZD-0033 R2)

Without an install base the machine command keeps no debt instead of failing
before its usage check, so a wrong invocation still prints the help with
exit 2 (tests/machine-context.test.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder refresh: a restart debt survives overlapping refreshes (LZD-0033 R2, review)

The owed restart carries the token of the attempt that recorded it. A
refresh clears only the debt it recorded or found, never one recorded since,
and every failed restart records its debt anew, so a refresh whose restart
fails after an overlapping one succeeded still leaves its debt for the next
refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Folder refresh: one restart lifecycle at a time per install base (LZD-0033 R2, review)

refreshMachineFolderAndLaunchpad runs the debt, the refresh and the restart
under one restart lock per install base (update/launchpad-restart, the
Folder's kernel lock, released with its process); an overlapping refresh is
blocked as folder-busy, which lazurio update retries. Under the lock the debt
is recorded before the refresh and cleared only after a refresh that owes
none or a restart that succeeded or found the Launchpad unsupervised, so no
attempt can clear another's; the tokens of the previous scheme are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty merged commit 7546379 into main Nov 18, 2026
8 checks passed
@immakermatty
immakermatty deleted the lazurio/buddy-window-shared-server branch November 18, 2026 22:12
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