-
-
Simply use your mouse to highlight a fragment of text (at least 20 characters) that you want to analyze.
-
Click the "Get Learning Insights" button to start the analysis.
-
While the analysis is running, the extension will show a progress state.
-
The extension will present you with a couple of yes/no questions about key concepts found in the text.
-
After you submit your answers by clicking "See My Effort Level," Learn AIdvisor will show you the final **Attentional Effort Level**
-
Optimize for Learning: (Appears for MEDIUM or HIGH effort). This rewrites the original text to be easier to read.
-
The final result is a restructured version of the text, using shorter sentences, lists, and bolding key terms.
-
Generate Comprehension Test: This creates a set of flashcard-style questions to test if you've truly understood the core concepts.
-
The comprehension test presents you with questions in a card format.
-
Once the answer is shown, a horizontal slider will appear. Rate how easy it was for you to recall the answer, from "Easy" to "Hard"
-
Now you have a new option: "Generate Study Guide". Click this button to create a final, personalized review sheet based on your performance.
-
The Study Guide provides a powerful, focused learning tool: a Glossary of Key Concepts.
Inspiration
The inspiration for Learn AIdvisor came from the daily challenge of digital information overload. We're often confronted with complex articles or study materials online, and it's difficult to gauge the cognitive effort required before diving in. I was fascinated by Daniel Kahneman's Nobel-winning work on attention and effort and wondered: could I build a tool that applies these cognitive science principles to our daily reading? The goal was to create a "cognitive advisor" that could analyze any text and give the user a personalized understanding of its difficulty, empowering them to learn more effectively.
What it does
Learn AIdvisor is a Chrome browser extension that acts as a personal cognitive coach. When a user highlights text on any webpage, the extension:
Analyzes Cognitive Load: It uses Gemini Nano to perform an initial analysis, calculating the "Attentional Effort" (NEA Static) based on text complexity, sentence length, and conceptual density.
Personalizes the Score: It presents a quick "Familiarity Test" with yes/no questions about key concepts in the text. Based on the user's answers, it calculates a personalized NEA Dynamic, representing the actual effort the user will likely need to expend.
Provides Learning Tools: If the text is deemed difficult (NEA Medium or High), the extension offers to generate a simplified version of the text, rephrased for easier comprehension using Gestalt principles. Following this, or for any text, it can create a flashcard-style comprehension test to validate the user's understanding.
How I built it
Learn AIdvisor is a Manifest V3 Chrome Extension built entirely with JavaScript, HTML, and CSS, leveraging the on-device power of Gemini Nano.
Frontend (popup.js & popup.html): The user interface is a clean, multi-stage popup that guides the user through the process. It's responsible for managing the UI state, collecting user input from the familiarity and comprehension tests, and displaying the final results.
Backend (Service Worker - background.js): The core logic resides in the Service Worker. It handles all asynchronous, heavy-lifting tasks to keep the UI responsive. It uses chrome.scripting.executeScript to grab the selected text from the active tab.
On-Device AI (Gemini Nano): I used two of Chrome's built-in AI APIs:
The LanguageModel (Prompt API) is used for complex, instruction-based tasks: generating the initial assessment (NEA Static, PD Score, familiarity questions) in a structured JSON format, and creating the comprehension test questions.
The Rewriter API is used for the text simplification feature. I guide its output using the sharedContext property, providing it with a custom prompt based on Gestalt principles of unit formation (Proximity, Similarity, Structure).
Writer API is used to generate the Study Guide (Glossary). It creates entirely new content (the definitions) based on specific keywords and a set of instructions, all while being aware of the surrounding context.
Challenges I ran into
The Service Worker Lifecycle: The biggest challenge was the non-persistent nature of Manifest V3 Service Workers. They "go to sleep" to save resources, which frequently caused communication errors (Receiving end does not exist) when the popup tried to send a message. I solved this by implementing a "ping" from the popup on load to wake the Service Worker and a notification system (taskCompleted) from the worker to the popup.
Reliable On-Device AI Output: Getting Gemini Nano to consistently return valid JSON through the Prompt API required meticulous prompt engineering and error handling for cases where the output was malformed.
API Misunderstandings: I initially struggled with the Rewriter API, believing it couldn't be customized. A deeper dive into the documentation revealed the power of sharedContext, which was a breakthrough.
Accomplishments that I'm proud of
Translating Theory into Practice: I are incredibly proud of successfully translating abstract cognitive science concepts from Daniel Kahneman's work into a functional, practical tool that users can apply to their daily reading.
Building a Robust MV3 Architecture: Overcoming the challenges of the Service Worker lifecycle to create a reliable, asynchronous communication and state management system between the popup and the background was a major accomplishment.
Harnessing On-Device AI: Creating a fully on-device AI extension that respects user privacy (no data leaves the browser) while providing powerful text analysis and generation capabilities.
Iterative Design: Recognizing that our initial, complex design was failing and having the discipline to pivot back to a simpler, more user-friendly flow that just works.
What I learned
The Dominance of Asynchronicity: In Manifest V3, you must assume every interaction with the Service Worker is asynchronous and potentially unreliable. Building robust messaging, state management, and error-handling patterns is not optional; it's fundamental.
Prompt Engineering is Key: On-device models like Gemini Nano are powerful but require extremely precise instructions, especially for structured data like JSON. Small changes in the prompt can have a huge impact on the output's reliability.
The Power of Specialization: Understanding the right tool for the job—using the Rewriter API for its specific task instead of forcing the general Prompt API—was a key lesson in working with the new AI APIs.
What's next for Learn AIdvisor
Historical Tracking & Visualization: Implement a feature to save all analyzed texts and their NEA scores. This would allow users to track their progress and see which topics or writing styles they find most challenging over time. This might be a good opportunity to re-introduce the Side Panel as a history dashboard.
Implementing the Anchor ID: A system to allow NEA scores to be saved and re-displayed on a webpage, even after reloading.
User Feedback Loop: Allow users to adjust the final NEA score if they feel it was inaccurate. This feedback could be used (locally) to fine-tune future analyses for that user.
Integration with Flashcard Systems: Add an "Export to Anki" button for the comprehension test questions, connecting Learn AIdvisor to a broader ecosystem of learning tools.
Built With
- chrome
- extension
- gemini
- javascript
- json
- nano
Log in or sign up for Devpost to join the conversation.