XibeCode

Agent engine

How the XibeCode agent loop works — iterations, modes, tools, completion, and learning.

Agent engine

XibeCode’s core (xibecode-core) runs an autonomous coding agent: model calls → tool use → file/shell changes → verify → continue until the task is done or you stop it.

Surfaces

SurfaceCommandNotes
One-shot taskxibecode run "…"Non-interactive autonomous run
Task + PRxibecode run-pr "…"Branch + GitHub PR after work
Interactive chatxibecode chat / xcTUI with slash commands
Messagingxibecode gatewayTelegram / Discord / Slack coding sessions
Scheduledxibecode cron + gatewayPeriodic agent jobs
IDE / ACPVS Code extension, ACP stdioSame engine, different hosts

Agent loop

  1. Build context (project files, memory, skills, session history).
  2. Call the LLM with tools (read/write/edit, shell, search, MCP, etc.).
  3. Execute tool calls safely under permission rules.
  4. Feed results back; repeat until:
    • the model finishes with a final answer, or
    • you abort (Ctrl+C, chat cancel, gateway /stop), or
    • a finite iteration cap is hit.

Max iterations (unlimited by default)

ValueBehavior
0 (default)Unlimited — loop until completion or abort
Positive integerHard stop after N model turns
# Unlimited (default)
xibecode run "refactor auth module"

# Cap at 100 turns
xibecode run "…" -d 100

# Profile default
xibecode config  # or setup agent → Max agent iterations = 0

Economy cost mode still applies a separate lower cap (economyMaxIterations) so cheap runs stay bounded.

Anti-runaway: repeated identical tool calls are blocked by the loop detector; you can always interrupt.

Modes

Modes control tool categories and behavior (agent, plan, review, debugger, …). See Modes. Plan and review modes still allow shell where needed for verification.

Tools

File ops, shell, search, web fetch, memory, skills, swarm, MCP tools, and more. See Tools.

Learning & memory

After turns, optional learning loop features:

  • Curated MEMORY.md / USER.md
  • Post-turn review (optional cheap model)
  • Write-approval for sensitive memory/skill writes
  • Session search across past work
  • Skill learner for reusable procedures

See Memory.

Providers & models

Any catalog entry from Providers. Failover pools improve reliability under rate limits.

Cloud execution

Optional E2B sandbox runtime: shell in the cloud while files stay on host (host_only) or full workspace sync (sandbox_full). See Cloud / E2B.

Best practices

  1. Run xibecode setup once, then xibecode chat for interactive work.
  2. Prefer unlimited iterations for large refactors; use -d N only when you want a hard budget.
  3. Use economy mode for cheap drafts; normal mode for production changes.
  4. For always-on coding from phone/Telegram, install the gateway and use /stop if a run goes wrong.
Ctrl+I
Assistant

How can I help?

Ask me about configuration, installation, or specific features.