Skip to content

[FEATURE] apm validate / test harness for user packages (hooks, instructions, skills) #2248

Description

@saaga112

Is your feature request related to a problem?

As a user authoring APM packages (.apm/ with hooks, instructions, skills, agents), there is no first-class way to verify that my package actually works before installing/compiling it into a runtime:

  • Hook scripts may have syntax errors, wrong permissions, or never fire for the intended lifecycle event.
  • Instruction files may have malformed frontmatter or applyTo globs that silently match nothing.
  • Skills may never be routed to because their description/intent metadata doesn't match how users phrase requests.

Today the feedback loop is "compile, run a real agent session, notice the behavior is wrong" — slow and hard to debug. The APM repo itself has a strong internal test suite (unit / integration / acceptance / mutation), including hook execution tests, but none of this is exposed to package authors as a validation tool.

Describe the solution you'd like

A user-facing validation/test command, e.g. apm validate (or apm test), that runs against a local package and reports:

  1. Contract checks (static)

    • Frontmatter schema validation for *.instructions.md, SKILL.md, *.agent.md, *.prompt.md (required fields, valid YAML).
    • applyTo glob sanity: warn when a pattern matches zero files in the target workspace.
    • Hook manifest checks: referenced scripts exist, are executable, declare a known lifecycle event.
  2. Hook dry-run (dynamic, opt-in)

    • Execute hooks in a sandbox with mock event payloads; assert exit code 0 and bounded runtime.
  3. Routing/golden tests (optional fixtures)

    • Author-provided fixtures: prompt -> expected skill/instruction pairs.
    • Harness evaluates routing metadata deterministically (no LLM call needed for the static-matching portion) and reports which skill/instruction would be selected.

Output: human-readable summary + non-zero exit code on failure, so it's CI-friendly (authors can gate their package repos on apm validate).

Describe alternatives you've considered

  • Ad-hoc pytest suites in each package repo — works, but every author reinvents frontmatter parsing and hook mocking; no shared contract with APM's compiler.
  • Relying on compile-time errors — catches syntax issues but not "hook never fires" or "skill never routes".

Additional context

  • Happy to contribute this incrementally: start with static contract checks (smallest slice), then hook dry-run, then routing fixtures — each as a separate single-concern PR with tests, per the contribution guide.
  • Reuses existing internals where possible (package model parsing, hook execution code already covered by tests/integration/test_integrators_hooks_execution.py).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).area/testingTest infrastructure, fixtures, e2e harness, coverage.priority/highShips in current or next milestonestatus/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/featureNew capability, new flag, new primitive.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions