hive.terminal-tools-job-control
Ce qu’il fait
Cette compétence montre à l'IA comment lancer de longues tâches, comme des compilations ou des déploiements, sans bloquer la conversation. Elle s'adresse aux personnes dont les tâches durent des minutes plutôt que des secondes.
Quand l’utiliser
- ✓Quand une compilation, un déploiement ou un long test va durer plus d'une minute.
- ✓Quand vous voulez suivre un fichier journal ou un serveur de développement pendant que vous travaillez sur autre chose.
- ✓Quand une commande a été passée en arrière-plan et a renvoyé un identifiant de tâche.
Lien du skill
https://github.com/aden-hive/hive/blob/main/core/framework/skills/_preset_skills/terminal-tools-job-control/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Lance toute la suite de tests en arrière-plan et prévenez-moi quand elle sera terminée.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'IA lance la commande comme tâche en arrière-plan, lit ses journaux par morceaux et attend qu'elle se termine. Elle peut aussi lister ou arrêter des tâches grâce à leur identifiant.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Background job control
Background jobs are how you do things that take time without blocking your conversation. Three tools cover the surface: terminal_job_start, terminal_job_logs, terminal_job_manage.
When to use a job
- Builds, deploys, long tests
- Processes you want to monitor (streaming a log file, a dev server)
- Anything that auto-backgrounded from
terminal_exec(you have ajob_id; pivot to this skill's idioms)
For one-shot work expected to finish quickly, terminal_exec is simpler. The auto-promotion mechanic in terminal_exec is your safety net — start with terminal_exec, take over with this skill if needed.
Lifecycle
terminal_job_start(command, ...)
→ { job_id, pid, started_at }
terminal_job_logs(job_id, since_offset=0, max_bytes=64000)
→ { data, offset, next_offset, status: "running"|"exited", exit_code, ... }
# Repeat with since_offset = previous next_offset until status == "exited"
# Or block once with wait_until_exit=True:
terminal_job_logs(job_id, since_offset=N, wait_until_exit=True, wait_timeout_sec=30)
→ blocks server-side until exit or timeout
After exit, the job is retained for inspection (terminal_job_manage(action="list")) until evicted by FIFO (50 most recent exits kept).
Offset bookkeeping — the only rule that matters
The job's output lives in a 4 MB ring buffer per stream. Each call to terminal_job_logs returns:
data— bytes betweensince_offsetandnext_offsetnext_offset— pass this assince_offseton your next calltruncated_bytes_dropped— non-zero when yoursince_offsetwas older than the ring's floor (you fell behind)
Always carry next_offset forward. Don't replay from 0 — that's an offset reset, you'll see the same data twice and miss the part that fell off.
When truncated_bytes_dropped > 0, the buffer evicted N bytes between your last call and now. Treat it as a signal that the job is producing output faster than you're consuming. Either poll more often or accept the gap and read from next_offset going forward.
merge_stderr — interleaved or separate
merge_stderr=False → two streams, request "stdout" or "stderr" by name
merge_stderr=True → one stream ("merged"), order preserved
Pick merge_stderr=True when:
- The job's logs are designed to be read together (most servers, build tools)
- You don't need to distinguish "this was stderr"
Pick merge_stderr=False when:
- stderr is genuinely error-only and stdout is data
- You'll process them differently
Signal escalation
First query the actions implemented on the server's platform:
terminal_job_manage(action="capabilities")
# Returns platform, supported_actions, signals (action → semantics), note.
On POSIX, request signal_int, wait and inspect the job, then use signal_term if needed. signal_term gives the process group up to 2 seconds before forced cleanup; signal_kill forces termination immediately. Cleanup in response to SIGINT/SIGTERM depends on the application.
On Windows, signal_term and signal_kill both forcefully terminate the job process tree. Neither invokes application cleanup handlers. signal_int / Ctrl-C and the other POSIX signals are unsupported and return unsupported_action with the supported actions. If a program has a documented shutdown command on stdin, that can be used before forced termination.
After signaling, check exit with terminal_job_logs(job_id, wait_until_exit=True, wait_timeout_sec=2).
Stdin
terminal_job_manage(action="stdin", job_id=..., data="some input\n")
terminal_job_manage(action="close_stdin", job_id=...)
For tools that read stdin to EOF, close_stdin after writing flushes them. For interactive tools that read line-by-line, just write each line.
Take-over: when terminal_exec auto-backgrounds
When terminal_exec returned auto_backgrounded: true, job_id: <X>, the process is already in the JobManager with its output flowing into the ring buffer. Your transition is seamless:
# Already saw the start of output in terminal_exec's stdout/stderr.
# Pick up reading where the env left off — use the byte count of the
# initial stdout as your since_offset, OR just request tail output:
terminal_job_logs(job_id="job_xxx", tail=True, max_bytes=64000)
Or block until exit and grab everything:
terminal_job_logs(job_id="job_xxx", since_offset=0, wait_until_exit=True, wait_timeout_sec=30)
Hard rules
- **Jobs die when the server restart
Questions fréquentes
Comment l'IA évite-t-elle de manquer des lignes de journal ?
Elle garde un décalage à chaque lecture et ne demande que les nouvelles sorties à partir de ce point.
Peut-elle arrêter une tâche en cours ?
Oui. Un outil de gestion des tâches peut lister les tâches en arrière-plan et les arrêter.
Combien de temps les tâches terminées sont-elles conservées ?
Les 50 tâches terminées les plus récentes sont conservées pour inspection, et les plus anciennes sont supprimées.
Détails
Description originale de l’auteur
Use when launching anything that runs longer than a minute, anything that streams logs, anything you want to keep running while doing other work — or when terminal_exec auto-backgrounded on you and returned a job_id. Teaches the start→poll→wait pattern with terminal_job_logs offset bookkeeping, bounded blocking polls, platform-specific process control via terminal_job_manage capabilities, and the hard rule that jobs die when the terminal-tools server restarts. Read before calling terminal_job_start, or right after terminal_exec auto-backgrounded.
repo: aden-hive/hive
Popularité
- Étoiles GitHub
- 11k
- Position au classement
- #11814
- Licence
- Apache-2.0
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
browser-edge-cases
11kAide votre agent à corriger l'automatisation de navigateur qui échoue sur des sites difficiles comme LinkedIn, X ou les pages très riches en scripts.
hive.browser-automation
11kApprend à votre agent à contrôler votre propre navigateur Chrome avec l'outil hive-browser, en utilisant des captures d'écran et des clics.
hive.colony-progress-tracker
11kAide votre agent à réclamer des tâches et à consigner ses étapes et contrôles dans une base de données partagée, pour suivre le travail au fil de l'eau.
hive.context-preservation
11kAide votre agent à noter les faits clés des longs résultats d'outils dans des notes avant que les anciens détails ne soient retirés de sa mémoire.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.