Skip to content

docs(agents): teach agents the thread ownership vocabulary - #768

Merged
lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/thread-vocabulary-guidance
Nov 20, 2026
Merged

lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/thread-vocabulary-guidance

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Part of #751

Agent guidance still described threads in older terms. In evals on main, the model delegated requests to start a child thread and made a group thread independent. It archived the wrap-up root before asking whether to include the typed-in conversations. The revised guidance uses the sidebar and lifecycle tool vocabulary and maps each short request to its operation.

Injected thread vocabulary

  • Start work in another thread only when the user asks or a skill they invoked calls for it. "Task an agent", "have a task", and "delegate" mean a task: short-lived owned work via delegate_task. A named thread kind overrides the verb.
  • "Child thread": an owned, interactive thread that handles its own waits. Use t3_thread_launch for one or create_threads for a batch. Launches are owned by default across projects and environments. By default, owned threads sit under their owner in the same project or in a collapsed group per owner in another project.
  • "Top-level thread": an independent sidebar root. Set topLevel:true only when the user asks for one, as in "task a top-level thread". groupedUnderThreadId changes placement only.
  • "Group thread": an empty thread that holds others. Launch without a message or attachments, or batch-create without a prompt.
  • "Promote": t3_thread_organize with action:"promote" releases ownership; return_to_owner restores it.
  • "Wrap up": use t3_thread_archive_family to preview owned work across this environment's projects. If the user hasn't decided about conversations they typed in or their owned descendants, name the kept conversations, ask whether to include them, and wait for the answer before archiving. Use t3_thread_organize with the default selection unless the user consents to including those branches.

Stale guidance corrected

  • Launch ownership. Interactive launches were described as always top-level. The guidance now explains that the requesting thread owns a launch by default across projects and environments. Only an explicit top-level request sets topLevel:true. The eval runner’s comments now call them launches.
  • Start rule: it covered generic thread requests without separating a task from an interactive child. It now follows the requested thread kind and allows starts requested by the user or by a skill they invoke. Eligible native subagent requests keep their native route.
  • Group threads and placement: launch and batch-create copy said "empty parent", and null placement was described as leaving a thread ungrouped. The tools now say "empty group thread" and explain that clearing manual placement leaves ownership unchanged. A visible explicit group can override the default sidebar placement.
  • Actions: the guidance said "top-level" for any thread entitled to run its own Action. It now says eligible Actions, including a launched child's Actions and those a parent runs for a task.
  • Release wording: the thread list described release as an operation. The organize tool now owns the promote/return wording and explains the delegated result and continuation gate.
  • Archive: guidance covered grouped children and subagents only. It now describes the same-environment, cross-project family, the preview selection, and typed-in consent. The sidebar guide covers retention and restore, and identifies read-only subagents as provider-native.
  • Separate worktrees: the remote task prerequisite was missing. The instructions now name the destination capability and the fetchable parent commit.

Model eval against main

GPT-6.1 Sol xhigh with the GPT-6.1 Terra shell simulator. Three samples per case per arm. Baseline fba5fa4470e. The wrap-up pair uses the same revised fixture, with read results for the kept conversations. The vocabulary rows use the final model-facing text and were scored with the final grader. The wrap-up baseline uses the revised fixtures. The existing native-subagent guard uses the preceding candidate, which differs only by the default-placement clarification.

Owner phrasing or control Main Candidate
Task an agent 3/3 3/3
Have a task 3/3 3/3
Delegate 3/3 3/3
Start a child thread 0/3 3/3
Hand to a child thread 0/3 3/3
Task a top-level thread 3/3 3/3
Start a top-level thread 3/3 3/3
Start a group thread 0/3 3/3
Promote 3/3 3/3
Wrap up asks before archiving 0/3 3/3
Wrap up after choosing to leave typed-in conversations open 3/3 3/3
Ordinary work 3/3 3/3
Native subagent request (existing guard) 0/3 0/3
  • Main's failures: both child requests used delegation, and the group thread became independent.
  • Wrap-up: the first request must preview, name the two kept conversations, and ask for the user's choice before archiving. The follow-up checks the exact default archive selection after the user asks to keep them open.

The existing native-subagent guard failed all three samples on both main and the candidate. It is tracked in #589.

All 36 vocabulary samples and all three manual-placement control samples passed with the final grader. Both post-rebase samples passed, covering the explicit top-level flag and consent before archive. After reconciling #771, all 9 archive samples passed, including its temporary-project selection control. All 88 focused MCP and budget tests passed on the combined head.

