
generator
ctx: The missing link between your codebase and your LLM. Context as Code (CaC) tool with MCP server inside.
Stars: 51

README:
ctx: The missing link between your codebase and your LLM. Context as Code (CaC) tool with MCP server inside.
ctx is a tool made to solve a big problem when chatting with LLMs like ChatGPT or Claude: giving them enough context about your project.
There is an article about Context Generator on Medium that explains the motivation behind the project and the problem it solves.
Instead of manually copying or explaining your entire codebase each time, ctx automatically builds neat, organized context files from:
- Code files,
- GitHub repositories,
- Git commits and diffs
- Web pages (URLs) with CSS selectors,
- and plain text.
It was created to solve a common problem: efficiently providing AI language models like ChatGPT, Claude with necessary context about your codebase.
When you're using AI in development, contextt isn't just helpful — it's everything.
-
Code Refactoring Help: Need AI assistance refactoring messy code? ctx creates clean, structured documents with all necessary code files.
-
Multiple Iteration Development: Working through several iterations with an AI helper requires constantly updating the context. ctx automates this process.
-
Documentation Generation: Transform your codebase into comprehensive documentation by combining source code with custom explanations. Use AI to generate user guides, API references, or developer documentation based on your actual code.
-
Seamless AI Integration: hanks to built-in MCP support, you can connect Claude AI directly to your codebase, allowing for real-time, context-aware assistance without manual context sharing.
- Gathers code from files, directories, GitHub repositories, web pages, or plain text.
- Targets specific files through pattern matching, content search, size, or date filters
- Applies optional modifiers (like extracting PHP signatures without implementation details)
- Organizes content into well-structured markdown documents
- Saves context files ready to be shared with LLMs
- Optionally serves context through an MCP server, allowing AI assistants like Claude to directly access project information
With ctx, your AI conversations just got a whole lot smarter—and easier.
Getting started with Context Generator is straightforward. Follow these simple steps to create your first context file for LLMs.
Download and install the tool using our installation script:
curl -sSL https://raw.githubusercontent.com/context-hub/generator/main/download-latest.sh | sh
This installs the ctx
command to your system (typically in /usr/local/bin
).
Want more options? See the complete Installation Guide for alternative installation methods.
Create a new configuration file in your project directory:
ctx init
This generates a context.yaml
file with a basic structure to get you started.
Pro tip: Run
ctx init --type=json
if you prefer JSON configuration format. Check the Command Reference for all available commands and options.
Edit the generated context.yaml
file to specify what code or content you want to include. For example:
documents:
- description: "User Authentication System"
outputPath: "auth-context.md"
sources:
- type: file
description: "Authentication Controllers"
sourcePaths:
- src/Auth
filePattern: "*.php"
- type: file
description: "Authentication Models"
sourcePaths:
- src/Models
filePattern: "*User*.php"
This configuration will gather all PHP files from the src/Auth
directory and any PHP files containing "User" in their
name from the src/Models
directory.
- Learn about Document Structure and properties
- Explore different source types like GitHub, Git Diff, or URL
- Apply Modifiers to transform your content (like extracting PHP signatures)
- Discover how to use Environment Variables in your config
- Use IDE Integration for autocompletion and validation
Generate your context file by running:
ctx
The tool will process your configuration and create the specified output file (auth-context.md
in our example).
Tip: Configure Logging with
-v
,-vv
, or-vvv
for detailed output
Upload or paste the generated context file to your favorite LLM (like ChatGPT or Claude). Now you can ask specific questions about your codebase, and the LLM will have the necessary context to provide accurate assistance.
Example prompt:
I've shared my authentication system code with you. Can you help me identify potential security vulnerabilities in the user registration process?
Next steps: Check out Development with Context Generator for best practices on integrating context generation into your AI-powered development workflow.
That's it! You're now ready to leverage LLMs with proper context about your codebase.
For a more seamless experience, you can connect Context Generator directly to Claude AI using the MCP server:
There is a built-in MCP server that allows you to connect Claude AI directly to your codebase.
Point the MCP client to the Context Generator server:
{
"mcpServers": {
"ctx": {
"command": "ctx server -c /path/to/your/project"
}
}
}
Note: Read more about MCP Server for detailed setup instructions.
Now you can ask Claude questions about your codebase without manually uploading context files!
For better editing experience, Context Generator provides a JSON schema for autocompletion and validation in your IDE:
# Show schema URL
ctx schema
# Download schema to current directory
ctx schema --download
Learn more: See IDE Integration for detailed setup instructions for VSCode, PhpStorm, and other editors.
For complete documentation, including all available features and configuration options, please visit:
This project is licensed under the MIT License.
For Tasks:
Click tags to check more tools for each tasksFor Jobs:
Alternative AI tools for generator
Similar Open Source Tools

Local-File-Organizer
The Local File Organizer is an AI-powered tool designed to help users organize their digital files efficiently and securely on their local device. By leveraging advanced AI models for text and visual content analysis, the tool automatically scans and categorizes files, generates relevant descriptions and filenames, and organizes them into a new directory structure. All AI processing occurs locally using the Nexa SDK, ensuring privacy and security. With support for multiple file types and customizable prompts, this tool aims to simplify file management and bring order to users' digital lives.

langmanus
LangManus is a community-driven AI automation framework that combines language models with specialized tools for tasks like web search, crawling, and Python code execution. It implements a hierarchical multi-agent system with agents like Coordinator, Planner, Supervisor, Researcher, Coder, Browser, and Reporter. The framework supports LLM integration, search and retrieval tools, Python integration, workflow management, and visualization. LangManus aims to give back to the open-source community and welcomes contributions in various forms.

