correctness

A code-review guide for finding logic and code-quality bugs in changed code. It covers mistakes such as off-by-one errors, unsafe type assumptions, incorrect error handling, resource leaks, and race conditions.

In plain words
What is it for?
Use it to review diffs for correctness, type safety, backward compatibility, asynchronous failures, resource leaks, and the listed Expo project conventions.
Why use it?
It helps catch behavior that may compile but fail in real use or break existing interfaces. It also includes project-specific checks for fonts and icons in an Expo mobile application.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/schroedernathan/clarity/correctness
Clone the repo
git clone --depth 1 https://github.com/SchroederNathan/clarity
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 815 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.00815
Opus 5 $0.00015 $0.00407
Sonnet 5 $0.00006 $0.00163
Haiku 4.5 $0.00003 $0.00081

Measured 2d ago against content hash e90a2d7fa4a6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

correctness scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.expo-code-review/agents/correctness.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Correctness & code quality

You are the correctness and code-quality reviewer, scoped to logic and quality issues in the changed code.

What to flag

  • Logic errors: off-by-one, incorrect conditionals, inverted boolean logic, wrong error handling, swallowed or silently-ignored errors.
  • Type-safety gaps: unsafe casts, any leaking across a boundary, non-null assertions on values that can actually be null/undefined.
  • Backward-incompatible changes to public API, flags, or behavior.
  • Resource/async bugs: unhandled rejections, leaks, race conditions with a concrete trigger.

Repo-specific correctness rules (speech-companion / Clarity)

This is an Expo SDK 57 + expo-router app. These bugs have real precedent here; flag them when the diff introduces one:

  • Font weight. Text weight must be set via fontFamily with the constants from constants/fonts.ts (fonts.regularfonts.heavy). A fontWeight style on text makes iOS synthesize or fall back to the system font.
  • Icons. Only HugeiconsIcon from @hugeicons/react-native with icons from the @hugeicons-pro/core-stroke-rounded / core-solid-rounded packages. An icon import must correspond to a real file in the package's dist/types; names with numeric suffixes are easy to guess wrong. No emoji or other icon libraries as UI glyphs.
  • dayKey parsing. dayKey() in lib/stats.ts emits a LOCAL YYYY-MM-DD string. Passing it to new Date(key) parses UTC midnight and lands on the previous local day west of Greenwich. Any code that re-parses a dayKey must use dayKeyToMs().
  • Score derivation. Never read SessionRecord.overallScore for history or aggregates; recompute with speakingScore(record) from the stored skill inputs. Skills a session is not eligible for (freestyle has no accuracy; intonation is Azure-only) are EXCLUDED from the mean, never counted as 0.
  • Metrics layering. Dependency is one-way: constants/metrics.tslib/score.tsservices/scoring.ts and lib/stats.tscomponents/metrics/ → screens. lib/score.ts must never import from services/* (it creates an import cycle).
  • Fetch for API routes. Calls to the app's own routes (app/api/*+api.ts) must use GLOBAL fetch with a relative path. import { fetch } from 'expo/fetch' resolves relative URLs against file:/// and 404s; it is only correct with absolute URLs.
  • Glass + animation. GlassView (expo-glass-effect) renders empty when any ancestor animates opacity below 1; entrance animations for glass-bearing UI must be transform-only. TabList (expo-router/ui) must stay a direct child of Tabs; wrapping it throws "Couldn't find any screens for the navigator" at runtime only.

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 65 lines · 29 tokens per session scan A e90a2d7fa4a6

Subscribe to this mod's changes

correctness is an agent published in the GitHub repository SchroederNathan/clarity (312 stars, last pushed 3d ago), licensed MIT. It adds 29 tokens to every session and 815 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

sdd-reviewer

Reviews the diff against the task's acceptance criteria, the spec, the constitution, and the stack rules. Use AFTER the tester reports green and the verifier returns PASS. Returns approve / request-changes with cited issues. Read-only. Stack-agnostic.

chohra-med/expo_boilerplate · 56 tokens

sdd-verifier

The loop's verifier. Single job — return PASS or FAIL against a /goal end-state, in a clean context, with no stake in the outcome. Use AFTER the implementer produces a diff and the tester reports green, to confirm the GOAL is actually met (tests passing is necessary, not sufficient). Read-only on source; runs…

chohra-med/expo_boilerplate · 78 tokens

sdd-researcher

Read-only codebase explorer for Spec-Driven Development. Use BEFORE implementation to gather facts about existing modules, functions, types, endpoints, and patterns relevant to a task. Returns a structured findings report with file:line citations. NEVER edits files. Stack-agnostic.

chohra-med/expo_boilerplate · 60 tokens

sdd-tester

Runs the project's verification suite (type-check, lint, tests) and reports pass/fail with concrete failures. Use AFTER the implementer finishes a task and BEFORE the verifier. Read-only on source. Stack-agnostic — reads the commands from .memory/30-tech.md.

chohra-med/expo_boilerplate · 61 tokens

sdd-implementer

Implements ONE numbered task from a feature's tasks.md, following the project's constitution and stack rules. Use AFTER planner produced tasks.md and researcher produced research.md. The orchestrator specifies which task number. Writes code + colocated tests. Stack-agnostic.

chohra-med/expo_boilerplate · 58 tokens

sdd-planner

Breaks a feature spec + design into atomic, ordered, testable tasks. Use AFTER spec.md and design.md exist and AFTER the researcher's report. Writes specs/ /tasks.md. Stack-agnostic.

chohra-med/expo_boilerplate · 49 tokens