feat(amp): add deterministic native workflows - #132
Merged
Conversation
oliver-kriska
force-pushed
the
feat/amp-native-workflows
branch
from
August 11, 2026 10:11
6739495 to
e5b8b6d
Compare
Generate a complete Amp target with explicit palette commands, read-only specialists, bounded parallel analysis, and lifecycle guards. Keep the source target byte-identical to the validated standalone distribution and cover the runtime policies with model-free tests and smoke checks. Co-authored-by: Oliver Kriska <oliver@ideax.sk>
main added a second, hand-written Amp plugin (phx-watch-pr.ts, copied verbatim and byte-checked against its canonical source) while this branch added a first one (elixir-phoenix.ts, rendered from Python so it can embed projected agent bodies and skill metadata). Both landed on the same build_target(), the same validate_plugin(), the same OUTPUT_DIR, and the same snapshot digest. Neither generation style can replace the other: the workflow plugin has to be rendered because it inlines canonical content, and the watch plugin has to be copied because it is real TypeScript with no projected data. So the target now emits both. - validate_plugin() keeps main's signature and meaning (watch plugin, byte-identity against source). The rendered one becomes validate_workflow_plugin(), and PLUGIN_RELATIVE_PATH becomes WORKFLOW_PLUGIN_RELATIVE_PATH, so main's committed API is untouched and the rename stays confined to the incoming branch. - build_target() discovers specialists, copies the watch plugin, renders the workflow plugin, and returns skills + commands + plugins. - The runtime smoke test now execs both plugins: session.start for phx-watch-pr, agent.start for elixir-phoenix. - Docs and the runtime-support matrix describe two plugins rather than one, keeping both sides' capability rows. The transport budget needed the whole branch to land: after commit 1 the rendered plugin hit 98,745 bytes against its own 96,000 assert, because phx-watch-pr joined PORTABLE_WORKFLOWS and the shared specialist contract was still inlined five times. Commit 3's compaction brings it to 95,191 with 809 bytes of headroom.
oliver-kriska
force-pushed
the
feat/amp-native-workflows
branch
from
August 18, 2026 09:42
3ea78b0 to
b748795
Compare
oliver-kriska
added a commit
that referenced
this pull request
Aug 18, 2026
README and docs/amp.md told users to install the watcher with `amp plugins add` against a raw.githubusercontent.com URL. Amp rejects that outright: Error: For now, only https://ampcode.com/@amp/plugins/*.ts and https://ampcode.com/@amp/plugins/*.ts URLs are allowed. Verified on Amp 0.0.1787045288. Nothing is written, so the documented path to the watcher never worked for anyone. docs/amp.md already contradicted itself about this: 390 lines below the install block it states that Amp "restricts `amp plugins add` ... to Amp-hosted plugins" and hands out an atomic curl for elixir-phoenix.ts. The install instruction was simply the wrong half of the contradiction. Both call sites now use that same curl + mv pattern against the standalone repository's stable branch, verified to fetch bytes identical to the canonical target. The update section loops over both plugins rather than only the workflow one. Also raises the phx-watch-pr harness subprocess timeout from 60s to 240s. The harness drives a fake clock with real 80ms flushes -- advance() runs up to 21 per call across 23 calls -- so it spends ~59s waiting for ~3s of CPU. Consecutive local runs took 58.9s, 60.4s, and 73.9s, so a required check was passing or failing on runner load alone. The harness is unchanged; shortening the flush would swap a timeout flake for a race. Fixes a paragraph-join in README introduced when the watch-pr block was merged forward in #132.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refresh the canonical Amp integration on current
mainand make its workflow behavior deterministic where the supported Plugin API allows. The generated target includes all 51 Agent Skills, 40 paired-local workflow wrappers, five native controls, five read-only specialists, bounded parallel analysis, and lifecycle safety controls.This branch was rebased from the original #132 onto
mainat3f0f117; generated artifacts were regenerated from canonical source rather than conflict-merged. The installable artifacts remain owned here and will be projected from the reviewed commit into the separately gatedamp-elixir-phoenixdistribution PR.What changes
Readandfinder.phx-fullverification gate..agents/skillsand.claude/skillsfrom exposedworkspaceRootthrough its parents, then the legacy home fallback.skill: invoke, hosted-native versus paired-full profiles, machine-local versus personal/workspace hosted scope, independent skills/plugin publication, and skills-first rollout ordering.stable, paired local install, and GitHub/curl compatibility paths.Explicit Plugin API boundary
Native
skill: invokeuses Amp's effective resolver and supports local, built-in, personal hosted, and workspace hosted skills. The current Plugin API does not expose skill resolution/invocation or Amp's original nested invocation directory, so filesystem wrappers cannot correctly inject hosted-only, built-in, plugin-cache, custom-path, or unexposed nested skill bodies.Consequently:
phx: fullarms the plugin verification gate; native hostedskill: invoke→phx-fullfollows skill guidance but cannot activate that wrapper hook.The implementation documents this boundary instead of scanning undocumented Amp caches or claiming unsupported hosted wrapper behavior.
Safety and distribution
Specialists cannot edit, run shell commands, or recursively create agents. Edit-lock paths resolve symlinks and fail closed on malformed, unreadable, or workspace-escaping state. Verification rejects piped, chained, neutralized, pre-edit, unrelated-PID, and nonzero-exit checks.
The generated plugin deliberately retains the direct GitHub/curl fallback. Promotion to the standalone distribution and mutable
stableremains separately review-gated; neither is changed by this canonical PR.Rebase onto
874d2e4(two Amp plugins)mainlandedfeat(amp): add native PR watch lifecyclewhile this branch wasopen, which introduced a second Amp plugin on the same generator surface.
Both commits independently defined
build_target(),validate_plugin(), andthe same
OUTPUT_DIR, with different designs:874d2e4elixir-phoenix.tsphx-watch-pr.tsNeither style can replace the other, so
build_target()now emits both.validate_plugin()keeps main's signature and meaning; the rendered one becamevalidate_workflow_plugin()andPLUGIN_RELATIVE_PATHbecameWORKFLOW_PLUGIN_RELATIVE_PATH, confining the rename to this branch. Generatedfiles were regenerated from source, never hand-merged.
The transport budget needed the full branch: after the first commit the rendered
plugin reached 98,745 bytes against its own 96,000 assert (phx-watch-pr joined
PORTABLE_WORKFLOWS, and the shared specialist contract was still inlined fivetimes). The third commit's compaction lands it at 95,191 bytes, 809 bytes of
headroom.
Verification
Canonical commit:
b748795(rebased ontomainat874d2e4)make ci— PASS: 243 tests (including the Bun runtime harness), Claude manifest validation, all generated-target drift/snapshot checks, and full structural eval (51 skills, 26 agents). Skillspector was not installed in the orb, so the Makefile's optional security target reported its documented skip.make amp-runtime-smoke— PASS with Amp0.0.1786436318-g8453bf(2026-08-11): 51 skills and plugin loaded in isolation without model calls.make amp-target-validate— PASS: 51 skills and plugin, with regenerated golden snapshot.npm audit --audit-level=high, andgit diff --check— PASS; npm audit found 0 vulnerabilities.Review focus
The highest-value review areas are the documented hosted-wrapper boundary, local resolver precedence, Amp lifecycle assumptions, edit-lock enforcement, verification result classification, and generator-to-target parity.