The full tool-use run on 8f6dbba635f, before the review fixes, passed 600 of 649 scored samples across 317 cases. Three provider errors were unscored. The launch, grouping, promotion, and archive controls in that run passed. The ordinary new-thread guard passed 2 of 3, and the native-subagent guard also failed there. The paired main comparison covers the cases in the table. The full run has no matching full baseline.

Quick CI and 668 focused tests passed across the final changes. Rebase validation covers the generated budget and carry compilation. Required GitHub CI and Codex review passed on the preceding head ec0d25ef45c815e14fe30dd5abc3da7b135deb48, with zero unresolved review threads. GitHub CI, Codex review.

Context budget

Value Main Candidate Byte change
claudeSystemAppendBytes 21,845 23,198 +1,353
codexAdditionalContextBytes 22,843 24,196 +1,353
mcpToolListJsonBytes 85,478 85,506 +28

Main changed other tool descriptions after the focused run. At #771, the archive description kept both the new temporary-project consent and the vocabulary guidance. The measured byte increases are the same after rebasing.

The orchestrator applied agent-context-increase after reviewing the previously approved head. The rebase after #771 preserves all three approved byte increases.

Upstream-owned files

File Added Removed
apps/server/src/mcp/McpHttpServer.test.ts 1 1
apps/server/src/mcp/toolkits/orchestrator/tools.ts 3 3
apps/server/src/mcp/toolkits/project/tools.ts 1 1
apps/server/src/mcp/toolkits/thread/tools.ts 2 2
apps/server/src/provider/agentContextBudget.json 3 3
docs/user/thread-sidebar.md 22 17
evals/mcp-tool-use/run.ts 3 3
packages/provider-core/src/server/orchestrationInstructions.ts 7 4

Decisions

  • Shared copy: the vocabulary lives in a fork-owned module and is interpolated into the existing orchestration section, so Codex and the other providers get identical text.
  • Group threads: use the existing empty launch inputs. Tool schemas and runtime behavior are unchanged.
  • Wrap-up: name the kept conversations and get the user's choice before applying the archive preview selection. The rebase after feat(threads): remove temporary projects at wrap-up #771 preserved its separate consent and history-deletion warnings for removing temporary projects. Cross-environment archiving remains outside this PR.
  • Thread-read routing: the contract is intact. The added fixture returns matching read results so the model can follow the existing link rule.
  • Eval scope. The paired run and the full suite use one evaluator model. The new cases cover the owner's terse phrasing, and the existing suite covers neighboring behavior.
  • Carry replay. The initial push omitted the required source trailers. All source commits now identify Agent-created threads: record an owner, and make the sidebar, archive and promote follow it #751 and use the Incubator group, as the vocabulary spans the feature’s tools, prompts, tests, and docs. Main’s feat(server): publish observe-only machine capacity #726 squash then needed a provenance repair. The rebase onto repaired main preserved the complete PR tree.
  • Authorship: Claude Opus polished the guidance. I clarified null placement where an explicit top-level flag also applies, and fixed wrap-up's consent order after review traced what happens when the archive ends the turn.

Local review: 3 rounds with GPT-6.1 Terra (xhigh), approved. The last round found one low-severity grader gap. The tighter check rejects unrelated questions and preserves the paired wrap-up scores when regrading saved samples.

@lastobelus lastobelus changed the title docs(agents): use thread ownership vocabulary docs(agents): teach agents the thread ownership vocabulary Nov 20, 2026
@lastobelus
lastobelus marked this pull request as ready for review November 20, 2026 05:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T08:01:33.601984Z 19565ab Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: fa5264205f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus force-pushed the lastcode/thread-vocabulary-guidance branch from fa52642 to 1e904dc Compare November 20, 2026 05:42
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 1e904dcb80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus force-pushed the lastcode/thread-vocabulary-guidance branch from 1e904dc to 3b9c8ea Compare November 20, 2026 06:31
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 3b9c8ea93e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus force-pushed the lastcode/thread-vocabulary-guidance branch from 3b9c8ea to 7e22c72 Compare November 20, 2026 07:08
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 7e22c7217a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus lastobelus added the agent-context-increase Intentional agent context growth approved by a maintainer label Nov 20, 2026
@lastobelus
lastobelus force-pushed the lastcode/thread-vocabulary-guidance branch from 7e22c72 to ec0d25e Compare November 20, 2026 07:35
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: ec0d25ef45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The injected instructions still describe every launch as a top-level thread. Explain the thread kinds, default ownership, promotion and archive consent, and exercise the owner's requests in the tool-use eval.

