@ctxr/skill-llm-wiki 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/LICENSE +21 -0
  3. package/README.md +484 -0
  4. package/SKILL.md +252 -0
  5. package/guide/basics/concepts.md +74 -0
  6. package/guide/basics/index.md +45 -0
  7. package/guide/basics/schema.md +140 -0
  8. package/guide/cli.md +256 -0
  9. package/guide/correctness/index.md +45 -0
  10. package/guide/correctness/invariants.md +89 -0
  11. package/guide/correctness/safety.md +96 -0
  12. package/guide/history/diff.md +110 -0
  13. package/guide/history/hidden-git.md +130 -0
  14. package/guide/history/index.md +52 -0
  15. package/guide/history/remote-sync.md +113 -0
  16. package/guide/index.md +134 -0
  17. package/guide/isolation/coexistence.md +134 -0
  18. package/guide/isolation/index.md +44 -0
  19. package/guide/isolation/scale.md +251 -0
  20. package/guide/layout/in-place-mode.md +97 -0
  21. package/guide/layout/index.md +53 -0
  22. package/guide/layout/layout-contract.md +131 -0
  23. package/guide/layout/layout-modes.md +115 -0
  24. package/guide/operations/index.md +76 -0
  25. package/guide/operations/ingest/build.md +75 -0
  26. package/guide/operations/ingest/extend.md +61 -0
  27. package/guide/operations/ingest/index.md +54 -0
  28. package/guide/operations/ingest/join.md +65 -0
  29. package/guide/operations/maintain/fix.md +66 -0
  30. package/guide/operations/maintain/index.md +47 -0
  31. package/guide/operations/maintain/rebuild.md +86 -0
  32. package/guide/operations/validate.md +48 -0
  33. package/guide/substrate/index.md +47 -0
  34. package/guide/substrate/operators.md +96 -0
  35. package/guide/substrate/tiered-ai.md +363 -0
  36. package/guide/ux/index.md +44 -0
  37. package/guide/ux/preflight.md +150 -0
  38. package/guide/ux/user-intent.md +135 -0
  39. package/package.json +55 -0
  40. package/scripts/cli.mjs +893 -0
  41. package/scripts/commands/remote.mjs +93 -0
  42. package/scripts/commands/review.mjs +253 -0
  43. package/scripts/commands/sync.mjs +84 -0
  44. package/scripts/lib/chunk.mjs +421 -0
  45. package/scripts/lib/cluster-detect.mjs +516 -0
  46. package/scripts/lib/decision-log.mjs +343 -0
  47. package/scripts/lib/draft.mjs +158 -0
  48. package/scripts/lib/embeddings.mjs +366 -0
  49. package/scripts/lib/frontmatter.mjs +497 -0
  50. package/scripts/lib/git-commands.mjs +155 -0
  51. package/scripts/lib/git.mjs +486 -0
  52. package/scripts/lib/gitignore.mjs +62 -0
  53. package/scripts/lib/history.mjs +331 -0
  54. package/scripts/lib/indices.mjs +510 -0
  55. package/scripts/lib/ingest.mjs +258 -0
  56. package/scripts/lib/intent.mjs +713 -0
  57. package/scripts/lib/interactive.mjs +99 -0
  58. package/scripts/lib/migrate.mjs +126 -0
  59. package/scripts/lib/nest-applier.mjs +260 -0
  60. package/scripts/lib/operators.mjs +1365 -0
  61. package/scripts/lib/orchestrator.mjs +718 -0
  62. package/scripts/lib/paths.mjs +197 -0
  63. package/scripts/lib/preflight.mjs +213 -0
  64. package/scripts/lib/provenance.mjs +672 -0
  65. package/scripts/lib/quality-metric.mjs +269 -0
  66. package/scripts/lib/query-fixture.mjs +71 -0
  67. package/scripts/lib/rollback.mjs +95 -0
  68. package/scripts/lib/shape-check.mjs +172 -0
  69. package/scripts/lib/similarity-cache.mjs +126 -0
  70. package/scripts/lib/similarity.mjs +230 -0
  71. package/scripts/lib/snapshot.mjs +54 -0
  72. package/scripts/lib/source-frontmatter.mjs +85 -0
  73. package/scripts/lib/tier2-protocol.mjs +470 -0
  74. package/scripts/lib/tiered.mjs +453 -0
  75. package/scripts/lib/validate.mjs +362 -0
