How It Works
Agents CodeScanner Brainstormer Agentifier Designer StackAdvisor Phaser Deployer
BWS4 About Get Started →
Agent 01 — CodeScanner

CodeScanner

The first step when you're building on top of something that already exists.

Before you plan what to build next, it helps to have a clear, structured picture of what you've already built. CodeScanner reads your project directory and works with you to produce a confirmed code review — so every downstream agent starts from a shared, accurate understanding of your current stack.

CodeScanner start
CodeScanner reading a project directory
CodeScanner end
CodeScanner code review output

What CodeScanner does

CodeScanner gathers your file tree, analyzes config and manifest files, samples source code, and walks through your codebase in six areas — asking you to confirm or correct its findings before moving on:

01
Project Type
Web app, CLI, library, API, data pipeline, mobile app, desktop app, or something else entirely.
02
Architecture
The high-level structural pattern: MVC, layered, microservices, monolith, serverless, event-driven.
03
Languages and Frameworks
Every programming language and framework detected in use, with versions where available.
04
Build System and Dependencies
The package manager and build tool, plus a list of key dependencies and their purpose.
05
Coding Style
Indentation, naming conventions, linter, formatter, and type checker — inferred from config files or source samples when config files are absent.
06
Notable Observations
Test coverage, CI/CD configuration, security patterns, or anything else that will affect new development.

After each section, CodeScanner presents its findings and waits for your confirmation before moving on. If you correct something, it updates its understanding before proceeding. Web search is used to identify any unfamiliar frameworks or technologies it encounters.

Why it matters for the rest of the pipeline

CodeScanner's output — a code_review.json object — travels alongside the vision and stack spec through every downstream agent.

Refines the vision on top of what actually exists — the code review is part of the conversation, so the vision describes the next version of your real project, not an imaginary greenfield one.
Grounds its scouting and tier choices in your codebase — and when you already have AI infrastructure, its cross-cutting recommendations bias toward reusing it rather than proposing new tooling.
Learns from the code review whether your project already has a UI — so it offers to modify the existing look and feel rather than inventing a new one, and skips itself for UI-less projects.
Uses the code review to flag conflicts between your existing stack and any proposed changes, and offers concrete paths to resolve them: keep the existing choice, migrate, or go hybrid.
Uses the code review to ensure phase instructions don't contradict the patterns and conventions already established in your codebase.
Extracts your existing infrastructure from the code review, so the deployment plan builds on what's already running instead of assuming a blank slate.

Without a code review, those agents make assumptions. With a code review, they know exactly what they're working with.

Example output

From the healthcare app example, after scanning an existing FastAPI/Streamlit codebase:

{ "code_review": { "is_software_project": true, "project_type": "web application", "architecture": "layered (presentation / business logic / data)", "languages": ["Python"], "frameworks": ["FastAPI", "Streamlit"], "build_system": "uv / pyproject.toml", "dependencies": [ { "name": "streamlit", "purpose": "UI framework" }, { "name": "litellm", "purpose": "LLM provider abstraction" }, { "name": "fastapi", "purpose": "REST API backend" } ], "coding_style": { "linter": "ruff", "formatter": "ruff format", "indentation": "4 spaces", "quotes": "double", "naming_conventions": { "functions": "snake_case", "classes": "PascalCase" } }, "notes": ["test coverage is minimal", "no CI configuration found"] } }

When to use CodeScanner

You're adding major new features to an existing project
You're onboarding Spec4 to a project that was built before Spec4 existed
You're handing a project off to a new developer and want a shared baseline
You're starting a new planning round on a project Spec4 helped build — each brownfield round begins with a fresh scan, so planning always reflects what actually got implemented
You want to catch stack conflicts before they become implementation problems
Starting a brand-new project from scratch? You can skip CodeScanner and go straight to Brainstormer.

Ready to scan your codebase?

Open Spec4 and start your first code scan. It takes about five minutes and sets the foundation for everything that follows.