Agent skill

Working Directory Resolution

by HKUDS in HKUDS/OpenSpace

Resolve file access failures by changing to the correct working directory before command execution

MITAuto-check passed

Install Working Directory Resolution

skills CLI
$ npx skills add HKUDS/OpenSpace --skill working-directory-resolution -a claude-code

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

GitHub CLI
$ gh skill install HKUDS/OpenSpace working-directory-resolution --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/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/working-directory-resolution .claude/skills/working-directory-resolution && 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
working-directory-resolution
GitHub stars
7.7k
Token cost
~732 tokens
SKILL.md length
274 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Resolve file access failures by changing to the correct working directory before command execution

  • Works in 4 steps: Use absolute paths when possible → Combine related operations to avoid… → Verify directory exists before operations → …
  • SKILL.md covers Problem Symptoms, Solution, Implementation Pattern and When to Apply, plus 3 more sections
  • Calls python

What it does

Working Directory Resolution is an agent skill from HKUDS/OpenSpace. Resolve file access failures by changing to the correct working directory before command execution

Its SKILL.md is about 730 tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

Example prompts

  • “/working-directory-resolution”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Use absolute paths when possible
  2. Combine related operations to avoid repeated cd calls
  3. Verify directory exists before operations
  4. For scripts, set working directory at the start

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. 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

    Shell commands in SKILL.md call:

    • python

    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

Working Directory Resolution loads about 732 tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 274 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~32
When it runs · the whole SKILL.md, loaded when a task matches
~732

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); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 274 words, ~732 tokens.

Download SKILL.mdSave it as .claude/skills/working-directory-resolution/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
working-directory-resolution
description
Resolve file access failures by changing to the correct working directory before command execution

Working Directory Resolution Pattern

Many file operation failures occur because the tool's current working directory doesn't match where the target files are located. This skill provides a reliable pattern for resolving such issues.

Problem Symptoms

File operations fail with errors like:

  • "File not found" or "No such file or directory"
  • "Permission denied" (when path is actually relative)
  • Tools returning empty results for files that should exist

These failures often occur even when files are present in the workspace—the working directory context is simply wrong.

Solution

Always explicitly set the working directory before file operations by prepending cd to your shell commands.

Implementation Pattern

Basic Syntax
bash
cd /path/to/target/directory && your-command-here
With run_shell
bash
run_shell(command="cd /workspace/project && cat config.json")
Multiple Operations in Same Directory
bash
cd /workspace/project && ls -la && cat README.md && python script.py
Conditional Directory Change
bash
cd /workspace/project 2>/dev/null && cat file.txt || echo "Directory not found"

When to Apply

Use this pattern when:

  • read_file fails to locate an existing file
  • execute_code_sandbox can't find referenced files
  • Shell commands report missing files that should exist
  • File paths work in some contexts but not others
  • You're unsure of the tool's current working directory

Best Practices

  1. Use absolute paths when possible

    bash
    cd /workspace/project/src && python main.py
  2. Combine related operations to avoid repeated cd calls

    bash
    cd /workspace/project && ./build.sh && ./test.sh
  3. Verify directory exists before operations

    bash
    [ -d /workspace/project ] && cd /workspace/project && ls
  4. For scripts, set working directory at the start

    bash
    #!/bin/bash
    cd "$(dirname "$0")" || exit 1
    # Rest of script runs from script's directory

Common Pitfalls

IssueWrong ApproachCorrect Approach
Relative pathscat config.jsoncd /workspace && cat config.json
Assumed cwdpython script.pycd /workspace && python script.py
Multiple dirscd dir1; cd dir2; cmdcd dir1/dir2 && cmd

Fallback Strategy

If cd also fails:

  1. Use pwd to check current directory
  2. Use find or ls -R to locate files
  3. Verify the path structure with ls -la /path/to/check
bash
pwd && find /workspace -name "target_file.txt" 2>/dev/null

This pattern is especially valuable when tools like execute_code_sandbox or read_file fail but run_shell with explicit directory context succeeds.

© HKUDS, MIT. 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 1 other file in benchmarks/gdpval/skills/working-directory-resolution of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Working Directory Resolution 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.

Working Directory Resolution compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Working Directory Resolution this skillHKUDS/OpenSpace7.7k—~732Automated safety check: PassMIT
Resolve Git Conflictspenpot/penpot61k—~772Automated safety check: PassMPL-2.0
Correctcursor/plugins10k3 repos~612Automated safety check: PassNone
Make Changesremix-run/remix33k—~2.4kAutomated safety check: PassMIT
CorrectionNxcoreAI/EverRoom3k—~290Automated safety check: PassCustom licence
Orch Change Featureaffaan-m/ECC275k1 repos~420Automated safety check: PassMIT

Similar skills

  • Conflict resolution flow — understand the local git conflicts, present a resolution plan, and resolve them after the user approves it.

    61k GitHub stars~772 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Correct

    cursor/plugins

    Official

    Find the mistakes agents keep repeating in this repo and make each one impossible.

    10k GitHub starsUsed in 3 repos~612 tokens
    Auto-check passed
  • Make Changes

    remix-run/remix

    Create or update Remix repo change files under packages//.changes.

    33k GitHub stars~2.4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Correction

    NxcoreAI/EverRoom

    Compute Room overview corrections—citation corrections as per-claim edits and general corrections as a single proposal.

    3k GitHub stars~290 tokensUpdated yesterday
    Research & ScienceAuto-check passed
  • Orchestrate altering an existing, working feature to new desired behavior — update its tests to the new spec, change the implementation to match, review, and gated commit.

    275k GitHub starsUsed in 1 repo~420 tokens
    Auto-check passed
  • Archives several completed OpenSpec changes in one operation, checking the codebase to resolve spec conflicts rather than archiving blindly.

    71k GitHub starsUsed in 3 repos~5.6k tokens
    DevelopmentAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.7k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.7k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.7k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.7k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.7k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Working Directory Resolution

What does Working Directory Resolution do?

Resolve file access failures by changing to the correct working directory before command execution. Working Directory Resolution is an agent skill from HKUDS/OpenSpace.

How do I install Working Directory Resolution in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill working-directory-resolution -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/working-directory-resolution in HKUDS/OpenSpace) into .claude/skills/working-directory-resolution in your project. Claude Code loads it when a task matches its description.

How do I install Working Directory Resolution in Codex?

Run `npx skills add HKUDS/OpenSpace --skill working-directory-resolution -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/working-directory-resolution in HKUDS/OpenSpace) into .agents/skills/working-directory-resolution in your project. Codex loads it when a task matches its description.

Can I use Working Directory Resolution 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 HKUDS/OpenSpace --skill working-directory-resolution -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/working-directory-resolution, .gemini/skills/working-directory-resolution, .github/skills/working-directory-resolution and .opencode/skills/working-directory-resolution in your project.

What does Working Directory Resolution need to run?

Going by SKILL.md and its folder, Working Directory Resolution needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Working Directory Resolution 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 Working Directory Resolution 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. Review the folder before installing.

What licence does Working Directory Resolution use?

Working Directory Resolution is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Working Directory Resolution use?

About 732 tokens (SKILL.md is roughly 2.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Working Directory Resolution?

Skills that share tags, products or a category with Working Directory Resolution: Resolve Git Conflicts (penpot/penpot, 61k stars), Correct (cursor/plugins, 10k stars), Make Changes (remix-run/remix, 33k stars) and Correction (NxcoreAI/EverRoom, 3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Working Directory Resolution?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,749 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

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