Inspiration
Long AI collaborations tend to fail in opposite directions. Either everything remains active and the work sprawls, or the conversation is compressed into a simplified summary that loses reasons, exceptions, and abandoned branches. Corrections may repair the current output, but they rarely become accountable improvements in how the agent works later.
We wanted an agent that could develop with the user without confusing memory with relevance or interpretation with authority. Rein separates what is stored, what is currently active, and what is authorized to alter the project.
What it does
Rein is a developmental AI collaborator that turns human corrections into scoped, tested, reusable project capabilities.
It preserves the user’s exact correction and provenance, then uses Gemini 3.5 Flash to interpret its scope and exception policy into a constrained schema. Rein compiles that interpretation into a bounded candidate capability—but the candidate cannot execute.
Before asking for approval, Rein shadow-runs an isolated copy against:
- The observed failure
- Correct existing work
- Intentional exceptions
- Incomplete triggers
- Foreign-project boundary cases
The interface reports what the rule would repair, preserve, or wrongly alter. Any regression blocks promotion. Only after this consequence preview may the human approve the capability and run deterministic fixtures.
The demonstration then creates a later violation without repeating the original correction. The approved capability detects and repairs it automatically. Rein also preserves a deliberate exception with its rationale, stores a potentially useful aside without losing the active return point, elicits a provisional qualitative criterion through controlled probes, and finishes with an inspectable audit of the entire lifecycle.
How we built it
- Gemini 3.5 Flash performs schema-constrained interpretation of natural-language feedback.
- Google Agent Development Kit (ADK) defines a root agent and bounded tools for interpretation, candidate compilation, and validation.
- A Python compiler emits restricted declarative capabilities instead of executable model-generated code.
- A counterfactual evaluator previews candidate consequences without activating them.
- A deterministic executor enforces project scope, approval state, supported operations, test fixtures, and documented exceptions.
- FastAPI serves the public application from Google Cloud Run.
- The interface displays the structured artifact, capability lifecycle, loss/noise regulator, qualitative probes, and append-only evidence timeline.
- Optional Firestore mirroring and Pub/Sub audit-dispatch adapters are implemented in the repository, but they are not enabled or represented as executed in the hosted demonstration.
The Gemini API key remains server-side in Google Secret Manager and is never exposed to the browser or committed to source control.
Challenges
The hardest problem was preventing a plausible interpretation from being mistaken for an authorized project rule. Rein therefore separates candidate, previewed, approved, tested, and reused states.
A second challenge was demonstrating developmental learning without unsafe self-modifying code. Rein uses a deliberately restricted capability language and deterministic executor.
A third challenge was making human approval meaningful. Instead of asking users to approve an abstract rule, Rein shows the rule’s behavioral consequences and regression evidence before granting it authority.
Accomplishments that we’re proud of
- A public Cloud Run deployment completes the full Gemini-backed lifecycle.
- Candidate capabilities fail closed before approval.
- Consequence previews expose intervention, preservation, exception, and boundary cases.
- Regression-causing candidates cannot be promoted.
- Project scope prevents cross-project leakage.
- Approved capabilities repair later relevant violations without repeated instruction.
- Intentional exceptions remain valid, documented, and visible.
- Asides remain recoverable without redirecting active work.
- The final demonstration produces fifteen provenance-linked evidence events.
- All 22 deterministic safety and lifecycle tests pass.
What we learned
More context does not automatically produce better collaboration. The essential distinction is not only what the system remembers, but what is relevant now and what has authority to change the work.
We also learned that interpreting feedback is not sufficient for informed consent. Users need to see the proposed rule’s likely consequences before it becomes operative. A credible learning claim needs a visible lifecycle: origin, scope, preview, approval, tests, execution, reuse, exceptions, and evidence.
What’s next for Rein
Future versions will add capability versioning and suspension, dependency-aware context composition, additional artifact domains, richer qualitative probes, and carefully governed cross-project transfer.
The contest prototype deliberately proves one reliable vertical slice rather than claiming unrestricted self-improvement or general machine creativity.
Try it
Live application:
https://rein-agent-891492190467.us-east1.run.app
Source code:
https://github.com/wrt-del/rein-agent
Demo video:
https://www.youtube.com/watch?v=56IEbZKHiRs
Built With
- fastapi
- gemini-3.5-flash
- google-agent-development-kit
- google-cloud-run
- python