@llman-sdd/core 0.8.2 → 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 (89) 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 +21 -7
  9. package/src/config/changeId.ts +0 -6
  10. package/src/config/load.ts +36 -2
  11. package/src/config/schema.ts +3 -7
  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/git/spawnGit.ts +5 -1
  16. package/src/index.ts +37 -12
  17. package/src/init/defaultConfig.ts +14 -31
  18. package/src/init/init.ts +92 -30
  19. package/src/locale.ts +33 -0
  20. package/src/project/migrations.ts +196 -60
  21. package/src/report/graph/deps.ts +3 -38
  22. package/src/report/graph/nodes.ts +13 -19
  23. package/src/report/graph/types.ts +2 -6
  24. package/src/report/show.ts +16 -8
  25. package/src/report/specHelpers.ts +22 -28
  26. package/src/review/review.ts +18 -31
  27. package/src/self/completion.ts +206 -0
  28. package/src/spec/assignSpecIds.ts +9 -1
  29. package/src/spec/authoring.ts +11 -11
  30. package/src/spec/parser.ts +3 -1
  31. package/src/templates/skills.ts +3 -23
  32. package/src/util/datedId.ts +18 -0
  33. package/src/util/fsPort.ts +24 -0
  34. package/src/util/nextNumber.ts +30 -0
  35. package/src/util/semver.ts +21 -0
  36. package/src/validation/changeCheck.ts +133 -67
  37. package/src/validation/crossRoot.ts +86 -0
  38. package/src/validation/discover.ts +22 -13
  39. package/src/validation/roots.ts +2 -5
  40. package/src/validation/validate.ts +10 -19
  41. package/src/validation/{transitions.ts → xstateTransitions.ts} +81 -69
  42. package/templates/zh-Hans/skills/llman-sdd-apply-cycle.md +9 -7
  43. package/templates/zh-Hans/skills/llman-sdd-apply.md +5 -5
  44. package/templates/zh-Hans/skills/llman-sdd-archive.md +11 -2
  45. package/templates/zh-Hans/skills/llman-sdd-continue.md +1 -1
  46. package/templates/zh-Hans/skills/llman-sdd-draft.md +1 -1
  47. package/templates/zh-Hans/skills/llman-sdd-explore.md +2 -2
  48. package/templates/zh-Hans/skills/llman-sdd-ff.md +1 -1
  49. package/templates/zh-Hans/skills/llman-sdd-propose.md +8 -6
  50. package/templates/zh-Hans/skills/llman-sdd-quick.md +1 -1
  51. package/templates/zh-Hans/skills/llman-sdd-validate.md +1 -1
  52. package/templates/zh-Hans/skills/llman-sdd-verify.md +2 -2
  53. package/templates/zh-Hans/skills/llman-sdd-wayfinder.md +1 -1
  54. package/templates/zh-Hans/units/skills/git-native-flow.md +12 -6
  55. package/templates/zh-Hans/units/skills/index-fallback.md +1 -0
  56. package/templates/zh-Hans/units/skills/structured-protocol.md +1 -6
  57. package/templates/zh-Hans/units/spec/feature-contract.md +5 -33
  58. package/src/templates/locale.ts +0 -24
  59. package/templates/en/agents-root-stub.md +0 -9
  60. package/templates/en/llmanspec-agents-stub.md +0 -6
  61. package/templates/en/skills/llman-sdd-apply-cycle.md +0 -67
  62. package/templates/en/skills/llman-sdd-apply.md +0 -117
  63. package/templates/en/skills/llman-sdd-arch-review.md +0 -58
  64. package/templates/en/skills/llman-sdd-archive.md +0 -70
  65. package/templates/en/skills/llman-sdd-continue.md +0 -34
  66. package/templates/en/skills/llman-sdd-draft.md +0 -53
  67. package/templates/en/skills/llman-sdd-explore.md +0 -64
  68. package/templates/en/skills/llman-sdd-ff.md +0 -33
  69. package/templates/en/skills/llman-sdd-graph.md +0 -56
  70. package/templates/en/skills/llman-sdd-propose.md +0 -105
  71. package/templates/en/skills/llman-sdd-quick.md +0 -41
  72. package/templates/en/skills/llman-sdd-research.md +0 -35
  73. package/templates/en/skills/llman-sdd-specs-compact.md +0 -41
  74. package/templates/en/skills/llman-sdd-validate.md +0 -28
  75. package/templates/en/skills/llman-sdd-verify.md +0 -77
  76. package/templates/en/skills/llman-sdd-wayfinder.md +0 -83
  77. package/templates/en/units/skills/cli-footer.md +0 -2
  78. package/templates/en/units/skills/ethics-governance.md +0 -6
  79. package/templates/en/units/skills/git-native-flow-brief.md +0 -10
  80. package/templates/en/units/skills/git-native-flow.md +0 -50
  81. package/templates/en/units/skills/human-readable-summary.md +0 -9
  82. package/templates/en/units/skills/stage-guard.md +0 -17
  83. package/templates/en/units/skills/structured-protocol.md +0 -24
  84. package/templates/en/units/skills/validation-hints.md +0 -20
  85. package/templates/en/units/skills/version-drift.md +0 -3
  86. package/templates/en/units/spec/feature-contract.md +0 -38
  87. package/templates/en/units/workflow/archive-freeze-guidance.md +0 -9
  88. package/templates/zh-Hans/units/skills/git-native-flow-brief.md +0 -10
  89. package/templates/zh-Hans/units/workflow/archive-freeze-guidance.md +0 -10
@@ -1,67 +0,0 @@
1
- ---
2
- name: "llman-sdd-apply-cycle"
3
- description: "End-to-end closed loop for one change: implement→test→validate→verify→archive. Manual trigger only; agent must not auto-invoke."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- disable-model-invocation: true
7
- ---
8
-
9
- # LLMAN SDD Apply Cycle
10
-
11
- End-to-end closed loop for one change (manual). Requires a bound branch and a green specs-landed gate (`specsLanded ∨ needsSpecsChange=false`); `readyToImplement=true` (the completion signal) closes the cycle.
12
-
13
- **Manual trigger only**: `/skill:llman-sdd-apply-cycle <change-id>`
14
-
15
- ## Workflow
16
-
17
- ### 0) Gate + status
18
- ```bash
19
- llman-sdd show <change-id> --output json --type change
20
- ```
21
- > Stage decisions use the `stage` / `readyToImplement` fields; the full decision table lives in llman-sdd-apply.
22
-
23
- - Must be on the bound non-default branch.
24
- - specs-landed gate failing → STOP (land specs or `needs_specs_change: false`). Green but `readyToImplement=false` → normal: tasks pending, keep implementing; **finalize only when `readyToImplement=true`**.
25
- - Track progress via `tasks.md` checkboxes (or `llman-sdd list` task counts); still read `tasks.md`, proposal/design, and `llmanspec/specs/**` on the bound branch (the single source of truth).
26
-
27
- ### 1) Loop: implement → test
28
- For each incomplete task:
29
- 1. Implement per task + specs (minimal diff)
30
- 2. Run the task's stated verification command when the task text names one
31
- 3. On failure, fix and retry (same self-repair budget as `llman-sdd-apply`: cap 8 rounds)
32
- 4. Check off `tasks.md` as `[x]`
33
-
34
- ### 2) Validate
35
- ```bash
36
- llman-sdd validate <change-id> --strict
37
- ```
38
- On failure, fix and retry (cap 8 rounds).
39
-
40
- ### 3) Verify (recommended)
41
- Prefer `llman-sdd-verify` (or an equivalent dual-axis self-check). CRITICAL → STOP; do not archive.
42
-
43
- ### 4) Archive + commit
44
- ```bash
45
- llman-sdd change finalize <change-id>
46
- ```
47
- Dirty tree OK; auto merge (squash default) + rename + **auto commit** `archive(sdd): <change-id>` in one process. `--no-commit` skips the auto commit (manual/CI histories) — then commit with `git add -A && git commit -m "archive(sdd): <change-id>"`. Plain `change archive` stays as a fallback.
48
-
49
- ### 5) Optional cleanup
50
- ```bash
51
- git branch -D <feature-branch> # after squash the branch is no longer an ancestor of main; -d gets refused
52
- ```
53
- Push / PR only when the user explicitly asks.
54
-
55
- ## Hard constraints
56
- - **Never ask** "should I continue" unless blocked.
57
- - **Never switch** changes until this one is archived and committed.
58
- - **Do not** author `changes/<id>/specs/`; **no default push/PR**.
59
-
60
- ## Ethics Governance
61
- - `ethics.risk_level`: medium
62
- - `ethics.prohibited_actions`: implementing without a bound branch / a green specs-landed gate, archiving without `readyToImplement=true`, switching changes early, writing `changes/<id>/specs/`, committing without validation, default push/PR
63
- - `ethics.required_evidence`: `readyToImplement=true`, validate --strict pass, all tasks checked, finalize/archive success
64
- - `ethics.refusal_contract`: after 8 self-repair rounds still failing, report a blocker; never force-archive
65
- - `ethics.escalation_policy`: if changing SDD workflow specs/templates, pause for user confirmation before archive
66
-
67
- {{ unit("skills/cli-footer") }}
@@ -1,117 +0,0 @@
1
- ---
2
- name: "llman-sdd-apply"
3
- description: "Implement a proposed change's tasks in a closed loop: code → test → self-heal → all gates green. Enter after propose, once specs are landed."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Apply
9
-
10
- Implement all tasks in `llmanspec/changes/<id>/tasks.md` **in one closed loop**: implement → add tests/acceptance → run gates → self-heal and re-run on failure → report when all pass. Unless there is a clear blocker, **do not stop halfway to ask "should I continue?"**
11
-
12
- ## Pipeline Position
13
-
14
- {{ unit("skills/git-native-flow-brief") }}
15
-
16
- ```mermaid
17
- flowchart LR
18
- propose["llman-sdd-propose"] --> apply["★ llman-sdd-apply"]
19
- apply --> verify["llman-sdd-verify"]
20
- verify --> archive["llman-sdd-archive"]
21
-
22
- style apply fill:#fff3cd,stroke:#ffc107,stroke-width:3px
23
- ```
24
-
25
- > 📍 Entry requires the specs-landed gate green (or `needs_specs_change: false`); `readyToImplement=true` (all gates green) is the completion signal that closes this loop → next `llman-sdd-verify`.
26
-
27
- ## Hard Constraints
28
-
29
- - **Single-source-of-truth driven**: `proposal.md` / `design.md` / `tasks.md` and `llmanspec/specs/**` on the branch; every behavioral-contract requirement in specs must be fulfilled.
30
- - **Scope-locked**: only implement the current change's scope; never fix "unrelated issues" on the side; keep changes minimal.
31
- - **Governing scope**: the SDD flow (change branch, proposal, spec-edit gates) governs the behavior-contract surface only — `llmanspec/**` and its artifact alignment (e.g. `.agents/skills` render freshness). Everything else in the repo (build scripts, CI, general docs, test implementations) follows the project's regular engineering flow with direct edits and commits; no change wrapping required. Return to the corresponding skill flow only when a change reaches behavior-contract semantics.
32
- - **No guessing**: unclear requirements or specs contradicting reality → STOP and report; don't assume.
33
- - **No legacy compatibility layers**: if the change requires new behavior, upgrade all call sites directly, unless tasks/proposal explicitly require compatibility.
34
- - **Close-out**: this loop ends by suggesting `llman-sdd-verify`; finalize/archive belongs to `llman-sdd-archive` (do not finalize inside the self-healing loop).
35
-
36
- ## Commit Policy
37
-
38
- - **Commits on the change branch are free** (`change finalize` needs no clean tree): segment by task/milestone, or keep the tree dirty and let finalize make one close commit — both are first-class.
39
- - **Default close-out**: after all tasks pass gates and verify is green, `llman-sdd change finalize <id>` auto-commits `archive(sdd): <change-id>` (uncommitted diff + frontmatter + rename in one commit). Do not run finalize inside the apply loop. `--no-commit` skips the auto commit (manual/CI histories; pre-commit-hook conflicts).
40
- - **Blocker interrupt**: when you must STOP on a blocker, make ONE WIP commit (e.g. `wip(sdd): <change-id> <summary>`) to preserve the state, then report.
41
-
42
- ## Steps
43
-
44
- ### 0) Preflight (required)
45
- - Read and obey `llmanspec/config.yaml`, `AGENTS.md` (if present).
46
- - `git status --porcelain`: if the tree is dirty with changes not belonging to this change → `git stash push -u -m "llman-sdd-apply autopilot backup"` first.
47
- - `llman-sdd validate --all --strict`: if it fails for reasons unrelated to this change → stop and report (inconsistent artifacts prevent source-of-truth-driven implementation).
48
- - **Specs list readable**: `llman-sdd list --specs` returns the list without errors; on anomaly → stop and report.
49
-
50
- ### 1) Select the change id and check prerequisites
51
- - If provided, use it; otherwise infer from context, and if ambiguous run `llman-sdd list --json` and let the user pick. Always announce "Using change: <id>" and how to override.
52
- - Confirm you are on the non-default branch bound via `llman-sdd change start <id>` or `change attach <id>` (`--force` only to rebind). Specs on the branch are the single source of truth — do not author under `changes/<id>/specs/`.
53
- {{ unit("skills/stage-guard") }}
54
- - Use `llman-sdd context --task "<goal from proposal>" --paths "<scope from specs>"` to get relevant specs.
55
- - Context unavailable → run `llman-sdd index check` first: stale/missing → `llman-sdd index rebuild` 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.
56
-
57
- ### 2) Read the source-of-truth artifacts
58
- - `llmanspec/changes/<id>/proposal.md`, `design.md` (if present), `tasks.md`
59
- - `llmanspec/specs/**` (`<capability>.feature`) on the branch
60
-
61
- Distill proposal/design decisions into a list of inviolable hard constraints; convert tasks.md into a minimal executable step sequence (preserving original order).
62
-
63
- ### 3) Show status
64
- - Progress "N/M tasks complete" + a brief look at the next 1–3 unchecked tasks.
65
-
66
- ### 4) Implement tasks one by one (closed loop)
67
- For each unchecked task:
68
- 1. **Implement**: strictly per task description + specs, minimal changes.
69
- 2. **Check the box immediately** after completion: `- [ ]` → `- [x]`. **Close-out is not a task**: `change finalize` / `change archive` are pipeline steps and MUST NOT appear in tasks.md — if one is listed (e.g. "close-out — finalize"), remove it (the close-out task gate requires every task checked).
70
- 3. **Edit, then verify — serially**: verification MUST run after edits land on disk; MUST NOT put edits and tests/validation in the same parallel tool-call batch (the check may read stale files and report a false failure or a false pass).
71
- 4. Task unclear, blocker hit, or specs/design contradict reality → STOP and report; don't assume.
72
-
73
- ### 5) Verification and self-healing loop (after each task or batch)
74
- - Tests and static gates: run the verification means this repo has declared — as recorded in repo docs and configuration; for repos with `specs.check_command` configured, use the command reported by `llman-sdd config`. If the repo declares none, ask the user; never assume a specific task runner exists.
75
- - Edit `llmanspec/specs/<capability>.feature` on the branch as needed (flat or directory main file; canonical native layout: `@req:<id>` on the `规则:` block header, nested `场景:` as executable examples); run `llman-sdd validate --specs` after spec edits; commit on the branch freely.
76
- - SDD validation: `llman-sdd validate <id> --strict`
77
-
78
- **Verification ladder (opt-in discipline, escalate by cost)**:
79
- - L1 minimal unit: the fastest declared verification means that loads the changed module directly; covers only the current change point.
80
- - L2 targeted behavior: run the subset of declared verification means matching the current scenario (prefer targeted `specs.check_command` invocation when configured); reproduce the target behavior only.
81
- - L3 explicit full harness: `llman-sdd validate --check` (with `specs.check_command` configured; plain `validate` no longer runs the harness).
82
- - L4 close-out backstop: `change finalize` runs the real harness pre-merge — at least one full run per close-out.
83
- - Self-heal loops default to L1/L2 for fast reproduction; use L3 only when full-acceptance evidence is needed; avoid paying full-suite cost needlessly.
84
-
85
- **Gate evidence**:
86
- - Plain `validate` is structure/state-only and claims no harness evidence; harness evidence MUST come from explicit `--check` or close-out acceptance.
87
- - Gate verdicts MUST come from the real harness: claiming a harness pass requires `--check` (or close-out); the default structural gate is not a pass; on harness failure, find the root cause first (leaked env vars, nested-invocation guards, wrong cwd …) — MUST NOT label it an "inherent/self-referential property" and bypass it.
88
- - Before/after criteria (counts, baselines) 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.
89
- - Refactors and bulk replacements: MUST compare the test count before and after; all-green gates with fewer tests is a failure.
90
-
91
- **On failure → self-heal (don't ask "should I continue?"):**
92
- 1. Parse the failure cause (test / lint / format / validation).
93
- 2. Decide if it's a hard-to-locate bug (cause unclear / intermittent flake / regression not obvious at a glance):
94
- - **Not hard-to-locate** (clear lint/format/compile/validation error): apply a minimal fix (don't expand scope); re-run the minimum failure-repro command first, then all gates.
95
- - **Hard-to-locate → escalate to the diagnose sub-flow**:
96
- 1. **First build a command that reproduces the failure** (fast, deterministic, agent-runnable, and goes red on *this* bug) — one that drives the real bug path and asserts the user's exact symptom. **MUST NOT start hypothesizing before such a command exists** (staring at code and guessing is the failure this prevents).
97
- 2. Run it, confirm red → minimize the repro (cut inputs/calls/config/data one at a time, keep only what's load-bearing).
98
- 3. Generate **3–5 ranked hypotheses**, each falsifiable ("if X is the cause, changing Y makes the bug disappear").
99
- 4. Verify one variable at a time; fix once the root cause is found.
100
- 5. If there's no correct seam for a regression test, note the architectural gap (hand off to `llman-sdd-arch-review`; when not enabled, write the gap into this change's `proposal.md` Further Notes section or `design.md`, and MUST NOT break the loop over it).
101
- 3. Re-run the minimum failure-repro command first, then all gates.
102
- 4. Log one self-healing round: `Round N: failure → fix → re-run → pass/fail`.
103
-
104
- **Self-healing cap: 8 rounds**; exceeding it is a blocker: stop and output a blocker report (last failing command + output summary + what you tried).
105
-
106
- **Human review gate (after each task batch passes the gates)**: before starting the next batch or emitting the completion report, run `llman-sdd review`: exit code zero → continue; non-zero = CRITICAL findings → STOP, fix, re-run review; MUST NOT enter the next batch or emit the completion report with CRITICAL findings open.
107
-
108
- ### 6) Completion report
109
- After all tasks complete + all gates green, output a structured report (see Output Contract), then suggest `llman-sdd-verify`.
110
-
111
- {{ unit("skills/cli-footer") }}
112
-
113
- {{ unit("skills/version-drift") }}
114
-
115
- {{ unit("skills/validation-hints") }}
116
-
117
- {{ unit("skills/structured-protocol") }}
@@ -1,58 +0,0 @@
1
- ---
2
- name: "llman-sdd-arch-review"
3
- description: "Architecture review: scan for shallow modules (interface ≈ implementation) and surface deepening candidates to improve testability and AI-navigability."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Architecture Review
9
-
10
- Scan the codebase for architectural friction and surface **deepening opportunities** — turning shallow modules (interface ≈ implementation) into deep ones (lots of behavior behind a small interface). The aim is testability and AI-navigability. Auxiliary tool, not part of the main pipeline; usable at any stage, commonly triggered during explore.
11
-
12
- ## Design vocabulary
13
-
14
- Words about module shape; MUST NOT substitute "component" / "service" / "API" / "boundary" (broader, less precise):
15
-
16
- - **Module** — anything with an interface and an implementation (function/class/package/cross-layer slice).
17
- - **Interface** — everything a caller must know to use it correctly: type signature, plus invariants, ordering constraints, error modes, performance characteristics.
18
- - **Depth** — the amount of behavior behind the interface. **Deep** = lots of behavior behind a small interface; **shallow** = interface nearly as complex as the implementation (the caller saves nothing). This skill turns shallow into deep.
19
- - **Seam** — a place where you can swap the implementation without editing call sites (where the interface lives). In llman, seam = the public boundary driven by `*.feature` GWT steps.
20
- - **Leverage** — what callers get from depth: more capability per unit of interface learned.
21
- - **Locality** — what maintainers get from depth: changes/bugs/knowledge/verification concentrate in one place.
22
-
23
- ## Steps
24
-
25
- ### 1. Explore (scope first, YAGNI)
26
- - If the user named a direction (module/subsystem/pain point), accept it; skip inference.
27
- - Otherwise walk `git log --oneline` for hot spots (files/areas that keep coming up).
28
- - Prefer reading `<capability>.feature` (the single source of truth) and `design.md` (existing ADRs); MUST NOT create a `CONTEXT.md`.
29
- - Use the Agent tool (`subagent_type=Explore`) to walk the codebase, noting friction:
30
- - Does understanding one concept require bouncing between many small modules?
31
- - Where are modules **shallow** (interface ≈ implementation complexity, callers save nothing)?
32
- - Where are pure functions extracted only for testability, but real bugs hide in how they're called (no locality)?
33
- - Which parts are untested or hard to test through their current interface?
34
-
35
- ### 2. Present candidates
36
- For each candidate:
37
- - **Files** — which files/modules are involved.
38
- - **Problem** — why the current architecture causes friction (use depth/leverage/locality).
39
- - **Solution** — plain-English description of what would change.
40
- - **Benefits** — locality and leverage improvements; how tests get better.
41
- - **Recommendation strength** — `Strong` / `Worth exploring` / `Speculative`.
42
-
43
- **Deletion test**: for any suspected-shallow module, imagine deleting it — does complexity vanish (it's just a pass-through) or reappear across N call sites (it's actually earning its keep)? "Reappears" is the signal you want.
44
-
45
- **ADR conflicts**: if a candidate contradicts an existing `design.md` decision, surface it only when the friction is real enough to warrant reopening, and mark it in the candidate.
46
-
47
- ### 3. Deep-dive Q&A (after the user picks a candidate)
48
- Run `llman-sdd-explore`'s **deep-dive Q&A branch** (trigger "deep-dig") to walk the decision tree — constraints, dependencies, the deepened module's shape, what sits behind the seam, which tests survive.
49
-
50
- - The deepened module uses a concept not in the `.feature`? → update the `.feature` **only** if the change is branch-bound and you are on the bound branch; otherwise STOP and route to `llman-sdd-propose` / `change start` — **never** edit specs on the default branch.
51
- - User rejects the candidate with a load-bearing reason? → offer an ADR only when "hard to reverse + surprising without context + real trade-off" all hold; record in `design.md`.
52
-
53
- ## Output
54
- Candidate list (text; optional HTML report written to the OS temp dir, not the repo) + the deep-dive decision record after the user picks one (write back to the proposal; contract edits only after landing on the bound branch into the `.feature`).
55
-
56
- {{ unit("skills/cli-footer") }}
57
-
58
- {{ unit("skills/structured-protocol") }}
@@ -1,70 +0,0 @@
1
- ---
2
- name: "llman-sdd-archive"
3
- description: "Archive a completed change: merge back (squash default), rename docs into archive/, auto-commit the close-out. Run after verify is green."
4
- metadata:
5
- version: "{{ llman_version }}"
6
- ---
7
-
8
- # LLMAN SDD Archive
9
-
10
- Archive completed changes. Prerequisites: verify all-green, and the change is branch-bound with specs landed (or `needs_specs_change: false`). `change finalize` **auto-merges** into the base branch (target: `--into` > binding `base_branch` > default branch; when the target is the bound branch itself the merge is skipped for an in-place close-out with a notice in the output; method: `--method` > config `sdd.merge_method`, squash by default — feature diff + rename collapse into ONE commit on the target), **renames** change docs into `changes/archive/`, then **auto-commits** `archive(sdd): <change-id>` (`--no-commit` skips). `git push` / PR are optional.
11
-
12
- ## Pipeline Position
13
-
14
- ```mermaid
15
- flowchart LR
16
- verify["llman-sdd-verify"] --> archive["★ llman-sdd-archive"]
17
-
18
- style archive fill:#fff3cd,stroke:#ffc107,stroke-width:3px
19
- ```
20
-
21
- > 📍 You are in archive: the last stop of the branch lifecycle. If specs grow too large, run `llman-sdd-specs-compact`.
22
-
23
- ## Hard Constraints
24
-
25
- - **Verify must be all-green first**; **the change must be branch-bound** (`change start` / `attach`) — otherwise STOP.
26
- - Every change must pass `llman-sdd validate <id> --strict` before archiving.
27
- - **Don't ask "should I continue?"**: execute the full batch to completion unless you hit an unresolvable error.
28
- - **Close-out MUST NOT default to PR/push**: the CLI merges locally (squash default) + one close-out commit. Push / PR only when the user or project explicitly requires remote review — **Agent MUST NOT** push or open a PR by default.
29
-
30
- ## Steps
31
-
32
- ### 0) Preflight
33
- - `git status --porcelain`: confirm working-tree changes belong to completed changes; handle unexpected ones first (stash or report).
34
-
35
- ### 1) Confirm targets
36
- - Determine IDs (single or batch, from user input or `llman-sdd list --json`); always announce "Archiving IDs: <id1>, <id2>, ..." and confirm each change is verify all-green.
37
-
38
- ### 2) Archive one by one
39
- - **Human review gate (before each id, including batches)**: run `llman-sdd review` (plain; `--capability` takes a spec id only). Exit code zero → continue; non-zero = CRITICAL → STOP, fix, re-run; MUST NOT archive with CRITICAL findings open.
40
- - Validate first: `llman-sdd validate <id> --strict`; failure → STOP and report, never force-archive.
41
- - Optional preview: `llman-sdd change archive <id> --dry-run`.
42
- - Execute: `llman-sdd change archive <id>`; **stop immediately on first failure** and report the remaining IDs.
43
- - **Branch close-out**:
44
- - Prerequisites: branch bound; still on the bound branch (or on the target branch after the auto merge).
45
- - `change archive` / `change finalize` run the **auto merge** (target `--into` > `base_branch` > default branch; method squash by default or `ff`; when the target is held by another worktree the merge and commit run in place inside it, with `executed in target worktree <path>` in the output; a dirty holding worktree aborts with disposal options and zero writes), **then** rename into `changes/archive/` — the rename is never rolled back on merge failure and degradation is reported explicitly.
46
- - **Default: `change finalize` (one-command close)** — gates → merge → rename → **auto commit** `archive(sdd): <change-id>` (no manual `git commit` needed; locked-rule edits are a report-only WARNING — warn, never block):
47
- ```text
48
- 1. Implement specs + code (working tree may stay dirty; commits on the branch are free)
49
- 2. llman-sdd change finalize <id> # gates + merge (squash default) + rename + auto commit
50
- 3. optional: git commit --amend to adjust the message; git branch -D <feature> # after squash the branch is no longer an ancestor; -d gets refused
51
- ```
52
- `--no-commit` skips the auto commit (CI / pre-commit-hook conflicts): finalize leaves the tree dirty and prints the manual commit command. Idempotent retry: a rerun after a failed auto commit detects the already-archived rename and finishes the commit.
53
- - **Fallback: plain `change archive <id>`** — same auto merge + rename + close-out commit as finalize (no `--no-commit` here); gates: tasks all checked + clean tree + on the bound non-default branch (`--force` skips the gates). Snapshot review: `change diff`.
54
-
55
- ### 3) Full validation
56
- - After all archives: `llman-sdd validate --all --strict`; confirm spec artifacts are consistent.
57
-
58
- ### 4) Commit guidance
59
- - Finalize already auto-committed; with `--no-commit`, commit manually: `git add -A && git commit -m "archive(sdd): <id1>, <id2>"`.
60
- - Optional: `git branch -D <feature>` after the merge. Push / PR only when explicitly required.
61
- - **Breaking contract changes** (removed/renamed frontmatter field, command, tag, or stage value) MUST ship an upgrade path under `migrations/v<from>-v<to>/` (README + one-shot script, shipped in-repo) — verify it exists before closing.
62
- - **Archived `depends_on`**: archive renames the change dir to `archive/YYYY-MM-DD-<id>`; validate treats `depends_on` pointing to archived/frozen ids as INFO (not ERROR), so you do **not** need to update other changes' frontmatter after archive.
63
-
64
- {{ unit("workflow/archive-freeze-guidance") }}
65
-
66
- {{ unit("skills/cli-footer") }}
67
-
68
- {{ unit("skills/validation-hints") }}
69
-
70
- {{ unit("skills/structured-protocol") }}
@@ -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") }}