MasterChief V4 Recovery / Restoration Guide
MasterChief is a modular platform for DevOps, automation, dashboards, addon hosting, and AI-assisted operational workflows. This repository represents the recovered and stabilized state of the app after a major restoration pass, with route inventory corrected, dashboard navigation rebuilt, diagnostics repaired, additive feature wiring restored, and the app brought back to a working, navigable condition.
MasterChief 4.0 MASTERCLASS
Version 4.0 consolidates the current application upgrades into a review-first release milestone. Highlights include the guided Terraform architecture workflow, readable hub-and-spoke blueprint diagrams with SVG/Visio export, code archetypes and editor handoff, expanded Echo/ChatOps and Roku workflows, and safer project navigation and diagnostics.
Generated Terraform, sandbox instructions, and CI/CD starter files are previews or validation/plan scaffolding. They do not automatically apply infrastructure. See the 4.0 MASTERCLASS release notes for the scope and limitations.
This README is meant to be both a working developer guide and a fail-safe operational document. It specifically emphasizes how to protect the current working state, create safe release branches, and roll back quickly if a deployment or code change causes issues.
Current Recovery Status
The current branch state is intended to preserve a usable, repaired project while keeping a clean rollback path.
Key restoration areas include:
- core dashboard startup and runtime initialization
- route mapping and route inventory recovery
- UI and menu restoration
- diagnostics and system health API recovery
- gallery and metadata operations
- addon/module loading and dynamic route safety
- Echo chat and voice command support
- general project stability and route coverage
This repo should be treated as a working operational platform, not a throwaway prototype. The project has been repaired, extended, and stabilized enough to be used and released with caution.
Critical Safety Principle
Do not push directly from the active working directory unless you have verified the branch, commit set, and release scope.
The safest process is:
- keep the current live project directory as-is
- create a dedicated release branch for the recovered work
- back up the project directory before major changes
- tag and push only the intended release branch
- keep the old version available as a reference and rollback target
Recommended Branch Strategy
Use a separate release branch so the old version remains available for restore.
Suggested pattern:
- masterchief-V4: recovered and stabilized release branch
- legacy/backups: preserved old version branch or archived copy
Example:
git checkout -b masterchief-V4
If you want to preserve an older branch for posterity instead of touching it:
git checkout -b retro-version
This keeps the older version intact while allowing the recovered version to move forward cleanly.
Backup Before Any Risky Move
Before any commit, tag, or push, create a backup of the working directory.
Windows backup example
Copy-Item -Recurse -Force "C:\Users\Echo\masterchief" "C:\Users\Echo\masterchief-backup-$(Get-Date -Format yyyyMMdd-HHmmss)"
Alternative archive example
Compress-Archive -Path "C:\Users\Echo\masterchief" -DestinationPath "C:\Users\Echo\masterchief-backup-$(Get-Date -Format yyyyMMdd-HHmmss).zip" -Force
This is the safest fail-safe if anything goes wrong during a release or branch change.
Fast Fail-Safe Rollback
If something breaks after a push, tag, merge, or release attempt, use the following rollback path.
Option 1: Roll back to the last good commit
git log --oneline --decorate --max-count=20
git checkout <last-good-commit>
or if you want to reset the current branch cleanly:
git reset --hard <last-good-commit>
Option 2: Revert a recent bad commit
git revert <commit-sha>
Option 3: Restore from backup folder
If the repo or working directory becomes unsafe:
Copy-Item -Recurse -Force "C:\Users\Echo\masterchief-backup-<timestamp>" "C:\Users\Echo\masterchief"
or if you archived it:
Expand-Archive -Path "C:\Users\Echo\masterchief-backup-<timestamp>.zip" -DestinationPath "C:\Users\Echo"
Safe Release Workflow
Before pushing, do not use broad staging commands such as:
git add .
Instead, stage intentionally:
git status
git add -p
git diff --cached --name-only
Then review exactly what is being included.
Example release tag
git tag -a v0.9.0 -m "MasterChief V4 recovery release"
git push origin masterchief-V4 --follow-tags
This creates a clean, recordable version marker for the recovered build.
Fresh Setup
Install Python 3.10 or newer and Git first. The Windows setup below matches the local source workflow: create an isolated .venv, install requirements.txt and the editable app, then serve on 0.0.0.0:8080. Python 3.14.2 was used for the current local verification; the project supports Python 3.10+.
Windows PowerShell: line-by-line source setup
-
Open PowerShell and go to the parent folder where you keep projects:
Set-Location C:\Users\Echo
-
Clone the repository. GitHub access is required if the repository is private:
git clone https://github.com/jbalestrine/masterchief.git
-
Enter the project:
Set-Location .\masterchief
-
Allow this PowerShell process to run the setup script (this does not change the machine-wide policy):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
-
Install the base application into
.venvwithout starting it yet:.\MasterchiefRun.ps1 -SetupOnly -Port 8080
This upgrades pip, installs
requirements.txt, and installs the source checkout in editable mode. It does not download a model or configure cloud credentials. -
Start the app bound to this computer only:
.\.venv\Scripts\python.exe .\main.py --host 0.0.0.0 --port 8080
-
On the MasterChief machine, open http://localhost:8080/ in a browser. From another device on the trusted network, use
http://<masterchief-machine-ip>:8080/. The Terraform Wizard is at/tf_wizard; Echo Chat is at/echo-chat.0.0.0.0listens on all IPv4 interfaces; it is a bind address, not the browser URL. This deployment is intended for a trusted network. All authenticated users receive GOD access, so restrict network reachability and configure authentication accordingly. -
Stop the foreground server with
Ctrl+C. For later starts, repeat step 6. To have the setup script install and start in one step instead, run.\MasterchiefRun.ps1 -Port 8080after cloning.
One-command Windows setup
From the parent directory, the following clones, installs, and starts the app:
git clone https://github.com/jbalestrine/masterchief.git; if ($LASTEXITCODE -ne 0) { throw 'Clone failed' }; Set-Location .\masterchief; Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; .\MasterchiefRun.ps1 -Port 8080
For a prompted setup menu, use MASTER_SETUP.ps1. Its default port is also 8080.
Linux or macOS
Install Python 3.10+, Git, and a POSIX shell, then run:
git clone https://github.com/jbalestrine/masterchief.git
cd masterchief
bash scripts/start.sh
The POSIX starter creates or reuses .venv and installs requirements.txt on first run. It starts run.py; consult its startup output for the actual local URL.
Optional capabilities and requirements files
requirements.txtinstalls the source app's base and bundled integration dependencies.requirements-optional.txtadds heavy AI/ML, audio, asynchronous messaging, and database dependencies; it can require gigabytes of downloads and native system libraries. Do not install it unless those capabilities are needed.requirements-training.txtis for the optional local LoRA training workflow and compatible hardware/checkpoints.- Cloud integrations use the credentials each user supplies and can operate only on resources those credentials are authorized to manage. MasterChief admin/GOD access does not expand the cloud provider's IAM permissions. Provider services also need configuration. The Terraform Wizard's generated code and CI templates do not automatically deploy resources.
- To install optional groups from the source checkout, use extras such as
python -m pip install -e ".[ai]"orpython -m pip install -e ".[cloud]". See QUICKSTART.md for CLI examples.
Observability integrations
Open the Observability Center at /observability. Set PROMETHEUS_URL, GRAFANA_URL, and LOKI_URL in the MasterChief server environment to connect existing services. Optional read-only bearer tokens are PROMETHEUS_TOKEN, GRAFANA_API_TOKEN, and LOKI_TOKEN. These credentials remain server-side.
MasterChief exposes request counters and latency histograms at /metrics. By default this endpoint is loopback-only; set METRICS_TOKEN to allow a Prometheus scraper on another host and configure its scrape job using observability/prometheus-scrape-example.yml. The sample Grafana dashboard and alert rules are in observability/dashboards/ and observability/alerts/. Loki queries require a log shipper to send MasterChief logs to the configured Loki service.
From PyPI
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install masterchief
The source checkout is the recommended way to run the complete web UI. The PyPI package and CLI provide a package-based installation path; optional provider services still need configuration.
Release PyPI and Chocolatey Together
The single release entry point is CHOCO_PYPI_DEPLOY.ps1. First update setup.py to a new version, commit the intended source, create and push a matching v* tag, then run from that tagged checkout. Tag pushes run package-build validation only; they do not publish separately.
In /secrets, add encrypted entries named TWINE_PASSWORD and CHOCOLATEY_API_KEY. Choose API Key for TWINE_PASSWORD and Chocolatey API Key for CHOCOLATEY_API_KEY. Then run:
.\CHOCO_PYPI_DEPLOY.ps1 -DryRun
.\CHOCO_PYPI_DEPLOY.ps1 -UseVault
The script reads the secrets from the local encrypted Vault, builds both packages from the exact tag, verifies availability and metadata, uploads Chocolatey first and PyPI second, then clears any Vault-loaded values from its process environment. Registry uploads are not atomic: if the PyPI upload fails after Chocolatey accepts the package, fix PyPI and check both package pages before retrying.
Core Application Layout
This project is organized around a central Flask app and modular runtime components.
Main entry points
- main.py: application bootstrap, routes, UI shell, and app wiring
- templates/: dashboard and HTML shell assets
- blueprints/: modular route groups and feature surfaces
- features/: feature registration and manager logic
- data/: persistent app data and uploaded/generated content
- echo/: echo chat, prompt flow, and runtime logic
- addons/, modules/, scripts/: extension and automation surfaces
Notable Functional Areas Restored
- route inventory and app shell recovery
- dashboard navigation and menu system restoration
- diagnostics and system route health checks
- gallery screens and upload workflow
- module loading and dynamic route startup safety
- Echo chat and voice command UI interactions
- internal feature manager and plugin-style registration
- platform configuration and runtime safe fallback behavior
Do Not Do This Without Verifying
Avoid the following when preparing a release:
- force-pushing without a backup
- staging every changed file indiscriminately
- pushing from a dirty working tree without review
- replacing an old branch with a new one unless you deliberately intend to do so
- deleting the old version before preserving a restore copy
Release Checklist
Before a push, confirm all of the following:
- project backup has been created
- working tree is reviewed
- only intended files are staged
- branch is a dedicated recovery/release branch
- version tag is created
- push is limited to the release branch and tags
- rollback path is documented and preserved
Example Safe Commands
# 1) create backup
Copy-Item -Recurse -Force "C:\Users\Echo\masterchief" "C:\Users\Echo\masterchief-backup-$(Get-Date -Format yyyyMMdd-HHmmss)"
# 2) branch cleanly
git checkout -b masterchief-V4
# 3) stage intentionally
git add -p
git diff --cached --name-only
# 4) commit
git commit -m "Restore app stability and dashboard functionality"
# 5) tag
git tag -a v0.9.0 -m "MasterChief V4 recovery release"
# 6) push
git push origin masterchief-V4 --follow-tags
Troubleshooting Notes
If the app fails to start or route pages stop working:
- restore from the latest backup
- verify the app entrypoint is still main.py
- confirm required runtime files still exist under data/ and templates/
- check for stale artifact directories or local generated folders that may have drifted
- revert only the last bad commit instead of a broad rollback
Recommended Operating Principle
Treat this repository as a living operational system with a documented rollback path. The key to preserving progress is to keep old versions intact, create new release branches, and always have a backup ready before changing the repo state.
License
This project should be treated according to the repository's existing licensing terms. See the included LICENSE file if present in the project root.
Final Notes
This V4 recovery version is a meaningful milestone: the app is functional again, the key route structure is restored, and the system has been repaired enough to continue forward safely. The safest release is not the fastest push; it is the one that preserves the old version and allows a clean rollback if the new version has issues.
Metadata
Release files for masterchief 4.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 |
|---|---|---|---|---|
| masterchief-4.0.0.tar.gz | 2.4 MB | Without provenance | Details for masterchief-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| masterchief-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for masterchief-4.0.0-py3-none-any.whl |
Total release size: 5.1 MB
Release files / masterchief-4.0.0.tar.gz
| Download URL | masterchief-4.0.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f5baec921f246e047c24b758eb173449b7e629e6b1fd292ce30a205af551979
|
|
BLAKE2b-256 checksum How to use checksums |
cbd09a74d24c5c95aebad800d10a0471f6aa0a355b4b34bd5b706a8b5de9320f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / masterchief-4.0.0-py3-none-any.whl
| Download URL | masterchief-4.0.0-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
238507454c2a0fdfa6458106ddd8c646dd95ec039e70bebb085a1cb95ed16071
|
|
BLAKE2b-256 checksum How to use checksums |
8b9aac9757557284478385a80e7a1c838a74d75ee14dfae53f05da578aba0550
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for masterchief 4.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.