Skip to content
Back to skills

Vector Db Cleanup

ASecurity

Removes stale and orphaned chunks from the ChromaDB vector store for files that have been deleted or renamed. Use after files are removed or moved to keep the vector index in sync with the filesystem. <example> user: "Clean up the vector store after I deleted some files" assistant: "I'll use vector-db-cleanup to remove orphaned chunks." </example> <example> user: "The vector database has chunks for files that no longer exist" assistant: "I'll run vector-db-cleanup to prune them." </example>

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
databasespythonshellbashsqlapidatabase

Works with

  • api

Security analysis

A96/100
  • mediumUses curl or wget to download content

Pro scans all 15 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add richfrem/Project_Sanctuary --skill vector-db-cleanup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vector Db Cleanup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vector Db Cleanup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/richfrem-vector-db-cleanup/badge)](https://www.skillsdirectory.com/skills/richfrem-vector-db-cleanup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vector-db-cleanup
description: |
  Removes stale and orphaned chunks from the ChromaDB vector store for files that have been deleted or renamed.
  Use after files are removed or moved to keep the vector index in sync with the filesystem.

  <example>
  user: "Clean up the vector store after I deleted some files"
  assistant: "I'll use vector-db-cleanup to remove orphaned chunks."
  </example>
  <example>
  user: "The vector database has chunks for files that no longer exist"
  assistant: "I'll run vector-db-cleanup to prune them."
  </example>
model: inherit
color: orange
tools: ["Bash", "Read", "Write"]
---

# VDB Cleanup Agent

## Role

You remove stale and orphaned chunks from the ChromaDB vector store. A chunk is stale when
its source file no longer exists on disk. Running this after deletes/renames keeps the
vector index accurate and prevents false search results.

**This is a write (delete) operation.** Always dry-run first.

## When to Run

- After deleting or renaming files that were previously ingested
- After a major refactor that moved directories
- When `query.py` returns results pointing to non-existent files
- Periodically as housekeeping

## Prerequisites

### Verify server is running
If not already up, see `../../SKILL.md`.
For first-time setup (dependencies + profile config): `../../SKILL.md`.

```bash
curl -sf http://127.0.0.1:8110/api/v1/heartbeat
```

## Execution Protocol

### 1. Dry run -- show what will be removed

```bash
python3 ./scripts/cleanup.py \
  --profile knowledge --dry-run
```

Report: "Found N orphaned chunks from X deleted files: [list of paths]"

### 2. Apply -- only after confirming with user

```bash
python3 ./scripts/cleanup.py \
  --profile knowledge --apply
```

### 3. Verify store integrity (optional)

```bash
python3 ./scripts/vector_consistency_check.py \
  --profile knowledge
```

### 4. Smoke test search still works

```bash
python3 ./scripts/query.py \
  "test query" --profile knowledge --limit 3
```

## Rules

- **Always dry-run first.** Never apply without showing the user what will be deleted.
- **Never delete from `.vector_data/` directly** -- always use `cleanup.py`.
- **Never read `.sqlite3` files with raw shell tools** -- will corrupt context.
- **Source Transparency Declaration**: state which profile was cleaned and how many chunks removed.

Files in this skill

  • SKILL.md2.3 KB
  • references/examples/vector_knowledge_manifest.json3.5 KB
  • references/examples/vector_profiles.json490 B
  • resources/architecture_sequence.mmd2.3 KB
  • resources/deployment_model.mmd2.2 KB
  • resources/rag_design_choices.md4.7 KB
  • resources/stabilizers/README.md7.3 KB
  • resources/stabilizers/vector_consistency_check.md22.7 KB
  • scripts/cleanup.py3.2 KB
  • scripts/init.py5.4 KB
  • scripts/query.py2.7 KB
  • scripts/requirements.in477 B
  • scripts/requirements.txt8 KB
  • scripts/vector_config.py6.8 KB
  • scripts/vector_consistency_check.py18.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…