Skip to main content

The Context Engine for AI Coding: Persistent incremental knowledge graph for token-efficient, context-aware reviews

Project description

Kinrg Logo

Kinrg: The Intelligence OS for Code Context

"Stop letting AI guess. Let AI truly understand your codebase."

Website PyPI Stars MIT License


🌑 The Problem: AI is lost in your code

Most current AI tools read code linearly. In a large project (Monorepo), AI faces three hurdles:

  1. Noise: Reading thousands of irrelevant lines, wasting tokens.
  2. Oversight: Missing critical dependencies located in other files.
  3. Hallucination: Providing incorrect solutions due to a lack of overall architectural understanding.

🔥 The Breakthrough: Graph Intelligence Layer

kinrg is a Context Engine that transforms your source code into a living Knowledge Graph. It allows your AI Agent to "see":

  • Blast Radius: Precisely identify the impact zone of any code change.
  • Logic Flows: Understand how data flows from entry points to core logic.
  • Smart Pruning: Automatically strip away 95% of context noise so AI focuses on the right issue.

💎 Core Pillars

🚀 ULTIMATE PERFORMANCE 🧠 DEEP AST TECHNOLOGY 🌐 OPEN ECOSYSTEM
Save up to 27x Tokens through intelligent context filtering, sending only what truly matters. Powered by Tree-sitter to understand source code like a real compiler (19+ languages). Automatic MCP configuration for Cursor, Claude Code, Windsurf, Zed, Continue, and OpenCode.
Updates in < 2s even for projects with thousands of files, thanks to incremental algorithms. Hybrid Search: The perfect blend of Keyword (FTS5) and Semantic Vector Search (Embeddings). Deeply integrated into Anthropic's Model Context Protocol (MCP).

🔌 Supported AI Ecosystem

With a single kinrg install command, you can upgrade the intelligence of: CursorClaude CodeWindsurfZedContinueOpenCodeAntigravity


⚙️ Installation & Setup

1. Requirements

  • Python: Version 3.10 or higher.
  • IDEs: Best compatible with tools supporting MCP (Cursor, Claude Code, etc.)

2. Installation Methods

You can install kinrg flexibly via popular package managers:

# Standard installation via pip
pip install kinrg

# Install via pipx (Recommended to avoid dependency conflicts)
pipx install kinrg

# Use uv for maximum installation performance
uv tool install kinrg

3. Advanced Features (Optional)

Unlock the full power of kinrg by installing extension modules:

# Enable Semantic Search (Vector Embeddings)
pip install "kinrg[embeddings]"

# Enable Community & Module Structure Analysis
pip install "kinrg[communities]"

# Enable Automated Wiki Documentation (requires LLM summaries)
pip install "kinrg[wiki]"

# Install all features in a single command
pip install "kinrg[all]"

4. Connect to your AI Editor

Use the install command to let kinrg automatically detect your installed IDEs and configure the MCP Server:

kinrg install

Note: To configure for a specific platform, use: kinrg install --platform [cursor|claude-code|zed|...].


💡 First-time Usage Guide

To get started, open your project in an IDE (like Cursor or VS Code) and follow these steps:

  1. Build the Graph: Type in your AI chat: "Build the source code graph using kinrg".
  2. Review Code: When you have new changes, ask: "Review my latest changes using kinrg".
  3. Search: "Find all functions related to login using semantic search".

kinrg will run in the background, providing all necessary data for the AI to work with maximum accuracy.


🛠️ Comprehensive Intelligence: 26 MCP Tools

Your AI Agent will automatically utilize these 26 specialized tools to assist with every programming task:

🔍 Analysis & Review (Review & Impact)

  • audit_diff_tool: Risk analysis and precise change boundary identification based on Git diff.
  • trace_impact_tool: Precisely identify the "impact radius" of code changes (Blast Radius).
  • prepare_review_tool: Provide optimized code snippets for AI review, saving tokens.
  • quick_brief_tool: Retrieve hyper-compressed context (~100 tokens) for any task.
  • check_complexity_tool: Detect functions/classes that are too complex based on line count.

🌐 Search & Graph (Search & Query)

  • smart_search_tool: Search code using natural language or meaning (Vector Search).
  • inspect_relationships_tool: Query Callers, Callees, Imports, Tests, and Inheritance.
  • global_search_tool: Search source code across multiple registered projects simultaneously.
  • fetch_stats_tool: View detailed statistics on node counts, edges, and languages.

