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
- Agent found it easier to keep everything in one file (fewer tool calls)
- No CLAUDE.md instruction enforcing file-per-module convention
- 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.
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:
Agent produced:
Possible Causes
Proposal
Add optional
expected_filesfield 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.