feat: Copilot governance engine, VS Code extension, and recall parser#45
Open
bilersan wants to merge 4 commits intoActiveMemory:mainfrom
Open
feat: Copilot governance engine, VS Code extension, and recall parser#45bilersan wants to merge 4 commits intoActiveMemory:mainfrom
bilersan wants to merge 4 commits intoActiveMemory:mainfrom
Conversation
This was referenced Mar 17, 2026
- Case-insensitive path comparison on Windows for boundary validation - Extract osWindows constant for goconst compliance Closes ActiveMemory#30 Supersedes ActiveMemory#31 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
- CopilotParser implementing SessionParser interface with Matches() and ParseFile() - Platform-aware directory discovery for Code and Code Insiders - Typed Go structs for Copilot Chat JSONL format (snapshot+patch model) - Registration in parser.go and query scanning in query.go - ToolCopilot constant in config/session Closes ActiveMemory#28 Supersedes ActiveMemory#29 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
- VS Code extension with @ctx chat participant and slash commands - .vscode/mcp.json generation in init and hook paths - VS Code-specific context overrides (CONSTITUTION, CONVENTIONS, etc.) - Session event CLI command for VS Code lifecycle integration - Detection ring: terminal watcher for dangerous commands - Detection ring: file edit watcher for sensitive file patterns - Violation recording to .context/state/violations.json - Extension tests and init/hook integration tests Supersedes ActiveMemory#36 Signed-off-by: ersan bilik <ersanbilik@gmail.com>
- Governance checker (CheckGovernance) appends contextual warnings to every MCP tool response: session-not-started, context-not-loaded, drift-stale, persist-nudge, and violation escalation - Per-tool state recording: RecordSessionStart, RecordContextLoaded, RecordDriftCheck, RecordContextWrite, IncrementCallsSinceWrite - Violation reading from .context/state/violations.json with automatic cleanup after escalation (read-and-clear pattern) - Governance wired into route/tool dispatch with appendGovernance - RecordSessionStart called on session event handler - copilot-instructions.md template with governance rules and detection ring documentation - 24 governance tests covering all check paths and edge cases Signed-off-by: ersan bilik <ersanbilik@gmail.com>
9fa7a32 to
300d3a6
Compare
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
Three-layer governance architecture for VS Code Copilot that closes the governance gap with Claude Code hooks, plus Copilot Chat session parser and Windows compatibility fixes.
Resolves #44
Closes #28
Closes #30
Supersedes #29, #31, #36
Architecture
Layer 1: Behavioral Rules (
copilot-instructions.md)Preventive/advisory rules in the system prompt — session lifecycle, when to call tools, governance response handling.
Layer 2: MCP Governance-in-Response
CheckGovernance()appends contextual warnings to every MCP tool response:ctx_session_event(start)ctx_status()ctx_drift()ctx_add()Layer 3: VS Code Detection Ring
Extension monitors terminal commands and file edits:
rm -rf /,git push --force, etc.).env,.pem, credentials)Commits
ctx recallwith platform-aware JSONL parsingTesting