Agent skill

Agent Refocusing

by mvschwarz in mvschwarz/openrig

Re-grounds a long-running agent in the current product outcome by running a path-based trace to the root of its topology and work trees.

Apache-2.0Auto-check passedAgent Workflows

Install Agent Refocusing

skills CLI
$ npx skills add mvschwarz/openrig --skill refocusing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mvschwarz/openrig refocusing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mvschwarz/openrig.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/daemon/assets/plugins/openrig-core/skills/refocusing .claude/skills/refocusing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refocusing
GitHub stars
5.9k
Token cost
~864 tokens
SKILL.md length
451 words
Files
3 (incl. scripts, references)
Skills in repo
49
Repo updated
First seen
Licence
Apache-2.0

At a glance

Re-grounds a long-running agent in the current product outcome by running a path-based trace to the root of its topology and work trees.

  • A long-running agent may have lost sight of the product outcome
  • Runs Python scripts from its folder; calls python3
  • Context was compacted and the agent needs re-grounding
  • Work crossed a major boundary and a fresh trace is needed before the next action

What it does

Refocus keeps a long session's earned expertise while re-grounding it in current intent. It is not a restart, wake-up or phase checkpoint. The agent runs the bundled `scripts/trace-to-root.py` instead of rebuilding the hierarchy from memory, choosing `--trees` (topology, work or both) for the context domains and `--depth` (light or full) for how much each node contributes.

Light work traces compose each node's intent and name notes, while full traces include the complete node and note bodies. The script resolves the topology and workspace roots with `rig config get`, and environment variables or `--*-start` options can supply the current node when it cannot be derived. `rig context work-install` lists the project's declared context, and a missing chain file is reported as a gap instead of being followed to invent a second parent. A reference file covers the automatic hook and its content ladder.

When your agent uses it

  • A long-running agent may have lost sight of the product outcome
  • Context was compacted and the agent needs re-grounding
  • Work crossed a major boundary and a fresh trace is needed before the next action

Example prompts

  • “Refocus: trace to the root with both trees at light depth before you continue.”
  • “We just compacted context, so re-ground on the current intent before the next change.”
  • “Run the full-depth work trace so I can see every node's notes.”

Requirements

  • Python 3 to run `scripts/trace-to-root.py`
  • The OpenRig `rig` command-line tool

What it can do on your machine

Read from SKILL.md and the folder at commit 1f69831. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agent Refocusing loads about 864 tokens when it runs, and up to ~1.2k if it reads all its reference files. Until then it costs about 74 tokens; SKILL.md has 451 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~74
When it runs · the whole SKILL.md, loaded when a task matches
~864
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from mvschwarz/openrig at commit 1f69831, republished under its Apache-2.0 licence (© mvschwarz). 451 words, ~864 tokens.

Download SKILL.mdSave it as .claude/skills/refocusing/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
refocusing
description
Use when a long-running agent may have lost the product outcome, when context was compacted, when work has crossed a major boundary, or when a fresh path-based trace is needed before the next consequential action. Not for fresh-session orientation, waking an idle seat, or checkpoints.

Refocusing

Invoke the skill as refocusing, its frontmatter name. OpenRig seeds it in the Claude and Codex global skill roots and includes selected plugin skills in managed loadouts. Existing externally managed copies remain authoritative. If the harness has not discovered it yet, read this installed skill file and run its script directly; hook registration alone does not prove native skill discovery.

Refocus preserves a long session's earned expertise while re-grounding it in current intent and lived context. It is not a restart, wake, or phase checkpoint.

During an actionable managed restore, consume the current topology and work trace that actually arrived with the request. Do not rerun Python merely to duplicate it. If no current trace arrived, name that delivery gap. A packet pointer, compact summary or truncated extract is not a full source read. Use the native file-read tool for required notes and full sources, and complete the existing restore audit; partial file reads do not establish completed refocus or restoration.

