Skip to content

Commit 9323761

Browse files
author
catlog22
committed
Add context-aware specialist injection across all team pipelines
Replace keyword-based specialist injection with signal-driven triggering based on actual codebase characteristics detected by workers. Workers emit tech_profile signals in state_update; coordinator evaluates against trigger matrix to inject P0/P1 specialists dynamically.
1 parent 92278ec commit 9323761

22 files changed

Lines changed: 181 additions & 16 deletions

File tree

.claude/agents/team-worker.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ After claiming a task, check if output artifacts already exist (indicates resume
124124

125125
The role_spec contains Phase 2, Phase 3, and Phase 4 sections with domain-specific logic. Follow those instructions exactly. Key integration points with built-in infrastructure:
126126

127+
### Context-Aware Signal Emission (Optional)
128+
129+
During Phase 2-4, if you detect codebase signals (SQL usage, auth modules, ML imports, performance-sensitive code, etc.), include `tech_profile` in your Phase 5 state_update. Full signal catalog and schema: `skills_lib/specs/context-aware-trigger.md`. This enables the coordinator to evaluate specialist injection for the pipeline.
130+
127131
## CRITICAL LIMITATION: No Agent Delegation
128132

129133
**Team workers CANNOT call the Agent() tool to spawn other agents.**
@@ -293,7 +297,8 @@ After Phase 4 completes, determine Phase 5 variant (see Execution Flow for decis
293297
decisions: <from Phase 4>,
294298
files_modified: <from Phase 4>,
295299
artifact_path: "<artifact-path>",
296-
verification: "<verification_method>"
300+
verification: "<verification_method>",
301+
tech_profile: <optional, from Phase 3/4 if signals detected>
297302
}
298303
)
299304
```

.claude/skills/team-arch-opt/roles/analyzer/role.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ Execute analysis based on detected project type:
6060
- Rank top 3-7 architecture issues by severity (Critical / High / Medium)
6161
- Record evidence: file paths, line numbers, measured values
6262

63+
### Tech Profile Scan
64+
65+
After analysis, scan findings for context-aware trigger signals (based on detected codebase characteristics):
66+
67+
1. Check dependency analysis → signals (`sql_detected`, `auth_detected`, `ml_detected`)
68+
2. Check structural analysis → risk signals (`perf_sensitive`, `legacy_patterns`, `scaling_concern`)
69+
3. Include `tech_profile` in Phase 5 state_update data
70+
6371
## Phase 4: Report Generation
6472

6573
1. Write architecture baseline to `<session>/artifacts/architecture-baseline.json`:

.claude/skills/team-coordinate/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Only coordinator is statically registered. All other roles are dynamic, stored a
6161
| coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | built-in orchestrator |
6262
| (dynamic) | `<session>/role-specs/<role-name>.md` | runtime-generated role-spec |
6363

64+
**Tech Profile Scan**: When generating role-specs for analysis/exploration roles (responsibility_type includes "analysis", "exploration", or "research"), append to Phase 3:
65+
> After exploration, include `tech_profile` in state_update with detected signals (e.g., `sql_detected`, `auth_detected`, `perf_sensitive`) and evidence file paths. This enables coordinator to evaluate specialist injection needs.
66+
6467
### CLI Tool Usage
6568

6669
Workers can use CLI tools for analysis and code operations:

.claude/skills/team-coordinate/specs/role-spec-template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ Coordinator MAY reference these patterns when composing Phase 2-4 content for a
159159
- Phase 3: Multi-dimension analysis — perspectives and depth determined by task
160160
- Phase 4: Verify report exists + severity classification (Behavioral Traits) + update shared state
161161

162+
**Tech Profile Scan**: When generating role-specs for analysis/exploration roles (responsibility_type includes "analysis", "exploration", or "research"), append to Phase 3:
163+
> After exploration, include `tech_profile` in state_update with detected signals (e.g., `sql_detected`, `auth_detected`, `perf_sensitive`) and evidence file paths. This enables coordinator to evaluate specialist injection needs.
164+
162165
### Validation / Testing
163166

164167
- Phase 2: Detect test framework + identify changed files from upstream

.claude/skills/team-frontend-debug/roles/reproducer/role.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ Write `<session>/evidence/evidence-summary.json`:
120120
}
121121
```
122122

123+
### Tech Profile Scan
124+
125+
After reproduction, note any frontend-specific codebase characteristics:
126+
127+
1. Check reproduction findings → signals (`frontend_framework`, `perf_sensitive`, `realtime_detected`)
128+
2. Check code patterns → signals (`legacy_patterns`, `test_gap`)
129+
3. Include `tech_profile` in Phase 5 state_update data
130+
123131
## Phase 4: Report
124132

125133
1. Write evidence summary to session evidence/

.claude/skills/team-frontend/roles/analyst/role.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ Retrieve design intelligence via ui-ux-pro-max skill integration.
8080
- `<session>/analysis/design-intelligence.json`
8181
- `<session>/analysis/requirements.md`
8282

83+
### Tech Profile Scan
84+
85+
After analysis, scan findings for context-aware trigger signals (based on detected codebase characteristics):
86+
87+
1. Check detected_stack and dependencies → framework signals (`frontend_framework`, `api_surface`)
88+
2. Check codebase patterns → risk signals (`perf_sensitive`, `test_gap`, `legacy_patterns`)
89+
3. Include `tech_profile` in Phase 5 state_update data
90+
8391
## Phase 4: Self-Review
8492

8593
| Check | Method | Pass Criteria |

.claude/skills/team-issue/roles/explorer/role.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ CONSTRAINTS: Focus on issue context | Write output to <session>/explorations/con
8585
}
8686
```
8787

88+
### Tech Profile Scan
89+
90+
After exploration, scan findings for context-aware trigger signals (based on detected codebase characteristics):
91+
92+
1. Check relevant_files and dependencies → signals (`sql_detected`, `auth_detected`, `api_surface`)
93+
2. Check code patterns in explored files → risk signals (`injection_risk`, `eval_usage`, `perf_sensitive`)
94+
3. Include `tech_profile` in Phase 5 state_update data
95+
8896
## Phase 4: Context Report & Wisdom Contribution
8997

9098
1. Write context report to `<session>/explorations/context-<issueId>.json`

.claude/skills/team-lifecycle-v4/roles/analyst/role.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ CONTEXT: @**/*
5959
EXPECTED: JSON with: tech_stack[], architecture_patterns[], conventions[], integration_points[]" --tool gemini --mode analysis`, run_in_background: false })
6060
```
6161

62+
### Tech Profile Scan
63+
64+
After codebase exploration, scan results for context-aware trigger signals (based on detected codebase characteristics):
65+
66+
1. Check imports/dependencies → framework signals (`sql_detected`, `auth_detected`, `ml_detected`, `frontend_framework`)
67+
2. Check file patterns → infrastructure signals (`devops_detected`, `data_migration`, `realtime_detected`)
68+
3. Check code patterns → risk signals (`perf_sensitive`, `crypto_usage`, `legacy_patterns`, `test_gap`)
69+
4. Include `tech_profile` in Phase 5 state_update data:
70+
```json
71+
"tech_profile": {
72+
"signals": ["<detected signals>"],
73+
"evidence": { "<signal>": ["<file paths>"] },
74+
"confidence": "high|medium|low"
75+
}
76+
```
77+
6278
## Phase 4: Context Packaging
6379

6480
1. Write spec-config.json → <session>/spec/

.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ Worker completed. Process and advance.
3131
4. Completion -> mark task done
3232
- Resident agent (supervisor) -> keep in active_workers (stays alive for future checkpoints)
3333
- Standard worker -> remove from active_workers
34+
4.5. **evaluateSpecialistInjection** (based on detected codebase characteristics):
35+
- If callback from analyst, planner, or executor role:
36+
a. `get_state(role=<callback_role>)` → extract `tech_profile.signals`
37+
b. Merge with previously collected signals from other roles
38+
c. Evaluate against trigger matrix (§4)
39+
d. P0 matches → TaskCreate with blockedBy on current stage, blocks downstream
40+
e. P1 matches → TaskCreate parallel with REVIEW/TEST stage
41+
f. Log: `team_msg(type="specialist_injection", data={ specialist, signals, priority, evidence })`
42+
g. Dedup: skip if same specialist already injected this session
3443
5. Check for checkpoints:
3544
- CHECKPOINT-* with verdict "block" -> AskUserQuestion: Override / Revise upstream / Abort
3645
- CHECKPOINT-* with verdict "warn" -> log risks to wisdom, proceed normally

.claude/skills/team-lifecycle-v4/roles/planner/role.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ Codebase-informed implementation planning with complexity assessment.
4141
```
4242
4. Store results in <session>/explorations/
4343

44+
### Secondary Signal Scan
45+
46+
After exploration, supplement upstream tech_profile with planning-phase signals (based on detected codebase characteristics):
47+
48+
1. Check plan complexity → `scaling_concern` if O(n^2)+ patterns found
49+
2. Check scope → `breaking_change` if public API modifications planned
50+
3. Check data → `data_migration` if schema changes identified
51+
4. Include `tech_profile` in Phase 5 state_update (merge with any upstream signals)
52+
4453
## Phase 3: Plan Generation
4554

4655
Generate plan.json + .task/TASK-*.json:

0 commit comments

Comments
 (0)