🤖 AI-First Code Analysis Platform with Intelligent Reasoning
The most comprehensive suite of AI-optimized development tools, featuring structured JSON APIs, intelligent reasoning capabilities, and enterprise-grade safety. Built for AI agents, with 100+ tools providing lightning-fast analysis (10-100x faster than traditional tools) and unbreakable safety guarantees - preventing disasters like Replit's AI database wipe while enabling unprecedented development velocity.
✅ Phase 1: Unified JSON API - Production-ready programmatic access
✅ Phase 2: AI Reasoning System - Intelligent analysis with risk assessment
✅ Phase 3: Python SDK - High-level interfaces for seamless integration
- 🤖 AI-First Platform - Unified JSON API, intelligent reasoning, Python SDK
- 🧠 Intelligent Analysis - AI reasoning with risk assessment and security insights
- ⚡ 10-100x faster than grep, IDEs, or manual refactoring - critical for AI token efficiency
- 🛡️ Disaster-proof - Prevents AI agents from executing destructive operations
- 🎯 100% accurate AST-based code understanding - no hallucinations, just facts
- 🌐 Language-aware - Auto-detects Java vs Python for optimal AST processing
- 📊 Structured Output - JSON APIs, reasoning schemas, programmatic interfaces
- 🔧 100+ tools - Complete toolkit for any AI coding task with intelligent insights
- 📏 Handles massive files - Edit 10k+ line files that break AI IDE edit tools
- 🚀 Production-ready - Battle-tested on millions of lines of code with enterprise safety
- ⚡ No Persistent Index - Always current, zero setup, perfect for CI/CD and ephemeral environments
The rise of AI coding assistants has introduced a new paradigm, but it comes with critical trade-offs that impact safety, performance, and cost.
The Problem (The "Before"):
- Safety Crisis: AI agents with direct shell access can execute destructive operations like
rm -rf /
or unsafegit
commands, leading to catastrophic data loss, as seen in the recent Replit AI disaster. - Performance Bottlenecks: Traditional IDEs and search tools are slow on large codebases, bogging down both developers and AI agents that rely on them.
- Alert Fatigue: Static analysis tools that produce up to 50% false positives erode trust and cause developers to ignore potentially critical warnings.
- Spiraling Costs: Building a complete, enterprise-grade development and safety infrastructure can cost teams $1,500 to $15,000+ annually in subscriptions.
The Solution (The "After" with Our Toolkit):
- Unbreakable AI Safety Infrastructure: Our toolkit provides system-level protection that intercepts dangerous commands, making AI-driven disasters impossible while enhancing any AI assistant you already use.
- 10-100x Faster Analysis: A zero-index architecture provides instant, 100% accurate results, which is critical for the token efficiency and speed of AI agents.
- Intelligence-Driven Analysis: Our AI Reasoning System provides natural language explanations with confidence scoring, eliminating noise and allowing you to focus only on what matters.
- Zero Cost, Enterprise-Grade Platform: Get a complete suite for analysis, intelligence, and safety that is entirely free and open source.
While many excellent tools exist for individual tasks, our platform is unique in its ability to prevent the specific, high-stakes failure modes of modern, AI-assisted development.
Domain | The Risk (Common & Real-World Failures) | Our Solution (Code Intelligence Toolkit) |
---|---|---|
AI & System Integrity | • The Replit Incident: AI agents with direct shell access wiping production databases. • The 2017 GitLab Outage: Engineers under pressure running rm -rf on the wrong server. |
An AI-First Safety Platform with system-level command interception and a Safe File Manager that makes destructive operations reversible. |
Code Refactoring & Data Loss | • Losing your entire editor undo history after a bad AI edit. • Losing committed work to a mistaken git reset --hard or push --force . |
A Multi-Level Undo System that operates independently from the editor's buffer, and a SafeGIT wrapper that automatically creates backups before any destructive Git operation. |
Static Analysis & Deployment | • The Knight Capital Glitch ($440M loss from a silent breaking change). • Alert fatigue from tools producing up to 50% false positives. |
Our AI Reasoning System and semantic_diff_v3.py analyze what code actually does, flagging breaking changes and providing insights with confidence scoring to eliminate noise. |
Recent incidents demonstrate the critical need for AI-safe development tools:
- Replit's AI assistant accidentally wiped production databases (Fortune, July 2025)
- AI agents executing
rm -rf /
destroying entire development environments - Accidental git force pushes losing weeks of team collaboration
Our Solution: The only toolkit that provides unbreakable AI safety infrastructure - dangerous operations are intercepted at the system level, making disasters impossible while preserving full AI automation capabilities and enhancing any AI assistant you already use.
Tool Category | Market Leaders | Annual Cost | Our Toolkit |
---|---|---|---|
Static Analysis | CodeAnt.ai ($120-240/year), SonarQube Enterprise ($8,000+) | $120-8000+ | $0 |
Refactoring Tools | IntelliJ Ultimate ($169/year), IDE + plugins | $169+ | $0 |
Documentation Tools | Confluence ($5-6/user/mo), GitBook ($8-12/user/mo) | $60-144/year | $0 |
Safety & Recovery | Enterprise backup solutions ($100s-1000s/year) | $100-1000+ | $0 |
AI Safety Infrastructure | Custom solutions, enterprise security tools | $1000-5000+ | $0 |
Development Infrastructure | Complete platform with all capabilities above | TOTAL: $1,500-15,000+/year | $0 |
Note: Keep your existing AI assistant (Claude Code, Cursor, Copilot, etc.) - our toolkit enhances their capabilities with safety and intelligence.
If you're using AI coding assistants → Add unbreakable safety protection without changing your workflow
If you're frustrated with slow IDEs → Give your AI assistant 40x faster refactoring tools to use
If you're drowning in false positives → Provide your AI with reasoning systems that explain what actually matters
If you're tired of tool subscription costs → Get enterprise-grade infrastructure for free
If you need comprehensive AI-safe development → Get analysis, intelligence, and safety designed for AI automation
In summary, our toolkit is the missing infrastructure layer that makes AI-driven development safe, intelligent, and cost-effective. It integrates Analysis, Intelligence, and Safety into a single platform designed to enhance any AI assistant - at zero cost with unbreakable safety guarantees.
┌─────────────────────────────────────────────────────────────────────────┐
│ Users & AI Agents │
└─────────────────────────┬───────────────┬───────────────────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Python SDK │ │ Unified JSON API│
│ High-Level │ │ Programmatic │
│ Interface │ │ Access │
└─────────┬───────┘ └─────────┬───────┘
│ │
└─────────┬─────────┘
▼
┌─────────────────────────────┐
│ Intelligence Layer │
│ • AI Reasoning Engine │
│ • Risk Assessment │
│ • Security Analysis │
│ • Quality Metrics │
└─────────────┬───────────────┘
▼
┌─────────────────────────────┐
│ Core Tool Suite │
│ • AST Analysis (100% accurate)│
│ • Data Flow Tracking │
│ • Safe File Operations │
│ • Git Safety Wrapper │
│ • Semantic Search │
└─────────────┬───────────────┘
▼
┌─────────────────────────────┐
│ Your Codebase │
│ Always Current State │
│ No Persistent Index │
└─────────────────────────────┘
The Perfect Trilogy: Analysis + Intelligence + Safety = Complete Code Understanding
# Traditional AI coding can be dangerous
ai_agent.execute("rm -rf important_files") # 💥 Disaster!
# With Code Intelligence Toolkit - Two Approaches:
# 1. CLI Approach (Perfect for Claude Code, GitHub Copilot)
import subprocess
result = subprocess.run([
"./run_any_python_tool.sh",
"safe_file_manager.py",
"trash", "old_files" # Safe, reversible operation
], capture_output=True, text=True)
# 2. API Approach (For custom AI integrations)
from code_intelligence.api.client import CodeIntelligenceAPI
api = CodeIntelligenceAPI()
result = api.execute({
"tool": "safe_file_manager",
"params": {"command": "trash", "files": ["old_files"]},
"options": {"non_interactive": True}
})
Important for AI Developers: While we provide both CLI and API interfaces, AI coding assistants like Claude Code work best with the CLI due to their subprocess execution model. Both interfaces provide identical functionality - the CLI is just more direct for sandbox environments!
# Single endpoint for all 100+ tools
echo '{"tool": "data_flow_tracker_v2", "params": {"--var": "user_input", "--file": "app.py"}, "options": {"include_reasoning": true}}' | ./api.py
{
"ai_reasoning": {
"logical_steps": ["Analyzed variable flow", "Detected security risk"],
"risk_assessment": {
"overall_risk": "high",
"confidence": 0.92,
"security_implications": ["SQL injection possible"]
},
"recommendations": ["Add input validation", "Use parameterized queries"]
}
}
from code_intelligence import CodeIntelligence
ci = CodeIntelligence('/path/to/project')
result = ci.analyze_impact('app.py', 'user_input', include_reasoning=True)
print(f"Risk: {result.reasoning['risk_assessment']['overall_risk']}")
1. Non-Interactive Mode - All tools support automation
# Environment variables for CI/CD and AI agents
export SAFEGIT_NONINTERACTIVE=1
export SAFE_FILE_MANAGER_ASSUME_YES=1
# Or use command flags
./run_any_python_tool.sh doc_generator_enhanced.py --class MyClass --file code.py --yes --non-interactive
2. Structured Output - Parse results programmatically
# AI agent analyzing code
result = subprocess.run([
"./run_any_python_tool.sh",
"data_flow_tracker_v2.py",
"--var", "user_input",
"--file", "app.py",
"--json" # Structured output for AI parsing
], capture_output=True, text=True)
analysis = json.loads(result.stdout)
3. SafeGIT Integration - Prevent AI disasters
# AI agents CANNOT bypass safety
# This is automatically intercepted and requires confirmation
subprocess.run(["git", "reset", "--hard"]) # ❌ Blocked!
# Safe alternative
subprocess.run([
"./run_any_python_tool.sh",
"safegit.py",
"--force-yes", # Explicit override for automation
"reset", "--hard"
])
- Clone and Configure for AI
git clone https://github.com/Vaibhav-api-code/code-intelligence-toolkit.git
cd code-intelligence-toolkit
# Set up for AI/automation
echo "export CODE_INTEL_NONINTERACTIVE=1" >> ~/.bashrc
echo "export SAFEGIT_ASSUME_YES=1" >> ~/.bashrc
- Integrate with Your AI Agent
class SafeAICodingAgent:
def __init__(self, toolkit_path):
self.toolkit = toolkit_path
def analyze_code(self, file_path):
"""Safe code analysis with structured output"""
cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"doc_generator_enhanced.py",
"--file", file_path,
"--format", "json",
"--non-interactive"
]
result = subprocess.run(cmd, capture_output=True, text=True)
return json.loads(result.stdout)
def refactor_safely(self, old_name, new_name, file_path):
"""Safe refactoring with automatic backups"""
cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"replace_text_ast_v3.py",
"--file", file_path,
old_name, new_name,
"--yes" # Non-interactive mode
]
return subprocess.run(cmd, capture_output=True, text=True)
- Python - Full AST analysis, refactoring, and navigation
- Java - Complete parsing with javalang, method analysis
- JavaScript (Experimental) - Basic AST support with esprima
- Universal - Works with any programming language or text format
- Optimized for: C/C++, Go, Rust, TypeScript, Ruby, PHP, Shell scripts
- Also supports: Configuration files, Markdown, YAML, JSON, XML
The toolkit leverages ripgrep's extensive file type definitions, supporting 600+ file types out of the box. Run rg --type-list
to see all supported types.
Problem: How to prevent AI coding assistants from making dangerous mistakes like file deletion or unsafe Git operations. Solution: A production-ready Python SDK and JSON API with unbreakable safety guarantees, allowing AI agents to perform analysis and refactoring without risk.
Problem: Legacy codebases are hard to understand, document, and maintain
Solution: Quickly analyze complex data flows, understand system dependencies, and automatically generate documentation to facilitate knowledge sharing.
Problem: Code changes introduce vulnerabilities and are hard to audit
Solution: Use data flow tracking and semantic diff tools to audit changes, identify potential vulnerabilities, and enforce security best practices.
Problem: IDEs are slow for large codebases, refactoring is risky, search is limited
Solution: Get a toolkit that is 10-100x faster than your IDE for search and refactoring, with the peace of mind that every operation is safe and reversible.
Perfect for quick tasks, shell scripts, and AI coding assistants like Claude Code:
# Get started in 30 seconds
git clone https://github.com/Vaibhav-api-code/code-intelligence-toolkit.git
cd code-intelligence-toolkit
chmod +x run_any_python_tool.sh
# Find TODOs in your code
./run_any_python_tool.sh find_text_v7.py "TODO" --scope src/ --json
# Generate documentation
./run_any_python_tool.sh doc_generator_enhanced.py MyClass --style technical
# Safe refactoring
./run_any_python_tool.sh unified_refactor_v2.py rename oldMethod newMethod --file app.py # Auto-detects backend
# Analyze dependencies
./run_any_python_tool.sh dependency_analyzer.py MyClass --export-all
Ideal for automation, integrations, and building AI-powered tools:
# Method 2a: Direct API usage (for Python integrations)
from code_intelligence.api.client import CodeIntelligenceAPI
api = CodeIntelligenceAPI()
# Single operation
result = api.execute({
"tool": "find_text_v7",
"params": {"pattern": "TODO", "--scope": "src/"},
"options": {"cache": True, "include_reasoning": True}
})
# Batch operations
results = api.batch_execute([
{"tool": "find_text_v7", "params": {"TODO": True}},
{"tool": "replace_text_v9", "params": {"TODO": True, "DONE": True}}
])
# Method 2b: API via command line (for shell scripts/CI/CD)
# Single request
echo '{"tool": "find_text_v7", "params": {"TODO": true, "--json": true}}' | python3 api.py
# Interactive mode
python3 api.py
> {"tool": "doc_generator_enhanced", "params": {"MyClass": true}}
# Start API server
python3 api.py --server --port 8080
# Then use curl/wget/any HTTP client
curl -X POST http://localhost:8080/analyze \
-H "Content-Type: application/json" \
-d '{"tool": "semantic_diff_v3", "params": {"file1": "v1.py", "file2": "v2.py"}}'
Use CLI when:
- Running quick one-off commands
- Working in AI coding assistants (Claude Code, GitHub Copilot)
- Shell scripting and automation
- Learning and exploring tools
- Debugging specific issues
Use API when:
- Building applications or services
- Need structured error handling
- Running batch operations
- Caching results for performance
- Creating dashboards or monitoring
- Integrating with other systems
Note: The
run_any_python_tool.sh
wrapper handles environment setup and ensures all tools run with the correct shared configuration.
What you get immediately:
- ⚡ 10-100x faster code analysis than traditional tools
- 🛡️ Automatic backups before any destructive operation
- ↩️ Full undo capabilities for all file operations
- 🎯 Smart confirmations that prevent accidents
- 📊 Complete audit trail of all operations
For those using AI coding assistants or requiring enterprise-grade protection:
# Block direct access to dangerous commands
# See "Achieving Maximum Safety" section below for full setup
Additional protection:
- 🤖 AI agents cannot bypass safety mechanisms
- 🚫 System-level blocking of dangerous commands
- 🔐 Zero-trust architecture for production environments
- 📡 Monitoring and alerting for bypass attempts
The AI coding revolution has a safety problem. Recent incidents like Replit's AI wiping production databases show what happens when AI agents have unrestricted access to powerful commands.
This toolkit is the solution - providing AI agents with:
- 🛡️ Unbreakable safety guarantees - Dangerous operations are intercepted
- ⚡ 10-100x faster analysis - Critical for token efficiency and cost
- 📊 Structured, parseable output - No more regex parsing of CLI output
- 🔄 Full reversibility - Every operation can be undone
# Protects against common disasters:
./run_any_python_tool.sh safegit.py reset --hard # ✅ Creates backup first
./run_any_python_tool.sh safegit.py clean -fdx # ✅ Shows preview
./run_any_python_tool.sh safegit.py push --force # ✅ Converts to --force-with-lease
# Every operation is reversible:
./run_any_python_tool.sh safe_file_manager.py move important.doc backup/
./run_any_python_tool.sh safe_file_manager.py trash old_files/ # To trash, not gone
./run_any_python_tool.sh safe_file_manager.py undo --interactive # Recover anything
# Track how data flows through your code:
./run_any_python_tool.sh data_flow_tracker_v2.py --var user_input --file app.py
./run_any_python_tool.sh data_flow_tracker_v2.py --var result --direction backward
The Code Intelligence Toolkit provides 100+ command-line tools for developers who value their data. Every tool is designed with safety first, productivity second.
- Explicit Over Implicit - Clear intentions required
- Reversible By Default - Undo capability for all operations
- Fail Safe - When in doubt, do nothing
- Audit Everything - Complete operation history
- Always Current - No persistent index means results reflect current file state
Our toolkit deliberately avoids persistent indexing - this is a cornerstone feature, not a limitation:
- Analysis is always performed on the current version of your files on disk
- Never worry about stale or out-of-sync results from background indexers
- What you see is exactly what's in your files right now
- Clone the repository and get meaningful results in seconds
- No slow, resource-intensive initial indexing process to wait through
- Instant productivity - perfect for AI agents that need immediate results
- Zero CPU or memory consumption when not actively being used
- No background services constantly monitoring and re-indexing files
- Your system resources remain 100% available for your actual work
- Stateless, on-demand nature ideal for ephemeral environments
- CI/CD runners and Docker containers where persistent indexes are impractical
- Kubernetes pods and serverless functions work flawlessly
- Cloud development environments get instant, accurate results
- Consistent behavior across different environments and runs
- No cache invalidation complexity - every run is fresh and accurate
- Predictable performance - no variable indexing overhead
- Container-friendly - works perfectly in ephemeral environments
This "faster, safer, and more accurate" philosophy ensures that the toolkit provides reliable, current analysis without the complexity and resource overhead of maintaining persistent state.
Transform your toolkit into an AI-first platform with structured APIs, intelligent reasoning, and seamless integration.
Production-ready programmatic access to all 100+ tools
# Interactive mode
./api.py
> {"tool": "find_text_v7", "params": {"TODO": true, "--limit": 5}}
# Pipe mode
echo '{"tool": "data_flow_tracker_v2", "params": {"--var": "user_input", "--file": "app.py"}}' | ./api.py
# Demo mode
./api.py --demo
Key Features:
- Universal Tool Access: Single endpoint for all operations
- Caching System: SHA256-based caching with 1-hour TTL
- Batch Operations: Execute multiple requests efficiently
- Statistics Tracking: Performance monitoring and usage analytics
- Non-Interactive Mode: Perfect for CI/CD and automation
Intelligent analysis with structured reasoning output
Enhanced tools with AI-powered insights:
./run_any_python_tool.sh data_flow_tracker_v2.py --var user_input --file app.py --output-reasoning-json
{
"ai_reasoning": {
"risk_assessment": {
"overall_risk": "high",
"confidence": 0.92,
"security_implications": ["SQL injection possible"]
},
"recommendations": [
"Add input validation before database operations",
"Use parameterized queries to prevent SQL injection"
]
}
}
./run_any_python_tool.sh doc_generator_enhanced.py --file MyClass.java --output-reasoning-json
./run_any_python_tool.sh semantic_diff_v3.py file1.py file2.py --output-reasoning-json
High-level interfaces for seamless integration
# Install the SDK
pip install -e .
# High-level interface for AI agents
from code_intelligence import CodeIntelligence
ci = CodeIntelligence('/path/to/project')
# Analyze impact with AI reasoning
result = ci.analyze_impact('app.py', 'user_input', include_reasoning=True)
print(f"Risk: {result.reasoning['risk_assessment']['overall_risk']}")
# Generate documentation with quality assessment
docs = ci.generate_documentation('MyClass.java', style='api-docs')
print(f"Quality: {docs.reasoning['quality_assessment']['clarity_score']:.1%}")
# Safe refactoring with language-aware backend selection and impact analysis
refactor = ci.refactor_safely('oldName', 'newName', scope='project') # Auto-detects Java/Python per file
print(f"Modified {refactor.files_modified} files using {len(refactor.backends_used)} different backends")
SDK Packages:
analysis/
: DataFlowAnalyzer, ImpactAssessor, ASTNavigator, SemanticDiffAnalyzerdocumentation/
: DocumentationGenerator, StyleFormatterrefactoring/
: SafeRefactorer, ASTRefactorersafety/
: GitSafety, FileSafetyapi/
: CodeIntelligenceAPI client
- AI Integration Roadmap - Complete implementation guide
- Unified JSON API - API reference and examples
- AI Reasoning System - Intelligent analysis documentation
- Python SDK Guide - Comprehensive SDK documentation
- Ripgrep-powered search - 10-100x faster than traditional grep
- No file size limits - Edit massive files (10k+ lines) that break AI IDE tools
- Parallel processing - Multi-threaded analysis across entire codebases
- Smart caching - Instant results for repeated operations
- Optimized algorithms - AST parsing with minimal overhead
- Surgical precision - Replace text with regex, whole-word, or fixed-string modes
- Multi-file operations - Refactor across entire projects in seconds
- Git-aware - Target only staged files or specific commits
- Block-aware - Replace within specific code blocks (if/for/while/try)
- JSON pipelines - Chain operations for complex transformations
- Semantic accuracy - Understands code structure, not just text
- Symbol renaming - Rename variables/functions/classes with confidence
- Scope awareness - Changes only affect intended scope
- Multi-language - Python and Java with extensible architecture
- Comment/string modes - Target only comments or string literals
- Language-aware auto-detection - Java files use Java AST, Python files use Python AST
- Multiple backends - Choose between AST, Rope, or text engines, or use auto-detection
- Cross-language - Single interface for Python, Java, JavaScript with optimal backend selection
- Intelligent suggestions - AI-powered refactoring recommendations
- Batch operations - Rename hundreds of symbols in one command across mixed codebases
- Every search mode - Regex, fixed-string, whole-word, case-sensitive
- Context control - Show N lines before/after matches (-A/-B/-C)
- Block extraction - Extract entire functions/classes containing matches
- Method extraction - Pull out complete methods (with size limits)
- Range operations - Extract specific line ranges from files
- AST context - Shows class → method hierarchy for every match
- Multi-file search - Search across file lists or entire directories
- navigate_ast.py - Jump to any symbol definition instantly
- method_analyzer_ast.py - Track call flows and dependencies
- cross_file_analysis_ast.py - Understand module interactions
- show_structure_ast_v4.py - Visualize code hierarchy
- trace_calls_ast.py - Follow execution paths through code
- Intelligent commits - Auto-generated messages from diffs
- Smart staging - Stage only files you actually modified
- Safe operations - All git commands go through SafeGIT
- Workflow automation - GIT SEQ commands for common patterns
- dead_code_detector.py - Find unused code across languages
- suggest_refactoring.py - AI-powered improvement suggestions
- analyze_internal_usage.py - Understand API usage patterns
- error monitoring - Track and analyze runtime errors
# AI agent searching massive codebase efficiently
import time
start = time.time()
result = subprocess.run([
"./run_any_python_tool.sh",
"find_text_v7.py",
"security_issue",
"--json"
], capture_output=True, text=True)
print(f"Searched 1M+ lines in {time.time() - start:.1f}s") # 0.8s vs grep's 45s!
# Edit 15,000 line file
AI IDE tools # ❌ Timeout/crash/truncate
replace_text_v9.py "old" "new" big.py # ✅ 0.3 seconds + backup + undo
# Rename variable across 500 files
Manual IDE refactoring # 2-3 minutes + verification
replace_text_ast_v3.py oldVar newVar # 3 seconds + automatic backup
# Extract all methods from large file
Manual copy/paste # 10+ minutes
find_text_v7.py --extract-method-alllines # 0.2 seconds
Task | Traditional Method | Our Tools | Speedup |
---|---|---|---|
Search 1M lines | grep -r : 45s |
find_text_v7.py : 0.8s |
56x faster |
Edit 15k line file | AI IDE: crash/timeout | replace_text_v9.py : 0.3s |
✅ Works |
Find symbol usage | IDE indexing: 30s+ | navigate_ast.py : 0.1s |
300x faster |
Rename across project | IDE refactor: 2-3 min | replace_text_ast_v3.py : 3s |
40x faster |
Extract all methods | Manual: 10+ min | find_text_v7.py : 0.2s |
3000x faster |
Safe file move | mv + manual backup |
safe_file_manager.py : instant |
✓ Reversible |
Git reset recovery | Often impossible | safegit.py : automatic |
✓ Always safe |
- Ripgrep Core - Written in Rust, uses SIMD, respects .gitignore
- Stream Processing - Never loads entire file into memory (handles any size)
- Smart Caching - Parse AST once, reuse everywhere
- Parallel Processing - All CPU cores utilized automatically
- Optimized Algorithms - Purpose-built for code analysis
- No IDE Overhead - Direct file access, no language servers or indexing
Our toolkit includes over 100 tools for every stage of development, from lightning-fast search and safe refactoring to deep data flow analysis and automated documentation. The entire suite is accessible via our Unified JSON API and Python SDK.
Core Capabilities:
- 🔍 Advanced Analysis - AST-based parsing, data flow tracking, semantic diff
- 🛠️ Safe Refactoring - Multi-engine refactoring with automatic backups
- 🤖 AI Integration - Structured APIs, intelligent reasoning, Python SDK
- 🛡️ Enterprise Safety - Git protection, file safety, operation validation
- 📊 Smart Automation - CI/CD ready, non-interactive mode, batch operations
➡️ See the Complete Feature List and Tool Reference →
Built for safety at every level:
- Defense in depth - Multiple protection layers
- Fail-safe defaults - Safe unless explicitly overridden
- Atomic operations - No partial states
- Comprehensive logging - Full audit trail
SafeGIT-style undo capabilities for all text operations:
- Automatic tracking - Every operation creates an undo point
- Multi-level history - Restore to any previous state
- Atomic operations - All changes are reversible
- Cross-tool awareness - Track changes from any v9/v3/v2 tool
- Compressed backups - Efficient storage of operation history
- Recovery scripts - Generated for every operation
# Every operation is tracked automatically
./run_any_python_tool.sh replace_text_v9.py "old" "new" file.py
# Output: [Undo ID: 1753732740927_91513] Use 'text_undo.py undo --operation 1753732740927_91513' to undo.
# View operation history
./run_any_python_tool.sh text_undo.py history
./run_any_python_tool.sh text_undo.py history --file specific.py
# Undo last operation
./run_any_python_tool.sh text_undo.py undo --last --yes
# Undo specific operation
./run_any_python_tool.sh text_undo.py undo --operation 1753732740927_91513 --yes
# Clean old operations
./run_any_python_tool.sh text_undo.py clean --older-than 30d
Tools with integrated undo support:
replace_text_v9.py
- All text replacements trackedreplace_text_ast_v3.py
- AST-based refactoring with undounified_refactor_v2.py
- Universal refactoring with historyrefactor_rename_v2.py
- Batch operations with rollbacksafe_file_manager.py
- File operations with recovery
Released: July 28, 2025 - This major release completes the migration of all critical tools to use unified interactive utilities, eliminating EOF errors in CI/CD environments while introducing revolutionary tool version updates.
All Python tools now use a shared module for handling interactive prompts:
- No More EOF Errors - Clear, actionable error messages instead of crashes
- Automatic CI Detection - Detects CI/CD, pipes, no TTY environments automatically
- Multiple Config Methods - Command flags > Environment variables > .pytoolsrc > defaults
- Tool Version Updates -
replace_text_v9.py
,replace_text_ast_v3.py
,unified_refactor_v2.py
- Multiple Prompt Types - Yes/no, typed phrases, numbered selections, multi-choice
# Before (EOF crash in CI):
echo "" | python text_undo.py undo --last
# EOFError: EOF when reading a line
# After (helpful error with solutions):
echo "" | python text_undo.py undo --last
# ❌ ERROR: Interactive confirmation required but running in non-interactive mode.
# Use --yes flag to skip confirmation
# Or set TEXT_UNDO_ASSUME_YES=1 environment variable
# Or set 'assume_yes = true' in .pytoolsrc [text_undo] section
Migrated Tools:
- ✅
text_undo.py
- Multi-level undo with interactive selection - ✅
safe_file_manager.py
- Enterprise file operations - ✅
safegit.py
- Git safety wrapper with risk-based confirmations - ✅
replace_text_v9.py
- Text replacement with multi-level undo - ✅
replace_text_ast_v3.py
- AST refactoring with scope awareness
Complete rewrite with breakthrough intelligence capabilities:
- Natural Language Explanations - Complex analysis explained in plain English
- Interactive HTML Visualizations - Self-contained reports with vis.js network graphs
- Risk Assessment - Smart analysis of code change impact with confidence scoring
- Calculation Path Tracking - Step-by-step breakdown of how values are computed
- Type & State Evolution - Monitor how variables change through code execution
- Zero Dependencies - Works with any codebase, no setup required
# Revolutionary intelligence in action
./run_any_python_tool.sh data_flow_tracker_v2.py --var total --show-impact --explain --output-html --file calc.py
Two complementary tools that transform code analysis into professional documentation:
- doc_generator.py - Sophisticated content generation with deep intelligence (2768 lines of logic!)
- doc_generator_enhanced.py - AST tool integration with interactive HTML visualization
- Use both together - Enhanced for exploration, original for production docs
- Multiple Styles - API docs, user guides, technical analysis, quick reference, tutorials, architecture, call graphs
- Interactive HTML - Multi-tab interface with Navigation, Call Flow, Data Flow, Structure, Dependencies
- Multiple Formats - Markdown, HTML, reStructuredText, docstring injection
- Intelligence Integration - Leverages data flow analysis for smart content generation
- Auto-Examples - Contextually appropriate code samples and usage patterns
- Depth Control - Surface, medium, or deep analysis levels
# AI agent generating documentation after writing code
import subprocess
import json
def generate_docs(class_name, file_path):
"""AI-safe documentation generation with structured output"""
result = subprocess.run([
"./run_any_python_tool.sh",
"doc_generator_enhanced.py",
"--class", class_name,
"--file", file_path,
"--format", "json",
"--non-interactive"
], capture_output=True, text=True)
return json.loads(result.stdout)
# Example: AI agent documents the code it just created
docs = generate_docs("UserManager", "auth.py")
print(f"Generated {len(docs['methods'])} method documentations")
- Latest tools only - Main directory contains only current, stable versions
- Safe archival - All older versions preserved in organized
archive/
structure - Clear hierarchy - Easy to identify which tools to use (highest version number)
Current Active Tools:
data_flow_tracker_v2.py
(with intelligence layer) ← NEW MAJOR FEATUREdoc_generator.py
(automated documentation) ← NEW MAJOR FEATUREdoc_generator_enhanced.py
(with full AST integration) ← ENHANCED VERSIONfind_text_v7.py
(with multiline search) ← Latestreplace_text_v9.py
(with escape sequences + multi-level undo) ← Latestreplace_text_ast_v3.py
(enhanced AST refactoring + multi-level undo) ← Latest
- Fixed infinite recursion in data flow tracking - No more crashes with cyclic dependencies
- Enhanced Java method detection - Better regex patterns for complex signatures
- Template system reliability - Jinja2 templates with robust fallback mechanisms
- Updated ALL documentation - Every reference now points to correct tool versions
- Performance benchmarks - Updated with latest capabilities and tool names
- Working examples - All commands tested and verified
# 📖 Generate API documentation with enhanced AST integration
./run_any_python_tool.sh doc_generator_enhanced.py --function calculatePrice --file pricing.py --style api-docs
# 🌐 Create interactive HTML documentation with 6 analysis tabs
./run_any_python_tool.sh doc_generator_enhanced.py --class MyClass --file MyClass.java --style api-docs --format interactive
# 👥 Create user-friendly guides for classes
./run_any_python_tool.sh doc_generator_enhanced.py --class UserManager --file auth.py --style user-guide --depth deep
# 🔬 Generate architecture documentation with call graphs
./run_any_python_tool.sh doc_generator_enhanced.py --module --file database.py --style architecture --format html
# ⚡ Quick reference cards
./run_any_python_tool.sh doc_generator_enhanced.py --function process_data --file data.py --style quick-ref --format docstring
# 🎓 Tutorial-style documentation
./run_any_python_tool.sh doc_generator_enhanced.py --class APIClient --file client.py --style tutorial --depth medium
- BREAKTHROUGH: Intelligence Layer - Revolutionary enhancement that transforms complex analysis into intuitive insights through natural language explanations and interactive visualizations.
# 🧠 Natural Language Explanations - Understand analysis instantly
./run_any_python_tool.sh data_flow_tracker_v2.py --var config --show-impact --explain --file app.py
# 🌐 Interactive HTML Visualization - Explore dependencies visually
./run_any_python_tool.sh data_flow_tracker_v2.py --var total --show-calculation-path --output-html --file calc.py
# 🎯 Combined Intelligence - Best of both worlds
./run_any_python_tool.sh data_flow_tracker_v2.py --var data --track-state --explain --output-html --file process.py
# ⚡ All V2 analysis modes support intelligence layer
./run_any_python_tool.sh data_flow_tracker_v2.py --var x --direction backward --explain --file module.py
Shows where data escapes scope with risk assessment and actionable recommendations:
- Returns: Functions that return values dependent on the variable
- Side Effects: File writes, network calls, console output
- State Changes: Modifications to global variables or class members
- Risk Levels: High/Medium/Low with specific testing advice
Extracts the minimal "critical path" showing exactly how values are calculated:
- Algorithm Flow: Step-by-step calculation breakdown
- Input Tracking: Shows what each step depends on
- Debugging Aid: Trace issues back to their source
- Noise Filtering: Only shows essential calculation steps
Monitors how variable types and states evolve through code execution:
- Type Evolution: Tracks type changes that could indicate bugs
- State Context: Loop and conditional modification tracking
- Warning System: Alerts about potential null references and type issues
- Confidence Scoring: Statistical confidence in type inference
Converts technical analysis into intuitive explanations:
- Risk Assessment: "🚨 High Risk Change: Modifying 'config' affects 5 different places across 3 functions..."
- Algorithm Understanding: "🔍 How 'finalTotal' is Calculated: This value is calculated through 14 steps..."
- Bug Prevention: "
⚠️ Type Changes Detected: dict → UserModel. This could indicate potential bugs..." - Actionable Advice: Specific recommendations for testing and validation
Self-contained professional reports with zero external dependencies:
- vis.js Network Graphs: Click-to-explore node relationships
- Risk-Based Styling: Color-coded by impact level and confidence
- Progressive Disclosure: Overview → drill-down → code context
- Export Capabilities: Save visualizations as PNG images
- Responsive Design: Works on desktop, tablet, and mobile
Transform code analysis into professional documentation:
- Original Version (
doc_generator.py
): Data flow intelligence integration - Enhanced Version (
doc_generator_enhanced.py
): Full AST tool integration with 5 analysis engines - Multiple Styles: API docs, user guides, technical analysis, quick reference, tutorials, architecture, call graphs
- Interactive HTML: Multi-tab navigation showing Overview, Navigation, Call Flow, Data Flow, Structure, Dependencies
- Full Java/Python Parity: Both languages support all analysis features including data flow
- Multiple Formats: Markdown, HTML, docstring, reStructuredText
- Intelligence Integration: Leverages data flow analysis for smart documentation
- Depth Control: Surface, medium, or deep analysis levels
- Auto-Examples: Contextually appropriate code samples and usage patterns
The Perfect Trilogy: Analysis + Visualization + Documentation = Complete Code Understanding
- Before: Powerful analysis requiring expertise to interpret
- After: Complete intelligence platform with analysis, visualization, and documentation
- Impact: Complex codebases become manageable, understandable, and well-documented
- Result: Confident development, debugging, refactoring, and knowledge sharing for everyone
- Improved EOF handling: Added warnings to prevent 'EOF < /dev/null' issues in heredocs
- Tool organization: Better categorization in documentation
- More examples: Real-world use cases for data flow analysis
- Fixed stdin processing in replace_text_v8.py
- Fixed configuration handling in replace_text_ast_v3.py
- Made
--line
optional for--comments-only
and--strings-only
modes in AST tool
Released: July 28, 2025 - This major release completes the migration of all critical tools to use unified interactive utilities, eliminating EOF errors in CI/CD environments.
All Python tools now use a shared module for handling interactive prompts:
- No More EOF Errors - Clear, actionable error messages instead of crashes
- Automatic Detection - Detects CI/CD, pipes, no TTY environments
- Language-Aware Backends - Auto-detects Java vs Python for optimal AST processing
- Configuration Support - Respects
.pytoolsrc
settings for project defaults - Multiple Prompt Types - Yes/no, typed phrases, numbered selections, multi-choice
# Before (EOF crash):
echo "" | python text_undo.py undo --last
# EOFError: EOF when reading a line
# After (helpful message):
echo "" | python text_undo.py undo --last
# ERROR: Interactive confirmation required but running in non-interactive mode.
# Use --yes flag to skip confirmation
# Or set TEXT_UNDO_ASSUME_YES=1 environment variable
# Or set 'assume_yes = true' in .pytoolsrc [text_undo] section
Tools now check for settings in this order:
- Command-line flags -
--yes
,--non-interactive
(highest priority) - Environment variables -
{TOOL}_ASSUME_YES=1
- Tool-specific .pytoolsrc -
[tool_name]
section - Global .pytoolsrc defaults -
[defaults]
section - Hard-coded defaults - Conservative (interactive) by default
The toolkit includes pre-configured profiles for different environments:
.pytoolsrc.ci
- CI/CD automation with auto-confirm and non-interactive mode.pytoolsrc.automation
- Local automation with balanced safety and speed.pytoolsrc.safe
- Maximum safety with dry-run and interactive confirmations
# Use different configuration profiles
export PYTOOLSRC=.pytoolsrc.ci # For CI/CD
export PYTOOLSRC=.pytoolsrc.automation # For local automation
export PYTOOLSRC=.pytoolsrc.safe # For production/critical work
- text_undo.py - Complete with numbered selection menus for restore operations
- safe_file_manager.py - Risk-based confirmations with typed phrases for high-risk ops
- safegit.py - Multi-choice prompts and typed confirmations for dangerous operations
- replace_text_v9.py - Large change confirmations with auto-detection
- replace_text_ast_v3.py - Batch operation confirmations with y/n/q support
- 100% EOF Error Elimination - All migrated tools show helpful messages
- Consistent Behavior - Every tool handles non-interactive mode the same way
- CI/CD Ready - Automatic detection of GitHub Actions, GitLab CI, Jenkins, etc.
- Backward Compatible - All tools include fallback implementations
- Enhanced CLAUDE.md with interactive utils section
- Updated NON_INTERACTIVE_GUIDE.md with new features
- Added comprehensive migration guide for tool developers
- Python 3.7+
- Git
- ripgrep (
rg
)
The toolkit uses a modular dependency system:
Core Dependencies (Required for basic functionality):
javalang>=0.13.0
- Java AST parsing support- Basic Python standard library modules
Optional Dependencies (For enhanced features):
markdown>=3.3.0
- Enhanced HTML conversion in doc_generator.py (falls back to built-in converter if not installed)jinja2>=3.0.0
- Template engine for clean separation of HTML presentation from logic (falls back to built-in templates if not installed)rope>=1.0.0
- Advanced Python refactoring capabilitiesnumpy
,pandas
,scikit-learn
- Advanced semantic diff featuresastroid>=2.0.0
- Enhanced Python AST analysis- See
requirements-optional.txt
for complete list
- Clone the repository:
git clone https://github.com/[your-username]/code-intelligence-toolkit.git
cd code-intelligence-toolkit
- Install dependencies:
# Core dependencies only (minimal installation)
pip install -r requirements-core.txt
# Or install everything including optional features
pip install -r requirements.txt # Installs both core and optional
- Run safety setup:
./setup_config.sh # Interactive configuration
- Test safety features:
# Try a dangerous operation (it will be blocked)
./run_any_python_tool.sh safegit.py reset --hard HEAD~1
class AICodeReviewer:
def __init__(self, toolkit_path):
self.toolkit = toolkit_path
def find_security_issues(self, project_path):
"""AI agent scanning for security vulnerabilities"""
cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"find_text_v7.py",
"password|secret|api_key",
"--scope", project_path,
"--extract-method", # Get full context
"--json"
]
result = subprocess.run(cmd, capture_output=True, text=True)
findings = json.loads(result.stdout)
# AI analyzes each finding
for finding in findings:
if self.is_security_risk(finding['code']):
self.flag_for_review(finding)
class AIRefactoringAgent:
def rename_across_codebase(self, old_name, new_name, file_pattern="*.py"):
"""Safe, AST-aware renaming across entire project"""
# First, find all occurrences
search_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"find_text_v7.py",
old_name,
"--json",
"--scope", "src/"
]
occurrences = self.run_command(search_cmd)
# Then safely rename with AST understanding
for file in occurrences['files']:
rename_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"replace_text_ast_v3.py",
"--file", file,
old_name, new_name,
"--yes" # Non-interactive
]
result = self.run_command(rename_cmd)
print(f"Renamed in {file}: {result['changes_made']} occurrences")
class AIDocumentationAgent:
def document_new_code(self, file_path):
"""AI agent auto-documents code it just created"""
# Generate comprehensive documentation
doc_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"doc_generator_enhanced.py",
"--file", file_path,
"--style", "api-docs",
"--format", "interactive",
"--output", f"{file_path}.html",
"--non-interactive"
]
self.run_command(doc_cmd)
# Also generate user guide
guide_cmd = doc_cmd.copy()
guide_cmd[guide_cmd.index("api-docs")] = "user-guide"
guide_cmd[-2] = f"{file_path}_guide.html"
self.run_command(guide_cmd)
return f"Documentation generated: {file_path}.html"
class AIGitManager:
def safe_commit(self, ai_generated_message):
"""AI safely commits code with auto-generated messages"""
# Stage changes safely
stage_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"safegit.py",
"add", "-u",
"--yes"
]
self.run_command(stage_cmd)
# Generate enhanced commit message
analyze_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"git_commit_analyzer.py",
"--analyze-only",
"--json"
]
analysis = json.loads(self.run_command(analyze_cmd))
# Commit with SafeGIT protection
commit_cmd = [
f"{self.toolkit}/run_any_python_tool.sh",
"safegit.py",
"commit", "-m",
f"{ai_generated_message}\n\nDetails: {analysis['summary']}",
"--force-yes"
]
return self.run_command(commit_cmd)
# Move files with automatic backup
./run_any_python_tool.sh safe_file_manager.py move old_structure/ new_structure/
# Git operations with safety net
./run_any_python_tool.sh safegit.py reset --hard # Creates stash backup first
./run_any_python_tool.sh safegit.py clean -fdx # Shows preview, requires confirmation
Unlike other tools that do one thing well, our toolkit provides:
- Unified interface - One wrapper script for 100+ tools
- Tool chaining - Pipe results between tools for complex workflows
- JSON pipelines - Structured data flow between operations
- Cross-tool intelligence - Tools share AST analysis and caching
- Ripgrep foundation - Fastest regex engine available
- Parallel processing - Utilize all CPU cores automatically
- Smart caching - AST parse once, use everywhere
- Memory efficient - Stream processing for huge files
- Atomic operations - No partial states ever
- Automatic backups - Before every change
- Complete audit trail - Know who changed what, when
- Multi-level undo - Recover from any mistake
- Extract code blocks - Pull out complete if/for/try blocks
- Method extraction - Get entire methods with one command
- AST-guided text ops - Best of both semantic and text approaches
- Git-aware operations - Target staged/modified files only
- Language polyglot - Python, Java, JavaScript, and more
SafeGIT adapts its behavior based on your environment and workflow:
# Set environment context
./run_any_python_tool.sh safegit.py set-env production # Maximum restrictions
./run_any_python_tool.sh safegit.py set-env staging # Standard protections
./run_any_python_tool.sh safegit.py set-env development # Default protections
# Production environment blocks:
# - force push, reset --hard, clean -fdx
# - rebase on main/master branches
# - any operation that could lose committed work
# Set work mode
./run_any_python_tool.sh safegit.py set-mode normal # Default behavior
./run_any_python_tool.sh safegit.py set-mode code-freeze # Only hotfixes allowed
./run_any_python_tool.sh safegit.py set-mode paranoid # Read-only operations only
# Code-freeze mode:
# - Blocks all write operations except on 'hotfix/*' branches
# - Perfect for release preparation periods
# Paranoid mode:
# - Only allows: status, log, diff, show, branch -l
# - Blocks ALL modifications including add and commit
# Add custom pattern restrictions
./run_any_python_tool.sh safegit.py add-restriction "push.*production"
./run_any_python_tool.sh safegit.py add-restriction "merge.*experiment"
# View current context
./run_any_python_tool.sh safegit.py show-context
These settings persist across sessions and provide an extra layer of protection based on your current workflow needs.
Every tool in the toolkit supports non-interactive operation for seamless integration with:
- CI/CD Pipelines - GitHub Actions, GitLab CI, Jenkins, CircleCI
- AI Agents - Claude, GPT, Copilot, and other coding assistants
- Automation Scripts - Bash, Python, or any scripting language
- Docker Containers - Fully automated environments
# Safe File Manager
export SFM_ASSUME_YES=1 # Auto-confirm all file operations
# SafeGIT
export SAFEGIT_NONINTERACTIVE=1 # Strict non-interactive mode
export SAFEGIT_ASSUME_YES=1 # Auto-confirm safe git operations
# Global settings
export PYTOOLSRC_NON_INTERACTIVE=1 # Apply to all tools
[defaults]
non_interactive = true # No prompts, fail if input needed
assume_yes = true # Auto-confirm medium-risk operations
[safe_file_manager]
assume_yes = true
backup = true # Always create backups in automation
[safegit]
non_interactive = true
assume_yes = true
force_yes = false # Never auto-confirm dangerous operations
# Use --yes flag for individual commands
./run_any_python_tool.sh safe_file_manager.py --yes move file1 file2
./run_any_python_tool.sh safegit.py add . --yes
./run_any_python_tool.sh replace_text_ast_v3.py oldVar newVar --file script.py --yes
-
Auto-Approved (with assume_yes):
- Reading files, listing directories
- Creating backups, dry-run operations
- Git status, log, diff
-
Requires --yes or assume_yes:
- Moving/copying files
- Text replacements
- Git add, commit, pull
-
Requires --force-yes explicitly:
- Deleting files (even to trash)
- Git reset --hard
- Git push --force
- Any destructive operation
env:
SFM_ASSUME_YES: 1
SAFEGIT_ASSUME_YES: 1
steps:
- name: Refactor code
run: |
./run_any_python_tool.sh replace_text_v9.py "old_api" "new_api" --scope src/
./run_any_python_tool.sh safe_file_manager.py organize build/ --by-date
./run_any_python_tool.sh safegit.py add .
./run_any_python_tool.sh safegit.py commit -m "Automated refactoring"
For complete non-interactive mode documentation, see NON_INTERACTIVE_GUIDE.md.
When using this toolkit with AI coding assistants:
# ✅ CORRECT - AI must use safegit wrapper
os.system("./run_any_python_tool.sh safegit.py add .")
# ❌ WRONG - Direct git commands are blocked
os.system("git reset --hard") # BLOCKED!
# Enable non-interactive mode for AI
export SAFEGIT_NONINTERACTIVE=1
export SAFEGIT_ASSUME_YES=1 # Still requires --force for dangerous ops
# But NEVER set:
export SAFEGIT_FORCE_YES=1 # This would bypass critical safety!
- CHANGELOG.md - Version history and release notes
- DATA_FLOW_TRACKER_GUIDE.md - Complete data flow analysis and intelligence layer guide
- SAFEGIT_COMPREHENSIVE.md - Complete SafeGIT documentation
- SAFE_FILE_MANAGER_GUIDE.md - Safe file operations guide
- NON_INTERACTIVE_GUIDE.md - Automation safety guide
- CONFIG_GUIDE.md - Configuration for safety
- docs/ - Comprehensive documentation directory
- No Accidental Data Loss - Multiple confirmation layers
- No Surprise Operations - Everything is explicit
- Always Recoverable - Undo system and backups
- AI-Safe - Cannot be tricked into dangerous operations
- Audit Trail - Know what happened and when
- Default Deny - Operations fail safe when uncertain
- No Force Flags in Production - Use environment-specific configs
- Regular Backups - Tools create backups, but have your own too
- Test First - Use
--dry-run
before automation - Read the Warnings - They're there for a reason
Category | Tool | Version | Key Feature |
---|---|---|---|
Documentation | doc_generator.py | NEW | Automated intelligent documentation generation |
Documentation | doc_generator_enhanced.py | ENHANCED | Full AST integration with interactive HTML |
Data Flow | data_flow_tracker_v2.py | v2 | Intelligence layer with explanations & HTML |
Search | find_text_v7.py | v7 | Multiline search with --multiline flag |
Replace | replace_text_v9.py | v9 | Escape sequences + multi-level undo support |
AST Replace | replace_text_ast_v3.py | v3 | Escape sequences + multi-level undo support |
Git Safety | safegit.py | v2.0 | Complete protection, non-interactive mode |
File Safety | safe_file_manager.py | Latest | Atomic operations, complete undo |
Release | release_workflow.sh | Latest | --yes flag for automation |
# Generate documentation (enhanced version recommended)
./run_any_python_tool.sh doc_generator_enhanced.py --function calculatePrice --file pricing.py --style api-docs
# Interactive HTML with all AST analysis
./run_any_python_tool.sh doc_generator_enhanced.py --class MyClass --file code.java --style api-docs --format interactive
# Track data flow with intelligence
./run_any_python_tool.sh data_flow_tracker_v2.py --var input_data --show-impact --explain --file app.py
# Search
./run_any_python_tool.sh find_text_v7.py "pattern" --multiline --type regex
# Replace with newlines
./run_any_python_tool.sh replace_text_v8.py "old" "new\nline" --interpret-escapes
# AST refactoring
./run_any_python_tool.sh unified_refactor_v2.py rename old new --file script.py # Auto-detects Python backend
# Safe file operations
./run_any_python_tool.sh safe_file_manager.py move old.txt new.txt
# Safe git
./run_any_python_tool.sh safegit.py status
While the toolkit provides immediate value with its built-in safety features, achieving maximum protection requires blocking direct access to dangerous commands at the system level. This is especially critical when using AI coding assistants.
Recent incidents demonstrate that AI agents can cause catastrophic damage:
- Replit's AI database wipe - Complete data loss from AI assistant
- Accidental
rm -rf /
- Entire systems destroyed by AI misunderstanding - Git force pushes - Permanent loss of team's work
- File system corruption -
dd
commands overwriting critical data
┌─────────────────────────────────────────────────────┐
│ AI Agent Protection │
├─────────────────────────────────────────────────────┤
│ Level 1: Safe Tools (Immediate) │
│ • Automatic backups before operations │
│ • Smart confirmations prevent accidents │
│ • Complete undo/recovery capabilities │
├─────────────────────────────────────────────────────┤
│ Level 2: System Lockdown (Maximum Protection) │
│ • Block dangerous commands at OS level │
│ • Enforce safe alternatives only │
│ • Monitor and alert on bypass attempts │
│ • Zero-trust configuration for AI agents │
└─────────────────────────────────────────────────────┘
Single most compelling SafeGIT example:
# AI agent attempts dangerous operation
git reset --hard # ❌ BLOCKED with confirmation required
# Safe alternative automatically suggested
./run_any_python_tool.sh safegit.py reset --hard # ✅ Creates backup first
Single most compelling Safe File Manager example:
# AI agent attempts file deletion
rm important_files/ # ❌ BLOCKED - rm not available
# Safe alternative with full recovery
./run_any_python_tool.sh safe_file_manager.py trash important_files/ # ✅ Reversible
For step-by-step implementation of enterprise-grade AI safety:
➡️ Complete AI Safety Setup Guide →
Includes:
- Code-level protection - AI agent integration patterns
- System-level lockdown - Shell restrictions and command blocking
- Container isolation - Docker/Kubernetes deployment
- Enterprise compliance - Audit trails and monitoring
- Validation scripts - Automated safety testing
- Incident response - When safety measures are bypassed
With maximum protection in place:
- 🛡️ Zero risk of AI agents destroying data
- 📊 Complete audit trail of all operations
- ↩️ Instant recovery from any mistake
- 😌 Peace of mind when using AI assistants
- ✅ Compliance ready for regulated environments
Remember: The safe tools only protect you if dangerous commands are blocked at the source!
We welcome contributions that enhance safety! Please ensure:
- All code follows safety-first principles
- Dangerous operations have confirmations
- Changes are reversible where possible
- Documentation includes safety warnings
Mozilla Public License 2.0 (MPL-2.0) - See LICENSE.txt
- Built in response to real-world AI disasters
- Inspired by aerospace "fail-safe" design principles
- Thanks to the community for safety feedback
Remember: In software, as in life, safety first! 🛡️
"The best error is the one that never happens." - Code Intelligence Toolkit Philosophy
Keywords: AI Agent Development, Safe Code Refactoring, Static Analysis Tools, AI Safety, Data Flow Analysis, Python SDK, Code Intelligence, Zero-Index Architecture, DevSecOps, CI/CD Automation, Java Code Analysis.