Inspiration

Coding agents remember the current conversation, but repository conventions often disappear with the session. A developer corrects the same testing style, logging pattern, or architectural mistake again and again. Reflex asks: what if one correction could become verified, repository-owned memory?

What it does

Reflex captures an agent's original patch and the developer's accepted correction. GPT-5.6 Sol generalizes the difference into a reusable rule, rationale, Codex Skill, regression evaluation, and machine-checkable assertions.

The model cannot approve its own output. Reflex independently proves that the generated eval:

  1. fails on the original agent patch,
  2. passes on the human correction, and
  3. preserves all 24 baseline tests.

Only then does Reflex commit the lesson to AGENTS.md, write .codex/skills/repository-conventions/SKILL.md, persist the regression eval, and update the mistakes-prevented metric.

The final proof starts a completely fresh coding-agent session with no previous response state. It reads only repository memory and applies pytest plus structlog on its first attempt.

How we built it

  • OpenAI Responses API with GPT-5.6 Sol for the coding-agent loop and structured correction diagnosis.
  • Four constrained tools: list_files, read_file, write_file, and run_tests.
  • Strict Structured Outputs for rules, skills, evals, and assertions.
  • Server-Sent Events for the live eight-stage verification timeline.
  • Next.js/Vinext, React, TypeScript, Framer Motion, and Lucide for the responsive product interface.
  • Cloudflare Workers and D1 for durable repository state, corrections, rules, evals, and metrics.
  • Drizzle ORM for the persistence schema.
  • A deterministic no-key showcase path so judges can run the complete demo without credentials or a rebuild.

Challenges

The hardest problem was trust. A plausible model explanation is not evidence that a rule is correct. We designed the host verification layer so the model proposes artifacts, while deterministic assertions decide whether they are safe to commit. We also built a virtual repository rather than executing arbitrary model-authored code on the public Worker.

Accomplishments

Reflex delivers a falsifiable end-to-end loop: mistake, correction, generalized rule, regression proof, repository memory, and a fresh-session prevention result. The production deployment is public, resettable, responsive, and exercises the same D1 persistence and verification path in showcase and live modes.

What we learned

Agent memory is most useful when it is portable and executable. A lesson stored only in chat history is fragile; a rule in AGENTS.md, a reusable Codex Skill, and a CI regression eval can guide humans, Codex, other agents, and automation.

What's next

Next we would connect Reflex to real pull requests, add approval policies for organization-wide rules, run arbitrary-code evals in ephemeral isolated containers, and measure prevented violations across repositories.

Built With

  • cloudflare-workers
  • codex
  • d1
  • drizzle-orm
  • gpt-5.6
  • next.js
  • openai
  • pytest
  • python
  • react
  • responses-api
  • server-sent-events
  • typescript
Share this project:

Updates