Skip to content

punk-supervisor: agents ignore file structure instructions, dump everything in main.rs #9

@t3chn

Description

@t3chn

Problem

When task prompt explicitly says "Create src/db.rs", "Create src/cli.rs", "Create src/init.rs", the agent instead puts everything as inline mod db {}, mod cli {}, mod init {} inside main.rs. Result: 521-line monolith instead of modular files.

Context

Prompt said:

Create src/db.rs: pub fn init_db(...)
Create src/cli.rs for the clap types
Create src/init.rs: pub fn run_init(...)

Agent produced:

// main.rs (521 lines)
mod db { ... }      // inline, not separate file
mod cli { ... }     // inline, not separate file  
mod init { ... }    // inline, not separate file
fn main() { ... }

Possible Causes

  1. Agent found it easier to keep everything in one file (fewer tool calls)
  2. No CLAUDE.md instruction enforcing file-per-module convention
  3. No post-dispatch validation checking that requested files were actually created

Proposal

Add optional expected_files field to task.json for post-completion validation:

{
  "expected_files": ["src/db.rs", "src/cli.rs", "src/init.rs", "src/schema.sql"],
  "prompt": "..."
}

If expected files are missing after agent completes, log warning and optionally retry.

Workaround

Stronger prompt: "You MUST create separate files. Do NOT use inline modules." Or refactor manually after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions