@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,130 @@
1
+ ---
2
+ id: hidden-git
3
+ type: primary
4
+ depth_role: leaf
5
+ focus: "how Claude leverages the wiki's private git repo for history, blame, diff, and rollback"
6
+ parents:
7
+ - index.md
8
+ covers:
9
+ - "every wiki has a private git repo at <wiki>/.llmwiki/git/ with the full isolation env"
10
+ - "per-phase commits give granular history (snapshot, ingest, draft-frontmatter, ..., commit-finalize)"
11
+ - "tags: op/<id> marks the finalised operation, pre-op/<id> marks the rollback anchor"
12
+ - "skill-llm-wiki log/show/diff/blame/reflog/history all pass through to git safely"
13
+ - "diff --op <id> expands to pre-op/<id>..op/<id> with --find-renames --find-copies"
14
+ - "history <entry-id> walks op-log.yaml plus git log --follow for a single entry"
15
+ - "use these tools to answer 'why was this split?', 'when did this break?', 'what changed in op X?'"
16
+ tags:
17
+ - history
18
+ - git
19
+ activation:
20
+ keyword_matches:
21
+ - history
22
+ - what changed
23
+ - previous state
24
+ - why was this split
25
+ - diff
26
+ - log
27
+ - blame
28
+ - bisect
29
+ - reflog
30
+ - prior op
31
+ - show
32
+ tag_matches:
33
+ - history
34
+ escalation_from:
35
+ - build
36
+ - rebuild
37
+ - fix
38
+ - diff
39
+ source:
40
+ origin: file
41
+ path: hidden-git.md
42
+ hash: "sha256:5e1bfab79abdff4dd883cb5ec5107367061feb426774e8b288069e146750666d"
43
+ ---
44
+
45
+ # The hidden git repo is a first-class tool
46
+
47
+ <!--
48
+ NOTE on the `bisect` activation keyword: the skill does NOT ship a
49
+ `skill-llm-wiki bisect` subcommand. The keyword is retained so that
50
+ a user asking "can I bisect my wiki history?" routes into this leaf,
51
+ where Claude can explain how to use `log` / `diff` / `history` to
52
+ achieve the same result, or (if the user is comfortable) how to
53
+ drive `git bisect` directly against the isolated `<wiki>/.llmwiki/git/`
54
+ repo with the skill's isolation env exported. Removing the keyword
55
+ would route such questions nowhere.
56
+ -->
57
+
58
+ Every skill-managed wiki owns a private git repository at
59
+ `<wiki>/.llmwiki/git/`. It is NOT the user's project git repo — it is
60
+ strictly ours, hosted inside the wiki, reachable only through the
61
+ `scripts/lib/git.mjs` isolation env. Claude should treat it as a
62
+ first-class reasoning tool, not an implementation detail.
63
+
64
+ ## Tag layout
65
+
66
+ Two namespaces, intentionally split to avoid git ref hierarchy
67
+ collisions:
68
+
69
+ - `refs/tags/pre-op/<op-id>` — the snapshot taken immediately before
70
+ the operation started. Rollback anchor. Guaranteed to exist for every
71
+ op the orchestrator ever ran, including interrupted and failed ones.
72
+ - `refs/tags/op/<op-id>` — the final commit of a successful operation.
73
+ Absent when the operation failed mid-flight (use the reflog instead).
74
+ - `op/genesis` — the empty initial tree, created on first `gitInit`.
75
+
76
+ ## The subcommands
77
+
78
+ Every subcommand takes `<wiki>` as its first positional and passes the
79
+ rest through to git under the isolation env.
80
+
81
+ | Subcommand | Default behaviour | Typical use |
82
+ |------------|-------------------|-------------|
83
+ | `log <wiki>` | `git log --oneline --decorate --all` | "Show me the operation history" |
84
+ | `show <wiki> <ref>` | `git show <ref>` | "What did op X look like?" |
85
+ | `diff <wiki>` | `git diff --find-renames --find-copies` | "What changed since the last commit?" |
86
+ | `diff <wiki> --op <id>` | Expands to `pre-op/<id>..op/<id>` | "What did operation X do?" |
87
+ | `blame <wiki> <path>` | `git blame <path>` | "Who introduced this line?" |
88
+ | `reflog <wiki>` | `git reflog` | "What happened during that crashed build?" |
89
+ | `history <wiki> <entry-id>` | op-log + `git log --follow` | "When was this entry last changed, and why?" |
90
+
91
+ ## Example: answering "why was this entry merged?"
92
+
93
+ 1. `history <wiki> entry-a` — see which ops touched it.
94
+ 2. `log <wiki> --follow -- <path/to/entry-a.md>` — see the git commits.
95
+ 3. `show <wiki> <commit>` — read the diff of the specific commit.
96
+ 4. If the decision came from an operator application (Phase 6 lands
97
+ this), `<wiki>/.llmwiki/decisions.yaml` records tier/confidence.
98
+
99
+ ## Example: answering "what did the last rebuild do?"
100
+
101
+ ```
102
+ skill-llm-wiki log <wiki> --oneline | head
103
+ skill-llm-wiki diff <wiki> --op <rebuild-op-id> --stat
104
+ ```
105
+
106
+ The first shows the commit graph; the second shows the file-level
107
+ changes with rename detection.
108
+
109
+ ## Rollback
110
+
111
+ Rollback is a separate subcommand (`skill-llm-wiki rollback <wiki>
112
+ --to <ref>`) that runs `git reset --hard` + `git clean -fd` in the
113
+ private repo. It accepts:
114
+
115
+ - `genesis` — the original empty tree
116
+ - `<op-id>` — the state right after op X finished
117
+ - `pre-<op-id>` — the state right before op X started
118
+ - `HEAD`, `HEAD~N` — direct git refs
119
+
120
+ Validation failure already triggers automatic rollback to
121
+ `pre-op/<failed-op-id>`, so manual rollback is for the "I changed my
122
+ mind" case, not the crash-recovery case.
123
+
124
+ ## What the skill never does
125
+
126
+ - Touch the user's own `.git/`
127
+ - Run any git command outside the isolation env in `scripts/lib/git.mjs`
128
+ - Push, fetch, or otherwise talk to a remote (Phase 7 adds optional
129
+ remote mirroring under explicit user control)
130
+ - Run hooks — `core.hooksPath=/dev/null` disables every hook source
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: history
3
+ type: index
4
+ depth_role: subcategory
5
+ depth: 1
6
+ focus: Hidden private git repo backing history, diff, and remote mirroring.
7
+ parents:
8
+ - "../index.md"
9
+ shared_covers: []
10
+ entries:
11
+ - id: diff
12
+ file: diff.md
13
+ type: primary
14
+ focus: the diff subcommand — git-style file-level changes for any operation
15
+ tags:
16
+ - history
17
+ - diff
18
+ - id: hidden-git
19
+ file: hidden-git.md
20
+ type: primary
21
+ focus: "how Claude leverages the wiki's private git repo for history, blame, diff, and rollback"
22
+ tags:
23
+ - history
24
+ - git
25
+ - id: remote-sync
26
+ file: remote-sync.md
27
+ type: primary
28
+ focus: remote mirroring — sharing the private wiki git history across machines
29
+ tags:
30
+ - remote
31
+ - collaboration
32
+ - sync
33
+ children: []
34
+ ---
35
+ <!-- BEGIN AUTO-GENERATED NAVIGATION -->
36
+
37
+ # History
38
+
39
+ **Focus:** Hidden private git repo backing history, diff, and remote mirroring.
40
+
41
+ ## Children
42
+
43
+ | File | Type | Focus |
44
+ |------|------|-------|
45
+ | [diff.md](diff.md) | 📄 primary | the diff subcommand — git-style file-level changes for any operation |
46
+ | [hidden-git.md](hidden-git.md) | 📄 primary | how Claude leverages the wiki's private git repo for history, blame, diff, and rollback |
47
+ | [remote-sync.md](remote-sync.md) | 📄 primary | remote mirroring — sharing the private wiki git history across machines |
48
+
49
+ <!-- END AUTO-GENERATED NAVIGATION -->
50
+
51
+ <!-- BEGIN AUTHORED ORIENTATION -->
52
+ <!-- END AUTHORED ORIENTATION -->
@@ -0,0 +1,113 @@
1
+ ---
2
+ id: remote-sync
3
+ type: primary
4
+ depth_role: leaf
5
+ focus: remote mirroring — sharing the private wiki git history across machines
6
+ parents:
7
+ - index.md
8
+ covers:
9
+ - "remote add registers a URL in the private repo's config — no fetch, no auth"
10
+ - sync is the only path that exchanges objects with a remote and is always user-invoked
11
+ - "push refspec defaults to refs/tags/op/* and refs/tags/pre-op/* — history mirror only"
12
+ - branch heads are never pushed unless --push-branch is passed explicitly
13
+ - "--skip-fetch and --skip-push narrow the sync to a single direction"
14
+ - "regular operations (build, rebuild, fix, join) never auto-push"
15
+ - the isolation env block applies to remote subprocess calls too
16
+ tags:
17
+ - remote
18
+ - collaboration
19
+ - sync
20
+ activation:
21
+ keyword_matches:
22
+ - remote
23
+ - sync
24
+ - share
25
+ - push history
26
+ - backup
27
+ - mirror
28
+ - across machines
29
+ tag_matches:
30
+ - remote
31
+ - collaboration
32
+ escalation_from:
33
+ - build
34
+ - rebuild
35
+ - diff
36
+ source:
37
+ origin: file
38
+ path: remote-sync.md
39
+ hash: "sha256:521fe2e5863df144746d2397fe1988c6b4769658de066a3e7eee19459abbf88c"
40
+ ---
41
+
42
+ # Remote mirroring
43
+
44
+ Phase 7 adds a narrow remote-sharing capability so the private wiki
45
+ git history can be mirrored across machines. Two subcommands:
46
+
47
+ ```text
48
+ skill-llm-wiki remote <wiki> add <name> <url>
49
+ skill-llm-wiki remote <wiki> remove <name>
50
+ skill-llm-wiki remote <wiki> list
51
+
52
+ skill-llm-wiki sync <wiki> [--remote <name>]
53
+ [--push-branch <ref>]
54
+ [--skip-fetch] [--skip-push]
55
+ ```
56
+
57
+ Both commands run through the same isolation env block as every
58
+ other git operation — the user's `~/.gitconfig`, signing keys,
59
+ hooks, and push templates are NOT consulted. Authentication must
60
+ flow via the URL itself (`https://token@host/...`) or via an
61
+ out-of-band credential helper the user configures explicitly.
62
+
63
+ ## Never auto-push
64
+
65
+ The skill never pushes to a remote on its own. `remote add` only
66
+ records the URL in the private repo's config — nothing is fetched,
67
+ pushed, or authenticated at registration time. `sync` is the ONLY
68
+ path that exchanges objects with a remote, and it is always a
69
+ user-invoked action. Regular operations (`build`, `rebuild`,
70
+ `fix`, `join`) never trigger a sync.
71
+
72
+ ## Default push is a history mirror
73
+
74
+ `sync` pushes the refspecs `refs/tags/op/*` and `refs/tags/pre-op/*`
75
+ by default. A shared remote becomes a **read-only history mirror**
76
+ — every op's pre- and final tags are visible for post-mortem
77
+ inspection, but there's no competing `main` branch head that a
78
+ second user could push to and diverge.
79
+
80
+ If the user genuinely wants a branch pushed (e.g., to share the
81
+ working tree between machines), they pass `--push-branch <name>`
82
+ and the sync adds `refs/heads/<name>` to the refspec list. This is
83
+ an explicit opt-in; the skill never advertises it as normal usage.
84
+
85
+ ## Common sessions
86
+
87
+ ```text
88
+ # First time: register the remote, then push.
89
+ skill-llm-wiki remote ./docs.wiki add origin /srv/wikis/docs.git
90
+ skill-llm-wiki sync ./docs.wiki
91
+
92
+ # Later: pull history from a teammate's push.
93
+ skill-llm-wiki sync ./docs.wiki --skip-push
94
+
95
+ # Fetch-only variant that never modifies the remote.
96
+ skill-llm-wiki sync ./docs.wiki --remote teammate --skip-push
97
+ ```
98
+
99
+ ## What this does NOT do
100
+
101
+ - Discover remotes automatically. Every remote is registered
102
+ explicitly via `remote add`.
103
+ - Prompt for credentials. `GIT_TERMINAL_PROMPT=0` is set at the
104
+ base-isolation layer; any remote that needs credentials must
105
+ supply them via URL or an existing git credential helper.
106
+ - Merge divergent histories. `sync` uses tag-only refspecs by
107
+ default; a tag that already exists on the remote with a
108
+ different sha is a push rejection, not a silent overwrite. The
109
+ user fixes it manually.
110
+ - Rewrite history. Force-push is not exposed via the CLI. A user
111
+ who needs it invokes `git push --force` directly with the
112
+ explicit `GIT_DIR`/`GIT_WORK_TREE` env vars.
113
+ - Auto-sync on a schedule. Every sync is a conscious action.
package/guide/index.md ADDED
@@ -0,0 +1,134 @@
1
+ ---
2
+ id: guide
3
+ type: index
4
+ depth_role: category
5
+ depth: 0
6
+ focus: skill-llm-wiki operational reference routed by activation signals
7
+ parents: []
8
+ shared_covers:
9
+ - "every operation must run the Node.js preflight before invoking scripts/cli.mjs"
10
+ - every operation is explicit-invocation only and has no automatic triggers
11
+ - "every operation runs a phase pipeline under the private git at <wiki>/.llmwiki/git/ with per-phase commits and an atomic op/<id> tag at commit-finalize"
12
+ - "sibling (default) and hosted modes keep the source immutable; in-place mode anchors reversibility on the pre-op/<id> snapshot"
13
+ orientation: |
14
+ This is a real LLM wiki. Claude routes into it semantically: read each
15
+ entry's one-line `focus` in `entries[]` below and decide whether the
16
+ branch is relevant to the current task. No AND-filter and no activation
17
+ aggregation at this level — parent indices carry only id, file, type,
18
+ focus, and tags per entry. Descend into relevant branches, stopping at
19
+ the narrowest leaf whose focus covers the task. Per-leaf `activation`
20
+ blocks (when present in a loaded leaf) are advisory disambiguation
21
+ hints, not routing gates. Informational queries with no operation
22
+ keyword usually activate nothing here and are answered from SKILL.md
23
+ alone. Note: `bisect` is retained as a hint keyword on the leaf that
24
+ handles git-history questions, even though there is no
25
+ `skill-llm-wiki bisect` subcommand — a user asking "can I bisect the
26
+ wiki history?" should still route there so Claude can explain the
27
+ `log`/`diff`/`history` path (or drive `git bisect` directly against
28
+ the private repo).
29
+
30
+ generator: "skill-llm-wiki/v1"
31
+ rebuild_needed: false
32
+ rebuild_reasons: []
33
+ rebuild_command: "skill-llm-wiki rebuild <wiki> --plan"
34
+ entries:
35
+ - id: cli
36
+ file: cli.md
37
+ type: primary
38
+ focus: "complete CLI subcommand reference for scripts/cli.mjs"
39
+ tags:
40
+ - cli
41
+ - commands
42
+ - reference
43
+ - id: basics
44
+ file: "basics/index.md"
45
+ type: index
46
+ focus: "Core vocabulary, structure rules, and frontmatter/index schema fundamentals."
47
+ - id: correctness
48
+ file: "correctness/index.md"
49
+ type: index
50
+ focus: Hard invariants, validation, and the safety envelope around every mutation.
51
+ - id: history
52
+ file: "history/index.md"
53
+ type: index
54
+ focus: Hidden private git repo backing history, diff, and remote mirroring.
55
+ - id: isolation
56
+ file: "isolation/index.md"
57
+ type: index
58
+ focus: "Coexistence with the user's own git repo and bounded-memory scaling for large corpora."
59
+ - id: layout
60
+ file: "layout/index.md"
61
+ type: index
62
+ focus: Layout modes, hosted-mode contract, and in-place conversion of source folders.
63
+ - id: operations
64
+ file: "operations/index.md"
65
+ type: index
66
+ focus: per-operation phase pipelines for Build, Extend, Validate, Rebuild, Fix, and Join
67
+ - id: substrate
68
+ file: "substrate/index.md"
69
+ type: index
70
+ focus: Decision machinery — rewrite operators and the tiered AI ladder driving them.
71
+ tags:
72
+ - operators
73
+ - id: ux
74
+ file: "ux/index.md"
75
+ type: index
76
+ focus: User-facing intent resolution and preflight failure messaging.
77
+ children:
78
+ - "basics/index.md"
79
+ - "correctness/index.md"
80
+ - "history/index.md"
81
+ - "isolation/index.md"
82
+ - "layout/index.md"
83
+ - "operations/index.md"
84
+ - "substrate/index.md"
85
+ - "ux/index.md"
86
+ ---
87
+ <!-- BEGIN AUTO-GENERATED NAVIGATION -->
88
+
89
+ # Guide.wiki
90
+
91
+ **Focus:** skill-llm-wiki operational reference routed by activation signals
92
+
93
+ **Shared across all children:**
94
+
95
+ - every operation must run the Node.js preflight before invoking scripts/cli.mjs
96
+ - every operation is explicit-invocation only and has no automatic triggers
97
+ - every operation runs a phase pipeline under the private git at <wiki>/.llmwiki/git/ with per-phase commits and an atomic op/<id> tag at commit-finalize
98
+ - sibling (default) and hosted modes keep the source immutable; in-place mode anchors reversibility on the pre-op/<id> snapshot
99
+
100
+ ## Children
101
+
102
+ | File | Type | Focus |
103
+ |------|------|-------|
104
+ | [cli.md](cli.md) | 📄 primary | complete CLI subcommand reference for scripts/cli.mjs |
105
+ | [basics/index.md](basics/index.md) | 📁 index | Core vocabulary, structure rules, and frontmatter/index schema fundamentals. |
106
+ | [correctness/index.md](correctness/index.md) | 📁 index | Hard invariants, validation, and the safety envelope around every mutation. |
107
+ | [history/index.md](history/index.md) | 📁 index | Hidden private git repo backing history, diff, and remote mirroring. |
108
+ | [isolation/index.md](isolation/index.md) | 📁 index | Coexistence with the user's own git repo and bounded-memory scaling for large corpora. |
109
+ | [layout/index.md](layout/index.md) | 📁 index | Layout modes, hosted-mode contract, and in-place conversion of source folders. |
110
+ | [operations/index.md](operations/index.md) | 📁 index | per-operation phase pipelines for Build, Extend, Validate, Rebuild, Fix, and Join |
111
+ | [substrate/index.md](substrate/index.md) | 📁 index | Decision machinery — rewrite operators and the tiered AI ladder driving them. |
112
+ | [ux/index.md](ux/index.md) | 📁 index | User-facing intent resolution and preflight failure messaging. |
113
+
114
+ <!-- END AUTO-GENERATED NAVIGATION -->
115
+
116
+ <!-- BEGIN AUTHORED ORIENTATION -->
117
+ This wiki holds the skill-llm-wiki operational reference. It is not meant to
118
+ be read top-to-bottom. It is loaded slice-by-slice by SKILL.md's routing
119
+ table at the skill root — each top-level operation lists the exact set of
120
+ leaves to read for that operation. Do not browse this wiki outside the
121
+ routing discipline; Claude should only open leaves its current operation
122
+ explicitly names.
123
+
124
+ **Note on `bisect` as a routing keyword.** `guide/hidden-git.md` lists
125
+ `bisect` in its `activation.keyword_matches` block even though the skill
126
+ does **not** ship a `skill-llm-wiki bisect` subcommand. The keyword is
127
+ retained deliberately so that a user asking "can I bisect my wiki
128
+ history?" routes into `hidden-git.md`, where Claude can explain how to
129
+ use `log` / `diff` / `history` to achieve the same result (or, for
130
+ advanced users, how to drive `git bisect` directly against
131
+ `<wiki>/.llmwiki/git/` with the skill's isolation env). Removing the
132
+ keyword would route such questions nowhere. See the inline note at the
133
+ top of `hidden-git.md`'s body.
134
+ <!-- END AUTHORED ORIENTATION -->
@@ -0,0 +1,134 @@
1
+ ---
2
+ id: coexistence
3
+ type: primary
4
+ depth_role: leaf
5
+ focus: "coexistence with the user's own git repository — private git stays isolated"
6
+ parents:
7
+ - index.md
8
+ covers:
9
+ - "the skill spawns git only from scripts/lib/git.mjs with a fixed isolation env"
10
+ - "wiki-local .gitignore hides .llmwiki/ .work/ .shape/history/*/work/ from ancestor user git"
11
+ - "operations inside a hostile user repo (hooks, signing, custom hooksPath) are unaffected"
12
+ - "user can still commit wiki content (index.md, leaves, prose) into their own project"
13
+ - "tests/e2e/git-isolation.test.mjs is the load-bearing proof"
14
+ - "user's .git HEAD, reflog, and on-disk metadata must be byte-identical after every operation"
15
+ tags:
16
+ - coexistence
17
+ - isolation
18
+ - user-repo
19
+ activation:
20
+ keyword_matches:
21
+ - my repo
22
+ - user repo
23
+ - gitignore
24
+ - project git
25
+ - already in git
26
+ - my git
27
+ - inside a git repository
28
+ tag_matches:
29
+ - coexistence
30
+ - layout
31
+ escalation_from:
32
+ - build
33
+ - extend
34
+ - rebuild
35
+ - fix
36
+ source:
37
+ origin: file
38
+ path: coexistence.md
39
+ hash: "sha256:a74c6ee019b1c66c446d58c9b93060250db683c01c19eeca9d3254ad447e586e"
40
+ ---
41
+
42
+ # Coexistence with the user's git repository
43
+
44
+ Users will run this skill against folders that already live inside their own
45
+ git repositories. The skill's private git repo at `<wiki>/.llmwiki/git/` must
46
+ never leak into the user's repo, and the user's repo must never leak into
47
+ ours. Both are invariants enforced at the single `scripts/lib/git.mjs` choke
48
+ point.
49
+
50
+ ## The isolation env
51
+
52
+ Every git subprocess spawns with a fixed environment block that overrides
53
+ every possible leak surface:
54
+
55
+ ```text
56
+ GIT_DIR = <wiki>/.llmwiki/git
57
+ GIT_WORK_TREE = <wiki>
58
+ GIT_CONFIG_NOSYSTEM = 1 (ignore /etc/gitconfig)
59
+ GIT_CONFIG_GLOBAL = /dev/null (or NUL on Windows)
60
+ HOME = os.tmpdir() (ignore ~/.gitconfig hooks/keys)
61
+ GIT_TERMINAL_PROMPT = 0 (never prompt for creds)
62
+ GIT_OPTIONAL_LOCKS = 0 (don't race background index)
63
+ GIT_AUTHOR_NAME = skill-llm-wiki
64
+ GIT_AUTHOR_EMAIL = noreply@skill-llm-wiki.invalid
65
+ GIT_COMMITTER_NAME = skill-llm-wiki
66
+ GIT_COMMITTER_EMAIL = noreply@skill-llm-wiki.invalid
67
+ ```
68
+
69
+ Plus these per-invocation `-c` flags on every command:
70
+
71
+ ```text
72
+ commit.gpgsign=false
73
+ tag.gpgsign=false
74
+ core.hooksPath=/dev/null
75
+ core.autocrlf=false
76
+ core.fileMode=false
77
+ core.longpaths=true
78
+ ```
79
+
80
+ These values are set per-subprocess only; `process.env` is never mutated, and
81
+ nothing about the user's shell changes.
82
+
83
+ ## The wiki-local `.gitignore`
84
+
85
+ On the first operation against any wiki, the skill writes `<wiki>/.gitignore`
86
+ containing:
87
+
88
+ ```gitignore
89
+ # skill-llm-wiki internal metadata — safe to gitignore in your own project
90
+ .llmwiki/
91
+ .work/
92
+ .shape/history/*/work/
93
+ ```
94
+
95
+ This file is itself a normal wiki file — the user can commit it to their own
96
+ git repository. Its purpose is to make any ancestor git repo treat the
97
+ private metadata as ignored without requiring the user to edit their own
98
+ `.gitignore`. `ensureWikiGitignore` is idempotent and will only append
99
+ missing entries to a pre-existing `.gitignore`, never duplicate.
100
+
101
+ ## What the user can commit to their own repo
102
+
103
+ - Every plain text file the wiki produces (`index.md`, leaves, prose,
104
+ `.gitignore`). These are normal source files.
105
+ - Not: `.llmwiki/`, `.work/`, `.shape/history/*/work/`. The wiki-local
106
+ `.gitignore` hides them by default.
107
+
108
+ ## Hostile user config does not break us
109
+
110
+ The isolation env block neutralises every form of user-side customisation
111
+ we might trip over:
112
+
113
+ - Pre-commit hooks under `.git/hooks/` or a custom `core.hooksPath` — disabled
114
+ by `core.hooksPath=/dev/null`.
115
+ - Required signing (`commit.gpgsign`, `tag.gpgsign`, `user.signingkey`) —
116
+ disabled by our own `-c` flags.
117
+ - Hostile `~/.gitconfig` — ignored by `GIT_CONFIG_GLOBAL=/dev/null` plus
118
+ `HOME=tmpdir()`.
119
+ - `/etc/gitconfig` — ignored by `GIT_CONFIG_NOSYSTEM=1`.
120
+
121
+ The load-bearing proof is `tests/e2e/git-isolation.test.mjs`. It runs the
122
+ skill inside three synthetic user repos (plain, hostile-hook + required
123
+ signing, hostile-`HOME`) and asserts after every operation:
124
+
125
+ - `.git/` is byte-identical
126
+ - `git rev-parse HEAD` is unchanged
127
+ - `git reflog` is unchanged
128
+ - Any sentinel file the hostile hook would write does not exist
129
+
130
+ ## Asking before writing inside a user repo
131
+
132
+ When the user invokes `build` on a folder that is inside their own git repo
133
+ and has uncommitted changes, the skill refuses (**INT-08**) and asks whether
134
+ to `--accept-dirty`, commit/stash first, or abort. Never guess.
@@ -0,0 +1,44 @@
1
+ ---
2
+ id: isolation
3
+ type: index
4
+ depth_role: subcategory
5
+ depth: 1
6
+ focus: "Coexistence with the user's own git repo and bounded-memory scaling for large corpora."
7
+ parents:
8
+ - "../index.md"
9
+ shared_covers: []
10
+ entries:
11
+ - id: coexistence
12
+ file: coexistence.md
13
+ type: primary
14
+ focus: "coexistence with the user's own git repository — private git stays isolated"
15
+ tags:
16
+ - coexistence
17
+ - isolation
18
+ - user-repo
19
+ - id: scale
20
+ file: scale.md
21
+ type: primary
22
+ focus: chunked iteration, bounded memory, context-window hygiene, and how the skill handles multi-megabyte corpora
23
+ tags:
24
+ - scale
25
+ - performance
26
+ children: []
27
+ ---
28
+ <!-- BEGIN AUTO-GENERATED NAVIGATION -->
29
+
30
+ # Isolation
31
+
32
+ **Focus:** Coexistence with the user's own git repo and bounded-memory scaling for large corpora.
33
+
34
+ ## Children
35
+
36
+ | File | Type | Focus |
37
+ |------|------|-------|
38
+ | [coexistence.md](coexistence.md) | 📄 primary | coexistence with the user's own git repository — private git stays isolated |
39
+ | [scale.md](scale.md) | 📄 primary | chunked iteration, bounded memory, context-window hygiene, and how the skill handles multi-megabyte corpora |
40
+
41
+ <!-- END AUTO-GENERATED NAVIGATION -->
42
+
43
+ <!-- BEGIN AUTHORED ORIENTATION -->
44
+ <!-- END AUTHORED ORIENTATION -->