Purpose: Define all reference types that agents and skills can have within the repository, and how they're detected.
Status: Phase 3, Task T018 — Documentation of reference detection patterns
References are paths or identifiers that point to agents, skills, or workflows. They appear in multiple contexts and need to be detected, validated, and fixed when agents are renamed or restructured.
Context: Node.js scripts that import agents or skills using CommonJS or ES modules
Detection Pattern:
// CommonJS
require('agents/my-agent')
require('./agents/my-agent')
// ES Modules
import Agent from 'agents/my-agent'
import { helper } from 'agents/my-agent/utils'
// Dynamic imports
import('agents/' + agentName)
await import('agents/my-agent')Severity When Broken: CRITICAL
- Missing imports cause immediate module not found errors
- Breaks dependent scripts at runtime
- Often discovered only during CI/execution
Locations:
.js,.cjs,.mjsfiles in any directory- Especially common in:
scripts/(orchestration).github/scripts/(automation)agents/*/tests/(test files).github/agentic-workflows/(agent workflows)
Examples of Broken States:
// ❌ Agent was renamed from 'issue-agent' to 'issue-triage-agent'
const issueAgent = require('agents/issue-agent') // BROKEN
// ✅ Corrected
const issueAgent = require('agents/issue-triage-agent') // FIXEDContext: Bash/Shell scripts that execute scripts or reference agent folders
Detection Pattern:
# Direct path references
./agents/my-agent/tests/test.sh
$SCRIPT_DIR/agents/my-agent
# Variable references
AGENT_PATH="agents/my-agent"
# Command references
npm run agent:my-agent
node agents/my-agent/index.jsSeverity When Broken: HIGH
- Scripts fail to execute or find dependencies
- Causes CI/CD pipeline failures
- Difficult to debug without running scripts
Locations:
.sh,.bashfiles- Especially in:
.github/scripts/(GitHub automation)scripts/(build and deployment scripts).github/workflows/(inline shell steps)hooks/(git hooks)
Examples of Broken States:
# ❌ Agent was renamed
bash agents/old-agent/run.sh # BROKEN: old-agent no longer exists
# ✅ Corrected
bash agents/new-agent/run.sh # FIXEDContext: GitHub Actions workflows that reference agents as reusable actions
Detection Pattern:
# Composite action reference
- uses: lightspeedwp/.github/agents/my-agent@main
- uses: ./agents/my-agent
# With parameters
- uses: lightspeedwp/.github/agents/my-agent@v1
with:
input-param: valueSeverity When Broken: CRITICAL
- Workflow fails at the step that references the missing agent
- Blocks entire CI/CD pipeline
- Visible immediately in GitHub Actions UI
Locations:
.github/workflows/*.ymlfiles- Composite action definitions in
agents/*/action.yml
Examples of Broken States:
# ❌ Agent was moved or renamed
- uses: lightspeedwp/.github/agents/old-name@main # BROKEN
# ✅ Corrected
- uses: lightspeedwp/.github/agents/new-name@main # FIXEDContext: Inline shell commands in workflows that invoke agents or scripts
Detection Pattern:
- run: npm run agent:my-agent
- run: node agents/my-agent/index.js
- run: bash scripts/run-agent.sh agents/my-agentSeverity When Broken: HIGH
- Command execution fails with "not found" error
- Blocks that specific workflow step
- May not fail entire workflow (depends on continue-on-error)
Locations:
.github/workflows/*.ymlfilesrun:clauses in steps
Examples of Broken States:
# ❌ npm script references missing agent
- run: npm run agent:renamed-agent # BROKEN if agent was renamed
# ✅ Corrected
- run: npm run agent:new-name # FIXEDContext: References to skills from within agents or other scripts
Detection Pattern:
// Relative imports in agent code
const validation = require('../skills/validation-skill')
import { check } from './skills/audit-skill'
// Absolute imports
const { process } = require('skills/data-processing')Severity When Broken: HIGH
- Agent loses functionality when skill is missing
- May cause partial failures (depending on where skill is used)
Locations:
- Agent implementation files
- Shared scripts that use skills
- Integration layers
Context: Configuration files that point to agents or scripts
Detection Pattern:
{
"agents": ["agents/my-agent", "agents/other-agent"],
"scripts": ["scripts/setup.sh"],
"workflows": [".github/workflows/main.yml"]
}Severity When Broken: MEDIUM
- Application may not load agents or scripts
- Configuration validation fails
- May have fallbacks
Locations:
.github/specs/014-agents-restructure-consolidate/config.jsonscripts/validation/config.json- Application config files
For each file in the repository:
- Determine file type (
.js,.sh,.yml,.json, etc.) - Load file content
- Apply appropriate detection patterns for that file type
For each detected reference:
- Normalize the reference (remove
./, extensions, etc.) - Classify as agent, skill, or workflow reference
- Record location and context
Check if each reference target exists:
- Build index of valid agents (from
agents/folder) - Build index of valid skills (from
agents/*/skills/andskills/) - Compare detected references against indexes
For each broken reference:
- Record severity level
- Document file and location
- Suggest fix based on fuzzy matching or user input
| Severity | Definition | Impact | Examples |
|---|---|---|---|
| CRITICAL | Reference is core to operation; failure is immediate | Program crash, CI block | JS imports in core scripts, workflow uses: |
| HIGH | Reference is important; failure causes workflow issues | CI failure, missing functionality | Shell paths in automation, workflow run: |
| MEDIUM | Reference is useful but may have fallbacks | Partial functionality loss | Config references, optional imports |
| LOW | Reference is informational; failure is non-blocking | Informational only | Comments, documentation references |
| INFO | Reference is valid but may need attention | No immediate impact | Deprecation notices, migration reminders |
When an agent is renamed from old-name to new-name:
- All imports must change:
agents/old-name→agents/new-name - All path references must change
- All workflow invocations must change
- Configuration files must update
When an agent moves from one folder to another:
- Relative import paths break (e.g.,
../skillsmay need to become../../skills) - Absolute paths may need adjustment
- Workflow references may need scope updates
When skills are renamed or consolidated:
- Agent imports must be updated
- Skill registries must be regenerated
- Cross-agent dependencies must be verified
- Update require/import statements
- Verify paths are correct
- Run
npm testto verify
- Update hardcoded paths
- Test script execution locally
- Verify in CI
- Update
uses:lines - Update
run:commands - Re-run workflow to verify
- Update config files
- Validate against schema
- Test application startup
Automated Detection:
scripts/validation/lib/reference-detector.js— Detects all reference typesscripts/validation/audit-agents.js— Runs audit with broken-refs subcommand
Manual Verification:
- Use
grepto find references:grep -r "agents/old-name" . - Use IDE search to find imports
- Review git diff when renaming agents
- BROKEN_REFERENCE_REMEDIATION.md — Fix process
- scripts/validation/lib/reference-detector.js — Detection implementation
- spec.md — US1 specification