Skip to main content

/component-lifecycle

Unified command for the complete component lifecycle: create, improve, index, activate, and capture context in a single operation.

Purpose

Combines five separate operations into one atomic workflow:

/component-create + /component-improvement + /component-index + /component-activate + /cx

Usage

# Create new component with full lifecycle
/component-lifecycle agent my-new-agent "Description of agent"

# Create and process existing component
/component-lifecycle skill existing-skill --existing

# Full lifecycle with all options
/component-lifecycle command my-command "Command description" --commit --push

# Using aliases
/cl agent data-processor "Processes data files"
/component-full hook pre-commit-validator "Validates commits"

# Skip specific phases
/component-lifecycle agent test-agent "Test" --skip-improve
/component-lifecycle skill test-skill --existing --skip-cx

# Dry run (preview all phases)
/component-lifecycle agent test-agent "Test" --dry-run

# === MIGRATION / RELOCATION ===

# Migrate a component to another repo (creates stubs + moves code)
/component-lifecycle skill pdf-to-markdown --migrate --to coditect-research-continuum

# Migrate multiple components at once
/component-lifecycle --migrate --batch skill:pdf-to-markdown,command:pdf-to-markdown,command:udom-navigator --to coditect-research-continuum

# Deprecate a component (stub only, no target repo)
/component-lifecycle agent old-agent --deprecate --reason "Superseded by new-agent"

# Dry run migration (preview stubs and moves)
/component-lifecycle skill pdf-to-markdown --migrate --to coditect-research-continuum --dry-run

Arguments

ArgumentTypeRequiredDescription
typestringYesComponent type: agent, skill, command, hook, script, workflow, standard
namestringYesComponent name (kebab-case)
descriptionstringNoComponent description (for new components)

Options

