@codyswann/lisa 1.80.0 → 1.81.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.
Files changed (49) hide show
  1. package/package.json +1 -1
  2. package/plugins/lisa/.claude-plugin/plugin.json +14 -10
  3. package/plugins/lisa/agents/bug-fixer.md +1 -1
  4. package/plugins/lisa/agents/builder.md +1 -1
  5. package/plugins/lisa/agents/jira-agent.md +10 -9
  6. package/plugins/lisa/commands/build.md +3 -3
  7. package/plugins/lisa/commands/fix.md +3 -3
  8. package/plugins/lisa/commands/improve.md +8 -8
  9. package/plugins/lisa/commands/investigate.md +1 -1
  10. package/plugins/lisa/commands/monitor.md +2 -2
  11. package/plugins/lisa/commands/plan/create.md +3 -1
  12. package/plugins/lisa/commands/plan/execute.md +1 -1
  13. package/plugins/lisa/commands/plan.md +3 -1
  14. package/plugins/lisa/commands/research.md +8 -0
  15. package/plugins/lisa/commands/review.md +2 -2
  16. package/plugins/lisa/commands/ship.md +2 -4
  17. package/plugins/lisa/commands/verify.md +10 -0
  18. package/plugins/lisa/hooks/inject-flow-context.sh +12 -0
  19. package/plugins/lisa/rules/base-rules.md +4 -0
  20. package/plugins/lisa/rules/intent-routing.md +204 -82
  21. package/plugins/lisa/rules/verification.md +11 -0
  22. package/plugins/lisa/skills/plan-execute/SKILL.md +36 -19
  23. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  27. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  28. package/plugins/src/base/.claude-plugin/plugin.json +6 -10
  29. package/plugins/src/base/agents/bug-fixer.md +1 -1
  30. package/plugins/src/base/agents/builder.md +1 -1
  31. package/plugins/src/base/agents/jira-agent.md +10 -9
  32. package/plugins/src/base/commands/build.md +3 -3
  33. package/plugins/src/base/commands/fix.md +3 -3
  34. package/plugins/src/base/commands/improve.md +8 -8
  35. package/plugins/src/base/commands/investigate.md +1 -1
  36. package/plugins/src/base/commands/monitor.md +2 -2
  37. package/plugins/src/base/commands/plan/create.md +3 -1
  38. package/plugins/src/base/commands/plan/execute.md +1 -1
  39. package/plugins/src/base/commands/plan.md +3 -1
  40. package/plugins/src/base/commands/research.md +8 -0
  41. package/plugins/src/base/commands/review.md +2 -2
  42. package/plugins/src/base/commands/ship.md +2 -4
  43. package/plugins/src/base/commands/verify.md +10 -0
  44. package/plugins/src/base/hooks/inject-flow-context.sh +12 -0
  45. package/plugins/src/base/rules/base-rules.md +4 -0
  46. package/plugins/src/base/rules/intent-routing.md +204 -82
  47. package/plugins/src/base/rules/verification.md +11 -0
  48. package/plugins/src/base/skills/plan-execute/SKILL.md +36 -19
  49. package/scripts/test-intent-routing.sh +221 -0
package/package.json CHANGED
@@ -76,7 +76,7 @@
76
76
  "lodash": ">=4.18.1"
77
77
  },
78
78
  "name": "@codyswann/lisa",
79
- "version": "1.80.0",
79
+ "version": "1.81.1",
80
80
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
81
81
  "main": "dist/index.js",
82
82
  "exports": {
@@ -1,27 +1,22 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "1.80.0",
3
+ "version": "1.81.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
7
7
  },
8
8
  "hooks": {
9
9
  "UserPromptSubmit": [
10
- {
11
- "matcher": "",
12
- "hooks": [
13
- {
14
- "type": "command",
15
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/enforce-plan-rules.sh"
16
- }
17
- ]
18
- },
19
10
  {
20
11
  "matcher": "",
21
12
  "hooks": [
22
13
  {
23
14
  "type": "command",
24
15
  "command": "command -v entire >/dev/null 2>&1 && entire hooks claude-code user-prompt-submit || true"
16
+ },
17
+ {
18
+ "type": "prompt",
19
+ "prompt": "Classify this user request into exactly one flow. Output ONLY valid JSON.\n\nFlows:\n- Research: User needs requirements defined, wants a PRD, exploring a problem space, open-ended feature idea\n- Plan: User has requirements and wants them broken into tickets/work items\n- Implement/Build: User has a specific feature/story/task to code\n- Implement/Fix: User has a bug to fix, something is broken\n- Implement/Improve: User wants to refactor, optimize, or improve existing code\n- Implement/Investigate: User wants to understand why something works a certain way (spike)\n- Verify: User has code ready to ship (PR, deploy, merge)\n- None: Simple question, config change, one-off task, or not enough context to classify\n\nOutput format: {\"hookSpecificOutput\":{\"hookEventName\":\"UserPromptSubmit\",\"additionalContext\":\"Flow classification: [FLOW]. Reason: [one sentence].\"}}\n\nUser request: $ARGUMENTS"
25
20
  }
26
21
  ]
27
22
  }
@@ -133,6 +128,15 @@
133
128
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/inject-rules.sh"
134
129
  }
135
130
  ]
