Project Info
Business policies live in prose while customer decisions live in code. A single strict inequality or misplaced exception can silently change who receives a refund. PolicyTwin connects each policy sentence to an explicit decision, executable rule, edge case, application behavior, code location, and reviewable proof. The seeded Build Week workflow starts with a synthetic SaaS refund policy. Policy Studio keeps source-clause traceability and a strict PolicyIR. Decision Queue records three material ambiguity choices instead of hiding them in a prompt. Deterministic code compiles the accepted model to Rego, and checksum-pinned OPA 1.18.2 evaluates 41 golden, boundary, conflict, and generated cases. Integration / Drift compares the same accepted expectations with a deliberately buggy TypeScript fixture and exposes 16 counterexamples caused by three defects: excluding exactly day 14, excluding exactly 20% usage, and allowing an approved promotion to bypass final-sale precedence. The bounded local challenge run then asked GPT-5.6 Sol through Codex SDK/CLI 0.144.6 to repair a fresh fixture copy. Codex returned complete replacements for the two fixed files without seeing the evaluation-only expected implementation. PolicyTwin derived the filesystem diff, ran the fixed typecheck and seven regression tests, replayed all 41 accepted policy cases, and required a distinct read-only Codex review. The captured result is 41/41, zero drift, and APPROVE with no blocking finding; prompt, schema, thread, tree, command, result, and diff hashes are checked into artifacts/challenge-evidence/. The Proof view keeps claims attached to machine-readable evidence and leaves unavailable capabilities marked as not run. The local challenge profile is deliberately separate from the production verify:live contract: it may use a logged-in Codex SDK run on a disposable fixture, but it never claims cgroup-v2 isolation, direct Responses API evidence, deployment security, or production attestation. Judges can reproduce the deterministic seeded workflow with pnpm demo:run, inspect all six views with pnpm dev, run the full offline gate with pnpm verify, and validate the captured GPT-5.6/Codex proof with pnpm challenge:check.
PolicyTwin
Turn a policy sentence into rules, tests, application behavior, and reviewable proof.
Refund policies are written in prose, but products enforce them in code. A single < instead of <=, or one exception in the wrong order, can change who receives a refund. PolicyTwin keeps the policy and the implementation in sync.

