DEV Community

Mayukh Jyoti Sarkar
Mayukh Jyoti Sarkar

Posted on

Lazy Coder

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady πŸ¦₯

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

"Future you doesn't remember what past you wrote."

Every developer knows the struggle of reopening a side project after two weeks awayβ€”or cloning an unfamiliar repositoryβ€”and having to inspect dozens of files just to remember how everything works.

  • What was I working on before I closed my laptop?
  • Where is the actual entry point?
  • How do I install and run this project?
  • Which TODOs, FIXMEs, and HACKs did past-me leave behind?
  • Where should I start if I want to modify a particular feature?

LazyCoder is a local-first AI coding companion that helps developers understand, navigate, and resume existing codebases without manually investigating every file.

Instead of building another generic chatbot with a code-themed interface, I built a repository-aware developer workbench combining deterministic static analysis, local code retrieval, persistent storage, and open-weight AI through Ollama.

LazyCoder supports local models such as qwen2.5-coder:1.5b-base and qwen2.5-coder:7b, depending on the model available on the user's machine.

What can it do?

1. πŸ“Š AI Project Overview

Generate a structured architectural briefing covering the project's purpose, technologies, directory structure, important source files, entry points, dependencies, tests, documentation gaps, and suggested starting points.

The report is grounded in discovered repository files, with local SQLite caching to avoid unnecessarily regenerating results.

2. πŸ” Multi-Mode File Explainer

Understand unfamiliar code using seven explanation modes:

  • Beginner-friendly summary
  • Line-by-line walkthrough
  • Functions and APIs
  • Advanced technical explanation
  • Potential bugs and edge cases
  • Refactoring suggestions
  • Dependencies and imports

3. πŸ’¬ Ask Your Codebase

Ask natural-language questions about the repository, such as:

  • Where is task creation handled?
  • How does the application store data?
  • Which files are involved in authentication?
  • Where might this bug originate?

Local TF-IDF retrieval identifies relevant code snippets and provides file and line-range references to help developers investigate the actual implementation.

4. πŸ› οΈ Technical Debt and TODO Hub

Discover unfinished work by locating comments such as TODO, FIXME, BUG, HACK, and OPTIMIZE.

LazyCoder organizes these findings and calculates a technical-debt score to help prioritize areas that need attention.

5. ⏱️ Session Catch-up

Get back into a project by inspecting Git working-tree changes, recent commits, and recently modified files.

Instead of trying to remember everything from your previous coding session, you get a useful starting point for continuing your work.

6. πŸš€ Smart Run Guide

Inspect project manifests such as requirements.txt, pyproject.toml, package.json, Cargo.toml, and go.mod to help identify installation, testing, and execution commands.

The goal is to make returning to an unfamiliar project less intimidating.


Demo

The deployed Streamlit version demonstrates LazyCoder's repository-analysis workflows using its bundled sample project and deterministic fallback capabilities.

For local AI inference, run LazyCoder on your machine with Ollama and a compatible model installed.

This distinction matters: the cloud demonstration and the local Ollama-powered experience have different execution environments.


Code

The complete implementation is available in the WEEK3/ directory.

The project is organized into focused modules:

  • WEEK3/app.py β€” Streamlit interface and developer workbench.
  • WEEK3/lazycoder/safety.py β€” Filesystem safety checks, secret filtering, and file-size limits.
  • WEEK3/lazycoder/scanner.py β€” Repository scanning, language detection, manifests, entry points, tests, and TODO extraction.
  • WEEK3/lazycoder/local_ai.py β€” Local Ollama integration and model communication.
  • WEEK3/lazycoder/overview.py β€” Evidence-grounded project overview generation.
  • WEEK3/lazycoder/explainer.py β€” Multi-mode source-code explanation.
  • WEEK3/lazycoder/query_engine.py β€” Code chunking, TF-IDF retrieval, and repository-aware question answering.
  • WEEK3/lazycoder/session_tracker.py β€” Git activity and working-session context.
  • WEEK3/lazycoder/todo_tracker.py β€” Technical-debt scoring and unfinished-work tracking.
  • WEEK3/lazycoder/run_guide.py β€” Project setup and execution guidance.
  • WEEK3/lazycoder/storage.py β€” SQLite persistence and caching.
  • WEEK3/tests/ β€” Automated tests.

The implementation details above describe the intended module responsibilities; consult the repository for the current source code and test coverage.


How I Built It

LazyCoder combines deterministic repository analysis with local AI inference. Each component has a specific responsibility, rather than sending an entire codebase to a language model and hoping for the best.

1. Deterministic Repository Scanning

The scanner discovers source files, programming languages, project manifests, dependencies, entry points, tests, and unfinished-work markers.

