A comprehensive AI-powered code analysis and automation CLI tool
Project description
Sutra Knowledge CLI
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
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.
- Navigate to your project directory (e.g.,
cd my-project). - 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.
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:
- Update
"provider"to one of:"aws","anthropic","gcp", or"superllm". - Fill in the corresponding subsection with your API keys or credentials (leave others blank if unused).
- 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.
🛠️ Development Setup
If you want to contribute to the project or modify the BAML configurations, follow these steps:
Prerequisites
- Python 3.8+
- Git
- pip
Quick Setup
-
Clone the repository:
git clone https://github.com/sutragraph/sutracli.git cd sutracli
-
Run the development setup script:
./scripts/setup-dev.sh
This script will:
- Install development dependencies (including pre-commit)
- Set up pre-commit hooks
- Test BAML client generation
- Run initial code quality checks
Manual Setup
If you prefer to set up manually:
-
Install development dependencies:
pip install -e ".[dev]"
-
Install pre-commit hooks:
pre-commit install -
Generate BAML client (if needed):
./scripts/generate-baml.sh
Pre-commit Hooks
The project uses pre-commit hooks to ensure code quality and keep BAML client files up-to-date:
- BAML Generation: Automatically regenerates BAML client files when
baml_src/files change - Code Formatting: Runs Black and isort on Python files
- Code Quality: Checks for trailing whitespace, large files, merge conflicts, etc.
- File Validation: Validates YAML, JSON, and TOML files
Working with BAML
When you modify files in baml_src/, the pre-commit hooks will automatically:
- Regenerate the BAML client files in
baml_client/ - Add the updated client files to your commit
- Ensure code formatting and quality standards
You can also manually regenerate BAML client files:
./scripts/generate-baml.sh
Running Tests
# Run all pre-commit hooks
pre-commit run --all-files
# Run specific hook
pre-commit run baml-generate
⭐️ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sutrakit-0.1.12.tar.gz.
File metadata
- Download URL: sutrakit-0.1.12.tar.gz
- Upload date:
- Size: 434.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a77fc38a5b98d59fe77f9f4f064494e91ec5ce0b100abc648d652175818b7b14
|
|
| MD5 |
978e07d22deba848623eab146f523278
|
|
| BLAKE2b-256 |
497756acfb1348a82dd169aab0e3d520254edc93b34e7df108c8d01a4a0d2644
|
File details
Details for the file sutrakit-0.1.12-py3-none-any.whl.
File metadata
- Download URL: sutrakit-0.1.12-py3-none-any.whl
- Upload date:
- Size: 795.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8713123508b71d2af7bddf693e1f8e871af7f7d904b1cc4941a1d0b2b1a3a16b
|
|
| MD5 |
16e5c9bfbd5997618b4f69e61294d2b2
|
|
| BLAKE2b-256 |
28f41bce0c2a7c09138d75a89d893161f4f2e86361aabe432dabf45f43c7139c
|