Answer: You define a context-clearing tool using defineTool with a name like "clear_context", a description, a prompt parameter, and isTerminal set to true (with defer set to "never"), whose handler calls session.rpc.history.clearContext({ prompt }). Status: Confirmed Entry: tool/github-copilot/memory-and-context/define-context-clearing-tool Revision: 2 Digest: sha256:0ef5c5e37ad93944 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:27:54Z Last changed: 2026-11-19T13:01:46Z (required parameter: — → prompt) Last verified: 2026-11-20T13:08:09Z Next check: 2026-11-21T13:08:09Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of tool definition function | defineTool | [1] | 2026-11-20 tool name | clear_context | [1] | 2026-11-20 isTerminal setting | true | [1] | 2026-11-20 defer setting | never | [1] | 2026-11-20 handler call | session. rpc . history . clearContext ({ prompt }) | [1] | 2026-11-20 required parameter | prompt | [1] | 2026-11-20 success event | session.context_cleared | [1] | 2026-11-20 Sources: [1] GitHub. "Context clearing and terminal tools - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-sdk/features/context-management Role: primary. Accessed: 2026-11-20T13:08:09Z Quote: "tools : [ defineTool ( "clear_context" ," (Supports: tool definition function) Quote: "defineTool ( "clear_context" ," (Supports: tool name) Quote: "isTerminal : true ," (Supports: isTerminal setting) Quote: "defer : "never" ," (Supports: defer setting) Quote: "await session. rpc . history . clearContext ({ prompt });" (Supports: handler call) Quote: "parameters : z. object ({ prompt : z. string () })," (Supports: required parameter) Quote: "A successful clear emits session.context_cleared with the number of removed messages and the initial message." (Supports: success event) Snapshot SHA-256: 9f4cd4eb70554c92a7841d40e2f120cbfcad563ed92aa423b31cea76ec17dc05 (captured 2026-11-18T13:03:13Z) 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:03:13Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:08:09Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:08:09Z Last attempt: 2026-11-20T13:08:09Z Notes and limitations: Extracted automatically from a single official source (section "Define a context-clearing tool"). Related: https://latestn.com/tool/github-copilot/memory-and-context/delete-memory How do I delete a memory in GitHub Copilot? https://latestn.com/tool/github-copilot/memory-and-context/disable-enable-copilot-memory How do I disable or enable Copilot Memory for my personal GitHub Copilot account? https://latestn.com/tool/github-copilot/memory-and-context/enable-copilot-dreaming-personal-memories How do I enable Copilot Dreaming for my personal memories in GitHub Copilot? https://latestn.com/tool/github-copilot/memory-and-context/custom-instruction-types-2 What types of custom instructions does GitHub Copilot CLI support? https://latestn.com/tool/github-copilot/memory-and-context/custom-instructions-examples Where can I find more examples of GitHub Copilot custom instructions for specific languages? https://latestn.com/tool/github-copilot/memory-and-context/custom-instructions-precedence Which custom instructions take precedence when personal, repository, and organization instructions conflict in GitHub Copilot? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-19T13:01:46Z | changed | required parameter: — → prompt | [1] 2026-11-19T13:01:46Z | changed | tool definition function: — → defineTool | [1] 2026-11-19T13:01:46Z | changed | description: Clear the conversation and start a fresh context window → — | [1] 2026-11-13T03:27:54Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/memory-and-context/define-context-clearing-tool/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/define-context-clearing-tool POST: https://latestn.com/dispute/tool/github-copilot/memory-and-context/define-context-clearing-tool with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/memory-and-context/define-context-clearing-tool?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I define a context-clearing tool in the GitHub Copilot SDK? Revision 2, last verified 2026-11-20T13:08:09Z. https://latestn.com/tool/github-copilot/memory-and-context/define-context-clearing-tool (accessed 2026-11-21T09:53:31Z). @misc{LatestN_tool_github_copilot_memory_and_context_define_context_clearing_tool_r2, title = {How do I define a context-clearing tool in the GitHub Copilot SDK?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/memory-and-context/define-context-clearing-tool}}, note = {Revision 2; digest sha256:0ef5c5e37ad93944; last verified 2026-11-20T13:08:09Z; accessed 2026-11-21T09:53:31Z} } 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/define-context-clearing-tool