Build Week result
PolicyTwin found three seeded bugs in a TypeScript refund application, asked GPT-5.6 Sol through Codex to repair a disposable copy, and then checked the result independently.
| Result | Evidence |
|---|---|
| Seeded application bugs | 3 |
| Counterexamples before repair | 16 |
| Codex-authored files changed | 2 |
| Regression tests after repair | 7 / 7 |
| Accepted policy cases after repair | 41 / 41 |
| Application drift after repair | 0 |
| Independent review | APPROVE |
- Watch the 2:48 demo
- View the submitted Devpost entry
- Inspect the captured GPT-5.6/Codex evidence
- Primary Codex
/feedbacksession:019f5dcf-0233-7a80-9147-af10c7bbfb28
How it works
- Policy Studio links each source clause to a strict, versioned
PolicyIR. - Decision Queue makes boundary and precedence choices explicit instead of hiding them in a prompt.
- A deterministic compiler converts accepted
PolicyIRinto Rego, and checksum-pinned OPA evaluates it. - Case Lab generates boundary, conflict, contrast, and mutation cases.
- Integration / Drift runs the same expectations against the TypeScript application and shows concrete counterexamples.
- Codex repairs only the two approved fixture files; PolicyTwin derives the diff, runs fixed commands, replays all 41 cases, and requires an independent review.
flowchart LR
A[Policy text] --> B[Versioned PolicyIR]
B --> C[Rego + OPA]
B --> D[41 accepted cases]
D --> E[TypeScript application]
E --> F[Drift report]
F --> G[GPT-5.6 + Codex repair]
G --> H[7/7 tests · 41/41 cases · zero drift · APPROVE]
Try the judge path
Requirements: Node.js 22+, pnpm 11.7+, and Windows PowerShell. The deterministic demo does not need an API key.
pnpm install --frozen-lockfile
pnpm opa:install
pnpm demo:run
pnpm dev
Open http://localhost:3000, then review these views in order:
- Policy Studio
- Decision Queue
- Case Lab
- Integration / Drift
- Proof
- Change Impact
pnpm demo:run resets only the bundled trusted fixture and must report exactly the three seeded drifts. The strongest result is visible in Integration / Drift: two changed files, 7/7 regressions, 41/41 accepted cases, zero drift, and APPROVE.
What is demonstrated—and what is next
| Area | Current Build Week evidence |
|---|---|
| Policy contract, decisions, Rego, OPA, cases, and drift | Working deterministic product flow |
| GPT-5.6/Codex repair | Captured real bounded run with filesystem-derived diff and independent review |
| Natural-language interpretation | The judge demo starts from a recorded, schema-validated PolicyIR; a fresh direct Responses API interpretation was not run |
| Browser-triggered repair | The UI presents the verified captured repair; a fresh hosted repair worker is not connected to the button |
| Production deployment and isolation | Separate future hardening track, not a Build Week result claim |
These boundaries are intentional and visible. PolicyTwin never turns missing production infrastructure into a success claim.
Reproduce the captured result
The checked-in capture can be validated without making a new model call:
pnpm challenge:check
pnpm challenge:submission:check
Key evidence:
artifacts/challenge-evidence/summary.md— human-readable repair resultartifacts/challenge-evidence/local-challenge-run.json— model, commands, cases, review, and hashesartifacts/challenge-evidence/integration.diff— filesystem-derived repair diffartifacts/evidence/summary.md— deterministic reference evidenceartifacts/challenge-submission/— final challenge handoff
Useful commands
| Command | Purpose |
|---|---|
pnpm demo:reset | Restore the trusted demo fixture and local demo state |
pnpm demo:run | Reproduce the three seeded drifts |
pnpm dev | Start the six-view web workspace |
pnpm challenge:check | Validate the captured GPT-5.6/Codex repair evidence |
pnpm challenge:submission:check | Validate challenge links, video binding, and handoff metadata |
pnpm verify | Run the deterministic offline repository gate |
pnpm verify:live | Separate production-live gate; not required to inspect the captured challenge result |
The last recorded offline gate passed 452 unit tests, 82 integration tests, 22 evaluation tests, 3 browser tests, production build, clean-copy replay, and security/history checks. See PROGRESS.md for the exact checkpoint.
Optional server configuration
Copy .env.example only when working on server-side integrations. Never expose these values to the browser or commit them.
| Variable | Purpose |
|---|---|
OPENAI_API_KEY | Server-side Responses API credential |
OPENAI_MODEL | Configurable interpretation model; defaults to gpt-5.6 |
CODEX_MODEL | Explicit Codex repair model |
POLICYTWIN_RUN_TOKEN | Protects the interpretation route |
POLICYTWIN_DATABASE_PATH | Optional SQLite location |
The bounded Build Week capture used gpt-5.6-sol through the project-pinned Codex SDK/CLI 0.144.6 against a disposable fixture. Codex produced complete replacements for src/refund.ts and tests/refund.test.mjs; PolicyTwin—not model prose—derived and verified the result.
Architecture, safety, and limitations
PolicyTwin executes only the bundled trusted refund fixture. It does not execute uploaded or arbitrary repositories. It is a software verification aid, not legal advice; real policy deployment requires human approval.
Detailed engineering material is kept out of the quick judge path:
License
MIT License. Copyright (c) 2026 CHAN. See LICENSE and NOTICE.md.
Analysis
View
Metric
- 142
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CIn code
- CSSIn code
- Next.jsIn code
- OpenAIIn code
- ReactIn code
- TypeScriptIn code
6 of 6 appear in the indexed code.
AI coding agents
- CodexConfig
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
2.3 MB
Source files
194
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
sel-chan/policytwin
479 files · 18.0 MB · @ 5808ffe
Structure
Interface
28 files · 6%Screens, components and styles rendered to the user.
+2 moreAPI & routing
9 files · 2%Request entry points: routes, handlers and controllers.
Application logic
158 files · 33%Domain rules, services and shared utilities.
+21 moreData & schema
11 files · 2%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript60%
- Markdown31%
- YAML6%
- C1%
- CSS1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
package.json
npm · 14- @openai/codex-sdk
- next
- openai
- react
- react-dom
- zod
- +8 more
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.