بنقرة واحدة
tgtool
// Use when the user wants the agent to choose, combine, and actively use the best available local skills for a task.
// Use when the user wants the agent to choose, combine, and actively use the best available local skills for a task.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Use when the user explicitly wants multiple Codex agents or a virtual team, the work can be decomposed into safe parallel roles, and tgtool should coordinate a Ruflo-backed orchestration path.
Use when operating jstorcli with yatc and jetice/jetlake workflows, especially for VM lifecycle, image prep, deployment checks, and command lookup without hardcoded paths.
Rebuild and run the local bucketmanager final image, then execute the current S3Control bitmap-based end-to-end workflow for minimal validation or 300MB memory-peak tests. Use when testing local multi-s3gw S3Control parent/child jobs in this repository.
Use claude-mem from Codex via a Codex-specific wrapper, MCP registration, and ~/.codex-backed data paths.
Build, debug, and review Linux FUSE filesystems with the official libfuse userspace library. Use when implementing a FUSE filesystem, choosing between libfuse high-level vs low-level APIs, wiring callbacks, building with fuse3/pkg-config, mounting for local testing, or troubleshooting fusermount3 and permission issues.
| name | tgtool |
| description | Use when the user wants the agent to choose, combine, and actively use the best available local skills for a task. |
| metadata | {"author":"codex","version":"2.22.0"} |
Use this skill as the top-level router for local Codex skills.
Its job is to pick the smallest useful skill set, avoid redundant loading, and move directly into execution.
Route in layers:
The goal is not to use more skills. The goal is to use fewer, better.
Default mode is lazy.
lazy (default)
skills/tgtool/skills-index.json firstskill_id, summary, tags, triggers)SKILL.md files when neededfull (fallback)
Override switch:
TGTOOL_CONTEXT_MODE=lazy|fulllazyWhen the user explicitly invokes tgtool, ask for mode immediately unless the user already specified one in the same turn.
Use:
Choose a tgtool mode: review (1/re), standard (2/st), or autopilot (3/auto).
review
standard
autopilot
Accept these mode aliases:
review: 1, re, reviewstandard: 2, st, standardautopilot: 3, auto, autopilotAfter the user explicitly invokes tgtool once, keep tgtool active across subsequent turns by default.
Rules:
tgtool as the start of a persistent routed session.tgtool even if the user does not explicitly mention it again.tgend.tgend, stop applying tgtool by default from the next turn onward unless they explicitly invoke it again.tgtool invocation.Keep tgtool visible without repeating the same boilerplate every turn.
Rules:
仍在 tgtool/autopilot instead of repeating the full termination sentencetgend only at session start, after a long gap, when the user seems uncertain whether tgtool is still active, or near task closeoutIf the user explicitly says any equivalent of readonly, 只读, 不要修改, 不要动环境, 绝对谨慎, or otherwise makes a strong no-write request, enable strict read-only mode immediately.
Rules while strict read-only mode is active:
Strict read-only mode stays active until the user explicitly relaxes it.
Default posture: aggressively proactive for coding and debugging tasks.
The router should move forward end-to-end whenever the path is technically obvious and low-risk. It should stop only when continued execution would create irreversible damage, introduce product-level ambiguity, affect shared environments without approval, or require elevated privileges.
When in doubt between asking and progressing, prefer progressing if the action is local, reversible, and does not cross a shared-environment or business-semantics boundary.
The agent should proceed without asking for confirmation when the action is local, reversible, and part of the shortest path to completion.
Examples:
The agent should still proceed, but must tell the user what it is about to do in one short sentence before acting.
Examples:
Preferred pattern:
When the next action touches a remote machine, shared container, shared config, shared data set, or other non-local environment, classify it before acting:
只读可做需确认后可做禁止默认执行When the classification affects the next step, state it in one short line instead of using a long warning template.
The agent must pause for confirmation when any of these are true:
Examples:
git reset --hard, forced revert, or overwriting unrelated workFor debugging, default to read-only diagnosis first.
The agent should:
The agent must not:
For remote debugging, keep a compact evidence ledger as the work proceeds.
Record only the minimum useful facts:
Prefer updating one compact running record over scattering unsupported conclusions across many replies.
For long sessions, emit a compact evidence summary only when the topic shifts or the work is about to be summarized.
Use at most four lines:
For coding tasks, default to the smallest closed loop:
The agent should proactively add:
The agent should not proactively add:
Before routing, compress the current task into a tiny working snapshot and keep reusing it.
Include only:
Reuse this snapshot before re-reading files, skills, or prior context. Update it only when the facts change.
Apply this flow in order.
When tgtool needs to use any skill/tool (whether user-specified or internally selected), resolve that target first.
For skills, resolve in this strict order:
If a skill is present locally but not enabled:
tools/skill_temp_toggle.py on <skill_id> to temporarily enable ittools/skill_temp_toggle.py reset to roll back only skills that were previously disabledTemporary-toggle guardrails:
If the target skill/tool cannot be resolved immediately:
find-skills, then tool_search)Approval rule:
standard and review: always wait for explicit user approval before fallback executionautopilot: missing skill/tool still requires explicit user approval before fallback executionDo not silently switch to a different skill/tool when the intended one was not found. Do not treat "present locally but not enabled" as "not found".
Do not over-route.
Use the lowest evidence level that is safe.
L0
L1
skills/tgtool/skills-index.jsonL2
Default to L0 or L1. Escalate to L2 only when it materially improves correctness.
Index-first rule:
lazy mode, never bulk-read all SKILL.md files for capability scanning1-3 candidate skill filesBefore any capability scan, check whether the task can be routed immediately with current context.
Use the fast path when one or more of these are true:
Development-task override:
superpowers workflow family by default.If the fast path is sufficient, skip $tool-advisor and proceed directly to workflow selection.
$tool-advisor first by defaultDefault preference:
Priority rule:
fast-path and $tool-advisor default preference conflict, prefer fast-path$tool-advisor$tool-advisor just for formalityUse $tool-advisor unless the user explicitly forbids it or the path is already obvious.
Use it to answer:
Do not use $tool-advisor as an excuse to reload everything. Use it to reduce uncertainty.
Lazy interaction rule:
tool-advisor confirms capability surfaceChoose exactly one unless the task clearly moves across phases.
Prefer installed superpowers workflow skills when they are a better fit than $stream-coding.
Development-task default:
For implementation work, prefer the superpowers workflow family over direct execution.
If the user explicitly asks for multiple Codex agents, a virtual team, or parallel agent execution, evaluate the multi-codex-orchestration skill before ordinary single-session development routing.
When tgtool routes a task into superpowers, let superpowers choose and control its own internal development process.
Do not hard-code a fixed internal sequence such as brainstorming -> writing-plans -> executing-plans inside tgtool.
Keep tgtool responsible for global rules, mode behavior, visibility, boundaries, and support-skill selection while superpowers owns the development workflow once selected.
Use $stream-coding directly only when no superpowers workflow skill fits better, or when the change is extremely small, unambiguous, and low-risk.
Do not route code-changing work straight into $stream-coding unless one of those narrow exceptions is true.
Use using-superpowers
superpowers workflow family and its internal workflow should be delegated to superpowers instead of being prescribed by tgtoolUse brainstorming, writing-plans, or executing-plans directly only when the user explicitly asks for one of them, or when another active instruction already makes that specific entry point mandatory.
Use $stream-coding
Scenario-specific route:
multi-codex-orchestrationruflo backend or asks to initialize the orchestration runtime, first use skills/multi-codex-orchestration/scripts/bootstrap_ruflo_backend.py to automatically chain ruflo init --codex, ruflo init --minimal --force, and ruflo swarm init --v3-mode as neededruflo bootstrap succeeds, prefer the current session's claude_flow orchestration tool family for actual execution: initialize a swarm, spawn agents, create tasks, assign tasks, and monitor status there instead of stopping at CLI bootstrapskills/multi-codex-orchestration/scripts/probe_ruflo_execution.py only as a shell-side sanity check that the local ruflo CLI path can create a swarm, spawn an agent, create a task, and assign it; do not mistake that probe for the main in-session execution pathoperator; keep critic dormant and wake it only on failure, stage transition, or explicit review/feedback demand2 pane only (operator + critic) unless the user explicitly asks for more panesskills/multi-codex-orchestration/scripts/launch_explicit_tmux.py and treat “explicit” as auto-trying to pop a foreground tmux terminal, not requiring manual attach firstsubagent-driven-development, dispatching-parallel-agents, then ordinary using-superpowers routingWorkflow boundary rule:
superpowers workflow family, do not prescribe its internal fallback or forward transitions from tgtool; let superpowers manage that flow.$stream-coding as a separate default execution workflow only when no superpowers workflow skill clearly fits, not as the default internal fallback once superpowers has been chosen.These are optional support layers, not defaults.
claude-memUse when:
Do not use for short, self-contained tasks where current-session context is already sufficient.
When deciding whether to write or update memory, prefer high-value knowledge only.
Treat information as high-value when one or more of these are true:
Do not write low-value memory for:
When new verified information supersedes older memory, prefer updating the existing understanding instead of storing a conflicting duplicate.
planning-with-filesUse when:
task_plan.md, findings.md, and progress.md in the project rootDo not use when:
Use it as a support layer, not a replacement workflow:
superpowers own the development flow when superpowers is selectedplanning-with-files only when disk-backed plan, findings, and progress tracking would materially improve execution or recoveryplanning-with-files the default primary workflow for ordinary coding tasksjstorcli-yatc-jetice-opsUse when:
jstorcli workflows with yatc, jetice, or jetlakeDo not use when:
jstorcli or those environmentsUse it as a domain support layer:
jstorcli-yatc-jetice-ops only when those operations are actually in scopeexaUse when:
Do not use for purely local code or repository work when the answer is already in the workspace.
find-skillsUse when:
Use find-skills only when at least one of these harder conditions is true:
Do not use when the current installed skills already clearly cover the task.
If the intended skill was not found (user-specified or internally selected by tgtool):
find-skills immediatelyfind-skills only after approvalPrefer direct handling instead of find-skills when one or more of these are true:
After routing, open only the selected skill files and follow them.
Do not browse every skill body. Do not reload the same skill unless something changed or verification is required.
If tgtool auto-enabled any local skill for this task:
When inputs are large, old, or repetitive:
Use this fixed compression flow:
If a task is long-running:
claude-mem only if the added recall value is realContinuously estimate whether the current session context is becoming bloated.
Primary trigger uses context-window percentage when available:
70%: issue an early warning and recommend preparing handoff85%: start Phase A preview handoff suggestion92%: recommend immediate Phase B final handoff and session switchExplicit invocation hook:
$tgtool in a turn, run skills/tgtool/scripts/context_guard.js once before deeper routingnode skills/tgtool/scripts/context_guard.js --input-text "<current turn text>"estimated_context_pct as the percentage source for the 70/85/92 threshold logic in this sectionWhen a threshold is reached:
If user agrees to restart handoff, run in two phases:
summary + compact evidencedocs/session-handoffs/YYYY-MM-DD-<topic>.mdHandoff pack must include:
Session switch boundary:
At natural completion points, briefly evaluate whether memory should be written or updated.
Use this rule:
When deciding between updating prior memory and writing a new memory:
Priority of trust:
If the new result does not beat the old one on that scale, do not treat it as an authoritative update.
When reporting routing decisions, be concise but auditable.
Required:
Optional when helpful:
Examples:
claude-memfind-skillsDo not enumerate every rejected skill. Mention only the most plausible skipped candidate when it improves trust in the routing choice.
Required:
Also required in review and standard:
When the persistent tgtool session is active, keep session state visible without fixed boilerplate.
Preferred behavior:
如需结束本轮 tgtool 调用,请回复 tgend。 only when the user may need the reminder, near closeout, or after a long gapExamples:
Using fast-path routing with $stream-coding because the task is a small local code change and the path is already obvious.Using $tool-advisor to confirm available capabilities, $stream-coding as the workflow skill, and $bucketmanager-s3control-e2e for local S3Control validation.Using $tool-advisor first, then brainstorming because the request is still in the design phase.Using $tool-advisor first, then $stream-coding, and adding find-skills because the current installed skills do not clearly cover the requested capability.At the end of a routed task, prefer a very short recap when it adds value.
Use this shape:
find-skills next timeKeep it compact. Use it only when it helps future execution or user understanding.
Use this capability map as an index-first router. Keep routing progressive and minimal.
tgtool: top-level router and mode/state managerusing-superpowers: delegate internal development workflow to superpowerstool-advisor: capability confirmation when uncertainty is realfind-skills: capability-gap discovery/install path after explicit fallback approvalbrainstormingwriting-plansexecuting-planssubagent-driven-developmentdispatching-parallel-agentssystematic-debuggingtest-driven-developmentverification-before-completionrequesting-code-reviewreceiving-code-reviewfinishing-a-development-branchusing-git-worktreesplanning-with-filesstream-codingMemory and docs:
claude-mem-codexopenai-docswriting-skillsEnvironment/domain operations:
jstorcli-yatc-jetice-opsbucketmanager-s3control-e2emulti-codex-orchestrationAWS domain pack:
api-gateway, bedrock, cloudformation, cloudwatch, cognitodynamodb, ec2, ecs, eks, eventbridgeiam, lambda, rds, s3, secrets-manager, sns, sqs, step-functionsSpecialized systems:
fuseLayer progression rule:
L0 and select one primary workflow path.L1 workflow skills for the current phase.L2 domain/memory skills only when they materially improve correctness.L2 domain routing when L0/L1 already cover the task.These are defaults and examples, not mandatory routes.
tool-advisor + $stream-codingsuperpowers workflow family first, with internal development flow delegated to using-superpowers instead of hard-coded here$stream-coding development exception:
superpowers workflow skill fits bettertool-advisor + using-superpowers, unless a specific superpowers entry skill was explicitly requestedtool-advisor + claude-memusing-superpowers + multi-codex-orchestration when the user explicitly wants multiple Codex agents and the task can be split into safe parallel roles; explicit ruflo backend requests should run bootstrap_ruflo_backend.py first and then execute real orchestration through the current session's claude_flow swarm/agent/task toolsusing-superpowers + planning-with-files when disk-backed planning, findings, and progress tracking would materially helptool-advisorjstorcli-yatc-jetice-ops as a domain support layer when those environment-specific operations are in scopetool-advisor + using-superpowers, unless a specific design skill was explicitly requestedtool-advisor or direct trigger + exatool-advisor + find-skillssuperpowers workflow family + bucketmanager-s3control-e2e, unless the change is truly tiny or another explicit skill choice overrides itThis skill is the router and activator.
It should:
It should not become a second planning layer that delays work.
Keep the lazy index fresh:
SKILL.mdskills/tgtool/skills-index.json is a routing index, not policy authoritynode skills/tgtool/scripts/build_skills_index.jsUse local estimation when runtime percentage is not directly available to the agent.
Script:
skills/tgtool/scripts/context_guard.jsRecommended call at each tgtool execution turn:
node skills/tgtool/scripts/context_guard.js \
--input-text "<this turn's new user+assistant text>" \
--context-limit 200000 \
--fixed-overhead 2500
Recommended reset after final handoff + new session:
node skills/tgtool/scripts/context_guard.js --reset
Interpretation:
estimated_context_pct > 70: warnestimated_context_pct > 85: previewestimated_context_pct > 92: critical