Skip to content

About

AI-powered Windows system analysis assistant using Google Gemini, deterministic diagnostics, natural-language command routing, process/startup/storage analysis, software health analysis, controlled Windows actions, software verification, and a risk-based safety and approval system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

23 Commits

Folders and files

Repository files navigation

πŸ–₯️ System Analysis Chatbot

An AI-powered Windows system analysis assistant that combines Google Gemini, deterministic system diagnostics, natural-language command routing, controlled Windows tools, and a risk-based safety layer.

Python Streamlit Gemini Tests Platform


πŸ“Œ Overview

System Analysis Chatbot is a local AI-powered desktop assistant designed to help users inspect and interact with their Windows system through natural-language commands.

The project combines:

  • πŸ€– Google Gemini for conversational AI and system explanation
  • 🧠 Intent-based command routing
  • πŸ–₯️ Windows system analysis
  • πŸ“¦ Installed software discovery
  • βš™οΈ Process analysis
  • πŸš€ Startup application analysis
  • πŸ’Ύ Large-file and storage analysis
  • πŸ“₯ Controlled software installation and verification
  • πŸ” Risk-based safety and approval
  • πŸ›‘οΈ Allowlisted Windows application launching
  • πŸ§ͺ Automated testing

The project intentionally separates AI reasoning from system execution.

Instead of allowing an LLM to directly execute arbitrary operating-system commands, requests pass through a controlled execution pipeline.


🧠 Core Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     User Input       β”‚
                    β”‚  Natural Language    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚    Command Router    β”‚
                    β”‚                      β”‚
                    β”‚ Intent + Confidence  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Safety / Approval  β”‚
                    β”‚                      β”‚
                    β”‚ Risk Classification  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚    Tool Executor     β”‚
                    β”‚                      β”‚
                    β”‚ Controlled Dispatch  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                β”‚                β”‚
              β–Ό                β–Ό                β–Ό
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚  Software   β”‚  β”‚   System    β”‚  β”‚   Windows   β”‚
       β”‚    Tools    β”‚  β”‚   Analysis  β”‚  β”‚   Actions   β”‚
       β”‚             β”‚  β”‚             β”‚  β”‚             β”‚
       β”‚ Scan        β”‚  β”‚ Processes   β”‚  β”‚ Open URL    β”‚
       β”‚ Install     β”‚  β”‚ Startup     β”‚  β”‚ Launch App  β”‚
       β”‚ Verify      β”‚  β”‚ Storage     β”‚  β”‚             β”‚
       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
              β”‚                β”‚                β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚ Structured Results   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Gemini Analysis    β”‚
                    β”‚ & Human Explanation  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design Principle

AI interprets what the user wants. Deterministic tools determine what is actually happening.

This separation makes the system easier to test, extend, and control.


✨ Features

πŸ€– Gemini-Powered System Diagnosis

The application combines deterministic system measurements with Gemini-powered reasoning.

Gemini can explain findings related to:

  • CPU health
  • Memory utilization
  • Storage conditions
  • Installed software
  • Software-health findings
  • Overall system-health observations

The AI is not treated as the source of truth for raw system measurements.

Instead:

System Metrics
      ↓
Deterministic Analysis
      ↓
Structured Findings
      ↓
Gemini
      ↓
Human-readable Explanation

This reduces the possibility of the model inventing system facts.


🧠 Natural-Language Command Routing

User commands are converted into structured intents before reaching system tools.

Supported intents

Intent Purpose
SYSTEM_INFO Retrieve system information
SOFTWARE_SCAN Scan installed software
PROCESS_ANALYSIS Analyze running processes
STARTUP_ANALYSIS Analyze Windows startup applications
STORAGE_ANALYSIS Find large files
SOFTWARE_INSTALL Install supported software
OPEN_URL Open a URL
LAUNCH_APPLICATION Launch an approved Windows application
CHAT Normal conversational interaction
UNKNOWN Unrecognized command

Example

"show running processes"
          β”‚
          β–Ό
    Command Router
          β”‚
          β–Ό
 PROCESS_ANALYSIS
          β”‚
          β–Ό
 Process Analyzer
          β”‚
          β–Ό
 Structured Result

The router therefore keeps intent recognition separate from execution.


πŸ–₯️ Windows System Analysis

The current implementation is focused specifically on Windows.

Windows-specific APIs and system interfaces are used where appropriate, while the higher-level architecture remains modular enough to support additional platforms later.


πŸ“¦ Installed Software Analysis

Installed Windows software can be discovered using:

  • Windows AppX packages
  • Windows Registry
  • Win32 application registry entries
  • 32-bit registry entries

Collected information can include:

  • Application name
  • Version
  • Publisher
  • Installation location
  • Installation metadata

Software Health Analysis

The software-health layer can identify:

  • Missing installation paths
  • Missing versions
  • Missing publishers
  • Duplicate application names
  • Large installed applications

βš™οΈ Process Analysis

The process analyzer uses psutil to inspect running Windows processes.

It can analyze:

  • CPU usage
  • Memory usage
  • Process count
  • Process status
  • Process ownership

Example commands

show running processes
what is using my cpu
show top memory processes

The analyzer produces structured results that can then be displayed or passed into the AI explanation layer.


πŸš€ Windows Startup Analysis

The startup analyzer inspects Windows Registry startup locations.

Currently checked locations include:

HKCU
HKLM
HKLM 32-bit

Example commands

startup apps
show startup programs
what starts with Windows

Returned information includes:

  • Application name
  • Startup command
  • Registry source

πŸ’Ύ Storage Analysis

The storage analyzer searches the Windows filesystem for large files.

It supports:

  • Configurable traversal depth
  • Configurable result limits
  • File-size sorting
  • Permission-error handling
  • Missing-file handling
  • Windows system-directory exclusions

Example commands

show largest files
find large files
what is using my storage

Results include:

  • File name
  • Full path
  • Size in MB
  • Size in GB

πŸ“₯ Software Installation & Verification

The project includes a controlled software installation pipeline.

User Request
     β”‚
     β–Ό
Command Router
     β”‚
     β–Ό
Safety Layer
     β”‚
     β–Ό
User Approval
     β”‚
     β–Ό
Download
     β”‚
     β–Ό
Windows Installer
     β”‚
     β–Ό
Installation Verification
     β”‚
     β–Ό
Confirmed Result

A completed installer process alone is not considered sufficient evidence of successful installation.

After installation, the application performs a verification step to determine whether the software is actually detected on the system.


πŸ” Safety & Approval System

Every executable system action is associated with a risk level.

Action Risk Confirmation
System information 🟒 Low No
Software scan 🟒 Low No
Process analysis 🟒 Low No
Startup analysis 🟒 Low No
Storage analysis 🟒 Low No
Open URL 🟒 Low No
Launch application 🟑 Medium Yes
Software installation πŸ”΄ High Yes
Unknown action πŸ”΄ High Yes

The safety layer is implemented independently from the Streamlit UI.

This means an action cannot simply bypass the normal safety policy by reaching an underlying tool through the standard execution pipeline.


πŸ›‘οΈ Controlled Windows Actions

Application Allowlist

The project does not allow arbitrary application strings to be passed directly to a shell.

Currently supported applications include:

notepad
calculator
calc

Application launching uses:

subprocess.Popen(
    ["notepad.exe"],
    shell=False
)

rather than unrestricted shell execution.

This provides an additional protection layer against arbitrary command execution.


URL Actions

URLs can be opened through a dedicated tool:

open https://example.com

URL handling is separated from application launching and follows its own execution path.


πŸ—οΈ Tool-Based Architecture

The system uses a registry and executor pattern for system capabilities.

User Command
     β”‚
     β–Ό
Command Router
     β”‚
     β–Ό
Structured Intent
     β”‚
     β–Ό
Tool Registry
     β”‚
     β–Ό
Safety Policy
     β”‚
     β–Ό
Tool Executor
     β”‚
     β–Ό
Controlled Function
     β”‚
     β–Ό
Structured Result

This architecture allows new system capabilities to be added without turning the chatbot into an unrestricted command shell.


🧩 Core Components

command_router.py

Converts natural-language commands into structured RoutedCommand objects.

Example:

RoutedCommand(
    intent=CommandIntent.PROCESS_ANALYSIS,
    command="show running processes",
    confidence=0.90
)

The router determines:

  • User intent
  • Original command
  • Confidence score
  • Whether confirmation may be required

tool_registry.py

Maintains the controlled mapping between command intents and executable tools.

Conceptually:

Intent
  ↓
Tool Registry
  ↓
Approved Function

This prevents arbitrary user input from being directly mapped to arbitrary Python functions.


tool_executor.py

Responsible for controlled tool execution.

The executor:

  1. Receives a routed command
  2. Resolves the associated tool
  3. Retrieves its safety policy
  4. Determines whether confirmation is required
  5. Executes the tool if permitted
  6. Returns a structured result
  7. Handles execution errors

safety.py

Centralizes risk classification and approval policies.

Unknown actions use a restrictive policy that requires confirmation.

This keeps security decisions independent from the UI.


system_diagnosis.py

Provides deterministic system-health calculations and Gemini-based diagnosis.

The deterministic layer establishes the actual system measurements.

Gemini is then used to explain those findings.


windows_actions.py

Contains controlled Windows actions such as:

  • Opening URLs
  • Launching allowlisted applications

Platform checks prevent these actions from executing on unsupported operating systems.


πŸ“‚ Project Structure

System_Analysis_Chatbot/
β”‚
β”œβ”€β”€ app.py
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ chat_db.py
β”‚   β”œβ”€β”€ chats.py
β”‚   β”œβ”€β”€ command_router.py
β”‚   β”œβ”€β”€ installexe.py
β”‚   β”œβ”€β”€ model.py
β”‚   β”œβ”€β”€ process_analysis.py
β”‚   β”œβ”€β”€ safety.py
β”‚   β”œβ”€β”€ software_details.py
β”‚   β”œβ”€β”€ software_health.py
β”‚   β”œβ”€β”€ startup_analysis.py
β”‚   β”œβ”€β”€ storage_analysis.py
β”‚   β”œβ”€β”€ system_diagnosis.py
β”‚   β”œβ”€β”€ tool_executor.py
β”‚   β”œβ”€β”€ tool_registry.py
β”‚   └── windows_actions.py
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_command_router.py
β”‚   β”œβ”€β”€ test_windows_process_analysis.py
β”‚   β”œβ”€β”€ test_windows_startup.py
β”‚   β”œβ”€β”€ test_windows_storage.py
β”‚   β”œβ”€β”€ test_windows_actions.py
β”‚   └── test_windows_action_execution.py
β”‚
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ requirements.txt
└── README.md

πŸ§ͺ Testing

The project includes a Windows-focused automated test suite.

Windows-specific behavior is mocked where necessary so the implementation can be tested safely from the development environment.

Test coverage includes

  • Command routing
  • Process analysis
  • Startup analysis
  • Storage analysis
  • Windows URL actions
  • Windows application launching
  • Application allowlisting
  • Safety confirmation
  • Tool execution
  • Error handling

Run tests

pytest -q

Current result

28 passed

28/28 tests currently pass.


πŸ› οΈ Technology Stack

Technology Purpose
Python Core application
Streamlit Local user interface
Google Gemini AI conversation and analysis
psutil Process and system information
PowerShell Windows software discovery
Windows Registry Software and startup discovery
python-dotenv Environment configuration
pytest Automated testing

πŸš€ Local Setup

1. Clone the repository

git clone https://github.com/arjungupt771/System_Analysis_Chatbot.git
cd System_Analysis_Chatbot

2. Create a virtual environment

On Windows:

python -m venv venv

Activate it:

venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Configure Gemini

Create a .env file in the project root:

GEMINI_API_KEY=your_gemini_api_key

A template is available at:

.env.example

⚠️ Important

Never commit your actual .env file or API key to GitHub.


5. Start the application

streamlit run app.py