OptionShortDefaultDescription
--existing-efalseProcess existing component (skip create)
--skip-createfalseSkip creation phase
--skip-improvefalseSkip improvement phase
--skip-indexfalseSkip indexing phase
--skip-activatefalseSkip activation phase
--skip-cxfalseSkip context capture
--commit-cfalseGit commit after completion
--push-pfalsePush to remote (requires --commit)
--dry-run-nfalsePreview all phases without executing
--verbose-vfalseShow detailed output for each phase
--task-id-tNoneTask ID for tracking (e.g., F.3.1)
--migrate-mfalseMigrate component to another repo (creates stubs)
--deprecatefalseDeprecate component (stub only, no target)
--toNoneTarget repo for migration (e.g., coditect-research-continuum)
--reasonNoneReason for deprecation/migration
--batchNoneComma-separated list of type:name pairs for batch migration
--keep-sourcefalseKeep source files after migration (don't delete)

Lifecycle Phases

Phase 1: CREATE

Condition: New component (not --existing)

Actions:

  1. Generate component from template
  2. Apply YAML frontmatter
  3. Create directory structure (for skills)
  4. Set initial metadata

Script: scripts/component-create.sh

# Equivalent to:
/component-create <type> <name> "<description>"

Phase 2: IMPROVE

Condition: Always (unless --skip-improve)

Actions:

  1. Analyze component quality (component-analyzer)
  2. Identify missing sections
  3. Apply enhancements (component-enhancer)
  4. Validate with MoE classifier
  5. Update frontmatter confidence

Agents: component-analyzer, component-enhancer

# Equivalent to:
/agent component-analyzer "Analyze <path>"
/agent component-enhancer "Enhance <path>"

Phase 3: INDEX

Condition: Always (unless --skip-index)

Actions:

  1. Add to component database (platform.db)
  2. Generate embeddings
  3. Update FTS5 search index
  4. Register capabilities
  5. Update component counts

Script: scripts/component-indexer.py -i

# Equivalent to:
python3 scripts/component-indexer.py -i
python3 scripts/update-component-counts.py

Phase 4: ACTIVATE

Condition: Always (unless --skip-activate)

Actions:

  1. Register in component registry
  2. Enable runtime loading
  3. Verify activation
  4. Update activation status

Script: scripts/core/ensure_component_registered.py

# Equivalent to:
/component-activate <path>
python3 scripts/core/ensure_component_registered.py <path>

Phase 5: CONTEXT

Condition: Always (unless --skip-cx)

Actions:

  1. Extract session context
  2. Save component creation metadata
  3. Update unified_messages.jsonl
  4. Generate embeddings for searchability

Command: /cx

# Equivalent to:
/cx --with-component-metadata

Phase 6: MIGRATE

Condition: --migrate or --deprecate flag

Actions:

  1. Inventory all component files in source repo (skill, command, hook, agent, script, workflow)
  2. For each component type found: a. Copy source files to target repo (if --migrate) b. Replace source files with redirect stubs c. Update registries (framework-registry.json, component-activation-status.json) d. Update component counts
  3. Log migration in session log with full file manifest

Stub Types Created:

Component TypeStub LocationStub Content
Skillskills/{name}/SKILL.mdRedirect frontmatter + "Moved to {repo}"
Commandcommands/{name}.mdRedirect frontmatter + "Moved to {repo}"
Hookhooks/{name}.pyRedirect comment + passthrough
Agentagents/{name}.mdRedirect frontmatter + "Moved to {repo}"
Scriptscripts/{name}.pyRedirect comment + import bridge
Workflowworkflows/{name}.yamlRedirect metadata + "Moved to {repo}"

Stub Frontmatter Standard:

All stubs MUST include these frontmatter fields:

---
status: relocated # or "deprecated" if --deprecate
relocated_to: coditect-research-continuum # target repo name
relocated_date: 2026-02-11
relocated_path: src/pipeline/ # path within target repo
original_path: skills/pdf-to-markdown/ # original path in this repo
reason: "Product code moved to dedicated product repository"
---

Stub Body Standard:

# {Component Name}

> **This component has been relocated to [`{target-repo}`](https://github.com/coditect-ai/{target-repo}).**
>
> **New location:** `{target-repo}/{new-path}`
> **Relocated:** {date}
> **Reason:** {reason}

This stub exists so that framework discovery (skill catalog, command index, component search)
continues to find this component and directs users to its new home.

## Usage

See the [{target-repo} README](https://github.com/coditect-ai/{target-repo}) for current usage instructions.

Registry Updates:

When migrating, the following registries are updated:

RegistryChange
config/framework-registry.jsonStatus → relocated, add relocated_to field
config/component-activation-status.jsonStatus → relocated
config/component-counts.jsonDecrement active count, increment relocated count

Batch Migration:

When --batch is provided, all components are migrated atomically:

/component-lifecycle --migrate --batch \
skill:pdf-to-markdown,command:pdf-to-markdown,command:udom-navigator \
--to coditect-research-continuum --commit

This creates stubs for all 3 components in a single operation and single commit.


System Prompt

Execution Directive:

When the user invokes /component-lifecycle, execute ALL phases in sequence:

def execute_component_lifecycle(type, name, description, options):
"""Execute complete component lifecycle."""

path = get_component_path(type, name)
task_id = options.get('task_id', 'F.3.1')

# Phase 1: CREATE (unless --existing or --skip-create)
if not options.existing and not options.skip_create:
print(f"📝 Phase 1: CREATE - {type}/{name}")
create_component(type, name, description)

# Phase 2: IMPROVE (unless --skip-improve)
if not options.skip_improve:
print(f"🔧 Phase 2: IMPROVE - Analyzing and enhancing")
analyze_result = invoke_agent("component-analyzer", f"Analyze {path}")
if analyze_result.score < 80:
invoke_agent("component-enhancer", f"Enhance {path}")

# Phase 3: INDEX (unless --skip-index)
if not options.skip_index:
print(f"📚 Phase 3: INDEX - Adding to database")
run_script("component-indexer.py", "-i")
run_script("update-component-counts.py")

# Phase 4: ACTIVATE (unless --skip-activate)
if not options.skip_activate:
print(f"⚡ Phase 4: ACTIVATE - Enabling component")
run_script("core/ensure_component_registered.py", path)

# Phase 5: CONTEXT (unless --skip-cx)
if not options.skip_cx:
print(f"💾 Phase 5: CONTEXT - Capturing to memory")
execute_command("/cx")

# Git workflow (if --commit)
if options.commit:
git_add(path)
git_commit(f"feat({type}): Add {name} via component-lifecycle")
if options.push:
git_push()

print(f"✅ COMPLETE: {type}/{name} lifecycle finished")
return success_summary()

Examples

Example 1: Create New Agent

/component-lifecycle agent data-processor "Processes and transforms data files"

Output:

📝 Phase 1: CREATE - agent/data-processor
✓ Created: agents/data-processor.md
✓ Applied template: agent-standard

🔧 Phase 2: IMPROVE - Analyzing and enhancing
✓ Quality score: 72% → 85%
✓ Added: Success Output, Completion Checklist
✓ MoE confidence: 0.92

📚 Phase 3: INDEX - Adding to database
✓ Indexed in platform.db
✓ Generated embeddings
✓ Component count: 2,335

⚡ Phase 4: ACTIVATE - Enabling component
✓ Registered in component_registry
✓ Activation verified

💾 Phase 5: CONTEXT - Capturing to memory
✓ Session context saved
✓ Component metadata captured

✅ COMPLETE: agent/data-processor lifecycle finished

Summary:
Component: agents/data-processor.md
Quality: 85% (Grade B)
Status: Active
Indexed: Yes
Context: Captured

Example 2: Improve Existing Skill

/component-lifecycle skill api-design-patterns --existing --commit

Output:

🔧 Phase 2: IMPROVE - Analyzing and enhancing
✓ Quality score: 68% → 88%
✓ Added: Anti-Patterns, When NOT to Use

📚 Phase 3: INDEX - Re-indexing
✓ Updated in platform.db

⚡ Phase 4: ACTIVATE - Verifying activation
✓ Already active

💾 Phase 5: CONTEXT - Capturing to memory
✓ Session context saved

📦 Git commit: abc1234
feat(skill): Improve api-design-patterns via component-lifecycle

✅ COMPLETE: skill/api-design-patterns lifecycle finished

Example 3: Dry Run

/component-lifecycle command new-command "Does something" --dry-run

Output:

🔍 DRY RUN: component-lifecycle

Would execute:
Phase 1: CREATE commands/new-command.md
Phase 2: IMPROVE with component-analyzer, component-enhancer
Phase 3: INDEX via component-indexer.py
Phase 4: ACTIVATE via ensure_component_registered.py
Phase 5: CONTEXT via /cx

No changes applied (dry run mode)

Component Type Paths

TypePath PatternTemplate
agentagents/<name>.mdagent-standard
skillskills/<name>/SKILL.mdskill-standard
commandcommands/<name>.mdcommand-standard
hookhooks/<name>.pyhook-standard
scriptscripts/<name>.pyscript-standard
workflowdocs/workflows/WF-<name>.mdworkflow-standard
standardcoditect-core-standards/CODITECT-STANDARD-<NAME>.mdstandard-template

Error Handling

PhaseErrorAction
CREATEComponent existsSkip or use --existing
IMPROVEScore < 60%Retry enhancement once
INDEXDatabase lockedRetry with backoff
ACTIVATERegistration failsLog and continue
CONTEXT/cx timeoutContinue without context
CommandPurpose
/component-createCreate only
/component-improveImprove only
/component-indexIndex only
/component-activateActivate only
/cxContext capture only
/component-analyzeAnalysis only

Success Criteria

Phase 1: Component file created (or exists if --existing)
Phase 2: Quality score >= 80%
Phase 3: Component in database with embeddings
Phase 4: Component registered and active
Phase 5: Context captured in unified_messages.jsonl

Completion Checklist

Before marking complete, verify:

  • Component file exists at correct path
  • YAML frontmatter valid and complete
  • Quality score >= 80% (Grade B)
  • Indexed in platform.db
  • Registered in component_registry
  • Context captured via /cx
  • Git commit created (if --commit)

Standards Compliance

  • CODITECT-STANDARD-AUTOMATION.md - Principle #5: Complete Execution Chain
  • CODITECT-STANDARD-TASK-ID-PROTOCOL.md - Task ID in operations
  • CODITECT-STANDARD-TRACK-NOMENCLATURE.md - Track F (Documentation) for docs

Changelog

VersionDateChanges
1.1.02026-02-11Phase 6: MIGRATE — component relocation with stubs, batch migration, registry updates
1.0.02026-01-23Initial unified lifecycle command

Author: Claude Opus 4.5 + Hal Casteel Owner: AZ1.AI INC