|
1 | | -# ctx: The missing link between your codebase and your LLM. Context as Code (CaC) tool with MCP server inside. |
| 1 | +# CTX: The missing link between your codebase and your LLM. |
2 | 2 |
|
3 | 3 | <p> |
4 | 4 | <a href="https://docs.ctxgithub.com/"><img alt="Docs" src="https://img.shields.io/badge/docs-green"></a> |
|
12 | 12 |
|
13 | 13 | ## Table of Contents |
14 | 14 |
|
15 | | -- [How it works](#how-it-works) |
16 | 15 | - [Quick Start](#quick-start) |
17 | | -- [Full Documentation](#full-documentation) |
| 16 | +- [Full Documentation](https://docs.ctxgithub.com) |
18 | 17 | - [License](#license) |
19 | 18 |
|
20 | | -**CTX** is a tool made to solve a big problem when chatting with LLMs like ChatGPT or Claude: **giving them enough |
21 | | -context about your project**. |
| 19 | +During development, your codebase constantly evolves. Files are added, modified, and removed. Each time you need to |
| 20 | +continue working with an LLM, you need to regenerate context to provide updated information about your current codebase |
| 21 | +state. |
22 | 22 |
|
23 | | -> There is an article about Context Generator |
24 | | -> on [Medium](https://medium.com/p/ef72df0f83d1) that explains the |
25 | | -> motivation behind the project and the problem it solves. |
| 23 | +**CTX** helps developers organize contexts and automatically collect information from their codebase into structured |
| 24 | +documents that can be easily shared with LLM. |
26 | 25 |
|
27 | | -When you're using AI in development, context isn't just helpful — it's everything. |
28 | | -Instead of manually copying or explaining your entire codebase each time, ctx automatically builds neat, organized |
29 | | -context files from: |
| 26 | +For example, a developer describes what context they need: |
30 | 27 |
|
31 | | -- Code files, |
32 | | -- GitHub and Gitlab repositories, |
33 | | -- Git commits and diffs |
34 | | -- Web pages (URLs) with CSS selectors, |
35 | | -- MCP servers |
36 | | -- and plain text. |
| 28 | +```yaml |
| 29 | +# context.yaml |
| 30 | +documents: |
| 31 | + - description: User Authentication System |
| 32 | + outputPath: auth.md |
| 33 | + sources: |
| 34 | + - type: file |
| 35 | + description: Authentication Controllers |
| 36 | + sourcePaths: |
| 37 | + - src/Auth |
| 38 | + filePattern: "*.php" |
| 39 | + |
| 40 | + - type: file |
| 41 | + description: Authentication Models |
| 42 | + sourcePaths: |
| 43 | + - src/Models |
| 44 | + filePattern: "*User*.php" |
| 45 | + |
| 46 | + - description: Another Document |
| 47 | + outputPath: another-document.md |
| 48 | + sources: |
| 49 | + - type: file |
| 50 | + sourcePaths: |
| 51 | + - src/SomeModule |
| 52 | +``` |
| 53 | +
|
| 54 | +This configuration will gather all PHP files from the `src/Auth` directory and any PHP files containing "**User**" in |
| 55 | +their name from the `src/Models` directory into a single context file `.context/auth.md`. This file can then be pasted |
| 56 | +into a chat session or provided via the built-in [MCP server](https://docs.ctxgithub.com/mcp/). |
| 57 | + |
| 58 | +### How it works |
| 59 | + |
| 60 | +**CTX automatically builds structured context documents from:** |
| 61 | + |
| 62 | +- [Code files and directories](https://docs.ctxgithub.com/sources/file-source.html) |
| 63 | +- [GitHub repositories](https://docs.ctxgithub.com/sources/github-source.html) |
| 64 | +- [Git commit changes and diffs](https://docs.ctxgithub.com/sources/git-diff-source.html) |
| 65 | +- W[eb pages (URLs) with CSS selectors](https://docs.ctxgithub.com/sources/url-source.html) |
| 66 | +- Plain text |
| 67 | +- and more! |
37 | 68 |
|
38 | | -It was created to solve a common problem: **efficiently providing AI language models like Claude with necessary |
39 | | -context about your codebase.** |
| 69 | +**Process:** |
40 | 70 |
|
41 | | -## How it works |
| 71 | +- Collects code from specified sources |
| 72 | +- Filters files through pattern matching, content search, size, or date criteria |
| 73 | +- Applies modifiers (e.g., extracting function signatures without implementation) |
| 74 | +- Organizes content into structured markdown documents |
| 75 | +- Saves context files ready for LLM consumption |
| 76 | +- Optionally serves context through MCP server for direct AI assistant access |
42 | 77 |
|
43 | | -1. Gathers code from files, directories, GitHub or Gitlab repositories, web pages, or plain text. |
44 | | -2. Targets specific files through pattern matching, content search, size, or date filters |
45 | | -3. Applies optional modifiers (like extracting PHP signatures without implementation details) |
46 | | -4. Organizes content into well-structured markdown documents |
47 | | -5. Saves context files ready to be shared with LLMs |
48 | | -6. Optionally serves context through an MCP server, allowing AI assistants like Claude to directly access project |
49 | | - information |
| 78 | +> Here is a [Quickstart guide](https://docs.ctxgithub.com/quick-start.html) to get you started with CTX. |
| 79 | + |
| 80 | +### The Problem CTX Solves |
| 81 | + |
| 82 | +**Without such a tool, you would need to:** |
| 83 | + |
| 84 | +- Manually search for all files that were changed |
| 85 | +- Copy their contents each time |
| 86 | +- Explain the codebase structure repeatedly |
| 87 | +- Spend significant time maintaining context consistency |
| 88 | + |
| 89 | +This repetitive process becomes frustrating and can discourage continued development, as you end up doing the same |
| 90 | +context-gathering work over and over instead of writing code. |
| 91 | + |
| 92 | +Since CTX describes contexts, this process becomes automated. |
| 93 | + |
| 94 | +--- |
50 | 95 |
|
51 | | -# Quick Start |
| 96 | +## Quick Start |
52 | 97 |
|
53 | 98 | Getting started with CTX is straightforward. Follow these simple steps to create your first context file. |
54 | 99 |
|
|
0 commit comments