GPT-6.2 Sol via Codex in T3 Code.

Carry-Group: incubator
Carry-Fix: #751
A wrap-up can close its own turn, so ask which conversations to keep first and exercise both sides of the choice in the eval. Scope native subagent guidance to subagent requests and clarify when a delegated task can be promoted.

GPT-6.2 Sol via Codex in T3 Code.

Carry-Group: incubator
Carry-Fix: #751
An explicitly grouped thread can sit under a different conversation while keeping its owner. Qualify the default in the agent guidance and sidebar guide.

GPT-6.2 Sol via Codex in T3 Code.

Carry-Group: incubator
Carry-Fix: #751
A retention statement followed by an unrelated question previously passed. Require the consent question to refer to the retained conversations.

GPT-6.2 Sol via Codex in T3 Code.

Carry-Group: incubator
Carry-Fix: #751
Expect owned-task wording while retaining the routing guards. Accept the consent question phrased as an inline choice without admitting unrelated questions.

GPT-6.2 Sol via Codex in T3 Code.

Carry-Group: incubator
Carry-Fix: #751
@lastobelus
lastobelus force-pushed the lastcode/thread-vocabulary-guidance branch from ec0d25e to 19565ab Compare November 20, 2026 07:59
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 19565abda3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit 1aaf768 into lastcode/main Nov 20, 2026
33 checks passed
@lastobelus
lastobelus deleted the lastcode/thread-vocabulary-guidance branch November 20, 2026 08:17
lastobelus added a commit that referenced this pull request Nov 20, 2026
Part of #751

When `delegate_task` refuses a different local project, point authorized work to `t3_thread_launch` in that project. For an isolated request, let T3 create the worktree. Include a callback when the caller will use the result.

GPT-6.1 Sol at medium effort, with #768 on both sides

- Recovery passed 0/3 on main and 3/3 completed samples with the new wording. A replacement passed after one provider stream ended early.
- Same-project delegation passed 3/3 on both.
- Quick CI, 634 focused tests, eval typecheck, and lint passed. The tool-list and injected-text budgets changed by 0 bytes.

Local review: 4 rounds with GPT-6.1 Terra (xhigh), approved.

Carry-Source-Ref: refs/lastcode/carry-sources/pr-783/6fc2fc545d3f29a2057c9d6fac6c447673ecffe7
Carry-Source-Base: 1aaf768
Carry-Source-Head: 6fc2fc5
lastobelus added a commit that referenced this pull request Nov 20, 2026
Part of #751

## What this PR does

Archive preview now shows owned conversations on linked environments and names peers it cannot check. This is part 1 of the two-PR split of D4. Linked threads stay open unless the user explicitly selected them through another archive entry in a bulk selection.

## What users see

- An available machine lists its owned threads with project, typed-in, active, unread, and protected state. Ordinary archive, bulk archive, saved-workspace confirmation, and the mobile alert use the same information. The `t3_thread_archive_family` tool returns per-machine sections.
- An offline machine shows **Pending · Offline**. A refusal shows **Blocked · Access denied**. An older build shows **Blocked · Update this machine to review its threads**.
- Each destination applies the paired link's authorization and walks its recorded ownership for the source thread and that thread's locally owned work. Work owned through a second peer needs a separate review.
- Peer inventory is read-only. Once the local roster supplies the machine names, owner lookup, link resolution and requests use the remaining time in a shared one-second budget. Each machine's result is retained as it answers. Bulk previews run concurrently and list the selected threads with archive labels and locations. An unavailable peer prompts for review. Empty inventories alone leave the normal idle archive flow in place.

## Archive and restore in part 2

Part 2 records one operation per local archive generation, with an exact selection and receipt for each destination. Local archive finishes independently of the peers. An explicit retry reuses a reviewed selection while it remains valid and asks for fresh review when the destination could not be inspected. Restore reopens the exact committed threads and reports unreachable destinations for retry. The recorded selection preserves consent without a standing retry service.

## Verification

