Skip to content

Support Recursive Imports in Context Files (GEMINI.md) #15544

@coygeek

Description

@coygeek

What would you like to be added?

I would like GEMINI.md context files to support a syntax for importing content from other files recursively.

Currently, if I have multiple projects that share a set of coding conventions, I have to duplicate those conventions into every GEMINI.md file. I would like to be able to use a syntax like @path/to/shared_conventions.md inside a GEMINI.md file, which the CLI should resolve, read, and inject into the context window at runtime.

Requirements:

  • Syntax: Support a clear syntax (e.g., @./relative/path.md or @/absolute/path.md) to reference other files.
  • Recursion: Imported files should be able to import other files (nested imports).
  • Cycle Detection: The system should gracefully handle or error out on circular dependencies (e.g., File A imports File B, File B imports File A).
  • Path Resolution: Support relative paths (relative to the file doing the importing) and project-absolute paths.

Why is this needed?

This feature is essential for Context Management at Scale:

  1. DRY (Don't Repeat Yourself): Teams often have global coding standards (linting rules, architectural patterns) that apply to all repositories. Currently, these must be copy-pasted into every project's GEMINI.md.
  2. Maintainability: If a team convention changes, developers currently have to update every single GEMINI.md file across their file system. With imports, they would only need to update the single source-of-truth file.
  3. Modularity: It allows developers to organize context logically (e.g., testing_rules.md, style_guide.md, architecture.md) rather than having one massive, unreadable GEMINI.md file.

Additional context

Example Workflow:

File Structure:

/my-project
  ├── GEMINI.md
  ├── docs/
  │   └── api-conventions.md
  └── shared-rules/    (perhaps a submodule or shared folder)
      └── team-style.md

Content of GEMINI.md:

# Project Overview
This is the main backend service.

# Context Imports
@docs/api-conventions.md
@shared-rules/team-style.md

# Specific Instructions
Focus on high performance.

Desired Behavior:
When the CLI initializes or refreshes context, it should construct a final system prompt that concatenates the content of GEMINI.md with the fully resolved content of api-conventions.md and team-style.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions