Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ brief instead of spawning a native subagent. The worker starts with a clean
context, so nothing leaks between it and the main conversation, and only its
final report comes back. The main agent keeps design decisions and final review.

- **Any model per task:** pick a profile by its `use_for` hint, then override the
model, reasoning effort or fast mode for one run (`-m`, `-effort`, `-fast`).
- **Default profile first:** new runs inherit `OFFLOAD_PROFILE` or the configured
default; explicit per-run overrides remain available when requested or required.
- **Two backends:** Codex CLI and Claude Code with Anthropic-compatible gateways.
- **Named profiles:** a model, provider or managed Codex account, with an optional hint about which tasks it suits.
- **Persistent sessions:** resume related work and inspect previous reports.
Expand Down Expand Up @@ -82,9 +82,9 @@ backup. Only Codex's file credential store is supported (verified with Codex CLI
0.167.0). Sharing the file does not serialize concurrent network token refreshes;
avoid refreshing the same account concurrently in multiple clients.

The [agent skill](skills/offload/SKILL.md) explains random account selection and
bounded failover on quota errors. This selection happens in the supervising
agent; a CLI call without `-p` still uses the configured default.
The [agent skill](skills/offload/SKILL.md) tells supervising agents to omit `-p`
and use the active default. Compatible account fallbacks are used only when the
user requests or authorizes them; quota errors never trigger silent rotation.
[Account setup and routing details →](docs/guide.md#managed-codex-accounts)

## Agent integration
Expand Down
16 changes: 8 additions & 8 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ OFFLOAD_PROFILE=deepseek offload -d /absolute/path/app "Find retry entry points,

#### Disable or delete a profile

Disable a profile to keep it but stop every use of it. A disabled profile is skipped for default and pool selection, reports `"disabled": true` and `"available": false` in `offload profiles --json`, and any run on it fails before a worker starts, including `-p`, `OFFLOAD_PROFILE`, resumes and scheduled runs. The configured default cannot be disabled; choose another default first.
Disable a profile to keep it but stop every use of it. A disabled profile is skipped for default selection, reports `"disabled": true` and `"available": false` in `offload profiles --json`, and any run on it fails before a worker starts, including `-p`, `OFFLOAD_PROFILE`, resumes and scheduled runs. The configured default cannot be disabled; choose another default first.

```sh
offload profile disable codex-old
Expand All @@ -108,7 +108,7 @@ offload profile delete codex-old --account # also remove its managed Codex acc

`-m` overrides the selected profile's model for that run. `-effort <level>` overrides its reasoning effort (`low`, `medium`, `high`, `xhigh`, `max`; Codex also accepts `ultra`). On Codex profiles, `-fast` selects the priority service tier and `-fast=false` the default tier; Claude profiles reject `-fast`. Overrides apply to that run only, including a resume, and never change the saved profile.

A profile may carry an optional `use_for` hint (up to 300 characters, one line), such as "frontend/UI work" or "bulk log reading". `offload profiles --json` returns it so agents can choose a profile by task, the way they would choose a subagent's model. Set it in the macOS profile editor or with `offload profile save --json`:
A profile may carry optional descriptive `use_for` metadata (up to 300 characters, one line), such as "frontend/UI work" or "bulk log reading". `offload profiles --json` returns it for user context, but installed agent guidance does not let it override a usable active default. Set it in the macOS profile editor or with `offload profile save --json`:

```sh
offload profile save --json <<'JSON'
Expand Down Expand Up @@ -206,7 +206,7 @@ Codex's current skill locations are documented in [Build skills](https://learn.c

### Main agent and subagent workflow

The installed policy positions offload as the replacement for native subagents: for any clearly specified task that does not need the conversation, the main agent runs offload with a self-contained brief instead of spawning a subagent, picks the profile by its `use_for` hint, and overrides model, effort or fast mode per run. A native subagent remains only for work that needs the forked conversation or host-only tools (browser, MCP or app tools), and as the Codex result waiter. The policy also asks main agents and native subagents to actually invoke offload before doing substantial bounded supporting work themselves, according to the active delegation mode. In **proactive** mode this includes bounded implementation once the design is decided; in **basic** mode it mainly covers research, localization, summaries, and bounded mechanical edits, without proactively handing off a whole feature's implementation. In both modes, the main agent owns requirements, architecture/design, tradeoffs, task decomposition, and final review/acceptance. If a worker finds the design, scope, or architecture needs to change, it reports findings/options back instead of redesigning on its own. Call the CLI directly and avoid duplicating work an active worker is already doing. Run parallel slices as several background offload runs, and an independent review on a different profile. When a native subagent is still used, it can launch the external worker:
The installed policy positions offload as the replacement for native subagents: for any clearly specified task that does not need the conversation, the main agent runs offload with a self-contained brief instead of spawning a subagent. New runs normally omit profile/model/effort/tier flags and inherit `OFFLOAD_PROFILE` or the configured default; `use_for` is descriptive only. Overrides require an explicit user request, concrete task incompatibility, or verified default failure with an authorized compatible fallback, and the agent states the reason. It never randomly rotates accounts, silently changes provider/model, or automatically enables or edits an unavailable default. A native subagent remains only for work that needs the forked conversation or host-only tools (browser, MCP or app tools), and as the Codex result waiter. The policy also asks main agents and native subagents to actually invoke offload before doing substantial bounded supporting work themselves, according to the active delegation mode. In **proactive** mode this includes bounded implementation once the design is decided; in **basic** mode it mainly covers research, localization, summaries, and bounded mechanical edits, without proactively handing off a whole feature's implementation. In both modes, the main agent owns requirements, architecture/design, tradeoffs, task decomposition, and final review/acceptance. If a worker finds the design, scope, or architecture needs to change, it reports findings/options back instead of redesigning on its own. Call the CLI directly and avoid duplicating work an active worker is already doing. Run parallel slices as several background offload runs. Independent review starts a fresh session on the default; a different profile/model is used only when explicitly requested or concretely required. When a native subagent is still used, it can launch the external worker:

```text
Main agent → optional native subagent → offload → selected Claude/Codex profile
Expand Down Expand Up @@ -930,11 +930,11 @@ sign-in when both the original installation and offload will remain active.
Profiles with no account selection continue to use the system Codex account.
Managed runs isolate authentication, session/model lookup and usage accounting.
Resume keeps the recorded account and home even after profile edits. This
version provides explicit account selection. The bundled agent skill also explains
how an agent can choose a random compatible account when none is specified and
try another account on confirmed quota/capacity failures. Selection and bounded
failover are performed by the supervising agent using `-p`; the CLI itself still
uses the configured default when `-p` is omitted. Resumes stay bound to their
version provides explicit account selection. The bundled agent skill tells agents
to omit `-p` when no account is specified, so `OFFLOAD_PROFILE` or the configured
default remains authoritative. A compatible fallback account is selected only
when the user requests or authorizes it after a concrete incompatibility or verified
failure; there is no random or proactive rotation. Resumes stay bound to their
original account, so switching accounts starts a new session and must account for
any partial effects. Managed homes start with Codex defaults and do not copy the system
home's skills, MCP configuration or other settings.
Expand Down
6 changes: 3 additions & 3 deletions internal/agentinstall/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const offloadAgentPolicy = offloadPolicyBegin + `
` + offloadPolicyEnd

// subagentPolicy positions offload as the replacement for native subagents in both modes.
const subagentPolicy = `- Use offload in place of a native subagent for any clearly specified task that does not need your conversation: research, localization, review, implementation slices, checks. The worker starts with a clean context, so nothing from your conversation leaks in or out, and you choose its model per task. Parallel work means several background offload runs; an independent review means an offload run on another profile. Keep a native subagent only when the task needs your forked conversation, needs host-only tools the worker lacks (browser, MCP or app tools), or is the Codex result waiter.
- Choose the worker like a subagent: read offload profiles --json, skip profiles that are unavailable or disabled, pick the one whose use_for hint fits the task (else the configured default), and override per run with -m <model>, -effort <level> and, on Codex profiles only, -fast or -fast=false. Overrides affect only that run and never change the saved profile. Do not invent profile names.`
const subagentPolicy = `- Use offload in place of a native subagent for any clearly specified task that does not need your conversation: research, localization, review, implementation slices, checks. The worker starts with a clean context, so nothing from your conversation leaks in or out. Parallel work means several background offload runs. Independent review starts a fresh session on the active default; use a different profile/model only when explicitly requested or concretely required for independence, and state why. Keep a native subagent only when the task needs your forked conversation, needs host-only tools the worker lacks (browser, MCP or app tools), or is the Codex result waiter.
- For new runs, normally omit -p, -m, -effort and -fast so offload inherits an explicit OFFLOAD_PROFILE or the configured default and its settings. The use_for field is descriptive metadata and must not override a usable default. Never randomly choose or proactively rotate profiles/accounts, and never silently change provider, model, effort or tier. Override only for an explicit user request, a concrete task incompatibility, or a verified default failure with a user-authorized compatible fallback; explain the reason. If the default is unavailable or disabled, report the concrete failure instead of testing, enabling, editing or replacing it automatically. Do not invent profile names.`

// sessionReusePolicy is shared by both modes so the installed workflow stays identical.
const sessionReusePolicy = `- Reuse one worker session for related work: investigation, implementation, and review corrections of the same task or slice should use offload -r <session> (it keeps the original profile and directory). Each follow-up still states the current corrections and acceptance criteria, because backend compaction means history is not unlimited or verbatim. Start a new session for unrelated tasks, a different directory or profile, or stale context; do not reuse one session for every task. Never send overlapping runs to one session. Inspect an interrupted run (offload show <session>, git diff) before continuing, and keep its partial edits. If the session's profile no longer exists, restore it or start a new session with -p; offload never switches providers silently.
const sessionReusePolicy = `- Reuse one worker session for related work: investigation, implementation, and review corrections of the same task or slice should use offload -r <session> without selection overrides (it keeps the original profile/account and directory). Each follow-up still states the current corrections and acceptance criteria, because backend compaction means history is not unlimited or verbatim. Start a new session for unrelated tasks, a different explicitly requested/required profile, or stale context; do not reuse one session for every task. Never send overlapping runs to one session. Inspect an interrupted run (offload show <session>, git diff) before continuing, and keep its partial edits. If the session's profile no longer exists, restore it or start a user-authorized new session with -p; offload never switches providers silently.
- Dispatch is parallel work: the offload command blocks until its worker ends, so start it in the background and keep doing independent work (not the worker's files, not anything that needs its result) instead of waiting; collect its exit status and report before relying on it. In Claude Code, Bash run_in_background notifies you when it exits. In Codex, start the run inside a waiter subagent (spawn_agent, fork_turns "none", cheapest model, low effort; it cannot reach a run you started yourself) that keeps the exec session_id, waits on it with 30-second waits, never guesses an id or relaunches, recovers a lost handle with offload status and offload show, and returns stdout verbatim; its final answer arrives automatically at your next tool call, so call wait_agent only when nothing independent is left.
- Cut parent polling: run long workers in the background and wait with offload watch -t <long bound, e.g. 10m> under the host's completion or monitor facility, rather than repeated short status checks; without one, use a few long bounded waits. STALLED, LOST, timeout, and failures still surface, and waiting must not open or control the user's desktop. Delegate a coherent slice and then inspect targeted evidence or diffs and run scoped checks instead of repeating the worker's investigation. Ask for compact reports (outcome, changed files or key references, checks, unresolved issues); offload show has the full history.`

Expand Down
21 changes: 21 additions & 0 deletions internal/agentinstall/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,24 @@ func TestSessionReuseWorkflowAgreesAcrossPolicySkillAndGuide(t *testing.T) {
t.Error("both modes must carry the shared session reuse policy")
}
}

func TestDefaultProfileFirstGuidanceAcrossModesAndEmbeddedSkill(t *testing.T) {
docs := map[string]string{
"skill": string(skills.Offload),
"policy-basic": policyForMode(config.ModeBasic),
"policy-proactive": policyForMode(config.ModeProactive),
}
for name, doc := range docs {
doc = strings.ReplaceAll(doc, "`", "")
for _, want := range []string{"omit -p", "OFFLOAD_PROFILE", "configured default", "use_for", "descriptive", "explicit user request", "concrete task incompatibility", "verified default failure", "user-authorized compatible fallback", "Never randomly", "never silently change", "unavailable or disabled", "without selection overrides", "original profile/account"} {
if !strings.Contains(doc, want) {
t.Errorf("%s missing default-first boundary %q", name, want)
}
}
for _, forbidden := range []string{"pick the one whose use_for", "agent-selected random", "may randomly choose", "shuffled order", "independent review means an offload run on another profile"} {
if strings.Contains(doc, forbidden) {
t.Errorf("%s contains obsolete profile-selection guidance %q", name, forbidden)
}
}
}
}
Loading
Loading