feat: add VS Code/Copilot integration for tool-agnostic sessions (fixes #7)#16
Open
bilersan wants to merge 7 commits intoActiveMemory:mainfrom
Open
feat: add VS Code/Copilot integration for tool-agnostic sessions (fixes #7)#16bilersan wants to merge 7 commits intoActiveMemory:mainfrom
bilersan wants to merge 7 commits intoActiveMemory:mainfrom
Conversation
Member
|
This is very much appreciated 🙏 Will check this out as soon as I can. Thanks for your contribution. |
Member
|
@bilersan there are minor linter issues; not a blocker, but would be cool if you can fix them before I jump in 🙏 . |
Add tool-agnostic session parser that reads structured Markdown files from .context/sessions/, enabling non-Claude tools (Copilot, Cursor, Windsurf) to participate in the recall/journal pipeline. Changes: - Add config constants: ToolClaudeCode, ToolMarkdown, DirSessions - Implement MarkdownSessionParser with support for multiple header formats (# Session: YYYY-MM-DD - Topic, etc.) - Register markdown parser alongside ClaudeCodeParser - Scan .context/sessions/ for markdown session files - Replace hardcoded 'claude-code' strings with config constants - Add comprehensive parser tests (390 lines) Refs: ActiveMemory#7 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
Add --write flag to 'ctx hook copilot' that generates .github/copilot-instructions.md directly instead of just printing the configuration snippet. The generated instructions teach Copilot Chat (agent mode) to: - Read .context/ files in priority order at session start - Persist session summaries to .context/sessions/ - Proactively update context files during work - Respond to memory queries with structured readbacks Also creates .context/sessions/ during ctx init so the session persistence workflow is ready out of the box for all tools. Refs: ActiveMemory#7 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
Add @ctx chat participant for VS Code Copilot Chat that wraps ctx CLI commands as slash commands. Users can type @ctx /init, @ctx /status, @ctx /drift, etc. directly in the Chat panel. Slash commands: - /init - Initialize .context/ + auto-generate copilot-instructions.md - /status - Show context summary with token estimate - /agent - Print AI-ready context packet - /drift - Detect stale or invalid context - /recall - Browse and search session history - /hook - Generate AI tool integration configs - /add - Add task, decision, or learning - /load - Output assembled context Markdown - /compact - Archive completed tasks - /sync - Reconcile context with codebase The extension executes the ctx binary and streams results back to chat. Includes CancellationToken support for aborting long-running calls, follow-up suggestions, and natural language routing. Also includes: - 11 colocated unit tests (vitest) - esbuild ^0.25.0 (resolves GHSA-67mh-4wv8-2f99) Refs: ActiveMemory#7 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
- Add VS Code Chat Participant section to integrations.md with build/install instructions and slash command reference - Document copilot --write flag in cli-reference.md - Add Copilot session persistence to first-session.md - Update getting-started.md with VS Code extension install steps - Fix vsix version reference (0.6.0 -> 0.7.0) Refs: ActiveMemory#7 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
- Add filepath.Clean for os.ReadFile in hook/run.go (gosec G304) - Export ToolConfigFiles var in hook/run.go (unused) - Add goconst nolint directives for trivial yes comparisons
Test files construct paths from test constants, not user input. This matches the goconst exclusion already in place.
c376022 to
a2ad811
Compare
Author
|
@josealekhine Linter issues are fixed! Here's what was done: Rebased on latest Lint fixes (3 new commits):
Verification:
Ready for review whenever you have time 🙏 |
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
Adds first-class VS Code and GitHub Copilot support to ctx, delivering the tool-agnostic session persistence pipeline proposed in #7.
This PR introduces three tightly coupled components that together enable Copilot Chat to read and write ctx sessions without requiring users to leave their editor.
What's Included
1. Tool-Agnostic Session Parser (internal/recall/parser/markdown.go)
MarkdownSessionParserthat reads.context/sessions/*.mdfiles# Session,##, YAML frontmatter)2. Copilot Hook + Init Updates (internal/cli/hook/,
internal/cli/initialize/)ctx hook copilot --writegenerates.github/copilot-instructions.mdwith ctx-aware system promptctx initnow creates.context/sessions/directory for session storagetoolConfigFilesmap for extensible tool config discovery3. VS Code Chat Participant Extension (
editors/vscode/)@ctxchat participant with 10 slash commands:/init,/load,/save,/status,/list,/search,/config,/help,/version,/recallWhat's Intentionally Excluded
This PR is scoped to VS Code and GitHub Copilot only. The following exist on the feature branch but are held back for separate PRs:
--toolflag onctx initTesting
go build ./...clean, all new parser and hook tests passnpm run buildclean (7.6 KB), 11/11 vitest tests pass,npm audit0 vulnerabilitiesConnects To
Issue #7 — specifically the proposed architecture of
ctx hook <tool> --writegenerating tool-specific instruction files, with editor extensions acting as the bridge between the tool's chat interface and ctx's session storage.