Alpha Feature - Source code editing is currently in alpha. Monk makes
targeted fixes to resolve deployment issues, not general code refactoring.
What It Does
When deploying your application, Monk may discover issues in your source code that prevent successful deployment - wrong ports, missing environment variables, incorrect connection strings, or Dockerfile problems. Instead of just reporting these issues, Monk can fix them directly in your code. Monk makes targeted, deployment-focused code edits to get your application running successfully.How It Works
When Monk Edits Code
During deployment, if Monk encounters fixable issues: Example - Wrong Port Configuration:- Approve - Apply the fix
- Reject - Skip this fix
- Revert - Undo after seeing the result
Types of Fixes Monk Makes
Deployment-related fixes:- Port configuration - Aligning server port with Dockerfile EXPOSE
- Environment variables - Reading from correct env var names
- Connection strings - Fixing database URLs, Redis hosts
- Build commands - Correcting package.json scripts, Makefiles
- Entry points - Fixing main files, startup commands
- Dockerfile issues - EXPOSE directives, CMD/ENTRYPOINT
- Build scripts - Missing build steps, incorrect paths
- Health checks - Adding or fixing health check endpoints
- Dependencies - Critical missing dependencies for deployment
- Config file paths - Fixing paths that work locally but fail in containers
- Static file serving - Correct asset paths for containerized apps
- API endpoints - Environment-aware endpoint configuration
What Monk Does NOT Edit
Monk’s code editing is not for general development. It won’t:- ❌ Add new features to your application
- ❌ Refactor code for better structure
- ❌ Fix business logic bugs
- ❌ Optimize performance (unless deployment-blocking)
- ❌ Modify your application’s core functionality
Files Monk Can Edit
Source Code Files
- JavaScript/TypeScript:
*.ts,*.tsx,*.js,*.jsx,*.mjs,*.cjs - Python:
*.py - Go:
*.go - Java/Kotlin:
*.java,*.kt - Rust:
*.rs - Ruby:
*.rb - PHP:
*.php - C/C++:
*.c,*.cpp,*.h,*.hpp - Shell scripts:
*.sh,*.bash
Build & Configuration Files
- Package files:
package.json,requirements.txt,go.mod,Cargo.toml,Gemfile,composer.json - Build configs:
tsconfig.json,jsconfig.json,pyproject.toml,Makefile,Procfile - Docker:
Dockerfile,docker-compose.yml - CI/CD:
.github/workflows/*.yml,netlify.toml,vercel.json
Files Monk Cannot Edit
- 🚫 Monk templates -
MANIFEST,*.yaml(use template editor instead) - 🚫 Environment files -
.env,.env.production(security) - 🚫 Lock files -
package-lock.json,yarn.lock, etc. (integrity) - 🚫 Generated files -
dist/,build/,target/directories - 🚫 Binary files - Images, fonts, archives
Example Scenarios
Scenario 1: Port Mismatch
Problem: Dockerfile exposes 3000, but Express app listens on 8080 Monk’s fix:Scenario 2: Missing Environment Variable
Problem: App crashes because DATABASE_URL not read from environment Monk’s fix:Scenario 3: Incorrect Connection String
Problem: Hardcoded localhost Redis connection fails in production Monk’s fix:Scenario 4: Dockerfile Build Issue
Problem: Dockerfile COPY command fails because path is wrong Monk’s fix:Approval & Review Process
You Stay in Control
Every code edit goes through review: 1. Monk proposes changes: “I found 3 issues I can fix in your code. Should I proceed?” 2. Monk shows diffs: You see exactly what will change (side-by-side diff in IDE) 3. You decide:- Approve all fixes
- Approve specific fixes
- Reject and handle manually
- Ask Monk to try a different approach
When Code Editing Happens
During Deployment
Most commonly, during initial deployment:- Container build fails due to Dockerfile issue
- App crashes on startup due to config problem
- Health check fails due to wrong port
On Demand
Ask Monk to fix specific deployment problems:After Failed Deployments
If a deployment fails due to code issues:Limitations
Alpha Status
This is an alpha feature:- Works well for common deployment issues
- May not catch all edge cases
- Best for straightforward codebases
- Complex fixes may need human review
Not a Code Generator
Monk does not:- Generate new features
- Write application logic
- Implement business requirements
- Create new components or modules
File Type Restrictions
- Cannot edit template files (use Monk template editor)
- Cannot edit secrets (.env files)
- Cannot modify lock files or generated code
- Focused on source files and build configs
What Makes This Different
Traditional deployment error resolution:- Deploy fails
- Read error logs
- Search for solution
- Edit code manually
- Redeploy
- Repeat if still broken
- Deploy
- Monk detects and diagnoses issue
- Monk proposes fix with diff
- You approve
- Monk applies fix and redeploys
- Success
Safety & Security
How Monk keeps editing safe:- ✅ Diff approval required - You see and approve all changes
- ✅ Minimal changes - Only fixes what’s needed, preserves your code style
- ✅ Revertible - Can undo changes if needed
- ✅ Scoped to deployment - Won’t modify business logic
- ✅ File type restrictions - Cannot edit secrets or templates
- ✅ No arbitrary edits - Only deployment-focused fixes
Best Practices
1. Review All Diffs
Always review what Monk changes:- Check the diff makes sense
- Verify it aligns with your code style
- Ensure no unintended side effects
2. Test After Fixes
After Monk fixes code:- Verify the deployment works
- Test the affected functionality
- Ensure nothing broke
3. Commit Fixed Code
Once deployment succeeds with Monk’s fixes:- Commit the changes to version control
- Document what was fixed and why
- Share with team if relevant
4. Use for Deployment Issues Only
Don’t ask Monk to:- “Refactor this function”
- “Add a new API endpoint”
- “Optimize this algorithm”
Future Enhancements
As the feature matures: Improved detection - Catch more subtle deployment issues Smarter fixes - Context-aware changes that better match your code style Learning - Remember your preferences for future fixes Broader scope - Support more file types and frameworksRelated Features
- Autonomous Deployment - Where code editing fits in deployment
- Containerization - Dockerfile fixes Monk makes
- Configuration & Wiring - Environment variable fixes
- Troubleshooting - Diagnosing issues Monk can fix
- Build & CI/CD - Build script fixes

