Skip to main content

Overview

The generate_map prompt guides AI agents through generating comprehensive architecture documentation for a codebase. It reads the knowledge graph, identifies key structures, and produces documentation with mermaid diagrams. Use this to auto-generate ARCHITECTURE.md files for onboarding, documentation, or code reviews.

Parameters

string
Repository name (omit if only one repository is indexed)Required when multiple repositories are indexed.

What It Does

The prompt instructs the agent to:
  1. Read codebase context to get stats and overview
  2. List all functional areas (clusters) with cohesion scores
  3. List all execution flows (processes) with step counts
  4. Trace top 5 processes to get step-by-step execution details
  5. Generate mermaid diagram showing architecture and connections
  6. Write ARCHITECTURE.md with overview, areas, flows, and diagram

Usage

In Claude Desktop

Agent will ask for the repo name if multiple are indexed.

In Cursor/OpenCode

Invoke from the MCP prompts menu:

With Parameters

Example Workflow

Here’s what the agent does when you invoke this prompt:
1

Read Context

Reads gitnexus://repo/{name}/context to get codebase statistics:
2

List Functional Areas

Reads gitnexus://repo/{name}/clusters to see all modules:
3

List Execution Flows

Reads gitnexus://repo/{name}/processes to see all processes:
4

Trace Key Processes

For the top 5 most important processes, reads detailed traces:
5

Generate Documentation

Creates ARCHITECTURE.md with:
  • Overview section with stats
  • Functional areas description
  • Key execution flows with traces
  • Mermaid architecture diagram

Example Output

The agent generates a comprehensive ARCHITECTURE.md file:

When to Use

New Repository

Generate initial architecture documentation

Onboarding

Help new developers understand the codebase

Documentation Refresh

Update architecture docs after major changes

Code Review

Provide architectural context in PRs

Customization

You can customize the output by asking the agent:

Resources Used

This prompt reads the following resources: No tools are called — this prompt uses only resources for a purely read-only workflow.

Next Steps

Resources Overview

Learn about all available resources

Detect Impact Prompt

Analyze changes before committing