description: Maintain registry quality through dependency validation and consistency checks tags:
Purpose: Maintain registry quality through dependency validation and consistency checks
Audience: Contributors, maintainers, CI/CD processes
Golden Rule: All component dependencies must be declared in frontmatter and validated before commits.
Critical Commands:
# Check context file dependencies
/check-context-deps
# Auto-fix missing dependencies
/check-context-deps --fix
# Validate entire registry
./scripts/registry/validate-registry.sh
# Update registry after changes
./scripts/registry/auto-detect-components.sh --auto-add
Components can depend on other components using the type:id format:
| Type | Format | Example | Description |
|---|---|---|---|
| agent | agent:id |
agent:opencoder |
Core agent profile |
| subagent | subagent:id |
subagent:coder-agent |
Delegatable subagent |
| command | command:id |
command:context |
Slash command |
| tool | tool:id |
tool:gemini |
External tool integration |
| plugin | plugin:id |
plugin:context |
Plugin component |
| context | context:path |
context:core/standards/code |
Context file |
| config | config:id |
config:defaults |
Configuration file |
In component frontmatter (example):
id: opencoder
name: OpenCoder
description: Multi-language implementation agent
dependencies:
- subagent:task-manager # Can delegate to task-manager
- subagent:coder-agent # Can delegate to coder-agent
- subagent:tester # Can delegate to tester
- context:core/standards/code # Requires code standards context
Why declare dependencies?
Agents reference context files in their prompts but often don't declare them as dependencies:
<!-- In agent prompt -->
BEFORE any code implementation, ALWAYS load:
- Code tasks → .opencode/context/core/standards/code-quality.md (MANDATORY)
Without dependency declaration:
Declare context dependencies in frontmatter (example):
id: opencoder
dependencies:
- context:core/standards/code # ← ADD THIS
Use /check-context-deps to find missing declarations:
# Analyze all agents
/check-context-deps
# Auto-fix missing context dependencies
/check-context-deps --fix
Path normalization:
File path: .opencode/context/core/standards/code-quality.md
Dependency: context:core/standards/code
^^^^^^^ ^^^^^^^^^^^^^^^^^^^
type path (no .opencode/, no .md)
Examples:
dependencies:
- context:core/standards/code # .opencode/context/core/standards/code-quality.md
- context:core/standards/docs # .opencode/context/core/standards/documentation.md
- context:core/workflows/delegation # .opencode/context/core/workflows/task-delegation.md
- context:openagents-repo/guides/adding-agent # Project-specific context
Before committing changes to agents, commands, or context files:
Check context dependencies:
/check-context-deps
Fix missing dependencies (if needed):
/check-context-deps --fix
context: dependencies to frontmatterUpdate registry:
./scripts/registry/auto-detect-components.sh --auto-add
Validate registry:
./scripts/registry/validate-registry.sh
/check-context-deps CommandPurpose: Analyze context file usage and validate dependencies
What it checks:
Usage:
# Full analysis
/check-context-deps
# Specific agent
/check-context-deps opencoder
# Auto-fix
/check-context-deps --fix
# Verbose (show line numbers)
/check-context-deps --verbose
Example output:
# Context Dependency Analysis Report
## Summary
- Agents scanned: 25
- Context files referenced: 12
- Missing dependencies: 8
- Unused context files: 2
## Missing Dependencies
### opencoder
Uses but not declared:
- context:core/standards/code (referenced 3 times)
- Line 64: "Code tasks → .opencode/context/core/standards/code-quality.md"
Recommended fix:
dependencies:
- context:core/standards/code
auto-detect-components.sh ScriptPurpose: Scan for new components and update registry
Dependency validation:
Usage:
# See what would be added
./scripts/registry/auto-detect-components.sh --dry-run
# Add new components
./scripts/registry/auto-detect-components.sh --auto-add
Example warning:
⚠ New command: Demo (demo)
Dependencies: subagent:coder-agent,subagent:missing-agent
⚠ Dependency not found in registry: subagent:missing-agent
validate-registry.sh ScriptPurpose: Comprehensive registry validation
Checks:
Usage:
./scripts/registry/validate-registry.sh
Example output:
Validating registry.json...
✗ Dependency not found: opencoder → context:core/standards/code
Missing dependencies: 1
- opencoder (agent) → context:core/standards/code
Fix: Add missing component to registry or remove from dependencies
A high-quality registry has:
✅ Complete dependencies: All component dependencies declared
✅ Validated dependencies: All dependencies exist in registry
✅ No orphans: All context files used by at least one component
✅ Consistent format: Dependencies use type:id format
✅ Up-to-date: Registry reflects current component state
✅ No broken paths: All component paths valid
DO:
type:idDON'T:
1. Add component with proper frontmatter (example):
id: my-agent
name: My Agent
description: Does something useful
tags:
- development
- coding
dependencies:
- subagent:coder-agent
- context:core/standards/code
2. Validate dependencies:
/check-context-deps my-agent
3. Update registry:
./scripts/registry/auto-detect-components.sh --auto-add
4. Validate registry:
./scripts/registry/validate-registry.sh
5. Commit with descriptive message:
git add .opencode/agent/my-agent.md registry.json
git commit -m "Add my-agent with coder-agent and code standards dependencies"
1. Check which agents depend on it:
jq '.components[] | .[] | select(.dependencies[]? | contains("context:core/standards/code")) | {id, name}' registry.json
2. Update context file:
# Make your changes
vim .opencode/context/core/standards/code-quality.md
3. Validate no broken references:
/check-context-deps --verbose
4. Update registry if needed:
./scripts/registry/auto-detect-components.sh --auto-add
5. Commit with impact note:
git commit -m "Update code standards - affects opencoder, openagent, reviewer"
1. Check dependencies first:
# Find what depends on this component
jq '.components[] | .[] | select(.dependencies[]? == "subagent:old-agent") | {id, name}' registry.json
2. Remove from dependents:
# Update agents that depend on it
# Remove the dependency from their frontmatter
3. Delete component:
rm .opencode/agent/subagents/old-agent.md
4. Update registry:
./scripts/registry/auto-detect-components.sh --auto-add
5. Validate:
./scripts/registry/validate-registry.sh
Symptom:
/check-context-deps reports:
opencoder: missing context:core/standards/code
Fix:
# Option 1: Auto-fix
/check-context-deps --fix
# Option 2: Manual fix
# Edit .opencode/agent/core/opencoder.md
# Add to frontmatter:
dependencies:
- context:core/standards/code
# Then update registry
./scripts/registry/auto-detect-components.sh --auto-add
Symptom:
⚠ Dependency not found in registry: context:core/standards/code
Causes:
Fix:
# Check if file exists
ls -la .opencode/context/core/standards/code-quality.md
# If exists, add to registry
./scripts/registry/auto-detect-components.sh --auto-add
# If doesn't exist, remove dependency or create file
Symptom:
/check-context-deps reports:
Unused: context:core/standards/analysis (0 references)
Fix:
# Option 1: Add to an agent that should use it
# Edit agent frontmatter to add dependency
# Option 2: Remove if truly unused
rm .opencode/context/core/standards/code-analysis.md
./scripts/registry/auto-detect-components.sh --auto-add
Symptom:
Agent A depends on Agent B
Agent B depends on Agent A
Fix:
#!/bin/bash
# .git/hooks/pre-commit
echo "Validating registry dependencies..."
# Check context dependencies
/check-context-deps || {
echo "❌ Context dependency validation failed"
echo "Run: /check-context-deps --fix"
exit 1
}
# Validate registry
./scripts/registry/validate-registry.sh || {
echo "❌ Registry validation failed"
exit 1
}
echo "✅ Registry validation passed"
name: Validate Registry
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate registry
run: ./scripts/registry/validate-registry.sh
- name: Check context dependencies
run: /check-context-deps
/check-context-deps before committing.opencode/context/openagents-repo/guides/updating-registry.md.opencode/context/openagents-repo/core-concepts/registry.md.opencode/context/openagents-repo/guides/adding-agent.md/check-context-deps commandKey Takeaways:
/check-context-deps to find missing context dependenciestype:idQuality Checklist:
Remember: Dependencies are documentation. They help users understand what components need and help the system validate integrity.