Skip to main content

A code summarizer agent that generates summary.md for every folder in your repo and writes to .summaries/ at your repo root. BYO API key and endpoint.

Project description

codesumm

AI-powered code summarizer that generates a summary.md for every folder in your repository. Uses an LLM to understand your codebase and produce structured, human-readable summaries so that new contributors (and future you) can navigate the project without reading every file.

Features

  • Bottom-up DFS traversal — summarizes leaf folders first, then incorporates child summaries into parent folders
  • Context-aware — reads your README and architecture docs to understand the project before summarizing
  • .gitignore-style exclusions — skip node_modules, .git, dist, and anything else via --exclude option or from create config.yaml in root of repository. Can get structure for this config below.
  • Context window management — automatically batches large folders to fit within model limits
  • Rate limit handling — exponential backoff on 429 responses
  • Works with any OpenAI-compatible API — OpenRouter, OpenAI, local models, anything with a /v1/chat/completions endpoint

Installation

pip install codesumm

Quick Start

  1. Set your API key:
export LLM_API_KEY=sk-your-key-here
export LLM_BASE_URL=https://openrouter.ai/api/v1
export LLM_MODEL=openai/gpt-4o

Or create a .env file in your repo root with the same variables.

  1. Run it:
codesumm ./your-repo
  1. Find your summaries in ./your-repo/.summaries/, mirroring your repo structure.

Example Output

your-repo/
  src/
    auth/
    utils/
  .summaries/
    summary.md            ← root summary
    src/
      summary.md          ← summary for /src
      auth/
        summary.md        ← summary for /src/auth
      utils/
        summary.md        ← summary for /src/utils

Each summary.md follows a standard format:

# auth

## Purpose

Handles user authentication and session management.

## Key Components

- `jwt.py` — JWT token generation and validation
- `middleware.py` — Express middleware for route protection
- `providers/` — OAuth provider integrations (Google, GitHub)

## Internal Dependencies

Depends on `src/db/repositories/user.py` for user lookups.

## Notes

Token expiry is configured via AUTH_TOKEN_TTL environment variable.

Configuration

Create a config.yaml in your repo root to customize behavior:

exclude:
  - node_modules/
  - .git/
  - dist/
  - __pycache__/
  - "*.pyc"
  - "*.lock"

supported_extensions:
  - .py
  - .js
  - .ts
  - .go
  - .java
  - .rs
  - .yaml
  - .json
  - .sh

output_dir: .summaries

rate_limit:
  base_delay_seconds: 1
  max_retries: 5

context_reserve_ratio: 0.3

If no config file is found, sensible defaults are used.

CLI Options

codesumm <repo_path> [options]

Options:
  --config PATH       Path to config.yaml
  --output-dir NAME   Override output directory (default: .summaries)
  --model MODEL       Override LLM model
  --exclude           Exclude pattern
  --base-url URL      Override LLM API base URL
  --verbose           Enable debug logging
  --version           Show version
  --help              Show help

How It Works

1. Read README / architecture docs at repo root
2. Build a file tree (depth=2) for project overview
3. DFS into each folder:
   a. Read all code files in the folder
   b. Generate a scope hint (1-2 line purpose description)
   c. Summarize all files in one LLM call
   d. Recurse into subfolders, passing scope hint as parent context
   e. Combine file summary + child summaries into final folder summary
   f. Write summary.md to .summaries/
4. Done.

Requirements

  • Python 3.10+
  • An API key for any OpenAI-compatible LLM provider

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codesumm-0.1.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codesumm-0.1.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file codesumm-0.1.0.tar.gz.

File metadata

  • Download URL: codesumm-0.1.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for codesumm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 406960996ba742fb86ea7e6934d0d5e97e9ab77f2a539c5a7d853f4c4185cfbe
MD5 56780fdcb27735248b7f0ac3a2153599
BLAKE2b-256 5be631adf5ae82798cf71d47e15731f0841ecb00b1d264d2deaaf8d1caf6078c

See more details on using hashes here.

File details

Details for the file codesumm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: codesumm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for codesumm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d5ba2bf55a716e9c958578dfa8ed5e6176e9220f056f7f836ce8869408f6c82
MD5 841df0040ac31d2d8f1acf68a0eebf81
BLAKE2b-256 8938a137adef70f255100ec68f481d06edb0f4c3b6c489a5d2c1d4a0af875ad8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page