Skip to content

Promote engine/ to its own Go module so external consumers can import the core without the adapter dep-cone #113

Closed

Description

@JAORMX

Context

Atrium (stacklok/atrium) is converging its in-house agent loop onto mecatl: instead of maintaining a hand-rolled function-calling loop and harvesting mecatl mechanisms by copy (the prior plan), Atrium wants to import the engine/ core as a library and inject its own adapters (LLM-Gateway egress, MCP-Gateway tool dispatch, an event-log-backed session store, its own event schema). The hexagonal split you've built — engine/ is the importable core, internal/adapter/* holds the heavy adapters — is exactly the shape that makes this possible. (See also the cloud-native-harness-kit discussion in #71 / #54.)

This issue covers the module-graph hygiene of consuming engine/ as a dependency.

What actually happens today (corrected)

Importing engine/agent does not bloat the consumer's binary — Go compiles only imported packages, so toolhive/k8s/wazero/the SDKs never compile in regardless. The cost is at the module-graph / MVS layer. Because the core packages live in the same module as the adapters, Go 1.17+ module-graph pruning still pulls github.com/stacklok/mecatl's direct require block (toolhive, k8s, openai-go, anthropic-sdk, mcp-sdk, grpc, otel) into the consumer's module graph as MVS participants.

Concrete consequences, in priority order:

  1. MVS version coupling on shared modules. Atrium and mecatl both depend on google.golang.org/grpc, google.golang.org/protobuf, and OpenTelemetry. MVS takes the max, so a mecatl bump to any of those raises Atrium's floor — even though the imported engine/agent uses none of them.
  2. SBOM / go list -m all / dependabot noise — the consumer's module graph enumerates k8s/toolhive/AWS as "dependencies," misleading for audits.
  3. go.sum / graph-load size — minor.

Proposed work

  1. Add engine/go.mod with module path github.com/stacklok/mecatl/engine (Go 1.26.x to match root), require golang.org/x/sync (the verified sole non-stdlib dep of the core closure).
  2. Convert the root module to a go.work (or a replace) so cmd/, internal/, e2e/, perf/ keep consuming the local engine module.
  3. Keep engine/arch/layering_test.go as the standing guard — its doc already states the intent: "the engine tree can become its own module without dragging the host repo along."
  4. Tag the new submodule (engine/vX.Y.Z) through the existing release pipeline.

Acceptance

  • go get github.com/stacklok/mecatl/engine@<tag> from a fresh module pulls a go.sum whose only non-stdlib entry is golang.org/x/sync (+ its closure).
  • The root build, the cmd/* binaries, and the e2e/perf suites still build and pass against the local engine module.

Priority

Strongly recommended, not a hard blocker. A consumer can import the root module today and get a clean binary; the split is about not coupling Atrium's grpc/protobuf/otel floor to mecatl's release cadence. Since both repos are Stacklok-owned, move fast, and share exactly those modules, that coupling is the concrete ongoing cost the split removes.

Tracking — "make engine consumable as an external library (Atrium convergence)"

#113 is the prerequisite for #114; #115, #116, #118 are independent.

Activity

  1. added
    enhancement
    atrium-convergence
    on Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    atrium-convergencedevexenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions