Skip to main content

A comprehensive AI-powered code analysis and automation CLI tool

Project description

Sutra Knowledge CLI

Python version Python report Code coverage License

An intelligent codebase analysis and knowledge management tool that provides AI-powered insights, semantic search capabilities, and comprehensive project understanding through advanced parsing and embedding technologies. Focus on writing your code and thinking of the business-logic! The CLI will take care of the rest.

⚡️ Quick Start

First, download and install Python. Version 3.8 or higher is required.

Installation is done by using the pip install command:

pip install sutrakit

Setup environment

Sets up ~/.sutra directory, downloads ML models, creates config files, sets environment variables, and prepares BAML client for AI code analysis.

sutrakit-setup

Setup Demo

That's all you need to know to start! 🎉

Indexing Your Projects

To enable analysis, each project must be indexed. This process parses the codebase, extracts structures, and builds embeddings for semantic search.

  1. Navigate to your project directory (e.g., cd my-project).
  2. Run sutrakit – if the project isn't indexed, you'll be prompted to do so.
    • Confirm indexing when asked; it typically takes a few minutes depending on project size.

For ecosystems with multiple related projects (e.g., backend, frontend, microservices):

  • Repeat the above in each project's directory.
  • Sutrakit automatically links them by matching connections, creating a dependency graph for ecosystem-wide analysis.

Indexing Demo

Important Note:

  • For the Roadmap Agent to fully discover and navigate inter-project connections (e.g., API calls, message queues, WebSockets), cross-indexing is required during the indexing phase. This builds a dependency graph of external links that standard parsing might miss. Without it, the agent can't trace code flows across projects, resulting in incomplete roadmaps.
  • Do not run cross-indexing parallelly for multiple projects, as it can lead to conflicts and incomplete or incorrect dependency graphs.

📝 Key Features

Sutrakit is an orchestrator for AI agents and services, focused on multi-project codebase analysis and management. It helps developers handle complex ecosystems by providing intelligent insights and automated workflows. Below are the core features, with a diagram for the key component.

  • AI-Powered Roadmap Agent:

    • Processes user queries to create minimal plans across projects.
    • Identifies change locations, reuses code, and defines integrations.
    • Refines via feedback; orchestrates sub-agents for execution.
  • Orchestration of Sub-Agents:

    • Spawns AI sub-agents for parallel project updates.
    • Handles dependencies seamlessly.
  • Cross-Indexing Service:

    • Discovers and indexes external connections (e.g., APIs, message queues, WebSockets) beyond standard parsing, using advanced matching for identifiers, parameters, wrappers, and variables.
    • Builds a dependency graph by scanning new projects against existing ones, creating links for matched connections to enable seamless navigation and hopping between projects during analysis.
  • Semantic Search and Code Analysis:

    • Queries codebases with semantic/keyword tools.
    • Manages memory to optimize operations.

Roadmap Agent Workflow

flowchart TD
    A[User Query] --> D[Analyze & Plan]
    D --> E[Verify & Review]
    E -->|Refine| D
    E -->|Approve| F[Execute via Sub-Agents]
    F --> SA[Sub-Agent: Project A]
    F --> SB[Sub-Agent: Project B]
    F --> SC[Sub-Agent: Project C]

Use Cases

Sutrakit excels in interconnected projects like microservices or full-stack apps:

  • New Feature: Maps backend-to-frontend changes; generates contracts; updates via sub-agents.
  • Bug Fix: Traces dependencies; plans minimal fixes.
  • Refactor: Analyzes patterns; roadmaps reusable updates.
  • Onboard Repo: Indexes and links to ecosystem for integrations.

This keeps focus on practical value to see if it fits your needs.

Configuration

Sutrakit allows customization through the system configuration file located at ~/.sutra/config/system.config. This JSON file controls various aspects of the tool, such as database paths, storage directories, embedding models, logging, and LLM providers. You can edit it manually to tweak settings—changes take effect on the next run. Always back up the file before modifying, and ensure valid JSON format to avoid errors.

