khromov/ai-digest
A CLI tool to aggregate your codebase into a single Markdown file for use with Claude Projects or custom ChatGPTs.
ai‑digest
What it does
- A command‑line tool (and Node library) that walks through a project’s files, filters them with ignore/minify rules, optionally strips whitespace, and writes everything into a single Markdown document (
codebase.md). - The resulting Markdown can be uploaded to Claude Projects or a custom ChatGPT so the model can “see” the whole codebase for analysis, debugging, or review.
How you use it
- Install/run the CLI with
npx ai-digest(ornpm i ai-digestand call it from a script). - Choose options such as:
-i/--inputto point at one or more directories.-oto name the output file.--whitespace-removalto shrink the text size.--ignore-file/--minify-fileto supply.aidigestignoreand.aidigestminifypattern files.--watchto keep the markdown up‑to‑date while you edit.--show-output-filesto see a bar‑chart of each file’s size.
- The tool creates a Markdown file that contains each source file wrapped in a code block, with placeholders for files that are minified (i.e., listed but not fully included).
- Upload that Markdown to Claude or a custom GPT’s knowledge base, then start a chat.
Key features
- Default ignore patterns (build artefacts, config files) plus custom
.aidigestignoresupport. - Minify patterns (
.aidigestminify) that replace large files with a short placeholder; you can customise the placeholder via a callback when using the library. - Whitespace removal (disabled for whitespace‑sensitive languages like Python/YAML) to cut token count.
- File‑size statistics with visual bar charts; can be sorted by size.
- Watch mode – automatically rebuilds the markdown on file changes.
- Library API – all CLI functionality is exposed as async functions (
generateDigest,generateDigestFiles,getFileStats, etc.) for programmatic use.
Who it helps
- Developers who want to give an LLM a full view of a codebase without manually zipping or copying files.
- Teams building custom ChatGPT agents or Claude Projects that need a concise, token‑efficient representation of their source.
Typical workflow
# From the root of your repo
npx ai-digest # creates codebase.md
# In Claude UI → New Project → upload codebase.md
# or in ChatGPT → Custom GPT → upload the same file
Limitations
- The tool only aggregates text files; binary/SVG files are noted but not embedded.
- Whitespace removal is skipped for languages where it would change semantics.
- Token estimates are provided, but actual model limits still apply.
License
- MIT, so you can freely use or modify it.
Related
- Project
- Project
- Project
- Project