chore(agents): enforce Codebase Memory preflight in discovery agents - #105
Merged
Conversation
Add Codebase Memory preflight protocol to explore, architect, debugger, and tracer agents. Update delegation routing and tool-priority policy to require index_status/search_graph before Grep/Glob for non-trivial codebase discovery. This prevents subagents from bypassing the graph when the orchestrator delegates discovery tasks. Constraint: subagent prompts start fresh; system-reminder rules do not propagate. Agent prompt must contain explicit preflight instructions. Rejected: duplicating full protocol into all agent files — kept canonical definition in tool-priority.md, concise references in debugger/tracer. Directive: orchestrator must either preflight discovery itself or include explicit Codebase Memory instructions in delegation prompt. Confidence: high Scope-risk: narrow Not-tested: agent prompt loading validation requires manual review Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add Mandatory Codebase Discovery Preflight to CLAUDE.md with explicit ToolSearch step, MUST keyword, and prohibition on git-status-as-discovery. Add observable action barrier to tool-priority.md: reasoning is not enough, the next discovery tool call must actually be Codebase Memory. Directive: orchestrator must not start first-pass discovery with Bash/Glob/Grep/Read; subagent prompts must contain explicit preflight. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
Author
|
This PR enforces Codebase Memory preflight for both orchestrator-level discovery |
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
This PR fixes a gap where subagents delegated for codebase discovery (e.g.
explore) would start withGlob/Grepinstead ofCodebase Memory, because agent prompts start fresh and do not inherit orchestrator system-reminders.Changes
Codebase Discovery Protocolsection and listed Codebase Memory tools as primary in the tool list.Glob/Grep/Readin investigation protocol.Analysisrouting row to includeCodebase Memoryas primary and addedarchitect.Codebase Discoveryrule as repo-wide guidance.Rationale
exploreagent was explicitly instructing itself toLaunch 3+ parallel searches (Grep vs Glob)on first action, overriding the global policy.tool-priority.mdand adding concise references in individual agents avoids DRY violations.Test plan
exploreagent prompt loads correctly in next delegation.Glob/Grepused for first-pass discovery when index is available.Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com