This provides a structured foundation for subsequent AI operations.

The scanner is designed to exclude generated directories and sensitive files, enforce file-size limits, and avoid executing repository code.

2. Filesystem Safety and Privacy

Repository inspection requires access to potentially sensitive source code, so filesystem safety is a core part of the design.

The safety layer is intended to validate paths against the selected repository root, filter credential files, ignore generated directories, and restrict the files that can be inspected.

LazyCoder is designed to analyze code without automatically modifying or executing the user's project.

3. Local Code Retrieval

For repository-aware questions, LazyCoder divides source files into overlapping chunks and indexes their contents using scikit-learn's TfidfVectorizer.

When a developer asks a question, the retrieval engine selects relevant snippets and passes their contents and line ranges to the answering component.

This keeps the context focused on potentially relevant code instead of overwhelming the model with the entire repository.

4. Open-Weight AI Through Ollama

LazyCoder uses Ollama as its local inference runtime.

Compatible models can analyze retrieved code, explain unfamiliar functions, summarize architectural relationships, and help developers investigate potential problems.

The application can also use deterministic fallback behavior when local inference is unavailable, allowing supported analysis workflows to remain useful without an active model.

5. Persistent Local Storage

SQLite stores reusable analysis results and cached explanations.

Caching helps reduce repeated work when revisiting the same project. Repository state and file-content hashes can be used to determine whether cached information remains relevant.

Together, these components create a workflow in which deterministic analysis establishes the facts, retrieval supplies relevant evidence, and the language model provides contextual interpretation.


Why Does Open Innovation Matter?

For a coding assistant that inspects source code, open-weight models and local inference are more than a technical preference. They change the privacy, cost, and accessibility of the tool.

πŸ” 1. Your Code Can Stay on Your Machine

Developers regularly work with proprietary projects, personal experiments, client code, and unreleased products.

Sending entire repositories to an external AI service may be undesirable or prohibited.

By using Ollama for local inference, LazyCoder can analyze source code without requiring a remote LLM API.

The local-first architecture is especially valuable when privacy matters more than access to the largest available model.

πŸ’Έ 2. No Per-Token API Bills

Repository exploration can involve repeated scans, file explanations, and dozens of follow-up questions.

With a locally installed model, inference does not require paying a third-party provider for each token. Users still need to account for their hardware, electricity, and storage costs.

This makes repeated experimentation more accessible to students, independent developers, and open-source contributors.

πŸ“΄ 3. Useful Without an Internet Connection

Once the application, dependencies, and model are installed, its local analysis and inference workflows can operate without an internet connection.

That means developers can work during a campus Wi-Fi outage, while travelling, or in environments where network access is restricted.

Initial setup and model downloads may still require connectivity.

πŸ”„ 4. Freedom to Choose Your Model

Different developers have different hardware constraints.

A smaller model can be appropriate for a laptop with limited memory, while a larger coding model may provide better results on a more powerful machine.

Ollama makes it possible to experiment with different compatible open-weight models without redesigning the entire application around a proprietary API.

🧩 5. Transparent, Composable Building Blocks

LazyCoder combines open-source components such as Python, Streamlit, scikit-learn, SQLite, and Ollama.

Developers can inspect the implementation, change the retrieval strategy, replace the model, or extend the scanner to support additional languages and frameworks.

Open innovation makes a coding assistant more adaptable, more accessible, and easier to keep under the developer's control.


My Agent Session

I used AI-assisted development to help design and implement LazyCoder's repository-analysis workflows.

The focus was on building a practical developer tool rather than a generic conversational interface.

If a DevRelay Agent Session is available, its link can be added here.


The Lazy Payoff

Imagine returning to a project you haven't touched in a month.

Before LazyCoder, you might:

  1. Run git status and git log to reconstruct your previous work.
  2. Search the repository for TODO and FIXME comments.
  3. Open dependency manifests to remember the required packages.
  4. Trace imports across multiple files to understand how a feature works.
  5. Read unfamiliar functions before attempting even a small change.

With LazyCoder, you can start with a project overview, inspect unfinished work, review recent changes, ask questions about relevant code, and generate setup guidance from the project's manifests.

Instead of treating every return to an old repository as a fresh investigation, you have a structured starting point.

The aim is simple: spend less time remembering your code and more time improving it.

And because LazyCoder uses local retrieval, persistent caching, and an optional local language model, its workflows can be adapted to different projects and hardware configurations.


Prize Categories

Challenge: Hacktoberfest Open-Source AI Challenge β€” Week 3: Slow and Steady.

Additional partner prize categories can be listed here if they apply to the final submission.


Built for developers who love writing code but don't particularly enjoy rediscovering code they wrote three weeks ago.

Top comments (0)