The Streamlit interface will open in your browser.


πŸ’¬ Example Commands

System information

system info
show system information

Software

scan apps
show installed software

Processes

show running processes
what is using my cpu
show top memory processes

Startup

startup apps
show startup programs

Storage

show largest files
find large files
what is using my storage

Software installation

install vlc

Software installation is classified as a high-risk action and therefore requires explicit approval.

URL

open https://example.com

Application

open notepad
open calculator

Application launching requires confirmation because it performs an external system action.


πŸ”’ Security Design

The project intentionally avoids giving the language model unrestricted access to the operating system.

The execution pipeline is:

User Input
    ↓
Intent Recognition
    ↓
Tool Validation
    ↓
Safety Policy
    ↓
Approval if Required
    ↓
Controlled Tool
    ↓
Structured Result

Security properties

  • No unrestricted shell execution
  • Explicit tool registry
  • Risk-based action policies
  • Confirmation for sensitive operations
  • Application allowlisting
  • shell=False for process launching
  • Windows platform guards
  • Input validation
  • Installation verification
  • Structured execution results
  • Restrictive handling of unknown intents

🎯 Design Philosophy

The system deliberately separates AI reasoning from system execution.

Avoided architecture

User
  ↓
LLM
  ↓
Arbitrary OS Command

Implemented architecture

User
  ↓
AI / Intent Router
  ↓
Structured Intent
  ↓
Safety Layer
  ↓
Approved Tool
  ↓
Actual System Data
  ↓
AI Explanation

This makes the system:

  • More predictable
  • Easier to test
  • Easier to extend
  • Safer to operate
  • Less dependent on LLM-generated system facts

🧱 Extensibility

Adding a new system capability follows a controlled pattern:

New Intent
    ↓
New Tool
    ↓
Tool Registry Entry
    ↓
Safety Policy
    ↓
Executor Integration
    ↓
Tests

This allows the assistant to grow without turning the project into an unrestricted operating-system command interface.


πŸͺŸ Platform Support

Platform Status
Windows βœ… Supported
Linux 🚧 Future
macOS 🚧 Future

The current implementation intentionally prioritizes Windows-specific functionality.

The routing, registry, safety, and executor architecture can later be reused for platform-specific implementations.


πŸ“Š Project Status

Implemented

  • Gemini integration
  • Deterministic system-health analysis
  • Software-health analysis
  • Windows software discovery
  • Software installation verification
  • Natural-language command routing
  • Tool registry
  • Tool executor
  • Windows process analysis
  • Windows startup analysis
  • Windows storage analysis
  • Safety and approval layer
  • Windows URL actions
  • Controlled application launching
  • Application allowlisting
  • Windows-focused automated tests
  • 28/28 tests passing
  • GitHub documentation

Future Scope

  • Linux system-analysis support
  • Additional Windows diagnostics
  • More controlled Windows automation
  • Expanded system-health recommendations
  • Additional AI-assisted troubleshooting

⚠️ Limitations

The current project has several intentional limitations:

  1. Windows is the supported runtime platform.
  2. Some capabilities depend on Windows APIs, Registry access, and PowerShell.
  3. Application launching is restricted to an explicit allowlist.
  4. Sensitive actions require explicit confirmation.
  5. Software installation depends on configured installer sources.
  6. Storage analysis is bounded by traversal depth and result limits.
  7. Gemini functionality requires a valid API key.

These limitations are intentional design decisions that keep system interaction controlled.


πŸ‘¨β€πŸ’» Author

Arjun Gupta

B.Tech β€” Information Technology
VIT Vellore

GitHub:
https://github.com/arjungupt771


πŸ“„ License

No license has currently been specified for this repository.

If the project is later released for redistribution or open-source use, an appropriate license can be added.


Built with Python Β· Streamlit Β· Google Gemini Β· Windows System Tooling

About

AI-powered Windows system analysis assistant using Google Gemini, deterministic diagnostics, natural-language command routing, process/startup/storage analysis, software health analysis, controlled Windows actions, software verification, and a risk-based safety and approval system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages