Answer: You add project context by defining an onUserPromptSubmitted hook in the session's hooks that returns an additionalContext string, as shown in the example where projectInfo name, language, and framework are included. Status: Confirmed Entry: tool/github-copilot/memory-and-context/add-context-via-hook Revision: 2 Digest: sha256:3bf01b1062c94534 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:28:39Z Last changed: 2026-11-16T12:53:09Z (context source: — → getProjectInfo) Last verified: 2026-11-20T13:09:11Z Next check: 2026-11-21T13:09:11Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of hook name | onUserPromptSubmitted | [1] | 2026-11-20 returned field | additionalContext | [1] | 2026-11-20 context source | getProjectInfo | [1] | 2026-11-20 Sources: [1] GitHub. "User prompt submitted hook - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-sdk/hooks/user-prompt-submitted Role: primary. Accessed: 2026-11-20T13:09:11Z Quote: "onUserPromptSubmitted : async (input) =>" (Supports: hook name) Quote: "return { additionalContext : ` Project: ${projectInfo.name} Language: ${projectInfo.language} Framework: ${projectInfo.framework} ` . trim (), };" (Supports: returned field) Quote: "const projectInfo = await getProjectInfo ();" (Supports: context source) Snapshot SHA-256: 758bcb5515c6532a256f90821442e9c18a0c0c9c71908f0c34ebf2a90640f294 (captured 2026-11-18T13:04:22Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T13:04:25Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:09:11Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:09:11Z Last attempt: 2026-11-20T13:09:11Z Notes and limitations: Extracted automatically from a single official source (section "Add project context"). Related: https://latestn.com/tool/github-copilot/memory-and-context/add-custom-instructions How do I add custom instructions for GitHub Copilot CLI? https://latestn.com/tool/github-copilot/memory-and-context/add-custom-instructions-2 How do I add custom instructions for GitHub Copilot? https://latestn.com/tool/github-copilot/memory-and-context/add-personal-custom-instructions How do I add personal custom instructions for GitHub Copilot? https://latestn.com/tool/github-copilot/memory-and-context/about-personal-custom-instructions What are personal custom instructions in GitHub Copilot Chat and how do they work? https://latestn.com/tool/github-copilot/memory-and-context/access-space-context-in-ide How do I access Copilot Spaces context from my IDE? https://latestn.com/tool/github-copilot/memory-and-context/add-context-to-space How do I add context to a GitHub Copilot Space? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-16T12:53:09Z | changed | context source: — → getProjectInfo | [1] 2026-11-16T12:53:09Z | changed | returned field: — → additionalContext | [1] 2026-11-16T12:53:09Z | changed | hook name: — → onUserPromptSubmitted | [1] 2026-11-16T12:53:09Z | changed | Session creation call: client. createSession ({ hooks : { → — | [1] 2026-11-16T12:53:09Z | changed | Context contents: Project: ${projectInfo.name} Language: ${projectInfo.language} Framework: ${projectInfo.framework} → — | [1] 2026-11-16T12:53:09Z | changed | Returned field: additionalContext → — | [1] 2026-11-16T12:53:09Z | changed | Hook name: onUserPromptSubmitted → — | [1] 2026-11-13T03:28:39Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/memory-and-context/add-context-via-hook/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/memory-and-context/add-context-via-hook POST: https://latestn.com/dispute/tool/github-copilot/memory-and-context/add-context-via-hook with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/memory-and-context/add-context-via-hook?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I add project context or user preferences to prompts using the GitHub Copilot SDK user prompt submitted hook? Revision 2, last verified 2026-11-20T13:09:11Z. https://latestn.com/tool/github-copilot/memory-and-context/add-context-via-hook (accessed 2026-11-21T09:54:27Z). @misc{LatestN_tool_github_copilot_memory_and_context_add_context_via_hook_r2, title = {How do I add project context or user preferences to prompts using the GitHub Copilot SDK user prompt submitted hook?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/memory-and-context/add-context-via-hook}}, note = {Revision 2; digest sha256:3bf01b1062c94534; last verified 2026-11-20T13:09:11Z; accessed 2026-11-21T09:54:27Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/memory-and-context/add-context-via-hook