DEV Community

Gayatri Khandre
Gayatri Khandre

Posted on

ContextLens — Think Deeper. Decide Better. 🧠

What if AI's most useful role in a difficult decision wasn't to tell you what to do?

What if it helped you see the problem more clearly first?

That's the idea behind ContextLens — a structured AI thinking partner that helps people examine difficult situations, question assumptions, discover missing context, explore trade-offs, and then make their own decision.

🔗 GitHub: https://github.com/GayatriKhandre/contextlens

🎥 Demo: https://drive.google.com/drive/folders/1EY23NGljUcJVfKCQmqqYP1auDOjSz_u1?usp=sharing

The problem

When we're stuck with a difficult decision, we often start with the question:

"What should I do?"

But that can be the wrong first question.

We may already be mixing together:

  • facts and assumptions
  • known information and unknown information
  • our own perspective and someone else's
  • short-term needs and long-term goals
  • options and their trade-offs

And when we ask a conventional AI assistant for advice, it can be tempting for the system to immediately give us an answer.

ContextLens takes a different approach.

Instead of immediately giving a verdict, it asks:

Do we understand the problem well enough to make a decision yet?

What I built

ContextLens is a structured thinking workspace designed around a simple principle:

AI should help you examine a decision, not make the decision for you.

The workflow is:
Understand
↓
Question
↓
Expand
↓
Connect
↓
Challenge
↓
Reframe
↓
Compare
↓
Synthesize
↓
Human decides

The final decision always stays with the human.

A real situation I used while building it

I designed the experience around a realistic situation involving a software fresher.

Imagine a fresher who:

  • has a very high workload
  • is handling multiple tasks simultaneously
  • sometimes works beyond normal hours
  • wants to eventually move to a better role
  • has very little time and energy left for interview preparation
  • worries that, as a fresher, pushing back on a manager may be difficult
  • still needs to maintain income stability

A typical AI assistant might jump directly to:

"Start applying for new jobs."

But that's not necessarily the right answer.

There are many things we don't know yet.

Is the workload temporary?

Which tasks are actually non-negotiable?

Can priorities be renegotiated?

How much preparation time is realistically possible each week?

Is changing jobs the immediate goal, or is creating sustainable preparation time the immediate goal?

ContextLens tries to surface these questions before jumping to a conclusion.

How ContextLens thinks about a problem

The system separates a situation into structured pieces such as:

Known

What do we actually know from the information provided?

Unknown

What important information is missing?

Assumptions

What are we treating as true without enough evidence?

Perspectives

How might the situation look from different stakeholders' viewpoints?

Connections

What factors are related even if they weren't initially obvious?

Contradictions

Where do different goals or pieces of information conflict?

Blind spots

What might the person not be considering?

Reframings

Is there a better way to describe the actual problem?

Options

What possible paths exist?

Trade-offs

What does each option gain and sacrifice?

Synthesis

What does the overall situation look like after examining it from multiple angles?

And finally:

Your decision

The human decides.

Why open-source AI matters here

This is the part of ContextLens that matters most for this Hacktoberfest challenge.

ContextLens uses Gemma 3 4B, served locally through Ollama.

That means the core AI reasoning workflow can run locally rather than requiring every piece of decision context to be sent to a remote closed AI service.

For a tool designed around personal and potentially sensitive decisions, that changes the design trade-off.

With a local open-weight model:

  • the model can run on the user's machine
  • decision context can remain within the local runtime
  • the model/runtime can be changed without redesigning the entire product
  • the AI layer is not tied to a single closed provider
  • experimentation is much more accessible

Open AI isn't just an implementation detail here.
The local/open approach directly supports the product's purpose.

The architecture

The project is intentionally kept relatively simple rather than turning the MVP into a collection of unrelated AI services.

                ContextLens
                     │
            User's situation
                     │
                     ▼
                  FastAPI
                     │
                     ▼
                Structured
                 workflow
                     │
          ┌──────────┴──────────┐
          │                     │
   Problem analysis        AI reasoning
          │                     │
          │                  Ollama
          │                     │
          │                 Gemma 3 4B
          │
          └──────────┬──────────┘
                     │
                     ▼
              Structured result
                     │
                     ▼
              Human decision
Enter fullscreen mode Exit fullscreen mode

The application also stores local case information and replay data using SQLite.

The goal was to keep the architecture understandable, testable, and easy to run locally.

Voice workspace

ContextLens also includes a voice workspace designed to keep the thinking process conversational.

The current implementation uses browser speech capabilities when supported:

  • speech recognition can add spoken input
  • speech synthesis can read important responses
  • the interface shows listening/speaking states
  • the transcript appears as chat bubbles
  • text input remains available
  • users can control read-aloud behavior
  • the browser controls microphone permission

If speech recognition isn't available, the interface doesn't pretend that voice is working. It falls back to a usable text interaction.

Why I didn't make it another chatbot

One of the biggest design decisions was intentionally not making ContextLens a generic chatbot.

A generic chatbot often encourages this pattern:
User:
"What should I do?"

AI:
"Here's what you should do..."

