Engineering Docs
This is a technical deep dive to explain the code behind the kernel, the conventions, and proper usage of the kernel.

Overall purpose of the kernel

The kernel presents a facade for product resources to consume. In this context, a product could be a customer/client facing application (desktop, mobile app, web app), an internal application (async process worker, data ingestion process), or an internal business operation app.

Parts of the kernel

System Commands
System Commands are usually an enum with a descriptive label.
System Processes
System Processes are the workhorses of the kernel. This function takes in a map of labels to System Interfaces and an arbitrary number of keyword arguments. For certain languages, this value can be an associative map.
System Interfaces
System Interfaces are facades that speak to external sources. External sources can be a database, a cloud storage, an API server, or a file system.
Exit
The Exit class is what is returned from System Processes. This class has a `code` attribute, which is an enum with the labels, GOOD or ERROR. This class also has a `data` attribute, which has an associative map or an object. EVERY Exit class will have a “msg” key in the `data` attribute.

Convention over configuration

This saying was popularized by Ruby on Rails and in the age of AI coding, this is much needed. The less decisions that the AI model has to make, the better the output. The folder structure of a kernel is clearly labeled. Here is an example Python kernel folder structure:

+-- src
|   +-- kerneltest
|   |   +-- implementations (system interfaces go here)
|   |   |   +-- __init__.py
|   |   +-- processes (system processes go here)
|   |   |   +-- __init__.py
|   |   +-- __init__.py (Python-specific; bootstraps the kernel)
|   |   +-- kernel.py (Kernel data structures and classes)
+-- tests
|   +-- __init__.py
+-- specs (Spec and AI workplans are placed here)
+-- pyproject.toml
+-- .gitignore
+-- .python-version
+-- README.md

Kernel Flow

The entrypoint for a kernel is the cmd function. This function takes a System Command – which is usually an enum – and an arbitrary number of keyword parameters. Internally, the kernel keeps an associative map of System Commands to System Processes. System Processes are then called with the corresponding keyword arguments that were passed in the `cmd` function.

Exit codes

System Processes will always return an instance of Exit class. If there are any exceptions raised during the execution of a System Process, the Exit class will return an ERROR code.