惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

PCI Perspectives
PCI Perspectives
Apple Machine Learning Research
Apple Machine Learning Research
Recent Announcements
Recent Announcements
量子位
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Recorded Future
Recorded Future
P
Privacy International News Feed
Cisco Talos Blog
Cisco Talos Blog
Latest news
Latest news
C
Check Point Blog
O
OpenAI News
N
Netflix TechBlog - Medium
U
Unit 42
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
F
Full Disclosure
Know Your Adversary
Know Your Adversary
GbyAI
GbyAI
W
WeLiveSecurity
Engineering at Meta
Engineering at Meta
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
I
InfoQ
D
Docker
N
News | PayPal Newsroom
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
T
Tor Project blog
The GitHub Blog
The GitHub Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
ThreatConnect
人人都是产品经理
人人都是产品经理
S
Securelist
G
Google Developers Blog
Martin Fowler
Martin Fowler
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
P
Privacy & Cybersecurity Law Blog
L
Lohrmann on Cybersecurity
博客园 - 【当耐特】
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog

DEV Community

I built a local voice AI that can change to 9 different personalities! UXRay: I Built an AI That Roasts Your UI Like a Senior Designer Would Wyrly DI: Type-safe Dependency Injection for Modern TypeScript The contract is the interface: agent-driven Steampipe Stave in one command Gemma 4's Hidden Superpower: Why Built-in Thinking Tokens Change Everything for Evaluation Tasks ⚡ WordPress Performance: The Real Truth They Don't Tell You A Mobile App Usually Needs an Admin System First Customer Portals Should Remove Repeated Admin Work Episode 4: The Time Loop (Layers & Caching) Why shadow DOM beat iframe for inline tooltips HOW TO CREATE USER AND ASSIGN ROLES IN AZURE WITH ENTRA ID When AI Blackmail Goes Viral Episode 3: The Secret Scroll (The Dockerfile) Monte Carlo Simulation for Engineers: Turning Uncertainty Into Numbers The tokens-per-byte trap: character-level 'compression' adds tokens Nobody Reads Your Code Anymore Why I built a collection of 5 free, zero-signup career finance tools for solo builders 🚀 New React Challenge: Instant UI with useOptimistic Resolvendo a Alucinação da IA na Arquitetura de Software com Code Property Graphs e .NET 9 S1 — Clean Backtrace Crashes: How to Diagnose and Fix Them Cómo solucionar el bucle infinito en useEffect con objetos y arrays The Brutal Reality of Running Gemma 4 Locally I made Claude Code refuse to write code unless the ticket scores 80/100 I Fed React's Entire Hooks Transition History to Gemma 4. Here's What It Found That We Missed. Building a Private RAG System: Lessons from a Local-First AI Journal CodePulse AI — Reviving an AI-Powered Repository Intelligence Platform How to Split Video into Segments with FFmpeg (CLI + API) I've audited dozens of estate agency websites. The same 5 problems show up every single time. Part 1: Taming Asynchronous JavaScript: How to Build a "Mailbox" Queue Building My AI-Powered VS Code Extension 🚀 Google Login in Express with PassportJS & JWT Great example of Gemma 4 moving beyond chatbots into real-world decision support. Using AI to guide everyday actions like recycling shows how impactful applied LLMs can be when designed for usability, not just capability. #Gemma4 #AI #Sustainability Building a Production AI Chatbot for an Educational Institute: Architecture, Lessons & Full Stack Deep-Dive Google Login in Express with PassportJS & JWT How I reclaimed 47GB on my MacBook by cleaning developer project junk Operators Are Not Oracles: How We Learned to Stop Worrying and Love the Configuration I Built 6 Free Developer Tools for AI APIs, Cron, Docker, and Self-Hosting How I Built a Real-Time Precious Metals Price Feed for 30,000 Concurrent Users in Laravel How to Use a SERP API to Validate Whether a Project Idea Is Worth Building Gemma 4 discussions often focus on capability, but real-world impact depends on deployment context. For offline education, especially in low-connectivity regions, latency, cost, and local inference matter as much as model strength. Local Mind Explores it Space Complexity + Ω and Θ Notations Google I/O 2026 Just Confirmed the Shift From AI Chatbots to AI Agents How to Add API Monitoring to an Express App in 5 Minutes (2026) Designing an In-Game Inflation Tracking Algorithm for Web Utility Apps Google AI Studio Just Changed the Shape of App Development If you struggle to learn then this is for you. Best AI Agent Security & Guardrails Tools in 2026: LLM Guard vs NeMo vs Guardrails AI Building Dynamic RBAC in React 19: From Permission Strings to Component-Level Access Control How to Build a Self-Hosted AI Code Review Tool in Python Why We Switched from React to HTMX in Production: A 200-Site Case Study Gemma-Loom: The Intent-Based Virtual Machine (IVM) for Edge Sovereignty Java实习海投攻略:3天300个沟通,我是怎么拿到面试的 I Deployed Netflix's Web Server in 30 Seconds (And So Can You) - Docker Project 1 Debugging Android 14 WebRTC Disconnects on a coturn Relay Path 1/30 Days System Design Question Testing FastAPI + SQLAlchemy with Real PostgreSQL Fixtures: No More Mocking Misery FAQ Schema Markup Generators: What They Actually Do (and What They Don't Tell You) How a pure-TypeScript flex layout engine closed the last WASM-Yoga gap Spot instances as GitHub Actions runners Agents Need Receipts, Not Just Better Prompts readmegen — Generate beautiful README.md in seconds (12 templates, open source) When AI Reads Blueprints: The Hidden Attack Surface of Multimodal Engineering Intelligence Simplicity scales — complexity kills side projects AI does exactly what you ask — that's the problem How a model upgrade silently broke our extraction prompt (and how we caught it) The Best Form Backend for Static Sites in 2026 # ⛽ I Built a Cross-Platform Fuel Finder with React & Supabase: The Indie Dev Journey The 11 Major Cloud Service Providers in 2025 Membangun Karya Visual: Mengintip Fasilitas Multimedia dan Studio Kreatif Amikom What Is IOPS? Visualizing Database Design: From Interactive Canvas to Drizzle, Prisma, and SQL in Real-time A tool to make your GitHub README impossible to ignore 🚀 Zero-Downtime Blue-Green and IP-Based Canary Deployments on ECS Fargate I reproduced a Claude Code RCE. The bug pattern is everywhere. We Replaced Our RAG Pipeline With Persistent KV Cache. Here's What We Found. Jenkins CI/CD Pipeline for a Dockerized Node.js Application: Manual Trigger vs Automatic Trigger Using GitHub Webhooks How to Stream Live Forex Rates to Google Sheets API: A Complete Guide Small Models Will Beat Giant Models (And Most People Haven’t Realized Why Yet) How I Built 5 Linux Automation Scripts on AWS EC2 I built TokenPatch to measure AI coding cost per applied patch I built a Chrome extension to stop squinting at the web Producer audit clean, six tests red Conversa — A Multi-Agent AI Platform Powered by Gemma 4 Build a Real Agent in 15 Minutes with Gemini's New Managed Agents API What I Actually Build: AI Systems That Ship, Not Demos That Impress The Box Ticked While You Read This: LinkedIn, AI Training, and the Switch You Did Not Flip Investasi Masa Depan: Mengintip Fasilitas Laboratorium Komputer Kelas Dunia di Yogyakarta I Cancelled My $20 Claude Cowork Plan After a Week With OpenWork Stop Reviewing Every Line of AI Code - Build the Trust Stack Instead How To Build an Image Cropper in Browser (Simple Steps) I built a macOS disk cleaner for developers and just launched it would love feedback Membangun Kompetensi dan Relasi: Mengapa Ekosistem Kampus Itu Penting I Built an AI That Decides Which AI to Talk To — Running 24/7 From My Living Room Codex Team Usage SOP How to Actually Become a Programmer: The Hard Part Nobody Wants to Explain Building a Production-Style Multi-Tool AI Agent with Python, Flask, React & Gemini AI The Caretaker Sandbox: An Offline-First Visual Playground & Template Engine powered by Gemma 4 # Building Instagram OSINT Projects with HikerAPI Your AI can read. Gemma 4 can see The Battle of the Senior Dev: Why AI Gives You Wings But Only If You're Ready to Pilot
I Built ContextForge with Gemma 4: A Project Memory Generator for Developers and AI Coding Agents
Brian Koech · 2026-05-23 · via DEV Community

This is a submission for the Gemma 4 Challenge: Build with Gemma 4.

What I Built

ContextForge is a developer tool that scans a codebase and generates practical, AI-ready project documentation using Gemma 4 through the Gemini API.

The goal is simple: when a developer or AI coding agent opens a project, they should not have to rediscover the whole repository from scratch. ContextForge generates README.md, SETUP.md, ARCHITECTURE.md, and especially AGENT.md, a durable handoff file designed for future AI coding sessions.

The problem: AI coding agents lose context

AI coding agents are useful, but their context is fragile.

When a chat is cleared, a session expires, or a different agent starts working on the same repository, a lot of hard-won project understanding disappears:

  • what framework the app uses
  • which files matter most
  • how to run the project locally
  • what generated folders should be ignored
  • what assumptions are still uncertain
  • what safety rules an agent should follow before editing

Traditional README files help humans, but they are not always enough for AI agents. Agents need a project map, editing constraints, validation steps, and warnings about risky areas.

That is why ContextForge focuses on AGENT.md.

What ContextForge does

ContextForge takes a ZIP upload or a built-in sample project and generates documentation from the actual files in the codebase.

The MVP can:

  • upload a ZIP file
  • load a built-in Django sample project
  • safely extract and scan files
  • ignore folders like .git, node_modules, .venv, dist, build, .next, and coverage
  • detect the tech stack
  • build a structured prompt for Gemma 4
  • generate:
    • README.md
    • AGENT.md
    • SETUP.md
    • ARCHITECTURE.md
  • display generated docs in tabs
  • copy each generated document
  • download all generated docs as a ZIP

The output is meant to be practical rather than marketing-heavy. If ContextForge is unsure about something, the prompt asks the model to mark that uncertainty instead of inventing details.

Demo

The project is available on GitHub and can be run locally with Docker Compose:

git clone https://github.com/bryko254/contextforge.git
cd contextforge
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
docker compose up --build

Enter fullscreen mode Exit fullscreen mode

Then open http://localhost:5173.

The judge-friendly demo flow is:

  1. Open the ContextForge frontend.
  2. Click Try sample project.
  3. The backend scans the built-in Django task API sample.
  4. ContextForge detects Python, Django, PostgreSQL, Docker, and pip.
  5. The app asks Gemma 4 to generate docs.
  6. The UI displays:
    • README.md
    • AGENT.md
    • SETUP.md
    • ARCHITECTURE.md
  7. Open AGENT.md and show the AI-agent-focused project handoff.
  8. Copy a generated document.
  9. Download all docs as a ZIP.
  10. Optionally upload a small ZIP project and run the same flow.

The app also supports mock mode, so the UI can be tested without a Gemini API key. For judging the real AI flow, run with USE_MOCK_AI=false and provide GEMINI_API_KEY.

Code

Repository: https://github.com/bryko254/contextforge

The project is structured as a small full-stack app:

  • backend/: FastAPI API, ZIP handling, scanning, stack detection, prompt construction, and Gemma API client.
  • frontend/: React/Vite UI for uploads, sample generation, document tabs, copy buttons, and ZIP export.
  • sample-projects/django-api-demo/: built-in Django REST Framework sample used for the default demo.
  • docs/dev-to-submission-draft.md: this DEV submission draft.

How I Used Gemma 4

ContextForge uses gemma-4-26b-a4b-it through the Gemini API. I chose this model because ContextForge is not trying to write arbitrary code; it is doing structured documentation synthesis over selected codebase context.

The model needs to:

  • read selected project files
  • follow a strict JSON response schema
  • avoid inventing dependencies
  • summarize architecture clearly
  • generate instructions for both humans and AI coding agents

Gemma 4 works well for this kind of grounded, instruction-following task. The hosted demo uses the Gemini API so judges can try the app without running a local model.

The architecture is intentionally isolated behind a gemma_client.py service, so the project can later support local Gemma 4 inference for private repositories.

The Gemma 4 call is at the heart of the pipeline:

  1. The backend scans selected files from the uploaded or sample project.
  2. The scanner filters out large, generated, binary, and irrelevant files.
  3. Stack detection summarizes languages, frameworks, databases, infrastructure, and package managers.
  4. ContextForge builds a structured prompt with file summaries, selected file content, and safety rules.
  5. Gemma 4 returns valid JSON containing readme, agent_md, setup, architecture, and summary.
  6. The backend validates the JSON schema before returning it to the frontend.

Architecture

The app has a small full-stack architecture:

User
  |
  | ZIP upload or sample project
  v
React + Vite frontend
  |
  | HTTP request
  v
FastAPI backend
  |
  | safe ZIP extraction / sample project path
  v
Scanner
  |
  | selected files + file tree
  v
Stack detector
  |
  | structured stack summary
  v
Prompt builder
  |
  | documentation prompt
  v
Gemma 4 via Gemini API
  |
  | JSON response
  v
Generated docs UI

Enter fullscreen mode Exit fullscreen mode

The backend is responsible for file handling, scan limits, prompt construction, and API calls. The frontend is responsible for upload controls, loading states, docs tabs, copy buttons, and ZIP download.

How the codebase scanner works

The scanner is intentionally simple and safe for an MVP.

It walks an extracted project directory recursively and ignores noisy or risky paths, including:

  • .git
  • node_modules
  • venv
  • .venv
  • __pycache__
  • dist
  • build
  • vendor
  • .next
  • .turbo
  • coverage

It also skips binary and large files such as databases, images, PDFs, and ZIPs.

The scanner only reads text/code files and applies limits:

  • maximum individual file size: 80KB
  • maximum collected content: about 300KB

Important files are prioritized, including:

  • README.md
  • package.json
  • requirements.txt
  • pyproject.toml
  • Dockerfile
  • docker-compose.yml
  • manage.py
  • settings.py
  • urls.py
  • models.py
  • views.py
  • serializers.py
  • folders like src, app, and routes

The scanner returns a file tree summary, selected file contents, skipped file count, and total collected size.

How AGENT.md is generated

AGENT.md is generated from the same scan context as the other docs, but the prompt gives it a specific job.

It asks Gemma 4 to write AGENT.md for future AI coding agents. That means the output should include:

  • project map
  • important directories and files
  • setup and validation guidance
  • safe development rules
  • uncertain assumptions
  • areas that need extra caution

This is the core idea behind ContextForge: make project context durable across AI coding sessions.

For example, after a chat is cleared, the next agent can open AGENT.md and immediately understand how to move safely inside the repository.

Challenges faced

The biggest challenge was deciding how much code context to send to the model.

Sending everything is risky and inefficient. Sending too little gives weak documentation. The MVP solves this with a scanner that prioritizes important files, skips generated/binary folders, and keeps a strict total content limit.

Another challenge was making the model output predictable. ContextForge asks Gemma 4 for valid JSON with a fixed schema, then the backend validates that response before sending it to the frontend.

I also had to handle security basics around ZIP uploads. The backend checks for path traversal before extracting archives and cleans temporary folders after processing.

Finally, I wanted the project to work without a real API key during local testing, so I added USE_MOCK_AI=true.

What I would improve next

Next improvements I would make:

  • add GitHub repository cloning from the frontend
  • support local Gemma 4 inference for private repositories
  • add richer language-specific parsing
  • generate docs from diffs after code changes
  • add server-side history for generated docs
  • support more output formats for different agent ecosystems
  • improve prompt compression for large repositories
  • add background jobs for larger scans

The local inference path is especially important. The hosted demo uses Gemini API for easy judging, but private repositories should eventually be able to use local Gemma 4 inference without sending selected code context to an external API.