Skip to main content

/component-index

Rebuild or update the CODITECT component index database. Supports full rebuild, incremental updates, and FTS maintenance.

Syntax

/component-index [options]

Options

OptionDescriptionExample
--fullFull rebuild (delete and recreate)--full
--incrementalOnly new/changed files (default)--incremental
--type <type>Index only specific type--type agent
--rebuild-ftsRebuild FTS index only--rebuild-fts
--vacuumVacuum database after indexing--vacuum
--verifyVerify index integrity--verify
--dry-runPreview what would be indexed--dry-run
--verboseShow detailed progress--verbose
--statsShow statistics after indexing--stats
--project <id>Scope indexing to project components (ADR-159)--project PILOT

Modes

Incremental (Default)

Only indexes new or modified files based on content hash:

/component-index
# Or explicitly:
/component-index --incremental

When to use: Regular updates, after adding new components

Full Rebuild

Deletes existing index and rebuilds from scratch:

/component-index --full

When to use: After schema changes, corruption, major updates

FTS Rebuild

Rebuilds only the full-text search index:

/component-index --rebuild-fts

When to use: Search returning wrong results, FTS integrity errors

Examples

Standard Operations

# Quick incremental update
/component-index

# Full rebuild with statistics
/component-index --full --stats

# Preview changes without applying
/component-index --dry-run --verbose

Targeted Indexing

# Re-index only agents
/component-index --type agent

# Re-index scripts after bulk update
/component-index --type script --verbose

Maintenance

# Verify index integrity
/component-index --verify

# Optimize database
/component-index --vacuum

# Full maintenance workflow
/component-index --full --vacuum --verify --stats

Output

Component Index Update
======================
Mode: incremental
Started: 2026-01-22 14:30:00

Scanning...
agents/ 152 files
commands/ 89 files
skills/ 221 files
scripts/ 339 files
hooks/ 62 files
workflows/ 45 files
documents/ 686 files

Processing...
New: 15
Updated: 3
Unchanged: 1576
Errors: 0

Statistics:
Total components: 3,027
Index size: 4.2 MB
FTS records: 3,027

Duration: 12.4s
Status: SUCCESS

Implementation

# Underlying script
python3 scripts/component-indexer.py [options]

# Python API
from scripts.component_indexer import ComponentIndexer
indexer = ComponentIndexer()
indexer.run(incremental=True)

Database Operations

Tables Modified

TableOperation
componentsINSERT/UPDATE component records
capabilitiesINSERT capabilities
triggersINSERT triggers
component_relationshipsINSERT relationships
component_searchFTS5 index sync

Index Integrity

The indexer maintains:

  • Content hashes for change detection
  • Timestamps for audit trail
  • Referential integrity between tables
  • FTS index synchronization

Scheduling

Automatic Indexing

Configure in ~/.coditect/config/config.json:

{
"component_index": {
"auto_index": true,
"schedule": "0 */6 * * *",
"mode": "incremental"
}
}

Git Hook Integration

Add to .git/hooks/post-commit:

#!/bin/bash
python3 ~/.coditect/scripts/component-indexer.py --incremental

Error Handling

Common Errors

ErrorCauseFix
database is lockedConcurrent accessWait and retry
no such tableMissing schema--full rebuild
FTS integrity errorCorrupt FTS--rebuild-fts
UNIQUE constraintDuplicate IDCheck for duplicates

Recovery

# Backup first (ADR-118: platform.db is Tier 1 - component data)
cp ~/PROJECTS/.coditect-data/context-storage/platform.db platform.db.bak

# Full rebuild
/component-index --full

# If still failing, delete and recreate
rm ~/PROJECTS/.coditect-data/context-storage/platform.db
/component-index --full
CommandPurpose
/component-searchSearch indexed components
/component-statsView index statistics
/component-validateValidate component files
/component-activateActivate component loading

Script: scripts/component-indexer.py Database (ADR-118): ~/PROJECTS/.coditect-data/context-storage/platform.db (Tier 1 - component data)