🧰 CodeMuse – AI Code Assistant

🚀 Inspiration

As a developer, I’ve always relied on tools like GitHub Copilot and ChatGPT to understand, debug, and improve my code, but I was never comfortable with the trade-off they demanded. Every time I used them, I had to send proprietary or sensitive code to remote servers. For developers under NDAs, or those working in regulated industries like finance or healthcare, that’s simply not an option. I wanted to create something that gave developers the same power of AI-assisted coding without compromising privacy, compliance, or control.

That motivation became CodeMuse , a Chrome Extension that delivers a fully offline, on-device AI coding assistant using Chrome’s new Prompt API and the Gemini Nano model. My goal was to prove that privacy and productivity don’t have to conflict, that we can build AI tools that help developers work faster while keeping their intellectual property secure.


đź§  What I Learned

This project taught me the incredible flexibility of Chrome’s Prompt API and how much can be achieved through prompt engineering alone. I learned how to structure prompts to achieve specialized tasks like code explanation, refactoring, and bug detection, all from a single API endpoint.

I also gained deeper insight into client-side AI architecture: how to manage sessions efficiently, handle asynchronous responses, and design graceful fallbacks when AI resources are unavailable. Beyond the technical side, I learned how to think like a product designer, how to make AI interactions intuitive, reliable, and privacy-centered for real developers.


🏗️ How I Built It

CodeMuse is built as a Chrome Extension (Manifest V3) with a modern developer-themed UI. It integrates the Prompt API (LanguageModel endpoint) to process natural-language prompts locally through Gemini Nano. Each feature, Explain, Refactor, Review, and Comment, is powered by a custom-engineered prompt that converts a general-purpose language model into a specialized code mentor.

The extension’s logic in popup.js manages session creation, AI prompting, and result rendering. A background service worker handles keyboard shortcuts, context menu integration, and cross-component communication, while a content script detects code selections and injects contextual hints into websites like GitHub or Stack Overflow.


⚙️ Challenges I Faced

The biggest challenge was designing around an evolving API ecosystem. Chrome’s built-in AI features are still in early access, so I had to build adaptive code that could gracefully handle unavailable endpoints while staying future-proof. Creating multi-mode prompts within a single API also required careful engineering, ensuring that the model produced structured, reliable results across multiple programming languages was a constant iteration process.

Another major challenge was optimizing the user experience. I wanted CodeMuse to feel effortless, a one-click assistant that enhances a developer’s workflow without slowing them down. Balancing performance, simplicity, and aesthetic design within the browser’s limited pop-up interface required thoughtful experimentation and refinement.


đź’ˇ Conclusion

CodeMuse represents what I believe to be the next generation of developer tools: intelligent, secure, and fully local. By combining Chrome’s Prompt API with responsible prompt engineering, I built an AI assistant that runs completely offline, no subscriptions, no servers, no data leaks.

This project reinforced a powerful lesson for me: the future of AI doesn’t just depend on bigger models, it depends on trust, accessibility, and privacy. With CodeMuse, I wanted to show that we can have all three, right inside the browser.

Built With

Share this project:

Updates