{"id":18185274,"url":"https://github.com/lucianoayres/cypher","last_synced_at":"2025-07-29T16:05:17.342Z","repository":{"id":260800977,"uuid":"882357587","full_name":"lucianoayres/cypher","owner":"lucianoayres","description":"Cypher is an AI model that creates optimized summaries of source code, reducing prompt size and saving tokens when submitting to LLMs. By leveraging Ollama, Cypher captures essential relationships and dependencies, enabling efficient, architecture-aware insights with ease.","archived":false,"fork":false,"pushed_at":"2024-11-09T09:38:08.000Z","size":8461,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T15:30:49.427Z","etag":null,"topics":["ai","coding","llama","llm","modelfile","ollama","prompt-engineering"],"latest_commit_sha":null,"homepage":"","language":null,"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/lucianoayres.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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-02T16:04:08.000Z","updated_at":"2024-11-09T09:38:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6f765b1-dafd-453e-a139-a5ba57f01778","html_url":"https://github.com/lucianoayres/cypher","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"6c5676e4d62ef9900dc460ca78bdbc9e23c111e1"},"previous_names":["lucianoayres/cypher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucianoayres%2Fcypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucianoayres%2Fcypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucianoayres%2Fcypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucianoayres%2Fcypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucianoayres","download_url":"https://codeload.github.com/lucianoayres/cypher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247655371,"owners_count":20974165,"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":["ai","coding","llama","llm","modelfile","ollama","prompt-engineering"],"created_at":"2024-11-02T23:00:22.609Z","updated_at":"2025-04-07T12:43:42.634Z","avatar_url":"https://github.com/lucianoayres.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦊 Cypher\n\n![Cypher Banner](https://github.com/lucianoayres/cypher/blob/main/images/banner_cypher.png?raw=true)\n\n## Smart Code Summaries for Token-Efficient LLM Power\n\n[🦾 Overview](#overview) · [🧠 Why Use Cypher](#why-use-cypher) · [✨ Features](#features) · [🚀 How It Works](#how-it-works) · [🧩 Method](#method) · [🛠️ How to Use](#how-to-use) · [📚 Examples](#examples) · [📄 Template](#template-) · [📄 License](#license) · [🤝 Contribution](#contribution)\n\n---\n\n### 🦾 Overview\n\nCypher is an AI-powered code summarizer tailored for efficient navigation of large codebases. Using a dedicated [Modelfile](./modelfiles/Cypher1.0), 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.\n\n### 🧠 Why Use Cypher\n\n-   🦊 **Unique Summarization Method**: Uses a specialized approach that organizes summaries by focusing on roles, interfaces, dependencies, and execution flow.\n-   💻 **Token-Efficient**: Optimizes prompt size, allowing AI models to handle extensive projects.\n-   🧩 **Architectural Insight**: Captures essential code relationships and dependencies, enhancing AI's decision-making.\n-   🌐 **Flexible**: Works with projects of any size, from small modules to large enterprise systems.\n-   ⏲️ **Time-Saving**: Automates summarization to provide critical context with minimal user input.\n\n### ✨ Features\n\n-   🧬 **Token-Efficient Summarization**: Generates summaries within LLM token limits, retaining essential architectural context.\n-   🛠️ **Architecture-Aware Analysis**: Identifies code relationships and dependencies for high-level insights.\n-   🔗 **Versatile Usage**: Operates as both a custom Modelfile and a flexible prompt for any LLM.\n-   🔎 **Decision Support**: Empowers LLMs to offer informed suggestions without requiring the entire codebase.\n\n---\n\n### 🚀 How It Works\n\n1. **Input Code** 📄: Cypher is provided with the project code, focusing on architecture and structure.\n2. **Summarization Process** 🧬: Cypher analyzes code, creating a structured summary of relationships and dependencies.\n3. **Model File or Prompt Generation** 🦾: This summary serves as a Modelfile or prompt, delivering a comprehensive project overview.\n4. **AI-Enhanced Insights** 🧠✨: With Cypher's summary, AI offers targeted advice without the full code, ideal for architecture decisions.\n\n---\n\n### 🧩 Method\n\nCypher 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.\n\n-   🦊 **Role-Based Overview and Dependencies**: Groups code into functional roles, summarizing each file’s purpose and listing primary dependencies.\n-   🔍 **Interface Summarization**: Lists key functions, their parameters, return types, and dependencies to show how each function interfaces with others.\n-   🔄 **Execution Flow Summary**: Provides a step-by-step breakdown of the application’s execution flow, illustrating module interactions.\n-   📊 **Dependency Graph and Hierarchical Structure**: Visualizes file dependencies and organizes the project hierarchy, showing modularity and connections.\n-   💡 **Comment Extraction and Key Logic Details**: Highlights important comments, constants, unique logic, and edge-case handling, capturing key design decisions.\n\nThis approach integrates multiple summarization techniques for a comprehensive, structured overview of the codebase.\n\n---\n\n### 🛠️ How to Use\n\nCypher smartly summarizes your code, providing a concise output for further use with any LLM of your choice.\n\n#### 1. Select Your Source Code\n\nChoose the code or snippet you’d like summarized. Cypher will analyze it and generate an efficient overview.\n\n#### 2. Clone the Cypher Repository\n\nClone the Cypher repository:\n\n```bash\ngit clone https://github.com/lucianoayres/cypher.git\ncd cypher\n```\n\n#### 3. Set Up the Cypher Modelfile\n\nEnsure [Ollama](https://github.com/ollama/ollama) is installed, then create the Cypher model:\n\n```bash\nollama create cypher -f ./modelfiles/Cypher1.0\n```\n\n#### 4. Run Cypher\n\nExecute Cypher to generate a summary of your code:\n\n```bash\nollama run cypher\n```\n\n#### 5. Input Your Code\n\nProvide the source code when prompted. Cypher will process the code and output a smart summary, completing its task.\n\n#### 6. Save the Summary (Optional)\n\nTo save the Cypher output automatically, use [Nino](https://github.com/lucianoayres/nino-cli). This allows you to save the summary locally for easy reference.\n\n---\n\n### 📚 Examples\n\nFind various sample source code files in different programming languages [in the examples](./examples). These samples help you easily evaluate how Cypher handles different languages and coding styles.\n\n#### Using Examples with Nino CLI\n\nUsers can utilize these example files as prompts for Cypher to generate summaries. Below are sample commands using the [Nino CLI](https://github.com/lucianoayres/nino-cli):\n\n##### Python Example:\n\n```bash\nnino -model cypher -prompt-file ./examples/text_to_morse.py\n```\n\n##### Java Example:\n\n```bash\nnino -model cypher -prompt-file ./examples/Payment.java\n```\n\n##### JavaScript Example:\n\n```bash\nnino -model cypher -prompt-file ./examples/tic-tac-toe.js\n```\n\n##### C# Example:\n\n```bash\nnino -model cypher -prompt-file ./examples/TaskTrackerApp.cs\n```\n\n### 🚀 Recommendations for Better Results\n\nTo achieve more accurate summaries, follow these guidelines:\n\n📝 **Use Specific Code Snippets**: Instead of submitting entire files or projects, provide focused code snippets that highlight the areas you want to summarize.\n\n📂 **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.\n\n🧩 **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.\n\n💡 **HINT**: Use [**Taco**](https://github.com/lucianoayres/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.\n\n### Template 📄\n\nCypher's primary focus is the [Cypher Modelfile](./modelfiles/Cypher1.0), but prompt examples for usage are available in the [prompts directory](./prompts). These templates offer guidance for crafting tailored summaries and help illustrate Cypher’s flexibility.\n\n**Structure**:\n\n1. **Objective and Rules** 📜: Defines the summary purpose and guidelines to ensure effective analysis.\n2. **Command Specification** 🛠️: Core Modelfile commands, such as:\n    - **META**: Adds metadata and model info.\n    - **FROM**: Specifies the base model (e.g., `llama3.2`).\n    - **PARAMETER**: Sets key parameters for summary generation.\n    - **SYSTEM**: Sets the model system prompt.\n    - **MESSAGE**: Provides initial prompts for effective summarization.\n    - **LICENSE**: Includes licensing details.\n\n---\n\n### 🦖 Create Custom AI Models with Modelzilla\n\nLooking to build your own AI models? Use [**Modelzilla**](https://github.com/lucianoayres/modelzilla) 🦖 to effortlessly generate customized Modelfiles.\n\n---\n\n### 📄 License\n\nCypher is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n---\n\n### 🤝 Contribution\n\nYour input is welcome! Feel free to open an issue or submit a pull request with suggestions, improvements, or new features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucianoayres%2Fcypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucianoayres%2Fcypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucianoayres%2Fcypher/lists"}