Workspace Autopsy & Governance Restructure
Overview
This skill enables agents to systematically analyze (autopsy) an existing, potentially disorganized workspace, propose a logical new directory structure, and migrate the workspace to this new structure while enforcing new governance standards.
Workflow
To execute this skill, follow these sequential steps:
Phase 1: Workspace Autopsy (Mapping)
To begin, you must understand the current state of the workspace.
- Run the autopsy script to map the directory:
python /Users/4jp/.agents/skills/workspace-autopsy-governance/scripts/workspace_autopsy.py --dir . - Review the generated map and statistics. Identify:
- Where the core source code lives.
- Where documentation, scripts, and assets are currently scattered.
- Legacy folders or structural chaos that need cleaning.
Phase 2: Sending the Signal (Restructure Proposal)
Before moving any files, you must "send out the signal" to the user proposing the new structure and governance.
- Read the template from
assets/RESTRUCTURE_PROPOSAL-template.md. - Draft a customized
RESTRUCTURE_PROPOSAL.mdbased on your findings from the autopsy. Detail exactly which directories will be created and which files will move where. - Present this proposal to the user and wait for their explicit approval. Do not proceed to Phase 3 without approval.
Phase 3: Unite Under New Locations (Migration)
Once the user approves the proposal:
- Create the new target directories (e.g.,
/src,/docs,/scripts,/assets,/tests) as agreed upon in the proposal. - Use standard shell commands (
mv) to systematically migrate files from their old locations to the newly created, unified locations. - Ensure no orphaned files remain in chaotic root locations unless they are standard configuration files (e.g.,
.gitignore,package.json).
Phase 4: Establish New Governance
With the files in their new locations, establish the rules that will govern them going forward.
- Read the template from
assets/GEMINI-template.md. - Customize it to reflect the specific standards, workflows, and constraints of the newly restructured project.
- Write this customized governance document to
GEMINI.mdat the root of the project. - If appropriate, create subdirectory-specific
GEMINI.mdfiles for deeper governance (e.g., in/src/GEMINI.md).
Resources Included
scripts/workspace_autopsy.py
A Python script that traverses the specified directory, ignores common build/dependency folders, and prints a tree map along with statistics about file types and counts.
assets/RESTRUCTURE_PROPOSAL-template.md
A template for the document you will generate to propose the new structure to the user.
assets/GEMINI-template.md
A template for the governance rules to establish in the repository after the restructure.