ChatGPT-desktop
ChatGPT Desktop Application is a multi-platform tool that provides a powerful AI wrapper for generating text. It offers features like text-to-speech, exporting chat history in various formats, automatic application upgrades, system tray hover window, support for slash commands, customization of global shortcuts, and pop-up search. The application is built using Tauri and aims to enhance user experience by simplifying text generation tasks. It is available for Mac, Windows, and Linux, and is designed for personal learning and research purposes.

swark
Swark is a VS Code extension that automatically generates architecture diagrams from code using large language models (LLMs). It is directly integrated with GitHub Copilot, requires no authentication or API key, and supports all languages. Swark helps users learn new codebases, review AI-generated code, improve documentation, understand legacy code, spot design flaws, and gain test coverage insights. It saves output in a 'swark-output' folder with diagram and log files. Source code is only shared with GitHub Copilot for privacy. The extension settings allow customization for file reading, file extensions, exclusion patterns, and language model selection. Swark is open source under the GNU Affero General Public License v3.0.

any-parser
AnyParser provides an API to accurately extract unstructured data (e.g., PDFs, images, charts) into a structured format. Users can set up their API key, run synchronous and asynchronous extractions, and perform batch extraction. The tool is useful for extracting text, numbers, and symbols from various sources like PDFs and images. It offers flexibility in processing data and provides immediate results for synchronous extraction while allowing users to fetch results later for asynchronous and batch extraction. AnyParser is designed to simplify data extraction tasks and enhance data processing efficiency.

sd-webui-agent-scheduler
AgentScheduler is an Automatic/Vladmandic Stable Diffusion Web UI extension designed to enhance image generation workflows. It allows users to enqueue prompts, settings, and controlnets, manage queued tasks, prioritize, pause, resume, and delete tasks, view generation results, and more. The extension offers hidden features like queuing checkpoints, editing queued tasks, and custom checkpoint selection. Users can access the functionality through HTTP APIs and API callbacks. Troubleshooting steps are provided for common errors. The extension is compatible with latest versions of A1111 and Vladmandic. It is licensed under Apache License 2.0.

middleware
Middleware is an open-source engineering management tool that helps engineering leaders measure and analyze team effectiveness using DORA metrics. It integrates with CI/CD tools, automates DORA metric collection and analysis, visualizes key performance indicators, provides customizable reports and dashboards, and integrates with project management platforms. Users can set up Middleware using Docker or manually, generate encryption keys, set up backend and web servers, and access the application to view DORA metrics. The tool calculates DORA metrics using GitHub data, including Deployment Frequency, Lead Time for Changes, Mean Time to Restore, and Change Failure Rate. Middleware aims to provide DORA metrics to users based on their Git data, simplifying the process of tracking software delivery performance and operational efficiency.

gitdiagram
GitDiagram is a tool that turns any GitHub repository into an interactive diagram for visualization in seconds. It offers instant visualization, interactivity, fast generation, customization, and API access. The tool utilizes a tech stack including Next.js, FastAPI, PostgreSQL, Claude 3.5 Sonnet, Vercel, EC2, GitHub Actions, PostHog, and Api-Analytics. Users can self-host the tool for local development and contribute to its development. GitDiagram is inspired by Gitingest and has future plans to use larger context models, allow user API key input, implement RAG with Mermaid.js docs, and include font-awesome icons in diagrams.

inspector-laravel
Inspector is a code execution monitoring tool specifically designed for Laravel applications. It provides simple and efficient monitoring capabilities to track and analyze the performance of your Laravel code. With Inspector, you can easily monitor web requests, test the functionality of your application, and explore data through a user-friendly dashboard. The tool requires PHP version 7.2.0 or higher and Laravel version 5.5 or above. By configuring the ingestion key and attaching the middleware, users can seamlessly integrate Inspector into their Laravel projects. The official documentation provides detailed instructions on installation, configuration, and usage of Inspector. Contributions to the tool are welcome, and users are encouraged to follow the Contribution Guidelines to participate in the development of Inspector.

DevDocs
DevDocs is a platform designed to simplify the process of digesting technical documentation for software engineers and developers. It automates the extraction and conversion of web content into markdown format, making it easier for users to access and understand the information. By crawling through child pages of a given URL, DevDocs provides a streamlined approach to gathering relevant data and integrating it into various tools for software development. The tool aims to save time and effort by eliminating the need for manual research and content extraction, ultimately enhancing productivity and efficiency in the development process.

maige
Maige is a tool designed to simplify repository maintenance by automating the handling of issue labels. Users can quickly set up Maige to let AI manage their issue labels effortlessly. The tool provides guidance on self-hosting, GitHub app integration, environment variables setup, and offers commands for streamlined issue management. Maige aims to streamline the process of managing issues in a repository, making it easier for users to handle tasks related to labeling and tracking issues.

atidraw
Atidraw is a web application that allows users to create, enhance, and share drawings using Cloudflare R2 and Cloudflare AI. It features intuitive drawing with signature_pad, AI-powered enhancements such as alt text generation and image generation with Stable Diffusion, global storage on Cloudflare R2, flexible authentication options, and high-performance server-side rendering on Cloudflare Pages. Users can deploy Atidraw with zero configuration on their Cloudflare account using NuxtHub.

RainbowGPT
RainbowGPT is a versatile tool that offers a range of functionalities, including Stock Analysis for financial decision-making, MySQL Management for database navigation, and integration of AI technologies like GPT-4 and ChatGlm3. It provides a user-friendly interface suitable for all skill levels, ensuring seamless information flow and continuous expansion of emerging technologies. The tool enhances adaptability, creativity, and insight, making it a valuable asset for various projects and tasks.