Skip to content

feat(relay): add workflow guidance to MCP tools for deterministic agent behavior#11

Merged
Narrator merged 1 commit intomainfrom
feat/agent-workflow-guidance
Mar 24, 2026
Merged

feat(relay): add workflow guidance to MCP tools for deterministic agent behavior#11
Narrator merged 1 commit intomainfrom
feat/agent-workflow-guidance

Conversation

@Narrator
Copy link
Member

Summary

  • Tool description breadcrumbs: Each annotation tool now tells the agent what to call next in the lifecycle (process → implement → verify → respond → updateStatus). annotation.list explicitly redirects to annotation.process for claiming work.
  • Output-level workflow hints: annotation.process and annotation.respond return nextStep fields; query.bySource returns contextual hint fields for browser-not-connected, element-not-rendered, and entry-not-found states — guiding the agent to ask the user to navigate when needed.
  • "Editing Components" workflow in SKILL.md / POWER.md: Positions query.bySource as the default before/after step when editing UI components, replacing the need for curl/Playwright/screenshots. Broadens skill trigger keywords to activate when agents edit components.
  • Prompt typo fix: domscribe.annotations.*domscribe.annotation.* in process_next and find_annotations MCP prompts.

Test plan

  • All existing relay unit tests pass with updated expectations
  • New tests for query.bySource hint branches (browser disconnected, element not rendered, entry not found)
  • Manual verification: connect domscribe MCP to a coding agent and confirm it follows the annotation lifecycle without extra prompting
  • Manual verification: confirm agent calls query.bySource before/after editing a component

🤖 Generated with Claude Code

Agents weren't following the annotation lifecycle deterministically — they
called annotation.list instead of annotation.process and skipped the
updateStatus step after responding. Similarly, agents didn't use
queryBySource to inspect live component state before/after edits.

Three fixes:

1. Tool descriptions now encode the workflow as breadcrumbs — each tool
   says what comes next (process → implement → verify → respond →
   updateStatus) and annotation.list redirects to annotation.process
   for claiming work.

2. Tool outputs include contextual nextStep/hint fields that remind the
   agent of the next action at exactly the right moment (e.g. respond
   output tells agent to call updateStatus with the annotation ID).

3. SKILL.md and POWER.md gain an "Editing Components" section that
   positions queryBySource as the default before/after step when editing
   UI components, with guidance for browser-not-connected and
   element-not-rendered cases.

Also fixes tool name typo in MCP prompts (domscribe.annotations.* →
domscribe.annotation.*).
@nx-cloud
Copy link

nx-cloud bot commented Mar 24, 2026

View your CI Pipeline Execution ↗ for commit d377ac4

Command Status Duration Result
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 23s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 54s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 44s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 45s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 41s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 49s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 51s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 20s View ↗
Additional runs (18) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-03-24 17:46:20 UTC

@Narrator Narrator merged commit 37e65f0 into main Mar 24, 2026
24 checks passed
@Narrator Narrator deleted the feat/agent-workflow-guidance branch March 24, 2026 19:14
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