Inspiration

Modern developers increasingly rely on AI tools to assist with coding, yet most solutions exist as external tools rather than being deeply integrated into the development environment. This creates friction between writing code and improving it. The goal of this project was to explore a more seamless approach: an editor where AI is not a separate tool, but a core part of the workflow.

This project was inspired by the idea of combining the familiarity of a lightweight code editor with the intelligence of a conversational AI system that understands context and evolves code interactively.

What it does

The project is an AI-powered code editor that allows users to write, edit, and improve code in real time. Users can open files, modify content, and provide natural language instructions that guide the AI to refactor or enhance the current file.

Unlike traditional code assistants, the system maintains a structured message history, allowing the AI to operate with context across multiple interactions. This enables more consistent and meaningful improvements over time, rather than isolated one-off suggestions.

How we built it

The application is built as a full-stack web-based editor:

Frontend: A custom editor interface built with React and Next.js, featuring a file explorer, editable code panel, and an AI interaction sidebar. Backend: API routes handle file operations, message management, and AI requests. AI Integration: The system integrates with a large language model via an API, structuring prompts to preserve intent, formatting, and language consistency. State Management: Message history is persisted and reused to provide contextual improvements rather than stateless responses. File System Layer: A virtual file system abstraction allows users to create, edit, and manage files within the editor.

The architecture was designed to separate concerns between file handling, AI interaction, and UI, while keeping the system flexible enough for future extensions.

Challenges we ran into

One of the primary challenges was handling file persistence in production environments where the filesystem is read-only. This required rethinking the storage layer and designing a more robust solution that does not depend on local disk writes.

Another challenge was managing AI context effectively. Ensuring that the model receives the right balance of prior messages and current file content without exceeding limits required careful structuring of prompts.

Additionally, maintaining a smooth user experience while performing asynchronous AI operations required thoughtful state handling and UI feedback mechanisms.

Accomplishments that we're proud of

This project provided valuable insights into:

Designing systems that combine deterministic logic (file operations) with probabilistic AI outputs. Structuring prompts for consistent and high-quality code generation. Managing stateful AI interactions in a way that improves results over time. Building developer tools that feel responsive and intuitive despite relying on external AI services.

It also reinforced the importance of treating AI as part of the product architecture rather than an external add-on.

What we learned

This project provided valuable insights into:

Designing systems that combine deterministic logic (file operations) with probabilistic AI outputs. Structuring prompts for consistent and high-quality code generation. Managing stateful AI interactions in a way that improves results over time. Building developer tools that feel responsive and intuitive despite relying on external AI services.

It also reinforced the importance of treating AI as part of the product architecture rather than an external add-on.

What's next for Cogent

Future work will focus on expanding the capabilities of the editor, including:

Real-time streaming of AI responses More advanced code understanding and diff-based updates Multi-file context awareness Persistent cloud-based storage and collaboration features

Built With

Share this project:

Updates