Context is everything. When coding agents have access to your complete codebase through Sourcegraph MCP, they understand dependencies, follow existing patterns, and deliver production-ready solutions. Without proper context, agents make assumptions that break downstream systems and create technical debt.
Context changes everything
See how coding agents with Sourcegraph MCP deliver complete solutions vs. incomplete fixes.
Read models/user.go
I'll add a Role field to the User struct and update the store methods.|
Edit models/user.go — added Role string field
Edit database/user_store.go — updated Create/Update
Done! I've added:
- Role field to the User struct
- Updated Create and Update to persist the role
- Added a GetByRole query method
You'll want to add a migration for the new column and update your auth checks.
What the agent missed
Auth middleware — no role check, any user can access admin routes
API response DTO — role never returned to clients
Audit logging — role changes not tracked, no compliance trail
/admin frontend routes — no guard, UI still accessible to all
Invite flow — new users created without a default role
4 integration tests — assert on user shape, will break
sg_keyword_search "User struct" across 2,847 repositories
Found 31 files referencing User across 7 layers
models/user.go
middleware/auth.go
api/dto/user_response.go
routes/admin/guard.ts
+27 more files
This is a cross-cutting change. Here's my plan:|
Plan 8 steps
Edit 12 files across 7 layers
Complete. All layers updated, tests passing. Full diff ready for review.|
Nothing missed
Auth middleware API response DTO Audit logging Frontend routes Invite flow Integration tests