Skip to main content

AI-powered codebase analyzer โ€” scans project structure, builds dependency graphs, generates LLM-optimized prompts with minification, skeleton mode, and JSON patching

Project description

๐ŸŒŸ About

CodeContext AI is a powerful desktop tool for preparing your codebase to work with Large Language Models (LLMs). It scans project folders, analyzes structure, builds dependency graphs, and generates a single, perfectly structured prompt โ€” optimized for token consumption and architectural clarity.

โ“ Why?

When working with AI, developers face context window token limits โ€” LLMs "lose" architectural coherence when code is copied in parts. CodeContext AI solves this: collect your entire project into one structured prompt in a few clicks, saving up to 80% on tokens.


๐Ÿš€ Features

FeatureCodeContext AIManual
๐Ÿ—œ๏ธ MinifyUp to 80% token reduction โ€” strips whitespace & blank linesManual copy-paste
๐Ÿงฉ LLM PatcherPreview & apply JSON patchesNot available
โœ… LLM CheckerAuto-verify code before savingNot available
๐Ÿ”— AST dependency graphPython, JS/TS, VueFile listing only
๐Ÿ–ฑ๏ธ Context menuWindows / LinuxNone
๐ŸŽจ ThemesApple, Modern, custom JSONFixed UI
โš™๏ธ UI customization (v1.14+)Premiere Pro-styleFixed UI
๐ŸŒ i18n (v1.17+)15 languages, system auto-detectSingle language
โ™ป๏ธ Dedup (v1.23+)Detects & skips files with identical contentManual check
โšก Aggressive minify (v1.23+)Extra compression โ€” eliminates trailing whitespace on every lineManual delete
๐Ÿ“Œ Checkpoints (v1.23+)Save before/after snapshots for debuggingNot available
๐Ÿ‘๏ธ Auto-Watch (v1.23+)Watches files & re-processes on changeNot available
๐Ÿ”Œ Plugin System (v1.25+)Extend with Python plugins โ€” custom tabs, actions, and i18nNot available

๐Ÿ“ฅ Installation

Prerequisites: Python 3.10+, Git

git clone https://github.com/NIKIRIKI7/CodeContext.git
cd CodeContext
python -m venv venv
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
pip install -r requirements.txt

PyPI (pip)

pip install codecontext-ai
# Then launch:
codecontext

Windows .exe

pip install pyinstaller
pyinstaller --windowed --onefile --icon=assets/images/logo.ico --name "CodeContext AI" main.py

Arch Linux (AUR)

ActionCommand
Installyay -S codecontext-ai
Searchyay -Ss codecontext
Updateyay -Syu
Removesudo pacman -Rns codecontext-ai

If yay is not installed:

sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay && makepkg -si

Alternative: paru -S codecontext-ai


๐Ÿ’ป GUI Mode

python main.py

1. Interface Overview

The window is split into three zones:

  • Left sidebar (tabs) โ€” scan settings, filters, prompts, LLM config, themes
  • Center area โ€” folder list, file tree, token analytics
  • Top action bar โ€” Minify/No Comments/Skeleton toggles, output format, action buttons

2. Adding a Project

ActionHow
Drag & dropJust drag a project folder into the window
Browse dialogClick "+ ะŸะฐะฟะบะฐ ะŸะš" on the Sources tab
GitHub repoClick "+ GitHub / PR" โ€” paste a repo or Pull Request URL
Save configClick "๐Ÿ’พ Save config" โ€” creates .codecontextrc

GitHub loading modes:

  • Save permanently โ€” clones to a folder on your disk
  • Temporary โ€” clones to a temp folder (deleted on app close)

3. Scan Configuration

Sources Tab

OptionDescription
โ˜‘ Git Changes OnlyInclude only files changed in the last commit
โ˜‘ Respect .gitignoreAuto-exclude files from .gitignore
๐Ÿ” Scan FilesBuild the file tree with metadata

Filters Tab

OptionDescription
Extension presetsQuick switch between language sets (Python, Web, Golang, Rust, C#, etc.)
ExtensionsCustom file extension whitelist
Ignored pathsSkip folders/files (node_modules, .git, build, dist, etc.)
โ˜‘ Include file treePrepends folder structure to the prompt
โ˜‘ Include dependency mapAST-based import analysis for Python/JS/TS
โ˜‘ Include Mermaid graphArchitecture diagram in Mermaid format

๐Ÿ’ก Saving custom presets: configure filters, click ๐Ÿ’พ, enter a name.

Prompts Tab

OptionDescription
Prompt presetsQuick change of system prompt (Code Review, Bug Hunter, Refactoring, etc.)
System promptCustom prompt โ€” sent to LLM as system context
๐Ÿงฉ Apply JSON patchPaste LLM JSON response โ€” preview diff and apply to disk

Using JSON patches:

  1. Ask LLM for a JSON array: [{"action": "replace", "file": "main.py", "search": "...", "content": "..."}]
  2. Paste JSON, click "Next" โ†’ Safety Diff Viewer opens
  3. Check/uncheck files, optionally click "๐Ÿค– Check via LLM"
  4. Click "๐Ÿ’พ Save selected to disk"

4. Output Format Settings

OptionDescription
โ˜‘ MinifyTrims leading/trailing whitespace on every line, removes blank lines โ€” safe baseline compression for everyday use
โ˜‘ AggressiveExtra minification pass โ€” strips trailing whitespace aggressively on every line. Combine with Minify for maximum token savings when context is tight
โ˜‘ No CommentsRemoves all comments from code
โ˜‘ No SecretsMasks API keys, passwords, tokens
โ˜‘ Skeleton โ˜ ๏ธStrips function bodies โ€” maximum token savings
โ˜‘ DedupScans all files and excludes duplicates with identical content โ€” eliminates redundant context from repeated files
โ˜‘ CheckpointsSaves intermediate processing snapshots (before/after) to disk โ€” useful for debugging pipeline stages or comparing outputs
โ˜‘ Auto-WatchWatches project files for changes and automatically reprocesses โ€” keeps your prompt up-to-date during active development
FormatMarkdown, XML, Plain, JSONL Chunks, Custom (Jinja2)
๐Ÿ“ templateJinja2 template picker

Skeleton Mode: removes function implementations (def func_name(...): # ... implementation ...), preserving all classes โ€” lets LLM understand massive projects with minimal tokens.

Minify vs Aggressive: Minify strips leading/trailing whitespace and removes blank lines โ€” safe for any codebase, reduces tokens without affecting readability. Aggressive adds an extra pass that eliminates trailing whitespace on every line for maximum compression. Combine both when you need to fit more code into a limited context window.

Dedup: automatically detects files with identical content across your project and excludes duplicates from the output โ€” prevents LLM from seeing the same code twice and wasting tokens.

Checkpoints: saves intermediate results at each pipeline stage (before cleanup, after minification, etc.) to checkpoints/ folder. Useful for debugging what each processing step does or comparing outputs side by side.

Auto-Watch: monitors your project files for changes using the OS file watcher. When a file is saved, the pipeline automatically re-runs โ€” ideal during active development when you need continuous prompt updates.

5. Action Buttons

ButtonAction
๐Ÿ‘€ PreviewAdvanced Preview Dialog โ€” "Final Prompt" + "Before/After" tabs
๐Ÿ“‹ Copy to ClipboardCopy result โ€” paste into ChatGPT / Claude
๐Ÿš€ Send to ChatGPT / ClaudeOpens web chat and pastes context
๐Ÿ’ป Open in EditorOpens in VS Code / Cursor
๐Ÿ’พ Save to FileSave result to disk

6. Advanced Preview Dialog

"๐Ÿ“ Final Prompt" tab: file list (left) + full text with highlighting (right). Copy All / Copy File.

"๐Ÿ” Before/After" tab: colored diff between original and optimized. Counter: Before: 1500 โ†’ After: 300 (80%).

7. LLM & OS

LLM Checker
โ˜‘ Enable verificationAuto LLM patch verification before applying
URL / Key / ModelAPI endpoint (default OpenAI), key, model
๐Ÿฆ™ Ollamahttp://localhost:11434/v1 / llama3
๐Ÿ–ฅ LM Studiohttp://localhost:1234/v1 / local-model
OS Integration
Install context menu"Open with CodeContext AI" in right-click menu
Add to PATHGlobal codecontext CLI command
Editorcode, cursor, idea, vim

8. Themes

  • Theme: Apple, Modern โ€” Mode: light / dark
  • ๐Ÿ“‚ Open themes folder / โž• Import theme (.json)

9. ๐Ÿ“Š Token Analytics

Table: file path, tokens (tiktoken), compression, savings %, cost for model.

10. ๐ŸŽ›๏ธ UI Customization (v1.14+)

Click โš™ next to version โ€” "Interface Settings (Premiere Pro style)" dialog. Toggle tabs (Sources, Filters, Prompts, LLM & OS, Themes) and action buttons (Preview, Clipboard, ChatGPT, Editor, File).

11. Command Palette

Ctrl+Shift+P โ€” mouse-free access to all actions.

12. ๐Ÿ”Œ Plugin System (v1.25+)

CodeContext AI supports a Python plugin system that lets you extend the app with custom functionality.

๐Ÿ“ Plugin Structure

my_plugin/
โ”œโ”€โ”€ manifest.json          # Plugin metadata
โ”œโ”€โ”€ requirements.txt       # (Optional) pip dependencies
โ”œโ”€โ”€ locales/
โ”‚   โ”œโ”€โ”€ en.json            # English translations
โ”‚   โ””โ”€โ”€ ru.json            # Russian translations
โ””โ”€โ”€ plugin.py              # Entry point

๐Ÿ“„ manifest.json

{
  "id": "my_plugin",
  "name": "My Plugin",
  "version": "1.0.0",
  "description": "Does something useful",
  "entry_point": "plugin"
}

๐Ÿ plugin.py (Example)

from src.api.plugin_api import IPlugin, PluginAPI

class MyPlugin(IPlugin): id = "my_plugin" name = "My Plugin" version = "1.0.0"

def on_init(self, api: PluginAPI) -> None:
    # Add translations from locales/ folder (auto-loaded)
    # Register a sidebar tab
    api.ui.register_sidebar_tab(
        "my_tab", "My Tab",
        lambda: QLabel("Hello from plugin!")
    )
    # Register an action button
    api.ui.register_action_button(
        "my_action", "My Action",
        lambda: api.add_log("Plugin action clicked")
    )
    api.add_log("My Plugin initialized")

def on_shutdown(self) -> None:
    pass</pre>

๐Ÿ” Security

  • Plugins get full Python access โ€” only install from trusted sources
  • On first load, a security dialog asks your approval before enabling a plugin
  • If requirements.txt exists, you'll see a live pip install log before loading
  • Approved plugins are remembered in settings (approved_plugins)

๐Ÿ›  Plugin API

Property / MethodDescription
api.storeRead-only Redux store (state access via state.settings.xxx)
api.dispatcherDispatch actions (e.g. UI_ADD_LOG)
api.ui.register_sidebar_tab(id, label, factory)Add a tab to the left sidebar
api.ui.register_action_button(id, label, callback)Add a button to the "Plugins ๐Ÿ”ฝ" dropdown
api.add_translations(lang, data)Add runtime translations (merged on top of built-in)
api.add_log(message)Write to the app log panel

โš™๏ธ Visibility

Plugin tabs and action buttons can be toggled via โš™ UI Customization โ€” they appear alongside built-in tabs/actions with their own checkboxes.


๐Ÿ’ป CLI Mode

python main.py --cli --path /path/to/project [options]
python main.py --help
ParameterTypeDescriptionExample
--cliflagCLI mode (no GUI)--cli
--pathlistProject path--path ./app
--extstrExtensions--ext ".py .js"
--ignorestrIgnored paths--ignore "node_modules"
--modeenumnone / default / shallow / deep--mode deep
--formatenummarkdown / xml / plain / jsonl_chunk--format xml
--minifyflagEnable minification--minify
--no-commentsflagStrip comments--no-comments
--no-secretsflagMask secrets--no-secrets
--skeletonflagSkeleton mode--skeleton
--outputstrOutput file--output out.txt
--stdoutflagPrint to stdout--stdout
--gitflagGit changes only--git
--gitignoreflagRespect .gitignore--gitignore
--treeflagFile tree--tree
--mermaidflagMermaid graph--mermaid
--dependenciesflagDependency map--dependencies
--patchstrLLM JSON patch--patch patch.json
--templatestrJinja2 template--template my.j2
--system-promptstrCustom system prompt--system-prompt "Review"

Examples

# Minimal run
python main.py --cli --path ./myapp --stdout

Full analysis with XML

python main.py --cli --path ./myapp --ext ".py .js .ts" --ignore "node_modules,.git,pycache" --mode deep --mermaid --tree --dependencies --minify --no-comments --skeleton --format xml --output analysis.xml

Git diff

python main.py --cli --path ./myapp --git --gitignore --stdout

LLM JSON patch

python main.py --cli --path ./myapp --patch llm_response.json

Custom Jinja2 template

python main.py --cli --path ./myapp --template my.j2 --stdout

Mermaid diagram

python main.py --cli --path ./myapp --mode deep --mermaid --output with_mermaid.md

Multiple paths

python main.py --cli --path ./frontend ./backend --format xml --output combined.xml


๐Ÿ—๏ธ Tech Stack

ComponentTechnology
LanguagePython 3.10+
GUI FrameworkPySide6 (Qt 6)
ArchitectureClean Architecture + Redux-like
Tokenizationtiktoken (OpenAI)
Templatingjinja2 (11 built-in)
AST parsersast (Python), tree-sitter (JS/TS/Go/Rust)
DistributionPyInstaller, AUR

๐Ÿ—บ๏ธ Roadmap

  • ๐Ÿ“š RAG (Retrieval-Augmented Generation) mode โ€” indexing massive codebases using local vector DB (Chroma/FAISS).
  • ๐Ÿšซ Deep .gitignore parsing โ€” support for nested .gitignore files & global ~/.gitignore.
  • โ˜๏ธ Cloud Sync โ€” sync presets & configurations via GitHub Gists.
  • ๐ŸŒณ Multi-root Workspaces โ€” improved monorepo support (Lerna, NX, Turborepo).
  • ๐Ÿš€ CI/CD Pipelines โ€” GitHub Actions & GitLab CI plugins for automated PR context generation.
  • ๐Ÿค– Direct OpenAI/Anthropic API integration โ€” complete the bridge from prompt generation to direct output.
  • ๐ŸŽ macOS Finder context menu
  • ๐Ÿ”Œ Plugin system โœ…

๐Ÿ‘จโ€๐Ÿ’ป Team

Developer: mcniki ยท VK: gor_niki ยท Issues & PRs on GitHub


๐Ÿค Contributing

  1. Fork the repository
  2. Branch: git checkout -b feature/AmazingFeature
  3. Commit: git commit -m 'Add AmazingFeature'
  4. Push: git push origin feature/AmazingFeature
  5. Pull Request

Follow SOLID principles (see docs/ARCHITECTURE.md).


๐Ÿ“„ License

MIT. See LICENSE for details.

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

codecontext_ai-1.25.1.tar.gz (566.0 kB view details)

Uploaded Source

Built Distribution

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

codecontext_ai-1.25.1-py3-none-any.whl (512.4 kB view details)

Uploaded Python 3

File details

Details for the file codecontext_ai-1.25.1.tar.gz.

File metadata

  • Download URL: codecontext_ai-1.25.1.tar.gz
  • Upload date:
  • Size: 566.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for codecontext_ai-1.25.1.tar.gz
Algorithm Hash digest
SHA256 575152852fa1311c7d09010e4aa6d17e83362435bd959aaf48762005f6b2a9bf
MD5 a13e8ad8c5fcbbd6d5c145f06eb99f38
BLAKE2b-256 5c9ce76c56efa1a0b340af15d8de8cead6baf16a2f0cebb2eb121c4a9f0556cb

See more details on using hashes here.

File details

Details for the file codecontext_ai-1.25.1-py3-none-any.whl.

File metadata

  • Download URL: codecontext_ai-1.25.1-py3-none-any.whl
  • Upload date:
  • Size: 512.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for codecontext_ai-1.25.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd2c498e3e747d1efb6795fb998ef1f927660fd2e82d17ce69f0de2a0345a88f
MD5 dbc570e84b5d26449060dcc7423568ca
BLAKE2b-256 5c59d1b313c5a1166067ac547f6355bb9fe716b7020b48bf397569506a58bc62

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