Skip to main content
Greptile learns your team’s coding standards by analyzing PR feedback. Use MCP tools to access these patterns during development.

What is Custom Context?

Custom context entries are coding patterns Greptile has learned from your team’s code reviews. They include:
  • CUSTOM_INSTRUCTION: Explicit coding rules (e.g., “Use async/await instead of Promise.then()”)
  • PATTERN: Observed patterns from your codebase (e.g., “API errors should return standardized error objects”)
Each entry has:
  • Body: The actual instruction or pattern
  • Scopes: Where it applies (specific files, directories, or universal)
  • Status: ACTIVE, INACTIVE, or SUGGESTED
  • Evidence: Linked comments that support the pattern

Common Workflows

List Your Team’s Patterns

Ask your AI assistant:
What custom context does my organization have?
Or be more specific:
Show me all active coding patterns for JavaScript files
The assistant uses list_custom_context to retrieve your patterns.

Onboard a New Developer

Show a new team member all our coding patterns and explain why we use them
Example response:
Here are your organization's key coding patterns:

1. **Security Pattern**: "Validate all API inputs using Joi schemas"
   - Why: Prevents injection attacks and ensures data integrity
   - Applied to: All API route files

2. **Style Pattern**: "Use async/await instead of Promise.then()"
   - Why: Better readability and error handling
   - Applied to: All JavaScript/TypeScript files

3. **Architecture Pattern**: "Prefer composition over inheritance"
   - Why: More flexible and testable code
   - Applied to: Class-based components

Apply Patterns During Development

When writing code, ask:
Check if my current code follows our team's patterns
Or when reviewing a specific file:
What coding patterns apply to this authentication service?

Create New Patterns

From recent review feedback:
Create a new coding pattern based on this review feedback: "Always use TypeScript strict mode for new services"
The assistant will use create_custom_context:
Pattern Type: CUSTOM_INSTRUCTION
Body: "Always use TypeScript strict mode for new services"
Scope: Apply to **/services/**/*.ts files
Status: ACTIVE

Should I create this pattern?

Search for Specific Patterns

Search our custom context for anything related to error handling
Uses search_custom_context to find relevant patterns.

Understanding Scopes

Scopes define where patterns apply:
Scope TypeExampleMeaning
Universal{"AND": []}Applies everywhere
File pattern{"AND": [{"operator": "MATCHES", "field": "filepath", "value": "**/*.ts"}]}Applies to TypeScript files
Directory{"AND": [{"operator": "MATCHES", "field": "filepath", "value": "src/api/**"}]}Applies to API directory
Scope format:
{
  "scopes": {
    "AND": [
      {
        "operator": "MATCHES",
        "field": "filepath",
        "value": "**/*.js"
      }
    ]
  }
}

Example Prompts

Check this function against our team's coding patterns. 
What improvements should I make?
What patterns should I follow when writing database queries?
Get the details and linked comments for pattern ctx_123. 
Why was this pattern created?
Based on recent Greptile comments, what new patterns 
should we add to our custom context?

Tools Used

ToolPurpose
list_custom_contextList all patterns, optionally filter by type
get_custom_contextGet details for a specific pattern
search_custom_contextSearch patterns by content
create_custom_contextCreate new patterns
See Tools Reference for complete parameters.

Next Steps