Skip to content

chore(agents): enforce Codebase Memory preflight in discovery agents - #105

Merged
LimiNode merged 2 commits into
mainfrom
fix/agent-codebase-discovery-preflight
May 22, 2026
Merged

chore(agents): enforce Codebase Memory preflight in discovery agents#105
LimiNode merged 2 commits into
mainfrom
fix/agent-codebase-discovery-preflight

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

This PR fixes a gap where subagents delegated for codebase discovery (e.g. explore) would start with Glob/Grep instead of Codebase Memory, because agent prompts start fresh and do not inherit orchestrator system-reminders.

Changes

  • explore.md: Added mandatory Codebase Discovery Protocol section and listed Codebase Memory tools as primary in the tool list.
  • architect.md: Added Codebase Memory preflight before Glob/Grep/Read in investigation protocol.
  • debugger.md, tracer.md: Added conditional Codebase Memory preflight for call-chain / cross-file tracing.
  • delegation.md: Updated Analysis routing row to include Codebase Memory as primary and added architect.
  • tool-priority.md: Added explicit subagent policy — subagents must not assume orchestrator has already indexed; delegation prompt must either include preflight instructions or provide verified results.
  • AGENTS.md: Added top-level Codebase Discovery rule as repo-wide guidance.

Rationale

  • Orchestrator system-reminders do not propagate into subagent prompts.
  • explore agent was explicitly instructing itself to Launch 3+ parallel searches (Grep vs Glob) on first action, overriding the global policy.
  • Centralizing the full protocol in tool-priority.md and adding concise references in individual agents avoids DRY violations.

Test plan

  • Verify explore agent prompt loads correctly in next delegation.
  • Verify no Glob/Grep used for first-pass discovery when index is available.

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

LimiNode and others added 2 commits May 22, 2026 03:02
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>
@LimiNode

Copy link
Copy Markdown
Owner Author

This PR enforces Codebase Memory preflight for both orchestrator-level discovery
and delegated subagent discovery.

@LimiNode
LimiNode merged commit a886724 into main May 22, 2026
12 checks passed
@LimiNode
LimiNode deleted the fix/agent-codebase-discovery-preflight branch June 3, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant