---
Updates steering context documentation incrementally based on detected code changes.
/plugin marketplace add varaku1012/aditi.code/plugin install steering-context-generator@aditi-code-pluginsEfficiently update your steering context documentation when code changes.
/steering-update
The system will:
The system uses Git (if available) or file timestamps to detect changes:
# Check last generation time
LAST_GEN=$(jq -r '.last_run' .claude/memory/orchestration/state.json)
# Detect changes via Git
git diff --name-only $LAST_GEN..HEAD
# Or via file timestamps
find . -newer .claude/steering/ARCHITECTURE.md -type f
Changed files are mapped to affected domains:
| Files Changed | Affected Domains | Agents to Run |
|---|---|---|
*.tsx, *.jsx | UI Components | ui-specialist |
app/api/*.ts | API Routes | api-design-analyst |
prisma/schema.prisma | Database | database-analyst |
*.test.ts | Testing | test-strategist |
lib/events/*.ts | Messaging | messaging-architect |
Only affected agents run:
Changes:
ā UI: 4 files modified
ā API: 6 files changed
ā Database: 2 schema updates
Running agents:
ā³ ui-specialist (updating UI_DESIGN_SYSTEM.md)
ā³ api-design-analyst (updating API_DESIGN_GUIDE.md)
ā³ database-analyst (updating DATABASE_CONTEXT.md)
Updated sections are merged with existing documents:
Before:
UI_DESIGN_SYSTEM.md (203 KB, 45 components)
Changes:
+ 2 new components
~ 3 modified components
After:
UI_DESIGN_SYSTEM.md (237 KB, 47 components)
# Load last generation timestamp
LAST_RUN=$(jq -r '.last_run' .claude/memory/orchestration/state.json)
if [ "$LAST_RUN" == "null" ]; then
echo "ā No previous generation found. Run /steering-generate first."
exit 1
fi
# Detect changed files
echo "š Detecting changes since $LAST_RUN..."
if git rev-parse --git-dir > /dev/null 2>&1; then
# Use Git if available
CHANGED_FILES=$(git diff --name-only $LAST_RUN..HEAD)
else
# Use file timestamps
CHANGED_FILES=$(find . -newer .claude/steering/ARCHITECTURE.md -type f \
-not -path "*/node_modules/*" \
-not -path "*/.git/*")
fi
if [ -z "$CHANGED_FILES" ]; then
echo "ā No changes detected. Context is up-to-date."
exit 0
fi
echo "Found $(echo "$CHANGED_FILES" | wc -l) changed files"
# Categorize changes
UI_CHANGES=$(echo "$CHANGED_FILES" | grep -E '\.(tsx|jsx|css|scss)$' | wc -l)
API_CHANGES=$(echo "$CHANGED_FILES" | grep -E 'api/.*\.(ts|js)$' | wc -l)
DB_CHANGES=$(echo "$CHANGED_FILES" | grep -E '(schema|migration)' | wc -l)
TEST_CHANGES=$(echo "$CHANGED_FILES" | grep -E '\.(test|spec)\.' | wc -l)
echo "Change analysis:"
echo " UI components: $UI_CHANGES files"
echo " API routes: $API_CHANGES files"
echo " Database: $DB_CHANGES files"
echo " Tests: $TEST_CHANGES files"
AGENTS_TO_RUN=()
if [ $UI_CHANGES -gt 0 ]; then
AGENTS_TO_RUN+=("ui-specialist")
fi
if [ $API_CHANGES -gt 0 ]; then
AGENTS_TO_RUN+=("api-design-analyst")
fi
if [ $DB_CHANGES -gt 0 ]; then
AGENTS_TO_RUN+=("database-analyst")
fi
if [ $TEST_CHANGES -gt 0 ]; then
AGENTS_TO_RUN+=("test-strategist")
fi
# Always run quality auditor for affected areas
AGENTS_TO_RUN+=("quality-auditor")
echo "Selected agents: ${AGENTS_TO_RUN[@]}"
Use the Task tool to run selected agents:
For UI changes - Invoke ui-specialist:
Update UI_DESIGN_SYSTEM.md with new/modified components
Focus only on changed files: $UI_CHANGED_FILES
Merge with existing: .claude/memory/ui/
For API changes - Invoke api-design-analyst:
Update API_DESIGN_GUIDE.md with new/modified endpoints
Focus only on changed files: $API_CHANGED_FILES
Merge with existing: .claude/memory/api-design/
For Database changes - Invoke database-analyst:
Update DATABASE_CONTEXT.md with schema changes
Focus only on migrations/schema: $DB_CHANGED_FILES
Merge with existing: .claude/memory/database/
For Test changes - Invoke test-strategist:
Update TESTING_GUIDE.md with new test patterns
Focus only on changed tests: $TEST_CHANGED_FILES
Merge with existing: .claude/memory/testing/
# Validate updated documents
bash scripts/validate.sh
# Update architecture document with changes
# (context-synthesizer runs lightweight merge)
# Update state
cat > .claude/memory/orchestration/state.json << EOF
{
"phase": "ready",
"timestamp": "$(date -Iseconds)",
"initialized": true,
"last_run": "$(date -Iseconds)",
"last_update": "$(date -Iseconds)",
"agents_status": {
$(for agent in "${AGENTS_TO_RUN[@]}"; do
echo "\"$agent\": \"updated\","
done | sed '$ s/,$//')
}
}
EOF
echo "ā
Update complete!"
echo ""
echo "Updated Files:"
for agent in "${AGENTS_TO_RUN[@]}"; do
case $agent in
ui-specialist)
echo " ā» UI_DESIGN_SYSTEM.md (+${UI_CHANGES} changes)"
;;
api-design-analyst)
echo " ā» API_DESIGN_GUIDE.md (+${API_CHANGES} changes)"
;;
database-analyst)
echo " ā» DATABASE_CONTEXT.md (+${DB_CHANGES} changes)"
;;
test-strategist)
echo " ā» TESTING_GUIDE.md (+${TEST_CHANGES} changes)"
;;
quality-auditor)
echo " ā» QUALITY_REPORT.md (revalidated)"
;;
esac
done
echo ""
echo "Time saved vs full regeneration: ~$(echo "$((45 - 8))" minutes)"
echo "Tokens used: ~18,000 (vs ~145,000 full)"
š Checking for changes since last generation...
Last Generated: 2025-11-01 15:30:45 (1 day ago)
Changes Detected (git diff):
Modified: 12 files
Added: 3 files
Deleted: 1 file
Change Analysis:
UI components: 4 files
API routes: 6 files
Database schema: 2 files
Selected Agents:
ā ui-specialist
ā api-design-analyst
ā database-analyst
ā quality-auditor
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Running Incremental Analysis:
ā³ ui-specialist: Updating UI_DESIGN_SYSTEM.md...
ā³ api-design-analyst: Updating API_DESIGN_GUIDE.md...
ā³ database-analyst: Updating DATABASE_CONTEXT.md...
ā³ quality-auditor: Revalidating affected areas...
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
Update complete! (8 minutes)
Updated Files:
ā» UI_DESIGN_SYSTEM.md (+34 KB, 2 new components)
ā» API_DESIGN_GUIDE.md (+12 KB, 3 endpoints modified)
ā» DATABASE_CONTEXT.md (+8 KB, 1 table added)
ā ARCHITECTURE.md (revalidated)
ā QUALITY_REPORT.md (revalidated)
Performance:
Time: 8 minutes (vs 45 full)
Time saved: 37 minutes (82% faster)
Tokens: ~18,000 (vs ~145,000 full)
Efficiency: 87% token savings
Next Steps:
/steering-status - View updated context
Set minimum changes to trigger update:
// .claude/steering/config.json
{
"update_threshold": 5 // Minimum files changed
}
Skip incremental and force full regeneration:
/steering-generate --force
Update only specific domains:
# Update only UI (not yet implemented - use config)
{
"update_domains": ["ui"]
}
Causes:
Solutions:
# Check excluded patterns
cat .claude/steering/config.json | jq '.excluded_patterns'
# Force full regeneration
/steering-generate --force
# Update excluded patterns if needed
If updates conflict with manual edits:
Option 1: Backup and regenerate
cp .claude/steering/ARCHITECTURE.md .claude/steering/ARCHITECTURE.md.backup
/steering-update
# Manually merge if needed
Option 2: Force full regeneration
/steering-generate --force
Check agent status:
cat .claude/memory/orchestration/state.json | jq '.agents_status'
Retry specific agent:
# Run agent manually with Task tool
When to Use Update:
When to Use Full Regeneration:
Update Frequency:
Set up Git hooks for automatic updates:
# .git/hooks/post-commit
#!/bin/bash
if [ -f ".claude/steering/config.json" ]; then
/steering-update
fi
Add to CI pipeline:
# .github/workflows/update-context.yml
name: Update Steering Context
on:
push:
branches: [main]
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Context
run: claude /steering-update
Compare before/after:
# Before update
cp .claude/steering/ARCHITECTURE.md /tmp/arch-before.md
# Run update
/steering-update
# Compare
diff /tmp/arch-before.md .claude/steering/ARCHITECTURE.md
Typical incremental update performance:
| Changes | Time | Tokens | vs Full |
|---|---|---|---|
| 1-5 files | 3-5 min | 5K | 90% faster |
| 6-15 files | 5-8 min | 15K | 82% faster |
| 16-30 files | 8-12 min | 25K | 73% faster |
| 31-50 files | 12-20 min | 40K | 56% faster |
| 50+ files | Consider full regeneration | - | - |
Keep your context fresh: Run /steering-update regularly!