AI•Pkg.Core public API types, aipkg CLI command syntax, and configuration file schemas — the normative interface for anyone building compatible tooling.
The AI•Pkg SDK has two public interfaces: the AI•Pkg.Core .NET library and the aipkg CLI. This spec defines the normative API surface for both. Anyone building a compatible tool, client, or alternative implementation should use this document as the reference.
AI•Pkg.Core
Cross-platform .NET 10 class library. Consumed by servers, CLI tools, and test harnesses.
aipkg CLI
Command-line tool. Single-file binary. No runtime required.
// Represents a parsed .aispec manifestpublic sealed class AipkgManifest{ public string Schema { get; init; } public string Id { get; init; } public string Version { get; init; } public string Description { get; init; } public IReadOnlyList<string> Authors { get; init; } public IReadOnlyList<string> Capabilities { get; init; } public IReadOnlyList<string> Targets { get; init; } public string? Title { get; init; } public string? Summary { get; init; } public string? ReleaseNotes { get; init; } public Uri? ProjectUrl { get; init; } public Uri? RepositoryUrl { get; init; } public string? RepositoryType { get; init; } public string? RepositoryBranch { get; init; } public string? RepositoryCommit { get; init; } public string? LicenseExpression { get; init; } public string? LicenseFile { get; init; } public string? IconFile { get; init; } public string? Readme { get; init; } public IReadOnlyList<string> Tags { get; init; } public string? Copyright { get; init; } public string? Language { get; init; } public ModelCompatibility? ModelCompatibility { get; init; } public IReadOnlyList<string> Permissions { get; init; } public IReadOnlyList<McpServerDefinition> McpServers { get; init; } public IReadOnlyList<PackageDependency> Dependencies { get; init; } public bool Listed { get; init; } public DeprecationInfo? Deprecated { get; init; }}public sealed class ModelCompatibility{ public int? MinimumContextWindow { get; init; } public bool? RequiresToolUse { get; init; } public bool? RequiresVision { get; init; } public string? Notes { get; init; }}public sealed class McpServerDefinition{ public string Name { get; init; } public string Transport { get; init; } public string? Command { get; init; } public IReadOnlyList<string> Args { get; init; } public Uri? Url { get; init; } public IReadOnlyDictionary<string, string> Env { get; init; } public string? Description { get; init; } public IReadOnlyList<string> Targets { get; init; }}public sealed class PackageDependency{ public string Id { get; init; } public string Version { get; init; } public IReadOnlyList<string> Apms { get; init; } public bool Optional { get; init; }}public sealed class DeprecationInfo{ public string? Message { get; init; } public string? AlternatePackageId { get; init; } public string? AlternatePackageVersion { get; init; }}
// Reads .aipkg archivespublic sealed class AipkgReader : IDisposable{ public AipkgReader(Stream stream); public AipkgReader(string filePath); // Reads the manifest without extracting the full archive public AipkgManifest ReadManifest(); // Lists all entries in the archive public IReadOnlyList<AipkgEntry> GetEntries(); // Opens a specific entry for reading public Stream OpenEntry(string entryPath); // Extracts files for a given APM, applying fallback resolution public IReadOnlyDictionary<string, Stream> ExtractForPlatform(string apmMoniker);}public sealed record AipkgEntry( string Path, long CompressedSize, long UncompressedSize, string Section // "shared", "apm/{moniker}", "root", "reserved");// Creates .aipkg archivespublic sealed class AipkgWriter : IDisposable{ public AipkgWriter(Stream outputStream); public AipkgWriter(string outputFilePath); // Must be called first public void WriteManifest(AipkgManifest manifest); // Adds a file to shared/ public void AddSharedFile(string relativePath, Stream content); // Adds a file to apm/{moniker}/ public void AddPlatformFile(string moniker, string relativePath, Stream content); // Adds icon, README, LICENSE at archive root public void AddRootFile(string filename, Stream content); public void Finalize();}
public sealed class PlatformCompatibilityService{ // e.g. "claude-code" → ["apm/claude-code", "apm/claude", "apm/ai", "shared"] public IReadOnlyList<string> GetFallbackChain(string moniker); public string? GetParent(string moniker); public bool IsCompatible(IReadOnlyList<string> packageTargets, string targetMoniker); public string? GetInstallPath(string moniker, OperatingSystem os); public IReadOnlyList<ApmInfo> GetAllPlatforms(); public bool IsKnown(string moniker);}public sealed record ApmInfo( string Moniker, string DisplayName, string? Parent, string? InstallPath, string Stability // "stable", "provisional", "deprecated");
public sealed class AipkgValidator{ public ValidationResult ValidateManifest(AipkgManifest manifest); public ValidationResult ValidateArchive(Stream archiveStream);}public sealed class ValidationResult{ public bool IsValid { get; } public IReadOnlyList<ValidationError> Errors { get; } public IReadOnlyList<ValidationWarning> Warnings { get; }}public sealed record ValidationError(string Code, string Message, string? Field = null);public sealed record ValidationWarning(string Code, string Message, string? Field = null);
// SemVer 2.0.0 — compatible with NuGet versioningpublic sealed class AipkgVersion : IComparable<AipkgVersion>{ public static AipkgVersion Parse(string version); public static bool TryParse(string version, out AipkgVersion result); public bool SatisfiesRange(string versionRange);}
100% of public surface members must carry XML doc comments before the 1.0.0 release.
aipkg pack [manifest-path] [options]Arguments: manifest-path Path to .aispec file (default: finds *.aispec in current dir)Options: -o, --output <dir> Output directory (default: current dir) --no-validate Skip validation (not recommended) -v, --verbosity <lvl> Verbosity: quiet, normal, detailed (default: normal)Output: {id}.{version}.aipkg
Behavior:
Reads and validates the .aispec manifest
Resolves all file references (icon, readme, license, shared/, apm/)
Builds the ZIP archive
Reports the archive size and file count
aipkg push
aipkg push <package-path> [options]Arguments: package-path Path to .aipkg fileOptions: -s, --source <url> Registry URL (default: https://aipkg.org) -k, --api-key <key> API key (or set AIPKG_API_KEY env var) --skip-duplicate Return success if version already exists -t, --timeout <sec> Upload timeout in seconds (default: 300)
aipkg install
aipkg install <id[@version]> [options]aipkg install ← installs from aipkg.config.jsonOptions: -p, --platform <apm> Target APM moniker (default: auto-detect) -g, --global Install globally (not project-scoped) --prerelease Include pre-release versions -s, --source <url> Registry URL --dry-run Show what would be installed without installing
Auto-detect platform: the CLI inspects the current directory for known config directories (.claude/, .cursor/, etc.) to infer the active platform. Falls back to prompting if ambiguous.
aipkg restore
aipkg restore [options]Options: --locked Fail if aipkg.lock.json is out of date --no-lock Do not write/update aipkg.lock.json --force Re-install even if already installed
Reads aipkg.config.json and installs all declared packages.
aipkg new [options]Options: --id <id> Package ID (prompted if not given) --capability <cap> Initial capability --non-interactive Use defaults without prompting
Creates a minimal {id}.aispec file in the current directory.