Skip to content

Support PreCompact hook#293581

Merged
roblourens merged 3 commits intomainfrom
roblou/xenial-mouse
Feb 7, 2026
Merged

Support PreCompact hook#293581
roblourens merged 3 commits intomainfrom
roblou/xenial-mouse

Conversation

@roblourens
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 7, 2026 04:06
@roblourens roblourens enabled auto-merge (squash) February 7, 2026 04:06
@roblourens roblourens self-assigned this Feb 7, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new PreCompact hook type to the chat prompt-syntax hooks system so it can be configured in hooks.json, displayed/validated via schema metadata, and parsed/collected from supported hook file formats.

Changes:

  • Extend HookType/HOOK_TYPES/IChatRequestHooks and JSON schema to include PreCompact.
  • Add Claude compatibility mapping for PreCompact.
  • Ensure parsed hooks collection in PromptsService initializes storage for PreCompact.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts Initializes the per-hook-type collection map with a PreCompact bucket so parsed hooks can be retained.
src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts Defines the new hook type and exposes it via metadata + schema so it can be authored/validated.
src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.ts Maps Claude’s PreCompact hook identifier to the new HookType.PreCompact.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts:25

  • parseCopilotHooks supports Copilot CLI-style camelCase hook ids via resolveCopilotCliHookType(...), but hookCopilotCliCompat.ts does not map a preCompact id to HookType.PreCompact. That means a hooks.json authored in Copilot CLI format using preCompact will be silently ignored; consider adding the missing mapping so PreCompact works across supported formats.
	PreCompact = 'PreCompact',
	SubagentStart = 'SubagentStart',
	SubagentStop = 'SubagentStop',
	Stop = 'Stop',

@roblourens roblourens merged commit 0204a85 into main Feb 7, 2026
18 checks passed
@roblourens roblourens deleted the roblou/xenial-mouse branch February 7, 2026 05:38
daviddossett pushed a commit to daviddossett/vscode that referenced this pull request Feb 7, 2026
* Support PreCompact hook

* add this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants