~15 min read

Vibe Coding with the Agent

Generate and edit code, workflows, and configs through natural language — then refine until it's right.

~15 minIntermediateYou'll build: A custom ComfyUI workflow JSON and a modified .thumper.yaml, both created via natural language

1. What Is Vibe Coding?

Vibe coding is a workflow where you describe what you want in plain English, the agent generates or edits the code, you review it in the built-in editor, and refine with feedback. Think of it as a conversation that produces code.

1

Describe

Tell the agent what you want in natural language

2

Generate

Agent reads context, writes or edits files

3

Refine

Review in the editor, give feedback, repeat

This works for: Python, YAML, JSON, TOML, Bash, Rust, JavaScript, TypeScript, ComfyUI workflow JSON, .thumper.yaml manifests, and .model.yaml/.pack.yaml files.

How it differs from traditional coding: you describe the outcome, not the implementation. The agent reads existing code, understands the structure, and makes targeted changes.

The agent follows platform guidelines: READ before EDIT. It always reads file state before changing anything.

2. Setup

Prerequisites: Thumper-Run installed with at least one app (ComfyUI recommended for this tutorial).

Select the code-helper template from the dropdown at the agent launch screen. This adds a system prompt: "Focus on code-related tasks. Prefer search_code, file_read, file_edit. Show code snippets."

Recommended Models for Code

ModelSizeSpeedCode QualityBest For
qwen3:4b2.4 GBFastGoodQuick edits, JSON, YAML
codellama:7b4 GBMediumVery GoodPython, complex logic
llama3.1:8b4.7 GBMediumGoodBalanced tasks
llama3.1:70b40 GBSlowExcellentLarge refactors, multi-file

You can also attach reference files at launch (image/*, .pdf, .txt, .md, .json, .csv) to give the agent initial context without extra tool calls.

Your model and template choices are persisted via CRDT so they're remembered next time.

3. Describe What You Want

Example 1: Create a ComfyUI Workflow

Type a specific request:

text
Create a ComfyUI API workflow JSON that generates a 1024x1024 image using
the SDXL base checkpoint with 25 KSampler steps, CFG scale 7, euler sampler,
normal scheduler. Include positive and negative CLIP text encode nodes.
Save it to ~/comfyui-workflows/portrait.json

The agent reasons through the node structure it needs, then writes the file:

Thinking: I need to create a valid ComfyUI API format workflow with nodes: CheckpointLoaderSimple, CLIPTextEncode ×2, KSampler, VAEDecode, SaveImage...

[file_write { path: "~/comfyui-workflows/portrait.json" }]

⚡ Awaiting approval...

After you approve, the file appears in the code editor panel:

json
{
"3": {
"class_type": "KSampler",
"inputs": {
"seed": 42,
"steps": 25,
"cfg": 7,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0
}
}
}

Example 2: Edit a .thumper.yaml Manifest

text
Read the ComfyUI .thumper.yaml and add a ROCm platform patch that
sets HSA_OVERRIDE_GFX_VERSION=11.0.0 for AMD gfx1100 GPUs

The agent first reads the file, then makes a targeted edit:

[file_read { path: "~/.local/share/tr-desktop/apps/comfyui/.thumper.yaml" }]

✓ Read 45 lines

[file_edit { old_string: "platform_overrides:", new_string: "platform_overrides:\n amd_gfx1100:\n env:\n HSA_OVERRIDE_GFX_VERSION: '11.0.0'" }]

Example 3: Generate a Python Script

text
Write a Python script that converts all PNG images in a directory to
WebP format using Pillow. Add argparse for input/output directories
and quality setting.

The agent generates a complete script with imports, argument parsing, and error handling:

python
import argparse
from pathlib import Path
from PIL import Image
def convert_images(input_dir, output_dir, quality):
input_path = Path(input_dir)
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
for png in input_path.glob("*.png"):
img = Image.open(png)
img.save(output_path / f"{png.stem}.webp", "webp", quality=quality)

Be specific about file paths — saves a search_files call and ~200 context tokens. The agent has 4096 tokens of context by default.

4. The Code Editor

When the agent creates or edits files, a code editor panel appears on the right (668px width). This is your review workspace.

File Tabs

Each generated file gets its own tab:

  • Active tab — bg-gray-800, pink text
  • Inactive tabs — border outline, gray text
  • Modified indicator — ● dot next to filename
  • Close button — X icon on each tab

Syntax Highlighting

The editor highlights code with a dark theme:

  • Tags/keywords — blue
  • Attributes/functions — green
  • Values/strings — amber
  • Text/identifiers — light gray

Supported languages: Python, YAML, JSON, TOML, Bash, Rust, JavaScript, TypeScript, HTML, CSS, and more.

Diff View

When file_edit modifies an existing file, you see a before/after diff:

  • Green lines — added
  • Red lines — removed

Changes must be approved before they're saved to disk. Think of this as your safety net — a checkpoint you can review before anything changes.

Editor Toolbar

ActionShortcut
IndentTab
DedentShift+Tab
Toggle CommentCtrl+/
FindCtrl+F
Find & ReplaceCtrl+H
Go to LineCtrl+G

The agent operates within the Thumper data directory (~/.local/share/tr-desktop/) and app directories. System files are off-limits.

5. Test & Iterate

The Refinement Loop

  1. Describe what you want (code mode)
  2. Review the generated code in the editor
  3. Tell the agent what to fix (natural language)
  4. Agent reads current state, applies targeted edits
  5. Repeat until satisfied

Example: Iterating on a Workflow

The workflow runs but quality is low

T

Thinking: Low quality → likely not enough steps or missing negative prompt

[file_read] Reading portrait.json...

[file_edit] Increased KSampler steps 25→40, set cfg_scale to 8.5

Add a negative prompt: blurry, low quality, watermark, text

T

[file_edit] Added CLIPTextEncode for negative prompt, connected to KSampler negative input

Now test it

T

[run_command] curl -s -X POST http://localhost:8188/prompt -d @portrait.json

Workflow queued. Check ComfyUI at http://localhost:8188 for results.

Error Recovery

When things go wrong, the agent handles it:

  • Tool fails: Agent sees the error in ToolResult and can retry with different parameters.
  • file_edit fails (old_string not found): Agent re-reads the file with file_read, adjusts old_string to match current content.
  • run_command times out (60s limit): Agent reports the timeout and suggests alternatives.

The agent retries once on malformed output via step_with_retry. If it's stuck after 25 iterations, it stops and explains what went wrong.

6. Advanced Patterns

Multi-File Scaffolding

Ask the agent to create an entire project structure:

"Create a ComfyUI custom node called ThumperResize"

The agent generates __init__.py, resize_node.py, and requirements.txt — each as a separate file_write call with its own editor tab.

Search Then Edit

For bulk changes across files:

"Find all files referencing 'sd_xl_base_1.0.safetensors' and update to 'juggernautXL_v9.safetensors'"

The agent runs search_code to find all matches, then file_edit on each one.

Context Attachment

Attach .json, .yaml, or other reference files at launch to give the agent initial context. This saves tool calls and context tokens.

agent_knowledge.md

Create a persistent knowledge file at ~/.local/share/tr-desktop/agent_knowledge.md (max ~2000 chars). This is loaded at priority 3 into every agent session:

markdown
This project uses ComfyUI with SDXL.
Models are in /data/models/.
Use BF16 on AMD GPUs — never FP16.
Preferred sampler: euler_ancestral.

Filesystem Tools Reference

ToolDescriptionSafetyTimeoutUse Case
file_readRead file contents (offset/limit)Safe10sInspect before editing
file_writeCreate or overwrite a fileConfirm10sNew files, complete rewrites
file_editReplace exact string in fileConfirm10sTargeted patches
search_codeRegex search across projectSafe30sFind patterns, references
list_filesList directory recursivelySafe30sExplore file structure
run_commandExecute shell command (sandboxed)Confirm60sTest, build, validate

Key Takeaways

  • Describe the outcome, not the implementation — let the agent choose the approach
  • Use the code-helper template to narrow the tool set for coding tasks
  • Always review diffs in the editor before approving file changes
  • Iterate with specific feedback — "increase steps to 40" beats "make it better"
  • Use "search then edit" for bulk changes across multiple files
  • Create agent_knowledge.md for persistent project-specific context