Synchronizes Knowledge Graph, tasks, and codebase for a spec folder to maintain context quality post-implementation. Supports --update-kg-only, --task, and --dry-run flags.
From developer-kitnpx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit[ spec-folder ] [--update-kg-only] [--task=TASK-XXX] [--dry-run]inheritspecs/Maintains the quality and consistency of specification context by synchronizing Knowledge Graph, Tasks, and Codebase.
This command solves three main problems in the specification workflow:
Idea → Specs → Tasks → Implementation → Specs Quality Update (this)
↑ ↓ ↓
└─────────────────────────────────────┘
Continuously sync context
# Basic usage - update context for a spec folder
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/
# Update KG only (used by spec-to-tasks after codebase analysis)
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/ --update-kg-only
# Update after task completion (used by task-implementation)
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/ --task=TASK-001
# Dry run - show what would be changed without making changes
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/ --dry-run
| Argument | Required | Description |
|---|---|---|
spec-folder | No | Path to spec folder (default: current working directory) |
--update-kg-only | No | Only update Knowledge Graph, skip task enrichment |
--task | No | Update context after specific task completion |
--dry-run | No | Show planned changes without executing them |
Goal: Identify spec folder and gather current context state
Actions:
spec-folder path--update-kg-only, --task=TASK-XXX, --dry-runknowledge-graph.json existstasks/ directoryuser-request.md if existsGoal: Identify discrepancies between KG, tasks, and actual codebase
Actions:
Knowledge Graph vs Codebase:
Tasks vs Knowledge Graph:
Requirements Traceability:
Generate gap report:
## Gap Analysis Report
### Missing in KG
- NewFile.java (discovered in codebase)
### Outdated in KG
- OldComponent.java (file removed)
### Tasks Needing Update
- TASK-003: References outdated pattern
- TASK-007: Missing technical context
### Orphaned Requirements
- User request mentions "X" but no task covers it
Goal: Extract structured information from implemented code
Actions:
If --task=TASK-XXX specified:
provides section or Files to CreateIf no specific task:
Extract symbols from files:
class|interface|enum declarationsclass|interface|function|const declarationsclass|def declarationsClassify by type:
/domain/entity/ → entity@RestController → controllerBuild provides objects:
{
"task_id": "TASK-001",
"file": "src/main/java/.../Search.java",
"symbols": ["Search", "SearchStatus"],
"type": "entity",
"implemented_at": "2026-03-15T10:30:00Z"
}
Goal: Update knowledge-graph.json with new findings
Actions:
Load existing KG (or create new structure):
{
"metadata": {
"spec_id": "...",
"feature_name": "...",
"created_at": "...",
"updated_at": "2026-03-15T...",
"version": "1.0",
"analysis_sources": [...]
},
"codebase_context": {...},
"patterns": {...},
"components": {...},
"provides": [...],
"apis": {...},
"integration_points": [...]
}
Update provides array:
implemented_at for existing entriesUpdate components (if new discovered):
Update APIs (if new endpoints discovered):
Update metadata:
updated_at to current ISO timestampanalysis_sources: {"agent": "spec-quality", "timestamp": "..."}Write updated KG:
--dry-run: Show diff instead of writingdocs/specs/[ID]/knowledge-graph.jsonGoal: Update task files with improved technical context
Skip if: --update-kg-only flag is set
Actions:
Identify tasks needing update (from Phase 2 gap analysis)
For each task file:
Enrich technical context with KG data:
Update provides section (if task was implemented):
provides: array in frontmatterPreserve manual content:
Write updated task file:
--dry-run: Show proposed changesGoal: Detect drift between specification and implemented reality
Actions:
Resolve and read the spec file (YYYY-MM-DD--feature-name.md preferred, legacy *-specs.md supported):
Read decision-log.md if exists:
Read completed tasks:
Compare and identify drift:
Generate drift report:
/devkit.spec-sync [spec-folder] to update specification."Goal: Generate summary of all changes made
Actions:
Generate change summary:
## Specs Quality Update Summary
**Spec**: docs/specs/[ID]/
**Timestamp**: [ISO timestamp]
**Mode**: [full|kg-only|task=TASK-XXX|dry-run]
### Knowledge Graph Updates
- Added 3 new provides entries
- Updated 2 existing entries
- Verified 15 components
### Task Updates
- Enriched TASK-001 technical context
- Enriched TASK-003 technical context
- Added provides to TASK-007
### Gap Analysis Results
- All requirements covered
- Technical context synchronized
### Files Modified
- knowledge-graph.json
- tasks/TASK-001.md
- tasks/TASK-003.md
If dry-run mode: Include detailed diff preview
Present report to user
Add to spec-to-tasks Phase 3.5 (after Codebase Analysis):
## Phase 3.5: Update Knowledge Graph
After codebase analysis completes, automatically update KG:
/developer-kit:devkit.spec-quality [spec-folder] --update-kg-only
This persists agent discoveries into knowledge-graph.json for future reuse.
Add to task-implementation, after T-6 (Task Completion):
## T-6.5: Update Specs Quality
After task completion and verification, update spec context:
/developer-kit:devkit.spec-quality [spec-folder] --task=[TASK-ID]
This updates:
- Knowledge Graph with new provides entries
- Task file with implementation details
- Technical context for dependent tasks
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/
Output:
Analyzing spec folder: docs/specs/001-hotel-search-aggregation/
Found knowledge-graph.json (3 days old)
Found 10 task files
Gap Analysis:
- 2 new components discovered
- 1 task needs technical context update
Updating Knowledge Graph...
✓ Added 2 provides entries
✓ Updated metadata
Updating Tasks...
✓ Enriched TASK-003 technical context
Summary:
- KG updated: 3 days ago → now
- Tasks enriched: 1
- Files modified: 2
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/ --dry-run
Shows what would change without applying changes.
/developer-kit:devkit.spec-quality docs/specs/001-hotel-search-aggregation/ --task=TASK-001
Updates KG with provides from TASK-001 and enriches related tasks.
Maintain todo list:
[ ] Phase 1: Discovery
[ ] Phase 2: Gap Analysis
[ ] Phase 3: Extraction
[ ] Phase 4: Knowledge Graph Update
[ ] Phase 5: Task Enrichment (skipped if --update-kg-only)
[ ] Phase 6: Report Generation