131
+ },
132
+ {
133
+ "matcher": "",
134
+ "hooks": [
135
+ {
136
+ "type": "command",
137
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/inject-flow-context.sh"
138
+ }
139
+ ]
136
140
  }
137
141
  ],
138
142
  "SessionEnd": [
@@ -14,7 +14,7 @@ You are a bug fix specialist. Your job is to turn a diagnosed bug into a verifie
14
14
 
15
15
  ## Prerequisites
16
16
 
17
- You receive a diagnosed bug from the Fix flow with:
17
+ You receive a diagnosed bug from the **Implement** flow (Fix work type) with:
18
18
  - **Root cause** — what is causing the bug and where (file:line)
19
19
  - **Reproduction** — how to trigger the bug reliably
20
20
  - **Test strategy** — what regression tests to write (from `test-specialist`)
@@ -14,7 +14,7 @@ You are a feature build specialist. Your job is to turn acceptance criteria into
14
14
 
15
15
  ## Prerequisites
16
16
 
17
- You receive a task from the Build flow with:
17
+ You receive a task from the **Implement** flow (Build or Improve work type) with:
18
18
  - **Acceptance criteria** — what the feature must do (from `product-specialist`)
19
19
  - **Architecture plan** — which files to create/modify, design decisions, reusable code (from `architecture-specialist`)
20
20
  - **Test strategy** — coverage targets, edge cases, TDD sequence (from `test-specialist`)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jira-agent
3
- description: JIRA lifecycle agent. Reads tickets, determines intent (Bug → Fix, Story/Task → Build, Epic → Plan), delegates to the appropriate flow, syncs progress at milestones, and posts evidence at completion.
3
+ description: JIRA lifecycle agent. Reads tickets, determines intent (Bug → Implement/Fix, Story/Task → Implement/Build, Epic → Plan, Spike → Implement/Investigate), delegates to the appropriate flow, syncs progress at milestones, and posts evidence at completion.
4
4
  tools: Read, Grep, Glob, Bash
5
5
  skills:
6
6
  - jira-sync
@@ -55,15 +55,16 @@ If not triaged:
55
55
 
56
56
  Map the ticket type to a flow:
57
57
 
58
- | Ticket Type | Flow | Entry Agent |
59
- |-------------|------|-------------|
60
- | Bug | Fix | `git-history-analyzer` → `debug-specialist` → `bug-fixer` |
61
- | Story | Build | `product-specialist` → `architecture-specialist` → `builder` |
62
- | Task | Build | `product-specialist` → `architecture-specialist` → `builder` |
63
- | Epic | Plan | `product-specialist` → `architecture-specialist` → break down |
64
- | Spike | Investigate | `git-history-analyzer` `debug-specialist` |
58
+ | Ticket Type | Flow | Work Type |
59
+ |-------------|------|-----------|
60
+ | Epic | Plan | -- |
61
+ | Story | Implement | Build |
62
+ | Task | Implement | Build |
63
+ | Bug | Implement | Fix |
64
+ | Spike | Implement | Investigate Only |
65
+ | Improvement | Implement | Improve |
65
66
 
66
- If the ticket type is ambiguous, read the description to classify. A "Task" that describes broken behavior is a Fix, not a Build.
67
+ If the ticket type is ambiguous, read the description to classify. A "Task" that describes broken behavior is a Fix, not a Build. A "Bug" that requests new functionality is a Build.
67
68
 
68
69
  ### 5. Delegate to Flow
69
70
 
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: "Build a feature. Defines acceptance criteria, researches codebase, implements via TDD, reviews, verifies, and ships."
2
+ description: "Build a feature. Defines acceptance criteria, researches codebase, implements via TDD, verifies locally, and reviews."
3
3
  argument-hint: "<description-or-ticket-id-or-url>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Build** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Implement** flow with the **Build** work type.
7
7
 
8
- If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket, extract context, and delegate back to the Build flow.
8
+ If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket, extract context, and delegate back to the Implement flow.
9
9
 
10
10
  $ARGUMENTS
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: "Fix a bug. Analyzes git history, reproduces, finds root cause, implements fix via TDD, verifies, and ships."
2
+ description: "Fix a bug. Reproduces, analyzes git history, finds root cause, implements fix via TDD, verifies locally, and reviews."
3
3
  argument-hint: "<description-or-ticket-id-or-url>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Fix** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Implement** flow with the **Fix** work type.
7
7
 
8
- If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket, extract context, and delegate back to the Fix flow.
8
+ If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket, extract context, and delegate back to the Implement flow.
9
9
 
10
10
  $ARGUMENTS
@@ -1,16 +1,16 @@
1
1
  ---
2
- description: "Improve existing code. Identifies target, measures baseline, implements improvements via TDD, measures again, and ships."
2
+ description: "Improve existing code. Measures baseline, implements improvements via TDD, measures again, and reviews."
3
3
  argument-hint: "<target-description>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Improve** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Implement** flow with the **Improve** work type.
7
7
 
8
8
  For specific improvement types, you can also use:
9
- - `/lisa:plan:add-test-coverage` increase test coverage
10
- - `/lisa:plan:fix-linter-error` fix lint rule violations
11
- - `/lisa:plan:lower-code-complexity` reduce cognitive complexity
12
- - `/lisa:plan:reduce-max-lines` reduce file length
13
- - `/lisa:plan:reduce-max-lines-per-function` reduce function length
14
- - `/lisa:plan:improve-tests` improve test quality
9
+ - `/lisa:plan:add-test-coverage` -- increase test coverage
10
+ - `/lisa:plan:fix-linter-error` -- fix lint rule violations
11
+ - `/lisa:plan:lower-code-complexity` -- reduce cognitive complexity
12
+ - `/lisa:plan:reduce-max-lines` -- reduce file length
13
+ - `/lisa:plan:reduce-max-lines-per-function` -- reduce function length
14
+ - `/lisa:plan:improve-tests` -- improve test quality
15
15
 
16
16
  $ARGUMENTS
@@ -3,7 +3,7 @@ description: "Investigate an issue. Analyzes git history, reproduces, traces exe
3
3
  argument-hint: "<description-or-ticket-id-or-url>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Investigate** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Implement** flow with the **Investigate Only** work type (spike).
7
7
 
8
8
  If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket and extract context.
9
9
 
@@ -3,8 +3,8 @@ description: "Monitor application health. Checks health endpoints, logs, errors,
3
3
  argument-hint: "[environment]"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Monitor** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Monitor** sub-flow.
7
7
 
8
- Delegates to `ops-specialist` for health checks, log inspection, error monitoring, and performance analysis.
8
+ This sub-flow is also invoked as part of the Verify flow's remote verification step. Delegates to `ops-specialist` for health checks, log inspection, error monitoring, and performance analysis.
9
9
 
10
10
  $ARGUMENTS
@@ -3,4 +3,6 @@ description: "Creates an implementation plan from a ticket URL, file path, or te
3
3
  argument-hint: "<ticket-url | @file-path | description>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Plan** flow on $ARGUMENTS
6
+ Read `.claude/rules/intent-routing.md` and execute the **Plan** flow on $ARGUMENTS.
7
+
8
+ If requirements are ambiguous or no specification exists, suggest running the **Research** flow first.
@@ -3,4 +3,4 @@ description: "Deploys an agent team to research, implement, review and deploy a
3
3
  argument-hint: "<ticket-url | @file-path | description>"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and determine the appropriate flow for $ARGUMENTS. Execute the full flow including implementation, review, and ship sub-flows.
6
+ Read `.claude/rules/intent-routing.md` and determine the appropriate flow for $ARGUMENTS. Execute the full flow including implementation, review, and verify flows.
@@ -1,10 +1,12 @@
1
1
  ---
2
- description: "Plan work. Defines acceptance criteria, researches codebase, maps dependencies, and breaks down into ordered tasks."
2
+ description: "Plan work. Defines acceptance criteria, researches codebase, maps dependencies, and breaks down into ordered work items."
3
3
  argument-hint: "<description-or-ticket-id-or-url>"
4
4
  ---
5
5
 
6
6
  Read `.claude/rules/intent-routing.md` and execute the **Plan** flow.
7
7
 
8
+ If no PRD or specification exists, suggest running the **Research** flow first to produce one.
9
+
8
10
  If the argument is a JIRA ticket ID or URL, hand off to the `jira-agent` which will read the ticket and extract context.
9
11
 
10
12
  $ARGUMENTS
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Research a problem space and produce a PRD. Investigates codebase, defines user flows, assesses technical feasibility."
3
+ argument-hint: "<problem-statement-or-feature-idea>"
4
+ ---
5
+
6
+ Read `.claude/rules/intent-routing.md` and execute the **Research** flow.
7
+
8
+ $ARGUMENTS
@@ -3,8 +3,8 @@ description: "Review code changes. Runs quality, security, performance, product,
3
3
  argument-hint: "[pr-link-or-branch]"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Review** flow.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Review** sub-flow.
7
7
 
8
- Runs `quality-specialist`, `security-specialist`, and `performance-specialist` in parallel, followed by `product-specialist` and `test-specialist`. Consolidates all findings ranked by severity.
8
+ This sub-flow is also invoked automatically by the Implement flow. It runs `quality-specialist`, `security-specialist`, and `performance-specialist` in parallel, followed by `product-specialist` and `test-specialist`. Consolidates all findings ranked by severity.
9
9
 
10
10
  $ARGUMENTS
@@ -1,10 +1,8 @@
1
1
  ---
2
- description: "Ship current changes. Commits, opens PR, handles review feedback loop, deploys, verifies, and monitors."
2
+ description: "Ship current changes. Alias for /verify."
3
3
  argument-hint: "[commit-message-hint]"
4
4
  ---
5
5
 
6
- Read `.claude/rules/intent-routing.md` and execute the **Ship** flow.
7
-
8
- This includes: atomic commits, PR creation, review-fix loop (fix failed checks, resolve merge conflicts, handle bot review feedback until mergeable), merge, deploy, post-deploy verification, and monitoring.
6
+ Read `.claude/rules/intent-routing.md` and execute the **Verify** flow.
9
7
 
10
8
  $ARGUMENTS
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: "Ship and verify code. Commits, opens PR, handles review loop, merges, deploys, and verifies in target environment."
3
+ argument-hint: "[commit-message-hint]"
4
+ ---
5
+
6
+ Read `.claude/rules/intent-routing.md` and execute the **Verify** flow.
7
+
8
+ This includes: atomic commits, PR creation, CI/review-fix loop, merge, deploy monitoring, and remote verification.
9
+
10
+ $ARGUMENTS
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+ # Tells subagents not to ask users for flow selection.
3
+ # The parent agent has already determined the flow and work type.
4
+ # Used by SubagentStart hook.
5
+ set -euo pipefail
6
+
7
+ jq -n '{
8
+ "hookSpecificOutput": {
9
+ "hookEventName": "SubagentStart",
10
+ "additionalContext": "You are a subagent operating within an established flow. Your parent agent has already determined the flow and work type. Do NOT ask the user to choose a flow or classify the request. Execute your assigned work within the context provided by your parent agent."
11
+ }
12
+ }'
@@ -1,3 +1,7 @@
1
+ Intent Routing (FIRST — before anything else):
2
+
3
+ Before starting any work in a session, classify the user's initial request using the Intent Routing rule. Determine which flow applies (Research, Plan, Implement, Verify, or None) and check its readiness gate. Once a flow is established, all subsequent messages operate within it. Do not skip this step — even if the request seems simple. See the `intent-routing` rule for the full protocol.
4
+
1
5
  Requirement Verification:
