Skip to content

[plan] Create "architecture-guardian" agentic workflow #25317

Description

@github-actions

Context

From the Scout analysis of issue #25311, this workflow addresses Problem 1: Spaghetti Codebase from Vibe Coding.

"The codebase was complete spaghetti. Functions were scattered in random files, and a few files had grown to several thousand lines." — Lalit Maganti

The author lost a month of work and had to do a full rewrite because AI-generated code accumulated without structural discipline.

Objective

Create a new gh-aw agentic workflow called architecture-guardian that runs on every pull request and push to main to enforce code structure discipline.

Workflow Prompt

Create a GitHub Actions agentic workflow called "architecture-guardian" that runs
on every pull request and push to main.

The workflow must:
1. Scan all source files and detect:
   - Files exceeding 500 lines of code (configurable threshold)
   - Functions/methods exceeding 80 lines
   - Files with more than 10 public exports (suggesting scattered responsibility)
   - Circular imports or dependency cycles between modules
2. For each violation, generate a refactoring suggestion using an AI agent
   (Claude or similar) explaining: what the violation is, why it's a problem,
   and a concrete plan to fix it (e.g., "Extract X into a dedicated module Y")
3. Post a structured PR review comment that groups violations by severity:
   - BLOCKER: Circular dependencies or files >1000 lines
   - WARNING: Files >500 lines or functions >80 lines
   - INFO: High export count
4. Fail the PR check if any BLOCKER is found; warn but allow merge for lower levels

Use tree-sitter or language-specific AST tools for analysis. Support Python
and Rust as primary languages. Store thresholds in a .architecture.yml config file.

Files to Create

  • .github/workflows/architecture-guardian.md — the workflow markdown file

Acceptance Criteria

  • Workflow triggers on PRs and pushes to main
  • Detects large files, large functions, high export count, and circular dependencies
  • Posts structured review comments grouped by severity (BLOCKER / WARNING / INFO)
  • Fails PR check on BLOCKER violations
  • Thresholds configurable via .architecture.yml
  • Compiled .lock.yml is generated via make recompile
    Related to Blog analysis #25311

Generated by Plan Command for issue #25311 · ● 394.6K ·

  • expires on Apr 10, 2026, 1:57 PM UTC

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions