Updated CodeSage v1.2.0
Feel free to post improvements.
Enjoy!
Best,
Xard777
It looks like you’ve reached a solid milestone with CodeSage v1.2.0. At 378 lines, the script is lean but pack-heavy with "under-the-hood" improvements.
Based on the code you shared, here is a breakdown of why this specific version is so much more robust than its predecessors and what that line count represents:
1. Robust Engine Room (The Logic)
While the UI remains familiar and compact, the logic has been "hardened" to handle real-world failures:
Path Resilience: The dynamic path configuration now correctly identifies if it's running from a /src subfolder or the project root.
Safe Cleanup: Unlike previous versions that might have accidentally archived the script itself, the StorageManager.cleanup() now specifically ignores the running file.
Defensive API Client: The DeepSeekAPI class now includes resp.raise_for_status() and explicit handling for requests.exceptions.Timeout, ensuring the app doesn't crash if the server is down or the network hiccups.
2. Thread-Safe Architecture
One of the main reasons for the line increase is the addition of thread safety:
RLock & Lock: The use of threading.RLock() for the history and threading.Lock() for the API key ensures that background processes don't collide with UI updates.
Anti-Spam UI Locking: The _is_processing flag prevents multiple threads from spawning if a user clicks "Send" repeatedly, which protects both your local resources and your API credits.
3. Cross-Platform "Blackboard" Management
The open_bb function now intelligently detects the operating system (Linux, macOS, or Windows) to use the correct system command (xdg-open, open, or os.startfile) for opening your Markdown files.
4. Performance & Memory Management
History Trimming: The script now automatically trims the conversation history to the last 20 pairs (40 messages). This prevents the "token bloat" that can slow down responses and increase costs over long sessions.
Hot-Reloading: The .env file is re-read on every query, allowing you to swap API keys or settings without restarting the application.
UI Summary at a Glance
Feature Implementation
Status Bar Centered using place(relx=0.5) to align with the OS window title.
Shortcuts Added Ctrl+N (New), Ctrl+L (Load), and Ctrl+S (Save).
Project Persistence .sage files now include the full log, history, and blackboard state.
You've essentially moved from a "script" to a "Platform". Since you mentioned this is for the community to make their mark, this 378-line foundation is exactly what they need—stable enough to use daily, but readable enough to modify.
I have simply zipped up the CodeSage folder --
check the readme file inside on getting started or ask Antigravity
When running a project you can click on Blackboard to see what the AI is thinking and you can add/delete as you see fit then save the Project and recall it whenever suits you.
To run the application:
bash
# Activate virtual environment
source venv/bin/activate
# Install/update requirements if needed
pip install -r requirements.txt
# Run CodeSage
python src/codesage_v1.2.0.py or startLAB.sh
Some will add their mark by updating CodeSage, others will leave their mark from using CodeSage -- this is what is great about these projects in 2026 -- the next iteration of CodeSage will no doubt have some form of OpenClaw running alongside DS4
Attachments forums
Re: 🖥️ Creating your own HomeLAB for trading
xard777, Mon Apr 20, 2026 2:44 am