Skip to content

Add stub-agent example for pub/sub change notifications - #1

Merged
sujal-maheshwari2004 merged 1 commit into
mainfrom
feat/stub-agent
Aug 23, 2026
Merged

sujal-maheshwari2004 merged 1 commit into
mainfrom
feat/stub-agent

Conversation

@sujal-maheshwari2004

Copy link
Copy Markdown
Contributor

Adds stub-agent.js, a runnable stand-in for a production agent that reads its prompts from priompt by address and reacts to change pushes.

It demonstrates what the pub/sub layer exists for: the semantic diff verdict rides along with the notification, so the reload decision needs no extra round trip.

  • minor edit / localized tweak / new → hot-reload
  • structural → hold, keep serving the old version, flag for review

Uses the existing PromptClient.subscribe(). No new dependencies.

Usage

node stub-agent.js onboarding-bot priompt://acme/onboarding/welcome

A heartbeat renders the prompt every few seconds so a version flip is visible in the stream rather than being one line you have to go looking for.

Verified against a live server

Hot-reload on a safe edit:

13:26:50  onboarding-bot CALL     welcome @5f6b4665  "Hey Sujal, welcome aboard at Acme..."
13:26:52  onboarding-bot RELOAD   .../welcome  localized tweak -> now @6ddb8d92

Hold on a structural one:

13:27:11  support-bot HELD   .../support/triage  structural — needs review
13:27:11  support-bot          still serving @ea968b58, pending @62611817
13:27:19  support-bot CALL   triage @ea968b58 [holding update]  "You are a support triage agent..."

Note for reviewers

It subscribes once per URI rather than using a wildcard subject. pubsub.Event is {version, classification} with no URI, so a wildcard subscriber (priompt.acme.>, which the subject mapping otherwise supports for free) cannot tell which prompt moved. The closure supplies the URI instead. Adding uri to the Event struct would make wildcard subscription viable for an agent watching many prompts.

Two deliberate limits: held versions live in memory only, and there is no approve path to un-hold.

A runnable stand-in for a production agent: reads its prompts by address,
subscribes to change pushes, and acts on the semantic diff verdict that
rides along with each notification — hot-reloading a minor edit or
localized tweak, holding a structural change until a human reviews it.

Uses the existing PromptClient.subscribe(); no new dependencies.

Subscribes per URI rather than by wildcard because the notification body
carries {version, classification} but not the URI, so a wildcard
subscriber cannot tell which prompt changed.
@sujal-maheshwari2004 sujal-maheshwari2004 self-assigned this Aug 17, 2026
@sujal-maheshwari2004
sujal-maheshwari2004 merged commit bc4a27a into main Aug 23, 2026
1 check passed
@sujal-maheshwari2004
sujal-maheshwari2004 deleted the feat/stub-agent branch August 23, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant