Skip to content

jaywal04/Linux-Shell-AI-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Linux Terminal AI Wrapper

The goal of this project is to integrate a simple AI wrapper to help the user better understand the outputs it receive from the terminal invoked by the user. The output and input in the terminal is logged automatically after running ./shell_logging.sh and is saved in a personal log directory inside the host (/home/{hostname}directory.

To run the AI (DeepSeek version 3.2) and ask question(s) pertain to the log content, it uses a custom shell command. In my case, it's AIag. For more details about arguments, please go to .... The command calls the AIag.sh script. Within the script, it than calls the python script which will call the AI model using a API key and than reading the log content and return it's content upon successful exacution.


Setup Instruction:

1. Clone Repository

git clone https://github.com/ProximaSF/Simple-Linux-Shell-AI-Wrapper
  • Create .env file inside the cloned repository and add these variable

    AWS_BEARER_TOKEN_BEDROCK = ...
    LOG_FILE = ...
    • AWS_BEARER_TOKEN_BEDROCK: AWS Bedrock API key

    • LOG_FILE: File path to logging.log for AI to read

2. Setup virtual environment (.venv)

  • In a empty directory terminal, past:

    python -m venv .venv
  • Activate .venv

    source ".venv/bin/activate" # for bash
    .venv/Scripts/activate # for powershell
    • To deactivate, simply type deactivate

3. Install Dependencies

  • Using the active .venv working directory to install required packages:

    pip install -r requirements.txt

4. Create logs and bin folder

  • In host directory (/home/{hostname}) create two folders:

    mkdir logs
    mkdir bin

5. Create logging.sh and AIag inside bin

  • In /home/{hostname}/bin directory:

    nano logging.sh
  • Copy script in clone repository ("bash scripts/logging.sh") and past it to the editor. Save (ctrl+o) and exit to create the file (ctrl+x)

  • Allow the new script to run in terminal:

    chmod +x logging.sh 
  • Repeat the same process for AIag

    • Make sure the two file paths at the bottom of the script points to the right direction.
      • The first path points to the .venv python interpreter
      • Second path point to the python script (should be in the same working directory of the clone repository)

6. Add scripts to SYSTEM PATH

  • Inside of nano ~./bashrc add these two lines at the very bottom:

    export PATH="$PATH:/home/{hostname}/bin/logging.sh"
    export PATH="$PATH:/home/{hostname}/bin/AIag"

7. Finally Reset system (Might be Optional)


How to Use:

  1. Start logging.sh script by logging.sh in terminal

  2. Enter commands

    • All input and output will be recorded in /logs/recorded_session.log
    • The content will be the exact clone of the input, thus there will be bash ANSI escape sequences and terminal control characters.
    • Use cat command to read content in proper format
  3. Type exit to stop script (optional)

  4. Ask AI what's in the context

    AIag "What is this file?"

Bash Script Arguments:

  • Prompt: a required argument to ask AI a question based on the context it can see

  • Token (-tk): optional argument to determine how many token will be used for the output.

    • Default int: 150
  • Verbose (-v): optional argument to echo and return verbose from python

  • Model (-m): optional argument to chose which models to use

    • Default model: deepseek.v3.2
    • As of now, simply type deepseek or claude to change model

Side Notes:

  • While logging.sh is running, running commands like clear should not reset/clear the recorded_session.log
  • Python script is configured for DeepSeek v3.2 and claude_Sonnet4_6 for US.
  • Might need to fill out a form to use Claude on AWS Bedrock.

## Possible Future Improvement Check List
  • Allow different models
  • Prevent AI response being logged in logging.log
  • Provide additional file
  • Default chat mode (without using file)
  • Find a job :/

About

Linux Based AI Wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors