feat(project.identify): setupHint when key wasn't read from the file

When Claude calls project.identify with `source` ∈ {explicit, header,
inferred, undefined}, the response now includes a `setupHint` field
with a short message + a copy-pasteable command to create the
`.shared-memory-project` file. When `source: 'file'` is passed,
no hint is emitted (the user already has the file).

Hint only fires on owned-project responses — you can't ask a viewer of
a shared project to commit to a repo they don't own.

Tool description tells Claude: "Pass `source` based on how you
resolved the key. If the response carries a setupHint, briefly relay
its message and command to the user." This gives us a one-prompt
nudge per session without auto-creating files or being pushy — the
user decides.

ProjectIdentifyInput in @shared-memory/schemas gains an optional
`source: 'file' | 'explicit' | 'header' | 'inferred'` field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 09:24:11 -07:00
co-authored by Claude Opus 4.7
parent b6e28b329d
commit f769daa48a
2 changed files with 42 additions and 1 deletions
+12
View File
@@ -105,6 +105,18 @@ export type MemorySearchInput = z.infer<typeof MemorySearchInput>;
export const ProjectIdentifyInput = z.object({
key: ProjectKey,
display_name: z.string().min(1).max(200).optional(),
/**
* How the caller resolved this project key. The server uses this to
* decide whether to include a `setupHint` in the response suggesting
* the user commit a `.shared-memory-project` file:
* - 'file' — already from .shared-memory-project; no hint needed
* - 'explicit' — user named the project in-conversation; hint shown
* - 'header' — X-Project-Key fallback; hint shown
* - 'inferred' — guessed from repo/cwd; hint shown
*
* Omitting the field is treated as 'inferred'.
*/
source: z.enum(["file", "explicit", "header", "inferred"]).optional(),
});
export type ProjectIdentifyInput = z.infer<typeof ProjectIdentifyInput>;