@moxxy/mode-default
v0.30.0
Published
Default loop strategy (mode) for moxxy — a Claude Code-style ReAct tool-use loop. Register it into an @moxxy/core Session to give your agent its turn-by-turn reasoning + tool-calling behaviour.
Maintainers
Readme
@moxxy/mode-default
The default loop strategy (mode) for moxxy — a Claude Code-style ReAct loop: the agent thinks, optionally calls tools, sees the results, and continues until it produces a final answer. It also handles retryable provider errors (e.g. 429s) with backoff.
A "mode" is the turn-by-turn brain of a moxxy Session;
register this one to get sensible default agent behaviour, or author your own
against @moxxy/sdk's defineMode.
Install
npm i @moxxy/core @moxxy/sdk @moxxy/mode-defaultUsage
import { Session, collectTurn, autoAllowResolver } from '@moxxy/core';
import defaultModePlugin from '@moxxy/mode-default';
import openaiPlugin from '@moxxy/plugin-provider-openai';
const session = new Session({ cwd: process.cwd(), permissionResolver: autoAllowResolver });
session.pluginHost.registerStatic(defaultModePlugin); // ← the loop strategy
session.pluginHost.registerStatic(openaiPlugin);
session.providers.setActive('openai', { apiKey: process.env.OPENAI_API_KEY });
const events = await collectTurn(session, 'What is 2+2? Use a tool if you have one.');The mode is selected automatically once registered (it registers as the default).
To run a different strategy, register another mode package and switch with
session.modes.setActive(name).
Exports
default/defaultModePlugin— the moxxy plugin to register.defaultMode— the underlyingMode(if you compose registries yourself).DEFAULT_MODE_NAME— its registered name.
License
MIT
