stax
Composition layer

Defining a Package

How to define a reusable package using definePackage()

Packages are reusable configuration bundles published as OCI artifacts. They are the main unit of sharing in the stax ecosystem.

A package can contain any combination of:

  • MCP server configurations
  • Skills
  • Rules
  • Knowledge
  • Surfaces
  • Secret declarations
  • Dependencies on other packages

Packages do not contain a prompt or persona.

definePackage()

import { definePackage } from "stax";

export default definePackage({
  name: "github-workflow",
  version: "2.0.0",
  description: "MCP servers and skills for GitHub workflows.",
  author: "myorg",
  license: "MIT",
  tags: ["github", "pr", "code-review"],

  mcp: "./mcp-servers.ts",
  skills: "./skills/",
  rules: "./rules/",
  knowledge: "./knowledge/",
  surfaces: "./surfaces/",

  packages: ["ghcr.io/myorg/packages/git-utils:1.0.0"],

  secrets: [{ key: "GITHUB_TOKEN", required: true }],
});

Fields

FieldTypeRequiredDescription
namestringYesPackage identifier (same naming rules as agents)
versionstringYesValid semver version
descriptionstringYesHuman-readable description
authorstringNoAuthor or organization
licensestringNoSPDX license identifier
tagsstring[]NoUnique, case-sensitive tags

Layer Source Paths

FieldPoints toDescription
mcpFileMCP server configuration
skillsDirectorySkill definitions
rulesDirectoryRule files
knowledgeDirectoryKnowledge documents
surfacesDirectorySurface files

Package References

Packages can depend on other packages. The same reference formats apply as for agents:

  • Relative local path: ./packages/shared-utils
  • OCI tag reference: ghcr.io/myorg/packages/git-utils:1.0.0
  • OCI digest reference: ghcr.io/myorg/packages/git-utils@sha256:abc...

OCI Artifact Type

Packages use the same OCI manifest shape as agents but with a distinct artifact type:

artifactType: application/vnd.stax.package.v1

The config blob contains kind: "package".

Directory Structure

my-package/
├── package.ts
├── mcp-servers.ts
├── skills/
├── rules/
├── knowledge/
├── surfaces/
├── .staxignore
└── stax.lock

Publishing Guidance

Package authors should:

  • Publish immutable semver tags
  • Sign released artifacts
  • Pin transitive dependencies via stax.lock
  • Avoid breaking package behavior behind unchanged tags

On this page