- GitHub CI and Codex review passed on `6b36558175043c85896f9bea8ffc88103ca567b9`, with zero unresolved review threads. [GitHub CI](https://github.com/lastobelus/lastCode/actions/runs/44703913066) · [Codex review](#772 (comment))
- Rebased over #771 so local temporary-project removal and linked preview appear in the same confirmation. The later rebase over #768 required regenerating only the context budget. The rebase passed 118 focused tests, 81 web checks, 17 Chromium tests, and the translation catalog check. The final deadline and bulk-label fixes passed 33 focused tests and scoped lint. Quick CI passed on `6b36558175043c85896f9bea8ffc88103ca567b9` against `1aaf7683dc0d16bb937721b7b1585f25348f4379`.
- Production indexed reads exercised two separate SQLite environments. The fixtures included transitive ownership across projects, archived and deleted intermediates on both sides, and a thread ID reused under a different environment. Transport tests checked link authorization, refusal, offline, unsupported, and the deadline during both resolution and HTTP.
- In the isolated dev app, the real web client named an expired test link as blocked and moved the local thread to Archived after confirmation. The Incognito QA tab paired with the isolated dev credential. Chromium component tests rendered available, offline, and older peers. Mobile tests exercised alert contents and local archive consent.
- Six batches of 50 synthetic local archive commands per checkout measured dispatch through completion, with shared dependencies. Median was 3.047 s on the original main baseline, with a 2.081–3.230 s range. The preview branch measured 3.106 s, with a 1.981–3.472 s range. The archive command does not call peers.
- The archive tool eval passed 17/18 samples with GPT-6.1 Sol on the final head. Five cases passed 3/3. The busy-owner case passed 2/3, matching a run against main at `1aaf7683dc0d16bb937721b7b1585f25348f4379`. The one failure skipped the archive-family inspection while leaving the busy owner and its work alone. The same case was 0/3 after #768 with the earlier preview wording, and all six cases passed 18/18 before #768.
- Repository budget bytes moved from 23,198 to 23,198 for Claude system append, from 24,196 to 24,196 for Codex additional context, and from 85,506 to 85,503 for the MCP tool list (−3 bytes).

<details>
<summary>Browser component captures</summary>

**Before** — local archive choices.

<img width="414" alt="Archive confirmation with local threads" src="https://github.com/user-attachments/assets/e9fae817-15b2-4449-b0e0-616db443f2f9" />

**After** — available, offline, and older machines in the same confirmation.

<img width="414" alt="Archive confirmation with sections for linked machines" src="https://github.com/user-attachments/assets/d47a2c82-9fce-4083-9556-e6d450ead9bf" />

</details>

## Upstream-owned files touched

| File | Added | Removed |
| --- | ---: | ---: |
| `apps/mobile/src/i18n/translations/de.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/en.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/es.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/fr.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/ja.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/ko.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/pt-BR.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/ru.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/sv.json` | 10 | 1 |
| `apps/mobile/src/i18n/translations/zh.json` | 10 | 1 |
| `apps/server/src/mcp/toolkits/thread/handlers.ts` | 7 | 4 |
| `apps/server/src/mcp/toolkits/thread/tools.ts` | 1 | 1 |
| `apps/server/src/peer/PeerLinks.test.ts` | 3 | 0 |
| `apps/server/src/peer/PeerLinks.ts` | 9 | 3 |
| `apps/server/src/provider/agentContextBudget.json` | 1 | 1 |
| `apps/server/src/server.ts` | 7 | 0 |
| `apps/server/src/ws.ts` | 8 | 0 |
| `apps/web/src/i18n/translations/de.json` | 11 | 1 |
| `apps/web/src/i18n/translations/en.json` | 11 | 1 |
| `apps/web/src/i18n/translations/es.json` | 11 | 1 |
| `apps/web/src/i18n/translations/fr.json` | 11 | 1 |
| `apps/web/src/i18n/translations/ja.json` | 11 | 1 |
| `apps/web/src/i18n/translations/ko.json` | 11 | 1 |
| `apps/web/src/i18n/translations/pt-BR.json` | 11 | 1 |
| `apps/web/src/i18n/translations/ru.json` | 11 | 1 |
| `apps/web/src/i18n/translations/sv.json` | 11 | 1 |
| `apps/web/src/i18n/translations/zh.json` | 11 | 1 |
| `packages/contracts/src/index.ts` | 1 | 0 |
| `packages/contracts/src/orchestrationV2.ts` | 2 | 0 |

Local review: 8 rounds with gpt-6.1-terra (xhigh), approved.

Carry-Source-Ref: refs/lastcode/carry-sources/pr-772/6b36558175043c85896f9bea8ffc88103ca567b9
Carry-Source-Base: 1aaf768
Carry-Source-Head: 6b36558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Intentional agent context growth approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant