DEV Community

Cover image for Projection Engine: I Built an AI Agent That Enters a Reasoning World
Tariq Davis
Tariq Davis

Posted on

Projection Engine: I Built an AI Agent That Enters a Reasoning World

Sanity Challenge Path One Submission

This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content

What I Built

I didn't start this project by trying to build an AI agent.

I was trying to figure out how to make AI reason through a problem without immediately collapsing everything into an answer.

That became the Projection Engine.

The basic flow is:

Question → Projection → Tension → Next Move → Reusable System → AI Build Prompt

The engine runs a question through six stages:

Perceive → Compress → Test → Strip → Integrate → Exit

The interesting part is what happens after the reasoning.

Instead of stopping at "here's what you should do," the engine asks:

What reusable system could exist so this problem can be handled repeatedly?

That system is then turned into an AI Build Prompt.


The Three Egos

The Projection Engine uses three structured analytical lenses.

THE ANALYST

Looks for structure, assumptions, contradictions, and failure points.

What is actually happening here?

Its strength is precision.

Its weakness is over-analysis.

THE CARIBBEAN BUILDER

Looks at practical construction, available resources, constraints, and what can actually work.

The Caribbean framing represents resourcefulness and improvisation.

Its strength is practical construction.

Its weakness is reducing a problem too quickly to immediate utility.

THE CONNECTOR

Looks at relationships, sequence, pacing, and what needs to connect to what.

Its strength is integration.

Its weakness is continuing to interpret when it is already time to move.

They don't always agree.

That's intentional.

The tension between them becomes part of the output instead of being forced into a single artificial consensus.


The World Behind the Agent

This is where Sanity became important.

I didn't use Sanity simply as a database of information.

I used it as the structured world that the Projection Engine queries while reasoning.

The conceptual architecture is:

Sanity = world
MCP / Context = doorway
Projection Engine = movement
Gemini = interpreter
Output = trace

The content in Sanity includes things like stages, mechanics, methods, tensions, next moves, and analytical lenses.

So the model isn't reasoning in an empty space.

It's moving through a structured environment.


Seeing the Projection Happen

A question can be run directly through the terminal:

node write.mjs "whether to trust a plan that sounds too clean"
Enter fullscreen mode Exit fullscreen mode

The engine then produces the six-stage projection.

One of the useful parts of the output is that it doesn't immediately jump to an answer.

It surfaces the tension first.

From that tension, it generates a concrete Next Move.

In this example:

Stress-Test the Plan's Assumptions

That gives the reasoning somewhere to go.


From a Next Move to a Reusable System

The engine then takes the next move one step further.

Instead of simply saying:

Stress-test the plan.

It asks what reusable structure could make that action repeatable.

That produced:

Plan Cleanliness Audit System

Now the output isn't just advice.

It's the beginning of an actual system specification.

The generated structure includes things such as:

  • Purpose
  • Trigger
  • Inputs
  • Process
  • Outputs
  • Failure modes
  • First implementation


And Then It Builds the Builder Prompt

This is probably my favorite part of the experiment.

The engine takes that system specification and turns it into an AI Build Prompt.

So the chain becomes:

Question → Reasoning → Tension → Next Move → Reusable System → AI Build Prompt

The prompt is essentially saying:

Here is the system that emerged from the reasoning. Now build it.

That creates a bridge between thinking about a system and actually constructing one.


Building With AI

During development, I also used Claude to explore and shape parts of the system.

Those artifacts became part of the development trail:

Claude Artifact 1

Claude Artifact 2

But Claude isn't the downstream builder in the final demo.

The actual test is different.

The Projection Engine generates the AI Build Prompt, and I take that prompt and give it to ChatGPT.

Then I see what ChatGPT can actually build from the specification produced by the engine.

That's the part I want to test.


Demo

The demo shows the Projection Engine running from the terminal on a real question:

node write.mjs "How do I know when the strange behavior of a system is a failure, a signal, or something I haven't understood yet?"
Enter fullscreen mode Exit fullscreen mode

The recording follows the output through:

Perceive → Compress → Test → Strip → Integrate → Exit

Then:

Tension → Next Move → Reusable System → AI Build Prompt

The final part is the interesting one.

I copy the generated AI Build Prompt into ChatGPT and let it attempt to build the system described by the engine.


Code

Projection Engine — GitHub

The public repository contains the implementation used for the challenge.


How I Used Sanity

Sanity became the structured reasoning environment behind the agent.

It stores the pieces the engine can query:

  • Projection stages
  • Mechanics
  • Methods
  • Analytical lenses
  • Tensions
  • Next moves
  • Sources

The important distinction is that this content isn't just reference material.

The data becomes part of the behavior.

The engine queries the structured world, interprets what it finds, and produces a new trace from the interaction.


Sanity Project Details

Project ID: 358bqlwi
Dataset: production
Runtime: Node v20.20.2
Model: gemini-3.5-flash-lite

The current version is a terminal-based system rather than a hosted multi-user application.

The Sanity read path is handled through MCP/Context, while the application controls the write path for generated fields.

The model itself does not receive a Sanity write token.


Agent Session

The actual session is intentionally simple.

I give the engine a question.

It queries the structured world.

The different lenses interpret the question.

Their differences create tension.

That tension produces a next move.

The next move becomes a reusable system.

And that system becomes a prompt another AI can build from.

That's the experiment.

I'm not just testing whether AI can answer a question.

I'm testing what happens when structured content becomes part of the reasoning process itself.

And whether the resulting reasoning can become something reusable enough for another AI to actually build.


More of My Work

The Projection Engine is part of a larger body of experiments around AI, cybersecurity, creativity, and personal systems.

The whole library: TagzAuthor

Support the work: ko-fi.com/tagzauthor

Top comments (0)