| name | code-mode |
| description | Runs lightweight tmux-backed REPL workflows so agents can execute code and engineer context without bloating prompt history. |
code-mode
Use this skill when a task is better solved by iterative code execution in a live
REPL than by stuffing intermediate data into chat context.
The core idea is intentionally simple: tmux provides a persistent runtime shell,
and the agent drives it with bash.
Contents
Core contract
-
Use persistent runtime state, not prompt state
- Keep working data in REPL variables, files, and process memory.
- Only return compact summaries/artifacts to chat.
-
One session per task scope
- Reuse the same tmux session while solving one problem.
- Use distinct session names for unrelated tasks to avoid state bleed.
-
Bounded command passes
- Send one coherent code block per pass.
- Capture output, summarize, decide next pass.
-
On-demand discovery
- Ask runtime for definitions/help only when needed (
help(...), dir(...),
.help, etc.) instead of loading everything up front.
-
No extra harness required
- Trusted local workflows can stay minimal:
tmux + bash + REPL.
tmux skill dependency
Before mutating tmux session state, load tmux and follow its canonical
session lifecycle and bounded pass protocol.
- Treat
tmux as source-of-truth for create/reuse, capture, fan-out, and teardown.
- This
code-mode skill defines REPL/context-engineering behavior only.
Minimal tmux execution loop
Follow the Bounded execution protocol in the tmux skill to create
sessions, run commands with a completion marker, and capture output.
Example session creation for a REPL:
session="mu-code-py"
tmux has-session -t "$session" 2>/dev/null || tmux new-session -d -s "$session" "python3 -q"
Then send your REPL commands and the marker, according to the tmux skill.
Teardown the session when finished.
Context engineering contract
Use the runtime to compress context before speaking:
- Load raw data into files/variables.
- Execute code that filters, slices, or aggregates.
- Persist useful artifacts (
summary.json, notes.md, results.csv).
- Report only:
- key findings,
- confidence/limits,
- artifact paths and next action.
Practical rules:
- Prefer computed summaries over pasted raw logs.
- Keep long transcripts in files; cite paths.
- Recompute when uncertain instead of guessing from stale text.
Language-specific quick starts
Python:
tmux new-session -d -s mu-code-py "python3 -q"
Node:
tmux new-session -d -s mu-code-node "node"
SQLite:
tmux new-session -d -s mu-code-sql "sqlite3 data.db"
Shell-only REPL (for pipelines/tools):
tmux new-session -d -s mu-code-sh "bash --noprofile --norc -i"
Integration with other mu skills
- Use with
planning when a plan step needs exploratory coding.
- Use with
protocol/execution by assigning one tmux session per worker.
- Use with
control-flow for explicit retry/termination policy around code passes.
- Use with
heartbeats/crons when bounded code passes should run on schedule.
Evaluation scenarios
-
Exploratory data pass
- Setup: large raw text/log corpus.
- Expected: agent uses REPL transforms to produce concise findings + artifact path,
without dumping full corpus into chat.
-
Multi-pass debugging
- Setup: bug reproduction requires iterative commands.
- Expected: same tmux session is reused across passes; state continuity reduces
repeated setup and prompt churn.
-
Language swap with same control pattern
- Setup: compare Python and Node approaches.
- Expected: same tmux send/capture loop works across both REPLs with only session
bootstrap command changed.