@massa-ai/cursor-plugin 1.9.1 → 1.10.0

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "massa-ai",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "description": "massa-ai — semantic code search, memory, and context compression for Cursor"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/cursor-plugin",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
5
  "files": [
6
6
  "agents",
@@ -278,6 +278,7 @@ Load only when a selected workflow asks for them:
278
278
  - `references/project-context.md`
279
279
  - `references/implementation-delivery.md`
280
280
  - `references/code-annotation.md`
281
+ - `references/repo-rules-discovery.md`
281
282
  - `references/root-cause-scripts.md`
282
283
  - `references/conversation-feedback.md`
283
284
  - `references/maestro.md`
@@ -104,6 +104,34 @@ Rules:
104
104
  - If no valid test seam exists, document why in the completion report rather
105
105
  than silently shipping untested code.
106
106
 
107
+ ### Exception — data and domain models are not unit-tested
108
+
109
+ Data models and anemic domain models carry state, not behavior. A unit test
110
+ that constructs them and asserts their own getters, setters, fields, or
111
+ constructor defaults mirrors the implementation and cannot detect that the
112
+ model is wrong — it is the "test that mirrors the code" anti-pattern from the
113
+ rule above. **Do not write unit tests for these kinds:**
114
+
115
+ - **Data models** — persistence-layer entities: ORM-mapped classes, database
116
+ schema-mapped types, Prisma/TypeORM/Entity Framework/Hibernate/JPA entities,
117
+ SQL row types, and repository entity structs.
118
+ - **Anemic domain models** — DDD value objects and domain entities whose public
119
+ surface is fields, accessors, and constructors with no meaningful behavior
120
+ (no invariants, no state transitions, no domain rules).
121
+
122
+ This applies across every language the workflows touch (TypeScript/JavaScript,
123
+ Kotlin, Swift, Java, Python, Go, Rust, C#, Ruby, PHP, SQL). Test the **behavior**
124
+ that uses the model at the seam where it lives — the repository, service,
125
+ use-case, or mapper that creates, validates, persists, or transforms it.
126
+
127
+ This exception does **not** weaken the "test every changed code path" rule for
128
+ code that has behavior. A model with invariants, validation, state machines, or
129
+ domain rules is not anemic — test those rules at the model or the seam that
130
+ exercises them, wherever the contract is observable. When unsure whether a model
131
+ is anemic, the test is: "does this type have a method whose outcome is not fully
132
+ determined by its inputs and field assignments?" If yes, it has behavior; test
133
+ it. If no, it is a data model; test its consumers instead.
134
+
107
135
  ## Completion Evidence
108
136
 
109
137
  Report, per changed unit: doc block present (yes / not-applicable-because), the
@@ -29,11 +29,13 @@ human chose to merge it".
29
29
 
30
30
  ### Stage 1 — worktree isolation is mandatory
31
31
 
32
- Every implementation task runs in its own git worktree. There is **no size
33
- exemption**: a one-line typo fix is isolated exactly like a twelve-file feature.
34
- The reason is that the exemption, not the ceremony, is what costs time —
35
- "this one is too small to isolate" is the judgment call that puts half-finished
36
- work on a shared branch.
32
+ Every implementation task runs in its own git worktree. **Mandatory worktree
33
+ creation is the rule, not a preference:** a one-line typo fix is isolated
34
+ exactly like a twelve-file feature. There is **no size exemption**. The reason
35
+ is that the exemption, not the ceremony, is what costs time — "this one is too
36
+ small to isolate" is the judgment call that puts half-finished work on a shared
37
+ branch. Worktree creation happens **before the first repository mutation**, not
38
+ after implementation.
37
39
 
38
40
  The only two legal skip reasons:
39
41
 
@@ -48,6 +50,17 @@ no `node_modules`, no `dist`, and no `.env`. A gate that fails only because the
48
50
  worktree was never provisioned is an environment failure; say so rather than
49
51
  reporting it as a code failure.
50
52
 
53
+ **Phased work — one branch per Phase/Wave.** When the work is phased (sourced
54
+ from `workflows/ticket.md`, a spec-driven `tasks.md` with Phases/Waves, or a TDD
55
+ PR-group table), create **one branch per Phase/Wave**, not one branch per task
56
+ and not one branch for the whole feature. Name the branch with the phase's Jira
57
+ Task key, e.g. `feat/<PHASE-KEY>-<slug>` (so `feat/SA-100-phase-1-search-split`
58
+ for phase SA-100). The phase key comes from `workflows/ticket.md` or the user.
59
+ Each Task inside the phase is then one atomic commit on that branch, prefixed
60
+ with its own sub-task key — the commit contract is owned by
61
+ `workflows/commit.md`; do not restate it here. Non-phased work keeps the
62
+ `<type>/<slug>` branch shape unchanged.
63
+
51
64
  ### Stage 2 — one commit per task
52
65
 
53
66
  Commit message content, staging rules, audit-report exclusions, and Jira
@@ -56,6 +69,16 @@ that workflow. This reference owns only the cadence: **one atomic commit per
56
69
  completed task, after its gate passes.** Never batch tasks into one commit and
57
70
  never commit a task whose gate is red.
58
71
 
72
+ ### Stage 4 — propose carries the phase key prefix
73
+
74
+ The PR/MR is created with `gh pr create --base <base> --title <t> --body <b>`.
75
+ For **phased work**, the PR title and body include the Phase/Wave Jira Task key
76
+ prefix, matching the branch naming (the branch is named with that phase key per
77
+ Stage 1). Source the key from the branch; do not ask the user again. Example
78
+ title: `[SA-100] Phase 1: search facade split`. The per-task commit prefixes on
79
+ the branch are owned by `workflows/commit.md`; this stage owns only the PR-level
80
+ phase prefix. Non-phased work keeps the existing PR title behavior unchanged.
81
+
59
82
  ### Stage 7 — merge is never automatic
60
83
 
61
84
  Do not run `gh pr merge` without explicit user approval given in the current
@@ -0,0 +1,103 @@
1
+ # Repo Rules Discovery
2
+
3
+ Use this reference from `workflows/spec-driven.md` before the first repository
4
+ mutation. It defines how to discover, load, and enforce the target repository's
5
+ own AI-harness rules and implementation conventions, so spec-driven
6
+ implementation conforms to the repo it runs in rather than only to the
7
+ skill's defaults.
8
+
9
+ massa-ai is shipped to many repositories. This reference is **conditional on
10
+ the target repo**: it loads what is present and never invents what is absent.
11
+
12
+ ## Principle
13
+
14
+ A repository's rules live in its own harness files and conventions. spec-driven
15
+ must read them before implementing and enforce conformance, because a change
16
+ that follows the skill's defaults but violates the repo's module layout, test
17
+ placement, or lint rules is not deliverable. Silence here reads as "the repo
18
+ has no rules", which is almost never true — it means they were not looked up.
19
+
20
+ ## 1. Discovery list
21
+
22
+ Look for the target repo's AI-harness rule sources in this order. Record each
23
+ one found with its path; record `none present` for any that are absent.
24
+
25
+ ### `.claude/` harness
26
+
27
+ - `.claude/CLAUDE.md` — the primary Claude Code instructions file.
28
+ - `.claude/rules/**` — rule files imported by CLAUDE.md.
29
+ - `.claude/settings.json` — permissions and tool policy (read-only; never mutate).
30
+ - A root `CLAUDE.md` when `.claude/CLAUDE.md` is absent.
31
+
32
+ ### `.cursor/` harness
33
+
34
+ - `.cursor/rules/*.mdc` and `.cursor/rules/*.md` — Cursor rule files (MDC format).
35
+ - `.cursorrules` — the legacy single-file Cursor rules at repo root.
36
+
37
+ ### Other harness sources
38
+
39
+ - `AGENTS.md` at the repo root and in subdirectories (the cross-host standard).
40
+ - `CONTRIBUTING.md`, `README.md`, and `docs/` when they state implementation,
41
+ testing, or layout rules.
42
+ - The repo's test-runner config (`bunfig.toml`, `jest.config.*`, `vitest.config.*`,
43
+ `pytest.ini`/`pyproject.toml`, `gradle` test blocks, Xcode test schemes) —
44
+ these pin **where tests live and how the gate runs**.
45
+
46
+ ### Repo / module implementation pattern
47
+
48
+ Derive the repo's own conventions by reading current source, not by assuming
49
+ the skill's defaults:
50
+
51
+ - **Module layout** — where new source files go (layer folders, feature folders,
52
+ package boundaries).
53
+ - **Unit-test location** — the source set or directory the repo uses for unit
54
+ tests (`__tests__/`, `src/test/`, `commonTest/`, `androidUnitTest/`,
55
+ `unitTest/`, `tests/`, the repo's actual equivalent).
56
+ - **Testing areas** — integration vs unit vs e2e boundaries the repo already
57
+ enforces, and which test runner command exercises each.
58
+
59
+ ## 2. Loading order
60
+
61
+ 1. Read each present source from §1; skip absent ones without erroring.
62
+ 2. Summarize what binds implementation into a compact `repo-rules` record:
63
+ - the paths loaded,
64
+ - the rules that constrain implementation (layout, naming, lint, test
65
+ placement, commit/branch conventions),
66
+ - any rule that conflicts with the skill's default.
67
+ 3. If a repo rule conflicts with a skill default, the **repo rule wins** for
68
+ implementation placement and gate commands; record the conflict and the
69
+ resolution.
70
+
71
+ ## 3. Absence is valid
72
+
73
+ If none of the sources in §1 are present, record:
74
+
75
+ ```
76
+ repo-rules: none present
77
+ ```
78
+
79
+ and continue. **Never fabricate rules. Never create `.claude/`, `.cursor/`, or
80
+ any harness directory in a repo that lacks them.** A repo with no harness rules
81
+ is implemented against its own source conventions (§1 "Repo / module
82
+ implementation pattern") and the skill's defaults — that is a legitimate state,
83
+ not a failure.
84
+
85
+ ## 4. Enforcement hook (spec-driven)
86
+
87
+ Before the first repository mutation, spec-driven:
88
+
89
+ 1. runs this discovery,
90
+ 2. records the `repo-rules` summary (paths loaded, or `none present`),
91
+ 3. implements so that every new or changed file conforms to the discovered
92
+ module layout, unit-test location, and testing-area conventions,
93
+ 4. records any deviation with an explicit reason in the completion evidence.
94
+
95
+ A deviation is allowed only with a recorded reason; an unrecorded deviation is
96
+ a protocol violation, not a shortcut.
97
+
98
+ ## Completion Evidence
99
+
100
+ Report, in one block: the harness sources loaded (paths), the repo's module /
101
+ unit-test / testing-area conventions in effect, any repo-rule vs skill-default
102
+ conflict and its resolution, or `repo-rules: none present` with the conventions
103
+ derived from source.
@@ -67,6 +67,8 @@ If `tasks.md` exists, check dependencies. If using the inline plan, follow the o
67
67
 
68
68
  If blocked: "T3 depends on T2 which isn't done. Should I do T2 first?"
69
69
 
70
+ **Wire dependencies in this task, not later.** The task that introduces a component also wires it — registration, binding, and composition-root/module setup are part of the task, never deferred to a trailing "DI" or "integration" phase. Code whose dependencies are not wired is incomplete and fails this task's gate; "wiring happens in a later phase" is not a valid state. See `references/spec-driven/tasks.md` → *Dependency Injection And Wiring Is Per-Task, Never a Separate Phase* for the planning-side rule and the restructure options (wire inline / merge backward / merge forward).
71
+
70
72
  ### 3. State Implementation Plan
71
73
 
72
74
  Before writing code:
@@ -151,6 +151,8 @@ Group tasks into ordered phases. Each phase depends on the ones before it; tasks
151
151
 
152
152
  This keeps phase boundaries meaningful while letting the packing hit its target worker count.
153
153
 
154
+ **No trailing wiring phase.** A phase whose purpose is DI, wiring, or integration of this feature's own components is prohibited — that work belongs in the task that introduces each component (see *Dependency Injection And Wiring Is Per-Task, Never a Separate Phase* below). Split phases at genuine dependency/cohesion seams, never to gather wiring into one place.
155
+
154
156
  ### 5. Validate Before Presenting (MANDATORY)
155
157
 
156
158
  Before showing tasks to the user, run ALL three pre-approval checks. These are NOT optional — they are gates. If any check fails, restructure the tasks and re-run until all pass.
@@ -427,6 +429,26 @@ Pick whichever option keeps tasks atomic and cohesive. The goal: no task produce
427
429
 
428
430
  ---
429
431
 
432
+ ## Dependency Injection And Wiring Is Per-Task, Never a Separate Phase
433
+
434
+ Dependency injection, module/dependency wiring, container/service registration, and composition-root setup for a unit of code are done **inside the task (or its phase) that introduces that unit**. **Never collect wiring into a dedicated trailing "DI", "wiring", or "integration" phase.** A final phase whose purpose is "wire everything together" is the same defect class as deferring tests to a separate task (see *Resolving compilation dependencies* above): every intermediate task ships code that cannot build or run until a much later phase, so none of their gates actually prove the code works in context, and a failure or skip in the trailing phase strands all preceding work.
435
+
436
+ This rule is the dependency-side twin of test co-location: tests live with the code that creates it, and so does its wiring.
437
+
438
+ **Rule:** each task must leave the repository buildable and its own gate green against code whose dependencies are wired **by that task or an earlier one**. Code whose dependencies are not yet wired is incomplete — it is a gate failure, not a deferred item.
439
+
440
+ **When a task introduces code that needs wiring, restructure rather than defer:**
441
+
442
+ 1. **Wire inline:** the task that creates the component/service also registers it, binds its dependencies, and adds it to the composition root or module it belongs to.
443
+ 2. **Merge backward:** if the wiring depends on a container or module a later task introduces, pull that container/module into this task so the code is wired and runnable now.
444
+ 3. **Merge forward:** only when wiring is genuinely shared across several components, fold the wiring into the earliest task where the wired unit becomes runnable — never into a phase whose only job is wiring.
445
+
446
+ Pick whichever keeps tasks atomic and the repository green at every commit. The goal: no task produces code that cannot run until a later phase. If a unit cannot be wired in the task that creates it, the task or phase boundaries are wrong.
447
+
448
+ **Phase-planning consequence:** the execution plan must not contain a phase whose stated purpose is DI, wiring, or integration of everything built earlier. "Integration" phases are allowed only when they integrate *externally* delivered components (a third-party service, another team's API) that were not available to earlier tasks — never as a catch-all for wiring this feature's own code. A phase that exists only to wire the feature's own components is a planning smell: redistribute its work into the tasks that own each component.
449
+
450
+ ---
451
+
430
452
  ## Tips
431
453
 
432
454
  - **Phases are ordered** — Each phase completes before the next; tasks run in order within a phase
@@ -486,6 +508,7 @@ Before sampling tests manually, prefer massa-ai tooling to read the codebase:
486
508
 
487
509
  - Keep tasks atomic enough to verify independently.
488
510
  - Order tasks so earlier tasks leave the repository buildable and testable.
511
+ - **Dependency injection and wiring are per-task/per-phase.** The task that introduces a component wires it (registration, binding, composition root). Never defer wiring to a separate trailing "DI"/"wiring"/"integration" phase; a phase that only wires this feature's own code is a planning smell. See *Dependency Injection And Wiring Is Per-Task, Never a Separate Phase* above.
489
512
  - Do not create tasks that require hidden chat context; every task must point to the spec/design evidence it needs.
490
513
  - If a task reveals a missing requirement or design decision, stop and update the earlier artifact (`.specs/features/<slug>/spec.md` or `design.md`) before continuing.
491
514
 
@@ -11,6 +11,7 @@ Resolve inputs in this order:
11
11
  - `epic-tickets`: create a new Epic and standard child issues.
12
12
  - `epic-tickets-subtasks`: create a new Epic, standard child issues, and sub-tasks.
13
13
  - `tickets-subtasks`: create standard issues and optional sub-tasks without creating an Epic. Ask for an existing Epic key only when the user wants those standard issues attached and Jira supports that relationship.
14
+ - A phased source (spec-driven `tasks.md` organized into Phases/Waves, or a TDD implementation PR-group table) selects the **phased mapping** under `tickets-subtasks`: one standard Task per Phase/Wave, one sub-task per Task inside the phase. See `templates-and-quality.md` → Phased Decomposition.
14
15
  3. **Ticket template source**: ask whether to use a Jira reference issue, an explicitly supplied local file or pasted template, or the built-in templates. A Jira reference may be supplied as a key or URL.
15
16
  4. **Definition of Ready and Definition of Done**: ask whether the user wants to provide either source. Accept Jira or Confluence content through Atlassian MCP, explicitly supplied local files, or pasted text. Use built-in checklists when omitted.
16
17
  5. **Jira-required choices**: after metadata inspection, ask only for unresolved issue types, priorities, components, labels, ownership, versions, or custom fields that are required by Jira or material to the user's intent.
@@ -111,6 +111,30 @@ A sub-task cannot exist without one standard parent issue. Do not use sub-tasks
111
111
  - Do not enforce fixed day estimates. Size by outcome coherence, dependency boundaries, reviewability, and whether an assignee can complete the work without reopening product decisions.
112
112
  - Express dependency edges through stable draft IDs before Jira keys exist. Reject self-dependencies and cycles.
113
113
 
114
+ ### Phased Decomposition (spec-driven / TDD source)
115
+
116
+ When the source plan is already phased — a spec-driven `tasks.md` with
117
+ Phases/Waves, or a TDD implementation PR-group table — decompose to match the
118
+ phases, not by layer:
119
+
120
+ - **Phase/Wave → one standard Jira Task.** Each phase or wave becomes one
121
+ standard issue whose acceptance criteria are the phase's exit gate.
122
+ - **Task inside a phase → one sub-task.** Each atomic task listed inside a
123
+ phase becomes one sub-task parented to that phase's Task. The sub-task's
124
+ acceptance criteria are the task's own gate.
125
+ - **Branch naming follows the Phase/Wave key.** One branch per phase, named with
126
+ the phase's Jira key; the branch command itself is owned by
127
+ `references/implementation-delivery.md` Stage 1 — do not restate it here.
128
+ - **One commit per task sub-task.** Each sub-task maps to exactly one atomic
129
+ commit prefixed with its sub-task key `[XXX-YYYY]`; the commit contract is
130
+ owned by `workflows/commit.md` — do not restate it here.
131
+ - Emit every created phase-Task key and task-sub-task key back to the caller so
132
+ the branch/commit/PR rules can consume them.
133
+
134
+ This is the `tickets-subtasks` hierarchy mode driven by a phased input. It does
135
+ not create a new issue type and does not require an Epic; the Epic layer stays
136
+ optional.
137
+
114
138
  ## Deterministic Quality Gate
115
139
 
116
140
  Before review approval, verify every draft:
@@ -16,7 +16,8 @@ Do not use this workflow for Jira ticket creation, release notes, changelogs, PR
16
16
  - unstaged changed paths from `git diff --name-only`
17
17
  - status summary from `git status --short`
18
18
  - staged diff when anything is staged; otherwise the unstaged diff for allowed paths
19
- 4. Extract the first Jira key from the branch with case-insensitive regex `(?<![A-Z0-9])([A-Z][A-Z0-9]{1,9}-[0-9]+)(?![A-Z0-9])`. Normalize the key to uppercase. If no key is found, proceed without a prefix and do not ask.
19
+ 4. Extract the first Jira key from the branch with case-insensitive regex `(?<![A-Z0-9])([A-Z][A-Z0-9]{1,9}-[0-9]+)(?![A-Z0-9])`. Normalize the key to uppercase. If no key is found, proceed without a prefix and do not ask. When an explicit task key is supplied (from `workflows/ticket.md` for phased work, or by the user), it takes precedence over the branch-derived key.
20
+ - **Phased work — one commit per task, prefixed with the task's sub-task key.** When committing phased work sourced from `workflows/ticket.md`, each Task inside a Phase/Wave is exactly **one atomic commit** (never batched; the one-commit-per-task cadence is owned by the Implementation Delivery Protocol, Stage 2). That commit's subject is prefixed with the Task's Jira **sub-task** key as `[XXX-YYYY]`, for example `[SA-142] feat(auth): reject expired tokens`. The prefix format is the same `[<KEY>] ` rule below; the sub-task key simply replaces the generic branch key.
20
21
  5. Resolve commit scope:
21
22
  - If files are already staged, treat staged files as the user-selected commit scope and do not stage additional files.
22
23
  - If nothing is staged and the user explicitly asked to commit, stage only allowed changed files one path at a time with pathspec-safe commands.
@@ -4,7 +4,7 @@ Use this workflow for explicit spec-driven requests and broad, ambiguous, migrat
4
4
 
5
5
  Before the first substantive read, load `references/project-context.md` and run the project-context intake sweep for this repository.
6
6
 
7
- Before the first repository mutation, load `references/implementation-delivery.md` for worktree isolation, atomic commits, PR creation, CI watch, and the merge gate, and `references/code-annotation.md` for doc blocks, rationale comments, and test coverage on every created or updated unit. If two consecutive fix attempts fail on the same symptom, stop editing and load `references/root-cause-scripts.md`.
7
+ Before the first repository mutation, load `references/implementation-delivery.md` for worktree isolation, atomic commits, PR creation, CI watch, and the merge gate, and `references/code-annotation.md` for doc blocks, rationale comments, and test coverage on every created or updated unit, and `references/repo-rules-discovery.md` to discover and enforce the target repository's own `.claude/`, `.cursor/`, and module/unit-test/testing-area conventions. If two consecutive fix attempts fail on the same symptom, stop editing and load `references/root-cause-scripts.md`.
8
8
 
9
9
  ## TLC v3 Flow
10
10
 
@@ -90,6 +90,7 @@ Quick artifacts live under `.specs/quick/NNN-slug/` with a `TASK.md` (one-line i
90
90
  5. Decide whether `Tasks` is required. If yes, run `references/spec-driven/tasks.md`; if no, list the inline atomic execution steps before editing. If the inline list reveals more than 5 steps or complex dependencies, stop and create `tasks.md` — the Tasks phase was wrongly skipped (safety valve).
91
91
  6. Run `Execute` with `references/spec-driven/execute.md`.
92
92
  - Load `references/spec-driven/coding-principles.md` before implementation.
93
+ - Run repo-rules discovery from `references/repo-rules-discovery.md` before the first repository mutation: record the harness sources loaded (or `repo-rules: none present`), and implement so every new or changed file conforms to the target repo's module layout, unit-test location, and testing-area conventions. A repo rule wins over a skill default for placement and gate commands; record any deviation with an explicit reason. Never fabricate rules or create `.claude/`/`.cursor/` directories the repo lacks.
93
94
  - Use the Test Coverage Matrix and Gate Check Commands from `tasks.md`, or state their inline equivalents when Tasks was skipped.
94
95
  - Ask the MCP and skill question in Tasks or inline Execute when tool choice can change correctness or verification.
95
96
  - If a formal `tasks.md` packs into more than one task-budgeted batch (> ~8 tasks), present the sub-agent offer from `references/spec-driven/sub-agents.md` before starting Execute. Offer-then-confirm — never auto-spawn; the user must accept before any sub-agent is dispatched. One worker per batch (~7 tasks, whole phases): each batch worker executes all its tasks in order (implement → gate → atomic commit), then reports a compact summary (tasks done, commit hashes, test counts, deviations). Workers never spawn further sub-agents.
@@ -18,6 +18,7 @@ Before the first substantive read, load `references/project-context.md` and run
18
18
  6. When code grounding is useful, run a bounded read-only child pass using `workflows/exploration.md`, then return to the ticket session. Never search Git history, branches, commits, or repository ticket references for ticket examples or templates.
19
19
  7. Inspect the selected Jira project's issue types, required fields, parent rules, and relevant field options before finalizing the draft. A reference ticket controls format and tone only; it does not authorize copying project facts.
20
20
  8. Draft the requested hierarchy using `templates-and-quality.md`. Keep each standard issue independently understandable, use sub-tasks only for atomic work owned by one parent, and make dependencies explicit.
21
+ - **Phased source mapping:** when the source is a phased plan — a spec-driven `tasks.md` organized into Phases/Waves, or a TDD implementation PR-group table — map the hierarchy to the phases: **one standard Jira Task per Phase/Wave**, and **one sub-task per Task inside that phase**, each sub-task parented to its phase's Task. This reuses the `tickets-subtasks` hierarchy mode; do not invent new issue types. The Epic layer stays optional and unchanged. Record every created phase-Task key and task-sub-task key so `workflows/commit.md` (per-task commit prefix) and the Implementation Delivery Protocol (phase branch + PR prefix) can consume them. See `templates-and-quality.md` → Phased Decomposition.
21
22
  9. Search the selected Jira project for potential duplicates using the proposed summary and distinctive scope terms. Record candidates in the review artifact; do not silently merge, skip, or close work.
22
23
  10. Resolve the agent-native external plans directory and create one temporary review file named `ticket-<project>-<slug>-<YYYYMMDDTHHMMSSZ>.md`. The artifact must be outside the repository and contain stable draft IDs, draft revision, approval status, creation order, Jira fields, full descriptions, duplicate candidates, open questions, and created keys or URLs when present.
23
24
  11. Run every deterministic quality gate from `templates-and-quality.md`. Present the current artifact for review. Any content or field revision increments `Draft Revision` and resets `Approval Status` to `NOT APPROVED`.