Restoring Academic Due Process: How We Built Margin with Next.js 16 and Clocked AI
"An 87% AI probability score is not evidence. It is an expulsion notice without due process." In the age of large language models (LLMs), universities face an academic integrity crisis. Commercial AI detectors produce opaque, probabilistic verdicts that can disproportionately affect non-native Engl

"An 87% AI probability score is not evidence. It is an expulsion notice without due process."
In the age of large language models (LLMs), universities face an academic integrity crisis. Commercial AI detectors produce opaque, probabilistic verdicts that can disproportionately affect non-native English speakers, trigger flawed disciplinary proceedings, and erode trust between students and faculty.
Meanwhile, traditional plagiarism checkers focus on finding copied passages across the public web. They can miss intra-cohort collusion (two students in the same seminar sharing work) and ungrounded factual claims, including fabricated research papers, invented benchmarks, and unsupported assertions.
We built Margin for the Clocked Build Challenge 2026 to address these problems.
Margin is an academic review system that helps course conveners and lecturers examine batches of student submissions using a transparent, evidence-first workflow.
The machine flags; the educator decides.
Margin uses Clocked's inference endpoints to build an evidentiary pipeline that helps educators investigate potential inconsistencies without treating AI-generated scores as proof of misconduct.
Student Manuscripts (.txt /.docx) | v 1. Clocked Protect Remove direct identifiers | v 2. Clocked Compare Compare submissions pairwise | v 3. Clocked Verify Ground claims in course materials | v 4. Clocked Rerank Prioritize supporting evidence | v Human Reviewer Ledger Compare evidence and record decisions Enter fullscreen mode Exit fullscreen mode Figure 1: The tactile side-by-side verification sheet highlighting contradictory empirical findings.
Each stage produces information for human review rather than an automatic academic misconduct verdict.
Before submissions enter the comparison workflow, Margin sends them through Clocked Protect to identify and remove direct identifiers such as student names, matriculation numbers, and email addresses.
The system then uses anonymous tokens such as S-01 and S-02 to distinguish submissions throughout the downstream workflow.
This design helps reduce the influence of identifying information during evidence review and supports a more privacy-conscious assessment process.
An important distinction: removing direct identifiers is a privacy safeguard, not a guarantee of FERPA compliance. Actual compliance depends on the complete system, its data handling, institutional obligations, and applicable law.
Instead of relying exclusively on public-web plagiarism searches, Margin compares submissions within the same cohort.
For a group of (n) submissions, the number of unique pairs is:
n × (n - 1) / 2 Enter fullscreen mode Exit fullscreen mode Figure 2: Pairwise review interface sorting direct contradictions to the top with pen-wash highlights.
The comparison pipeline looks for two important patterns.
Contradictions: Direct factual inconsistencies between submissions. For example, two papers might describe an apparently identical experiment but report 45 and 120 iterations, respectively.
Shared facts and near-duplicates: Similar reasoning or overlapping passages that may warrant closer inspection. Margin uses pen-wash highlights to make relevant text easier to compare.
These signals are leads for investigation, not proof of copying. Similarity can have legitimate explanations, and contradictory results can arise from different methods, assumptions, or reporting errors.
A submission can sound convincing while containing unsupported claims. Margin addresses this by checking student assertions against the course syllabus or assigned reading pack.
Claims are classified into three categories:
Unsupported claims are prioritized for faculty review.
Figure 3: Claims check interface validating student statements directly against the course syllabus.
The distinction matters: a claim that cannot be verified against a particular reading pack is not necessarily false. It may require another source, additional context, or a more careful interpretation.
Figure 4: The faculty decision ledger with downloadable audit-ready Markdown report.
Once Margin identifies claims that need further investigation, Clocked Rerank helps evaluate relevant reading-pack excerpts and determine how useful each piece of context is.
The triage process assigns one of three actions:
This helps reviewers focus on meaningful evidence instead of manually inspecting every passage with equal priority.
The final step is the Human Reviewer Ledger, where educators can examine submissions side by side, inspect character-offset evidence, and record their own decisions.
Building an application around an AI API involves more than connecting endpoints. We also had to consider API costs, repeated requests, concurrency, and failure handling.
Consider a seminar containing 30 student submissions:
30 × 29 / 2 = 435 unique comparisons Enter fullscreen mode Exit fullscreen mode Making hundreds of API calls for a single batch can become expensive quickly.
Submissions are tokenized into character n-grams in memory. Pairs with no detected vocabulary overlap can be pruned before making an API request, reducing unnecessary calls.
This is a cost-saving heuristic, not a definitive test of whether two submissions are related. It must be interpreted accordingly.
The interface displays a live estimate of the number of comparisons required. A server-side limit, configured through MAX_PAIRS with a default of 20, prevents unexpectedly large batches from proceeding without an appropriate limit configuration.
This adds a second line of defence against accidental credit depletion.
Repeated development requests should not needlessly consume API credits.
To address this, we implemented a file-backed cache under clocked_cache/ using SHA-256 content hashes.
export function computeCacheKey ( endpoint: string, payload: unknown ): string { const serialized = canonicalJson ( payload ); return crypto. createHash ( " sha256 " ). update ( ` ${ endpoint }: ${ serialized } ` ). digest ( " hex " ); } Enter fullscreen mode Exit fullscreen mode The canonicalJson helper recursively sorts JSON object keys before serialization. This means equivalent payloads produce the same cache key regardless of object-key insertion order.
We also implemented a strict Never-Cache-Error policy. Transient failures are not stored as successful cache results, allowing subsequent requests to retry rather than reusing stale errors.
Unrestricted parallel requests can overwhelm an external API or cause avoidable rate-limit failures.
Margin wraps outbound requests in a four-worker concurrency pool using p-limit.
For HTTP 429 and 5xx responses, the retry strategy uses exponential backoff with randomized jitter. This spaces retries out and reduces the likelihood that simultaneous requests will repeatedly collide with the same rate limit.
Together, these measures make API usage more controlled and predictable.
We deliberately avoided another dark dashboard filled with purple gradients and neon effects.
Margin uses a tactile Paper–Ink–Cobalt design language inspired by printed examination scripts, annotated documents, and academic journals.
The background evokes physical exam scripts, term papers, and archival documents.
One-pixel borders and hard shadows, such as 3px 3px 0 #101426, create a sense of physical depth and make interface elements feel deliberate.
Evidence highlights use an inset box shadow:
box-shadow: inset 0 -0. 5 em 0 0 var ( --wash ); Enter fullscreen mode Exit fullscreen mode The effect resembles a professor's highlighter passing over a relevant passage.
The interface uses vanilla CSS custom properties rather than Tailwind or an external UI component library.
The result is a focused, document-oriented experience where evidence and reviewer decisions take priority over decorative dashboard elements.
We wanted judges and developers to evaluate Margin without unnecessary setup friction.
The landing page includes a ⚖️ Judge Access option that authenticates the reviewer into a pre-seeded GNS102 Informatics & Formal Methods batch.
When CLOCKED_API_KEY is not configured, Margin falls back to deterministic, precomputed fixture data. This allows developers and judges to explore the workflow without live API credentials.
The project includes 34 automated tests across six test suites, run through Node.js's native test runner using:
npm test Enter fullscreen mode Exit fullscreen mode These features make the application easier to evaluate, reproduce, and develop locally.
Repository: github.com/Josephjbassey/margin-review
Clone the project and start the development server:
git clone https://github.com/Josephjbassey/margin-review.git cd margin-review npm install npm run seed npm run dev Enter fullscreen mode Exit fullscreen mode You can explore the application with the offline mock engine when CLOCKED_API_KEY is omitted. Live Clocked API functionality requires the appropriate credentials and configuration.
Academic integrity tools should help educators ask better questions, not replace their judgment with a probability score.
Margin explores a different approach: compare submissions within their actual cohort, check claims against assigned materials, surface relevant evidence, and give educators the context they need to make informed decisions.
There are still difficult questions around privacy, false positives, interpretation, and the limits of automated analysis. Those questions deserve to be part of the design process, not an afterthought.
Our goal is not to automate accusations. It is to make academic review more transparent, evidence-based, and fair.
Built by Joseph John Bassey for the Clocked Build Challenge 2026.