Index of every page on this site: llms.txt
All skills
eyriecommander avatar

/thread-workspace-relink

@e2bf5bd
Run it yourself

Use when Codex threads need to be relinked to a new local workspace folder after a rename or move, chats appear under an old folder, show "working directory missing", or jump folders because local session/index state still points to an old cwd.

Use this Skill: https://skilld.dev/gh/eyriecommander/codex-skills/thread-workspace-relink

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈67 tokens for metadata: the name and description. ≈762 when used: this file. ≈213 more on demand in 2 files.

Description uses 3.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈270 characters, or 3.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Thread Workspace Relink

Use this skill to migrate Codex thread workspace paths from old_path to new_path safely and repeatably.

Workflow

  1. Confirm target and scope
  • Collect old_path and new_path.
  • Decide scope: all affected threads or selected thread_ids.
  1. Run dry-run first
  • Use script in scripts/relink_thread_workspaces.py with --mode dry-run.
  • Review affected counts and files before writing.
  1. Apply with backup
  • Run with --mode apply.
  • Prefer applying only after Codex is closed, because the app may be reading or writing the same local state.
  • Script creates timestamped backup under ~/.codex/path_rename_backup_*.
  • Script updates:
    • Session JSONL cwd fields (sessions/, archived_sessions/)
    • State DB threads.cwd in ~/.codex/state_*.sqlite
  1. Verify
  • Confirm old count is 0 for migrated scope.
  • Spot-check requested thread IDs.
  • If no compatible DB is discovered, run --diagnose and inspect db_search_roots, db_candidates, and compatible_dbs.
  1. Refresh UI
  • Quit/reopen Codex after apply so sidebar grouping refreshes.

Commands

Dry-run all:

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode dry-run \
  --scope all

Apply all:

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode apply \
  --scope all

Dry-run selected thread IDs:

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode dry-run \
  --scope ids \
  --ids "id1,id2,id3"

Apply selected thread IDs:

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode apply \
  --scope ids \
  --ids "id1,id2,id3"

Diagnose DB discovery:

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode dry-run \
  --scope all \
  --diagnose

Deep diagnostics (recommended for issue triage):

python3 scripts/relink_thread_workspaces.py \
  --old "/old/path" \
  --new "/new/path" \
  --mode dry-run \
  --scope all \
  --diagnose-deep

Guardrails

  • Do not bulk-rewrite arbitrary text/history; only structured cwd surfaces.
  • Always run dry-run before apply.
  • Always create backup before writes.
  • Keep rollout reversible via backup restore.
  • If JSONL matches exist but no compatible DB is found, apply exits with an error by default.
  • Use --db-path "/path/to/state_x.sqlite" to include explicit DB files when discovery misses your active state DB.
  • Use --allow-jsonl-only only when JSONL-only migration is intentional.

Compatibility Note

  • This skill targets current Codex local state surfaces (sessions/*.jsonl, archived_sessions/*.jsonl, state_*.sqlite with threads.cwd).
  • Codex versions can change storage/schema details over time.
  • Always run dry-run first and review counts before apply.
  • If expected tables/fields are missing, stop and inspect local state layout before writing.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    The skill is a local maintenance utility designed to relink workspace paths in Codex thread state files. It uses a Python script to update local files and databases, incorporating safety features such as mandatory backups and dry-run modes to ensure data integrity without any external data transmission.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at e2bf5bd. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 6 months ago

README badge

README badge for eyriecommander/codex-skills/thread-workspace-relink