Codex

rollback-workspace

Restore the .aiwg/ directory from a migrate-workspace backup, listing available backups when none is specified

104 stars

Best use case

rollback-workspace is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

It is a strong fit for teams already working in Codex.

Restore the .aiwg/ directory from a migrate-workspace backup, listing available backups when none is specified

Teams using rollback-workspace should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/rollback-workspace/SKILL.md --create-dirs "https://raw.githubusercontent.com/jmagly/aiwg/main/.agents/skills/rollback-workspace/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/rollback-workspace/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How rollback-workspace Compares

Feature / Agentrollback-workspaceStandard Approach
Platform SupportCodexLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Restore the .aiwg/ directory from a migrate-workspace backup, listing available backups when none is specified

Which AI agents support this skill?

This skill is designed for Codex.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Rollback Workspace

You restore the `.aiwg/` directory from a backup created by `migrate-workspace`. Lists available backups when no specific backup is named. The restore is safe — it will not overwrite artifacts that were created after the migration.

## Triggers

Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):

- "undo the migration" → rollback to most recent backup
- "restore my workspace" → rollback to most recent backup
- "what backups do I have?" → list available backups
- "revert aiwg directory" → rollback to most recent backup

## Trigger Patterns Reference

| Pattern | Example | Action |
|---------|---------|--------|
| Rollback latest | "roll back the workspace migration" | Run `aiwg rollback-workspace` |
| List backups | "what workspace backups exist?" | Run `aiwg rollback-workspace --list` |
| Specific backup | "restore from the backup made on April 1st" | Run `aiwg rollback-workspace --from .aiwg/.backup-20260401-1423` |
| Dry run | "preview the rollback" | Run `aiwg rollback-workspace --dry-run` |
| Force | "rollback workspace, skip confirmation" | Run `aiwg rollback-workspace --yes` |

## Behavior

When triggered:

1. **List backups before restoring** unless a specific backup is named or the user has already confirmed:
   - Run `aiwg rollback-workspace --list` to show what is available.
   - If only one backup exists, propose it directly.
   - If multiple backups exist, ask which one to restore.

2. **Extract arguments**:
   - Is `--list` requested? Show backups and stop.
   - Is a specific `--from <path>` given? Use that backup.
   - Is `--dry-run` requested? Show what would be restored, no changes.
   - Has the user confirmed? Use `--yes` to skip the interactive prompt.

3. **Run the appropriate command**:

   ```bash
   # List available backups
   aiwg rollback-workspace --list

   # Preview rollback (no changes)
   aiwg rollback-workspace --dry-run

   # Rollback to most recent backup (prompts for confirmation)
   aiwg rollback-workspace

   # Rollback to specific backup
   aiwg rollback-workspace --from .aiwg/.backup-20260401-1423

   # Rollback, skip prompt
   aiwg rollback-workspace --yes
   ```

4. **Safety behaviour**:
   - Will not overwrite files that were created **after** the backup timestamp (new artifacts added post-migration are preserved).
   - Conflicting files (same path, newer mtime) are reported rather than silently overwritten — the user decides.
   - If no backup exists, reports clearly and suggests contacting support.

5. **Report the result** — confirm what was restored, list any skipped conflicts, and remind the user to run `aiwg status` to verify.

## Examples

### Example 1: List backups first

**User**: "Roll back my workspace migration"

**Extraction**: Rollback requested — list backups before applying

**Action** (step 1):
```bash
aiwg rollback-workspace --list
```

**Response**:
```
Available workspace backups:

  1. .aiwg/.backup-20260401-1423   (created 2026-04-01 14:23 UTC — before migration)
  2. .aiwg/.backup-20260320-0900   (created 2026-03-20 09:00 UTC — before migration)

Which backup would you like to restore from? (default: 1 — most recent)
```

After user selects → run `aiwg rollback-workspace --from .aiwg/.backup-20260401-1423`.

### Example 2: Single backup, confirm and restore

**User**: "Undo the migration"

**Extraction**: One backup found, propose it

**Action**:
```bash
aiwg rollback-workspace --list
# One result → propose it
aiwg rollback-workspace --dry-run
```

**Preview response**:
```
Rollback Preview (from .aiwg/.backup-20260401-1423)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Would restore:
  .aiwg/frameworks/sdlc-complete/requirements/ → .aiwg/requirements/
  .aiwg/frameworks/sdlc-complete/architecture/ → .aiwg/architecture/
  (+ 6 more directories)

Files added after migration (will NOT be overwritten):
  .aiwg/requirements/UC-015.md  (newer than backup)

Proceed? [y/N]
```

After user confirms → `aiwg rollback-workspace --yes`.

### Example 3: Dry run only

**User**: "Preview a workspace rollback"

**Extraction**: Dry-run only

**Action**:
```bash
aiwg rollback-workspace --dry-run
```

**Response**: Shows the planned restore table (as above) and stops. Does not prompt for confirmation.

### Example 4: No backups available

**User**: "Roll back my workspace"

**Extraction**: No backups found

**Action**:
```bash
aiwg rollback-workspace --list
```

**Response**: "No workspace backups found in `.aiwg/`. Backups are created automatically when you run `aiwg migrate-workspace`. If you have a manual backup, specify its path with `aiwg rollback-workspace --from <path>`."

### Example 5: Specific backup path

**User**: "Restore from the backup at .aiwg/.backup-20260320-0900"

**Extraction**: Explicit backup path given

**Action**:
```bash
aiwg rollback-workspace --from .aiwg/.backup-20260320-0900
```

**Response**: Runs the restore, reports what was moved back and any skipped conflicts. Confirms with `aiwg status` recommendation.

## Clarification Prompts

If the user's intent is ambiguous:

- "Which backup would you like to restore from? I found: `.backup-20260401-1423`, `.backup-20260320-0900`."
- "Would you like me to preview the rollback first before applying it?"
- "Files created after the migration will not be overwritten — is that OK, or do you need to handle those manually?"

## References

- @$AIWG_ROOT/src/cli/handlers/workspace.ts — `rollback-workspace` command handler
- @$AIWG_ROOT/docs/cli-reference.md — CLI reference
- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/skills/migrate-workspace/SKILL.md — The migration this reverses

Related Skills

workspace-reset

104
from jmagly/aiwg

Wipe .aiwg/ directory and optionally restart with fresh intake

Codex

workspace-realign

104
from jmagly/aiwg

Reorganize and update .aiwg/ documentation to reflect current project reality

Codex

workspace-prune-working

104
from jmagly/aiwg

Clean up .aiwg/working/ by promoting, archiving, or deleting temporary files

Codex

workspace-health

104
from jmagly/aiwg

Assess workspace alignment and recommend cleanup or realignment actions at key lifecycle transition points

Codex

migrate-workspace

104
from jmagly/aiwg

Migrate the .aiwg/ directory from single-framework layout to the multi-framework layout with an automatic backup

Codex

aiwg-orchestrate

104
from jmagly/aiwg

Route structured artifact work to AIWG workflows via MCP with zero parent context cost

venv-manager

104
from jmagly/aiwg

Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.

pytest-runner

104
from jmagly/aiwg

Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.

vitest-runner

104
from jmagly/aiwg

Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.

eslint-checker

104
from jmagly/aiwg

Run ESLint for JavaScript/TypeScript code quality and style enforcement. Use for static analysis and auto-fixing.

repo-analyzer

104
from jmagly/aiwg

Analyze GitHub repositories for structure, documentation, dependencies, and contribution patterns. Use for codebase understanding and health assessment.

pr-reviewer

104
from jmagly/aiwg

Review GitHub pull requests for code quality, security, and best practices. Use for automated PR feedback and approval workflows.