-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
465 lines (422 loc) · 23 KB
/
index.html
File metadata and controls
465 lines (422 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Context for AI Agents | Why Retrieval Prevents Failure</title>
<meta name="description" content="A microsite about getting the right context into agents, workflows, and automation tools so they stop failing, with Sourcegraph MCP as one concrete implementation.">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23ffe0a3'/%3E%3Cstop offset='100%25' stop-color='%2369d9d0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='64' height='64' rx='18' fill='%23040506'/%3E%3Ccircle cx='32' cy='32' r='16' fill='url(%23g)'/%3E%3Ccircle cx='27' cy='26' r='5' fill='white' fill-opacity='.9'/%3E%3C/svg%3E">
<link rel="preconnect" href="https://cdn.prod.website-files.com" crossorigin>
<link rel="stylesheet" href="./assets/site.css">
</head>
<body class="landing-page">
<div class="page-progress" aria-hidden="true"></div>
<div class="site-utility">
<nav class="utility-group" aria-label="Primary">
<a class="utility-link utility-link-brand" href="#top" aria-current="page">
<span class="brand-text">Codebase Context</span>
</a>
<a class="utility-link" href="./context-problem.html">Software Factory</a>
<a class="utility-link" href="./mcp-guide.html">Sourcegraph MCP</a>
</nav>
</div>
<aside class="chapter-rail is-gated-hidden" aria-label="Page chapters" data-chapter-gate="context-problem">
<span class="chapter-kicker">Chapters</span>
<a class="chapter-link is-active" href="#context-problem" data-chapter-target="context-problem" aria-current="location">
<span class="chapter-dot" aria-hidden="true"></span>
<span class="chapter-copy">
<span class="chapter-index">01</span>
<span class="chapter-title">Context Problem</span>
</span>
</a>
<a class="chapter-link" href="#agent-loop" data-chapter-target="agent-loop">
<span class="chapter-dot" aria-hidden="true"></span>
<span class="chapter-copy">
<span class="chapter-index">02</span>
<span class="chapter-title">Agent Loop</span>
</span>
</a>
<a class="chapter-link" href="#how-mcp-works" data-chapter-target="how-mcp-works">
<span class="chapter-dot" aria-hidden="true"></span>
<span class="chapter-copy">
<span class="chapter-index">03</span>
<span class="chapter-title">How MCP Works</span>
</span>
</a>
<a class="chapter-link" href="#use-cases" data-chapter-target="use-cases">
<span class="chapter-dot" aria-hidden="true"></span>
<span class="chapter-copy">
<span class="chapter-index">04</span>
<span class="chapter-title">Use Cases</span>
</span>
</a>
</aside>
<main id="top">
<section class="hero" aria-labelledby="heroTitle">
<div class="hero-stage" id="heroScene" aria-hidden="true">
<div class="scene-backdrop"></div>
<div class="scan-halo"></div>
</div>
<div class="container hero-layout">
<div class="hero-copy reveal">
<span class="f-kicker">Context for Agents, Workflows, and Automation</span>
<p class="hero-statement" id="heroTitle">
<span>Narrow context creates fast, confident, <span class="text-wrong">wrong</span> answers.</span>
</p>
<p class="hero-support">
Agents, workflows, and automation tools break for the same reason: they act from a partial view. Give them the right context, and the failure rate drops fast.
</p>
<p class="hero-credit">Ajay Sridhar and Stephanie Jarmak.</p>
</div>
<div class="hero-demo" aria-hidden="true">
<div class="hero-sourcegraph-grid"></div>
<div class="hero-sourcegraph-orbit hero-sourcegraph-orbit-a"></div>
<div class="hero-sourcegraph-orbit hero-sourcegraph-orbit-b"></div>
<div class="hero-sourcegraph-orbit hero-sourcegraph-orbit-c"></div>
<div class="hero-sourcegraph-copy">
<img class="hero-sourcegraph-logo" src="./assets/sourcegraph.svg" alt="Sourcegraph">
</div>
</div>
<div class="hero-scroll-action">
<a class="scroll-cue" id="heroCta" href="#context-problem">
<span class="scroll-cue-text">See failure pattern</span>
<span class="scroll-cue-icon" aria-hidden="true">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none">
<path d="M11 4v14M4 11l7 7 7-7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
</a>
</div>
</div>
</section>
<section class="section problem-section" id="context-problem">
<div class="container">
<div class="section-heading reveal">
<span class="f-kicker">The Context Problem</span>
<h2 class="section-title section-title-small">Same prompt. Two agents.</h2>
<p class="section-copy">Pick a use case and see the difference.</p>
</div>
<div class="question-bar reveal">
<button class="question-pill is-active" type="button" data-question-index="0">
<span class="question-pill-title">Understand Existing Code</span>
<span class="question-pill-meta">microsoft/vscode · behavioral search</span>
</button>
<button class="question-pill" type="button" data-question-index="1">
<span class="question-pill-title">Consistency and Quality</span>
<span class="question-pill-meta">apache/flink · deprecation audit</span>
</button>
<button class="question-pill" type="button" data-question-index="2">
<span class="question-pill-title">Investigate an Incident</span>
<span class="question-pill-meta">grafana/grafana · trace migration bug</span>
</button>
<button class="question-pill" type="button" data-question-index="3">
<span class="question-pill-title">Security Audit</span>
<span class="question-pill-meta">apache/kafka · ACL authorization</span>
</button>
</div>
<div class="contrast-stage reveal" id="problemDemo">
<div class="problem-prompt">
<div class="console-query problem-prompt-query">
<span class="prompt prompt-shared" aria-hidden="true">❯</span>
<span id="problemQuery">A function in microsoft/vscode implements a three-way merge algorithm for Settings Sync that reconciles local, remote, and base versions, producing four sets: added, removed, updated, and conflicts. Identify the function and the file it lives in.</span>
</div>
</div>
<div class="problem-compare-grid">
<article class="contrast-column">
<p class="contrast-label">AI without context</p>
<div class="console-view">
<div class="console-response">
<p id="withoutResponse"></p>
</div>
<div class="confidence">
<div class="confidence-meta">
<span>confidence meter</span>
<strong id="withoutConfidence">0%</strong>
</div>
<div class="confidence-bar">
<div class="confidence-fill blind" id="withoutConfidenceFill"></div>
</div>
</div>
</div>
</article>
<div class="contrast-divider" aria-hidden="true">
<span>Context arrives</span>
</div>
<article class="contrast-column contrast-column-lit">
<p class="contrast-label">AI with retrieved context from Sourcegraph</p>
<div class="console-view console-view-lit">
<div class="console-response">
<div class="log-stream" id="contextLogs"></div>
<p id="withResponse"></p>
</div>
<div class="confidence">
<div class="confidence-meta">
<span>confidence meter</span>
<strong id="withConfidence">0%</strong>
</div>
<div class="confidence-bar">
<div class="confidence-fill lit" id="withConfidenceFill"></div>
</div>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
<div class="section-anchor" id="inside-outside-loop" aria-hidden="true"></div>
<section class="section loop-section" id="agent-loop">
<div class="container">
<div class="loop-layout">
<div class="loop-visual reveal">
<span class="f-kicker loop-eyebrow">Agent Loop</span>
<article class="loop-shell" id="loopShell">
<canvas class="loop-canvas" id="loopCanvas" aria-hidden="true"></canvas>
<div class="loop-core">
<p class="loop-stage-title" id="loopStageTitle">Plan</p>
<p class="loop-stage-description" id="loopStageDescription">The agent interprets the task and identifies what context is missing.</p>
</div>
<button class="loop-point active" type="button" data-angle="-90" data-title="Plan" data-description="The agent interprets the task and identifies what context is missing before it starts editing or answering.">
<strong>Plan</strong>
</button>
<button class="loop-point" type="button" data-angle="0" data-title="Discover" data-description="The agent finds and pulls the evidence it needs from files, local history, and tools.">
<strong>Discover</strong>
</button>
<button class="loop-point" type="button" data-angle="90" data-title="Reason" data-description="The agent synthesizes that context, decides what to do, and checks for constraints or risks.">
<strong>Reason</strong>
</button>
<button class="loop-point" type="button" data-angle="180" data-title="Act" data-description="The agent produces the output: an answer, code change, workflow step, or automation action grounded in the context it found.">
<strong>Act</strong>
</button>
</article>
</div>
<div class="section-heading reveal">
<h2 class="section-title section-title-small statement-title">How Agents Gather Context</h2>
<p class="section-copy">
This is not a linear sequence. An agent may plan, retrieve, synthesize, and then return to retrieval several times before acting. The quality of each cycle depends on the context surface available — and retrieval is where most agents fall short.
</p>
</div>
</div>
</div>
</section>
<section class="section loop-mcp-section" id="loop-with-mcp">
<div class="container">
<div class="loop-layout loop-layout-mcp">
<div class="section-heading reveal">
<h2 class="section-title section-title-small statement-title">The agentic loop with Sourcegraph</h2>
<p class="section-copy">
Agents retrieve the correct context before reasoning begins: exact files, definitions, references, and history on demand, so the agent acts on full context, not just a partial picture.
</p>
</div>
<div class="loop-visual reveal">
<div class="loop-compare">
<div class="loop-compare-col loop-compare-col-lit">
<div class="loop-flow">
<div class="loop-flow-node">Plan</div>
<div class="loop-flow-connector loop-flow-connector-lit" aria-hidden="true"></div>
<div class="loop-flow-node">Discover</div>
<div class="loop-flow-connector loop-flow-connector-lit" aria-hidden="true"></div>
<div class="loop-flow-node loop-flow-node-retrieve">Retrieve</div>
<div class="loop-flow-connector loop-flow-connector-lit" aria-hidden="true"></div>
<div class="loop-flow-node">Reason</div>
<div class="loop-flow-connector loop-flow-connector-lit" aria-hidden="true"></div>
<div class="loop-flow-node">Act</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="section protocol-section" id="how-mcp-works">
<div class="container">
<div class="section-heading reveal">
<span class="f-kicker">How MCP Works</span>
<h2 class="section-title statement-title">An open protocol for pulling context on demand.</h2>
<p class="section-copy">
Model Context Protocol (MCP) gives agents a standard way to retrieve information beyond their context window - search indexes, code intelligence, history and etc — on demand.
</p>
</div>
<div class="protocol-stage reveal" data-tab-group>
<div class="protocol-rail" id="protocolRail" aria-label="Agent to codebase flow">
<button class="protocol-node is-active" type="button" data-node-index="0">
<span class="protocol-node-title">Agent</span>
<span class="protocol-node-copy">plans what to ask</span>
</button>
<button class="protocol-node" type="button" data-node-index="1">
<span class="protocol-node-title">MCP Client</span>
<span class="protocol-node-copy">list, read, call</span>
</button>
<button class="protocol-node" type="button" data-node-index="2">
<span class="protocol-node-title">MCP Server</span>
<span class="protocol-node-copy">capabilities + auth</span>
</button>
<button class="protocol-node" type="button" data-node-index="3">
<span class="protocol-node-title">Retrieval Layer</span>
<span class="protocol-node-copy">search, nav, history</span>
</button>
<button class="protocol-node" type="button" data-node-index="4">
<span class="protocol-node-title">Codebase</span>
<span class="protocol-node-copy">ground truth</span>
</button>
</div>
<div class="protocol-active">
<h3 id="protocolTitle">Agent</h3>
<p id="protocolText">plans what to ask</p>
</div>
<div class="protocol-facets">
<div class="config-tab-row">
<button class="config-tab is-active" type="button" data-tab-target="resources">Resources</button>
<button class="config-tab" type="button" data-tab-target="tools">Tools</button>
<button class="config-tab" type="button" data-tab-target="prompts">Prompts</button>
</div>
<div class="facet-panels">
<div class="facet-panel is-active" data-tab-panel="resources">
<h3>Read-only context</h3>
<p>Resources expose structured data to the host: schema-like material, documents, or any other context the agent should be able to read without executing an action.</p>
</div>
<div class="facet-panel" data-tab-panel="tools">
<h3>Executable actions</h3>
<p>Tools are the workhorses. The agent lists them, then executes focused actions like repo discovery, code search, file reads, symbol navigation, revision comparison, contributor lookup, or Deep Search.</p>
</div>
<div class="facet-panel" data-tab-panel="prompts">
<h3>Reusable templates</h3>
<p>Prompts package guidance and examples so hosts can reuse proven workflows. They help structure the interaction without overloading every request with boilerplate.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="section sourcegraph-mcp-section" id="sourcegraph-mcp-works">
<div class="container">
<div class="section-heading reveal">
<h2 class="section-title statement-title">How does Sourcegraph MCP work?</h2>
</div>
<div class="mcp-scene reveal" aria-label="Agent to Sourcegraph MCP flow">
<div class="mcp-scene-stage">
<section class="mcp-host-zone" aria-labelledby="mcpAgentsTitle">
<span class="mcp-scene-label" id="mcpAgentsTitle">Agents</span>
<ul class="mcp-agent-list" aria-label="Agent hosts from the assets agents directory">
<li class="mcp-agent-list-item">
<img class="mcp-agent-logo mcp-agent-logo-claude" src="assets/agents/claude.svg.png" alt="Claude" loading="lazy">
</li>
<li class="mcp-agent-list-item">
<img class="mcp-agent-logo mcp-agent-logo-amp" src="assets/agents/amp.svg" alt="Amp" loading="lazy">
</li>
<li class="mcp-agent-list-item">
<img class="mcp-agent-logo mcp-agent-logo-cursor" src="assets/agents/cursor.svg" alt="Cursor" loading="lazy">
</li>
<li class="mcp-agent-list-item">
<img class="mcp-agent-logo mcp-agent-logo-openai" src="assets/agents/openai.svg" alt="OpenAI" loading="lazy">
</li>
</ul>
</section>
<div class="mcp-connection mcp-connection-mcp" aria-hidden="true">
<span class="mcp-connection-label">MCP Tools</span>
</div>
<section class="mcp-sourcegraph-zone" aria-labelledby="mcpSourcegraphTitle">
<span class="mcp-scene-label">Sourcegraph MCP</span>
<h3 class="mcp-scene-title mcp-sourcegraph-title" id="mcpSourcegraphTitle">Sourcegraph exposes tools for the agent</h3>
<div class="mcp-sourcegraph-core">
<div class="mcp-sourcegraph-brand">
<span class="mcp-sourcegraph-kicker">MCP Server</span>
<img class="mcp-sourcegraph-logo" src="assets/sourcegraph.svg" alt="Sourcegraph" loading="lazy">
<p>Discover tools, retrieve context.</p>
</div>
<div class="mcp-tool-cluster" aria-label="Sourcegraph MCP tools">
<span class="mcp-tool-chip">Search</span>
<span class="mcp-tool-chip">Read file</span>
<span class="mcp-tool-chip">Definitions</span>
<span class="mcp-tool-chip">References</span>
<span class="mcp-tool-chip">Diffs</span>
<span class="mcp-tool-chip">Deep Search</span>
</div>
</div>
</section>
<div class="mcp-connection mcp-connection-evidence" aria-hidden="true">
<span class="mcp-connection-label">Context</span>
</div>
<section class="mcp-context-zone" aria-labelledby="mcpContextTitle">
<span class="mcp-scene-label">Context Window</span>
<h3 class="mcp-scene-title mcp-context-title" id="mcpContextTitle">The LLM has precise context</h3>
<div class="mcp-context-shell">
<div class="mcp-context-bar">
<span>Grounded Evidence</span>
</div>
<div class="mcp-context-items" aria-hidden="true">
<span class="mcp-context-chip">Definition: `settingsMerge.ts`</span>
<span class="mcp-context-chip">Reference graph</span>
<span class="mcp-context-chip">Read: exact file range</span>
<span class="mcp-context-chip">Diff + history</span>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
<section class="section-compact">
<div class="container">
<div class="loop-mcp-cta reveal">
<a class="factory-cta" href="./mcp-guide.html">See a concrete Sourcegraph MCP guide →</a>
</div>
</div>
</section>
<section class="section use-cases-section" id="use-cases">
<div class="container">
<div class="section-heading reveal">
<span class="f-kicker">Use Cases</span>
<h2 class="section-title statement-title">How your workflow changes with context-aware agents</h2>
</div>
<div class="use-case-stage reveal">
<div class="use-case-list">
<button class="use-case-trigger is-active" type="button" data-spotlight-key="existing">
<span class="use-case-name">Understanding Existing Code</span>
<span class="use-case-note">search + definition + references</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="quality">
<span class="use-case-name">Consistency & Quality</span>
<span class="use-case-note">codebase conventions</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="refactor">
<span class="use-case-name">Codebase-wide Refactoring</span>
<span class="use-case-note">references + diffs</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="bug">
<span class="use-case-name">Fixing Bugs</span>
<span class="use-case-note">history + file reads</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="feature">
<span class="use-case-name">Implementing New Features</span>
<span class="use-case-note">pattern retrieval</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="review">
<span class="use-case-name">Code Review</span>
<span class="use-case-note">cross-repo evidence</span>
</button>
<button class="use-case-trigger" type="button" data-spotlight-key="debug">
<span class="use-case-name">Debugging Issues / Troubleshooting</span>
<span class="use-case-note">deep search</span>
</button>
</div>
<article class="use-case-spotlight">
<strong data-spotlight-title>Understanding existing code</strong>
<p data-spotlight-text>
Ask where a symbol is defined, which services call it, and which docs explain the surrounding architecture. The agent can answer with file paths and dependencies instead of hand-wavy summaries.
</p>
</article>
</div>
</div>
</section>
<section class="section footer-cta">
<div class="container">
<div class="cta-inner reveal">
<a class="factory-cta" href="./context-problem.html">Read about Software Factory →</a>
</div>
</div>
</section>
</main>
<script src="./assets/site.js"></script>
</body>
</html>