aikernel-tools is the Python wrapper for the public AIKernel.Tools
instrumentation surface.
Install:
pip install aikernel-toolsImport:
from aikernel_tools import (
CanonicalFormatter,
ChatHistoryRecord,
ChatHistoryScraper,
InfoCommand,
MdExporter,
NowCommand,
ReplayEngine,
Inspector,
RomExporter,
RomStorageCapability,
TimelineCommand,
TreeCommand,
VfsGitCapability,
tools_assemblies,
)The package exposes:
- replay and inspection facades
- canonical chat-history formatting
- C#-named chat-history scraper/exporter facades
- C#-named KernelClock and VFS inspector command facades
- public Capability contract wrappers
- managed assembly discovery and pythonnet loading
It does not reimplement Tools internals in Python. Managed assemblies are
bundled under aikernel_tools/native and loaded with pythonnet/CoreCLR.
The wheel must include Tools assemblies and their contract dependencies:
AIKernel.Abstractions.dllAIKernel.Common.dllAIKernel.Core.dllAIKernel.Dtos.dllAIKernel.Enums.dllAIKernel.Tools.Instrumentation.dllAIKernel.Tools.Capability.RomStorage.dllAIKernel.Tools.Inspectors.ChatHistoryScraper.dllAIKernel.Tools.Inspectors.KernelClock.dllAIKernel.Tools.Inspectors.Vfs.dllChatHistoryProvider.dll
Linux validation requires pythonnet to load CoreCLR. The loader explicitly calls
pythonnet.load("coreclr") before adding managed references.
from aikernel_tools import CanonicalFormatter, ChatHistoryRecord, MdExporter, RomExporter
formatter = CanonicalFormatter()
rom = formatter.serialize([
ChatHistoryRecord("user", "hello", "2026-06-09T00:00:00+00:00")
])
markdown = MdExporter.to_markdown([
ChatHistoryRecord("assistant", "world", "2026-06-09T00:00:01+00:00")
])
history_rom = RomExporter.to_rom([
ChatHistoryRecord("assistant", "world", "2026-06-09T00:00:01+00:00")
])
print(rom)Recommended source checks:
python -m pytest
python -m compileall src testsFor Linux wheel validation, use the shared Docker test image and a virtual environment because the base image follows PEP 668 and blocks system-wide pip installation.
The Python package mirrors the public C# package surface:
ReplayEngine->AIKernel.Tools.Instrumentation.ReplayEngineReplaySession->AIKernel.Tools.Instrumentation.ReplaySessionInspector->AIKernel.Tools.Instrumentation.InspectorCanonicalFormatter->AIKernel.Tools.Instrumentation.CanonicalFormatterCanonicalSerializer->AIKernel.Tools.Instrumentation.CanonicalSerializerMdExporter->AIKernel.Tools.Inspectors.ChatHistoryScraper.Export.MdExporterRomExporter->AIKernel.Tools.Inspectors.ChatHistoryScraper.Export.RomExporterChatHistoryScraper->AIKernel.Tools.Inspectors.ChatHistoryScraper.ChatHistoryScraperNowCommand/TimelineCommand-> KernelClock inspector commandsInfoCommand/TreeCommand-> VFS inspector commandsRomStorageCapability-> Core-owned ROM storage descriptor bridgeVfsGitCapability-> Core-owned VFS Git descriptor bridge
Python wrappers must remain thin. If a behavior exists in C#, Python should delegate to the managed assembly or expose a data wrapper over the managed contract. Python should not introduce a separate interpretation of replay, canonical formatting, or ROM serialization semantics.
Before publishing the wheel:
- ensure
aikernel_tools/nativecontains the latest Release DLLs - remove stale wheels from
python/dist - run
py -m compileall src tests - run
py -m pytest - run
py -m build - inspect the generated wheel metadata for project URLs, license, pythonnet dependency, and bundled managed assemblies
The wheel is pure Python from PyPI's perspective but carries managed assemblies. Linux hosts require a usable CoreCLR runtime for pythonnet.