{"id":23099737,"url":"https://github.com/brandondocusen/cntxtcs","last_synced_at":"2025-05-05T18:47:30.773Z","repository":{"id":264989302,"uuid":"894814523","full_name":"brandondocusen/CntxtCS","owner":"brandondocusen","description":"A lightweight tool to optimize your C# project for LLM context windows by using a knowledge graph | Code structure visualization | Static analysis for AI | Large Language Model tooling | .NET ecosystem support  #LLM #AI #CSharp #DotNet #CodeAnalysis #ContextWindow #DeveloperTools","archived":false,"fork":false,"pushed_at":"2024-12-03T05:57:57.000Z","size":59,"stargazers_count":24,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T22:51:15.340Z","etag":null,"topics":["architecture-insights","code-documentation","code-visualization","codebase-analysis","context-management","context-window","csharp","dependency-analysis","dependency-mapping","developer-tools","dotnet","knowledge-graph","large-language-models","llm","llm-integration","machine-learning","module-relationships","open-source","python","token-reduction"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brandondocusen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T03:26:57.000Z","updated_at":"2024-12-07T00:18:08.000Z","dependencies_parsed_at":"2024-11-27T14:15:58.527Z","dependency_job_id":null,"html_url":"https://github.com/brandondocusen/CntxtCS","commit_stats":null,"previous_names":["brandondocusen/cntxtcs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandondocusen%2FCntxtCS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandondocusen%2FCntxtCS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandondocusen%2FCntxtCS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandondocusen%2FCntxtCS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandondocusen","download_url":"https://codeload.github.com/brandondocusen/CntxtCS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252556009,"owners_count":21767276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture-insights","code-documentation","code-visualization","codebase-analysis","context-management","context-window","csharp","dependency-analysis","dependency-mapping","developer-tools","dotnet","knowledge-graph","large-language-models","llm","llm-integration","machine-learning","module-relationships","open-source","python","token-reduction"],"created_at":"2024-12-16T23:20:37.051Z","updated_at":"2025-05-05T18:47:30.756Z","avatar_url":"https://github.com/brandondocusen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 CntxtCS: Minify Your C# Codebase Context for LLMs\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n\u003e 🤯 **75% Token Reduction In LLM Context Window Usage!** \n\n## Why CntxtCS?\n\n-  Boosts precision: Maps relationships and dependencies for clear analysis.\n-  Eliminates noise: Focuses LLMs on key code insights.\n-  Supports analysis: Reveals architecture for smarter LLM insights.\n-  Speeds solutions: Helps LLMs trace workflows and logic faster.\n-  Improves recommendations: Gives LLMs detailed metadata for better suggestions.\n-  Optimized prompts: Provides structured context for better LLM responses.\n-  Streamlines collaboration: Helps LLMs explain and document code easily.\n\nSupercharge your LLM's understanding of your C# codebases. CntxtCS generates comprehensive knowledge graphs that help LLMs navigate and comprehend your code structure with ease.\n\nIt's like handing your LLM the cliff notes instead of a novel.\n\n## **Active Enhancement Notice**\n\n- CntxtCS is **actively being enhanced at high velocity with improvements every day**. Thank you for your contributions! 🙌\n\n## ✨ Features\n\n- 🔍 Deep analysis of C# codebases\n- 📊 Generates detailed knowledge graphs of:\n  - File relationships and dependencies\n  - Class hierarchies and methods\n  - Method signatures and parameters\n  - Namespace structures\n  - Using statements and references\n  - NuGet package dependencies\n  - Attributes and interfaces\n- 🎯 Specially designed for LLM context windows\n- 📈 Built-in visualization capabilities of your project's knowledge graph\n- 🚀 Support for modern .NET frameworks and patterns\n\n## 🚀 Quick Start\n\n```bash\n# Clone the repository\ngit clone https://github.com/brandondocusen/CntxtCS.git\n\n# Navigate to the directory\ncd CntxtCS\n\n# Run the Python file\npython CntxtCS.py\n```\n\nWhen prompted, enter the path to your C# solution or project file. The tool will generate a `csharp_code_knowledge_graph.json` file and offer to visualize the relationships.\n\n## 💡 Example Usage with LLMs\n\nThe LLM can now provide detailed insights about your codebase's implementations, understanding the relationships between components, classes, and namespaces! After generating your knowledge graph, you can upload it as a single file to give LLMs deep context about your codebase. Here's a powerful example prompt:\n\n```Prompt Example\nBased on the knowledge graph, explain how the service layer is implemented in this application, including which classes and methods are involved in the process.\n```\n\n```Prompt Example\nBased on the knowledge graph, map out the core namespace structure - starting from the main application through to the different modules and their interactions.\n```\n\n```Prompt Example\nUsing the knowledge graph, analyze the dependency injection approach in this application. Which services exist, what do they manage, and how do they interact with components?\n```\n\n```Prompt Example\nFrom the knowledge graph data, break down this application's controller hierarchy, focusing on API endpoints and their implementation patterns.\n```\n\n```Prompt Example\nAccording to the knowledge graph, identify all exception handling patterns in this codebase - where are exceptions caught, how are they processed, and how are they handled?\n```\n\n```Prompt Example\nBased on the knowledge graph's dependency analysis, outline the key NuGet packages this project relies on and their primary use cases in the application.\n```\n\n```Prompt Example\nUsing the knowledge graph's method analysis, explain how the application handles Entity Framework Core interactions and transaction patterns across different services.\n```\n\n## 📊 Output Format\n\nThe tool generates two main outputs:\n1. A JSON knowledge graph (`csharp_code_knowledge_graph.json`)\n2. Optional visualization using GraphViz\n\nThe knowledge graph includes:\n- Detailed metadata about your codebase\n- Node and edge relationships\n- Method parameters and return types\n- Class hierarchies\n- Using statement mappings\n- Namespace structures\n\n## 🤝 Contributing\n\nWe love contributions! Whether it's:\n- 🐛 Bug fixes\n- ✨ New features\n- 📚 Documentation improvements\n- 🎨 Visualization enhancements\n\nJust fork, make your changes, and submit a PR. Check out our [contribution guidelines](CONTRIBUTING.md) for more details.\n\n## 🎯 Future Goals\n\n- [ ] Deeper support for additional frameworks\n- [ ] Enhanced attribute processing\n- [ ] Interactive web-based visualizations\n- [ ] Custom graph export formats\n- [ ] Integration with Visual Studio and Rider\n- [ ] Support for file-scoped namespaces and global using statements\n\n## 📝 License\n\nMIT License - feel free to use this in your own projects!\n\n## 🌟 Show Your Support\n\nIf you find CntxtCS helpful, give it a star! ⭐️ \n\n---\n\nMade with ❤️ for the LLM and .NET communities\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandondocusen%2Fcntxtcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandondocusen%2Fcntxtcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandondocusen%2Fcntxtcs/lists"}