ContextLens aims for:

User:
"Here's my situation."

ContextLens:
"What do we know?"

"What don't we know?"

"What assumptions are being made?"

"What perspective are we missing?"

"What trade-offs exist?"

"What would change the decision?"

Human:
"Now I can decide."




The distinction is small in the interface but important in the product philosophy.

---

## What I learned while building it

The biggest lesson was that adding AI isn't the same as designing an AI product.

The difficult part wasn't simply connecting a model.

The difficult part was deciding:

* what the model should actually do
* where deterministic logic is better
* how to structure the model's output
* how to avoid confidently invented conclusions
* how to represent uncertainty
* how to keep the human in control
* how to make local AI status honest
* how to keep the system usable even when the local model isn't available

That led to an important design principle:

> **Don't use AI everywhere just because you can. Use it where it improves the actual experience.**

---

## Local-first design

ContextLens checks whether the local Ollama runtime and Gemma model are available.

The UI doesn't display a fake "AI connected" state.

If the local model isn't available, the application can still demonstrate the complete structured workflow through a clearly identified deterministic fallback.

This was important because a product shouldn't silently pretend that an AI model produced something when it didn't.

---

## Tech stack

### Backend

* Python
* FastAPI
* LangGraph
* Pydantic
* SQLite

### AI

* Gemma 3 4B
* Ollama
* Local inference

### Frontend

* HTML
* CSS
* JavaScript
* Browser Web Speech API

### Testing

* Pytest

The project is designed to run locally without requiring a paid AI API for the core workflow.

## Run it locally
Clone the repository:
git clone https://github.com/GayatriKhandre/contextlens.git
cd contextlens

Create a virtual environment: python3 -m venv .venv

Activate it: source .venv/bin/activate

On Windows PowerShell:
Install dependencies: pip install -r requirements.txt

If you want to use the local Gemma runtime:

ollama pull gemma3:4b

Then start ContextLens:

uvicorn backend.main:app --host 0.0.0.0 --port 3000

Open: http://127.0.0.1:3000

The complete setup and API information are available in the repository README.

---

## API
The application exposes structured endpoints for the thinking workflow, including:

GET  /api/v1/health
GET  /api/v1/cases
POST /api/v1/analyze
POST /api/v1/analyze/continue
POST /api/v1/analyze/decision
GET  /api/v1/cases/{case_id}/replay
GET  /api/v1/decisions
POST /api/v1/memory/personal
GET  /api/v1/memory/personal
DELETE /api/v1/data

This keeps the thinking workflow separate from the UI and makes the system easier to extend.



## Demo

I recorded a walkthrough showing the ContextLens workflow from entering a situation through structured analysis and decision-making.

🎥 Watch the demo:  https://drive.google.com/drive/folders/1EY23NGljUcJVfKCQmqqYP1auDOjSz_u1?usp=sharing

The demo focuses on the actual user experience rather than just showing the code.



## GitHub

The complete source code is open source here:

🔗 https://github.com/GayatriKhandre/contextlens

The repository includes the application code, tests, documentation, configuration, and local setup instructions.



## Current limitations

ContextLens is an MVP, so there are still important limitations.

The quality of AI-generated reasoning depends on the local model and the quality of the information provided by the user.

The system should not be treated as professional legal, medical, financial, or mental-health advice.

The voice experience also depends on browser speech support.

And while local inference improves the privacy story, the application should not be described as providing absolute privacy guarantees. The actual storage and runtime configuration determine what data remains on the machine.



## What's next?

Some directions I'd like to explore include:

* stronger model evaluation for structured reasoning
* better uncertainty detection
* richer case replay
* improved local model selection
* optional model swapping
* more sophisticated long-term personal context
* better voice interaction
* additional open-source models
* evaluation datasets for measuring whether the system actually reduces blind spots
* improved observability for AI workflows

The goal isn't to make ContextLens tell people what to do.

The goal is to make it better at helping people **think before they decide**.



## Why this project matters to me

We often talk about AI as something that gives us answers faster.

I'm more interested in another possibility:

**What if AI could help us ask better questions?**

A difficult decision rarely becomes easy just because someone gives us an answer.

Sometimes we need to slow down, separate facts from assumptions, identify what we're missing, understand other perspectives, and see the trade-offs clearly.

That's what I wanted ContextLens to explore.



## Final thought

AI doesn't have to make the decision for us.

Sometimes its most useful job is simply helping us **see the decision more clearly**.

Think deeper. Decide better.


## Built with open-source AI

ContextLens was built for the Hacktoberfest 2026 open-source AI challenge using Gemma 3 4B and Ollama as the local AI foundation.

The project is open source and available on GitHub.

🔗 https://github.com/GayatriKhandre/contextlens

🎥 https://drive.google.com/drive/folders/1EY23NGljUcJVfKCQmqqYP1auDOjSz_u1?usp=sharing

#hacktoberfest #hf26challenge #opensource #ai
![ ](https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/4lz2tjyres5le05fvakr.png)




Enter fullscreen mode Exit fullscreen mode

Top comments (0)