Rules and Response Resolution
Rule phases
ce_rule.phase supports:
POST_DIALOGUE_ACTPRE_RESPONSE_RESOLUTIONPOST_AGENT_INTENTPOST_SCHEMA_EXTRACTIONPRE_AGENT_MCPPOST_AGENT_MCPPOST_TOOL_EXECUTION
RulesStep writes phase/source/origin metadata into input params and audit payload for every pass.
ce_rule.action supports:
SET_INTENTSET_STATESET_DIALOGUE_ACTSET_JSONGET_CONTEXTGET_SCHEMA_JSONGET_SESSIONSET_TASKSET_INPUT_PARAM
Why POST_SCHEMA_EXTRACTION and PRE_AGENT_MCP both matter
Use the two phases for different boundaries:
POST_SCHEMA_EXTRACTION: immediate shaping right after schema merge and schema-completeness recomputePRE_AGENT_MCP: last deterministic gate before planner/tool execution starts
Typical confirmation-first flow:
POST_SCHEMA_EXTRACTIONseesschemaComplete=true- rule sets
state=CONFIRMATION - optional
SET_INPUT_PARAMwritesawaiting_confirmation=trueandconfirmation_key=... - user responds with
AFFIRM/EDIT POST_DIALOGUE_ACTcan useSET_DIALOGUE_ACTif the final guarded act should be overridden before policy routingCorrectionStepsets runtime flags such asrouting_decisionorcorrection_appliedPRE_AGENT_MCPchecks those flags and decides whether MCP should start
Rule matching behavior
For each pass:
- fetch by phase + session state
- check intent (
ANY/blank/null supported) - check state (
ANY/blank/null supported) - evaluate type resolver (
EXACT,REGEX,JSON_PATH) - execute action resolver
- rerun pass if intent/state changed (max pass cap)
Audit emitted for both outcomes:
RULE_MATCH (AgentIntentResolver)RULE_NO_MATCH (AgentIntentResolver)RULE_MATCH (RulesStep)RULE_NO_MATCH (RulesStep)RULE_MATCH (McpToolStep)RULE_NO_MATCH (McpToolStep)
RULE_APPLIED (...) is additionally emitted when action execution mutates/executes the matched rule.
Response resolution behavior
ResponseResolutionStep:
- selects response template by intent/state/priority
- resolves output format
- emits
RESOLVE_RESPONSE*audit stages - writes final payload (
EXACTorDERIVED)
SET_INPUT_PARAM patterns
Use SET_INPUT_PARAM when you need lightweight runtime variables persisted in inputParams instead of writing custom Java.
Common runtime-flag patterns
| Scenario | Example action_value | Why it helps |
|---|---|---|
| Confirmation required | {"awaiting_confirmation":true,"confirmation_key":"LOAN_APPLICATION_CONFIRM"} | Marks the next turn as a confirmation-bound reply. |
| Skip re-extraction | {"skip_schema_extraction":true} | Avoids another schema LLM call on confirm-accept or deterministic patch. |
| Route after AFFIRM | {"routing_decision":"PROCEED_CONFIRMED"} | Lets PRE_AGENT_MCP or PRE_RESPONSE_RESOLUTION rules branch without parsing raw user text. |
| Patch feedback | {"correction_applied":true} | Allows confirmation responses to mention that a value was updated. |
Best practice for yes/no turns
Do not write ce_rule against raw “yes”, “go ahead”, or “confirm” text. Use DialogueActStep (AFFIRM / NEGATE) plus a scoped runtime flag such as awaiting_confirmation or confirmation_key.
Operational guidance
- Keep fallback state responses (
ANY/UNKNOWN) for safety paths. - Keep at least one response for each terminal state.
- Use phase-scoped rules instead of overloading one monolithic
PRE_RESPONSE_RESOLUTIONpass. - Use
SET_INPUT_PARAMwhen you need deterministic runtime flags without hardcoding more Java branching. - For confirmation flows, combine
DialogueActStep+CorrectionStep+SET_INPUT_PARAMrather than rerunning full schema extraction on every turn. - When guarded dialogue-act output needs a DB-driven override, use
POST_DIALOGUE_ACT+SET_DIALOGUE_ACTinstead of hardcoding workflow state names in Java.