Skip to content

Conversation

@maswa
Copy link

@maswa maswa commented Feb 7, 2026

What this does

Adds a complete workflow for bringing existing projects into AutoForge. Instead of starting from scratch with a spec, the research agent first analyzes the codebase and generates documentation, which then gets converted into an app spec.

This is useful when you have an existing project and want AutoForge to continue development on it — the agent needs to understand what's already there before it can add features.

Workflow

  1. Click "Analyze Existing Codebase" in the project selector
  2. Browse to the project folder
  3. The research agent runs and generates docs in .planning/codebase/:
    • STACK.md — frameworks, languages, dependencies
    • ARCHITECTURE.md — design patterns, data flow
    • STRUCTURE.md — directory layout, key files
    • CONVENTIONS.md — naming, imports, code style
    • INTEGRATIONS.md — external APIs, services
  4. Review the results in the tabbed viewer
  5. Convert to an app spec via the existing spec creation flow
  6. Choose a git branch (with protected branch warnings)
  7. Continue with normal AutoForge development

There's also a Re-analyze button (microscope icon) on existing projects for when the codebase has changed outside of AutoForge.

What's included

Backend

  • Research MCP server (mcp_server/research_mcp.py) with 6 tools: scan files, detect stack, add findings, get context, finalize, get stats
  • Analysis modules: stack detection (70+ frameworks), pattern analysis, convention extraction
  • Research database for persisting findings across sessions
  • Git branch API (server/routers/git.py) — list, create, checkout branches with protected branch detection
  • Research endpoints in server/routers/agent.py — start/stop/status for research agents
  • Research docs endpoint in server/routers/projects.py — serve generated markdown
  • has-features endpoint — check if project already has features (for reinitialize flow)
  • CLAUDE.md cleanup — auto-deleted after spec creation to prevent agent confusion
  • WebSocket tracking for research agent output and status

Frontend

  • AnalyzeCodebaseModal — folder browser + project name input
  • ResearchProgressView — real-time progress with phase tracking and activity log
  • ResearchResultsView — tabbed markdown viewer for the 5 doc types
  • MarkdownViewer — syntax-highlighted markdown renderer
  • BranchSelectionModal — git branch picker with protected branch warnings
  • ReanalyzeCodebaseModal — confirmation dialog for re-analysis
  • ReinitializeFeaturesModal — clear old features when converting research to spec
  • React Router integration for /research/:projectName routes
  • New shadcn/ui components: radio-group, scroll-area, tabs

Bug fixes bundled in

  • Research agent no longer exits when all features are passing (it analyzes codebases regardless)
  • Stop button URL corrected and method changed from DELETE to POST
  • WebSocket registers callbacks for research agent output (enables activity log)
  • Spec creation with force=True so newer specs overwrite old ones

Changes

  • 48 files changed — 20 new files, 28 modified
  • ~11,600 lines added

Test plan

  • Create a new project via "Analyze Existing Codebase" on a real codebase
  • Verify all 5 documentation files are generated in .planning/codebase/
  • Review results in the tabbed viewer
  • Convert to spec and verify initializer runs correctly
  • Test the Re-analyze button on an existing project
  • Test the Reinitialize Features modal (appears when project already has features)
  • Stop a running research agent via the stop button
  • Verify git branch selection with a protected branch (main/master)
  • Run the full flow end-to-end: research → spec → initialize → coding agent

Complete workflow for onboarding existing projects to AutoForge:

Backend:
- Research MCP server with 6 tools for codebase analysis
- Technology stack detection (70+ frameworks)
- Architecture pattern analysis and code convention extraction
- Research state persistence via SQLAlchemy
- Git branch safety (protected branch warnings, branch creation)
- Auto-delete CLAUDE.md after spec creation to prevent agent confusion
- REST endpoints for research agent lifecycle (start/stop/status)

Frontend:
- Analyze Codebase modal with folder browser integration
- Research progress view with real-time WebSocket updates
- Research results viewer with tabbed markdown display
- Branch selection modal for safe git operations
- Re-analyze Codebase button for updating documentation
- Reinitialize Features modal for research-to-spec flow

Workflow:
1. Click "Analyze Existing Codebase" and select project folder
2. Research agent generates documentation in .planning/codebase/
3. Review results and convert to app spec
4. Choose git branch for safe development
5. Continue with normal AutoForge agent workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant