
Overview
By integrating with the code repositories of your organization, Glean enriches its enterprise knowledge graph to provide:Code Search & Understanding
Ask questions about your codebase and get answers grounded in your organization’s actual code, documentation, and related discussions. No special action needed.
Inline Code Generation
Generate code snippets directly in chat that align with your organization’s standards. Copy and paste into your editor.
Code Writer
Propose and apply small, targeted code changes by opening draft pull requests in GitHub. Move from bug to fix without leaving Assistant.
Code Search is enabled by default after a supported code host (GitHub Cloud, GitHub Enterprise Server, or GitLab) is connected to Glean. See Code Tool for more details.
Key Benefits
Rapid Error Resolution
Quickly identify and resolve issues using a comprehensive database of code snippets, documentation, and previous solutions.
Automated Code Generation
Boost productivity with automatic generation of code snippets for both routine tasks and new feature development.
Knowledge Sharing
Facilitate effective communication of coding practices and standards across your organization.
Streamlined Onboarding
Accelerate new engineer integration with structured learning resources and codebase insights.
Understanding the Capabilities
Assistant supports several related capabilities for working with code:-
Code search & questions
- Ask questions about your codebase and Assistant searches your code, PRs, commits, and related documentation.
- Use this when you want to understand how something works, find implementations, or get context.
- No special action needed—just ask naturally.
-
Inline code generation
- Write or improve code snippets directly in chat.
- Use this when you want ideas, examples, or a starting point that you will paste into your editor.
-
Code Writer
- Proposes and applies code changes by opening draft pull requests in GitHub.
- Uses your instructions as context, then writes code into a branch for review.
- Use this when you want to make changes in a repository.
- Ask questions to understand existing code (Assistant searches automatically).
- Ask Assistant to use Code Writer to propose a fix if you need changes.
- Review and merge the resulting pull request in GitHub.
Example Queries
You can ask Assistant about your codebase without explicitly invoking Code Writer. These questions use code search and inline generation:Code Context & Understanding
- “How is
[system]implemented at our company?” - “How do I debug/solve
[error]?” - “Help me write code to do
Xin[language]” - “Where is the code file that does
X?” - “Help me write unit tests for
[file]”
Process & Customer Context
- “What is the status of this week’s backend release?”
- “Who can I ask about
[system or feature]?” - “How do I set up my dev environment?”
- “Which customers are using
[feature]?” - “What customers have raised issues this week?”
Code Writer
Code Writer is an AI‑powered code action that edits code and opens draft pull requests. It works with GitHub so you can make changes to your code without leaving Assistant or Slack. When Code Writer is enabled for your organization and you have access:- Assistant can call Code Writer behind the scenes when a task requires code changes.
- Code Writer reads the relevant repository, proposes a change, and opens a draft pull request in GitHub.
- Assistant returns the pull request link and a short explanation so you can review it in your usual tools.
Use Code Writer in Assistant
You can trigger Code Writer from Assistant to make changes in GitHub.Connect your GitHub account
The first time you use a feature that relies on Code Writer:- Ask Assistant to perform a code change (see examples below).
- Assistant prompts you to connect your GitHub account.
- Follow the sign‑in flow to authorize Glean.
- After that, tokens refresh automatically and you typically will not see this prompt again.
Example prompts
Here are some example ways to ask Assistant to use Code Writer:- “Use Code Writer to create a draft PR that fixes this stack trace in the
examplerepo.” - “Based on JIRA-1234, propose a fix and open a draft PR.”
- “Update the error message in our password reset handler and open a draft PR with the change.”
- “Review PR
ENG-5678and apply the requested logging changes as a new commit.”
- Assistant gathers context (ticket text, stack traces, related code).
- Code Writer plans and applies a small change in the configured GitHub repository and branch.
-
Assistant returns:
- A link to the draft pull request.
- A short summary of what changed.
- Open the pull request in GitHub and review the diff.
- Ask follow‑up questions in Assistant (for example, “What tests should I run?” or “Can you narrow this change to just the
user-profilemodule?”).
Use Code Writer from Slack (Glean in Slack)
If your organization has Glean in Slack and Code Writer enabled, you can trigger Code Writer directly from Slack.Requirements
- The Glean Slack app is installed for your workspace.
- The Glean app is added to the channel where you want to use it.
- You have permission to use Code Writer and have connected your GitHub account when prompted.
Usage Scenarios
Adding to Existing Code
1
Situation
An engineer needs to create a new evalset, working with code spread across multiple files and languages. They need to leverage existing code rather than starting from scratch.
2
Example Queries
- “How do I add a new search evalset?”
- “How to create a new autocomplete evalset for history suggestions?”
3
Outcome

Debugging Errors
1
Situation
An on-call engineer encounters a panic occurring in specific product situations.
2
Example Queries
- “Help me debug [full panic error]”
- “Can you review the code and help me fix the panic?”
- “Give me a list of reviewers for this code change”
- “Can you create a PR description?”
3
Outcome


Feature Status Check
1
Situation
An engineer needs to determine a feature’s implementation status and customer requests.
2
Example Queries
- “Is [feature] enabled?”
- “What customers have asked for this feature?”
3
Outcome

Code Change Impact
1
Situation
An engineer debugging an error needs to understand recent changes affecting their component.
2
Example Queries
“What recent changes could have caused errors in runtime configs?”
3
Outcome

Implementation Guidance
1
Situation
An engineer starting a new implementation needs guidance on multi-file changes across the stack.
2
Example Queries
“Where can I add a new endpoint for QE?”
3
Outcome

FAQ
Which datasources are supported?
Which datasources are supported?
Code repositories in GitHub (Cloud), GitHub Enterprise Server, and GitLab are supported.
What permissions are required?
What permissions are required?
The permissions match those of the Glean GitHub and GitLab connectors exactly. For Code Writer specifically, you will need to connect your personal GitHub account to authorize changes.
Is code search supported in search results?
Is code search supported in search results?
Currently, indexed code is only used for Glean Assistant responses. Glean Search matches PR descriptions and file names, but not code contents directly, to reduce result noise.
How is my data secured?
How is my data secured?
Code snippets become part of your organization’s Glean Knowledge Graph, ensuring:
- Only users with existing code access can access it via Glean Assistant
- Code snippets follow the same privacy guarantees as all other indexed Glean content
What code file types are supported?
What code file types are supported?
Glean Assistant searches through code in:
- PR and Merge Request differentials
- Latest commit and Main/Master branch files with extensions including but not limited to:
- Common languages: .js, .py, .java, .cpp, .go, .rb, .php
- Web technologies: .html, .css, .scss
- Configuration: .ini, .cfg, .cnf
For a complete list of supported file extensions, please contact Glean support.
Do I need Code Writer to ask questions about my code?
Do I need Code Writer to ask questions about my code?
No. You can ask Assistant questions about your codebase, get explanations, and receive code snippets without using Code Writer. Code Writer is only needed when you want to create actual pull requests with proposed changes.