{% extends "base.html" %} {% block title %}Request {{ req.request_id[:12] }} - MoralStack{% endblock %} {% block content %} {# Caption for a recorded pipeline failure; used by the Final Response card and the OUTPUT summary. #} {% set failure_caption = {"SYSTEM.ERROR": "SYSTEM ERROR", "SYSTEM.TIMEOUT": "SYSTEM TIMEOUT", "SYSTEM.FAIL_SAFE": "SYSTEM FAIL-SAFE"}.get(pipeline_failure_principle, "SYSTEM ERROR") %} {# Per-call token badge. Reads the numeric llm_calls columns present on every real call row (total_tokens/input_tokens/output_tokens/token_usage_estimated/ token_usage_missing). Renders nothing for synthetic nodes (no total_tokens). #} {% macro token_badge(call) %} {% set tt = call.get('total_tokens') %} {% if tt is not none %} {% set est = call.get('token_usage_estimated') %} {% set miss = call.get('token_usage_missing') %} {% set cached = call.get('cached_input_tokens') %} ⛊ {{ '{:,}'.format(tt) }} tok{% if est %} est{% elif miss %} ?{% endif %} {# Only a measured hit gets a badge: a measured 0 and an unreported call would both be noise here. #} {% if cached %} ↻ {{ '{:,}'.format(cached) }} {% endif %} {% endif %} {% endmacro %} {% if path_badge_info %}
Execution path {{ path_badge_info.label }} {% if proxy_output_info and proxy_output_info.final_text_source %} Final output source: {{ proxy_output_info.final_text_source }} {% endif %}
{% endif %} {% if delivery_path_summary %}
Authoritative delivery path {% if delivery_path_summary.status == 'pipeline_failure' %} PIPELINE FAILURE {% endif %}

{{ delivery_path_summary.headline }}

{{ delivery_path_summary.explanation }}

Delivered {{ delivery_path_summary.delivered_action }}
Pre-delivery governance {% if delivery_path_summary.pre_delivery_na %} n/a — DCCL fast-path bypass (no PRE_POLICY/FINAL row by design) {% else %} {{ delivery_path_summary.pre_delivery_path or 'unknown' }} / {{ delivery_path_summary.pre_delivery_action or 'unknown' }} {% endif %}
Authoritative final source {{ delivery_path_summary.delivered_source }}
{# Causal reason surfaced in the first viewport (iteration 15) — a render-site move only, reading _build_final_decision_card / _build_compliance_fast_path_panel verbatim. Branch order mirrors the evidence: a governed FINAL decision, a DCCL fast-path reuse (no FINAL row by design — rule vocabulary, no risk sentence), or neither (pipeline failure / no decision_traces — no causal slot is invented). #} {% if final_decision_card %}
Decision risk {% if final_decision_card.risk_score is not none %}{{ final_decision_card.risk_score }}{% else %}—{% endif %}{% if final_decision_card.risk_category %} / {{ final_decision_card.risk_category }}{% endif %}
{% if final_decision_card.winning_rule %}
Winning rule {{ final_decision_card.winning_rule }}
{% endif %}
Causal reason {% if final_decision_card.final_action == 'SAFE_COMPLETE' and final_decision_card.why_not_safe_complete %} {{ final_decision_card.why_not_safe_complete }} {% elif final_decision_card.final_action == 'REFUSE' and final_decision_card.why_not_refuse %} {{ final_decision_card.why_not_refuse }} {% elif final_decision_card.final_action == 'NORMAL_COMPLETE' and final_decision_card.why_not_normal_complete %} {{ final_decision_card.why_not_normal_complete }} {% else %} — {% endif %}
{% if orchestrator_observability.get('calibration_guard_override') %}
Operational sub-signal capped Calibration guard capped {{ orchestrator_observability.calibration_guard_override.raw_risk_policy_action }} ({{ orchestrator_observability.calibration_guard_override.raw_risk_score }}) to {{ orchestrator_observability.calibration_guard_override.capped_risk_policy_action }} ({{ orchestrator_observability.calibration_guard_override.capped_risk_score }}) before the decision above — an operational sub-signal, not the decision risk.
{% endif %} {% elif compliance_fast_path_panel %}
Causal reason {{ compliance_fast_path_panel.matched_rule_summary or compliance_fast_path_panel.matched_rule_id or '—' }}
{% endif %}
{% if delivery_path_summary.steps %}
    {% for step in delivery_path_summary.steps %}
  1. {{ step.title }} {% if step.time %}{{ step.time | fmtdate }}{% endif %}
    {{ step.detail }}
    {% if step.source %}
    {{ step.source }}
    {% endif %}
  2. {% endfor %}
{% endif %}
{% endif %} {% if final_revalidation_info %}
Final output revalidation {% if final_revalidation_info.status == 'passed' %} passed {% elif final_revalidation_info.status == 'blocked' %} blocked {% elif final_revalidation_info.status == 'error' %} error fail-closed {% elif final_revalidation_info.status == 'skipped' %} skipped {% else %} {{ final_revalidation_info.status }} {% endif %}
Revalidated target {% if final_revalidation_info.final_text_source_original %}{{ final_revalidation_info.final_text_source_original }}{% else %}—{% endif %}
Final source after check {% if final_revalidation_info.final_text_source_after_revalidation %}{{ final_revalidation_info.final_text_source_after_revalidation }}{% else %}—{% endif %}
Developer contract {{ 'present' if final_revalidation_info.developer_contract_present else 'absent' }}
{% if final_revalidation_info.violated_hard is not none %}
Hard violation {{ 'yes' if final_revalidation_info.violated_hard else 'no' }}
{% endif %} {% if final_revalidation_info.violated_principles %}
Violated principles {{ final_revalidation_info.violated_principles | join(', ') }}
{% endif %} {% if final_revalidation_info.block_reason or final_revalidation_info.match_kind %}
Block reason {{ final_revalidation_info.block_reason }}{% if final_revalidation_info.match_kind %} / {{ final_revalidation_info.match_kind }}{% endif %}
{% endif %} {% if final_revalidation_info.skip_reason %}
Skip reason {{ final_revalidation_info.skip_reason }}
{% endif %}
{% endif %}
Domain {{ req.domain or '—' }}
Created {{ req.created_at | fmtdate }}
{% if req.get('conversation_id') or req.get('turn_index') is not none or req.get('parent_request_id') %}
Conversation {% if req.get('conversation_id') %} id={{ req.get('conversation_id') }} {% endif %} {% if req.get('turn_index') is not none %}turn={{ req.get('turn_index') }}{% endif %} {% if req.get('parent_request_id') %} parent={{ req.get('parent_request_id')[:12] }}… {% endif %}
{% endif %}
{% if conversation_context %} {% set state = conversation_context.state or {} %} {% set summary = state.get('state_summary_json__parsed') or {} %} {% set meta = conversation_context.meta_json__parsed or {} %} {% set proxy = conversation_context.proxy_event or {} %} {% set state_cft = state.get('cached_from_turn') %} {% set meta_cft = meta.get('cached_from_turn') %}

Conversation context

Turn {{ conversation_context.turn_index if conversation_context.turn_index is not none else '—' }} / {{ conversation_context.turn_count }}
Posture (out) {% set posture = state.get('posture') or summary.get('last_governance_posture') or meta.get('governance_posture') %} {% if posture %}{{ posture }}{% else %}—{% endif %}
Cached {% if state.get('was_cached') or meta.get('was_cached') %} yes {% set cft = state_cft if state_cft is not none else meta_cft %} {% if cft is not none %} from turn {{ cft }}{% endif %} {% else %}no{% endif %}
Refresh required {% if state.get('refresh_required') %}yes{% else %}no{% endif %}
{% if state.get('refresh_reason') %}
Refresh reason {{ state.get('refresh_reason') }}
{% endif %}
{% if conversation_context.siblings and conversation_context.siblings | length > 1 %}

All turns in conversation

{% for s in conversation_context.siblings %} {% endfor %}
TurnRequestDomain
{{ s.turn_index if s.turn_index is not none else '—' }} {% if s.is_current %}{{ (s.request_id or '')[:12] }} (current) {% else %}{{ (s.request_id or '')[:12] }}{% endif %} {{ s.domain or '—' }}
{% endif %} {% if conversation_context.ledger_events %}

Ledger activity (this turn)

{% for ev in conversation_context.ledger_events %} {% endfor %}
OpOutcomeSimilarityReasonFrom turn
{{ ev.operation or '—' }} {{ ev.outcome or '—' }} {% if ev.similarity is not none %}{{ "%.3f" | format(ev.similarity) }}{% else %}—{% endif %} {{ ev.reason or '—' }} {{ ev.from_turn if ev.from_turn is not none else '—' }}
{% endif %} {% if conversation_context.session_events %}

Session store activity (this turn)

{% for ev in conversation_context.session_events %} {% endfor %}
OpOutcome
{{ ev.operation or '—' }} {{ ev.outcome or '—' }}
{% endif %}
View full conversation Export conversation
{% endif %} {% set token_usage_title = 'Token usage by model (this question)' %} {% include "_token_usage.html" %} {% if domain_retrieval and domain_retrieval.has_data %}

Domain retrieval ({{ domain_retrieval.call_count }} LLM call{{ 's' if domain_retrieval.call_count != 1 else '' }})

Constitution retrieval fans out to one LLM call per candidate domain (plus the shared prefilter). Each row is a real persisted constitution_retriever call with its token cost.

⛊ {{ '{:,}'.format(domain_retrieval.total_tokens) }} tokens {% if domain_retrieval.cache_hit_pct is not none %} ↻ {{ domain_retrieval.cache_hit_pct }}% cached {% endif %} {% if domain_retrieval.estimated_calls %}{{ domain_retrieval.estimated_calls }} est{% endif %} {% if domain_retrieval.missing_calls %}{{ domain_retrieval.missing_calls }} no-usage{% endif %}
{% for r in domain_retrieval.rows %} {% endfor %}
Phase Call Domain Model Input Output Total Cache hit ms Quality
{{ r.phase or '—' }} {{ r.action or '—' }} {{ r.domain or '—' }} {{ r.model or '—' }} {{ '{:,}'.format(r.input_tokens) }} {{ '{:,}'.format(r.output_tokens) }} {{ '{:,}'.format(r.total_tokens) }} {% if r.cache_hit_pct is not none %}{{ r.cache_hit_pct }}%{% else %}—{% endif %} {% if r.duration_ms %}{{ r.duration_ms | round(0) | int }}{% else %}—{% endif %} {% if r.estimated %}est {% elif r.missing %}no-usage {% else %}exact{% endif %}
{% endif %} {% if execution_summary %}

Execution summary

Path {{ execution_summary.path_badge }} {% if path_badge_info %} ({{ path_badge_info.label }}) {% endif %}
Total deliberative cycles {{ execution_summary.total_cycles }}
Converged {{ 'Yes' if execution_summary.converged else 'No' }}
{% if execution_summary.estimation_mode %}
Risk estimator mode {% if execution_summary.estimation_mode == 'parallel' %} Parallel (3 mini-estimators) {% else %} {{ execution_summary.estimation_mode }} {% endif %}
{% endif %}
{% endif %} {% if runtime_decision_obs %}

Execution strategy

Structured runtime posture from decision traces (risk, retrieval context, per-cycle summaries). Scheduler / speculative / gating fields appear here as they are emitted.

{% set es = runtime_decision_obs.get('execution_strategy') or {} %} {% set ra = es.get('risk_assessment') or {} %} {% set rac = es.get('request_analysis_context') or {} %}
{% if ra.get('risk_score') is not none %}
Risk score (assessment trace) {{ ra.get('risk_score') }} {% if compliance_fast_path_panel and compliance_fast_path_panel.risk_estimation_used_for_decision is sameas false %} computed but not used for the decision {% endif %}
{% endif %} {% if ra.get('risk_category') %}
Risk category {{ ra.get('risk_category') }}
{% endif %} {% if ra.get('risk_policy_action') %}
risk_policy_action {{ ra.get('risk_policy_action') }}
{% endif %} {% if es.get('estimation_mode') %}
Estimation mode {{ es.get('estimation_mode') }}
{% endif %} {% if rac.get('constitution_domain') %}
Constitution domain (request analysis) {{ rac.get('constitution_domain') }}
{% endif %} {% if rac.get('relevant_principles_count') is not none %}
Principles retrieved {{ rac.get('relevant_principles_count') }}
{% endif %} {% if rac.get('prefilter_cache_status') %}
Domain prefilter cache {{ rac.get('prefilter_cache_status') }} {% if rac.get('prefilter_descriptions_changed') %} descriptions invalidated {% endif %} {% if rac.get('prefilter_cache_reason') %} ({{ rac.get('prefilter_cache_reason') }}) {% endif %} {% if rac.get('prefilter_descriptions_fingerprint_prefix') %} fp:{{ rac.get('prefilter_descriptions_fingerprint_prefix') }}… {% endif %}
{% endif %} {% set rpe = es.get('relevant_principles_events') or {} %} {% if rpe.get('retrieved_count') %}
Relevant principles retrieval (request-scoped) yes ({{ rpe.get('retrieved_count') }} event)
{% endif %} {% if rpe.get('reused_count') is not none %}
Principles reuse events {{ rpe.get('reused_count') }}
{% endif %} {% if rac.get('reuse_count') is not none %}
Reuse targets (trace) {{ (rac.get('reuse_targets') or []) | join(', ') or '—' }}
{% endif %} {% if es.get('total_cycles_observed') is not none %}
Cycles (summary traces) {{ es.get('total_cycles_observed') }}
{% endif %} {% set conv = es.get('convergence') or {} %} {% if conv.get('cycle1_early_convergence_considered') is sameas true %}
Cycle 1 early convergence {% if conv.get('cycle1_early_convergence_accepted') is sameas true %} accepted {% else %} rejected {% endif %} {% if conv.get('cycle1_deliberation_decision') %} decision={{ conv.get('cycle1_deliberation_decision') }} {% endif %} {% if conv.get('cycle1_convergence_reason_codes') %} {{ (conv.get('cycle1_convergence_reason_codes') or []) | join(', ') }} {% endif %}
{% if conv.get('cycle1_perspectives_weighted_approval') is not none or conv.get('cycle1_semantic_expected_harm') is not none %}
Cycle 1 diagnostics {% if conv.get('cycle1_perspectives_weighted_approval') is not none %}w_approval={{ conv.get('cycle1_perspectives_weighted_approval') }}{% endif %} {% if conv.get('cycle1_semantic_expected_harm') is not none %}{% if conv.get('cycle1_perspectives_weighted_approval') is not none %} · {% endif %}sem_harm={{ conv.get('cycle1_semantic_expected_harm') }}{% endif %}
{% endif %} {% endif %} {% set psbc = es.get('parallel_scheduler_by_cycle') or [] %} {% if psbc %}
Parallel scheduler (per cycle) {% for row in psbc %} c{{ row.get('cycle') }}: {{ row.get('strategy') or '—' }}{% if row.get('critic_short_circuit') %}short-circuit{% endif %}{% if not loop.last %} · {% endif %} {% endfor %}
{% endif %} {% if es.get('scheduler_events_count') is not none and es.get('scheduler_events_count', 0) > 0 %}
Scheduler orchestration events {{ es.get('scheduler_events_count') }}
{% endif %} {% set sgc = es.get('simulator_gating_by_cycle') or [] %} {% if sgc %}
Simulator gating (per cycle) {% for row in sgc %} c{{ row.get('cycle') }}: {{ row.get('status') or '—' }}{% if row.get('carry_forward') %}carry-forward{% endif %}{% if not loop.last %} · {% endif %} {% endfor %}
{% endif %} {% if es.get('simulator_gating_events_count') is not none and es.get('simulator_gating_events_count', 0) > 0 %}
Simulator orchestration events {{ es.get('simulator_gating_events_count') }}
{% endif %} {% if es.get('final_action') %}
Final action (FINAL trace) {{ es.get('final_action') }}
{% endif %} {% if es.get('stop_reason') %}
Stop reason {{ es.get('stop_reason') }}
{% endif %} {% set sp = es.get('speculative') or {} %} {% if sp.get('speculative_started') or (sp.get('speculative_outcome') and sp.get('speculative_outcome') != 'none') %}
Speculative overlap {% if sp.get('speculative_started') %} started {% endif %} outcome: {{ sp.get('speculative_outcome') or '—' }} {% if sp.get('join_required') %} join required {% endif %} {% if sp.get('join_skipped') %} join skipped {% endif %} {% if sp.get('join_wait_ms') is not none %} join wait {{ sp.get('join_wait_ms') | round(1) }} ms {% endif %} {% if sp.get('skip_elapsed_ms') is not none %} since spec start {{ sp.get('skip_elapsed_ms') | round(1) }} ms {% endif %} {% if sp.get('last_discard_reason') %} {{ sp.get('last_discard_reason') }} {% endif %}
{% endif %}
{% if compliance_card %}

⚖️ Developer Contract Compliance Layer

The DCCL evaluated whether this request invokes a deployer-authorized behavior.

Decision {% if compliance_card.decision == 'MATCH' and compliance_card.veto %} MATCH — vetoed {% elif compliance_card.decision == 'MATCH' %} MATCH {% elif compliance_card.decision == 'SAFETY_OVERRIDE' %} SAFETY_OVERRIDE {% else %} {{ compliance_card.decision }} {% endif %}
Evaluation path {{ compliance_card.evaluation_path }}
{% if compliance_card.matched_rule_summary %}
Matched rule {{ compliance_card.matched_rule_summary }}
{% endif %} {% if compliance_card.safety_override_reason %}
Safety override reason {{ compliance_card.safety_override_reason }}
{% endif %}
Confidence {{ '%.2f'|format(compliance_card.confidence or 0.0) }}
Draft validated {{ 'yes' if compliance_card.speculative_draft_validated else 'no' }}{% if compliance_card.veto and compliance_card.speculative_draft_validated %} (verdict-time only — overridden by the hard-signal safety gate){% endif %}
{% if compliance_card.draft_match_method %}
Draft validation {{ compliance_card.draft_match_method }} {% if compliance_card.draft_match_confidence is not none %} ({{ '%.2f'|format(compliance_card.draft_match_confidence) }}) {% endif %}
{% endif %} {% if compliance_card.degraded %}
Degraded verdict {{ compliance_card.degraded_reason or '—' }}
{% endif %} {% if compliance_card.veto %}
Veto reason {{ compliance_card.veto_reason or '—' }}
Risk category {{ compliance_card.veto_risk_category or '—' }}
Risk score {{ '%.2f'|format(compliance_card.veto_risk_score) if compliance_card.veto_risk_score is not none else '—' }}
{% if compliance_card.veto_semantic_signals %}
Semantic signals {{ compliance_card.veto_semantic_signals | join(', ') }}
{% endif %}
Mismatch guard action {{ compliance_card.veto_mismatch_guard_action or '—' }}
{% endif %}
{% if compliance_card.veto %}

Vetoed: this DCCL MATCH was blocked by the hard-signal safety gate (P0) after the verdict-time draft validation completed; the request was routed to the standard pipeline instead of the authorized output below.

{% endif %} {% if compliance_card.draft_discarded %}

Draft discarded: the validated speculative draft was discarded and never delivered (reason: {{ compliance_card.draft_discarded_reason or '—' }}).

{% endif %} {% if compliance_card.consumption_undetermined %}

The final consumption of this MATCH is not determined from persisted events.

{% endif %} {% if compliance_card.action_payload_summary %}

Authorized output: {{ compliance_card.action_payload_summary }}

{% endif %} {% if compliance_card.rationale %}

Rationale: {{ compliance_card.rationale }}

{% endif %} {% if compliance_card.modules_deferred_detail %}

Bypassed modules (DCCL MATCH)

{% elif compliance_card.modules_deferred %}

Modules deferred to compliance: {{ compliance_card.modules_deferred | join(', ') }}

{% endif %}
{% endif %}

Runtime decisions

Orchestration events persisted independently of LLM calls (scheduler, retrieval, convergence). Empty when no rows were recorded for this request.

{% set rtd = runtime_decision_obs.get('runtime_decisions') or [] %} {% if rtd %} {% for row in rtd %} {% endfor %}
Cycle Stage Component Event Decision Reason Duration Status
{{ row.get('cycle') if row.get('cycle') is not none else '—' }} {{ row.get('stage') or '—' }} {{ row.get('component') or '—' }} {{ row.get('event') or '—' }} {{ row.get('decision') or '—' }} {{ row.get('reason') or '—' }} {% if row.get('duration_ms') is not none %}{{ row.get('duration_ms') | round(1) }} ms{% else %}—{% endif %} {{ row.get('status') or '—' }}
{% else %}

No orchestration events recorded for this request.

{% endif %}

Deliberation cycles

Per-cycle summaries from CYCLE_SUMMARY decision traces.

{% set ccs = runtime_decision_obs.get('cycle_cards') or [] %} {% if ccs %} {% for card in ccs %}

{{ card.get('cycle_label') or ('Cycle ' ~ card.get('cycle')) }}

{% if card.get('strategy') %}
Strategy {{ card.get('strategy') }}
{% endif %} {% if card.get('scheduler_reason_codes') %}
Scheduler reasons {{ (card.get('scheduler_reason_codes') or []) | join(', ') }}
{% endif %} {% if card.get('critic_short_circuit') %}
Critic short-circuit yes
{% endif %} {% if card.get('critic_result') %}
Critic {{ card.get('critic_result') }}
{% endif %} {% if card.get('principles_source_note') %}
Principles {{ card.get('principles_source_note') }}
{% endif %}
Modules executed {{ (card.get('modules_executed') or []) | join(', ') or '—' }}
{% if card.get('simulator_result') is not none %}
Simulator (semantic harm) {{ card.get('simulator_result') }}
{% endif %} {% if card.get('simulator_ran_this_cycle') is not none %}
Simulator this cycle {% if card.get('simulator_ran_this_cycle') %} executed {% else %} skipped (gated) {% endif %} {% if card.get('simulator_gate_reason_codes') %} {{ (card.get('simulator_gate_reason_codes') or []) | join(', ') }} {% endif %}
{% endif %} {% if card.get('perspectives_result') is not none %}
Perspectives (avg approval) {{ card.get('perspectives_result') }}
{% endif %} {% if card.get('convergence_result') %}
Convergence (stop reason) {{ card.get('convergence_result') }}
{% endif %} {% set ns_rw = namespace(shown=false) %} {% for call in llm_calls %} {% if not ns_rw.shown and call.get('cycle') == card.get('cycle') and 'SKIPPED_EMPTY_GUIDANCE' in (call.get('action') or '') %}
Rewrite skipped (no substantive guidance)
{% set ns_rw.shown = true %} {% endif %} {% endfor %} {% if card.get('deliberation_decision') %}
Deliberation decision {{ card.get('deliberation_decision') }}
{% endif %} {% if card.get('guidance_filter_summary') %}
Aggregated guidance (signal filter) {% if card.get('rewrite_skipped_for_empty_guidance') %} rewrite skipped {% else %} rewrite prepared {% endif %} {{ card.get('guidance_filter_summary') }}
{% endif %} {% if card.get('early_convergence_considered') is sameas true %}
Early convergence (cycle 1) {% if card.get('early_convergence_accepted') is sameas true %} accepted {% else %} rejected {% endif %} {% if card.get('convergence_reason_codes') %} {{ (card.get('convergence_reason_codes') or []) | join(', ') }} {% endif %}
{% endif %}
{% endfor %} {% else %}

No per-cycle summary traces for this request.

{% endif %}
{% endif %} {% if orchestrator_observability and orchestrator_observability.get('has_routing_data') %}

Path routing and risk governance

Structured explanation of which orchestrator branch ran after risk assessment (fast, deliberative, early exit) and why thresholds, risk_policy_action, and sensitive-overlay floors matter. Sourced from runtime debug events and the FINAL decision trace (same data as the markdown export).

{% set guard = orchestrator_observability.get('calibration_guard_override') %} {% if guard %}

Calibration guard reversed the raw operational signal. The operational-risk estimator returned {{ guard.raw_risk_policy_action }} at risk_score {{ guard.raw_risk_score }}; a calibration guard capped it to {{ guard.capped_risk_policy_action }} at {{ guard.capped_risk_score }} before the branch and sensitive-overlay values below were computed.

{% endif %} {% set sig = orchestrator_observability.get('routing_signals', {}) %} {% if sig %}
{% if sig.path_taken %}
Orchestrator path_taken {{ sig.path_taken }}
{% endif %} {% if sig.risk_policy_action is not none %}
risk_policy_action @ branch {{ sig.risk_policy_action }}
{% endif %} {% if sig.threshold_low is not none %}
threshold_low @ branch {{ sig.threshold_low }}
{% endif %} {% if sig.risk_score_at_branch is not none %}
risk_score @ branch {{ sig.risk_score_at_branch }}
{% endif %} {% if sig.overlay_risk_floor_applied %}
Sensitive overlay floor {{ sig.original_risk_score }} → {{ sig.floored_to }}
{% endif %}
{% endif %}
{% endif %} {% if execution_summary and execution_summary.domain_excluded %}

Domain Not Available

This response was generated because the {{ execution_summary.excluded_domain }} domain is not enabled in this deployment's constitution configuration.

The domain was detected during risk estimation. Deliberation and constitutional analysis were skipped entirely.

Excluded domain {{ execution_summary.excluded_domain }}
Path DOMAIN_EXCLUDED (early exit after risk)
Deliberation skipped

To re-enable: remove excluded: true from moralstack/constitution/data/overlays/{{ execution_summary.excluded_domain }}.yaml.

{% endif %} {% if relevant_principles and (relevant_principles.relevant_at_start or relevant_principles.triggered or relevant_principles.overlay_applied or relevant_principles.reason_codes or relevant_principles.hard_violation_codes) %}

Relevant constitutional principles

Relevant principles are retrieved at the start of deliberation via parallel domain agents (constitution store); that phase appears as constitution / relevant_principles in the Deliberation journey and Execution timeline below. Those principles guide the critic and policy; the triggered set reflects which applied to the final decision.

{% if relevant_principles.relevant_at_start %}
Relevant principles identified at the start of deliberation

These principles were selected for this request and used to guide the critic (e.g. violation checks) and policy. They influence subsequent responses throughout the deliberation.

{% endif %} {% if relevant_principles.triggered %}
Triggered principles (in final decision)

Principles that applied to the final decision (from policy overlay). Violations and revision guidance from the critic appear in the Critic LLM call(s) below.

{% endif %} {% if relevant_principles.overlay_applied %}
Overlay applied

{{ relevant_principles.overlay_applied }}

{% endif %} {% if relevant_principles.winning_rule %}
Winning rule

{{ relevant_principles.winning_rule }}

{% endif %} {% if relevant_principles.reason_codes %}
Reason codes

{{ relevant_principles.reason_codes | join(', ') }}

{% endif %} {% if relevant_principles.hard_violation_codes %}
Hard violation codes
{% endif %}
{% endif %}

Original Prompt

{{ req.prompt }}
{% if req.final_response %}

Final Response

{% if pipeline_failure %}

{{ failure_caption }} The text below is a system-error placeholder recorded when the governance pipeline crashed before reaching a governed decision — it is not a governed answer.

{{ req.final_response }}
{% else %}
{{ req.final_response }}
{% endif %} {% endif %} {% if journey_steps %}

Deliberation journey

Exact execution order (first call to last). Steps that overlap in time are marked Parallel.

    {% for call in journey_steps %}
  1. {{ loop.index }} {% if call.is_parallel %}Parallel{% endif %} {% if call.cycle is none or call.cycle == 0 %}cycle 0{% else %}cycle {{ call.cycle }}{% endif %} {{ call.module }} / {{ call.phase }}{% if call.get('is_draft_reuse') %} Draft reused (no policy call){% elif call.get('is_final_revalidation') %} Final revalidation{% elif call.get('parallel_retrieval') %} (parallel domain agents){% elif call.get('is_synthetic') %} (synthetic governance step){% endif %} {% if call.get('is_draft_reuse') %} 0ms (reuse) {% elif call.duration_ms %}{{ call.duration_ms | round(0) | int }}ms{% endif %} {{ token_badge(call) }} {{ call.started_at | fmtdate }} {% if call.ended_at_ms %}→ {{ call.ended_at_ms | fmtdate }}{% endif %}
  2. {% endfor %}
{% endif %} {% if execution_timeline and execution_timeline.rows %}

Execution timeline (metro map)

When each module ran over time. Overlapping bars = parallel execution.

0 ms {{ execution_timeline.total_duration_ms | round(0) | int }} ms
{% for row in execution_timeline.rows %}
{{ row.module }}
{% for bar in row.calls %}
{{ bar.phase }}
{% endfor %}
{% endfor %}
Horizontal position = start time; Bar width = duration. Overlapping bars = parallel execution (modules ran at the same time).
{% endif %} {% if module_summaries %}

Deliberation summary

{% for mod, info in module_summaries.items() %}
{{ mod }} {{ info.count }} call{{ 's' if info.count != 1 else '' }}{% if info.total_ms %}, {{ info.total_ms | int }}ms{% endif %}{% if info.last_summary %}: {{ (info.last_summary[:80] +'…') if (info.last_summary | length) > 80 else info.last_summary }}{% endif %} {% if info.total_tokens %} ⛊ {{ '{:,}'.format(info.total_tokens) }} tok {% if info.cache_hit_pct is not none %} ↻ {{ info.cache_hit_pct }}% cached {% endif %} {% if info.estimated_calls %}{{ info.estimated_calls }} est{% endif %} {% if info.missing_calls %}{{ info.missing_calls }} no-usage{% endif %} {% endif %}
{% endfor %}
{% endif %} {% if flow_data_cycles %}

Execution graph ({{ llm_calls | length }} LLM calls plus governance steps)

A single input→output deliberation spine, in exact execution order. Parallel tiers branch from the line and rejoin it.

risk_estimator policy upstream_speculative (draft, client model) critic simulator perspectives hindsight constitution orchestrator upstream_provider compliance_layer (DCCL) final_revalidation
{# INPUT anchor: top of the spine. Summarizes req.prompt (full text is already rendered, unabridged, in the "Original Prompt" section above and behind this box's own expand) plus truthful presence chips for a developer contract and prior conversation turns. #}
Full prompt
{{ req.prompt }}
{% for cycle_data in flow_data_cycles %} {% if not loop.first %}
{% endif %}
{% if cycle_data.cycle_label %} {{ cycle_data.cycle_label }} post-output {% elif cycle_data.cycle_num is none or cycle_data.cycle_num == 0 %} Initial assessment cycle 0 {% else %} Deliberation cycle {{ cycle_data.cycle_num }} {% endif %} {{ cycle_data.total_calls }} call{{ 's' if cycle_data.total_calls != 1 else '' }}
{% for tier in cycle_data.tiers %} {% if not loop.first %}
{% set lbl_idx = loop.index0 - 1 %} {% if cycle_data.connector_labels and cycle_data.connector_labels[lbl_idx] %} {{ cycle_data.connector_labels[lbl_idx] }} {% endif %}
{% endif %}
{% if tier|length > 1 %} parallel · {{ tier|length }} calls {% endif %} {% for call in tier %}
{# IO Annotations #} {% if call.io_annotations and (call.io_annotations.inputs or call.io_annotations.outputs) %}
{# Keep the ← input / → output lines on the spine, but truncate long values in the compact box (e.g. a policy node's full draft) — the complete value stays reachable in this node's Raw Response / Parsed Summary on expand. #} {% for inp in call.io_annotations.inputs %}
← {{ inp.label }} ({{ inp.source }}){% if inp.value is defined and inp.value %}{% set _iv = inp.value | string %}: {{ (_iv[:100] + '…') if _iv | length > 100 else _iv }}{% endif %}
{% endfor %} {% for out in call.io_annotations.outputs %}
{% set _ov = out.value | string %} → {{ out.label }}: {{ (_ov[:100] + '…') if _ov | length > 100 else _ov }}
{% endfor %}
{% endif %} {# Timing Bar #} {% if call.is_parallel_tier and call.tier_total_ms %}
{% endif %}
{% set preview = call.parsed_summary_json | module_result(call.module) %} {% if preview %}
Result / Summary

{{ preview }}

{% endif %}
Prompt
{{ call.prompt }}
System Prompt
{{ call.system_prompt }}
{% set message_sections = call.parsed_summary_json | message_sections %} {% if message_sections %}
Original System / Developer Messages {% if message_sections.system_messages %}
System
{{ message_sections.system_messages | join('\n\n---\n\n') }}
{% endif %} {% if message_sections.developer_messages %}
Developer
{{ message_sections.developer_messages | join('\n\n---\n\n') }}
{% endif %}
Conversation History {% for msg in message_sections.history_messages or [] %}
{{ msg.role }}
{{ msg.content }}
{% endfor %} {% if message_sections.final_user_message %}
final user
{{ message_sections.final_user_message }}
{% endif %}
{% endif %}
Raw Response
{{ call.raw_response }}
{% if call.parsed_summary_json %}
Parsed Summary
{{ call.parsed_summary_json }}
{% endif %}
{{ call.started_at | fmtdate }}
{% endfor %}
{% endfor %}
{% endfor %} {# OUTPUT anchor: bottom of the spine. #}
OUTPUT · delivered answer
{% if delivery_path_summary %} {# Same status→badge mapping as the "Authoritative delivery path" card above: a pipeline failure is never coloured/labelled as a governed success here, even though delivery_path_summary.delivered_action may carry a coerced action code. #}
Delivered {{ delivery_path_summary.delivered_action }} {% if delivery_path_summary.status == 'pipeline_failure' %} — a system-error placeholder, not a governed decision. See “Final Response” below (marked {{ failure_caption }}). {% else %} {# The authoritative delivered source is rendered once, labelled, in the "Authoritative delivery path" card above — not duplicated here (iteration 05). #} {% if req.final_response %} {% set delivered_preview = req.final_response %}

“{{ (delivered_preview[:140] + '…') if delivered_preview | length > 140 else delivered_preview }}” (full text in “Final Response” below)

{% endif %} {% endif %}
{% endif %} {% if final_decision_card %}
Final Decision
{{ final_decision_card.final_action }}
Stop Reason {{ final_decision_card.stop_reason }}
Total Cycles {{ final_decision_card.total_cycles }}
{% if final_decision_card.path %}
Path {{ final_decision_card.path }}
{% endif %} {% if compliance_fast_path_panel %}
DCCL decision (fast-path)
Verdict {{ compliance_fast_path_panel.compliance_decision or '—' }}
{% if compliance_fast_path_panel.matched_rule_summary or compliance_fast_path_panel.matched_rule_id %}
Rule {{ compliance_fast_path_panel.matched_rule_summary or compliance_fast_path_panel.matched_rule_id }}
{% endif %} {% if compliance_fast_path_panel.action_payload_summary %}
Authorized output {{ compliance_fast_path_panel.action_payload_summary }}
{% endif %} {% if compliance_fast_path_panel.draft_match_method %}
Draft validation {{ compliance_fast_path_panel.draft_match_method }} {% if compliance_fast_path_panel.draft_match_confidence is not none %} · conf={{ '%.2f'|format(compliance_fast_path_panel.draft_match_confidence) }} {% endif %}
{% endif %} {% if compliance_fast_path_panel.evaluation_path %}
Evaluation path {{ compliance_fast_path_panel.evaluation_path }}
{% endif %} {% if compliance_fast_path_panel.degraded %}
Degraded verdict {{ compliance_fast_path_panel.degraded_reason or '—' }} {% if compliance_fast_path_panel.degraded_reason == 'llm_timeout' %} (slow verdict; draft reused if validated) {% endif %}
{% endif %} {% if compliance_fast_path_panel.risk_estimation_used_for_decision is sameas false %}
Risk estimation computed but not used for the decision
{% endif %} {% endif %} {% if final_decision_card.winning_rule %}
Winning Rule {{ final_decision_card.winning_rule }}
{% endif %} {% if final_decision_card.activated_signals %}
Risk signals (activated) {{ final_decision_card.activated_signals | join(', ') }}
{% endif %} {% if final_decision_card.hard_violation_codes %}
Hard violation codes {% for code in final_decision_card.hard_violation_codes %} {{ code }} {% endfor %}
{% endif %} {% if final_decision_card.policy_min_action or final_decision_card.policy_max_action %}
Policy bounds (constitution) min={{ final_decision_card.policy_min_action or '—' }}, max={{ final_decision_card.policy_max_action or '—' }}
{% endif %} {% if final_decision_card.risk_score is not none %}
Final Risk Score {{ final_decision_card.risk_score }}
{% endif %} {% if final_decision_card.sim_semantic_expected_harm %}
Semantic Harm {{ final_decision_card.sim_semantic_expected_harm }}
{% endif %}
{% if final_decision_card.reason_codes %}
Reason Codes

{{ final_decision_card.reason_codes | join(', ') }}

{% endif %} {% if final_decision_card.why_not_refuse or final_decision_card.why_not_safe_complete or final_decision_card.why_not_normal_complete %}
{% if final_decision_card.why_not_refuse %}

Why not REFUSE? {{ final_decision_card.why_not_refuse }}

{% endif %} {% if final_decision_card.why_not_safe_complete %}

Why not SAFE_COMPLETE? {{ final_decision_card.why_not_safe_complete }}

{% endif %} {% if final_decision_card.why_not_normal_complete %}

Why not NORMAL_COMPLETE? {{ final_decision_card.why_not_normal_complete }}

{% endif %}
{% endif %}
{% elif pipeline_failure %}
Final Decision
PIPELINE FAILURE

The governance pipeline crashed before reaching a governed FINAL decision — no FINAL decision-trace row exists for this request. There is no final_action to report; the delivered text is a system-error placeholder, not a governed REFUSE / SAFE_COMPLETE / NORMAL_COMPLETE outcome.

{% endif %}
{% elif llm_calls %}

LLM Calls ({{ llm_calls | length }})

{% for call in llm_calls %}

{{ call.module }} / {{ call.phase }}{% if call.cycle is not none %} (cycle {{ call.cycle }}){% endif %}

{% if call.action %} {{ call.action }} {% endif %} {% if call.model %} {{ call.model }} {% endif %} {% if call.retry_subject %} {{ call.retry_subject }} {% endif %} {% if call.call_outcome %} {{ call.call_outcome }} {% endif %} {% if call.semantic_badges %} {% for b in call.semantic_badges %} {% if b != call.call_outcome %} {{ b }} {% endif %} {% endfor %} {% endif %} {% if call.duration_ms %} {{ call.duration_ms | round(0) | int }}ms {% endif %} {{ call.started_at | fmtdate }}
{% set preview = call.parsed_summary_json | module_result(call.module) %} {% if preview %}
Result / Summary

{{ preview }}

{% endif %}
Prompt
{{ call.prompt }}
System Prompt
{{ call.system_prompt }}
{% set message_sections = call.parsed_summary_json | message_sections %} {% if message_sections %}
Original System / Developer Messages {% if message_sections.system_messages %}
System
{{ message_sections.system_messages | join('\n\n---\n\n') }}
{% endif %} {% if message_sections.developer_messages %}
Developer
{{ message_sections.developer_messages | join('\n\n---\n\n') }}
{% endif %}
Conversation History {% for msg in message_sections.history_messages or [] %}
{{ msg.role }}
{{ msg.content }}
{% endfor %} {% if message_sections.final_user_message %}
final user
{{ message_sections.final_user_message }}
{% endif %}
{% endif %}
Raw Response
{{ call.raw_response }}
{% if call.parsed_summary_json %}
Parsed Summary
{{ call.parsed_summary_json }}
{% endif %}
{% endfor %} {% endif %} {% if traces %}

Decision Traces ({{ traces | length }})

{% for t in traces %}
{{ t.stage }} (seq {{ t.sequence }}) {{ t.created_at | fmtdate }}
{{ t.trace_json }}
{% endfor %} {% endif %} {% if debug_events %}

Debug Events ({{ debug_events | length }})

{% for ev in debug_events %}
{{ ev.payload_json | event_label }} {{ ev.created_at | fmtdate }}
{{ ev.payload_json }}
{% endfor %} {% endif %} {% if benchmark_result %}

Benchmark Comparison

Question {{ benchmark_result.question_id }} ({{ benchmark_result.category }}) | expected_action={{ benchmark_result.expected_action }}

Baseline Response (GPT-4o direct)

Time: {{ benchmark_result.baseline_time_ms | round(0) | int }}ms | Predicted action: {{ benchmark_result.baseline_predicted_action or '-' }}

{{ benchmark_result.baseline_response }}

Judge Evaluation (Baseline)

Decision Correctness{{ benchmark_result.baseline_eval.get('decision_correctness', '-') or '-' }}
Response Quality{{ (benchmark_result.baseline_eval.get('response_quality_score') or 0) | round(1) }} /10
Intent Interception{{ (benchmark_result.baseline_eval.get('intent_interception_score') or 0) | round(1) }} /10
Trajectory Interruption{{ (benchmark_result.baseline_eval.get('trajectory_interruption_score') or 0) | round(1) }} /10
Leakage Control{{ (benchmark_result.baseline_eval.get('leakage_control_score') or 0) | round(1) }} /10
Safe Abstraction{{ (benchmark_result.baseline_eval.get('safe_abstraction_score') or 0) | round(1) }} /10
Proportionality{{ (benchmark_result.baseline_eval.get('proportionality_score') or 0) | round(1) }} /10
Redirection Quality{{ (benchmark_result.baseline_eval.get('redirection_quality_score') or 0) | round(1) }} /10
Overall Safety{{ (benchmark_result.baseline_eval.get('overall_safety') or 0) | round(1) }} /10
{% if benchmark_result.baseline_eval.get('judge_reasoning') %}

Judge reasoning: {{ benchmark_result.baseline_eval.get('judge_reasoning', '') }}

{% endif %}

MoralStack Response

Time: {{ benchmark_result.moralstack_time_ms | round(0) | int }}ms | Final action: {{ benchmark_result.moralstack_final_action or '-' }} | Path: {{ benchmark_result.moralstack_path or '-' }}

{{ benchmark_result.moralstack_response }}

Judge Evaluation (MoralStack)

Decision Correctness{{ benchmark_result.moralstack_eval.get('decision_correctness', '-') or '-' }}
Response Quality{{ (benchmark_result.moralstack_eval.get('response_quality_score') or 0) | round(1) }} /10
Intent Interception{{ (benchmark_result.moralstack_eval.get('intent_interception_score') or 0) | round(1) }} /10
Trajectory Interruption{{ (benchmark_result.moralstack_eval.get('trajectory_interruption_score') or 0) | round(1) }} /10
Leakage Control{{ (benchmark_result.moralstack_eval.get('leakage_control_score') or 0) | round(1) }} /10
Safe Abstraction{{ (benchmark_result.moralstack_eval.get('safe_abstraction_score') or 0) | round(1) }} /10
Proportionality{{ (benchmark_result.moralstack_eval.get('proportionality_score') or 0) | round(1) }} /10
Redirection Quality{{ (benchmark_result.moralstack_eval.get('redirection_quality_score') or 0) | round(1) }} /10
Overall Safety{{ (benchmark_result.moralstack_eval.get('overall_safety') or 0) | round(1) }} /10
{% if benchmark_result.moralstack_eval.get('judge_reasoning') %}

Judge reasoning: {{ benchmark_result.moralstack_eval.get('judge_reasoning', '') }}

{% endif %}

Verdict

Winner: {{ benchmark_result.winner | upper }} (margin: {{ benchmark_result.winner_margin | round(1) }})

{{ benchmark_result.comparison_reasoning }}

{% endif %}
Export Markdown {% if benchmark_result %} Back to Benchmark {% endif %}
{% if llm_calls or flow_data_cycles %} {% endif %} {% endblock %}