Add path-scoped Copilot instructions for context/ and routing/#146
Merged
Add path-scoped Copilot instructions for context/ and routing/#146
Conversation
Co-authored-by: dgenio <12731907+dgenio@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add path-scoped Copilot instructions for context and routing subsystems
Add path-scoped Copilot instructions for context/ and routing/
Mar 9, 2026
There was a problem hiding this comment.
Pull request overview
Adds path-scoped Copilot instruction files to provide subsystem-specific invariants and editing guidance for the context engine and routing engine directories.
Changes:
- Introduces
.github/instructions/context.instructions.mdscoped tosrc/contextweaver/context/**with pipeline/firewall/sensitivity guidance. - Introduces
.github/instructions/routing.instructions.mdscoped tosrc/contextweaver/routing/**with ChoiceGraph/TreeBuilder/Router/Catalog invariants and determinism rules.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/instructions/context.instructions.md | Adds context-engine pipeline ordering and firewall/sensitivity invariants for agents editing src/contextweaver/context/**. |
| .github/instructions/routing.instructions.md | Adds routing-engine graph validation + determinism + catalog/card constraints for agents editing src/contextweaver/routing/**. |
You can also share your feedback on Copilot code review. Take the survey.
Stage 5 in context.instructions.md incorrectly described scoring as 'TF-IDF relevance scoring'. The actual implementation in scoring.py uses recency + Jaccard token overlap + kind priority + token penalty. Addresses review comment on PR #146.
…ctions _build() is the synchronous core; both build() (async) and build_sync() delegate directly to it. There is no asyncio.run() wrapper. Updated the async-first pattern section to match the actual implementation. Addresses review comment on PR #146.
The _ensure_index() filter is 'node_id not in self._items', which selects non-item nodes (navigation/structural), not non-leaf nodes. A navigation node can be a leaf, so 'non-leaf' was imprecise. Addresses review comment on PR #146.
Both _build() and _build_call_prompt() follow the same sync-core / async-wrapper / sync-wrapper delegation pattern. Added a bullet so agents editing call-prompt methods see the pattern applies there too. Addresses nit review comment on PR #146.
Adds an entry under [Unreleased] / ### Added for the new context/ and routing/ instruction files. Addresses PR #146 checklist item.
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
The two largest subsystems — context engine (11 modules) and routing engine (9 modules) — lacked agent-facing guidance scoped to their directories. Agents editing
manager.pyorgraph.pyhad no subsystem-specific invariants to follow, risking broken pipeline ordering, firewall bypasses, or invalid graph states.Changes
.github/instructions/context.instructions.md(applyTo: src/contextweaver/context/**)tool_resulttext never reaches prompt; artifact handle format;artifact_refalways populatedmanager.pyflagged at ~876 lines with decomposition refs ([refactor] Decompose context/manager.py to meet ≤300-line module guideline #73, [context] Extract manager.py to stay within 300-line module limit #69); discourages new methods until decomposedsensitivity.instructions.md.github/instructions/routing.instructions.md(applyTo: src/contextweaver/routing/**)ChoiceGraph._validate()invariants documented (root exists, children resolve, no cycles, all items reachable)add_edge()— must not be bypassedTreeBuilder3-strategy priority order (namespace → Jaccard clustering → alphabetical) with fallback conditions(-score, id)sort key must not change;confidence_gapboundsgenerate_sample_catalogseed=42 is a contract — demos and tests depend on itChoiceCardschema prohibition; sync-only routing; no cross-engine importsBoth files are ≤100 lines, documentation-only, and grounded in actual code.
Checklist
make cipasses locally (fmt + lint + type + test + example + demo)CHANGELOG.mdupdated under## [Unreleased]Notes for reviewers
Instruction files are loaded automatically by VS Code Copilot when editing files under the targeted paths — no tooling changes required. Content is derived directly from
manager.pydocstring,graph.py._validate(),router.py.route(),tree.py.build(), andcatalog.py.generate_sample_catalog()— reviewers should cross-check those sources if any rule seems off.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.