prolog-ninja
Prolog-powered system optimizer - uses logical reasoning to optimize your computer for specific tasks.
The "wheel within a wheel" - a reasoning engine inside a Python package that analyzes your hardware and generates smart optimization recommendations.
How It Works
- Detects your system hardware (CPU, RAM, GPU, disk, power status)
- Converts hardware specs into Prolog-style facts
- Reasons using rules to determine suitability and optimizations
- Recommends (or applies) settings for your chosen task
Your Hardware → Facts → Prolog Engine → Rules → Recommendations
↓ ↓ ↓
CPU: 8 cores cpu_cores(8) suitable_for(gaming, good) :-
RAM: 16GB ram_gb(16) has_dedicated_gpu(true),
GPU: RTX 3080 gpu_vendor(nvidia) ram_gb(R), R >= 8.
Installation
pip install prolog-ninja
Quick Start
# See your system info
prolog-ninja info
# List available optimization tasks
prolog-ninja list
# Get recommendations for gaming
prolog-ninja optimize gaming
# Check if your system can handle ML training
prolog-ninja check ml_training
# See the reasoning behind recommendations
prolog-ninja explain gaming
# Interactive mode
prolog-ninja interactive
Available Tasks
| Task | Description |
|---|---|
gaming |
Optimize for gaming performance |
video_editing |
Optimize for video editing (Premiere, DaVinci) |
programming |
Optimize for software development |
ml_training |
Optimize for machine learning training |
streaming |
Optimize for live streaming (OBS) |
3d_modeling |
Optimize for 3D modeling (Blender, Maya) |
audio_production |
Optimize for audio production (DAWs) |
compiling |
Optimize for compiling large projects |
virtualization |
Optimize for running VMs |
data_analysis |
Optimize for data analysis (pandas, R) |
office |
Optimize for office work |
web_dev |
Optimize for web development |
battery_saver |
Maximize battery life |
quiet |
Minimize fan noise |
balanced |
Balanced performance |
Usage Examples
Check System Info
$ prolog-ninja info
==================================================
SYSTEM INFORMATION
==================================================
OS: Linux 6.6.87
(Running in WSL)
CPU: AMD Ryzen 7 5800X
Cores: 16 (8 physical)
Tier: HIGH
RAM: 32.0 GB total (24.5 GB available)
Tier: HIGH
GPU: NVIDIA GeForce RTX 3080 (10.0 GB VRAM)
Dedicated: Yes
Tier: HIGH
Disk: NVME - 500 GB total (234 GB free)
Tier: HIGH
Power: Desktop (AC)
Get Optimization Recommendations
$ prolog-ninja optimize gaming
============================================================
OPTIMIZATION REPORT: GAMING
============================================================
Task: Optimize for gaming performance
--- System Summary ---
CPU: 16 cores (high)
RAM: 32.0 GB (high)
GPU: nvidia GeForce RTX 3080 (high)
DISK: nvme (high)
Suitability: EXCELLENT
--- Recommended Optimizations ---
1. Set power plan to High Performance for maximum speed
2. Set GPU to prefer maximum performance
3. Disable unnecessary background applications
4. Set application priority to High
Run Prolog Queries
$ prolog-ninja query "suitable_for(X, excellent)"
Query: suitable_for(X, excellent)
----------------------------------------
Found 3 solution(s):
1. X = gaming
2. X = programming
3. X = compiling
Explain the Reasoning
$ prolog-ninja explain ml_training
Reasoning Explanation: ML_TRAINING
==================================================
1. System Facts (detected from your system):
----------------------------------------
cpu_cores(16)
ram_total_gb(32.0)
gpu_vendor(nvidia)
gpu_vram_gb(10.0)
has_dedicated_gpu(True)
...
2. Suitability Query: suitable_for(ml_training, Rating)?
----------------------------------------
→ Rating = excellent
3. Optimization Query: optimize(ml_training, Setting, Value)?
----------------------------------------
→ set_power_mode = high_performance
→ set_cuda_visible_devices = 0
→ set_process_priority = high
4. Warning Query: warning(ml_training, Type, Message)?
----------------------------------------
→ No warnings
Python API
from system_sage import (
detect_system, get_system_facts,
PrologEngine, Fact, Rule,
optimize_for, list_tasks, get_recommendations
)
# Detect your system
system = detect_system()
print(f"CPU: {system['cpu']['cores']} cores")
print(f"GPU: {system['gpu']['vendor']} {system['gpu']['model']}")
# Get recommendations
recs = get_recommendations("gaming")
print(f"Suitability: {recs['suitability']}")
for opt in recs['optimizations']:
print(f" - {opt['description']}")
# Use the Prolog engine directly
engine = PrologEngine()
engine.add_fact("likes", "alice", "python")
engine.add_fact("likes", "bob", "prolog")
# Query
from system_sage.reasoner import var, fact
X = var("X")
for solution in engine.query(fact("likes", X, "python")):
print(f"Who likes Python? {solution['X']}")
The Prolog Engine
prolog-ninja includes a lightweight Prolog-style reasoning engine with:
- Unification - Pattern matching with variables
- Backtracking - Find all solutions via Python generators
- Rules - Define complex relationships
- Built-in predicates -
>=,<=,>,<,==,!=,member,not
from system_sage.reasoner import PrologEngine, var, fact, rule
engine = PrologEngine()
# Add facts
engine.add_fact("parent", "tom", "bob")
engine.add_fact("parent", "tom", "liz")
engine.add_fact("parent", "bob", "ann")
# Add rules
X, Y, Z = var("X"), var("Y"), var("Z")
engine.add_rule(
fact("grandparent", X, Z),
fact("parent", X, Y),
fact("parent", Y, Z)
)
# Query
for sol in engine.query(fact("grandparent", "tom", var("Who"))):
print(f"Tom is grandparent of: {sol['Who']}")
# Output: Tom is grandparent of: ann
Support
If you find this project useful, consider supporting its development:
License
MIT License
Metadata
Release files for prolog-ninja 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prolog_ninja-1.0.0.tar.gz | 20.1 kB | Without provenance | Details for prolog_ninja-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prolog_ninja-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for prolog_ninja-1.0.0-py3-none-any.whl |
Total release size: 42.4 kB
Release files / prolog_ninja-1.0.0.tar.gz
| Download URL | prolog_ninja-1.0.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b05e5ffa3203aad222d1fcbb4c3c118d14249489a9c35a52a97757dfc3751fe
|
|
BLAKE2b-256 checksum How to use checksums |
a4752860aa8bea8c7f7eafae868e4cacd5d7a3d281d8d865284f4dd213f3b5a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / prolog_ninja-1.0.0-py3-none-any.whl
| Download URL | prolog_ninja-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5340391ceb248d7f89ce623f3c334464abb96f942b6fdbaf744ec2373b6e8627
|
|
BLAKE2b-256 checksum How to use checksums |
cd2166b471ad5dc3955880bf85fd7448f0f0f87f2930eae61d71873addaab796
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for prolog-ninja 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.