mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
fix: resolve Gemini-identified pipeline data flow inconsistencies
Fix 3 issues found by Gemini full-chain analysis:
1. (High) cross_cutting_specs path format mismatch: feature-index.json
uses relative paths ("role/file.md") but context-package uses full
paths (".workflow/.../role/file.md"). Changed action-planning-agent
to use endsWith() matching and read from context-package objects
instead of raw feature-index strings.
2. (Medium) Add explicit feature_index_path field to context-package
schema in context-search-agent, so task-generate-agent can read it
directly instead of hardcoding paths. Updated both single-module
and multi-module prompt templates with fallback logic.
3. (Medium) Expand synthesis_output in context-search-agent to include
feature_driven sub-object pointing to feature-index.json and
feature-specs/ directory alongside legacy synthesis-specification.md.
This commit is contained in:
@@ -157,9 +157,9 @@ mcp__exa__get_code_context_exa(
|
||||
- **Load on-demand**: Only load specs referenced by current task's feature mapping
|
||||
- **Note**: For structured metadata (`feature_id`, `slug`, `priority`), use `feature_index.features[]` instead
|
||||
- `brainstorm_artifacts.cross_cutting_specs[]`: Cross-cutting concern specifications (from context-package)
|
||||
- Each spec: `cross_cutting_specs[i]` has `path` and `content`
|
||||
- Each spec: `cross_cutting_specs[i]` has `path` (full project-relative) and `content`
|
||||
- **Load on-demand**: Only load when task touches shared/cross-cutting concerns
|
||||
- **Note**: In feature-index.json, `cross_cutting_specs[]` is a plain string array (relative paths)
|
||||
- **Path format note**: context-package uses full paths (`.workflow/.../role/file.md`), feature-index.json uses relative paths (`role/file.md`). Match using `endsWith()`.
|
||||
- `brainstorm_artifacts.role_analyses[]`: Role-specific analyses (legacy fallback, if array not empty)
|
||||
- Each role: `role_analyses[i].files[j]` has `path` and `content`
|
||||
- **Only used when**: `feature_index` does not exist (backward compatibility)
|
||||
@@ -197,11 +197,17 @@ if (contextPackage.brainstorm_artifacts?.feature_index?.exists) {
|
||||
});
|
||||
|
||||
// Step 3: Load cross-cutting specs only when needed
|
||||
// Note: cross_cutting_specs in feature-index.json is a string array (relative paths)
|
||||
// Note: feature-index.json uses relative paths ("role/file.md"),
|
||||
// context-package uses full paths (".workflow/.../role/file.md")
|
||||
const crossCuttingFromPackage = contextPackage.brainstorm_artifacts.cross_cutting_specs || [];
|
||||
featureIndex.cross_cutting_specs
|
||||
.filter(cs => task.context.artifacts.some(a => a.type === 'cross_cutting_spec' && a.path === cs))
|
||||
.filter(cs => task.context.artifacts.some(a => a.type === 'cross_cutting_spec'))
|
||||
.forEach(cs => {
|
||||
const crossCuttingContent = Read(cs);
|
||||
// Match by path suffix since feature-index uses relative paths
|
||||
const matched = crossCuttingFromPackage.find(pkg => pkg.path.endsWith(cs));
|
||||
if (matched) {
|
||||
const crossCuttingContent = matched.content || Read(matched.path);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (contextPackage.brainstorm_artifacts?.role_analyses?.length > 0) {
|
||||
|
||||
@@ -338,7 +338,12 @@ if (dir_exists(brainstormDir)) {
|
||||
synthesis_output: {
|
||||
path: `${brainstormDir}/synthesis-specification.md`,
|
||||
exists: file_exists(`${brainstormDir}/synthesis-specification.md`),
|
||||
content: Read(`${brainstormDir}/synthesis-specification.md`) || null
|
||||
content: Read(`${brainstormDir}/synthesis-specification.md`) || null,
|
||||
// New feature-driven artifacts (preferred over legacy synthesis-specification.md)
|
||||
feature_driven: dir_exists(`${brainstormDir}/feature-specs`) ? {
|
||||
feature_index: `${brainstormDir}/feature-specs/feature-index.json`,
|
||||
feature_specs_dir: `${brainstormDir}/feature-specs/`
|
||||
} : undefined
|
||||
},
|
||||
// Feature index (optional - top level, matches action-planning-agent expected access pattern)
|
||||
feature_index: file_exists(`${brainstormDir}/feature-specs/feature-index.json`) ? {
|
||||
@@ -346,6 +351,10 @@ if (dir_exists(brainstormDir)) {
|
||||
exists: true,
|
||||
content: Read(`${brainstormDir}/feature-specs/feature-index.json`) || null
|
||||
} : undefined,
|
||||
// Convenience: direct path to feature-index.json (avoids hardcoding in task-generate-agent)
|
||||
feature_index_path: file_exists(`${brainstormDir}/feature-specs/feature-index.json`)
|
||||
? `${brainstormDir}/feature-specs/feature-index.json`
|
||||
: undefined,
|
||||
// Feature spec files (optional - individual feature specifications)
|
||||
feature_specs: dir_exists(`${brainstormDir}/feature-specs`)
|
||||
? glob(`${brainstormDir}/feature-specs/F-*-*.md`).map(file => ({
|
||||
@@ -479,13 +488,18 @@ Calculate risk level based on:
|
||||
"synthesis_output": {
|
||||
"path": ".workflow/WFS-xxx/.brainstorming/synthesis-specification.md",
|
||||
"exists": true,
|
||||
"content": "# Synthesis Specification\n\n## Cross-Role Integration\n..."
|
||||
"content": "# Synthesis Specification\n\n## Cross-Role Integration\n...",
|
||||
"feature_driven": {
|
||||
"feature_index": ".workflow/WFS-xxx/.brainstorming/feature-specs/feature-index.json",
|
||||
"feature_specs_dir": ".workflow/WFS-xxx/.brainstorming/feature-specs/"
|
||||
}
|
||||
},
|
||||
"feature_index": {
|
||||
"path": ".workflow/WFS-xxx/.brainstorming/feature-specs/feature-index.json",
|
||||
"exists": true,
|
||||
"content": "{\"version\":\"1.0\",\"features\":[...]}"
|
||||
},
|
||||
"feature_index_path": ".workflow/WFS-xxx/.brainstorming/feature-specs/feature-index.json",
|
||||
"feature_specs": [
|
||||
{
|
||||
"path": ".workflow/WFS-xxx/.brainstorming/feature-specs/F-001-auth.md",
|
||||
|
||||
@@ -280,7 +280,10 @@ Session ID: {session-id}
|
||||
MCP Capabilities: {exa_code, exa_web, code_index}
|
||||
|
||||
## FEATURE SPECIFICATIONS (conditional)
|
||||
If .workflow/active/{session-id}/.brainstorming/feature-specs/ exists:
|
||||
If context-package has brainstorm_artifacts.feature_index_path:
|
||||
Feature Index: ${contextPackage.brainstorm_artifacts.feature_index_path}
|
||||
Feature Spec Dir: ${contextPackage.brainstorm_artifacts.feature_index_path.replace('/feature-index.json', '/')}
|
||||
Else if .workflow/active/{session-id}/.brainstorming/feature-specs/ exists:
|
||||
Feature Index: .workflow/active/{session-id}/.brainstorming/feature-specs/feature-index.json
|
||||
Feature Spec Dir: .workflow/active/{session-id}/.brainstorming/feature-specs/
|
||||
|
||||
@@ -475,7 +478,10 @@ Session ID: {session-id}
|
||||
MCP Capabilities: {exa_code, exa_web, code_index}
|
||||
|
||||
## FEATURE SPECIFICATIONS (conditional)
|
||||
If .workflow/active/{session-id}/.brainstorming/feature-specs/ exists:
|
||||
If context-package has brainstorm_artifacts.feature_index_path:
|
||||
Feature Index: ${contextPackage.brainstorm_artifacts.feature_index_path}
|
||||
Feature Spec Dir: ${contextPackage.brainstorm_artifacts.feature_index_path.replace('/feature-index.json', '/')}
|
||||
Else if .workflow/active/{session-id}/.brainstorming/feature-specs/ exists:
|
||||
Feature Index: .workflow/active/{session-id}/.brainstorming/feature-specs/feature-index.json
|
||||
Feature Spec Dir: .workflow/active/{session-id}/.brainstorming/feature-specs/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user