Here's a partial view of the config file (focusing on the LLM section for brevity; other sections like database and storage are omitted):

{
  ...
  "llm": {
    "provider": "aws",
    "llama_model_id": "meta/llama-3.1-8b-instruct",
    "claude_model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
    "gemini_model": "gemini-1.5-flash",
    "aws": {
      "access_key_id": "YOUR_ACCESS_KEY",
      "secret_access_key": "YOUR_SECRET_KEY",
      "region": "us-east-2",
      "model_id": "us.anthropic.claude-sonnet-4-20250514-v1:0"
    },
    "anthropic": {
      "api_key": "YOUR_API_KEY",
      "model_id": "us.anthropic.claude-sonnet-4-20250514-v1:0"
    },
    "gcp": {
      "api_key": "YOUR_API_KEY",
      "project_id": "YOUR_PROJECT_ID",
      "location": "us-central1",
      "llm_endpoint": "https://us-central1-aiplatform.googleapis.com/v1/projects/{project_id}/locations/us-central1/endpoints/openapi/chat/completions"
    },
  }
  ...
}

Example: Changing the LLM Provider

The "llm" section lets you switch AI providers (e.g., for the Roadmap Agent) and configure credentials. By default, it's set to "aws". To change it:

  1. Update "provider" to one of: "aws", "anthropic", "gcp", or "superllm".
  2. Fill in the corresponding subsection with your API keys or credentials (leave others blank if unused).
  3. Optionally, adjust model IDs for specific LLMs.

Switch to Anthropic Example:

"llm": {
  "provider": "anthropic",
  "llama_model_id": "meta/llama-3.1-8b-instruct",
  "claude_model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
  "gemini_model": "gemini-1.5-flash",
  "aws": { /* Leave as-is or blank */ },
  "anthropic": {
    "api_key": "sk-ant-your-anthropic-api-key-here",
    "model_id": "claude-3-5-sonnet-20240620"
  },
  "gcp": { /* Leave as-is or blank */ },
  "superllm": { /* Leave as-is or blank */ }
}

After saving, restart Sutrakit to apply changes. For other sections (e.g., logging level or embedding model), edit values directly—refer to the file for details.

⭐️ Project assistance

If you want to say thank you or/and support active development of Sutra Knowledge CLI:

  • Add a GitHub Star to the project.
  • Write interesting articles about project on Dev.to, or personal blog.

🏆 A win-win cooperation

And now, I invite you to participate in this project! Let's work together to create the most useful tool for developers on the web today.

  • Issues: ask questions and submit your features.
  • Pull requests: send your improvements to the current.

Together, we can make this project better every day! 😘

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

sutrakit-0.1.7.tar.gz (252.8 kB view details)

Uploaded Source

Built Distribution

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

sutrakit-0.1.7-py3-none-any.whl (564.5 kB view details)

Uploaded Python 3

File details

Details for the file sutrakit-0.1.7.tar.gz.

File metadata

  • Download URL: sutrakit-0.1.7.tar.gz
  • Upload date:
  • Size: 252.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sutrakit-0.1.7.tar.gz
Algorithm Hash digest
SHA256 ab49858645057b93c4c2d55467b5a530183028636b4b684719aa0ce887bdad7d
MD5 7df9bbec7578d953bc979d4cca4b05f0
BLAKE2b-256 7354accbc9cd998a8cf602c7170ca2feb6368e22924bef8e9620cfa846d81895

See more details on using hashes here.

File details

Details for the file sutrakit-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: sutrakit-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 564.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sutrakit-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8d56bc67c534fc7981116b870180de10748adec68c2b7c9492fd066f980ca5ab
MD5 f60e36a9c453365758432d406c23ab53
BLAKE2b-256 f9d677c98806fe7e4922e3ee671a3a9b5577e3fd63b126089ce3635d2d7f7192

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