Core loop
The foundational unit is a disciplined loop:
- Analyzer: derive structured insights from inputs and context.
- Critic: validate completeness, compliance, and quality with bounded iterations.
- Recommender: produce a candidate output under explicit constraints.
- Critic (2): enforce format/length/guardrails, then gate to next step.
Bound retry counts, make failure explicit, and record rationales.
Parallel tracks
For complex artifacts, split work into independent tracks (e.g., title, bullets, description, specs, visuals). Each uses the same loop and emits typed outputs.
- Uniform interfaces for track inputs/outputs
- Track-local critics (domain-specific rules)
- Optional human-in-the-loop per track
Human gates
Toggle human_in_loop to require checkpoints on critical steps. Reviewers see rationale, constraints, and diffs; feedback routes deterministically.
- Pre‑approve safe paths; escalate edge cases
- Capture reviewer feedback into the audit log
- Never hide failures—surface and resolve
Aggregation & audit
A final aggregator merges track outputs, resolves conflicts, and emits a single, typed payload with a full audit trail.
type Critique = { ok: boolean; issues?: string[] };
type TrackOutput<T> = {
value: T;
critique: Critique;
iterations: number;
rationale?: string;
};
type AggregatedOutput = {
title: TrackOutput<string>;
bullets: TrackOutput<string[]>;
description: TrackOutput<string>; // e.g., HTML/markup-safe
specs: TrackOutput<Record<string, string>>;
visuals: TrackOutput<string[]>; // image/task descriptors
audit: Array<{ step: string; actor: 'analyzer'|'critic'|'human'; note?: string; ts: string }>;
};Keep the model simple, typed, and explainable; prefer JSON schemas for interop.
Safety & compliance
- Bounded retries and timeouts per step
- Static constraints (length, vocab, HTML policy)
- Content policy critics separate from business critics
- Deterministic fallbacks on critic failures
Operating the system
- Track‑level metrics: latency, retry counts, critic pass rates
- Drift detection on inputs and outcomes
- Feature flags for human gate toggles and critic strictness
- Versioned prompts and schemas; changelog in audit
This article omits implementation specifics by design.