2
6
 
3
7
  Never assume the person providing instructions has given you complete, correct, or technically precise requirements. Treat every request as potentially underspecified. Before starting any work:
@@ -1,114 +1,211 @@
1
1
  # Intent Routing
2
2
 
3
- Classify the user's request and execute the matching flow. Each flow is a sequence of agents. Sub-flows can be invoked by any flow.
3
+ MANDATORY: Before starting any work in a session, classify the user's initial request using the Flow Classification Protocol below. Do not respond, do not start work, do not ask questions until you have determined which flow applies. Once a flow is established, all subsequent messages operate within that flow — do not re-classify. This is not optional skipping classification leads to unstructured responses that bypass readiness gates.
4
4
 
5
- ## Flows
5
+ Each flow has a readiness gate that MUST pass before work begins. If the gate fails, stop and ask for what is missing.
6
6
 
7
- ### Fix
8
- When: Bug reports, broken behavior, error messages, JIRA bug tickets.
7
+ ## Flow Classification Protocol
9
8
 
10
- Sequence:
11
- 1. `git-history-analyzer` — understand why affected code exists, find related past fixes/reverts
12
- 2. `debug-specialist` — reproduce the bug, prove root cause with evidence
13
- 3. `architecture-specialist` — assess fix risk, identify files to change, check for ripple effects
14
- 4. `test-specialist` — design regression test strategy
15
- 5. `bug-fixer` — implement fix via TDD (reproduction becomes failing test)
16
- 6. **Verify sub-flow**
17
- 7. **Ship sub-flow**
18
- 8. `learner` — capture discoveries for future sessions
19
-
20
- ### Build
21
- When: New features, stories, tasks, JIRA story/task tickets.
9
+ A `UserPromptSubmit` prompt hook uses a fast model to pre-classify the user's request and injects the result as `additionalContext`. Use this classification as a strong hint but verify it against the flow definitions below.
22
10
 
23
- Sequence:
24
- 1. `product-specialist` define acceptance criteria, user flows, error states
25
- 2. `architecture-specialist` research codebase, design approach, map dependencies
26
- 3. `test-specialist` design test strategy (coverage, edge cases, TDD sequence)
27
- 4. `builder` implement via TDD (acceptance criteria become tests)
28
- 5. **Verify sub-flow**
29
- 6. **Review sub-flow**
30
- 7. **Ship sub-flow**
31
- 8. `learner` — capture discoveries
11
+ 1. If the user invoked a slash command (`/fix`, `/build`, `/plan`, etc.), the flow is already determined -- skip classification.
12
+ 2. If a flow hint was injected by the hook, verify it matches the request. If it does, proceed with that flow.
13
+ 3. If the classification is "None" or you disagree with the hint:
14
+ - **Interactive session** (user is present): present a multiple choice using AskUserQuestion with options: Research, Plan, Implement, Verify, No flow.
15
+ - **Headless/non-interactive session** (running with `-p` flag, in a CI pipeline, or as a scheduled agent): do NOT ask the user. Classify to the best of your ability from available context (ticket content, prompt text, current branch state). If you truly cannot classify, default to "No flow" and proceed with the request as-is.
16
+ 4. Once a flow is selected, check its readiness gate before proceeding.
17
+ 5. If you are a subagent: your parent agent has already determined the flow -- do NOT ask the user to choose a flow. Execute your assigned work within the established flow context.
32
18
 
33
- ### Investigate
34
- When: "Why is this happening?", triage requests, JIRA spike tickets.
19
+ ## Readiness Gate Protocol
20
+
21
+ Every flow begins with a gate check. The gate defines what information must be present before the flow can begin.
22
+
23
+ If the gate fails:
24
+ - **Interactive session** (user is present):
25
+ 1. Identify exactly what is missing
26
+ 2. Before asking the user, attempt to answer the questions yourself from available context (source code, docs, git history, project structure, config files). Only ask the user about information you genuinely cannot determine.
27
+ 3. When you do ask the user, provide recommended answers to choose from based on what you found in the codebase. Do not ask open-ended questions when you can offer specific options.
28
+ 4. Tell the user what is needed and why
29
+ 5. Do NOT proceed until the missing information is provided or resolved
30
+ 6. If the missing information can be obtained by running a preceding flow (e.g., Research before Plan), suggest that instead
31
+ - **Headless/non-interactive session** (running with `-p` flag, in a CI pipeline, or as a scheduled agent): do NOT block on missing information. Infer what you can from available context (ticket content, prompt text, codebase state, git history). Proceed with best effort using what is available. If critical information is truly unobtainable, fail with a clear error message explaining what was missing.
32
+
33
+ ## Main Flows
34
+
35
+ ### Research
36
+
37
+ When: "I need a PRD", "What should we build?", product discovery, requirements gathering, feature exploration, understanding a problem space, open-ended feature ideas.
38
+
39
+ Gate:
40
+ - A problem statement, feature idea, or business objective must be provided
41
+ - If none is provided, ask: "What problem are you trying to solve or what capability are you trying to add?"
35
42
 
36
43
  Sequence:
37
- 1. `git-history-analyzer` understand code evolution, find related changes
38
- 2. `debug-specialist` reproduce, trace execution, prove root cause
39
- 3. `ops-specialist` check logs, errors, health (if runtime issue)
40
- 4. Report findings with evidence, recommend next action (Fix, Build, or escalate)
44
+ 1. **Investigate sub-flow** -- gather context from codebase, git history, existing behavior, and external sources
45
+ 2. `product-specialist` -- define user goals, user flows (Gherkin), acceptance criteria, error states, UX concerns, and out-of-scope items
46
+ 3. `architecture-specialist` -- assess technical feasibility, identify constraints, map existing system boundaries
47
+ 4. Synthesize findings into a PRD document containing: problem statement, user stories, acceptance criteria, technical constraints, open questions, and proposed scope
48
+ 5. `learner` -- capture discoveries for future sessions
49
+
50
+ Output: A PRD document. If there is not enough context to produce a complete PRD, stop and report what is missing rather than producing an incomplete one.
41
51
 
42
52
  ### Plan
43
- When: "Break this down", epic planning, large scope work, JIRA epic tickets.
53
+
54
+ When: "Break this down", "Create tickets", epic planning, large scope work, JIRA epic tickets, "Turn this PRD into work items".
55
+
56
+ Gate:
57
+ - A PRD, specification document, or equivalent detailed description must be provided
58
+ - The specification must contain: clear scope, acceptance criteria, and enough detail to decompose into work items
59
+ - If no specification exists, stop and suggest running the **Research** flow first
60
+ - If the specification has unresolved ambiguities, stop and list them
44
61
 
45
62
  Sequence:
46
- 1. `product-specialist` define acceptance criteria for the whole scope
47
- 2. `architecture-specialist` understand scope, map dependencies, identify cross-cutting concerns
48
- 3. Break down into ordered tasks, each with: acceptance criteria, verification type, dependencies
63
+ 1. **Investigate sub-flow** -- explore codebase for architecture, patterns, dependencies relevant to the spec
64
+ 2. `product-specialist` -- validate and refine acceptance criteria for the whole scope
65
+ 3. `architecture-specialist` -- map dependencies, identify cross-cutting concerns, determine execution order
66
+ 4. Decompose into ordered work items (epics, stories, tasks, spikes, bugs), each with:
67
+ - Type (epic, story, task, spike, bug)
68
+ - Acceptance criteria
69
+ - Verification method
70
+ - Dependencies
71
+ - Skills required
72
+ 5. Create work items in the tracker (JIRA, Linear, GitHub) with acceptance criteria and dependencies
73
+ 6. `learner` -- capture discoveries for future sessions
74
+
75
+ Output: Work items in a tracker with acceptance criteria, ordered by dependency. If the specification cannot be decomposed without further clarification, stop and report what is missing.
76
+
77
+ ### Implement
78
+
79
+ When: Working on a specific ticket (story, task, bug, spike), implementing a well-defined piece of work.
80
+
81
+ Gate:
82
+ - A well-defined work item with acceptance criteria must be provided (ticket URL, file spec, or detailed description)
83
+ - The work item must have clear scope, expected behavior, and verification method
84
+ - If acceptance criteria are missing or ambiguous, stop and ask before proceeding
85
+ - If the work item is too large (epic-level), stop and suggest running the **Plan** flow first
86
+
87
+ Determine the work type and execute the matching variant:
88
+
89
+ #### Build (features, stories, tasks)
90
+
91
+ 1. **Investigate sub-flow** -- explore codebase for related code, patterns, dependencies
92
+ 2. `product-specialist` -- define acceptance criteria, user flows, error states
93
+ 3. `architecture-specialist` -- design approach, map files to modify, identify reusable code
94
+ 4. `test-specialist` -- design test strategy (coverage, edge cases, TDD sequence)
95
+ 5. `builder` -- implement via TDD (acceptance criteria become tests)
96
+ 6. Run validation: lint, typecheck, tests
97
+ 7. `verification-specialist` -- verify locally (run the software, observe behavior)
98
+ 8. Write e2e test encoding the verification
99
+ 9. **Review sub-flow**
100
+ 10. `learner` -- capture discoveries
101
+
102
+ #### Fix (bugs)
103
+
104
+ 1. **Reproduce sub-flow** -- write failing test or script that demonstrates the bug (MANDATORY before any fix is attempted)
105
+ 2. **Investigate sub-flow** -- git history, root cause analysis
106
+ 3. `debug-specialist` -- prove root cause with evidence
107
+ 4. `architecture-specialist` -- assess fix risk, identify files to change, check for ripple effects
108
+ 5. `test-specialist` -- design regression test strategy
109
+ 6. `bug-fixer` -- implement fix via TDD (reproduction becomes failing test)
110
+ 7. Run validation: lint, typecheck, tests
111
+ 8. `verification-specialist` -- verify locally (prove the bug is fixed)
112
+ 9. Write e2e test encoding the verification
113
+ 10. **Review sub-flow**
114
+ 11. `learner` -- capture discoveries
115
+
116
+ #### Improve (refactoring, optimization, coverage improvement)
117
+
118
+ 1. **Investigate sub-flow** -- understand current state, measure baseline
119
+ 2. `architecture-specialist` -- identify target, plan approach
120
+ 3. `test-specialist` -- ensure existing test coverage before refactoring (safety net)
121
+ 4. `builder` -- implement improvements via TDD
122
+ 5. Run validation: lint, typecheck, tests
123
+ 6. `verification-specialist` -- measure again, prove improvement over baseline
124
+ 7. Write e2e test encoding the verification (if applicable)
125
+ 8. **Review sub-flow**
126
+ 9. `learner` -- capture discoveries
127
+
128
+ #### Investigate Only (spikes)
129
+
130
+ 1. **Investigate sub-flow** -- full investigation
131
+ 2. Report findings with evidence
132
+ 3. Recommend next action (Research, Plan, Implement, or escalate)
133
+ 4. `learner` -- capture discoveries
134
+
135
+ Output: Code passing all validation + local empirical verification + e2e test (except for spikes, which produce findings only).
49
136
 
50
137
  ### Verify
51
- When: Pre-ship quality gate. Used as a sub-flow by Fix and Build.
52
138
 
53
- Sequence:
54
- 1. Run full test suite — all tests must pass before proceeding
55
- 2. Run quality checks — lint, typecheck, and format
56
- 3. `verification-specialist` — verify acceptance criteria are met empirically
139
+ When: Code is ready to ship. All local validation passes. Moving from "works on my machine" to "works in production".
57
140
 
58
- ### Ship
59
- When: Code is ready to deploy. Used as a sub-flow by Fix, Build, and Improve.
141
+ Gate:
142
+ - Code must pass local validation (lint, typecheck, tests)
143
+ - Local empirical verification must be complete
144
+ - If local validation fails, go back to **Implement**
145
+ - If no code changes exist, there is nothing to verify
60
146
 
61
147
  Sequence:
62
- 1. Commit atomic conventional commits via `git-commit` skill
63
- 2. PR create/update pull request via `git-submit-pr` skill
64
- 3. **Review sub-flow** (if not already done)
65
- 4. PR Watch Loop (repeat until mergeable):
66
- - If status checks fail fix and push
67
- - If merge conflicts → resolve and push
148
+ 1. Commit -- atomic conventional commits via `git-commit` skill
149
+ 2. PR -- create/update pull request via `git-submit-pr` skill
150
+ 3. PR Watch Loop (repeat until mergeable):
151
+ - If status checks fail -- fix and push
152
+ - If merge conflicts -- resolve and push
68
153
  - If bot review feedback (CodeRabbit, etc.):
69
- - Valid feedback implement fix, push, resolve comment
70
- - Invalid feedback reply explaining why, resolve comment
154
+ - Valid feedback -- implement fix, push, resolve comment
155
+ - Invalid feedback -- reply explaining why, resolve comment
71
156
  - Repeat until all checks pass and all comments are resolved
72
- 5. Merge the PR
73
- 6. `ops-specialist` deploy to target environment
74
- 7. `verification-specialist` post-deploy health check and smoke test
75
- 8. `ops-specialist` — monitor for errors in first minutes
157
+ 4. Merge the PR
158
+ 5. Monitor deploy (watch the deployment action triggered by merge):
159
+ - If deploy fails -- fix, open new PR, return to step 3
160
+ 6. Remote verification:
161
+ - `verification-specialist` -- verify in target environment (same checks as local verification, but on remote)
162
+ - `ops-specialist` -- post-deploy health check, smoke test, monitor for errors in first minutes
163
+ - If remote verification fails -- fix, open new PR, return to step 3
76
164
 
77
- ### Review
78
- When: Code review requests, PR review, quality assessment. Used as a sub-flow by Build.
165
+ Output: Merged PR, successful deploy, remote verification passing.
166
+
167
+ ## Sub-flows
168
+
169
+ Sub-flows are reusable sequences invoked by main flows. When a flow says "Investigate sub-flow", execute the full Investigate sequence.
170
+
171
+ ### Investigate
172
+
173
+ Purpose: Gather context and evidence about code, behavior, or systems.
79
174
 
80
175
  Sequence:
81
- 1. Run in parallel: `quality-specialist`, `security-specialist`, `performance-specialist`
82
- 2. `product-specialist` verify acceptance criteria are met empirically
83
- 3. `test-specialist` verify test coverage and quality
84
- 4. Consolidate findings, ranked by severity
176
+ 1. `git-history-analyzer` -- understand why affected code exists, find related past changes
177
+ 2. `debug-specialist` -- reproduce if applicable, trace execution, prove findings with evidence
178
+ 3. `ops-specialist` -- check logs, errors, health (if runtime issue)
179
+ 4. Report findings with evidence
180
+
181
+ ### Reproduce
85
182
 
86
- ### Improve
87
- When: Refactoring, optimization, coverage improvement, complexity reduction.
183
+ Purpose: Create a reliable reproduction that demonstrates a bug before fixing it.
88
184
 
89
185
  Sequence:
90
- 1. `architecture-specialist` identify target, measure baseline, plan approach
91
- 2. `test-specialist` ensure existing test coverage before refactoring (safety net)
92
- 3. `builder` implement improvements via TDD
93
- 4. `verification-specialist` measure again, prove improvement
94
- 5. **Ship sub-flow**
95
- 6. `learner` — capture discoveries
186
+ 1. Execute the exact scenario that triggers the bug
187
+ 2. Capture complete error output and evidence
188
+ 3. Write a failing test that captures the bug (preferred) or a minimal reproduction script
189
+ 4. Verify the reproduction is reliable (runs multiple times, consistently fails)
96
190
 
97
- #### Improve: Test Quality
98
- When: "Improve tests", "strengthen test suite", "fix weak tests", test quality improvement.
191
+ A bug MUST be reproduced before any fix is attempted. If reproduction fails, report what was tried and stop.
192
+
193
+ ### Review
194
+
195
+ Purpose: Multi-dimensional code review before shipping.
99
196
 
100
197
  Sequence:
101
- 1. `test-specialist` — scan tests, identify weak/brittle tests, rank by improvement impact
102
- 2. `builder` implement test improvements
103
- 3. **Verify sub-flow**
104
- 4. **Ship sub-flow**
105
- 5. `learner` — capture discoveries
198
+ 1. Run in parallel: `quality-specialist`, `security-specialist`, `performance-specialist`
199
+ 2. `product-specialist` -- verify acceptance criteria are met empirically
200
+ 3. `test-specialist` -- verify test coverage and quality
201
+ 4. Consolidate findings, ranked by severity
106
202
 
107
203
  ### Monitor
108
- When: "Check the logs", "Any errors?", health checks, production monitoring.
204
+
205
+ Purpose: Check application health and operational status. Can be invoked standalone or as part of Verify.
109
206
 
110
207
  Sequence:
111
- 1. `ops-specialist` health checks, log inspection, error monitoring, performance analysis
208
+ 1. `ops-specialist` -- health checks, log inspection, error monitoring, performance analysis
112
209
  2. Report findings, escalate if action needed
113
210
 
114
211
  ## JIRA Entry Point
@@ -116,11 +213,36 @@ Sequence:
116
213
  When the request references a JIRA ticket (ticket ID like PROJ-123 or a JIRA URL):
117
214
 
118
215
  1. Hand off to `jira-agent`
119
- 2. `jira-agent` reads the ticket, validates structural quality, and runs analytical triage
120
- 3. If triage finds unresolved ambiguities, `jira-agent` posts findings and STOPS no work begins
121
- 4. `jira-agent` determines intent and delegates to the appropriate flow above
122
- 5. `jira-agent` syncs progress at milestones and posts evidence at completion
216
+ 2. `jira-agent` reads the ticket fully (description, comments, attachments, linked issues)
217
+ 3. `jira-agent` validates ticket quality via `jira-verify` skill
218
+ 4. `jira-agent` runs analytical triage via `ticket-triage` skill
219
+ 5. If triage finds unresolved ambiguities (`BLOCKED` verdict), `jira-agent` posts findings and STOPS -- no work begins
220
+ 6. `jira-agent` determines intent and delegates to the appropriate flow:
221
+
222
+ | Ticket Type | Flow | Work Type |
223
+ |-------------|------|-----------|
224
+ | Epic | Plan | -- |
225
+ | Story | Implement | Build |
226
+ | Task | Implement | Build |
227
+ | Bug | Implement | Fix |
228
+ | Spike | Implement | Investigate Only |
229
+ | Improvement | Implement | Improve |
230
+
231
+ If the ticket type is ambiguous, read the description to classify. A "Task" that describes broken behavior is a Fix. A "Bug" that requests new functionality is a Build.
232
+
233
+ 7. `jira-agent` syncs progress at milestones via `jira-sync` skill
234
+ 8. `jira-agent` posts evidence at completion via `jira-evidence` skill
235
+
236
+ ## Flow Chaining
237
+
238
+ Flows can chain naturally:
239
+ - Research produces a PRD -- hand it to Plan
240
+ - Plan produces work items -- hand each to Implement
241
+ - Implement produces verified code -- hand to Verify
242
+ - If any flow discovers it lacks what it needs, it stops and suggests the preceding flow
243
+
244
+ The full lifecycle for a large initiative: Research -> Plan -> Implement (per item) -> Verify (per item).
123
245
 
124
246
  ## Sub-flow Usage
125
247
 
126
- Flows reference sub-flows by name. When a flow says "Ship sub-flow", execute the full Ship sequence. When it says "Review sub-flow", execute the full Review sequence. Sub-flows can be nested (e.g., Ship includes Review).
248
+ Flows reference sub-flows by name. When a flow says "Investigate sub-flow", execute the full Investigate sub-flow sequence. When it says "Review sub-flow", execute the full Review sequence. Sub-flows can be invoked by any main flow.