For a new trace outside that delivered context, follow the command guidance below. Resolve the bundled script's absolute path from the directory of this loaded skill. Stay in your current working directory; do not cd into the skill directory, which can change the inferred work node. Run the trace as one plain command, replacing the example path with the actual absolute path written out in the tool call:

bash
python3 "/absolute/path/to/refocusing/scripts/trace-to-root.py" --trees both --depth light

Do not combine this command with shell variables, environment assignments, command substitution, exit-status printing or file-reading loops. Read the named source files separately with the native read tool. Combined shell loops or variables can require native approval even when the intended operations are read-only; a plain command is not a guarantee that approval will never be needed.

Show full SKILL.md (164 more words)Show less

For managed compaction, refocus during the restore request or its read-depth audit. The earlier acknowledgement-only boundary is not permission to restore.

Use --trees topology|work|both to select context domains and --depth light|full to control how much each node contributes. Light work traces compose intent: and name notes; full traces include the complete node and notes bodies. The script resolves topology.root and workspace.root with rig config get. When a known current node must be supplied, pass --work-start or --topology-start with its literal absolute path in the same plain command. Do not substitute the project root for a mission or slice node and claim that mission was traced.

The trace walks the topology and work trees. For the project's own declared context (intent, context files, skills), rig context work-install lists it; read what the next action needs.

Read references/refocus.md when changing the automatic hook or its content ladder. A missing chain file is evidence: report the gap and continue; never follow pointers to invent a second parent.

© mvschwarz, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts, references) in packages/daemon/assets/plugins/openrig-core/skills/refocusing of mvschwarz/openrig.

  • SKILL.md
  • references/refocus.md
  • scripts/trace-to-root.py

Open the folder on GitHubat commit 1f69831

Compare with similar skills

Agent Refocusing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agent Refocusing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agent Refocusing this skillmvschwarz/openrig5.9k—~864Automated safety check: PassApache-2.0
Harness Engineering10xChengTu/harness-engineering1021 repos~1kAutomated safety check: PassNone
Harness Long-Running Task LoopChachamaru127/claude-code-harness3.2k—~2.3kAutomated safety check: NotesMIT
Loop Engineeringhuytieu/COG-second-brain1.3k—~1.5kAutomated safety check: PassMIT
Session Handoffdavila7/claude-code-templates32k2 repos~1.6kAutomated safety check: PassMIT
Harness Engineeringmagnus919/agent-skills113—~3.5kAutomated safety check: PassMIT

Similar skills

  • Harness Engineering

    10xChengTu/harness-engineering

    Set up and improve harness engineering (AGENTS.md, docs/, lint rules, eval systems, project-level prompt engineering) for AI-agent-friendly codebases.

    102 GitHub starsUsed in 1 repo~1k tokens
    Agent WorkflowsAuto-check passed
  • Harness Long-Running Task Loop

    Chachamaru127/claude-code-harness

    Repeats a long task as a series of scheduled wake-ups, each re-entering with fresh context and calling harness-work for one task per cycle.

    3.2k GitHub stars~2.3k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check: notes
  • Loop Engineering

    huytieu/COG-second-brain

    Shared loop-engineering reference for COG skills - the agent loop, deterministic verifiers, termination conditions, in-loop context management, and named patterns.

    1.3k GitHub stars~1.5k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Session Handoff

    davila7/claude-code-templates

    Creates comprehensive handoff documents for seamless AI agent session transfers.

    32k GitHub starsUsed in 2 repos~1.6k tokens
    Agent WorkflowsAuto-check passed
  • Harness Engineering

    magnus919/agent-skills

    Design, build, diagnose, and evolve agent harnesses: instructions, tools, execution environments, durable state, context management, verification, recovery, and bounded autonomous loops.

    113 GitHub stars~3.5k tokensUpdated 2 days ago
    Agent WorkflowsAuto-check passed
  • Agents Best Practices

    DenisSergeevitch/agents-best-practices

    A skill your agent uses when designing, generating an MVP blueprint for, auditing, troubleshooting, refactoring, or explaining an agentic harness for any domain.

    2.4k GitHub stars~7.4k tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check passed

