-
Notifications
You must be signed in to change notification settings - Fork 1
Pipeline Plan 44
The plan file is in a sensitive directory. Let me present the plan directly here instead — it's the pipeline's plan stage output.
The PM agent is a new bash module (sw-pm-agent.sh) that sits between daemon issue intake and pipeline execution. It analyzes each issue, produces a team-plan.json with team size/roles/stage config, which the pipeline reads and executes. Disabled by default — zero impact when off; falls back to static templates on failure.
Daemon receives issue
├── triage_score_issue() [existing]
├── select_pipeline_template() [existing]
├── pm_agent_plan() [NEW — if enabled]
│ ├── _pm_analyze_issue() → complexity, type, scope, risk
│ ├── _pm_decide_team_size() → 1-6 agents
│ ├── _pm_compose_team() → roles + focus areas
│ ├── _pm_configure_stages() → skip/parallel/iterations
│ └── writes team-plan.json
└── daemon_spawn_pipeline()
└── sw-pipeline.sh --team-plan team-plan.json
└── reads plan, applies skips, passes team config to sw-loop.sh
New Files:
| File | Purpose |
|---|---|
scripts/sw-pm-agent.sh |
~600 lines — core PM agent module |
scripts/sw-pm-agent-test.sh |
~800 lines — 33+ test suite |
Modified Files:
| File | Changes |
|---|---|
.claude/daemon-config.json |
Add pm_agent config section (disabled by default) |
scripts/sw-daemon.sh |
Source PM agent, call in daemon_spawn_pipeline(), load config, record outcomes |
scripts/sw-pipeline.sh |
Accept --team-plan, load plan, apply stage skips, pass team config to build loop |
scripts/sw-loop.sh |
Accept --team-plan argument |
scripts/sw-self-optimize.sh |
Add optimize_analyze_team_outcome()
|
package.json |
Register test suite #23 |
.claude/CLAUDE.md |
Add PM agent to docs tables |
Step 1-7: sw-pm-agent.sh — New module with:
-
_pm_analyze_issue()— keyword extraction, complexity scoring, type/risk classification, intelligence enrichment -
_pm_decide_team_size()— decision matrix (complexity × scope × budget × learned weights) -
_pm_compose_team()— role selection (builder/tester/reviewer/security/performance) with focus areas -
_pm_configure_stages()— skip compound_quality for simple, skip design for bugfixes, adversarial for high-risk -
pm_agent_plan()— orchestrator producingteam-plan.json -
pm_agent_record_outcome()/pm_agent_learn()— outcome tracking + exponential-smoothed weight learning
Step 8: Config — pm_agent section in daemon-config.json (enabled: false, max_team_size: 6, min_confidence: 0.7)
Step 9: Daemon integration — Source module, call pm_agent_plan() before building pipeline args, pass --team-plan to pipeline, record outcomes on job completion, run learning alongside self-optimize
Step 10-11: Pipeline/Loop integration — Accept --team-plan arg, load plan, apply stage skips, pass agents/roles/iterations to build loop
Step 12: Self-optimize — Team analytics function reading ~/.shipwright/pm-agent/outcomes.jsonl
Step 13-14: Tests + docs — 33+ unit tests across 7 categories, register in package.json, update CLAUDE.md
- Task 1: Create
sw-pm-agent.shskeleton (VERSION, helpers, emit_event, CLI dispatch) - Task 2: Implement
_pm_analyze_issue()— complexity scoring, type detection, keyword extraction - Task 3: Implement
_pm_decide_team_size()— decision matrix with budget/learning constraints - Task 4: Implement
_pm_compose_team()— role selection and focus area assignment - Task 5: Implement
_pm_configure_stages()— stage skip/parallel/iteration decisions - Task 6: Implement
pm_agent_plan()— main entry assembling team-plan.json - Task 7: Implement
pm_agent_record_outcome()andpm_agent_learn()— learning system - Task 8: Add
pm_agentconfig to.claude/daemon-config.json - Task 9: Integrate into
sw-daemon.sh— source, spawn call, config loading, outcome recording - Task 10: Integrate into
sw-pipeline.sh—--team-plan, stage skips, build loop config - Task 11: Integrate into
sw-loop.sh—--team-planargument - Task 12: Extend
sw-self-optimize.sh— team outcome analytics - Task 13: Create
sw-pm-agent-test.sh— 33+ tests across 7 categories - Task 14: Register test in
package.json, update.claude/CLAUDE.md
Unit tests (sw-pm-agent-test.sh): 33+ tests across issue analysis (6), team sizing (6), composition (5), stage config (5), full plan gen (4), outcome recording (3), learning (4). Isolated temp dirs, mock gh/claude binaries, PASS/FAIL counters.
Integration: Enable pm_agent, create issues of varying complexity, verify team-plan.json output, verify pipeline reads/applies plan, verify fallback on failure, verify learning after 5+ outcomes.
Regression: All 22 existing suites pass (PM agent disabled by default).
-
sw-pm-agent.shproduces validteam-plan.jsonfor varied issue types - Team size varies: simple=1, medium=2, complex=3+
- Roles match issue characteristics (security label → security role)
- Stage skips work (compound_quality for simple, design for bugfixes)
- Fallback to static templates when PM agent fails/disabled
- All decisions logged via
emit_event("pm_agent.*") - Outcome recording captures actual vs predicted
- Learning adjusts weights after 5+ samples
- Daemon calls PM agent in spawn flow, passes results to pipeline
- Pipeline reads team plan, applies skips, passes config to loop
-
pm_agent.enabled: falseby default — zero impact when off - 33+ tests pass in
sw-pm-agent-test.sh - All 22 existing test suites continue to pass
-
.claude/CLAUDE.mdupdated