| name | speccrew-knowledge-bizs-dispatch |
| description | Dispatch bizs knowledge base generation tasks with 5-stage pipeline (XML Block version). Handles feature inventory, feature analysis with skill routing, graph data writing, module summarization, UI style pattern extraction, and system summary. |
| tools | Read, Write, Task, Bash |
⚠️ MANDATORY EXECUTION PROTOCOL — READ BEFORE EXECUTING ANY BLOCK
Step 1: Load XML workflow specification: speccrew-workspace/docs/rules/agentflow-spec.md — this defines all block types and action-to-tool mappings
Step 2: Execute this SKILL.md's XML workflow block by block in document order. For EVERY block, you MUST follow this 3-step cycle:
📋 Block [ID] (action=[action]) — [desc]
🔧 Tool: [which IDE tool to call]
✅ Result: [output or status]
Action-to-tool mapping:
action="run-script" → Execute via Terminal tool (pass the <field name="command"> value EXACTLY)
action="run-skill" → Invoke via Skill tool (pass the <field name="skill"> value EXACTLY)
action="dispatch-to-worker" → Create Task via Task tool for speccrew-task-worker (Worker loads and executes the skill, NOT you)
action="confirm" (event) → Present to user and wait for response
Step 3: Execute ALL stages sequentially without pausing (only stop at explicit <event action="confirm"> blocks)
FORBIDDEN:
- Do NOT skip the block announcement format above — every block must be announced before execution
- Do NOT run terminal commands as substitute for Skill tool calls
- Do NOT do Worker's job yourself — when
action="dispatch-to-worker", create a Task and let Worker handle it
- Do NOT skip blocks or improvise your own commands
- Do NOT read a skill's SKILL.md file yourself — use the Skill tool which resolves paths automatically
Bizs Knowledge Dispatch (XML Block Version)
Orchestrate bizs knowledge base generation with a 5-stage pipeline using XML Block system: Feature Inventory → Feature Analysis + Graph Write → Module Summarize → UI Style Pattern Extract → System Summary.
Invocation Method
CRITICAL: This skill is an orchestration playbook — it MUST be loaded directly by Team Leader via Skill tool (NOT via Worker Agent).
Correct: Leader uses Skill tool to load this playbook directly
Incorrect: Dispatch this skill to speccrew-task-worker
Why? This skill defines the orchestration workflow and prepares task plans for downstream workers. The Team Leader reads this playbook and dispatches individual worker tasks via Task tool → speccrew-task-worker for each stage.
Correct Invocation Pattern:
<block type="task" action="run-skill" desc="Leader directly invokes bizs-dispatch as orchestration playbook">
<field name="skill">speccrew-knowledge-bizs-dispatch</field>
<field name="note">Leader directly calls this dispatch skill as an orchestration playbook. The dispatch skill defines the workflow; Leader dispatches downstream workers via Task tool → speccrew-task-worker for each stage.</field>
</block>
Worker Dispatch Rule:
- Dispatch skills (bizs-dispatch, techs-dispatch): Leader calls directly via Skill tool
- Downstream worker skills (identify-entries, init-features, ui-analyze, module-summarize, etc.): Leader dispatches via Task tool → speccrew-task-worker
FORBIDDEN: Worker Agents MUST NOT execute this dispatch skill. If a Worker Agent loads this skill, it must report error and abort.
Quick Reference — Execution Flow
Stage 0: Platform Detection
└─ Detect platforms → Confirm platform list
↓
Stage 1: Feature Inventory Init
└─ 1a: Entry directory recognition (identify-entries)
└─ 1b: Feature inventory generation (init-features)
└─ 1c: Feature merge (incremental mode)
↓
Stage 2: Feature Analysis (Batch Loop)
└─ Step 0: Ensure completed_dir exists
└─ Step 1: Get next batch of pending features
└─ Step 2: Dispatch Worker for analysis (UI/API routing)
└─ Step 2.5: Dispatch Graph Worker
└─ Step 3: Process batch results → Update status
└─ Loop until all features complete
↓
Stage 3: Module Summarize
└─ Step 1: Collect all platform-module pairs in one batch
└─ Step 2: Dispatch ALL module summary Workers in ONE parallel batch across ALL platforms
↓
Stage 3.5: UI Style Pattern Extract
└─ Extract UI style patterns for frontend platforms
↓
Stage 4: System Summary
└─ Generate system-level business knowledge summary
Language Adaptation
CRITICAL: All generated documents must match the user's language. Detect the language from the user's input and pass it to all downstream Worker Agents.
- User writes in 中文 → Generate Chinese documents, pass
language: "zh" to workers
- User writes in English → Generate English documents, pass
language: "en" to workers
- User writes in other languages → Use appropriate language code
All downstream skills must receive the language parameter and generate content in that language only.
Trigger Scenarios
- "Initialize bizs knowledge base"
- "Generate business knowledge from source code"
- "Dispatch bizs knowledge generation"
- "Generate knowledge base from src/views directory"
- "Analyze this subdirectory for knowledge base"
AgentFlow Definition
REQUIRED: Before executing this workflow, read the XML workflow specification: speccrew-workspace/docs/rules/agentflow-spec.md
After reading the specification, parse the XML workflow and strictly execute each <block> in document order. Every <block type="task"> is a literal tool-call instruction — use the action attribute to determine which IDE tool to invoke, and pass the <field name="command"> or <field name="skill"> value exactly as written. Do NOT interpret the workflow as a goal description or improvise your own approach.
This skill is an ORCHESTRATION PLAYBOOK — it MUST be loaded directly by Team Leader via Skill tool
Worker Agents MUST NOT execute this dispatch skill — if loaded by a Worker, report error and abort
Downstream worker skills (identify-entries, init-features, ui-analyze, module-summarize, etc.) MUST be dispatched via Task tool → speccrew-task-worker
DO NOT ask user "Should I continue?" or "How would you like to proceed?" between stages
DO NOT offer options like "Full execution / Sample execution / Pause" — always execute ALL stages to completion
DO NOT suggest "Let me split this into batches" or "Let's do this in parts" — process ALL features sequentially
DO NOT pause to list what you plan to do next — just do it
DO NOT ask for confirmation before generating output files
DO NOT warn about "large number of files" or "this may take a while" — proceed with generation
ONLY pause at explicit <event action="confirm"> blocks defined in the workflow
DO NOT offer "continue/pause/partial" options — EVER
DO NOT estimate workload and suggest breaking it into phases — execute ALL phases in sequence
When many features need analysis, dispatch ALL of them — do NOT skip or defer any
Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance
FORBIDDEN: Python, Ruby, Perl, compiled binaries, or any runtime requiring separate installation
PERMITTED scripting: PowerShell (Windows) and Bash (Linux/Mac) ONLY
PERMITTED Node.js: ONLY for existing project scripts (e.g., node scripts/update-progress.js)
For JSON validation use: node -e "JSON.parse(require('fs').readFileSync('file.json','utf8'))"
For JSON creation use: node -e with inline script, or PowerShell ConvertTo-Json
DO NOT create temporary .py, .rb, .pl, .bat files — use inline commands via run_in_terminal
<block type="rule" id="S0-R1" level="mandatory" desc="Stage 0 mandatory rules">
<field name="text">MUST scan project directory to discover ALL platforms — NEVER hardcode a fixed number of platforms</field>
<field name="text">Missing a platform means incomplete knowledge base generation</field>
</block>
<block type="rule" id="S0-R2" level="mandatory" desc="platformId format constraints">
<field name="text">platformId MUST use format: {platformType}-{techStack}</field>
<field name="text">platformType values: web (NOT frontend), mobile, desktop, backend</field>
<field name="text">✓ Correct: backend-fastapi, web-vue3, mobile-uniapp, desktop-electron</field>
<field name="text">✗ Wrong: backend-system, frontend-web, mobile-app, frontend-vue3</field>
</block>
<!-- Step 1: Scan backend modules -->
<block type="task" id="S0-B1" action="run-script" status="pending" desc="Scan backend module directories">
<field name="command">Get-ChildItem -Path "${source_path}" -Filter "yudao-module-*" -Directory</field>
<field name="alt_command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "^(module-|service-|api-)" }</field>
<field name="output" var="backend_modules"/>
</block>
<!-- Step 2: Scan frontend projects -->
<block type="task" id="S0-B2" action="run-script" status="pending" desc="Scan frontend/UI project directories">
<field name="command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "ui|frontend|web|app" }</field>
<field name="output" var="frontend_dirs"/>
</block>
<!-- Step 3: Validate each platform -->
<block type="loop" id="S0-L1" over="${backend_modules}" as="module" desc="Validate backend modules">
<block type="gateway" id="S0-G1" mode="guard" test="${module.hasSourceCode} == true" fail-action="skip" desc="Verify module has actual source code">
<field name="message">Skipping empty directory: ${module.name}</field>
</block>
<block type="event" id="S0-E1" action="log" level="info" desc="Log backend module">
<field name="message">Discovered backend module: ${module.name} → Platform type: backend-${module.business_name}</field>
</block>
</block>
<block type="loop" id="S0-L2" over="${frontend_dirs}" as="frontend" desc="Validate frontend projects">
<block type="task" id="S0-B3" action="run-script" status="pending" desc="Check frontend project structure">
<field name="command">Test-Path "${frontend.path}/package.json"</field>
<field name="output" var="has_package_json"/>
</block>
<block type="gateway" id="S0-G2" mode="guard" test="${has_package_json} == true" fail-action="skip" desc="Verify frontend project validity">
<field name="message">Skipping non-frontend directory: ${frontend.name}</field>
</block>
<block type="event" id="S0-E2" action="log" level="info" desc="Log frontend platform">
<field name="message">Discovered frontend platform: ${frontend.name} → Tech stack: Vue/React/UniApp</field>
</block>
</block>
<!-- Step 4: Generate platform list JSON -->
<block type="task" id="S0-B4" action="run-script" status="pending" desc="Generate platforms.json from discovered modules and frontends">
<field name="command">node -e "const fs=require('fs'); const data=JSON.parse(process.argv[1]); fs.mkdirSync(process.argv[2], {recursive:true}); fs.writeFileSync(process.argv[2]+'/platforms.json', JSON.stringify(data,null,2)); console.log('platforms.json written')"</field>
<field name="note">The LLM constructs the platforms array from S0-L1 and S0-L2 discovery results, then writes it via this inline script. No external platform-detector.js is needed.</field>
<field name="arg">${platforms_json_string}</field>
<field name="arg">${sync_state_bizs_dir}</field>
<field name="output" var="platforms" from="${sync_state_bizs_dir}/platforms.json"/>
</block>
<!-- Step 5: Gate - Confirm platforms detected -->
<block type="gateway" id="S0-G3" mode="guard" test="${platforms.length} > 0" fail-action="stop" desc="Confirm at least one platform detected">
<field name="message">No platforms detected, please check source_path and platform-mapping.json</field>
</block>
<!-- Step 6: User confirmation -->
<block type="event" id="S0-E3" action="confirm" title="Confirm Platform List" type="yesno" desc="Wait for user to confirm detected platform list">
<field name="preview">
Detected ${platforms.length} platforms:
(For each platform in ${platforms}, display: ${platform.platformId}: ${sourcePath} (${platformType}/${platformSubtype}))
Continue with knowledge base generation?
User confirmed platform list, continuing
User cancelled, terminating workflow
<!-- Checkpoint: Platform detection complete -->
<block type="checkpoint" id="S0-CP1" name="platforms_detected" desc="Platform detection complete">
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
<field name="verify" value="${platforms.length} > 0"/>
</block>
<block type="task" id="S0-B5" action="run-script" status="pending" desc="Update Stage 0 progress to completed">
<field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage0 --status completed --output "Detected ${platforms.length} platforms"</field>
</block>
<block type="event" id="S0-E4" action="log" level="info" desc="Report detected platform list">
<field name="message">Detected ${platforms.length} platforms: ${platforms.names}</field>
</block>
<block type="rule" id="S1a-R1" level="mandatory" desc="Stage 1a mandatory rules">
<field name="text">ALL platform entry directory recognition tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
<field name="text">ALL Worker dispatch calls in S1a-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
</block>
<block type="loop" id="S1a-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch entry directory recognition for each platform IN PARALLEL">
<!-- Step 1: Read source directory tree -->
<block type="task" id="S1a-B1" action="dispatch-to-worker" status="pending" desc="Dispatch entry identification to Worker">
<field name="worker">speccrew-knowledge-bizs-identify-entries</field>
<field name="source_path" value="${platform.sourcePath}"/>
<field name="platform_id" value="${platform.platformId}"/>
<field name="platform_type" value="${platform.platformType}"/>
<field name="platform_subtype" value="${platform.platformSubtype}"/>
<field name="tech_identifier" value="${platform.techIdentifier}"/>
<field name="configs_dir" value="${configs_dir}"/>
<field name="output_path" value="${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json"/>
<field name="output" var="entries_${platform.platformId}"/>
</block>
<!-- Step 2: Validate entry directories -->
<block type="gateway" id="S1a-G1" mode="guard" test="${entries_${platform.platformId}.modules.length} > 0" fail-action="stop" desc="Validate entry directory recognition result">
<field name="message">Platform ${platform.platformId} did not identify any entry directories</field>
</block>
</block>
<block type="checkpoint" id="S1a-CP1" name="entry_dirs_recognized" desc="Entry directory recognition complete">
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
<field name="verify" value="true"/>
</block>
<block type="task" id="S1a-B2" action="run-script" status="pending" desc="Update Stage 1a progress to completed">
<field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1a --status completed --output "Entry directories recognized for all platforms"</field>
</block>
<block type="rule" id="S1b-R1" level="mandatory" desc="Stage 1b mandatory rules">
<field name="text">ALL platform feature inventory generation tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
<field name="text">ALL Worker dispatch calls in S1b-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
<field name="text">Worker Agents do not have run_in_terminal capability, which is required for script execution</field>
</block>
<block type="loop" id="S1b-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Generate Feature inventory for each platform IN PARALLEL">
<!-- Step 1: Dispatch Worker to generate feature inventory -->
<block type="task" id="S1b-B1" action="dispatch-to-worker" status="pending" desc="Dispatch Worker to generate feature inventory">
<field name="worker">speccrew-knowledge-bizs-init-features</field>
<field name="instructions">
Generate feature inventory for the specified platform by analyzing entry directories.
Requirements:
-
Read entry-dirs JSON file to get module entry directories
-
Scan source files in each entry directory
-
Generate features JSON with feature metadata
-
Output to features-{platformId}.json in sync_state_bizs_dir
{
"platformId": "${platform.platformId}",
"platformName": "${platform.platformName}",
"platformType": "${platform.platformType}",
"platformSubtype": "${platform.platformSubtype}",
"sourcePath": "${platform.sourcePath}",
"techIdentifier": "${platform.techIdentifier}",
"entryDirsFile": "${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json",
"outputDir": "${sync_state_bizs_dir}",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"language": "${language}"
}
<!-- Step 2: Validate Feature inventory -->
<block type="gateway" id="S1b-G1" mode="guard" test="${features_${platform.platformId}.features.length} > 0" fail-action="stop" desc="Validate Feature inventory is not empty">
<field name="message">Platform ${platform.platformId} did not generate any Features</field>
</block>
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1b --status completed --output "${feature_count} features across ${platform_count} platforms"
Feature inventory initialized. ${feature_count} features across ${platform_count} platforms.
This stage is executed DIRECTLY by the dispatch agent (Leader) via run_in_terminal, NOT delegated to a Worker Agent
node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js"
--syncStatePath
${sync_state_bizs_dir}
--completedDir
${completed_dir}
--projectRoot
${source_path}
<!-- Step 2: Report merge result -->
<block type="event" id="S1c-E1" action="log" level="info" desc="Report merge result">
<field name="message">Feature merge complete:
-
Added: ${merge_result.added}
-
Removed: ${merge_result.removed}
-
Changed: ${merge_result.changed} (reset for re-analysis)
-
Unchanged: ${merge_result.unchanged} (analysis state preserved)
<!-- Step 3: Mark stale Features -->
<block type="task" id="S1c-B2" action="run-script" status="pending" desc="Clean up documents and markers for deleted Features">
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js"</field>
<field name="arg">--syncStatePath</field>
<field name="arg">${sync_state_bizs_dir}</field>
<field name="arg">--completedDir</field>
<field name="arg">${completed_dir}</field>
</block>
</branch>
<branch default="true" name="Full mode">
<block type="event" id="S1c-E2" action="log" level="info" desc="Full mode skip merge">
<field name="message">Full mode, skipping Feature merge step</field>
</block>
</branch>
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1c --status completed
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage2 --status in_progress
MUST use batch-orchestrator for batch management — DO NOT manually track batches
MUST dispatch Workers for feature analysis — DO NOT analyze features yourself
ALL workers for the same stage MUST be dispatched in PARALLEL — sequential execution is FORBIDDEN
ALL Worker dispatch calls in S2-L2 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn
DO NOT wait for any Worker to complete before dispatching the next Worker
Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete
Sequential one-by-one dispatch is STRICTLY FORBIDDEN
Monitor completion via marker files, NOT by polling worker status
DO NOT skip pending features — every feature must be analyzed
DO NOT generate feature analysis content yourself — always dispatch to Worker
DO NOT proceed to next Stage until ALL workers in current Stage have completed or failed
node -e "require('fs').mkdirSync('${completed_dir}', {recursive: true}); console.log('completed dir ready')"
completed_dir MUST be an ABSOLUTE path (e.g., d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed)
Relative paths will cause Worker marker file writes to fail silently
<!-- Step 1: Get next batch -->
<block type="task" id="S2-B1" action="run-script" status="pending" desc="Get next batch of pending Features">
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" get-batch</field>
<field name="arg">--syncStatePath</field>
<field name="arg">${sync_state_bizs_dir}</field>
<field name="arg">--batchSize</field>
<field name="arg">${max_concurrent_workers}</field>
<field name="output" var="batch_response"/>
</block>
<!-- Determine if complete -->
<block type="gateway" id="S2-G0" mode="exclusive" desc="Determine batch response">
<branch test="${batch_response.action} == 'done'" name="All Features processed">
<block type="event" id="S2-E-Done" action="log" level="info" desc="All Features processed">
<field name="message">All Features analyzed, exiting Stage 2 loop</field>
</block>
<field name="stage2_complete" value="true"/>
</branch>
<branch test="${batch_response.action} == 'process'" name="Process current batch">
<!-- Step 2: Prepare analysis task specifications -->
<block type="event" id="S2-E-Batch" action="log" level="info" desc="Report current batch">
<field name="message">Processing batch: ${batch_response.batch.length} Features</field>
</block>
<!-- Step 2: Dispatch Worker for each Feature -->
<!-- PARALLEL EXECUTION MANDATORY: All Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
<block type="loop" id="S2-L2" over="${batch_response.batch}" as="feature" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch analysis Worker for each Feature">
<!-- Route to different Skill based on platformType -->
<block type="gateway" id="S2-G1" mode="exclusive" desc="Route analysis Skill based on platform type">
<branch test="${feature.platformType} == 'web' or ${feature.platformType} == 'mobile' or ${feature.platformType} == 'desktop'" name="UI platform">
<block type="task" id="S2-B2a" action="dispatch-to-worker" status="pending" desc="Dispatch UI Feature analysis Worker">
<field name="worker">speccrew-knowledge-bizs-ui-analyze</field>
<field name="instructions">
Analyze the following source code file and generate detailed feature documentation.
CRITICAL - Template Fill-in Workflow (MANDATORY):
- First, copy the analysis template to documentPath (template structure = document skeleton)
- Then fill each Section using search_replace to replace placeholders with actual data
- NEVER use create_file to rewrite the entire document — this destroys template structure
- NEVER delete or skip any template Section — if no data available, fill with "N/A"
- NEVER create custom Section structures — use ONLY the template's predefined Sections
Requirements:
- Read source code file, understand related functionality interfaces
- Generate detailed documentation to documentPath
- Create two marker files to completed_dir
- Use speccrew-knowledge-bizs-ui-analyze skill to complete this task
{
"fileName": "${feature.fileName}",
"sourcePath": "${feature.sourcePath}",
"module": "${feature.module}",
"documentPath": "${feature.documentPath}",
"platformType": "${feature.platformType}",
"platformSubtype": "${feature.platformSubtype}",
"language": "${language}",
"completed_dir": "${completed_dir}",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"sourceFile": "${feature.sourceFile}"
}
speccrew-knowledge-bizs-api-analyze
Analyze the following source code file and generate detailed API feature documentation.
CRITICAL - Template Fill-in Workflow (MANDATORY):
- First, copy the analysis template to documentPath
- Then fill each Section using search_replace
- NEVER use create_file to rewrite the entire document
- NEVER delete or skip any template Section
Requirements:
-
Read API Controller source code
-
Extract API endpoints, request/response structures
-
Generate detailed documentation to documentPath
-
Create .done.json and .graph.json marker files
{
"fileName": "${feature.fileName}",
"sourcePath": "${feature.sourcePath}",
"module": "${feature.module}",
"documentPath": "${feature.documentPath}",
"platformType": "${feature.platformType}",
"platformSubtype": "${feature.platformSubtype}",
"language": "${language}",
"completed_dir": "${completed_dir}",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"sourceFile": "${feature.sourceFile}"
}
<!-- Step 2.5: Graph Worker Task Preparation -->
<block type="event" id="S2-E-Graph" action="log" level="info" desc="Prepare Graph Worker tasks">
<field name="message">Preparing Graph data generation for completed Features</field>
</block>
<!-- Step 2.5: Dispatch Graph Worker -->
<!-- PARALLEL EXECUTION MANDATORY: All Graph Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
<block type="loop" id="S2-L25" over="${batch_response.batch}" as="feature" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch Graph Worker for each Feature IN PARALLEL">
<block type="gateway" id="S2-G2" mode="exclusive" desc="Route Graph Worker based on analysis type">
<branch test="${feature.platformType} == 'backend'" name="API Graph">
<block type="task" id="S2-B25a" action="dispatch-to-worker" status="pending" desc="Dispatch API Graph Worker">
<field name="worker">speccrew-knowledge-bizs-api-graph</field>
<field name="instructions">
Generate graph data nodes and edges from the analyzed API feature document.
Requirements:
- Read the API analysis document at api_analysis_path
- Extract entities (APIs, services, tables, DTOs)
- Generate graph nodes and edges
- Write graph JSON to output_dir
- Create .graph-done.json completion marker at output_dir
{
"api_analysis_path": "${feature.documentPath}",
"platform_id": "${feature.platformId}",
"output_dir": "${completed_dir}",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"module": "${feature.module}",
"fileName": "${feature.fileName}",
"sourcePath": "${feature.sourcePath}",
"sourceFile": "${feature.sourceFile}",
"language": "${language}",
"subpath": "${feature.subpath}"
}
speccrew-knowledge-bizs-ui-graph
Generate graph data nodes and edges from the analyzed UI feature document.
Requirements:
-
Read the UI analysis document at documentPath
-
Extract entities (pages, components, API calls, navigations)
-
Generate graph nodes and edges
-
Write graph JSON to completed_dir
-
Create .graph-done.json completion marker at completed_dir
{
"feature": "${feature}",
"fileName": "${feature.fileName}",
"sourcePath": "${feature.sourcePath}",
"documentPath": "${feature.documentPath}",
"module": "${feature.module}",
"platform_type": "${feature.platformType}",
"platform_subtype": "${feature.platformSubtype}",
"completed_dir": "${completed_dir}",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"sourceFile": "${feature.sourceFile}",
"language": "${language}"
}
<!-- Step 3: Process batch results -->
<block type="task" id="S2-B3" action="run-script" status="pending" desc="Collect and process batch Worker results">
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" process-results</field>
<field name="arg">--syncStatePath</field>
<field name="arg">${sync_state_bizs_dir}</field>
<field name="arg">--graphRoot</field>
<field name="arg">${graph_root}</field>
<field name="arg">--completedDir</field>
<field name="arg">${completed_dir}</field>
<field name="output" var="batch_result"/>
</block>
<block type="event" id="S2-E-Result" action="log" level="info" desc="Report batch processing result">
<field name="message">Batch processing complete: ${batch_result.success} succeeded, ${batch_result.failed} failed</field>
</block>
</branch>
</block>
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage2 --status completed --output "${analyzed_count} features analyzed"
Stage 2 Milestone: Feature analysis complete. ${analyzed_count} features analyzed, ${failed_count} failed. ${graph_count} graph data files generated.
Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
ALL module summary workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN
ALL Worker dispatch calls in S3-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn
DO NOT wait for any Worker to complete before dispatching the next Worker
Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete
Sequential one-by-one dispatch is STRICTLY FORBIDDEN
Workers MUST NOT create any temporary scripts or workaround files
node -e "const fs=require('fs'); const path=require('path'); const syncDir='${sync_state_bizs_dir}'; const files=fs.readdirSync(syncDir).filter(f=>f.startsWith('features-')&&f.endsWith('.json')); const pairs=[]; files.forEach(f=>{const platformId=f.replace('features-','').replace('.json',''); const data=JSON.parse(fs.readFileSync(path.join(syncDir,f),'utf8')); const modules=[...new Set(data.features.map(x=>x.module))]; modules.forEach(m=>pairs.push({platformId,moduleName:m})); }); console.log(JSON.stringify(pairs));"
speccrew-knowledge-module-summarize
Generate complete module overview documentation for the specified module.
Requirements:
-
Read all Feature documents under the module
-
Aggregate and generate module-level overview
-
Output to {module_path}/{module_name}-overview.md
{
"module_name": "${pair.moduleName}",
"module_path": "${workspace_path}/knowledges/bizs/${pair.platformId}/${pair.moduleName}/",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"language": "${language}"
}
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage3 --status completed --output "${module_count} modules summarized"
Stage 3 Milestone: Module summaries complete. ${module_count} modules summarized.
Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
ALL UI style extraction workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN
ALL Worker dispatch calls in S35-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn
DO NOT wait for any Worker to complete before dispatching the next Worker
Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete
Sequential one-by-one dispatch is STRICTLY FORBIDDEN
This stage writes to techs knowledge base, not bizs knowledge base
speccrew-knowledge-bizs-ui-style-extract
Extract UI design patterns from frontend platform Feature documents.
Requirements:
-
Analyze Feature documents for page types, component patterns, layout patterns
-
Generate pattern documents under page-types/, components/, layouts/ directories
-
Output to {workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/
{
"platform_id": "${platform.platformId}",
"platform_type": "${platform.platformType}",
"feature_docs_path": "${workspace_path}/knowledges/bizs/${platform.platformId}",
"features_manifest_path": "${sync_state_bizs_dir}/features-${platform.platformId}.json",
"module_overviews_path": "${workspace_path}/knowledges/bizs/${platform.platformId}/",
"output_path": "${workspace_path}/knowledges/techs/${platform.platformId}/ui-style-patterns/",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"language": "${language}"
}
Backend platform ${platform.platformId} skipping UI style extraction
Stage 3.5 Milestone: UI style patterns extracted. ${pattern_count} patterns extracted from ${frontend_platform_count} platforms.
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage3.5 --status completed --output "${pattern_count} patterns extracted"
ALL platform modules must be summarized before system summarize
MUST include cross-platform analysis if multiple platforms exist
Worker dispatch is handled by the calling Agent (Team Leader)
node -e "const fs=require('fs'); const files=fs.readdirSync('${sync_state_bizs_dir}').filter(f=>f.startsWith('features-')); const platforms=files.map(f=>JSON.parse(fs.readFileSync('${sync_state_bizs_dir}/'+f))); console.log(JSON.stringify(platforms))"
speccrew-knowledge-system-summarize
Generate complete system-level business knowledge summary.
Requirements:
-
Aggregate business knowledge from all platforms and modules
-
Generate platform index and module hierarchy
-
Include cross-platform analysis (if multiple platforms exist)
-
Output to {workspace_path}/knowledges/bizs/system-overview.md
{
"modules_path": "${workspace_path}/knowledges/bizs/",
"output_path": "${workspace_path}/knowledges/bizs/",
"workspace_path": "${workspace_path}",
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
"language": "${language}",
"platforms": "${all_platforms_data}"
}
node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage4 --status completed --output "System overview generated"
Stage 4 Milestone: System overview generated. All stages complete. Pipeline finished successfully.
Worker ${error.worker} failed: ${error.message}
node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js"
--featureId
${error.feature_id}
--status
failed
--error
${error.message}
Script ${error.script} execution failed: ${error.message}
Stage ${error.stage} execution aborted: ${error.message}
Failure rate exceeds 50%, terminating entire pipeline
Appendix: Reference
Skill Routing Table (Stage 2)
Note: Detailed routing logic is defined in XML Stage 2 gateway (S2-G1).
| platformType | skill_name | Description |
|---|
web | speccrew-knowledge-bizs-ui-analyze | Web frontend (Vue/React/Angular) |
mobile | speccrew-knowledge-bizs-ui-analyze | Mobile apps (Flutter/React Native/UniApp) |
desktop | speccrew-knowledge-bizs-ui-analyze | Desktop apps (Electron/WPF) |
backend | speccrew-knowledge-bizs-api-analyze | Backend APIs (Java/Python/Node.js) |
Platform Types
| Platform Type | Platform Subtype | Description |
|---|
web | vue, react, angular | Web frontend applications |
mobile | uniapp, flutter, react-native | Mobile applications |
desktop | electron, wpf | Desktop applications |
backend | spring, nodejs, python | Backend services |
Worker Completion Marker Format
Marker File Naming Convention
Pattern: {module}-{subpath}-{fileName}.{type}.json
| Component | Description | Example |
|---|
module | Business module name | chat, user, order |
subpath | Sub-path within module, / replaced with -. Empty if file is directly under module | admin, api-v2 |
fileName | Source file name WITHOUT extension | UserController, ChatService |
type | Marker type: done, error, or skip | done |
Examples:
| Source File Path | Marker File Name |
|---|
chat/ChatController.java | chat-ChatController.done.json |
user/admin/UserController.java | user-admin-UserController.done.json |
order/api/v2/OrderService.java | order-api-v2-OrderService.done.json |
.done.json Required Fields
{
"fileName": "<class name without extension>",
"sourcePath": "<relative source file path>",
"sourceFile": "<features JSON filename, e.g. features-backend-ai.json>",
"module": "<business module name>",
"status": "success|partial|failed",
"analysisNotes": "<brief notes>"
}
WRONG: Writing plain text like "COMPLETED" or "Analysis done"
CORRECT: Writing valid JSON with all required fields
Batch Processing Details
get-batch Script Output Format
{
"action": "process|done",
"batch": [
{
"id": "feature-001",
"fileName": "UserController",
"sourcePath": "controller/admin/user/UserController.java",
"module": "user",
"documentPath": "speccrew-workspace/knowledges/bizs/backend-spring/user/UserController.md",
"platformType": "backend",
"platformSubtype": "spring",
"platformId": "backend-spring",
"sourceFile": "features-backend-spring.json"
}
]
}
process-results Script Behavior
- Scans
.done.json files → updates feature status to completed in features-*.json
- Scans
.graph-done.json files → confirms graph data generation complete
- Scans
.graph.json files → writes graph data (nodes + edges) grouped by module
- Cleans up all marker files
Stateless Design
Dispatch adopts a fully stateless file-driven design. Re-execute loop to recover: get-batch auto-recovers from file state; process-results handles uncleaned markers. The entire flow is safely re-entrant.
Large-Scale Scenario Guidance
For modules with >20 features: dispatch multiple Worker Agents in parallel (each handles a subset). Use get-next-batch for resume support across sessions. Run process-batch-results --validateDocs after completion to verify.