🌊 Execution Flow

  • explore_flows_tool: List major execution flows (Entry points) sorted by criticality.
  • detail_flow_tool: Step-by-step trace of a specific source code flow.
  • check_damaged_flows_tool: Find user flows directly affected by the code you just modified.

🏛️ Architecture & Community

  • generate_blueprint_tool: Overview architecture map and coupling dependency warnings.
  • cluster_modules_tool: Automatically cluster source code into logic modules (Leiden algorithm).
  • inspect_module_tool: View the boundaries and members of a specific code cluster.

📝 Documentation & Resources (Docs & Wiki)

  • build_wiki_tool: Automatically generate a full Markdown Wiki for the project from the graph.
  • read_wiki_tool: Retrieve documentation content for a specific module.
  • read_manual_tool: Quickly access technical documentation sections for kinrg.

🔧 Refactor & Database

  • refactor_advisor_tool: Preview wide-reaching renames and detect dead code for cleanup.
  • execute_refactor_tool: Execute refactoring changes that have been previewed.
  • catalog_database_tool: List all database tables (SQL, Prisma, Django, etc.).
  • inspect_table_tool: Table schema details, foreign keys, and code files querying it.

🏗️ Administration (Core & Registry)

  • sync_knowledge_tool: Initialize or update the project architectural graph (Full/Incremental).
  • optimize_graph_tool: Re-run post-processing steps (Flows, Communities, FTS) for the graph.
  • vectorize_codebase_tool: Compute vector embeddings for the entire codebase to enable semantic search.
  • manage_registry_tool: Manage and list repositories registered in the multi-repo system.

💻 CLI Reference

Control kinrg directly from your terminal using the following command suite:

Command Function
kinrg install Auto-detect and configure MCP for IDEs.
kinrg index Scan and build the architectural graph for the first time (Full parse).
kinrg sync Fast update of the graph (Processes only changed files).
kinrg report View detailed statistics on nodes, edges, and graph health.
kinrg monitor Watch mode: Auto-update the graph immediately upon file save.
kinrg map Launch the web interface to visualize the project graph.
kinrg docs Automatically generate a Markdown Wiki based on code structure.
kinrg audit Risk analysis of current changes compared to Git.
kinrg attach <path> Register a new project into the multi-repo management system.
kinrg registry List all repositories registered in the Registry.
kinrg serve Start the MCP server to connect with AI Agents.

⚡ Slash Commands

When chatting with MCP-enabled AIs (like Cursor, Claude Code, OpenCode), you can use these shortcuts:

  • /kinrg:build-graph: Ask AI to update the entire project architectural map.
  • /kinrg:review-delta: AI will analyze and comment on your latest code changes.
  • /kinrg:review-pr: Perform a full PR review process with deep risk analysis.

📝 License

MIT. All source code data is kept secure locally within the .kinrg/ directory.


WebsiteGitHub

Released under the MIT License. All source code data is kept secure locally within the .kinrg/ directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kinrg-1.0.4.tar.gz (589.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kinrg-1.0.4-py3-none-any.whl (197.7 kB view details)

Uploaded Python 3

File details

Details for the file kinrg-1.0.4.tar.gz.

File metadata

  • Download URL: kinrg-1.0.4.tar.gz
  • Upload date:
  • Size: 589.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for kinrg-1.0.4.tar.gz
Algorithm Hash digest
SHA256 65196907b6fb9e8cdd39a0ef9ebb419de7ebe37a6b1040157cd580d2ccdb7515
MD5 182af3aad843fe31df7542f6f6989a20
BLAKE2b-256 5bc0370e9fb03267ecbff443e9aa03c56603dd5708a1dda66251d6d9367e05bb

See more details on using hashes here.

File details

Details for the file kinrg-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: kinrg-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 197.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for kinrg-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1bcc03d5d9271399b2c0a8b9113a88248b2eded48f8f60e6c147202cb7c14f54
MD5 7bcb6d893e944286c75719bb62007906
BLAKE2b-256 7c035ee4dc21db696f30ad9fed4fec1572f6085aafea17c240e39ceb622ea151

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page