feat(agent): plan mode, preflight tool, and agent instructions#49
Open
anfibiacreativa wants to merge 6 commits into
Open
feat(agent): plan mode, preflight tool, and agent instructions#49anfibiacreativa wants to merge 6 commits into
anfibiacreativa wants to merge 6 commits into
Conversation
- add submit_plan tool requiring user approval before agent executes any
multi-step operation; execute returns {approved: true} so the agent
continues after Run is clicked
- add post-skill _hint in da_read_skill result nudging the agent to call
submit_plan before proceeding, mirroring AO's post-skill hook behaviour
- update system prompt: replace :::plan directive instructions with
submit_plan call instructions; keep :::task-item for per-step progress
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_mode Replace submit_plan with the two-tool bracket pattern used by AO's built-in planning tools so skills work consistently across both platforms. - rename submit_plan → exit_plan_mode (approval-gated, carries plan data) - add enter_plan_mode (no-op signal, no approval, mirrors AO semantics) - update system prompt: enter_plan_mode → reason → exit_plan_mode bracket - update da_read_skill _hint to reference the new tool names Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- require character-for-character identical labels between exit_plan_mode tasks and :::task-item directives to prevent status merge mismatches - clarify that `done` must be emitted immediately after each tool result, before any commentary, and must never be skipped - add Content-Length: 0 header to HEAD /chat response to signal end of response faster Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 tasks
- add run_preflight tool with needsApproval: true and zod schema validating title, readiness (0-100 int), categories/checks, summary - instruct agent to auto-include preflight as final plan step when creating/updating HTML page documents (.html files only) - instruct agent not to re-enter plan mode or re-read the document when executing the preflight step - add tests for tool schema, needsApproval, execute, and prompt instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ight
- add url field to run_preflight input schema (Live Preview URL)
- execute calls POST {GOVERNANCE_AGENT_URL}/api/v0/evaluate/page with IMS token
- maps text_evaluation.evaluations (check_title, alignment YES/NO/NA) to card schema
- falls back to approved:true when governance is unavailable or unconfigured
- add imsToken + governanceUrl to DAToolsOptions; pass from tool-assembly
- update prompt to make preflight conditional on a configured skill (not auto)
- update tests: add url to schema fixtures, add rejects-missing-url case
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…preflight as dumb gate - remove REST call from execute — agent calls mcp__governance-agent__evaluate_page directly - remove imsToken/governanceUrl from DAToolsOptions and tool-assembly (no longer needed) - update prompt: instruct agent to call evaluate_page, map results, then call run_preflight - update tests to match new prompt wording Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Must be merged together with adobe/da-nx#522
Summary
Why
Agents executing multi-step content operations need a user-reviewable plan before acting
Content generated by the agent should be checked for readiness (brand, SEO, accessibility, etc.) before the user publishes
AO has enter_plan_mode / exit_plan_mode built in — da-agent needs parity so both backends behave consistently in the chat UI
What Changed
src/tools/tools.ts — added enter_plan_mode (no approval), exit_plan_mode (needsApproval: true), and run_preflight (needsApproval: true, structured readiness result with title, readiness %, categories/checks, summary)
src/prompt-builder.ts — added planning bracket instructions, preflight scoping rules (HTML pages only, not images/config/skills), and no-re-plan instruction for preflight execution
src/server.ts — minor wiring changes
Test Plan
Risks / Follow-ups
Preflight categories are LLM-generated, not validated against a fixed schema
Image governance (brand compliance for uploads) is a separate follow-up ticket
Fix SITES-46674