Define deterministic rules for when agents should use local search, external fetch, or MCP-backed documentation tools.
| Condition | Tool | Priority |
|---|---|---|
| File content, code structure, project config | Local search/read tools | ALWAYS first |
| GitHub issues, PRs, repo context | web/githubRepo |
When task references external repo context |
| Third-party library behavior, API docs | web/fetch or Context7 |
When local search insufficient |
| Framework best practices, current versions | Context7 (resolve-library-id -> get-library-docs) |
When planning depends on third-party behavior |
| General web research | web/fetch |
Only when no structured source available |
Always search the local codebase before using any external tool. External sources supplement, not replace, local evidence.
External documentation lookup is mandatory before finalizing output when:
- The task involves a third-party library/framework not already documented in the codebase.
- The plan depends on API behavior that cannot be verified from local code alone.
- The user explicitly references an external resource, standard, or specification.
When Planner has Context7 tools granted:
- If the plan involves a third-party library: call
resolve-library-idfirst. - If library ID resolves: call
get-library-docsto fetch current documentation. - Use fetched docs to validate plan assumptions before finalizing phases.
- If library ID does not resolve: fall back to
web/fetchorweb/githubRepo.
If a tool is listed in an agent's YAML frontmatter tools: array, the agent's body instructions MUST include routing rules for that tool. A tool that appears only in frontmatter with no body reference is a compliance gap.
Prefer least-privilege grants: do not grant tools solely for speculative future use. Frontmatter should expose the minimum tool surface needed by the current role contract and body instructions.
| Agent | fetch | githubRepo | Context7 | Notes |
|---|---|---|---|---|
| Orchestrator | yes | yes | no | Orchestration; delegates research |
| Planner | yes | yes | yes | Planning; use Context7 for library docs |
| Researcher | yes | no | no | Deep research; fetch for evidence |
| CodeMapper | no | no | no | Read-only local discovery |
| CodeReviewer | no | no | no | Verification only; final review uses injected prior_phase_findings[] for novelty filtering |
| PlanAuditor | no | no | no | Read-only plan audit; local codebase cross-reference only |
| CoreImplementer | yes | yes | no | Implementation; fetch for API reference |
| UIImplementer | yes | yes | no | Implementation; fetch for component docs |
| PlatformEngineer | yes | yes | no | Infrastructure; fetch for provider docs |
| TechnicalWriter | yes | no | no | Documentation; fetch for external refs |
| BrowserTester | yes | no | no | Testing; fetch for health checks, URL verification, and test framework docs |
| AssumptionVerifier | no | no | no | Read-only local mirage detection |
| ExecutabilityVerifier | no | no | no | Read-only local executability simulation |
Tool outputs exceeding in-context thresholds should be spilled to the directory declared by tool_output_policy.spill_directory_template in governance/runtime-policy.json, keeping only the path + summary in the agent context. See MEMORY-ARCHITECTURE.md L4. Orchestrator performs a whole-directory purge of this cache at the Completion Gate.
- BrowserTester is script/harness-based. It may run provided executable browser test scripts or harnesses through its command/task grants, but it must return
ABSTAINwhen no executable browser test harness or script is supplied. It must not claim direct browser-session control unsupported by the provided harness. - CodeReviewer final review must use Orchestrator-injected
prior_phase_findings[]for novelty filtering. It must not self-source prior phase plans or artifacts fromplans/artifacts/to decide whether a finding is new.
Agent resource paths are workspace-relative by default. When a file listed in an agent's ## Resources section is not found in the active workspace root:
- Retry the read using the absolute prefix
{{VSCODE_USER_PROMPTS_FOLDER}}/— e.g.{{VSCODE_USER_PROMPTS_FOLDER}}/governance/model-routing.json. - If still not found, log the missing path in the gate event and continue with
confidencereduced by 0.1 per missing critical file. - Never fabricate file contents. Never silently proceed as if a missing governance file contained default values.
- Applies to:
governance/,schemas/,plans/project-context.md,docs/agent-engineering/,skills/— any path referenced in a## Resourcessection of any agent file.
This rule resolves the gap when agents are loaded as global prompts (from User/prompts/) but the active workspace does not contain the ControlFlow governance tree. It is intentionally duplicated in .github/copilot-instructions.md so the fallback is available before this file itself can be loaded.
Cursor IDE support is a documentation and rules surface only (.cursor/rules/*.mdc). It does not:
- Add new entries to
governance/tool-grants.jsonorgovernance/agent-grants.json. - Grant Cursor access to VS Code-specific capabilities such as
agent/runSubagent. - Require new model-routing roles or executor agents.
When updating .cursor/rules/*.mdc files, agents must verify the change against official Cursor documentation (https://cursor.com/docs/rules) before editing frontmatter activation fields (alwaysApply, globs, description). Local-first rule (Rule 1) still applies — search the codebase before consulting external Cursor docs. The authoritative governance document for Cursor support is docs/agent-engineering/CURSOR-SUPPORT.md.