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.
git clone https://github.com/ProximaSF/Simple-Linux-Shell-AI-Wrapper-
Create
.envfile inside the cloned repository and add these variableAWS_BEARER_TOKEN_BEDROCK = ... LOG_FILE = ...
-
AWS_BEARER_TOKEN_BEDROCK: AWS Bedrock API key
-
LOG_FILE: File path to
logging.logfor AI to read
-
-
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
- To deactivate, simply type
-
Using the active .venv working directory to install required packages:
pip install -r requirements.txt
-
In host directory (
/home/{hostname}) create two folders:mkdir logs mkdir bin
-
In
/home/{hostname}/bindirectory: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
.venvpython interpreter - Second path point to the python script (should be in the same working directory of the clone repository)
- The first path points to the
- Make sure the two file paths at the bottom of the script points to the right direction.
-
Inside of
nano ~./bashrcadd these two lines at the very bottom:export PATH="$PATH:/home/{hostname}/bin/logging.sh" export PATH="$PATH:/home/{hostname}/bin/AIag"
-
Start logging.sh script by
logging.shin terminal -
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
catcommand to read content in proper format
- All input and output will be recorded in
-
Type
exitto stop script (optional) -
Ask AI what's in the context
AIag "What is this file?"
-
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
deepseekorclaudeto change model
- Default model:
- While logging.sh is running, running commands like
clearshould not reset/clear therecorded_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 :/