Skip to main content

AI-powered bot for autonomous code modification, PR management, and continuous improvement

Project description

NasModifier-Bot

๐Ÿค– AI-powered bot for autonomous code modification, PR management, and continuous improvement

GitHub License Python

Overview

NasModifier-Bot is an autonomous AI agent that automatically:

  • ๐Ÿ” Scans repositories for issues, security vulnerabilities, and code quality problems
  • โœ๏ธ Modifies code and creates pull requests with improvements
  • ๐Ÿค Manages PR workflows with GitHub integration
  • ๐Ÿ“ฑ Sends notifications and status updates via Telegram
  • ๐Ÿš€ Runs 24/7 for continuous codebase improvement

Built on: NasTech-Agent - The self-improving AI agent framework

Features

Core Capabilities

  • Autonomous Code Review: Identifies bugs, security issues, and improvements
  • Automated Patching: Generates and applies fixes to code
  • GitHub Integration: Creates PRs, manages issues, handles approvals
  • Telegram Notifications: Real-time updates and admin controls via Telegram
  • Health Monitoring: 20-stage pre-flight checks before modifications
  • Governance Rules: Enforces NasGov framework for safe operations

Security & Compliance

  • โœ… Zero hardcoded credentials (environment variables only)
  • โœ… Pre-flight health checks (20 stages)
  • โœ… Violation detection (credentials, unsafe code, etc.)
  • โœ… Governance enforcement (NasGov framework)
  • โœ… Audit logging and activity tracking

Installation

Requirements

  • Python 3.9+
  • Git
  • Telegram Bot Token (for notifications)
  • GitHub Personal Access Token (for code modifications)

Quick Start

# Clone the repository
git clone https://github.com/nastech-ai/NasModifier-Bot.git
cd NasModifier-Bot

# Run the installer
bash install-modifier.sh

# Configure credentials
nano .env

# Start the bot
nasmodifier

Manual Installation

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install package
pip install .

# For development
pip install ".[dev]"

Configuration

Environment Variables (.env)

# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ADMIN_ID=your_user_id_here

# GitHub
GITHUB_TOKEN=your_github_pat_here

# API Keys (optional)
GROQ_API_KEY=your_groq_key_here
OPENROUTER_API_KEY=your_openrouter_key_here

Configuration Files

  • nasgov/: Governance framework documentation
    • NASAGENT_GOVERNANCE.md: Master rules for all agents
    • NASMODIFIER_COMMAND.md: NasModifier-Bot specific rules
    • COMPREHENSIVE_SCAN_REPORT.md: Security audit findings

Usage

Command Line

# Show help
nasmodifier --help

# Run in production mode
nasmodifier

# Run with verbose logging
nasmodifier --verbose

# Run health checks
nasmodifier --health-check

Telegram Commands

When running, the bot responds to Telegram commands:

/start     - Initialize bot
/status    - Get current status
/help      - Show available commands
/scan      - Run full health scan
/pause     - Pause modifications
/resume    - Resume modifications
/logs      - View recent logs

Architecture

NasModifier-Bot/
โ”œโ”€โ”€ nasmodifier/
โ”‚   โ”œโ”€โ”€ core/              # Core orchestration (state machine, scheduler)
โ”‚   โ”œโ”€โ”€ github/            # GitHub client and PR workflows
โ”‚   โ”œโ”€โ”€ skills/            # AI skills (branding, patching, analysis)
โ”‚   โ”œโ”€โ”€ stages/            # 20 pre-flight check stages
โ”‚   โ”œโ”€โ”€ telegram/          # Telegram bot integration
โ”‚   โ”œโ”€โ”€ memory/            # Memory providers and caching
โ”‚   โ”œโ”€โ”€ configs/           # Configuration templates
โ”‚   โ””โ”€โ”€ main.py            # Entry point
โ”œโ”€โ”€ tests/                 # Test suite
โ”œโ”€โ”€ nasgov/               # Governance framework documentation
โ”œโ”€โ”€ setup.py              # Package configuration
โ”œโ”€โ”€ pyproject.toml        # Project metadata
โ””โ”€โ”€ install-modifier.sh   # Installation script

Dependencies

Core

  • nastech-agent โ‰ฅ0.16.0 - Parent framework

GitHub

  • PyGithub - GitHub API client
  • gidgethub - Async GitHub client

Telegram

  • python-telegram-bot - Telegram bot library

Data & Processing

  • pydantic - Data validation
  • pyyaml - Config file parsing
  • sqlalchemy - Database ORM
  • alembic - Database migrations

Security & Governance

This project follows the NasGov framework for AI agent operations:

Pre-Flight Checks (20 Stages)

  1. Branding scan
  2. Dependency audit
  3. Syntax validation
  4. Import checks
  5. Config validation
  6. Protected paths
  7. File permissions
  8. Branding enforcement
  9. File integrity
  10. Test readiness
  11. CVE tracking
  12. Documentation
  13. Git status
  14. Patch safety
  15. Deployment readiness
  16. API health
  17. Telegram health
  18. GitHub token validity
  19. Secrets audit
  20. Sync status

Safety Guarantees

  • โœ… No modifications without admin approval
  • โœ… All changes require passing health checks
  • โœ… Violations trigger immediate halt
  • โœ… Audit trail of all operations
  • โœ… Hermes-Agent alignment verification

Licensing & Credits

Contributing

This repository is part of the NasTech ecosystem. All contributions must follow the NasGov governance framework.

Development Setup

# Install development dependencies
pip install ".[dev]"

# Run tests
pytest tests/ -v

# Code quality
black nasmodifier/ && isort nasmodifier/
flake8 nasmodifier/ && mypy nasmodifier/

Support

Roadmap

  • Web dashboard for monitoring
  • Advanced analytics and metrics
  • Multi-repository management
  • Custom skill development framework
  • Docker deployment templates
  • Kubernetes operator

Built with โค๏ธ by the NasTech team

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

nastech_modifier-1.0.0.tar.gz (20.7 kB view details)

Uploaded Source

File details

Details for the file nastech_modifier-1.0.0.tar.gz.

File metadata

  • Download URL: nastech_modifier-1.0.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nastech_modifier-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8924b097832844293a3a8a2ad97d3874dce4aad89a0607db5dcac4b25583fe04
MD5 df1a4167b727bc15b34de19919140908
BLAKE2b-256 51ef8e88964edf41266350f650f32429cd92b4277a162b1e205a575a564e6d4d

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