Skip to content

About

AIforALGO

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

120 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlgoMate - organization specific assistance

AlgoMate is a VS Code extension that enhances Algorand smart contract development with AI-powered assistance. It helps developers create, edit, and deploy smart contracts more efficiently on the Algorand blockchain. We are offering two versions of our extension :

  • LLM based (ideal for small users since the call is made through API)
  • SLM based (ideal for organizations wanting full privacy over model calls)

Refer to this presentation for a better understanding of the project : Canva Link Refer to this video for the live demo : Youtube Link

Recognition

  • Featured on the official Algorand website.
  • Open-source project built for the Algorand developer ecosystem.
  • Contributions, issues, and feature requests are welcome from the community.

Features

Smart Contract Generation

  • Purpose-based Templates: Generate contracts for various use cases:
    • Escrow
    • NFT (Non-Fungible Tokens)
    • DAO (Decentralized Autonomous Organizations)
    • DeFi (Decentralized Finance)
    • Voting systems
    • And more...

Contract Types

  • Support for different Algorand contract types:
    • Stateful contracts
    • Stateless contracts
    • Signature-based contracts

Development Tools

  • AI-Powered Code Completion: Get intelligent code suggestions as you type
  • Inline Documentation: Automatic generation of docstrings and documentation
  • Code Improvement Suggestions: AI-powered code optimization recommendations

Difference from other AI

  • No Hallucinations due to RAG
  • Cosine Similarity to log down relevent examples from the community
  • Can be modified to have LLM as a fallback for SLM
  • Retry option with prompt and code passed as context
  • Direct Deployment options

Supported Languages

  • Primary language: Python (PyTeal)
  • Clean and readable code generation

Getting Started

Prerequisites

  • Node.js (v14+)
  • VS Code (v1.70+)
  • Python 3.8+
  • Algorand Developer Tools (Goal, Sandbox, or TestNet access)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/ByteBandits.git
    cd ByteBandits
  2. Install dependencies:

    npm install
  3. Set up Python dependencies:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -r requirements.txt
  4. Set your Google API key in a .env file (if using LLM based):

    GEMINI_API_KEY=your_api_key_here
    

PostgreSQL vector store (Docker)

The RAG dataset is stored in one PostgreSQL table, instruction_documents. It contains instruction, a 384-dimension instruction_embedding, code, and metadata (JSONB). Source fields such as github_url, website_url, file_path, repository name, or any other JSONL fields are retained in metadata.

  1. Copy .env.example to .env and set a local database password.
  2. Build and start PostgreSQL with pgvector (the image is built locally from PostgreSQL's official image for reliable Windows Docker Desktop support):
    docker compose up -d
  3. Install the PostgreSQL importer dependencies, then import and embed the dataset:
    pip install -r requirements-postgres.txt
    python data/load_embeddings_to_postgres.py --input data/samples.jsonl

Use a supported Python version for the selected packages. The legacy requirements.txt includes older training dependencies and is not compatible with Python 3.14; create the importer environment with Python 3.11 or 3.12 if the latest sentence-transformers/PyTorch wheels are unavailable for your machine.

MCP knowledge search

The repository also exposes the PostgreSQL knowledge base to MCP-compatible AI clients. The search_algorand_knowledge(query, top_k) tool combines PostgreSQL full-text ranking with cosine similarity over the existing pgvector embeddings, then returns the matching instruction, code, metadata, and scores. The model or client uses those returned sources to produce its answer; the MCP server does not call an LLM.

Install the MCP/RAG dependencies in the same Python environment used by the PostgreSQL database setup, and ensure the database is running and populated:

pip install -r requirements-mcp.txt
python mcp_server.py

The server uses MCP stdio transport and the POSTGRES_* variables from .env. Example client configuration (adjust the Python path to your environment):

{
  "mcpServers": {
    "algorand-knowledge": {
      "command": "D:/path/to/ByteBandits/.venv-pg/Scripts/python.exe",
      "args": ["D:/path/to/ByteBandits/mcp_server.py"]
    }
  }
}

The first search downloads/loads all-MiniLM-L6-v2, the same model used during ingestion. top_k must be between 1 and 20.

The loader is idempotent: importing the same instruction/code pair updates its embedding and metadata instead of duplicating it. To inspect the data:

docker compose exec postgres psql -U algomate -d algomate -c "SELECT id, instruction, metadata FROM instruction_documents LIMIT 5;"
  1. Build and run the extension in VS Code:
    • Press F5 to open a new VS Code window with the extension loaded
    • Or use the command palette: Developer: Run Extension

🛠️ Usage

  1. Open the Algorand Contract Builder panel using the command palette (Ctrl+Shift+P or Cmd+Shift+P):

    Open Algorand Contract Panel
    
  2. Configure your contract:

    • Select the contract purpose
    • Choose the contract type
    • Select the programming language
    • Enter any specific requirements
  3. Generate and deploy your contract with a single click

🤖 AI Features

Code Completion

  • Get context-aware suggestions by typing . after an object
  • AI-powered method and property recommendations

Documentation Generation

  • Automatic docstring generation for smart contracts
  • Real-time documentation as you code

Code Improvement

  • Get suggestions for optimizing your smart contract code
  • Security best practices for Algorand development

Project Structure

ByteBandits/
├── src/                    # TypeScript source code
├── media/                  # Extension assets
├── data/                   # Sample contracts and templates
├── .vscode/                # VS Code configuration
├── .venv/                  # Python virtual environment
├── .gitignore
├── package.json            # Extension manifest
├── requirements.txt        # Python dependencies
└── README.md

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with VS Code Extension API
  • Powered by Google's Generative AI and Salesforce's Codegen Model
  • Part of the Algorand Developer Ecosystem

Made with ❤️ for organizaton specific AI assistance

About

AIforALGO

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages