knowzcode 0.1.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +9 -3
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +170 -73
- package/agents/analyst.md +24 -62
- package/agents/architect.md +60 -48
- package/agents/builder.md +35 -86
- package/agents/closer.md +29 -87
- package/agents/context-scout.md +54 -0
- package/agents/knowledge-migrator.md +7 -7
- package/agents/knowz-scout.md +83 -0
- package/agents/knowz-scribe.md +155 -0
- package/agents/microfix-specialist.md +1 -6
- package/agents/project-advisor.md +110 -0
- package/agents/reviewer.md +43 -91
- package/agents/security-officer.md +194 -0
- package/agents/test-advisor.md +162 -0
- package/agents/update-coordinator.md +7 -18
- package/bin/knowzcode.mjs +94 -7
- package/commands/audit.md +245 -25
- package/commands/connect-mcp.md +525 -507
- package/commands/fix.md +8 -8
- package/commands/init.md +125 -6
- package/commands/learn.md +327 -308
- package/commands/plan.md +173 -26
- package/commands/register.md +21 -12
- package/commands/status.md +309 -291
- package/commands/telemetry.md +188 -188
- package/commands/work.md +764 -114
- package/knowzcode/automation_manifest.md +59 -59
- package/knowzcode/claude_code_execution.md +291 -22
- package/knowzcode/copilot_execution.md +231 -0
- package/knowzcode/enterprise/compliance_manifest.md +5 -0
- package/knowzcode/knowzcode_loop.md +114 -46
- package/knowzcode/knowzcode_orchestration.md +66 -0
- package/knowzcode/knowzcode_project.md +48 -233
- package/knowzcode/knowzcode_vaults.md +183 -54
- package/knowzcode/mcp_config.md +72 -47
- package/knowzcode/platform_adapters.md +630 -29
- package/knowzcode/prompts/Execute_Micro_Fix.md +57 -57
- package/knowzcode/prompts/Investigate_Codebase.md +227 -227
- package/knowzcode/prompts/Migrate_Knowledge.md +301 -301
- package/knowzcode/prompts/Refactor_Node.md +72 -72
- package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -59
- package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -52
- package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -75
- package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -55
- package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -72
- package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -67
- package/package.json +1 -1
- package/skills/alias-resolver.json +1 -1
- package/skills/architecture-diff.json +1 -1
- package/skills/check-installation-status.json +1 -1
- package/skills/continue.md +25 -4
- package/skills/environment-guard.json +1 -1
- package/skills/generate-workgroup-id.json +1 -1
- package/skills/install-knowzcode.json +1 -1
- package/skills/load-core-context.json +1 -1
- package/skills/log-entry-builder.json +1 -1
- package/skills/spec-quality-check.json +1 -1
- package/skills/spec-template.json +1 -1
- package/skills/spec-validator.json +1 -1
- package/skills/tracker-scan.json +1 -1
- package/skills/tracker-update.json +1 -1
- package/skills/validate-installation.json +1 -1
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# KnowzCode Automation Manifest
|
|
2
|
-
|
|
3
|
-
This manifest describes the resources that support the KnowzCode workflow.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
| Command | Purpose |
|
|
8
|
-
| --- | --- |
|
|
9
|
-
| `/kc:work` | Start feature workflow with TDD, quality gates, and structured phases |
|
|
10
|
-
| `/kc:plan` | Research and investigate using parallel agents before implementing |
|
|
11
|
-
| `/kc:audit` | Run quality audits (spec, architecture, security, integration) |
|
|
12
|
-
| `/kc:fix` | Execute targeted micro-fix workflow |
|
|
13
|
-
| `/kc:init` | Initialize KnowzCode in current project + generate platform adapters |
|
|
14
|
-
| `/kc:telemetry` | Investigate production telemetry |
|
|
15
|
-
| `/kc:telemetry-setup` | Configure telemetry sources |
|
|
16
|
-
| `/kc:connect-mcp` | Configure MCP server connection |
|
|
17
|
-
| `/kc:learn` | Capture learning to vault |
|
|
18
|
-
| `/kc:register` | Register and configure MCP |
|
|
19
|
-
| `/kc:status` | Check MCP and vault status |
|
|
20
|
-
|
|
21
|
-
## Agents
|
|
22
|
-
|
|
23
|
-
| Agent | Phase | Description |
|
|
24
|
-
| --- | --- | --- |
|
|
25
|
-
| `analyst` | 1A | Impact analysis and Change Set proposals |
|
|
26
|
-
| `architect` | 1B | Specification drafting and architecture review |
|
|
27
|
-
| `builder` | 2A | TDD implementation and verification loops |
|
|
28
|
-
| `reviewer` | 2B | Quality audit, security review, compliance |
|
|
29
|
-
| `closer` | 3 | Finalization — specs, tracker, log, architecture |
|
|
30
|
-
| `microfix-specialist` | - | Scope-gated quick fixes |
|
|
31
|
-
| `knowledge-migrator` | - | External knowledge import |
|
|
32
|
-
| `update-coordinator` | - | Framework self-update |
|
|
33
|
-
|
|
34
|
-
## Skills
|
|
35
|
-
|
|
36
|
-
| Skill | Purpose |
|
|
37
|
-
| --- | --- |
|
|
38
|
-
| `start-work` | Detect implementation intent and redirect to /kc:work |
|
|
39
|
-
| `continue` | Detect continuation intent and resume active WorkGroup |
|
|
40
|
-
| `load-core-context` | Load project overview, architecture, tracker into memory |
|
|
41
|
-
| `generate-workgroup-id` | Produce WorkGroupID timestamps |
|
|
42
|
-
| `tracker-update` | Apply validated updates to tracker |
|
|
43
|
-
| `spec-template` | Seed specs with 4-section template |
|
|
44
|
-
| `spec-quality-check` | Verify spec completeness |
|
|
45
|
-
| `log-entry-builder` | Structure log entries |
|
|
46
|
-
| `architecture-diff` | Highlight differences between specs and architecture docs |
|
|
47
|
-
| `environment-guard` | Confirm environment context is complete |
|
|
48
|
-
| `tracker-scan` | Extract current status and WorkGroup assignments |
|
|
49
|
-
| `alias-resolver` | Convert natural language to canonical KnowzCode values |
|
|
50
|
-
| `spec-validator` | Validate individual spec quality |
|
|
51
|
-
|
|
52
|
-
## State Files
|
|
53
|
-
|
|
54
|
-
The authoritative state:
|
|
55
|
-
- `knowzcode/knowzcode_tracker.md` — backlog and node status
|
|
56
|
-
- `knowzcode/knowzcode_log.md` — operational history
|
|
57
|
-
- `knowzcode/specs/` — NodeID specifications
|
|
58
|
-
- `knowzcode/workgroups/` — session todo queues
|
|
59
|
-
- `knowzcode/knowzcode_architecture.md` — architecture documentation
|
|
1
|
+
# KnowzCode Automation Manifest
|
|
2
|
+
|
|
3
|
+
This manifest describes the resources that support the KnowzCode workflow.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
| Command | Purpose |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `/kc:work` | Start feature workflow with TDD, quality gates, and structured phases |
|
|
10
|
+
| `/kc:plan` | Research and investigate using parallel agents before implementing |
|
|
11
|
+
| `/kc:audit` | Run quality audits (spec, architecture, security, integration) |
|
|
12
|
+
| `/kc:fix` | Execute targeted micro-fix workflow |
|
|
13
|
+
| `/kc:init` | Initialize KnowzCode in current project + generate platform adapters |
|
|
14
|
+
| `/kc:telemetry` | Investigate production telemetry |
|
|
15
|
+
| `/kc:telemetry-setup` | Configure telemetry sources |
|
|
16
|
+
| `/kc:connect-mcp` | Configure MCP server connection |
|
|
17
|
+
| `/kc:learn` | Capture learning to vault |
|
|
18
|
+
| `/kc:register` | Register and configure MCP |
|
|
19
|
+
| `/kc:status` | Check MCP and vault status |
|
|
20
|
+
|
|
21
|
+
## Agents
|
|
22
|
+
|
|
23
|
+
| Agent | Phase | Description |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `analyst` | 1A | Impact analysis and Change Set proposals |
|
|
26
|
+
| `architect` | 1B | Specification drafting and architecture review |
|
|
27
|
+
| `builder` | 2A | TDD implementation and verification loops |
|
|
28
|
+
| `reviewer` | 2B | Quality audit, security review, compliance |
|
|
29
|
+
| `closer` | 3 | Finalization — specs, tracker, log, architecture |
|
|
30
|
+
| `microfix-specialist` | - | Scope-gated quick fixes |
|
|
31
|
+
| `knowledge-migrator` | - | External knowledge import |
|
|
32
|
+
| `update-coordinator` | - | Framework self-update |
|
|
33
|
+
|
|
34
|
+
## Skills
|
|
35
|
+
|
|
36
|
+
| Skill | Purpose |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `start-work` | Detect implementation intent and redirect to /kc:work |
|
|
39
|
+
| `continue` | Detect continuation intent and resume active WorkGroup |
|
|
40
|
+
| `load-core-context` | Load project overview, architecture, tracker into memory |
|
|
41
|
+
| `generate-workgroup-id` | Produce WorkGroupID timestamps |
|
|
42
|
+
| `tracker-update` | Apply validated updates to tracker |
|
|
43
|
+
| `spec-template` | Seed specs with 4-section template |
|
|
44
|
+
| `spec-quality-check` | Verify spec completeness |
|
|
45
|
+
| `log-entry-builder` | Structure log entries |
|
|
46
|
+
| `architecture-diff` | Highlight differences between specs and architecture docs |
|
|
47
|
+
| `environment-guard` | Confirm environment context is complete |
|
|
48
|
+
| `tracker-scan` | Extract current status and WorkGroup assignments |
|
|
49
|
+
| `alias-resolver` | Convert natural language to canonical KnowzCode values |
|
|
50
|
+
| `spec-validator` | Validate individual spec quality |
|
|
51
|
+
|
|
52
|
+
## State Files
|
|
53
|
+
|
|
54
|
+
The authoritative state:
|
|
55
|
+
- `knowzcode/knowzcode_tracker.md` — backlog and node status
|
|
56
|
+
- `knowzcode/knowzcode_log.md` — operational history
|
|
57
|
+
- `knowzcode/specs/` — NodeID specifications
|
|
58
|
+
- `knowzcode/workgroups/` — session todo queues
|
|
59
|
+
- `knowzcode/knowzcode_architecture.md` — architecture documentation
|
|
@@ -8,15 +8,15 @@ Agents on other platforms should ignore this file — see `knowzcode/platform_ad
|
|
|
8
8
|
|
|
9
9
|
## Agent Teams Overview
|
|
10
10
|
|
|
11
|
-
Agent Teams is an **experimental** Claude Code feature for multi-agent coordination. It requires the environment variable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to be
|
|
11
|
+
Agent Teams is an **experimental** Claude Code feature for multi-agent coordination. It requires the environment variable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to be set in the Claude Code environment.
|
|
12
12
|
|
|
13
13
|
> **Status:** Experimental. The API may change in future releases.
|
|
14
14
|
|
|
15
15
|
### Prerequisites
|
|
16
16
|
|
|
17
17
|
- Claude Code with Agent Teams support
|
|
18
|
-
- Environment variable: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
|
|
19
|
-
- Agent Teams
|
|
18
|
+
- Environment variable: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` (set in `~/.claude/settings.json` env block or shell environment)
|
|
19
|
+
- Commands detect Agent Teams at runtime via try-then-fallback: they attempt `TeamCreate()` and fall back to Subagent Delegation if it fails. No manual detection logic is needed in command files.
|
|
20
20
|
|
|
21
21
|
> **Windows note:** Split-pane mode (`tmux`) is not supported on Windows Terminal. Agent Teams automatically uses `in-process` mode on Windows (the default `auto` mode handles this correctly). No manual configuration is needed.
|
|
22
22
|
|
|
@@ -54,11 +54,69 @@ Agent Teams supports event-driven coordination via hooks:
|
|
|
54
54
|
- **`TeammateIdle`**: Fires when a teammate finishes its current task — can auto-assign next work
|
|
55
55
|
- **`TaskCompleted`**: Fires when a task is marked complete — can trigger dependent tasks
|
|
56
56
|
|
|
57
|
+
### Plan Approval Handshake (Agent Teams Only)
|
|
58
|
+
|
|
59
|
+
When the lead enables plan approval in the spawn prompt (or a teammate has `permissionMode: plan`):
|
|
60
|
+
|
|
61
|
+
1. **Teammate** presents their plan by calling `ExitPlanMode`
|
|
62
|
+
2. **Lead** receives a `plan_approval_request` message with a `request_id`
|
|
63
|
+
3. **Lead** reviews the plan and responds with `SendMessage` type `plan_approval_response`:
|
|
64
|
+
- `approve: true` → teammate exits plan mode and proceeds with execution
|
|
65
|
+
- `approve: false` + `content: "feedback"` → teammate revises their plan and re-presents
|
|
66
|
+
4. **Teammate** receives the response and acts accordingly
|
|
67
|
+
|
|
68
|
+
The lead MUST respond to every `plan_approval_request` — ignoring it will leave the teammate blocked indefinitely.
|
|
69
|
+
|
|
70
|
+
#### Autonomous Mode and Plan Approval
|
|
71
|
+
|
|
72
|
+
When `AUTONOMOUS_MODE = true`, the lead auto-approves all `plan_approval_request` messages immediately. The plan content is still logged for transparency, but no pause for review occurs.
|
|
73
|
+
|
|
74
|
+
**Exception**: Plans that touch >10 files or propose disabling security measures → pause for manual review even in autonomous mode.
|
|
75
|
+
|
|
76
|
+
### Handling Shutdown Requests
|
|
77
|
+
|
|
78
|
+
When you receive a `shutdown_request` from the lead:
|
|
79
|
+
|
|
80
|
+
1. Complete or save any in-progress work (update the WorkGroup file if needed)
|
|
81
|
+
2. Mark your current task as `completed` (or leave as `in_progress` if unfinished)
|
|
82
|
+
3. Respond with `SendMessage` type `shutdown_response`:
|
|
83
|
+
- `approve: true` → confirms shutdown, your process will terminate
|
|
84
|
+
- `approve: false` + `content: "reason"` → if you are mid-critical-operation (e.g., "Completing task, will be ready in a moment")
|
|
85
|
+
4. After approving shutdown, do not take any further actions
|
|
86
|
+
|
|
57
87
|
### Limitations
|
|
58
88
|
|
|
59
89
|
- Experimental feature — API may change
|
|
60
90
|
- Requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` env var
|
|
61
91
|
- Not available in all Claude Code environments
|
|
92
|
+
- No nested teams — teammates never create teams themselves
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Team Lifecycle
|
|
97
|
+
|
|
98
|
+
The team lead manages the full lifecycle of a team. Teammates never create or clean up teams.
|
|
99
|
+
|
|
100
|
+
### Creation
|
|
101
|
+
|
|
102
|
+
At the start of a workflow (`/kc:work`, `/kc:plan`, `/kc:audit`), the lead creates a team before spawning any teammates:
|
|
103
|
+
|
|
104
|
+
- **`/kc:work`**: Team name `kc-{wgid}` (matches the WorkGroup ID)
|
|
105
|
+
- **`/kc:plan`**: Team name `kc-plan-{slug}` (from the research topic)
|
|
106
|
+
- **`/kc:audit`**: Team name `kc-audit-{timestamp}`
|
|
107
|
+
|
|
108
|
+
Creating a team establishes:
|
|
109
|
+
- A shared task list for structured work tracking
|
|
110
|
+
- A team config that teammates can read to discover each other
|
|
111
|
+
- A coordination namespace for mailbox messaging
|
|
112
|
+
|
|
113
|
+
### Cleanup
|
|
114
|
+
|
|
115
|
+
After the workflow completes (or if cancelled), the lead:
|
|
116
|
+
1. Shuts down all active teammates — waits for each to confirm shutdown
|
|
117
|
+
2. Deletes the team — removes team config and task list
|
|
118
|
+
|
|
119
|
+
No teammates or team resources should remain after a workflow ends.
|
|
62
120
|
|
|
63
121
|
---
|
|
64
122
|
|
|
@@ -67,11 +125,13 @@ Agent Teams supports event-driven coordination via hooks:
|
|
|
67
125
|
When running as teammates in a Claude Code Agent Teams workflow, all agents follow these conventions:
|
|
68
126
|
|
|
69
127
|
### Task Lifecycle
|
|
70
|
-
-
|
|
128
|
+
- Your spawn prompt or DM includes your assigned task ID (e.g., `**Your Task**: #5`)
|
|
129
|
+
- Claim immediately: `TaskUpdate(taskId, status: "in_progress")`
|
|
71
130
|
- Read context files listed in task description independently (do not duplicate context across agents)
|
|
72
131
|
- Report progress by updating task status
|
|
73
|
-
- When complete:
|
|
132
|
+
- When complete: `TaskUpdate(taskId, status: "completed")` with a summary
|
|
74
133
|
- If blocked: keep task in_progress with blocker description
|
|
134
|
+
- Do NOT create new tasks for work already assigned to you — use the provided task ID
|
|
75
135
|
|
|
76
136
|
### Plan Approval (architect, builder only)
|
|
77
137
|
- **Architect**: Present spec drafts as a plan for lead review before finalizing. Wait for lead approval before writing final specs
|
|
@@ -79,42 +139,221 @@ When running as teammates in a Claude Code Agent Teams workflow, all agents foll
|
|
|
79
139
|
|
|
80
140
|
### Inter-Agent Communication
|
|
81
141
|
|
|
82
|
-
> **Note:** In
|
|
142
|
+
> **Note:** In `/kc:work` Parallel Teams mode, teammates coexist within stages: scouts run alongside analysts, builders and reviewers persist through the gap loop. The messaging patterns below are actively used. In Sequential Teams mode (`--sequential`), teammates are spawned one at a time — inter-phase communication goes through the lead via WorkGroup files.
|
|
83
143
|
|
|
84
144
|
Use mailbox messaging for coordination between teammates:
|
|
85
145
|
|
|
86
146
|
| From | To | When |
|
|
87
147
|
|------|-----|------|
|
|
148
|
+
| scout | all | Initial context/vault findings (broadcast) |
|
|
88
149
|
| analyst | architect | Scope clarifications, NodeID overlap with existing specs |
|
|
89
150
|
| architect | analyst | Scope adjustments needed |
|
|
90
|
-
| architect | builder |
|
|
151
|
+
| architect | builder | Design guidance and spec intent responses |
|
|
91
152
|
| builder | analyst | Affected files and dependency questions |
|
|
92
|
-
| builder | architect | Spec
|
|
93
|
-
|
|
|
153
|
+
| builder | architect | Spec clarification requests |
|
|
154
|
+
| builder | builder | Shared interface changes, dependency coordination |
|
|
155
|
+
| reviewer | lead | Gap reports per partition (structured format via task summaries) |
|
|
156
|
+
| lead | builder | Gap fix assignments with context (task creation + DM) |
|
|
157
|
+
| lead | reviewer | Re-audit requests after gap fixes (task creation + DM) |
|
|
158
|
+
| lead | knowz-scribe | Capture messages at quality gates (`"Capture Phase 1A: {wgid}"`, etc.) |
|
|
159
|
+
| closer | knowz-scribe | Phase 3 learning capture (`"Capture Phase 3: {wgid}"`) |
|
|
94
160
|
| closer | analyst | Change scope for log entry accuracy |
|
|
95
161
|
| closer | architect | Spec format and legacy migration |
|
|
162
|
+
| security-officer | lead | Structured finding reports at gates (with `[SECURITY-BLOCK]` for CRITICAL/HIGH) |
|
|
163
|
+
| security-officer | architect | Security VERIFY criteria needs during Phase 1B |
|
|
164
|
+
| security-officer | builder | Security guidance for sensitive partitions (max 2 DMs per builder) |
|
|
165
|
+
| security-officer | test-advisor | Cross-cutting: test gaps in security-critical paths (max 2 inter-specialist DMs) |
|
|
166
|
+
| test-advisor | lead | Test quality reports at gates |
|
|
167
|
+
| test-advisor | architect | VERIFY criteria testability concerns during Phase 1B |
|
|
168
|
+
| test-advisor | builder | Specific test improvement feedback (max 2 DMs per builder) |
|
|
169
|
+
| test-advisor | security-officer | Cross-cutting: security scenarios needing test coverage (max 2 inter-specialist DMs) |
|
|
170
|
+
| project-advisor | lead | Backlog context (Stage 0) and proposals (late Stage 2) |
|
|
171
|
+
| project-advisor | knowz-scribe | Idea captures for vault storage |
|
|
172
|
+
|
|
173
|
+
### Gap Communication Flow
|
|
174
|
+
In Parallel Teams mode, gap communication goes through the lead:
|
|
175
|
+
1. Reviewer reports gaps in task completion summary (structured format)
|
|
176
|
+
2. Lead creates fix task and pre-assigns to builder:
|
|
177
|
+
`TaskCreate("Fix gaps: NodeID-X")` → `TaskUpdate(taskId, owner: "builder-N")`
|
|
178
|
+
3. Lead sends DM to builder with task ID and gap details:
|
|
179
|
+
`"**New Task**: #{fix-task-id} — Fix gaps: NodeID-X. {file path, VERIFY criterion, expected vs actual}"`
|
|
180
|
+
4. Builder claims fix task, fixes gaps, marks fix task complete
|
|
181
|
+
5. Lead creates re-audit task and pre-assigns to reviewer:
|
|
182
|
+
`TaskCreate("Re-audit: NodeID-X")` → `TaskUpdate(taskId, owner: "reviewer-N")`
|
|
183
|
+
6. Lead sends DM to reviewer with task ID:
|
|
184
|
+
`"**New Task**: #{reaudit-task-id} — Re-audit: NodeID-X. {gap list}"`
|
|
185
|
+
|
|
186
|
+
In Sequential Teams mode, the lead spawns a new builder with gap context, then a new reviewer for re-audit.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Parallel Teams Orchestration
|
|
191
|
+
|
|
192
|
+
This section defines conventions specific to Parallel Teams mode in `/kc:work`. For the full orchestration flow, see `commands/work.md`.
|
|
193
|
+
|
|
194
|
+
### Lead Responsibilities in Parallel Mode
|
|
195
|
+
|
|
196
|
+
- Lead is the **sole WorkGroup file writer** — agents report via task completion summaries, lead consolidates
|
|
197
|
+
- Lead manages all agent lifecycles (spawn, shutdown) — agents never self-shutdown
|
|
198
|
+
- Lead creates the task graph progressively (not all upfront) based on dependency map
|
|
199
|
+
- Lead mediates gap flow: reviewer → lead → builder (not direct reviewer → builder for actionable gaps)
|
|
200
|
+
- Lead uses DM messages alongside task creation to provide context and coordinate
|
|
201
|
+
|
|
202
|
+
### Task Assignment Protocol
|
|
203
|
+
|
|
204
|
+
When creating a task for a specific agent, the lead MUST thread the task ID:
|
|
205
|
+
1. `TaskCreate(subject, description)` → capture returned `{task-id}`
|
|
206
|
+
2. `TaskUpdate(taskId: "{task-id}", owner: "{agent-name}")` — pre-assign
|
|
207
|
+
3. Include the task ID in the agent's context:
|
|
208
|
+
- **Spawn prompt** (new agent): Add `**Your Task**: #{task-id}` line
|
|
209
|
+
- **DM** (existing agent): Include `**New Task**: #{task-id} — "{subject}"`
|
|
210
|
+
|
|
211
|
+
Agents must NOT create new tasks for work already assigned to them via task ID.
|
|
212
|
+
|
|
213
|
+
### Agent Lifecycle
|
|
214
|
+
|
|
215
|
+
| Agent | Spawn At | Shut Down At | Purpose While Alive |
|
|
216
|
+
|-------|----------|-------------|---------------------|
|
|
217
|
+
| context-scout-specs | Stage 0 | After Gate #2 | Spec context lookups |
|
|
218
|
+
| context-scout-workgroups | Stage 0 | After Gate #2 | WorkGroup history lookups |
|
|
219
|
+
| context-scout-backlog | Stage 0 | After Gate #2 | Tracker/log/architecture lookups |
|
|
220
|
+
| knowz-scout | Stage 0 | After Phase 3 capture | Vault queries (read-only) throughout workflow |
|
|
221
|
+
| knowz-scribe | Stage 0 | After Phase 3 capture | Vault writes — receives capture messages, handles all `create_knowledge` calls |
|
|
222
|
+
| analyst | Stage 0 | Early Stage 2 | Scope questions from builders |
|
|
223
|
+
| architect | Stage 0 (pre-load) | After Gate #3 | Spec clarifications + design guidance for builders throughout Stage 2 |
|
|
224
|
+
| builder(s) | Stage 2 | After Gate #3 | Implementation + gap fixes (persistent through gap loop) |
|
|
225
|
+
| reviewer(s) | Stage 2 (1 per builder partition) | After Gate #3 | Incremental audit per partition (persistent through gap loop) |
|
|
226
|
+
| security-officer | Stage 0 (Group C) | After Gate #3 | Threat modeling + vulnerability scanning (officer — can block gates) |
|
|
227
|
+
| test-advisor | Stage 0 (Group C) | After Gate #3 | TDD enforcement + test quality review (advisor — informational) |
|
|
228
|
+
| project-advisor | Stage 0 (Group C) | Mid-Stage 2 | Backlog curation + idea capture (advisor — informational) |
|
|
229
|
+
| closer | Stage 3 | End of workflow | Finalization |
|
|
230
|
+
|
|
231
|
+
### Task Dependency Usage
|
|
232
|
+
|
|
233
|
+
All tasks in a workflow use `addBlockedBy` to express the dependency chain:
|
|
234
|
+
1. **Visibility**: `TaskList` shows the workflow graph at any point
|
|
235
|
+
2. **Future automation**: Hooks (`TeammateIdle`, `TaskCompleted`) can auto-assign when dependencies resolve
|
|
236
|
+
3. **Progressive creation**: Lead creates tasks stage-by-stage, not all upfront
|
|
237
|
+
|
|
238
|
+
### Task Graph Patterns
|
|
239
|
+
|
|
240
|
+
- Stage 0 tasks: scout + knowz-scribe + analysis tasks (no deps)
|
|
241
|
+
- Stage 1 tasks: spec drafting tasks (blocked by gate approval — lead creates after gate)
|
|
242
|
+
- Stage 2 tasks: implementation subtasks (blocked by spec approval), audit subtasks (blocked by implementation)
|
|
243
|
+
- Stage 3 tasks: finalization (blocked by audit approval)
|
|
96
244
|
|
|
97
|
-
###
|
|
98
|
-
When the reviewer finds gaps during Phase 2B audit, message the builder with specific details:
|
|
99
|
-
- File path and line number
|
|
100
|
-
- Criterion not met (the VERIFY: statement)
|
|
101
|
-
- Expected behavior vs actual behavior
|
|
245
|
+
### Orchestration Configuration
|
|
102
246
|
|
|
103
|
-
|
|
247
|
+
Team sizing defaults are configurable via `knowzcode/knowzcode_orchestration.md`:
|
|
248
|
+
|
|
249
|
+
| Parameter | Default | Flag Override | Effect |
|
|
250
|
+
|-----------|---------|--------------|--------|
|
|
251
|
+
| `max_builders` | 5 | `--max-builders=N` | Cap concurrent builders (1-5) |
|
|
252
|
+
| `scout_mode` | full | `--no-scouts` | full (3 scouts), minimal (1 scout), none (lead reads context) |
|
|
253
|
+
| `default_specialists` | [] | `--specialists`, `--no-specialists` | Project-level specialist defaults |
|
|
254
|
+
| `mcp_agents_enabled` | true | `--no-mcp` | Toggle vault agents (knowz-scout, knowz-scribe) |
|
|
255
|
+
|
|
256
|
+
Precedence: hardcoded defaults → orchestration config → per-invocation flags.
|
|
257
|
+
|
|
258
|
+
### Builder Partitioning Rules
|
|
259
|
+
|
|
260
|
+
- No two builders touch the same file
|
|
261
|
+
- Analyst dependency map determines partitions
|
|
262
|
+
- Max `MAX_BUILDERS` concurrent builders (default 5, configurable in `knowzcode_orchestration.md`)
|
|
263
|
+
- If all NodeIDs share files → single builder with subtask tracking
|
|
264
|
+
- Builder-to-builder messages for interface changes affecting other partitions
|
|
265
|
+
|
|
266
|
+
### Persistent Agent Patterns
|
|
267
|
+
|
|
268
|
+
In `/kc:work` Parallel Teams mode, agents persist across sub-phases for efficiency:
|
|
269
|
+
|
|
270
|
+
#### Build + Audit Loop
|
|
271
|
+
During Stage 2, each builder is paired with a dedicated reviewer for its partition:
|
|
272
|
+
- One reviewer per builder partition (e.g., builder-1 ↔ reviewer-1, builder-2 ↔ reviewer-2)
|
|
273
|
+
- Each reviewer audits only the NodeIDs in its paired builder's partition
|
|
274
|
+
- Gap loops run independently per partition — partition A's gap loop does not block partition B's audit
|
|
275
|
+
- If gaps found: lead creates fix task for the partition's builder + re-audit task for the partition's reviewer
|
|
276
|
+
- All builders and reviewers stay alive through the entire gap loop — shut down only after Gate #3
|
|
277
|
+
|
|
278
|
+
This eliminates both cold-start overhead (no respawning) and the sequential bottleneck (no single reviewer processing all partitions).
|
|
279
|
+
|
|
280
|
+
#### Architect Consultative Persistence
|
|
281
|
+
During Stage 2, the architect persists as a read-only consultative resource:
|
|
282
|
+
- Responds to builder DMs about spec intent, interface contracts, and design decisions
|
|
283
|
+
- Does NOT write code, modify specs, or create tasks
|
|
284
|
+
- Lead notifies architect when builders are spawned — architect sends intro message to each builder
|
|
285
|
+
- Shut down with builders and reviewers after Gate #3
|
|
286
|
+
|
|
287
|
+
#### Discovery Pre-loading
|
|
288
|
+
During Stage 0, the architect pre-loads context in parallel with analysis:
|
|
289
|
+
- Architect reads architecture docs, existing specs, project config
|
|
290
|
+
- When Gate #1 is approved, architect already has context → specs drafted faster
|
|
291
|
+
- If Gate #1 rejected, architect context is still useful for the revised analysis cycle
|
|
292
|
+
|
|
293
|
+
#### Specialist Agents (Group C — opt-in via `--specialists`)
|
|
294
|
+
|
|
295
|
+
When specialists are enabled, three additional agents spawn at Stage 0 alongside Groups A and B:
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Group A (always): 3 context-scouts + analyst + architect (5 agents)
|
|
299
|
+
Group B (if MCP): knowz-scout + knowz-scribe (2 agents)
|
|
300
|
+
Group C (if --specialists): security-officer + test-advisor + project-advisor (3 agents)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Max Stage 0 concurrent: 5-10 agents depending on orchestration config (scouts, MCP agents, specialists). Scouts shut down after Gate #2, so Stage 2 peak is manageable.
|
|
304
|
+
|
|
305
|
+
##### Officer vs Advisor Authority
|
|
306
|
+
|
|
307
|
+
| Role | Authority | Gate Impact |
|
|
308
|
+
|------|-----------|-------------|
|
|
309
|
+
| **Officer** (security-officer) | CRITICAL/HIGH findings block gates | `[SECURITY-BLOCK]` tag pauses autonomous mode |
|
|
310
|
+
| **Advisor** (test-advisor, project-advisor) | Informational only | Findings included in gate reports, do not block |
|
|
311
|
+
|
|
312
|
+
##### Direct DM Protocol
|
|
313
|
+
|
|
314
|
+
Specialists communicate directly with builders, architect, and each other — no lead bottleneck relay:
|
|
315
|
+
|
|
316
|
+
- **security-officer → architect**: Security VERIFY criteria needs during Phase 1B
|
|
317
|
+
- **security-officer → builder-N**: Security guidance for sensitive partitions (max 2 DMs per builder)
|
|
318
|
+
- **test-advisor → architect**: VERIFY criteria testability concerns during Phase 1B
|
|
319
|
+
- **test-advisor → builder-N**: Specific test improvement feedback (max 2 DMs per builder)
|
|
320
|
+
- **project-advisor → knowz-scribe**: Idea captures for vault storage
|
|
321
|
+
- **security-officer ↔ test-advisor**: Cross-cutting test gaps in security paths (max 2 inter-specialist DMs total)
|
|
322
|
+
|
|
323
|
+
##### Communication Discipline
|
|
324
|
+
|
|
325
|
+
- Max 2 DMs to any individual builder from each specialist
|
|
326
|
+
- Max 2 inter-specialist DMs per workflow
|
|
327
|
+
- Consolidate findings — no per-file noise
|
|
328
|
+
- project-advisor does NOT DM builders or other specialists (observes via task list only)
|
|
104
329
|
|
|
105
330
|
---
|
|
106
331
|
|
|
107
332
|
## Teammate Initialization Protocol
|
|
108
333
|
|
|
334
|
+
### Agent Teams Mode (spawned as a teammate)
|
|
335
|
+
|
|
109
336
|
When spawned as a teammate in an Agent Teams workflow, follow this sequence:
|
|
110
337
|
|
|
111
|
-
1. Read your agent definition file (referenced in your spawn prompt
|
|
112
|
-
2.
|
|
113
|
-
3. Read
|
|
114
|
-
4. Read
|
|
115
|
-
5.
|
|
116
|
-
6.
|
|
117
|
-
7.
|
|
338
|
+
1. Read your agent definition file (referenced in your spawn prompt)
|
|
339
|
+
2. Claim your assigned task: `TaskUpdate(taskId: "{task-id from spawn prompt}", status: "in_progress")`
|
|
340
|
+
3. Read this file (`knowzcode/claude_code_execution.md`) for team conventions
|
|
341
|
+
4. Read the WorkGroup file for current state, Change Set, and context
|
|
342
|
+
5. Read context files listed in your task description
|
|
343
|
+
6. Begin your phase work as defined by your role
|
|
344
|
+
7. Update the WorkGroup file with results — prefix all todo entries with `KnowzCode:`
|
|
345
|
+
8. Mark your task as complete with a summary of what was delivered
|
|
346
|
+
|
|
347
|
+
### Subagent Mode (spawned via Task())
|
|
348
|
+
|
|
349
|
+
When spawned as a custom subagent type (e.g. `subagent_type: "analyst"`), your agent definition from `agents/*.md` is **auto-loaded as your system prompt**. This means:
|
|
350
|
+
|
|
351
|
+
- Step 1 above is already done — your role definition, tools, and constraints are pre-loaded
|
|
352
|
+
- Your `tools`, `model`, `permissionMode`, and `maxTurns` from the YAML frontmatter are enforced automatically
|
|
353
|
+
- You only need to read the task-specific context provided in the spawn prompt (WorkGroup file, specs, context files)
|
|
354
|
+
- Begin your phase work directly
|
|
355
|
+
|
|
356
|
+
### For Both Modes
|
|
118
357
|
|
|
119
358
|
If you encounter a blocker, keep the task in `in_progress` status with a description of what is blocking you. Do not mark the task as complete until the work is done.
|
|
120
359
|
|
|
@@ -131,3 +370,33 @@ Agents may reference these Claude Code commands as escalation paths:
|
|
|
131
370
|
| `/kc:audit spec` | knowledge-migrator | Post-migration validation |
|
|
132
371
|
|
|
133
372
|
On other platforms, these commands translate to running the corresponding phase prompts manually.
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Verification & Troubleshooting
|
|
377
|
+
|
|
378
|
+
### How to verify Agent Teams is working
|
|
379
|
+
|
|
380
|
+
1. Run `/kc:status` — check the Agent Teams section for "Enabled" status and agent definitions
|
|
381
|
+
2. Run `/kc:work` — confirm a mode announcement appears before Phase 1A (either "Agent Teams" or "Subagent Delegation")
|
|
382
|
+
3. In-process mode: press Shift+Down to see spawned teammates in the panel
|
|
383
|
+
4. Check the WorkGroup file — should show phase transitions with timestamps in the Phase History table
|
|
384
|
+
|
|
385
|
+
### Common issues
|
|
386
|
+
|
|
387
|
+
| Symptom | Cause | Fix |
|
|
388
|
+
|---------|-------|-----|
|
|
389
|
+
| No mode announcement | Command didn't run setup step | Verify commands are updated (Step 2 should announce mode) |
|
|
390
|
+
| "Subagent Delegation" when expecting Agent Teams | Env var not set or Claude Code not restarted | Add `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` to settings.json `env` block. **Restart Claude Code** — env vars are only loaded on startup. |
|
|
391
|
+
| Agents seem generic / no specialization | Agent definitions not loaded | Check `agents/` directory exists with `.md` files for each role |
|
|
392
|
+
| No quality gates appearing | Command instructions not followed | Re-run `/kc:work` with an explicit goal description |
|
|
393
|
+
| Teammates not visible in panel | Using tmux mode on Windows | Windows uses in-process mode — teammates won't appear in a split pane |
|
|
394
|
+
|
|
395
|
+
### Verifying after a workflow
|
|
396
|
+
|
|
397
|
+
Check the WorkGroup file at `knowzcode/workgroups/{wgid}.md`:
|
|
398
|
+
|
|
399
|
+
- **Phase History table** should show all phases with timestamps and statuses
|
|
400
|
+
- **Change Set** should be populated (Phase 1A output) with NodeIDs and descriptions
|
|
401
|
+
- **Todos** should all start with the `KnowzCode:` prefix
|
|
402
|
+
- **Status** should show "Closed" after Phase 3 completes
|