Skip to content

A conversation can be told only about its own work (agents.set_scope) - #2462

Merged
AbirAbbas merged 4 commits into
workstreams/mainfrom
workstreams/l-fix9-cross
Nov 6, 2026
Merged

AbirAbbas merged 4 commits into
workstreams/mainfrom
workstreams/l-fix9-cross

Conversation

@AbirAbbas

Copy link
Copy Markdown
Collaborator

Summary

A conversation can now be told only about its own work. Today every conversation in a folder gets an <elsewhere> block with the other conversations' landed and running work there (with the files each wrote), and its tasks tool lists the folder's whole task index. A client that keeps a long-lived conversation in a person's shared work folder needs that conversation to see only its own work while keeping its folder, transcript and history.

  • session.Meta.Scope: conversation, or absent for project (today's behaviour). Written by session.SetConversationScope under the existing cross-process meta lock; the session's own stamps patch only their fields, so it survives them.
  • Read beside the turn in refreshElsewhere and in the tasks tool (both already read disk), so a live conversation follows the stored word from its next turn with no remote-protocol change. Scoped: no <elsewhere> block; the tasks tool lists and addresses only this conversation's rows; no running-in-other-windows or everywhere sections. The person's @ list, task nodes and the write-safety warnings (ground shift, preflight) are unchanged.
  • Wire: agents.set_scope {id, scope} → {id, scope}; hello feature agents.scope. It never opens, warms or interrupts the conversation (like agents.mark_seen). bad_params, not_found, conflict (lent conversation or no local folder), unknown_method on engines without the door.

Why a stored switch rather than moving a conversation to another folder: Config.Workspace is captured at launch and the session folder, task index, presence, told stamp and transcript URIs are keyed on it; a move would re-key all of them. A live in-memory dial would need new remote-protocol plumbing because app conversations are remote.Agent connections. The stored word is one field, one setter and two read sites. (The Workstreams plan, L-FIX9.)

Validation contract

Item Behaviour Test
A1 scoped conversation gets no <elsewhere> block despite another conversation's recent landing and running task TestConversationScopeLeavesOtherWorkOutOfTurnContext
A2 its tasks tool lists/reads/steers/resolves only its own tasks; no other-window or everywhere sections TestConversationScopeTasksReachOnlyItsOwnRows, TestConversationScopeKeepsItsLiveGraphWhileFilteringTheMergedIndex, TestConversationScopeLeavesATaskNodesChildrenVisible
A3 unset or project behaves exactly as before TestProjectScopeKeepsOtherWorkVisible, TestConversationScopeDefaultsQuietlyToProject
A4 survives reload and later effort/title/spend/places stamps TestConversationScopeSurvivesReloadAndLaterMetadataStamps
A5 an earlier block clears at the next reading TestConversationScopeClearsAnEarlierBlockOnTheNextReading
A6 changes nothing else in meta.json or the transcript; repeat writes nothing TestConversationScopeChangesOnlyItsStoredWord, TestConversationScopeStaysInMetaBesideSealedConversationSettings
A7 wire validation, hello gating, unknown_method, not_found, lent refusal, closed agent written without opening internal/appwire/agent_scope_test.go, cmd/codeaf/appscope_test.go
A8 unknown word and folder without meta.json refused; never minted TestConversationScopeRefusesUnknownWordsAndMissingConversations

Left for later

The scope is local meta.json state: it is not carried when a conversation moves to another computer.

🤖 Generated with Claude Code

AbirAbbas and others added 4 commits November 6, 2026 09:30
…tion context

A conversation's meta.json can now store scope "conversation". Such a
conversation gets no <elsewhere> block on its turns, and its tasks tool lists
and addresses only its own tasks (no other conversations' landed rows, no
running-in-other-windows or everywhere sections). The default, project, keeps
today's behaviour. The word is written under the meta lock and read beside the
turn and in the tasks tool, so a live conversation follows it from its next turn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pening it

agents.set_scope {id, scope} stores project or conversation in the
conversation's meta.json and answers the stored word. It never opens, warms or
interrupts the conversation. Engines that serve it announce agents.scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the scope

The new scope words are WorkScopeProject/WorkScopeConversation (ScopeProject
already names an answer scope). agents.set_scope returns *AgentScope as typed
handlers must. saveMetaLocked keeps the stored scope when a whole-Meta writer
loaded before a scope change saves with none, and project is stored as its own
word so a reset survives that rule too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas
AbirAbbas force-pushed the workstreams/l-fix9-cross branch from ea56746 to 2e3f564 Compare November 6, 2026 14:30
@AbirAbbas
AbirAbbas merged commit e985a44 into workstreams/main Nov 6, 2026
8 checks passed
@AbirAbbas
AbirAbbas deleted the workstreams/l-fix9-cross branch November 6, 2026 14:44
AbirAbbas added a commit that referenced this pull request Nov 13, 2026
…, agents.set_scope) (#2613)

* Client tools: a client attaches tools to a conversation

Carries #2334 from workstreams/main (e9a571c) onto dev. The workstream
door that commit sat beside is left out, and the collection-held
conversation half is already on dev (#2475).

Co-Authored-By: Claude Mythos 5.2 <[email protected]>

* Client tools: a tool call names the message its turn answers; the answer cutoff is a wait

Carries #2346 (b1a02be) and #2360 (25c6faa) from workstreams/main.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>

* Client tools cross the remote door to the connection that set them

Carries #2417 (08b6e1e) from workstreams/main.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>

* A conversation can be told only about its own work (agents.set_scope)

Carries #2462 (e985a44) from workstreams/main.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>

* changes: one entry for client tools and conversation scope (#2613)

Replaces the five entries carried with the source commits.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>

* Client tools: a call id hashes the whole call, and a call without a provider id gets a random id

The `call` id was sha256(agent, provider call id), with a per-process
counter when the provider gave no id. Provider ids are not unique:
Kimi-family models write their own `name:idx` ids, which repeat after
agents.rewind or compaction, and a faulty server can repeat any id. A
reused id with another tool or other arguments therefore joined the
earlier call's wait or got its saved answer, and never reached the app,
while the app's 30-day table replayed the old answer for the same id.
The counter restarted at every launch, so ids minted without a provider
id came back after a restart.

clientToolCallID now hashes the agent, provider call id, set, tool name
and exact argument bytes, each length-prefixed, and keeps the `ct_` + 64
hex shape. The same call dispatched again keeps its id, joins the pending
wait and gets the saved answer. Without a provider id the id is 32 random
bytes. Calls from a remote holder reach the same door, so they share the
identity.

PROTOCOL.md and the change entry say what `call` is derived from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Conversation scope: the page and the tasks description stop promising other windows' work

Under `conversation` scope a conversation gets no <elsewhere> block and
its tasks tool lists only its own work, but its system prompt still said
"OTHER codeaf WINDOWS ON THIS PROJECT ARE VISIBLE TO YOU" and the tasks
description still said search includes other windows' live work. The
model could read an empty answer as "nothing else is running here" and
tell the person so.

The page's other-windows line and the tasks description now follow the
stored scope. Under conversation scope the page says the conversation is
told only about its own work and must not conclude nothing else is
running; the tasks description says search reaches only its own work,
even with scope everywhere. A project page and tasks description stay
byte for byte as before.

The scope is read when the agent is made and again at each turn's start.
A changed scope re-renders the page and replaces the tasks tool on the
belt and on a lean shelf, in fresh arrays, so the model sees the change
from the next turn, as the scope already promises. Task nodes keep their
page.

PROTOCOL.md, the tasks manual page and the change entry say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Client tools: a session swap drops the old conversation's sets

A holder shares one ClientToolHub across the initial, fresh and resumed
openings of a remote Session. When another window ran /new or /resume,
Session.swap replaced the agent but left every connection's sets in the
hub, so the replacement conversation got a joined app's tools and
instructions, and its calls went to that app under the old agent's id.
The app then wrote into the old workstream, and its answer was refused
with ErrJoinedGone, so the holder's model was told client_timeout.

Session.swap now calls ClientToolHub.forget before the new agent is
reachable: every connection's sets go, pending calls end with a
clientToolEnded frame so the app stops waiting too, and a joined
connection's snapshot that was already past the session's check is
refused. A following surface may still attach to the open conversation.

PROTOCOL.md, REMOTE.md, the client-tools manual page and the change
entry say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Mythos 5.2 <[email protected]>
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.

1 participant