More from mvschwarz/openrig

All 49 skills in this repo
  • OpenRig Upgrade Procedure

    mvschwarz/openrig

    Walks an agent through upgrading the OpenRig CLI and daemon one observed step at a time, keeping live seats alive and reconciling managed plugin files.

    5.9k GitHub starsUsed in 1 repo~2.9k tokens
    Auto-check passed
  • OpenRig Software Factory

    mvschwarz/openrig

    Helps set up a continuing agent software team for a real repository with OpenRig, choosing between manual work, queue handoffs and an explicit Workflow.

    5.9k GitHub stars~2.6k tokensUpdated today
    Auto-check passed
  • Loads one section of a Markdown file by its path#h2-slug address with a bundled resolver script, for use outside OpenRig's context library.

    5.9k GitHub starsUsed in 1 repo~341 tokens
    Auto-check passed
  • Separates a stable agent seat's identity from its changing occupant, and records honest, two-part provenance whenever one occupant replaces another.

    5.9k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Cross Host Rig Commands

    mvschwarz/openrig

    A skill your agent uses when addressing a registered remote OpenRig host, choosing its transport, or interpreting a cross-host result.

    5.9k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Openrig Herdr

    mvschwarz/openrig

    A skill your agent uses when opening OpenRig fleet terminals as a herdr wall — turning a rig, pod, mission, slice, or saved view into live interactive agent tiles via rig terminal, watching another…

    5.9k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed

Categories

Questions about Agent Refocusing

What does Agent Refocusing do?

Re-grounds a long-running agent in the current product outcome by running a path-based trace to the root of its topology and work trees. Refocus keeps a long session's earned expertise while re-grounding it in current intent. It is not a restart, wake-up or phase checkpoint.

When should I use Agent Refocusing?

Agent Refocusing fits situations like: A long-running agent may have lost sight of the product outcome; context was compacted and the agent needs re-grounding; work crossed a major boundary and a fresh trace is needed before the next action.

How do I install Agent Refocusing in Claude Code?

Run `npx skills add mvschwarz/openrig --skill refocusing -a claude-code`. Or copy the skill folder (packages/daemon/assets/plugins/openrig-core/skills/refocusing in mvschwarz/openrig) into .claude/skills/refocusing in your project. Claude Code loads it when a task matches its description.

How do I install Agent Refocusing in Codex?

Run `npx skills add mvschwarz/openrig --skill refocusing -a codex`. Or copy the skill folder (packages/daemon/assets/plugins/openrig-core/skills/refocusing in mvschwarz/openrig) into .agents/skills/refocusing in your project. Codex loads it when a task matches its description.

Can I use Agent Refocusing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mvschwarz/openrig --skill refocusing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refocusing, .gemini/skills/refocusing, .github/skills/refocusing and .opencode/skills/refocusing in your project.

What does Agent Refocusing need to run?

Going by SKILL.md and its folder, Agent Refocusing needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3 to run `scripts/trace-to-root.py`; The OpenRig `rig` command-line tool.

Does Agent Refocusing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Agent Refocusing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Agent Refocusing use?

Agent Refocusing is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agent Refocusing use?

About 864 tokens (SKILL.md is roughly 3.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 290 tokens, read only when the agent opens those files.

What are the alternatives to Agent Refocusing?

Skills that share tags, products or a category with Agent Refocusing: Harness Engineering (10xChengTu/harness-engineering, 102 stars), Harness Long-Running Task Loop (Chachamaru127/claude-code-harness, 3.2k stars), Loop Engineering (huytieu/COG-second-brain, 1.3k stars) and Session Handoff (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agent Refocusing?

mvschwarz (a GitHub user) maintains it in mvschwarz/openrig, which has 5,854 GitHub stars. The repository holds 49 skills in this directory. The repository was last updated on October 8, 2026.

Source: mvschwarz/openrig on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.