Skip to content

feat(agent): plan mode, preflight tool, and agent instructions#49

Open
anfibiacreativa wants to merge 6 commits into
mainfrom
feat/submit-plan
Open

feat(agent): plan mode, preflight tool, and agent instructions#49
anfibiacreativa wants to merge 6 commits into
mainfrom
feat/submit-plan

Conversation

@anfibiacreativa

@anfibiacreativa anfibiacreativa commented Jun 22, 2026

Copy link
Copy Markdown
Member

Must be merged together with adobe/da-nx#522

Summary

  • Add enter_plan_mode / exit_plan_mode tools that mirror AO's built-in planning bracket
  • Add run_preflight tool for LLM-evaluated content readiness checks before publishing
  • Add :::task-item directive rules to the system prompt for plan execution progress tracking
  • Instruct agent to auto-include preflight as final step when creating HTML page documents
  • Instruct agent not to re-enter plan mode or re-read the document when running preflight

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

  • Run npx vitest run — all tests pass (38 tests)
  • Open canvas, ask agent to create a new HTML page — confirm plan card appears, user can click Run, task items update during execution
  • Confirm preflight card appears as final step with Reject / Always approve / Approve panel
  • Ask agent to upload an image — confirm no preflight step is included
  • Ask agent to copy/move a file — confirm no preflight step included

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

anfibiacreativa and others added 3 commits June 19, 2026 16:17
- 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>
- 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>
@anfibiacreativa anfibiacreativa changed the title fix(prompt): harden task-item directive rules for plan execution feat(agent): plan mode, preflight tool, and agent instructions Jun 25, 2026
anfibiacreativa and others added 2 commits June 30, 2026 16:29
…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>
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