@@ -0,0 +1,135 @@
1
+ ---
2
+ id: user-intent
3
+ type: primary
4
+ depth_role: leaf
5
+ focus: "ask, don't guess — how to resolve ambiguous user requests before running the skill"
6
+ parents:
7
+ - index.md
8
+ covers:
9
+ - the CLI refuses every ambiguous invocation with a structured INT-NN code
10
+ - Claude MUST ask the user before running the skill when intent is unclear
11
+ - ambiguity scenarios each have a fixed resolving flag the user can pick
12
+ - "--json-errors makes the ambiguity body machine-parseable for Claude to read"
13
+ - "--no-prompt / LLM_WIKI_NO_PROMPT=1 disables interactive fallback; failures become hard errors"
14
+ - never silently default — the cost of a wrong guess is always higher than a clarifying question
15
+ tags:
16
+ - ux
17
+ - intent
18
+ - prompting
19
+ activation:
20
+ keyword_matches:
21
+ - unclear
22
+ - ambiguous
23
+ - convert
24
+ - migrate
25
+ - update
26
+ - fix my wiki
27
+ - what should I do
28
+ tag_matches:
29
+ - ux
30
+ escalation_from:
31
+ - build
32
+ - extend
33
+ - rebuild
34
+ - fix
35
+ - join
36
+ - rollback
37
+ source:
38
+ origin: file
39
+ path: user-intent.md
40
+ hash: "sha256:3face4263518177ffaf27c0faf82bfa02651743bd62bd0a42a61c10c6fa23656"
41
+ ---
42
+
43
+ # Ask, don't guess
44
+
45
+ The single most important UX rule of this skill: when the user's request is
46
+ ambiguous, **ask them before running the skill**. Never silently pick a
47
+ default. Never interpret "convert" or "update" or "fix" without confirmation.
48
+ The cost of a wrong guess (a rewritten folder, a destroyed history, a commit
49
+ in the wrong place) is always higher than a one-sentence clarifying question.
50
+
51
+ ## Two enforcement layers
52
+
53
+ 1. **The CLI refuses ambiguous invocations.** `scripts/lib/intent.mjs`
54
+ walks every CLI call and, if any of the Part 6 scenarios apply, exits
55
+ with code 2 and a structured error. Each error carries a stable
56
+ `INT-NN` code, a human message, a list of numbered options, and the
57
+ disambiguating flag that would resolve the ambiguity.
58
+
59
+ 2. **Claude asks the user.** When Claude receives an ambiguous request
60
+ — "convert my docs", "fix that thing", "update the wiki" — Claude
61
+ **stops and asks** before running the skill. Claude does not guess
62
+ intent based on prior context, does not pick a default, and does not
63
+ proceed with "I'll assume you meant X" framing.
64
+
65
+ ## The ambiguity table
66
+
67
+ | Code | Trigger | Resolving flag |
68
+ |------|---------|----------------|
69
+ | INT-01 | Default sibling target exists as a foreign directory | `--target <other>` or `--layout-mode in-place` |
70
+ | INT-01b | Explicit `--target` points at a non-empty foreign directory | `--target <other>` or `--accept-foreign-target` |
71
+ | INT-02 | Source is already a managed wiki (implicit in-place) | pick `extend`/`rebuild`/`fix`, or `build --layout-mode in-place` |
72
+ | INT-03 | Default sibling target is already a managed wiki | pick `extend`/`rebuild`/`fix` |
73
+ | INT-04 | Source is a legacy `<name>.llmwiki.v<N>` folder | `skill-llm-wiki migrate <legacy>` |
74
+ | INT-05 | `rollback` without `--to` | `--to pre-<op-id>` / `<op-id>` / `genesis` |
75
+ | INT-06 | Missing positional, or positional is a file | provide a directory path |
76
+ | INT-07 | Multi-source build/extend without ordering | `--canonical <path>` |
77
+ | INT-08 | Source inside a dirty user git repo | commit/stash first, or `--accept-dirty` |
78
+ | INT-09a | `--layout-mode in-place` combined with `--target` | drop one of the two flags |
79
+ | INT-09b | `--layout-mode hosted` invoked without `--target` | add `--target <path>` |
80
+ | INT-10 | Unknown `--layout-mode` value | use `sibling` / `in-place` / `hosted` |
81
+ | INT-11 | Unknown flag / malformed flag value | correct the flag |
82
+ | INT-12 | Prompt required in non-interactive mode | supply the flag the prompt was asking for, or re-run in a TTY |
83
+ | INT-13 | Unknown `--quality-mode` value | use `tiered-fast` / `claude-first` / `tier0-only` |
84
+
85
+ ## `--json-errors` for programmatic consumption
86
+
87
+ When the skill is called from a script or from another Claude session, pass
88
+ `--json-errors` on every invocation. The ambiguity body becomes a single JSON
89
+ object on stderr:
90
+
91
+ ```json
92
+ {
93
+ "error": {
94
+ "code": "INT-03",
95
+ "message": "./docs.wiki is already a managed wiki; choose an operation",
96
+ "options": [
97
+ { "description": "add new entries from the source", "flag": "extend ./docs" },
98
+ { "description": "optimise structure in place", "flag": "rebuild ./docs" },
99
+ { "description": "repair methodology divergences", "flag": "fix ./docs" }
100
+ ],
101
+ "resolving_flag": "pick extend / rebuild / fix"
102
+ }
103
+ }
104
+ ```
105
+
106
+ Parse the JSON, surface the question to the user, then re-invoke with the
107
+ disambiguating flag the user selected.
108
+
109
+ ## Non-interactive mode
110
+
111
+ Set `LLM_WIKI_NO_PROMPT=1` (or pass `--no-prompt`) in CI, hooks, and any
112
+ pipeline where stdin is not a TTY. In non-interactive mode, every prompt
113
+ helper throws `NonInteractiveError` that the caller is expected to surface as
114
+ a hard CLI error. There is no "I'll pick a default because nobody is
115
+ listening" code path anywhere in the skill.
116
+
117
+ ## Claude's phrasing template
118
+
119
+ When the user's request is ambiguous, reply with a short, numbered
120
+ disambiguation question. Example:
121
+
122
+ > You said "convert my docs folder to a wiki". I can do this two ways:
123
+ >
124
+ > 1. **Sibling (default, reversible)** — create `./docs.wiki/` next to
125
+ > `./docs`. Your original folder stays untouched. Run:
126
+ > `skill-llm-wiki build ./docs`
127
+ >
128
+ > 2. **In-place (reversible via git rollback)** — transform `./docs`
129
+ > itself. Private git tracks the before-state so rollback is exact.
130
+ > Run: `skill-llm-wiki build ./docs --layout-mode in-place`
131
+ >
132
+ > Which do you prefer?
133
+
134
+ Then wait for the user to pick. Do not run the skill until the intent is
135
+ explicit.
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@ctxr/skill-llm-wiki",
3
+ "version": "1.0.1",
4
+ "description": "Claude Code skill — build, extend, validate, rebuild, fix, and join LLM wikis from any knowledge corpus. Token-efficient retrieval via hierarchical indices, DAG parents, and deterministic rewrite operators.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ctxr-dev/skill-llm-wiki.git"
10
+ },
11
+ "homepage": "https://github.com/ctxr-dev/skill-llm-wiki#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/ctxr-dev/skill-llm-wiki/issues"
14
+ },
15
+ "engines": {
16
+ "node": ">=18.0.0"
17
+ },
18
+ "keywords": [
19
+ "claude-code",
20
+ "skill",
21
+ "llm-wiki",
22
+ "knowledge-base",
23
+ "documentation",
24
+ "retrieval",
25
+ "ctxr",
26
+ "ai"
27
+ ],
28
+ "files": [
29
+ "SKILL.md",
30
+ "README.md",
31
+ "LICENSE",
32
+ "CHANGELOG.md",
33
+ "scripts/",
34
+ "guide/"
35
+ ],
36
+ "ctxr": {
37
+ "type": "skill",
38
+ "target": "folder"
39
+ },
40
+ "scripts": {
41
+ "test": "node --test",
42
+ "validate": "node scripts/cli.mjs --version",
43
+ "lint": "markdownlint-cli2 '**/*.md' '#node_modules'",
44
+ "lint:fix": "markdownlint-cli2 --fix '**/*.md' '#node_modules'",
45
+ "prepare": "husky || true"
46
+ },
47
+ "devDependencies": {
48
+ "husky": "^9.1.0",
49
+ "markdownlint-cli2": "^0.14.0"
50
+ },
51
+ "dependencies": {
52
+ "@xenova/transformers": "2.17.2",
53
+ "gray-matter": "^4.0.3"
54
+ }
55
+ }