Skip to main content
The clean command removes the .gitnexus/ index directory from a repository and unregisters it from the global registry.

Usage

Options

boolean
default:"false"
Skip confirmation prompt and delete immediately.Flag: -f, --force
boolean
default:"false"
Delete indexes for all registered repositories (instead of just the current one).Flag: --all

Examples

Clean Current Repository

Run from within a git repository:
Output:
Confirm:
Output:

Clean All Repositories

Output:
Confirm:
Output:

What Gets Deleted

Repository Index

The entire .gitnexus/ directory is removed:

Global Registry Entry

The repository is removed from ~/.gitnexus/registry.json.

What Stays

  • Source code (untouched)
  • .gitignore entry (harmless if index is deleted)
  • AGENTS.md and CLAUDE.md files (can be manually deleted)
  • Agent skills in .claude/skills/ (per-repo, can be manually deleted)

Use Cases

Free Disk Space

Indexes can grow to 100-500 MB for large repositories. Use clean to reclaim space:

Re-index After Corruption

If the index is corrupted:

Remove All Indexes Before Uninstalling

Safety

Confirmation Required

By default, clean shows what will be deleted and requires --force to proceed.

No Impact on Source Code

Only the .gitnexus/ directory is deleted. Your source code is never touched.

Re-indexing

You can always re-index after cleaning:

Troubleshooting

”No indexed repository found in this directory”

You’re not in a repository that has been indexed. Solution:
Or use --all to clean all indexed repos:

Permission Denied

The .gitnexus/ directory may be locked by another process. Solution:
  1. Stop any running gitnexus serve or MCP servers
  2. Close your editor
  3. Retry:

Failed to Delete (Partial Deletion)

If deletion fails partway through:

Impact on MCP

After cleaning a repository:
  • MCP tools will no longer see it in list_repos
  • Queries targeting that repo will fail
  • The web UI will not show it
Re-run gitnexus analyze to restore MCP access.

See Also