@llman-sdd/core 0.9.0 → 0.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.
Files changed (88) hide show
  1. package/package.json +1 -1
  2. package/src/archive/freeze.ts +15 -15
  3. package/src/archive/frozenCard.ts +3 -2
  4. package/src/change/collect.ts +17 -14
  5. package/src/change/deps.ts +54 -0
  6. package/src/change/frontmatter.ts +36 -5
  7. package/src/change/lifecycle.ts +124 -20
  8. package/src/change/nextId.ts +14 -6
  9. package/src/config/changeId.ts +0 -6
  10. package/src/config/load.ts +2 -2
  11. package/src/config/schema.ts +3 -1
  12. package/src/context/indexStore.ts +14 -14
  13. package/src/context/sddState.ts +1 -13
  14. package/src/context/tree.ts +9 -19
  15. package/src/index.ts +25 -9
  16. package/src/init/defaultConfig.ts +14 -31
  17. package/src/init/init.ts +25 -27
  18. package/src/locale.ts +33 -0
  19. package/src/project/migrations.ts +79 -9
  20. package/src/report/graph/deps.ts +3 -38
  21. package/src/report/graph/nodes.ts +13 -19
  22. package/src/report/graph/types.ts +2 -6
  23. package/src/report/show.ts +16 -8
  24. package/src/report/specHelpers.ts +22 -28
  25. package/src/review/review.ts +18 -30
  26. package/src/self/completion.ts +206 -0
  27. package/src/spec/assignSpecIds.ts +9 -1
  28. package/src/spec/authoring.ts +11 -11
  29. package/src/spec/parser.ts +3 -1
  30. package/src/templates/skills.ts +3 -23
  31. package/src/util/datedId.ts +18 -0
  32. package/src/util/fsPort.ts +24 -0
  33. package/src/util/nextNumber.ts +30 -0
  34. package/src/util/semver.ts +21 -0
  35. package/src/validation/changeCheck.ts +133 -67
  36. package/src/validation/crossRoot.ts +86 -0
  37. package/src/validation/discover.ts +22 -13
  38. package/src/validation/roots.ts +2 -5
  39. package/src/validation/validate.ts +4 -9
  40. package/src/validation/xstateTransitions.ts +0 -32
  41. package/templates/zh-Hans/skills/llman-sdd-apply-cycle.md +9 -7
  42. package/templates/zh-Hans/skills/llman-sdd-apply.md +5 -5
  43. package/templates/zh-Hans/skills/llman-sdd-archive.md +11 -2
  44. package/templates/zh-Hans/skills/llman-sdd-continue.md +1 -1
  45. package/templates/zh-Hans/skills/llman-sdd-draft.md +1 -1
  46. package/templates/zh-Hans/skills/llman-sdd-explore.md +2 -2
  47. package/templates/zh-Hans/skills/llman-sdd-ff.md +1 -1
  48. package/templates/zh-Hans/skills/llman-sdd-propose.md +8 -6
  49. package/templates/zh-Hans/skills/llman-sdd-quick.md +1 -1
  50. package/templates/zh-Hans/skills/llman-sdd-validate.md +1 -1
  51. package/templates/zh-Hans/skills/llman-sdd-verify.md +2 -2
  52. package/templates/zh-Hans/skills/llman-sdd-wayfinder.md +1 -1
  53. package/templates/zh-Hans/units/skills/git-native-flow.md +12 -6
  54. package/templates/zh-Hans/units/skills/index-fallback.md +1 -0
  55. package/templates/zh-Hans/units/skills/structured-protocol.md +1 -6
  56. package/templates/zh-Hans/units/spec/feature-contract.md +5 -33
  57. package/src/templates/locale.ts +0 -24
  58. package/templates/en/agents-root-stub.md +0 -9
  59. package/templates/en/llmanspec-agents-stub.md +0 -6
  60. package/templates/en/skills/llman-sdd-apply-cycle.md +0 -67
  61. package/templates/en/skills/llman-sdd-apply.md +0 -117
  62. package/templates/en/skills/llman-sdd-arch-review.md +0 -58
  63. package/templates/en/skills/llman-sdd-archive.md +0 -70
  64. package/templates/en/skills/llman-sdd-continue.md +0 -34
  65. package/templates/en/skills/llman-sdd-draft.md +0 -53
  66. package/templates/en/skills/llman-sdd-explore.md +0 -64
  67. package/templates/en/skills/llman-sdd-ff.md +0 -33
  68. package/templates/en/skills/llman-sdd-graph.md +0 -56
  69. package/templates/en/skills/llman-sdd-propose.md +0 -105
  70. package/templates/en/skills/llman-sdd-quick.md +0 -41
  71. package/templates/en/skills/llman-sdd-research.md +0 -35
  72. package/templates/en/skills/llman-sdd-specs-compact.md +0 -41
  73. package/templates/en/skills/llman-sdd-validate.md +0 -28
  74. package/templates/en/skills/llman-sdd-verify.md +0 -77
  75. package/templates/en/skills/llman-sdd-wayfinder.md +0 -83
  76. package/templates/en/units/skills/cli-footer.md +0 -2
  77. package/templates/en/units/skills/ethics-governance.md +0 -6
  78. package/templates/en/units/skills/git-native-flow-brief.md +0 -10
  79. package/templates/en/units/skills/git-native-flow.md +0 -50
  80. package/templates/en/units/skills/human-readable-summary.md +0 -9
  81. package/templates/en/units/skills/stage-guard.md +0 -17
  82. package/templates/en/units/skills/structured-protocol.md +0 -24
  83. package/templates/en/units/skills/validation-hints.md +0 -20
  84. package/templates/en/units/skills/version-drift.md +0 -3
  85. package/templates/en/units/spec/feature-contract.md +0 -38
  86. package/templates/en/units/workflow/archive-freeze-guidance.md +0 -9
  87. package/templates/zh-Hans/units/skills/git-native-flow-brief.md +0 -10
  88. package/templates/zh-Hans/units/workflow/archive-freeze-guidance.md +0 -10
