codemap_group_delete

Delete a code group. Returns the deleted group details.

groupsdeleteremove

Parameters

NameTypeRequiredDescription
namestring✅ RequiredGroup name to delete
forceboolean❌ OptionalForce delete without confirmation (default: false)

Usage Examples

MCP Usage (for AI Agents like Claude)

json
{
  "name": "codemap_group_delete",
  "arguments": {
    "name": "temp-files"
  }
}

Example Output

JSON Response

json
{
  "success": true,
  "message": "Group \"auth-system\" deleted successfully",
  "deleted": {
    "name": "auth-system",
    "description": "Authentication and authorization module - handles login, JWT tokens, and permissions",
    "memberCount": 5,
    "notationCount": 3
  }
}
ℹ️When to Use This Tool
    Use codemap_group_delete when you need to:
  • Remove obsolete or temporary groups
  • Clean up groups created for one-time refactoring tasks
  • Delete groups that are no longer relevant to the codebase
  • Reorganize group structure (delete and recreate with new members)
  • Remove groups before project archival or handoff
💡Common Patterns
Safe Deletion Workflow
Before deleting, check group contents:
1. Call codemap_group_search({ name: "group-name" })
2. Review members and notations
3. Verify group is truly obsolete
4. Call codemap_group_delete({ name: "group-name" })


Bulk Cleanup
Delete multiple temporary groups:
1. List all groups: codemap_group_list()
2. Identify temp groups (e.g., "temp-*", "fix-*")
3. Delete each: codemap_group_delete({ name: "temp-fix-123" })


Reorganization Pattern
Replace group with new structure:
1. Get current members: codemap_group_search({ name: "old-group" })
2. Delete old group: codemap_group_delete({ name: "old-group" })
3. Create new groups with refined organization
💡Pro Tips
  • Deletion is permanent: Once deleted, groups cannot be recovered (unless .codemap/groups.json is version controlled)
  • Force parameter is optional: The force parameter exists for future confirmation workflows - currently deletion is immediate
  • Returns deleted group details: The response includes the group's final state (members count, notations count) for verification
  • Group members stay intact: Deleting a group doesn't affect the actual files, just the organizational metadata
Best Practices
  • Always verify group contents before deletion using codemap_group_search
  • Keep .codemap/groups.json under version control to enable recovery via git
  • Delete temporary/experimental groups after work is complete
  • Document why groups are being deleted in commit messages
  • Consider archiving group data (export to JSON) before deletion for important groups
⚠️Common Mistakes
Mistake: Deleting groups without checking contents first
codemap_group_delete({ name: "api" })  // What was in this group?

Instead: Review before deletion
// First check what's in the group
const group = await codemap_group_search({ name: "api" });
console.log(Deleting group with ${group.data.group.memberCount} members);

// Then delete
codemap_group_delete({ name: "api" })


---

Mistake: Assuming deletion affects files or code
// Thinking this will delete actual files
codemap_group_delete({ name: "deprecated-code" })

Instead: Understand groups are organizational metadata only
// Delete group removes organizational metadata
codemap_group_delete({ name: "deprecated-code" })

// To delete actual files, use separate file deletion tools
codemap_delete({ path: "src/deprecated/**/*" })


---

Mistake: Not having version control as a safety net
// No backup if deletion was accidental
codemap_group_delete({ name: "important-feature" })

Instead: Commit .codemap/groups.json before major deletions
git add .codemap/groups.json
git commit -m "Snapshot before group cleanup"
codemap_group_delete({ name: "old-feature" })


---

Mistake: Deleting groups that are referenced in routines or macros
// Group is used in routine, but deleting anyway
codemap_group_delete({ name: "api-layer" })
// Now routine breaks: "Group api-layer not found"

Instead: Check for dependencies before deletion
// Search for group references in routines
codemap_routine_list() // Check if "api-layer" is referenced

// Update routines first, then delete group
codemap_routine_remove_group({ name: "release-workflow", group: "api-layer" })
codemap_group_delete({ name: "api-layer" })