Files
SuperBizAgent-java/openspec/changes/executor-composer-final-answer/tasks.md
T

45 lines
2.9 KiB
Markdown

## 1. Composer Prompt Contract
- [ ] 1.1 Add `src/main/resources/prompts/chat-composer-prompt.md`.
- [ ] 1.2 Define Composer input fields: `original_query`, `verdict`, `allowed_claims`, `allowed_hypotheses`, `missing_info`, `recommended_actions`, and `rationale`.
- [ ] 1.3 Define strict JSON output fields: `answer_summary`, `recommended_actions`, and `user_facing_answer`.
- [ ] 1.4 State verdict-specific wording rules for PASS, LOW_CONFID, and REJECT.
- [ ] 1.5 State that Composer must not add facts, call tools, output Markdown, or use raw Executor/tool output.
## 2. Composer Invocation And Input Filtering
- [ ] 2.1 Load the Composer prompt in `ChatService`.
- [ ] 2.2 Add a `chat_composer` Agent or equivalent Composer model call after final Verifier decision.
- [ ] 2.3 Build Composer input from Verifier decision and Executor structured output.
- [ ] 2.4 Filter `allowed_claims` from `claim_checks` using `direct_observation` and bounded `reasonable_inference`.
- [ ] 2.5 Exclude `unsupported`, `external_unknown`, and `contradicted` claims from confirmed output.
- [ ] 2.6 Downgrade `overstated` claims to `allowed_hypotheses` or `missing_info`.
- [ ] 2.7 Ensure REJECT Composer input has `allowed_hypotheses=[]`.
- [ ] 2.8 Ensure Composer input contains no raw tool output, full unscreened Executor output, or Executor `user_facing_answer`.
## 3. Composer Output Parsing, Fallback, And Audit
- [ ] 3.1 Parse Composer strict JSON output.
- [ ] 3.2 Add safe fallback rendering for malformed Composer output.
- [ ] 3.3 Ensure fallback rendering never exposes raw Composer JSON, raw Executor JSON, or Executor `user_facing_answer`.
- [ ] 3.4 Persist `composer_output` under `diagnosis_session.self_evaluation.verifier_evaluation`.
- [ ] 3.5 Preserve existing verifier audit fields when writing Composer output.
## 4. Final Answer Routing
- [ ] 4.1 Replace PASS temporary V2 renderer usage with Composer or safe template rendering.
- [ ] 4.2 Ensure LOW_CONFID final answer uses Composer-safe filtered material.
- [ ] 4.3 Ensure REJECT final answer does not include root-cause conclusions and does not pass through Executor raw answer.
- [ ] 4.4 Ensure Executor `user_facing_answer` is not read by any final answer path.
## 5. Tests And Verification
- [ ] 5.1 Add or update tests proving Composer input excludes raw tool output and full Executor output.
- [ ] 5.2 Add or update tests proving unsupported claims do not appear as confirmed final-answer content.
- [ ] 5.3 Add or update tests for PASS root-cause wording only when an allowed root-cause claim exists.
- [ ] 5.4 Add or update tests for LOW_CONFID separation of confirmed information, possible directions, and evidence gaps.
- [ ] 5.5 Add or update tests for REJECT with `allowed_hypotheses=[]` and no root-cause conclusion.
- [ ] 5.6 Add or update tests for malformed Composer fallback with no raw JSON leakage.
- [ ] 5.7 Run targeted Maven tests.
- [ ] 5.8 Validate this OpenSpec change and all specs.