@@ -1,34 +0,0 @@
1
- ---
2
- name: "llman-sdd-continue"
3
- description: "Continue an existing change: create the next missing artifact."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Continue
9
-
10
- Continue an existing change and create the next missing artifact.
11
-
12
- ## Steps
13
- 1. Identify the change id: use it if provided; otherwise run `llman-sdd list --json` and ask which change to continue. Always announce "Using change: <id>".
14
- 2. Read `llmanspec/changes/<id>/`.
15
- > Stage decisions use `stage` / `readyToImplement` from `llman-sdd show <id> --output json --type change`; the full decision table lives in llman-sdd-apply.
16
- 3. Determine the next missing artifact, in order:
17
- 1) `proposal.md`
18
- 2) `design.md` (only when design tradeoffs matter)
19
- 3) `tasks.md`
20
- 4) `llman-sdd change start <id>` (or `change attach <id>` if the branch exists) — bind the branch
21
- 5) Edit `llmanspec/specs/<capability>.feature` (flat, or directory main file) on the **bound branch** and commit — land specs (or set `needs_specs_change: false` when there is no contract edit)
22
- 4. Create exactly ONE missing artifact (or one spec edit on the bound branch).
23
- - Do NOT write application code; do NOT create `changes/<id>/specs/`; do NOT edit `llmanspec/specs/**` before start/attach.
24
- 5. If all artifacts exist, suggest next steps from `llman-sdd show <id> --output json`:
25
- - specs-landed gate failing → land specs first (or `needs_specs_change: false`); do **not** suggest apply yet
26
- - specs-landed gate green (even mid-implementation with `readyToImplement=false` while tasks remain) → `llman-sdd-apply`
27
- - After verify → `llman-sdd-archive`
28
- - Validate: `llman-sdd validate <id> --strict`; review: `llman-sdd change diff <id>` (read-only)
29
-
30
- {{ unit("skills/git-native-flow") }}
31
- {{ unit("skills/cli-footer") }}
32
- {{ unit("skills/validation-hints") }}
33
-
34
- {{ unit("skills/structured-protocol") }}
@@ -1,53 +0,0 @@
1
- ---
2
- name: "llman-sdd-draft"
3
- description: "Capture a change idea as a draft (proposal.md only, no id asked). For jotting ideas/future needs; formalize with propose when ready."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Draft
9
-
10
- Capture a change idea as a **draft** (a `proposal.md` skeleton only) — the lightweight "just record it" entry: no scale assessment, no tasks, no specs edits, no attach. Formalize with `llman-sdd-propose` when ready to act.
11
-
12
- ## Pipeline Position
13
-
14
- ```mermaid
15
- flowchart LR
16
- draft["★ llman-sdd-draft"] -.->|"formalize"| propose["llman-sdd-propose"]
17
- propose --> apply["llman-sdd-apply"] --> verify["llman-sdd-verify"] --> archive["llman-sdd-archive"]
18
-
19
- style draft fill:#fff3cd,stroke:#ffc107,stroke-width:3px
20
- ```
21
-
22
- > 📍 Draft stage → next: flesh out `proposal.md`, then `llman-sdd-propose` to formalize.
23
-
24
- ## Hard Constraints
25
-
26
- - **MUST NOT ask the user for a change id**: derive it from the description via `change new --from` and announce it.
27
- - **MUST NOT create tasks/design/specs/attach**: only the `proposal.md` draft; full planning belongs to `llman-sdd-propose`.
28
- - **MUST NOT assess change scale**: that is propose's job. If the user wants to start implementing → suggest `llman-sdd-propose`.
29
- - **Scope boundary**: if the description clearly involves behavioral-contract (requirement semantics) changes or multi-file impact, suggest `llman-sdd-propose` — but still create the draft first so the idea isn't lost.
30
- - **Frontmatter has a fixed schema**: `proposal.md` accepts only the allowed fields in `llmanspec/AGENTS.md` "Change Proposal Frontmatter SSOT" (`depends_on`, `title`, `blocks`, `branch`, `base_sha`, `needs_specs_change`, etc.); `title` MUST be a non-empty one-sentence concept title and MUST NOT repeat the change id — missing or empty values are rejected by `llman-sdd validate` as ERROR, and so are out-of-set fields like `status`/`priority`/`author`. Lifecycle stage is inferred (query via `llman-sdd show`/`list`), never stored in frontmatter. Do not re-declare frontmatter fields in the prose body (no `## Status` block); the H1 MAY keep a human-readable title (freeze prefers the frontmatter `title`, falling back to the H1), not a repeat of the change id.
31
-
32
- ## Steps
33
-
34
- ### 0) Preflight
35
- - Read `llmanspec/config.yaml`; if `llmanspec/` is missing, tell the user to run `llman-sdd init`, then STOP.
36
-
37
- ### 1) Capture the description
38
- - Take the user's description as-is (e.g. "draft: add an export-to-json command", "note: sdd changes should support worktrees"). **MUST NOT ask for a change id.**
39
-
40
- ### 2) Create the draft
41
- ```bash
42
- llman-sdd change new --from "<user description>"
43
- ```
44
- - The CLI generates a legal kebab-case id, creates `llmanspec/changes/<id>/proposal.md` (a skeleton with `## Why` / `## What Changes` TODO sections), and prints the id + path.
45
- - On id collision the CLI fails non-zero; suggest rephrasing or `--force` to overwrite (rare for drafts).
46
-
47
- ### 3) Announce and hand off
48
- - **MUST tell the user the derived id** ("Created draft change `<id>` at `llmanspec/changes/<id>/proposal.md`").
49
- - Suggest next steps: flesh out `proposal.md` (Why / What Changes / Capabilities / Impact); formalize with `llman-sdd-propose` when ready.
50
-
51
- {{ unit("skills/cli-footer") }}
52
-
53
- {{ unit("skills/ethics-governance") }}
@@ -1,64 +0,0 @@
1
- ---
2
- name: "llman-sdd-explore"
3
- description: "Explore mode: investigate, clarify requirements, think through problems before acting. No code writing. Use when intent is unclear or analysis comes first."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Explore
9
-
10
- Use this skill to think through ideas, investigate problems, or clarify requirements **before** implementation.
11
-
12
- **Explore mode is for thinking, not implementing:**
13
- - You MAY read files, search code, and investigate the codebase.
14
- - You MAY create or update planning docs (proposal/design/tasks).
15
- - `llmanspec/specs/**` is **READ-ONLY** — unless the change is already bound to a branch and you are on it; otherwise STOP and suggest `llman-sdd-propose` / `change start`.
16
- - You MUST NOT write application code.
17
-
18
- ## Pipeline Position
19
-
20
- {{ unit("skills/git-native-flow-brief") }}
21
-
22
- ```mermaid
23
- flowchart LR
24
- explore["★ llman-sdd-explore"] --> propose["llman-sdd-propose"]
25
- propose --> apply["llman-sdd-apply"]
26
- apply --> verify["llman-sdd-verify"]
27
- verify --> archive["llman-sdd-archive"]
28
-
29
- style explore fill:#fff3cd,stroke:#ffc107,stroke-width:3px
30
- ```
31
-
32
- > 📍 You are in explore → next is usually `llman-sdd-propose`; small changes (no contract edits) go via `llman-sdd-quick`.
33
-
34
- ## Stance
35
- - Curious, not prescriptive; grounded in the actual codebase.
36
- - Visual when helpful (ASCII diagrams); hold multiple options and tradeoffs.
37
-
38
- ## Suggested moves
39
- 1. Use `llman-sdd context --task "<task>" --paths "<files>"` to locate relevant specs; read the full text of the specs in its `direct` list (these are the contracts you must understand).
40
- - Context unavailable → run `llman-sdd index check` first: stale/missing → `llman-sdd index rebuild` (default `pageindex`, no model needed) and retry; still unavailable on a fresh index (`LLMAN_SDD_INDEX_CHAT_MODEL` unset) → fall back to `llman-sdd list --specs` + reading `.feature` files directly — do not loop on rebuild.
41
- 2. Clarify the goal and constraints (ask 1–3 questions).
42
- 3. **Deep-dive Q&A branch (optional, only on explicit user trigger)**: triggers on "deep-dig" / "grill" / "one at a time" / "nail it down". Walk the decision tree one question at a time:
43
- - Ask one question at a time, with your recommended answer; wait for feedback before the next.
44
- - Facts vs decisions: verify anything checkable by reading the `.feature`/code/running commands yourself — **don't ask** the user; only decisions (tradeoffs, preferences, scope boundaries) go to the user.
45
- - Terminology sharpening: when a term conflicts or is fuzzy, call it out immediately ("your spec defines 'X' as A, but you just said B — which is it?"); on resolution: if the change is branch-bound and you are on the bound branch, update the `.feature`; otherwise record only in `proposal.md` — never edit specs on the default branch. MUST NOT create a `CONTEXT.md` glossary as a second authority.
46
- - Write decisions back: resolved decisions go into the change's `proposal.md` "Open Questions" section.
47
- - Completion criterion: every pending decision is resolved or explicitly deferred. When not triggered, the default (ask 1–3 questions) behavior is unchanged.
48
- 4. If a change id is relevant, read its artifacts under `llmanspec/changes/<id>/`.
49
- - When diagnosing validation errors, run `llman-sdd validate <spec> --strict` first for the structural gates (Gherkin / `@req` linkage / dual-write / req_id uniqueness); when `specs.check_command` is configured, validate only executes that harness with explicit `--check` (default skips). Failing items are pinned down in the default TOON output's `items[].issues[]`; `--output human` prints `FAIL <item_type>/<id>` lines.
50
- 5. Explore options and tradeoffs (2–3 options).
51
- 6. Assess change scale to determine if full SDD is needed.
52
- 7. When something crystallizes, offer to capture it (don't auto-write):
53
- - Scope / design / work items → planning docs (`proposal.md` / `design.md` / `tasks.md`)
54
- - Constraints / executable harness → **suggest** `llmanspec/specs/**`; actual edits require a bound branch. If not bound yet, record only in proposal.
55
-
56
- ## Exiting explore mode
57
- - Behavioral contract change → `llman-sdd-propose`
58
- - Small change / no contract change → `llman-sdd-quick`
59
- - change already landed specs (`stage=full`, specs-landed gate green) → `llman-sdd-apply`
60
- If the user asks you to implement while in explore mode, STOP and remind them to exit explore mode first.
61
-
62
- {{ unit("skills/cli-footer") }}
63
-
64
- {{ unit("skills/structured-protocol") }}
@@ -1,33 +0,0 @@
1
- ---
2
- name: "llman-sdd-ff"
3
- description: "Fast-forward the propose path in one pass: planning docs → bind branch → land specs."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Fast-Forward (FF)
9
-
10
- Run the propose-equivalent path quickly: planning docs → bind branch → land specs (through the specs-landed gate). This is **not** the old `changes/<id>/specs/` delta model.
11
-
12
- ## Hard constraints
13
-
14
- - Planning docs only under `llmanspec/changes/<id>/` (proposal/design/tasks); specs only under bound-branch `llmanspec/specs/**`.
15
- - **Do not** create `llmanspec/changes/<id>/specs/`.
16
- - Enter apply when `stage=full` and the specs-landed gate passes (or `needs_specs_change: false`); verify/finalize require `readyToImplement=true`.
17
-
18
- ## Steps
19
-
20
- 1. Take a one-line description; derive the change id when not supplied and announce it (non-blocking, same rule as propose); identify the impacted capability.
21
- 2. Ensure `llman-sdd init` has been run (`llmanspec/` exists).
22
- 3. If `llmanspec/changes/<id>/` exists: ask fill-missing vs new id; do not overwrite without confirmation.
23
- 4. Create the planning docs (OK briefly on the default branch): `llman-sdd change new <id>` (or hand-write) → flesh out `proposal.md` → `design.md` (if needed) → `tasks.md`.
24
- 5. **Bind the branch**: `llman-sdd change start <id>` (clean tree on the default branch) or create a branch then `change attach <id>`.
25
- 6. **Land specs**: on the bound branch, edit `llmanspec/specs/<capability>.feature` (flat, or directory main file) and commit; or set `needs_specs_change: false` when there is no contract edit.
26
- 7. Validate: `llman-sdd validate <id> --strict`.
27
- 8. Confirm the specs-landed gate is green via `llman-sdd show <id> --output json` (`specsLanded` / `needsSpecsChange`), then suggest `llman-sdd-apply` (do not suggest apply before landing).
28
-
29
- {{ unit("skills/git-native-flow-brief") }}
30
- {{ unit("skills/cli-footer") }}
31
- {{ unit("skills/validation-hints") }}
32
-
33
- {{ unit("skills/ethics-governance") }}
@@ -1,56 +0,0 @@
1
- ---
2
- name: "llman-sdd-graph"
3
- description: "Visualize change dependencies (depends_on/blocks) as a mermaid graph. Auxiliary tool, usable at any stage."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Dependency Graph
9
-
10
- Visualize dependencies between changes. Auxiliary tool, not part of the main pipeline (propose → apply → verify → archive); usable at any stage.
11
-
12
- ## Usage
13
-
14
- **Focus view (seed mode)** — a specific change and its neighborhood:
15
-
16
- ```bash
17
- llman-sdd graph <change-id> # the change + direct relationships (depth 1)
18
- llman-sdd graph <change-id> --depth 3 # recurse 3 levels
19
- llman-sdd graph <change-id> --depth 0 # just the change itself
20
- ```
21
-
22
- Traverses three directions: upstream (depends_on), downstream (depended by), and blocks; auto-discovers active and archived changes.
23
-
24
- **Global view (scope mode)** — scope nodes are roots expanded one level along `depends_on` (depth 1, default; avoids unbounded dependency chains); `--depth` constrains this mode too:
25
-
26
- ```bash
27
- llman-sdd graph # active changes + direct deps (depth 1 default)
28
- llman-sdd graph --scope archived # archived + direct deps
29
- llman-sdd graph --scope all # everything + direct deps
30
- llman-sdd graph --depth 0 # scope nodes only (no dependency targets)
31
- llman-sdd graph --depth 3 # recurse 3 levels along dependency chains
32
- ```
33
-
34
- ## Output
35
-
36
- - Mermaid flowchart to stdout, pipeable to a file or renderer:
37
- ```
38
- llman-sdd graph c50 > deps.mmd
39
- llman-sdd graph c50 --depth 2 | mmdc -i - -o deps.png
40
- ```
41
- - Archived changes show a "✓ done" suffix and green highlight; disconnected groups render as independent subgraphs labeled "Active" / "Done" / "Mixed".
42
-
43
- ## Declaring dependencies (proposal frontmatter)
44
-
45
- ```yaml
46
- ---
47
- depends_on:
48
- - other-change-id
49
- blocks:
50
- - blocked-change-id
51
- ---
52
- ```
53
-
54
- {{ unit("skills/cli-footer") }}
55
-
56
- {{ unit("skills/ethics-governance") }}
@@ -1,105 +0,0 @@
1
- ---
2
- name: "llman-sdd-propose"
3
- description: "Create a proposal for behavioral-contract (requirement semantics) changes (proposal/tasks → bind branch → land specs). Small changes → quick; ideas → draft."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Propose
9
-
10
- Create a new change with planning docs (proposal + tasks; design optional): **first** `change start` (or `attach`) to bind the branch, **then** edit `llmanspec/specs/<capability>.feature` (flat, or directory main file) on the bound branch to land specs, validate, and suggest next steps.
11
-
12
- ## Pipeline Position
13
-
14
- {{ unit("skills/git-native-flow") }}
15
- {{ unit("skills/human-readable-summary") }}
16
-
17
- ```mermaid
18
- flowchart LR
19
- explore["llman-sdd-explore"] --> propose["★ llman-sdd-propose"]
20
- propose --> apply["llman-sdd-apply"]
21
- apply --> verify["llman-sdd-verify"]
22
- verify --> archive["llman-sdd-archive"]
23
-
24
- style propose fill:#fff3cd,stroke:#ffc107,stroke-width:3px
25
- ```
26
-
27
- > 📍 You are in propose: planning docs (draft → designed → planned) → bind branch → land specs (through the specs-landed gate) → next `llman-sdd-apply`. Small changes go via `llman-sdd-quick`.
28
-
29
- ## Hard Constraints
30
-
31
- - **Non-blocking change id**: if the user supplied an id, use it; otherwise derive a valid kebab-case id from the task description (verb prefix, passes the CLI id check, follows the naming convention in `llmanspec/AGENTS.md`), announce the chosen id and how to override, and continue — MUST NOT wait for confirmation (ids are cheap to change before binding). Route to `llman-sdd-draft` only when the user wants to capture an idea (no id).
32
- - **Specs are the single source of truth**: edit `llmanspec/specs/**` only **after** binding, on the **bound non-default branch**. **Do not** edit specs on the default branch. Planning docs may briefly live on the default branch.
33
- - **Don't ask "should I continue?"**: execute the full propose phase in one pass, generate artifacts and validate.
34
- {% if extra_skill_continue %}
35
- - **If the change already exists**: STOP. If the specs-landed gate is green, suggest `llman-sdd-apply`; otherwise use `llman-sdd-continue` to finish binding / landing specs or the planning docs.
36
- {% else %}
37
- - **If the change already exists**: STOP. If the specs-landed gate is green, suggest `llman-sdd-apply`; otherwise finish the planning docs / binding / landing specs (edit `llmanspec/changes/<id>/`, or enable `extra_skills: [llman-sdd-continue]`).
38
- {% endif %}
39
- - **Frontmatter has a fixed schema**: `proposal.md` accepts only the allowed fields in `llmanspec/AGENTS.md` "Change Proposal Frontmatter SSOT" (`depends_on`, `title`, `blocks`, `branch`, `base_sha`, `needs_specs_change`, etc.); `title` MUST be a non-empty one-sentence concept title and MUST NOT repeat the change id — missing or empty values are rejected by `llman-sdd validate` as ERROR, and so are out-of-set fields like `status`/`priority`/`author`. Lifecycle stage is inferred (query via `llman-sdd show`/`list`), never stored in frontmatter. Do not re-declare frontmatter fields in the prose body; the H1 MAY keep a human-readable title (freeze prefers the frontmatter `title`, falling back to the H1), not a repeat of the change id.
40
-
41
- ## Quick-capture routing
42
-
43
- If the user just wants to **capture an idea** ("draft a proposal", "note down X", "remember Y later") → `llman-sdd-draft`: it creates a `proposal.md`-only draft via `change new --from` (no id asked, no tasks/specs/attach). Full propose starts here.
44
-
45
- ## Steps
46
-
47
- ### 0) Preflight
48
- - Read `llmanspec/config.yaml` for project context, rules, locale.
49
- - `llman-sdd validate --all --strict` to ensure current artifacts are clean; on pre-existing errors, STOP and report (stacking a new change on dirty artifacts causes cascading errors).
50
- - **Specs list readable**: `llman-sdd list --specs` returns the list without errors; on anomaly, STOP and report.
51
-
52
- ### 1) Assess change scale
53
- 1. Classify:
54
- - **Behavioral contract change** (modify requirement semantics, change external behavior) → full SDD
55
- - **Implementation change** (refactor, typo, perf) → `llman-sdd-quick`
56
- - **Meta-spec change** (SDD templates/process) → full SDD
57
- - When uncertain, choose full SDD (conservative).
58
- 2. Use `llman-sdd context --task "<goal>" --paths "<scope>"` to find relevant specs.
59
- - Context unavailable → run `llman-sdd index check` first: stale/missing → `llman-sdd index rebuild` (default `pageindex`, no model needed) and retry; still unavailable on a fresh index (`LLMAN_SDD_INDEX_CHAT_MODEL` unset) → fall back to `llman-sdd list --specs` + reading `.feature` files directly — do not loop on rebuild.
60
- 3. Gather input: a short change description; a change id (user-supplied, else derive per the non-blocking rule and announce); the impacted capability (to name `specs/<capability>`).
61
-
62
- ### 2) Ensure the project is initialized
63
- - `llmanspec/` must exist; if missing, tell the user to run `llman-sdd init`, then STOP.
64
-
65
- ### 3) Create the change directory and artifacts
66
- - Prefer `llman-sdd change new <change-id>` for the `proposal.md` draft shell (or create `llmanspec/changes/<change-id>/` manually).
67
- {% if extra_skill_continue %}
68
- - If the change already exists, STOP and suggest `llman-sdd-continue`.
69
- {% else %}
70
- - If the change already exists, STOP and suggest filling missing artifacts or `llman-sdd-apply` (optionally enable continue via `extra_skills`).
71
- {% endif %}
72
- - Flesh out `proposal.md` (Why / What Changes / Capabilities / Impact); write `design.md` only when tradeoffs/migrations matter.
73
- - **Confirm seams before writing tasks.md**: list the seams to be tested and confirm with the user. A seam = the public boundary driven by `*.feature` GWT steps (CLI subprocess or public interface) — MUST reuse existing harness seams, MUST NOT invent seams detached from `.feature`; without `.feature`, the seam is the CLI subcommand or public function boundary under test.
74
- - `tasks.md`: split into **vertical slices** (each task cuts a narrow but complete path through schema→API→UI→tests, independently verifiable), with `[blocked-by: <task-id>]` dependency markers. **Wide-refactor exception** (one mechanical change sweeping the codebase, a single edit breaking many call sites): sequence as expand-contract (add new beside old → migrate call sites in batches → delete old); don't force vertical slices. **tasks.md lists implementation and verification tasks only**: close-out (`change finalize` / `change archive`) is a pipeline step and MUST NOT be listed as a task — its task gate requires every task checked, so a close-out task is self-contradictory (checking it lies, leaving it blocks close-out, and `validate --strict` stays red during implementation). Before/after completion criteria (counts, baselines) MUST state they are measured on the change branch (against merge-base) — a value taken on the default branch is usually trivially the baseline.
75
- - **First** `llman-sdd change start <change-id>` (recommended; clean tree on the default branch; `--worktree` to keep the current checkout, `--base <branch>` (local branches only) for a non-default fork source) or manually create a branch then `change attach <change-id>` (attach derives the fork source from runtime signals by default and warns on deviation).
76
- - **Then** edit `llmanspec/specs/<capability>.feature` (flat, or directory `llmanspec/specs/<capability>/` main file) on the bound non-default branch and commit (land specs). **Do not** edit specs before start; **do not** commit specs to the default branch just to satisfy the clean-tree gate. If already attached, do not re-run `start` (recover lost specs by checkout/recreate + `attach --force`).
77
- - For changes with no contract edits, set frontmatter `needs_specs_change: false`. Enter apply when `llman-sdd show <id> --output json` shows `stage=full` with the specs-landed gate green; `readyToImplement=true` (all gates) is the completion signal gating verify/finalize.
78
- - **Breaking contract changes** (removed/renamed fields, commands, tags, or stage values) MUST plan the upgrade path: write a `migrations/v<from>-v<to>/README` (upgrade guidance; a one-shot script SHALL ship with the repo when feasible) — include it in the proposal's What Changes.
79
-
80
- ### 4) Validate
81
- ```bash
82
- llman-sdd validate <change-id>
83
- ```
84
- The structure gate MUST pass before proceeding; failing items are listed one by one in the validate output's `items[].issues[]` — fix each and re-run. `--strict` promotes warnings (including unchecked tasks) to failures — reserve it for the post-implementation completion check, once every task is checked.
85
-
86
- ### 4a) Optional BDD runner (`specs:` block)
87
- - Read `llmanspec/config.yaml`. Is there a `specs:` block?
88
- - **Yes**: `specs.check_command` declares the project's BDD execution entry; validate runs it only via explicit `--check` (default skips — structure-only). Authoring follows 4b regardless.
89
- - **No**: if this change involves executable behavior scenarios (Given/When/Then the user will want to run), ask **once, up front** whether to enable a `specs:` verification runner block (adds a `specs:` block to `config.yaml` — runner only, does not change the lifecycle). If **yes**: show the exact `specs:` block to add (pick a `check_command` matching the project's test framework — `cargo test --features bdd` for rstest-bdd, `pytest {feature_dir} -k {feature_name} -v` for pytest-bdd), let the user confirm or edit, write it to `config.yaml`, then proceed with 4b. If **no**: features still validate structurally; BDD execution responsibility stays with the project test suite.
90
- - **Do NOT silently add the `specs:` block** — always ask first. Adding it declares the project-wide BDD execution entry.
91
-
92
- ### 4b) Single-track feature authoring
93
- - Planning docs may briefly live on the default branch; **do not** edit `llmanspec/specs/**` on the default branch. After binding, landing specs and implementation happen on the bound branch.
94
- - **Single-track**: each capability is ONE `<capability>.feature`. The canonical style is the native Gherkin hierarchy: `@req:<id>` on the `规则:` block header, nested `场景:` (`Given/When/Then` steps bound to runner step code and executed — **the default, preferred shape**); only when a requirement cannot be expressed programmatically (abstract goals, architecture decisions, governance/human judgment) or is not yet converted, leave a `规则:` block with no nested scenario (bare rule, free-text description) and record the rationale in proposal/design. Legacy tags (@executable/@rule/@human/@manual) are gone.
95
- - **Description readability**: split long `规则:` descriptions across multiple lines for reviewability (the official parser preserves lines); description lines must not carry a `- ` list marker (it becomes part of the description) and must not begin with a step keyword (`假如/当/那么/而且` / `Given/When/Then/And/But` — Gherkin would parse it as a step).
96
- - **Structured adds preferred**: to append rules/scenarios to an existing capability, prefer `llman-sdd spec next-req-id` (global rN allocation) + `spec add-req` (appends a `规则:` block) + `spec add-scenario` (inserts a nested `场景:` under the rule). New capability → `spec skeleton <capability>`; id lookup → `spec resolve-req <rN>`. Legacy tag-based files: run `spec migrate-native` first. Hand-editing the `.feature` stays the escape hatch (best for editing existing clauses).
97
- - **Executable-scenario-first triage** (decide before writing any new clause): any behavior expressible as GWT (Given/When/Then) and bound to step code MUST land as a nested `场景:` — prose-only rules guard nothing. Examples: programmatically decidable behavior (e.g. "when validate runs then stdout is TOON and exit code is 0") → nested `场景:`; abstract goals/architecture decisions not decidable by program → a bare `规则:` block (no nested scenario; aggregate count nudges it; specs-compact reduces it), recording the rationale in proposal/design.
98
-
99
- ### 5) Summarize and suggest next step
100
- - Enter implementation: `llman-sdd-apply`. Need more thinking: `llman-sdd-explore`.
101
-
102
- {{ unit("skills/cli-footer") }}
103
- {{ unit("skills/validation-hints") }}
104
-
105
- {{ unit("skills/structured-protocol") }}
@@ -1,41 +0,0 @@
1
- ---
2
- name: "llman-sdd-quick"
3
- description: "Quick path for small changes that don't touch behavioral contracts (refactor/typo/perf). If a behavioral-contract (requirement semantics) change emerges, stop and switch to propose."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Quick Path
9
-
10
- Use this path for small changes that don't modify behavioral contracts.
11
-
12
- ## Pipeline Position
13
-
14
- ```mermaid
15
- flowchart LR
16
- quick["★ llman-sdd-quick"] --> commit["git commit"]
17
- explore["llman-sdd-explore"] --> propose["Full path: propose → apply → verify → archive"]
18
-
19
- style quick fill:#d4edda,stroke:#28a745,stroke-width:3px
20
- ```
21
-
22
- > 📍 Quick path: edit code and commit directly. If you find a contract change is needed → STOP, switch to `llman-sdd-propose`.
23
-
24
- ## Conditions (all must hold)
25
- - Does not change any requirement-semantics-defined externally observable behavior
26
- - Does not cross capability boundaries; no migration/compatibility concerns; not an SDD meta-spec change
27
-
28
- ## Steps
29
- 1. Use `llman-sdd context --task "..." --paths "..."` to confirm no spec changes are needed.
30
- - If context returns `quality: "unavailable"` → run `llman-sdd index check` first: stale/missing → `llman-sdd index rebuild` (default `pageindex`, no model needed) and retry; still unavailable on a fresh index (`LLMAN_SDD_INDEX_CHAT_MODEL` unset) → fall back to `llman-sdd list --specs` + reading `.feature` files directly — do not loop on rebuild.
31
- 2. Modify the code directly.
32
- 3. If you need to touch `llmanspec/specs/**`, STOP — unless you are on a bound non-default change branch (mini change: `change start`/`attach` → edit → commit). Never commit specs on the default branch, not even for typo or scope-only fixes. Prefer routing specs maintenance to `llman-sdd-propose`.
33
- 4. git commit (message explains why). No change directory, no archive.
34
-
35
- ## Boundary handling
36
- - A behavioral contract change emerges mid-edit → STOP, switch to `llman-sdd-propose`.
37
- - Multiple files involved and scope unclear → confirm with `llman-sdd context` first.
38
-
39
- {{ unit("skills/cli-footer") }}
40
-
41
- {{ unit("skills/ethics-governance") }}
@@ -1,35 +0,0 @@
1
- ---
2
- name: "llman-sdd-research"
3
- description: "Delegate fact-finding to a background agent: primary sources only (official docs/API/source), cited findings."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Research
9
-
10
- Spin up a **background agent** to do the research while you keep working. Auxiliary tool, usable at any stage (common in explore/wayfinder); output is written back to the change's proposal "Further Notes" section.
11
-
12
- ## The background agent's job
13
-
14
- 1. Investigate against **primary sources** — official docs, source code, specs, first-party APIs, not secondary write-ups; trace every claim back to the source that owns it.
15
- 2. Write findings to a single Markdown file, citing each claim's source.
16
- 3. Save location (repo convention wins if it has one): **default** `llmanspec/changes/<current-change>/research/<topic>.md` (change docs, **not** specs). Write to `docs/research/` only when the topic spans multiple changes and will still be referenced after archiving; **never** put single-change decisions or decaying deep-dives into `docs/research/`.
17
- 4. **MUST NOT** edit `llmanspec/specs/**` in this skill. If research shows requirement semantics must change → suggest `llman-sdd-propose` (bind branch → land specs).
18
-
19
- ## Steps
20
-
21
- 1. Clarify the research question (confirm with the user; sharpen a fuzzy one into a falsifiable one).
22
- 2. Launch via the Agent tool with `subagent_type=general-purpose` + `run_in_background: true`, prompt containing:
23
- - The question statement; a requirement to cite only primary sources, with source URL/path per claim;
24
- - The output file path (default `llmanspec/changes/<id>/research/<topic>.md`);
25
- - A word limit (suggested: focus on facts, prose narrative < 1500 words).
26
- 3. Continue main-flow work while it runs; when done, read the output and summarize key conclusions into the current change's `proposal.md` "Further Notes" section (with a file pointer).
27
- 4. If the research reveals a decision is needed, suggest entering `llman-sdd-explore`'s deep-dive Q&A branch.
28
-
29
- ## Cooperation with wayfinder
30
-
31
- `llman-sdd-wayfinder`'s research tickets delegate to this skill for background resolution; on completion, write back to the ticket proposal and record a one-line gist in the map's Decisions-so-far.
32
-
33
- {{ unit("skills/cli-footer") }}
34
-
35
- {{ unit("skills/structured-protocol") }}
@@ -1,41 +0,0 @@
1
- ---
2
- name: "llman-sdd-specs-compact"
3
- description: "Compact and dedupe specs: merge redundant requirements/scenarios without changing normative behavior. Manual run only, when the user explicitly asks."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Specs Compact
9
-
10
- Compact specs without changing normative behavior. Maintenance tool, not part of the daily pipeline; typically run after many archived changes.
11
-
12
- ## Context
13
- - Specs bloat with duplicate requirements/scenarios as changes accumulate; compaction must stay verifiable and regressible.
14
- - An oversized archive history interferes with compaction review and navigation.
15
-
16
- ## Goal
17
- - Merge redundant requirements/scenarios into a more compact, maintainable spec structure.
18
-
19
- ## Constraints
20
- - Don't delete normative behavior without explicit replacement; keep requirement titles stable where possible; every retained requirement keeps at least one valid scenario.
21
- - **Editing `llmanspec/specs/**` requires a change**: bind the branch first (`change start` / `attach`), then edit and commit on the bound branch; **never** compact-rewrite specs on the default branch.
22
-
23
- ## Workflow
24
- 1. Inventory specs (`llman-sdd list --specs`).
25
- 2. If archived history is large, freeze first: preview `llman-sdd archive freeze --dry-run`; execute `llman-sdd archive freeze --before <YYYY-MM-DD> --keep-recent <N>`.
26
- 3. Identify cross-capability overlap (duplicate req ids across specs: `llman-sdd project dedupe-req-ids --dry-run` reports the remap plan).
27
- 4. Produce a compaction plan (canonical requirements + keep/merge/remove decisions + migration notes).
28
- 5. Execute and validate (`llman-sdd validate --specs --strict`).
29
-
30
- ## Decision Policy
31
- - Prefer merging semantically equivalent requirements; extract shared text only when references are clear; freeze first when the archive is noisy.
32
- - If compaction would change external behavior, pause and ask the user first.
33
-
34
- ## Output Contract
35
- - Compaction plan grouped by capability: keep/merge/remove decisions with rationale + validation commands and expected results.
36
-
37
- {{ unit("skills/cli-footer") }}
38
-
39
- {{ unit("skills/validation-hints") }}
40
-
41
- {{ unit("skills/ethics-governance") }}
@@ -1,28 +0,0 @@
1
- ---
2
- name: "llman-sdd-validate"
3
- description: "Validate changes and specs; suggest actionable fixes."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Validate
9
-
10
- Validate change/spec format.
11
-
12
- ## Steps
13
- 1. Single item: `llman-sdd validate <id>`; batch: `llman-sdd validate --all` (or `--changes` / `--specs`); use `--strict` in CI/automation.
14
- 2. On failure, summarize the errors and propose minimal, concrete fixes.
15
- {% if specs_enabled %}
16
- 3. **BDD checks**:
17
- - Validate `.feature` Gherkin and `@req` / dual-write gates on the **bound branch**; `.feature` is the harness authority — executable GWT lives only there.
18
- - Lifecycle gates: `change start` / `attach` (bind branch), `finalize` (close-out; auto commit `archive(sdd): <id>`, `--no-commit` to skip) / `diff` (read-only).
19
- - `llman-sdd validate --specs` enforces structural and contract gates; when `specs.check_command` is configured the full harness runs only with explicit `--check` (default skips — structure-only); a placeholder-free command runs at most once per invocation.
20
- - `list --specs --json` shows `morphology` (requirementCount / requirementBoundCount / requirementUnboundCount / acceptanceCount / featureScenarioCount).
21
- - Change JSON status fields: `stage` (draft/designed/planned/full) / `specsLanded` / `needsSpecsChange` / `readyToImplement` (`show --output json`).
22
- {% endif %}
23
-
24
- {{ unit("skills/cli-footer") }}
25
-
26
- {{ unit("skills/validation-hints") }}
27
-
28
- {{ unit("skills/ethics-governance") }}
@@ -1,77 +0,0 @@
1
- ---
2
- name: "llman-sdd-verify"
3
- description: "Verify an implemented change against its specs/design/tasks; report CRITICAL/WARNING/SUGGESTION. Run after apply; if clean, ready to archive."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Verify
9
-
10
- Verify that the implementation matches the change's artifacts.
11
-
12
- ## Pipeline Position
13
-
14
- ```mermaid
15
- flowchart LR
16
- apply["llman-sdd-apply"] --> verify["★ llman-sdd-verify"]
17
- verify --> archive["llman-sdd-archive"]
18
-
19
- style verify fill:#fff3cd,stroke:#ffc107,stroke-width:3px
20
- ```
21
-
22
- > 📍 You are in verify → pass leads to `llman-sdd-archive`, failure goes back to `llman-sdd-apply`. The change should already have landed specs with `readyToImplement=true` (all gates green — the completion signal).
23
-
24
- ## Hard Constraints
25
-
26
- - **Apply must be all-green first**: don't verify unimplemented changes.
27
- - **CRITICAL must be fixed**: zero CRITICAL before archive.
28
- - **Rerun the gates yourself**: MUST rerun `llman-sdd validate <id> --check --strict` (real harness evidence) and the project gates; MUST NOT trust gate verdicts in the implementer's report — a mismatch is CRITICAL.
29
- - **Harness evidence requires `--check`**: plain `validate` does not run the harness; claiming full-harness evidence MUST use explicit `--check` — the default structural gate is not a pass. Close-out runs the configured `specs.check_command`, so do not run it again just before close-out.
30
- - **Don't ask "should I continue?"**: run the full verification flow and output a complete report.
31
-
32
- {{ unit("skills/stage-guard") }}
33
-
34
- ## Steps
35
- 1. Select the change id (or ask the user to pick from `llman-sdd list --json`).
36
- 2. Fast validation gate: `llman-sdd validate <id> --strict`.
37
- - When diagnosing structural issues (Gherkin parse / `@req` linkage / dual-write / req_id uniqueness), run the structural validation first (the full harness only runs via explicit `--check`; plain `validate` no longer runs it by default; a harness failure lands as an ERROR on its spec item). Failing items are listed one by one in the default TOON output's `items[].issues[]` (`--output human` prints `FAIL <item_type>/<id>` lines above the `Totals` line).
38
- 3. Read: `llmanspec/specs/**` (`<capability>.feature`, the single source of truth) on the branch, `proposal.md` and `design.md` (if present), `tasks.md`; ignore residual old docs under `changes/<id>/specs/`.
39
- 4. **Dual-axis review (kept separate so neither masks the other)** — diff against `git diff <merge-base>...HEAD` (merge-base is COMPUTED via `git merge-base <local-default> HEAD`; the stored base_sha is audit-only and MUST NOT feed range math):
40
- - **Spec axis**: does the implementation satisfy the `规则:` block requirement statement (free-text description, judged by its semantics) and the nested `场景:` GWT steps? Missing/partial behaviors, wrong implementations, and scope creep not asked for by the spec → suggest minimal fixes or artifact updates. Check where before/after evidence (counts, baselines) was taken: it MUST be measured on the change branch (against the freshly computed merge-base); a value measured on the default branch is usually trivially the baseline and proves nothing.
41
- - **Standards axis**: does the code follow `AGENTS.md` + the smell baseline? Authority priority: `AGENTS.md` > smell baseline; skip anything tooling already enforces. Smells are **judgement heuristics** ("possible Feature Envy"), not hard violations:
42
-
43
- | Smell | Fix |
44
- |-------|-----|
45
- | Mysterious Name (name hides intent) | rename it |
46
- | Duplicated Code (same logic shape) | extract the shared part |
47
- | Feature Envy (method uses another's data more) | move the method over |
48
- | Data Clumps (same fields travel together) | bundle into a type |
49
- | Primitive Obsession (primitive stands in for a domain concept) | give it a dedicated type |
50
- | Repeated Switches (same switch recurs) | polymorphism or a shared map |
51
- | Shotgun Surgery (one change scatters edits) | gather into one module |
52
- | Divergent Change (one file changes for unrelated reasons) | split it |
53
- | Speculative Generality (abstraction for unseen needs) | delete it |
54
- | Message Chains (long a.b().c()) | hide the chain behind one method |
55
- | Middle Man (just delegates) | cut it, call direct |
56
- | Refused Bequest (subclass rejects most inheritance) | use composition |
57
- - The two axes may be reviewed in parallel (sub-agents); the report MUST present them separately, MUST NOT merge or cross-rerank (one axis passing must not mask the other failing).
58
- 5. **BDD verification** — only when `config.yaml` has a `specs:` block:
59
- - Confirm the change is branch-bound and you are on that branch.
60
- - `llman-sdd validate --specs`: Gherkin + `@req`/dual-write gates; the full harness only runs via explicit `--check` (default skips) and a failure maps to an ERROR on the matching spec item.
61
- - Optional read-only review: `llman-sdd change diff <id>` (or `--export-patch <path>`) — review/export only, never an apply step.
62
- - Next step after verify passes: `llman-sdd-archive` (not inline finalize here).
63
- {% if specs_verify_prompt %}
64
- - Extra requirement: {{ specs_verify_prompt }}
65
- {% endif %}
66
- 6. Produce a short report: **CRITICAL** (must fix before archive) / **WARNING** (should fix) / **SUGGESTION** (nice to have).
67
- 7. **Human review gate**: once the report has no CRITICAL findings and before suggesting archive, run `llman-sdd review`: exit code zero → suggest `llman-sdd-archive`; non-zero = CRITICAL → fix via `llman-sdd-apply`, then re-run review; MUST NOT enter finalize/archive with CRITICAL findings open.
68
-
69
- {{ unit("skills/git-native-flow-brief") }}
70
- {{ unit("skills/human-readable-summary") }}
71
- {{ unit("skills/cli-footer") }}
72
-
73
- {{ unit("skills/version-drift") }}
74
-
75
- {{ unit("skills/validation-hints") }}
76
-
77
- {{ unit("skills/structured-protocol") }}