🦾 Overview · 🧠 Why Use Cypher · ✨ Features · 🚀 How It Works · 🧩 Method · 🛠️ How to Use · 📚 Examples · 📄 Template · 📄 License · 🤝 Contribution
Cypher is an AI-powered code summarizer tailored for efficient navigation of large codebases. Using a dedicated Modelfile, Cypher captures essential code relationships and dependencies, generating optimized, architecture-aware summaries that enable AI to offer insightful support for architectural decisions without analyzing the entire source code.
- 🦊 Unique Summarization Method: Uses a specialized approach that organizes summaries by focusing on roles, interfaces, dependencies, and execution flow.
- 💻 Token-Efficient: Optimizes prompt size, allowing AI models to handle extensive projects.
- 🧩 Architectural Insight: Captures essential code relationships and dependencies, enhancing AI's decision-making.
- 🌐 Flexible: Works with projects of any size, from small modules to large enterprise systems.
- ⏲️ Time-Saving: Automates summarization to provide critical context with minimal user input.
- 🧬 Token-Efficient Summarization: Generates summaries within LLM token limits, retaining essential architectural context.
- 🛠️ Architecture-Aware Analysis: Identifies code relationships and dependencies for high-level insights.
- 🔗 Versatile Usage: Operates as both a custom Modelfile and a flexible prompt for any LLM.
- 🔎 Decision Support: Empowers LLMs to offer informed suggestions without requiring the entire codebase.
- Input Code 📄: Cypher is provided with the project code, focusing on architecture and structure.
- Summarization Process 🧬: Cypher analyzes code, creating a structured summary of relationships and dependencies.
- Model File or Prompt Generation 🦾: This summary serves as a Modelfile or prompt, delivering a comprehensive project overview.
- AI-Enhanced Insights 🧠✨: With Cypher's summary, AI offers targeted advice without the full code, ideal for architecture decisions.
Cypher uses a unique and original Integrated Summarization Method that combines multiple summarization techniques to provide a multi-layered, concise overview of complex codebases. This method organizes the summary by focusing on Roles, Interfaces, Dependencies, Execution Flow, and Hierarchy, creating a comprehensive yet token-efficient representation.
- 🦊 Role-Based Overview and Dependencies: Groups code into functional roles, summarizing each file’s purpose and listing primary dependencies.
- 🔍 Interface Summarization: Lists key functions, their parameters, return types, and dependencies to show how each function interfaces with others.
- 🔄 Execution Flow Summary: Provides a step-by-step breakdown of the application’s execution flow, illustrating module interactions.
- 📊 Dependency Graph and Hierarchical Structure: Visualizes file dependencies and organizes the project hierarchy, showing modularity and connections.
- 💡 Comment Extraction and Key Logic Details: Highlights important comments, constants, unique logic, and edge-case handling, capturing key design decisions.
This approach integrates multiple summarization techniques for a comprehensive, structured overview of the codebase.
Cypher smartly summarizes your code, providing a concise output for further use with any LLM of your choice.
Choose the code or snippet you’d like summarized. Cypher will analyze it and generate an efficient overview.
Clone the Cypher repository:
git clone https://github.com/lucianoayres/cypher.git
cd cypherEnsure Ollama is installed, then create the Cypher model:
ollama create cypher -f ./modelfiles/Cypher1.0Execute Cypher to generate a summary of your code:
ollama run cypherProvide the source code when prompted. Cypher will process the code and output a smart summary, completing its task.
To save the Cypher output automatically, use Nino. This allows you to save the summary locally for easy reference.
Find various sample source code files in different programming languages in the examples. These samples help you easily evaluate how Cypher handles different languages and coding styles.
Users can utilize these example files as prompts for Cypher to generate summaries. Below are sample commands using the Nino CLI:
nino -model cypher -prompt-file ./examples/text_to_morse.pynino -model cypher -prompt-file ./examples/Payment.javanino -model cypher -prompt-file ./examples/tic-tac-toe.jsnino -model cypher -prompt-file ./examples/TaskTrackerApp.csTo achieve more accurate summaries, follow these guidelines:
📝 Use Specific Code Snippets: Instead of submitting entire files or projects, provide focused code snippets that highlight the areas you want to summarize.
📂 Handle Large Files Appropriately: If a source file is too large, extract the relevant parts and save them in a separate text file. Use this smaller file as the input prompt for the model.
🧩 Break Down Extensive Codebases: Divide large codebases into smaller, manageable sections. Process each section in separate interactions with Cypher to ensure detailed and precise analysis without overwhelming the system.
💡 HINT: Use Taco 🌮 to selectively choose source code project files and merge them into a single text file. This makes it easy to create prompts for Cypher with specific files from your project, enhancing the efficiency of your summarization process.
Cypher's primary focus is the Cypher Modelfile, but prompt examples for usage are available in the prompts directory. These templates offer guidance for crafting tailored summaries and help illustrate Cypher’s flexibility.
Structure:
- Objective and Rules 📜: Defines the summary purpose and guidelines to ensure effective analysis.
- Command Specification 🛠️: Core Modelfile commands, such as:
- META: Adds metadata and model info.
- FROM: Specifies the base model (e.g.,
llama3.2). - PARAMETER: Sets key parameters for summary generation.
- SYSTEM: Sets the model system prompt.
- MESSAGE: Provides initial prompts for effective summarization.
- LICENSE: Includes licensing details.
Looking to build your own AI models? Use Modelzilla 🦖 to effortlessly generate customized Modelfiles.
Cypher is licensed under the MIT License. See the LICENSE file for more details.
Your input is welcome! Feel free to open an issue or submit a pull request with suggestions, improvements, or new features.
