Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
63bbfec
feat: project brief storage, RPCs and session lookup
badcuban Nov 19, 2026
cd7c396
feat(web): the project brief on Settings › Instructions, saved on eve…
badcuban Nov 19, 2026
25d62bb
feat(server): every agent gets the project brief when its session starts
badcuban Nov 19, 2026
2a25445
fix: a brief save never overwrites another computer's newer brief
badcuban Nov 19, 2026
565f966
feat(contracts): project notes, suggestions, their RPCs and the proje…
badcuban Nov 19, 2026
4fd1849
feat(server): project notes storage, service and the app's RPCs
badcuban Nov 19, 2026
ffca7d2
feat(server): agents read and write project notes, and sessions list …
badcuban Nov 19, 2026
1ede682
test(server): project notes: what agents see, what a write becomes, u…
badcuban Nov 19, 2026
2b95c7b
feat(web): project notes on Settings › Instructions and suggested not…
badcuban Nov 19, 2026
aedcf7e
refactor: one projectContext.changeNote RPC for every note change
badcuban Nov 19, 2026
2d13066
fix: a note's access follows the agent's real level, and approval nam…
badcuban Nov 19, 2026
b1e23e4
test(server): re-record the Claude replays, which now allow the proje…
badcuban Nov 19, 2026
1d9ea5b
fix(server): a note reader counts at the level its chat asks for
badcuban Nov 19, 2026
21a808e
fix(web): "Show to all threads" names the text the open note shows
badcuban Nov 19, 2026
3c3a4d7
test(server): the app's own tools now include the project note tools
badcuban Nov 19, 2026
95859bd
Merge commit 'd9d50dc7e' into feat/project-notes
badcuban Nov 19, 2026
9fc993f
Merge main into feat/project-notes
badcuban Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/server/evals/toolUse/cannedTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ export function makeCannedRoomHandlers(
outcome: "no_receiver",
detail: "No assistant is set up to receive alerts.",
})),
project_note_read: answer("project_note_read", () => ({
outcome: "not_found",
detail: "This project has no note with that title.",
})),
project_note_write: answer("project_note_write", () => ({
outcome: "suggested",
detail: "Your note waits for the user to keep or discard.",
})),
});
}

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

240 changes: 64 additions & 176 deletions apps/server/integration/replay/fixtures/revert-turn/claude.ndjson

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions apps/server/integration/replay/fixtures/simple-turn/claude.ndjson

Large diffs are not rendered by default.

192 changes: 97 additions & 95 deletions apps/server/integration/replay/fixtures/subagent/claude.ndjson

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions apps/server/src/guide/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,22 +331,30 @@ When a Claude or Codex usage limit stops a thread, the notice above the composer
},
{
id: "project-brief",
title: "Project brief",
title: "Project brief and notes",
keywords: [
"brief",
"project brief",
"project instructions",
"standing instructions",
"rules for every thread",
"project memory",
"project notes",
"notes",
"suggested note",
"keep note",
],
body: `A project's brief is text the user writes once. Every thread in the project gets it as the user's standing instructions, on any agent. It is set in {place:instructions.brief}: pick the project at the top, write it, Save. Up to 8,000 characters. Agents can't change it.

New threads get a change at once. A thread that is already open gets it the next time its agent starts: after the app restarts, after a model switch, or after a stop. Threads behind the link fence, or started by an outside agent, don't get it.

Threadlines keeps it on each computer, not in the repository. Save stores it on every connected computer that has the project, and the line under the box says where it went. If the computers hold different briefs, the page shows the picked computer's and offers to copy it to the others. If another device saved first, Save says so and shows the newer text instead of overwriting it. Set up on another computer copies the brief with the project.

The project menu's Project brief, the command palette and the lead chat's crown card open it too.`,
Project notes are short notes for later threads in the project: a title, one line and a text. Every thread gets the list of titles and lines when its agent starts and can read a note's text. Notes are what other agents or the user left, not the user's instructions. They stay on the computer whose agents wrote them and are listed in {place:instructions.notes}, where the user can add, edit or remove one.

{place:instructions.notesMode} decides what an agent's note becomes, for every project on that computer. Ask me first, the default: it is a suggestion, shown in the notes list and as a row in the thread that wrote it, with Keep and Discard. No agent sees a suggestion until the user keeps it, and it never marks the thread as needing the user or holds anything up. Keep without asking: it is kept at once, but only threads running with no more access than the agent that wrote it see it, until the user presses Show to all threads. Off: agents don't write notes, and kept notes still reach threads. Only the user can keep a note or change this setting.

The project menu's Project brief and notes, the command palette and the lead chat's crown card (Brief and notes) open the page too.`,
},
{
id: "browser-panel",
Expand Down
11 changes: 10 additions & 1 deletion apps/server/src/mcp/McpHttpServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ describe("McpSessionRegistry", () => {
registry.credentialFor({ sessionKey: THREAD, browser: true, room: true, guideOnly: true }),
);
expect([...((await Effect.runPromise(registry.resolve(main.token)))?.roomTools ?? [])]).toEqual(
["app_guide", "settings_change", "secret_request", "alert_assistants"],
[
"app_guide",
"settings_change",
"secret_request",
"alert_assistants",
"project_note_read",
"project_note_write",
],
);
const side = await Effect.runPromise(
registry.credentialFor({
Expand Down Expand Up @@ -455,6 +462,8 @@ describe("MCP endpoints", () => {
expect("tools" in result.guideOnlyRoom ? result.guideOnlyRoom.tools : []).toEqual([
"alert_assistants",
"app_guide",
"project_note_read",
"project_note_write",
"secret_request",
"settings_change",
]);
Expand Down
99 changes: 80 additions & 19 deletions apps/server/src/mcp/McpRoomServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
agentThreadsMode,
agentThreadsShareWorktrees,
} from "@threadlines/shared/serverSettings";
import type { ThreadId } from "@threadlines/contracts";
import type { ModelSelection, ThreadId } from "@threadlines/contracts";
import { runtimeModeOnAgent } from "@threadlines/shared/runtimeMode";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
Expand All @@ -36,7 +37,12 @@ import { ProjectionSnapshotQuery } from "../orchestration/Services/ProjectionSna
import { ProviderRegistry } from "../provider/Services/ProviderRegistry.ts";
import { ProviderService } from "../provider/Services/ProviderService.ts";
import { ServerSettingsService } from "../serverSettings.ts";
import { GUIDE_TOOL_NAME, SCHEDULE_TOOL_NAMES } from "./roomToolAccess.ts";
import {
GUIDE_TOOL_NAME,
PROJECT_NOTE_WRITE_TOOL_NAME,
SCHEDULE_TOOL_NAMES,
} from "./roomToolAccess.ts";
import { ProjectContext } from "../projectContext/ProjectContext.ts";
import { GitVcsDriver } from "../vcs/GitVcsDriver.ts";
import { ServerEnvironment } from "../environment/Services/ServerEnvironment.ts";
import { ComputerLinkClient } from "../links/ComputerLinkClient.ts";
Expand Down Expand Up @@ -71,6 +77,8 @@ import { SecretRequestToolkit } from "./secretRequestTools.ts";
import { AgentSecretRequests } from "../secrets/AgentSecretRequests.ts";
import { makeAlertAssistantsToolHandler } from "./alertAssistantsToolHandlers.ts";
import { AlertAssistantsToolkit } from "./alertAssistantsTools.ts";
import { makeProjectNoteToolHandlers } from "./projectNoteToolHandlers.ts";
import { ProjectNoteToolkit } from "./projectNoteTools.ts";
import { AssistantAlerts } from "../assistants/AssistantAlerts.ts";
import { makeScheduleToolHandlers } from "./scheduleToolHandlers.ts";
import { ScheduleToolkit } from "./scheduleTools.ts";
Expand All @@ -87,6 +95,7 @@ export const RoomEndpointToolkit = Toolkit.merge(
SettingsChangeToolkit,
SecretRequestToolkit,
AlertAssistantsToolkit,
ProjectNoteToolkit,
);

type RoomEndpointToolName = keyof typeof RoomEndpointToolkit.tools;
Expand Down Expand Up @@ -129,6 +138,11 @@ const ROOM_TOOL_REACH = {
// Only marks the caller's own turn, but sends word of it off this computer:
// refused while outside work limits the caller.
alert_assistants: "changes",
// Reads the caller's project's notes: beyond its own thread.
project_note_read: "project",
// Leaves a note other threads may read: refused while outside work limits
// the caller (docs/design/project-brief-notes.md, "What a write becomes").
project_note_write: "changes",
} as const satisfies Record<
Exclude<RoomEndpointToolName, typeof GUIDE_TOOL_NAME>,
"own" | "project" | "changes"
Expand Down Expand Up @@ -158,14 +172,18 @@ const authenticate = Effect.gen(function* () {
Effect.map(agentThreadsMode),
Effect.orElseSucceed(() => "off" as const),
);
const listed: ReadonlySet<string> =
mode === "off"
? new Set(
[...scope.roomTools].filter(
(tool) => !(SCHEDULE_TOOL_NAMES as ReadonlyArray<string>).includes(tool),
),
)
: scope.roomTools;
// So does project_note_write "Notes agents write".
const notesOff = yield* settings.getSettings.pipe(
Effect.map((current) => current.projectNotes === "off"),
Effect.orElseSucceed(() => true),
);
const listed: ReadonlySet<string> = new Set(
[...scope.roomTools].filter(
(tool) =>
!(mode === "off" && (SCHEDULE_TOOL_NAMES as ReadonlyArray<string>).includes(tool)) &&
!(notesOff && tool === PROJECT_NOTE_WRITE_TOOL_NAME),
),
);
// Read per call: outside work can limit a credential while it lives.
const outsideLimit = yield* limits.forScope(scope);
return yield* handler.pipe(
Expand Down Expand Up @@ -210,6 +228,15 @@ const RoomToolHandlersLive = RoomEndpointToolkit.toLayer(
snapshots.getThreadDetailById(threadId).pipe(Effect.map(Option.getOrUndefined), Effect.orDie);
const readThreadShell = (threadId: ThreadId) =>
snapshots.getThreadShellById(threadId).pipe(Effect.map(Option.getOrUndefined), Effect.orDie);
const modelNameOf = (selection: ModelSelection) =>
providers.getProviders.pipe(
Effect.map((all) => {
const model = all
.find((provider) => provider.instanceId === selection.instanceId)
?.models.find((candidate) => candidate.slug === selection.model);
return model?.shortName ?? model?.name ?? selection.model;
}),
);
const handlers = makeRoomToolHandlers({
engine,
readThread,
Expand All @@ -230,15 +257,7 @@ const RoomToolHandlersLive = RoomEndpointToolkit.toLayer(
),
Effect.orElseSucceed(() => undefined),
),
modelNameOf: (selection) =>
providers.getProviders.pipe(
Effect.map((all) => {
const model = all
.find((provider) => provider.instanceId === selection.instanceId)
?.models.find((candidate) => candidate.slug === selection.model);
return model?.shortName ?? model?.name ?? selection.model;
}),
),
modelNameOf,
threadTitleOf: (threadId) =>
readThreadShell(threadId).pipe(
Effect.map((thread) => thread?.title),
Expand Down Expand Up @@ -438,6 +457,40 @@ const RoomToolHandlersLive = RoomEndpointToolkit.toLayer(
),
alerts: Option.getOrUndefined(assistantAlerts),
});
const projectContext = yield* Effect.serviceOption(ProjectContext);
const projectNotes = makeProjectNoteToolHandlers({
readThread,
context: Option.getOrUndefined(projectContext),
notesMode: settings.getSettings.pipe(
Effect.map((current) => current.projectNotes),
Effect.orElseSucceed(() => "off" as const),
),
// The level the runtime's chat asks for, and the one it really runs
// at: an agent without the asked level (Pi has no Auto) runs at the
// next safer one. A provider that can't be found reads as the three
// legacy levels, which only lowers `runs`.
runtimeModeOf: (sessionKey) =>
Effect.gen(function* () {
const session = (yield* providerService.listSessions()).find(
(entry) => entry.threadId === sessionKey,
);
if (session === undefined) return undefined;
const provider = (yield* providers.getProviders).find(
(entry) => entry.instanceId === session.providerInstanceId,
);
return {
asked: session.runtimeMode,
runs: runtimeModeOnAgent({
requested: session.runtimeMode,
providerModes: provider?.supportedRuntimeModes,
modelModes: provider?.models.find((model) => model.slug === session.model)
?.supportedRuntimeModes,
}),
};
}).pipe(Effect.orElseSucceed(() => undefined)),
modelNameOf: (selection) =>
modelNameOf(selection).pipe(Effect.orElseSucceed(() => selection.model)),
});
const caller = requestService(McpRoomInvocation);
type Refused = { readonly outcome: "refused"; readonly detail: string };
/**
Expand Down Expand Up @@ -527,6 +580,14 @@ const RoomToolHandlersLive = RoomEndpointToolkit.toLayer(
changes("settings_change", (scope) => settingsChange(scope, input)),
secret_request: (input) => own("secret_request", (scope) => secretRequest(scope, input)),
alert_assistants: () => changes("alert_assistants", alertAssistants),
project_note_read: (input) =>
projectRead(
"project_note_read",
(scope) => projectNotes.project_note_read(scope, input),
(detail) => ({ outcome: "refused", detail }),
),
project_note_write: (input) =>
changes("project_note_write", (scope) => projectNotes.project_note_write(scope, input)),
// Listed only to runtimes granted it; a call from any other is refused
// too (a review runtime reads the checkout and nothing else). Refused
// while outside work limits the caller: it reads app-wide settings,
Expand Down
Loading
Loading