Renderer Algorithm Rationale

This document explains why the renderer layout algorithm was designed the way it is. It focuses on business and product reasoning, not low-level implementation details.

Problem Being Solved

Reason Tracker debates are directed claim graphs with one main sink claim. Those graphs may contain cycles.

For rendering and human review, cycles create UX problems:

The renderer must provide an optional way to present the same debate in an easier-to-follow acyclic form without rewriting the source debate.

Product Requirements Behind The Design

  1. Preserve original model as source of truth.
  1. Support two user intents.
  1. Keep one package boundary for output.
  1. Keep concept count low.

Why cycleMode Exists

cycleMode is an explicit product control, not just a technical switch.

This keeps behavior intentional and visible at call sites.

Why Sink-First Unrolling

The chosen mental model is to traverse from the main claim (sink) toward supporting/attacking leaves.

Business reasons:

Why Duplicate Appearances Are Allowed

When unrolling, the same claim may appear more than once in different branches.

Reason:

In short: duplicates in view are preferred over information loss in source semantics.

Why No Repeat Inside A Branch

A claim is not repeated within the same root-to-leaf branch during unroll.

Reason:

Why The Hard Expansion Guard Exists

Unrolling can still grow quickly across branches even with branch-local no-repeat.

Policy choice:

Business reasons:

The failure is intentionally surfaced as a named error so callers can decide UX handling.

Why Deterministic Ordering Matters

Deterministic traversal and ordering are required for:

Non-deterministic layouts make quality and correctness harder to validate.

Why Scores Are Referenced, Not Recomputed

Unrolled appearances reuse the score of the underlying claim.

Reason:

Why Layout Logic And Web Output Are Separated Internally

Even within one renderer package, layout and web emission remain separate concerns.

Reason:

Why This Is Not In AGENTS.md

AGENTS.md is agent-steering policy. This rationale is shared technical design documentation and belongs in docs.

A pointer from AGENTS.md to coding/design docs is appropriate; duplicating design rationale there is not.

Decision Summary