feat(copilot-cli): add GitHub Copilot CLI hooks integration#2742
Open
ScottGuymer wants to merge 1 commit into
Open
feat(copilot-cli): add GitHub Copilot CLI hooks integration#2742ScottGuymer wants to merge 1 commit into
ScottGuymer wants to merge 1 commit into
Conversation
Add hindsight-integrations/copilot-cli/, giving GitHub Copilot CLI persistent long-term memory via Hindsight hooks (see docs.github.com/en/ copilot/how-tos/copilot-cli/customize-copilot/use-hooks). Modeled on the existing cursor-cli integration. Hooks: - sessionStart: recall using initialPrompt (or a cwd-derived fallback query), injects additionalContext - subagentStart: recall for every subagent Copilot CLI spawns (explore, task, research, code-review, rubber-duck, security-review, and custom agents, not the built-in general-purpose agent, which never fires this hook). Subagent payloads carry no per-invocation task text, so this always uses the fallback query. - agentStop: reads the transcript, retains to Hindsight on a configurable turn cadence, caches the transcript path for sessionEnd - sessionEnd: forces a final retain using the transcript path cached from the last agentStop, since sessionEnd's own payload has no transcript path field Install via pip install hindsight-copilot-cli, then hindsight-copilot-cli install (user scope, writes ~/.copilot/hooks/hindsight-copilot-cli.json) or --scope repo for a team-shared .github/hooks/ registration. Zero runtime dependencies, hook scripts are pure stdlib Python. Also wires up CI (test-copilot-cli-integration job), release-integration.sh and generate_changelog.py registration, and docs gallery/sidebar entry. Closes vectorize-io#1588
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1588 — a new
hindsight-integrations/copilot-cli/package giving GitHub Copilot CLI persistent long-term memory via Hindsight hooks, modeled on the existinghindsight-integrations/cursor-cli/package.Hooks
session_start.pysessionStartinitialPrompt(or a project-context fallback query), inject asadditionalContextsubagent_start.pysubagentStartexplore,task,research,code-review,rubber-duck,security-review, custom agents — not the built-ingeneral-purposeagent, which never fires this hook) gets baseline project memory. Subagent payloads carry no per-invocation task text, so this always uses the fallback query.agent_stop.pyagentStopretainEveryNTurnscadence, POSTs to Hindsight (async); caches the transcript path forsessionEndsession_end.pysessionEndagentStop, sincesessionEnd's payload has no transcript path field of its ownPer-turn recall refresh (
userPromptSubmitted/preToolUse) was deliberately skipped — those hooks don't support context injection per the official docs.Installation
Also supports
--scope repofor a team-shared.github/hooks/hindsight-copilot-cli.jsonregistration (script install is still per-machine).Testing
uv build && uv sync --frozen && uv run pytest tests -vall green (mirrors the new CI job).ruff check/ruff format --checkclean against the shared reporuff.toml.sessionStart,subagentStart,agentStop,sessionEnd.Other changes
.github/workflows/test.yml— newtest-copilot-cli-integrationjob + path filters, mirroringtest-cursor-cli-integration.scripts/release-integration.sh/hindsight-dev/hindsight_dev/generate_changelog.py— registeredcopilot-clifor the release/changelog tooling.hindsight-docs/src/data/integrations.json+hindsight-docs/docs-integrations/copilot-cli.md— gallery/sidebar entry and docs page (passescheck-integrations.mjs).hindsight-integrations/README.md— added a row for Copilot CLI, clarified the existing GitHub Copilot row is VS Code-specific.Notes / known limitations
cursor-cli/claude-code— no live Copilot CLI transcript was available to validate the exact wire format against. Flagged in code comments and the README.uninstall's cleanup of the shared script directory uses an imperfect cwd-based heuristic to detect whether the other install scope is still registered — documented as an accepted v1 limitation (matches an equivalent limitation incursor-cli).Closes #1588