Skip to main content
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 you deploy, Monk sometimes finds issues in your source code that block a successful deployment. Wrong ports, missing environment variables, broken connection strings, container build problems. Monk doesn’t just report these. It fixes them. Targeted, deployment-focused edits to get your app running.

How It Works

When Monk Edits Code

During deployment, if Monk hits a fixable issue, it tells you what’s wrong and offers to fix it. Example — Wrong Port Configuration:
Monk: I found an issue: Your server listens on port 8080,
      but the Containerfile exposes port 3000.

      I can fix this in server.js. Should I proceed?

You: Yes, fix it

Monk: [Makes targeted change to port configuration]
      Fixed! Server now uses port 3000 to match Containerfile.
Monk shows you a diff before applying anything. You decide what happens next:
  • Approve — Apply the fix
  • Reject — Skip it
  • Revert — Undo after seeing the result
Every edit goes through this review. No changes land without your sign-off. Monk also keeps changes minimal and scoped strictly to deployment — it won’t touch business logic, and it can’t edit secrets or template files. Rollback is always possible.

Types of Fixes

Deployment-related:
  • Port configuration — Aligning server port with Containerfile 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
Containerization:
  • Containerfile 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
Configuration:
  • 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 Won’t Touch

Monk’s code editing is strictly for deployment. It won’t:
  • Add new features to your application
  • Refactor code for better structure
  • Fix business logic bugs
  • Optimize performance (unless it blocks deployment)
  • Modify your application’s core functionality
Use your regular coding tools for application development. Use Monk for deployment fixes.

Files Monk Can Edit

Source Code

  • 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

  • Package files: package.json, requirements.txt, go.mod, Cargo.toml, Gemfile, composer.json
  • Build configs: tsconfig.json, jsconfig.json, pyproject.toml, Makefile, Procfile
  • Container: Containerfile, docker-compose.yml
  • CI/CD: .github/workflows/*.yml, netlify.toml, vercel.json

Off-Limits

  • Monk templatesMANIFEST, *.yaml (use the template editor)
  • Environment files.env, .env.production (security)
  • Lock filespackage-lock.json, yarn.lock, etc. (integrity)
  • Generated filesdist/, build/, target/ directories
  • Binary files — Images, fonts, archives

Example Scenarios

Scenario 1: Port Mismatch

Problem: Containerfile exposes 3000, but Express app listens on 8080. Monk’s fix:
// server.js - BEFORE
const port = 8080;
app.listen(port);

// server.js - AFTER (Monk's fix)
const port = process.env.PORT || 3000;
app.listen(port);
Aligns your code with what the container expects.

Scenario 2: Missing Environment Variable

Problem: App crashes because DATABASE_URL isn’t read from the environment. Monk’s fix:
# config.py - BEFORE
DB_URL = "postgresql://localhost/mydb"

# config.py - AFTER (Monk's fix)
import os
DB_URL = os.environ.get("DATABASE_URL", "postgresql://localhost/mydb")
Now the app works with Monk’s configuration injection.

Scenario 3: Incorrect Connection String

Problem: Hardcoded localhost Redis connection fails in production. Monk’s fix:
// redis.js - BEFORE
const redis = new Redis({ host: 'localhost', port: 6379 });

// redis.js - AFTER (Monk's fix)
const redis = new Redis({
  host: process.env.REDIS_HOST || 'localhost',
  port: parseInt(process.env.REDIS_PORT || '6379')
});
Lets Monk inject the correct Redis connection details.

Scenario 4: Container Build Issue

Problem: Containerfile COPY command fails because the path is wrong. Monk’s fix:
# Containerfile - BEFORE
COPY src/app /app

# Containerfile - AFTER (Monk's fix)
COPY ./src /app/src
Fixes the build error. That’s it.

When Code Editing Happens

During Deployment

Most often, during initial deployment:
deploy this project
Monk may find that the container build fails, the app crashes on startup, or the health check hits the wrong port. Instead of stopping, it proposes fixes.

On Demand

You can ask directly:
fix the container build error
update my code to use environment variables
fix the port configuration for deployment
Monk examines the issue and proposes targeted fixes.

After Failed Deployments

If a deployment fails due to code issues:
Monk: Deployment failed. The API server expects REDIS_URL
      but your code only reads REDIS_HOST and REDIS_PORT.

      I can update your code to read from REDIS_URL instead.
      Should I fix this?

Limitations

This is an alpha feature. It works well for common deployment issues but may not catch every edge case. Best suited for straightforward codebases. Complex fixes may still need human review. Monk errs on the side of caution — if it’s unsure, it asks rather than guessing.
Monk doesn’t generate new features, write application logic, implement business requirements, or create new components. It fixes what’s blocking your deployment. Nothing more.

Autonomous Deployment

See how code editing fits into Monk’s deployment flow.

Configuration & Wiring

How Monk handles environment variables and service connections.