feat: Allow mods to spawn and await background agents / background work
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par retracer la surface existante de ModApi cmd.exec ainsi que les interfaces entre agent, background-agent et background-shell décrites dans l’issue. Comparez leur comportement avec le TUI Background panel (Ctrl+B) et le mode headless (-p). Le travail est terminé lorsqu’un mod peut lancer une tâche sans bloquer, recevoir son résultat final à l’achèvement, l’exposer dans le background panel et se dégrader de manière déterministe en mode headless.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Feature Description
Summary
Mods currently have no way to run work in the background. The agent tool (with run_in_background: true), background agents (background: true), and background shell tasks are all seams the main agent drives — none are reachable from a mod. Mods only have cmd.exec (foreground shell) and the synchronous onStop + prepareNextTurn force-continue seam for post-run model turns.
Motivation
Post-run maintenance work — summarization, extraction, knowledge discovery, compaction — is exactly the kind of task that should run detached from the main loop, on a cheap model, without blocking or polluting the session. Today a mod that wants a model to do post-run work must inject a continuation turn (onStop with {continue: true}) that runs in-line: it occupies the same run, renders in the feed, and competes with sibling mods over the single continuation slot (harness short-circuits "any mod returning continue wins").
Alternatives considered
- Keep the onStop continuation seam and just make the injected turn quieter. Doesn't solve the collision problem (one continuation slot shared by all
mods) or the "detached from the run" goal. - Background shell + cmd.events polling. Mods could shell out to cmd -p via a background process, but there's no background cmd.exec, and reacting to
completion would require polling from a hook — no clean completion signal.
Acceptance criteria
- A mod can launch a background agent and continue the session without blocking.
- The spawning mod is notified (hook or event) when the agent completes, with the agent's final result.
- The behavior is observable in the TUI Background panel (Ctrl+B) like other background work.
- Works headless (-p), degrading deterministically.
Use Case
Mods am building or trying out that could use background running
-
Memory/journal mods that extract compressed episodes or discover durable facts from a finished run (e.g. the project-brain / task-journal pattern).
-
Any mod wanting to fan out parallel investigation or run a long background process and react when it completes.
Current gap -
No cmd.agent(...) / cmd.spawnAgent(...) equivalent on ModApi — a mod cannot launch the built-in agent tool or a custom agent.
-
No background variant of cmd.exec (no way to get a task id + log + wake-up like shell_command run_in_background / monitor_command).
-
No hook or event a mod can register to be notified when a background agent it spawned finishes (the result of agent_output never reaches a mod).
Proposed API (suggestion — open to design)
Something like:
- cmd.agent({prompt, agent?, model?, runInBackground: true}) → Promise<{agentId}> — spawn a background agent from a mod.
- A completion hook or event, e.g. cmd.hooks({onAgentResult}) or cmd.events.on('agent_completed', ...), delivering the agent's final result to the
spawning mod. - Optionally: a background cmd.exec variant returning a task id + on-disk log, mirroring shell_command run_in_background.
Additional Context
- Sort of how taste learning works to be honest
How important is this to you?
Medium. Nice mod improvements for UX, but right now these are experiments and sync running is ok.
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 4k
- Forks
- 350
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de CommandCodeAI/command-code
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#855 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
CommandCodeAI/command-code#841 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#655 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#608 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
CommandCodeAI/command-code#893 ·
Toutes les issues de CommandCodeAI/command-code
Issues similaires
-
bug priority:normal ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
OpenHands/extensions#626 · 1 commentaire ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
avniproject/avni-client#2135 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
use-agent-os/agent-os#3276 ·