chore(memory): LRN-086 — external-tool skill provenance + gitignore/regen rule
ctx7 setup --claude --cli materializes find-docs (skill, symlinked into repo) + rules/context7.md (global, user-editable). login != setup. Rule: prove provenance by mtime not repo grep; gitignore tool-generated skill + regen via install-step; guard regen on absence when tool co-writes editable config. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C8bmCXTHNccS7KRV4gWXEF
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
41ee5c54bf
commit
f5961cb8d6
@@ -105,6 +105,7 @@ rules:
|
||||
| LRN-083 | 2026-06-30 | subagents are an INVALID instrument for measuring main-loop spontaneous routing — SUBAGENT-STOP + delegated framing pin them to the no-route floor | any RED of whether the MAIN loop self-invokes; use fresh main-loop sessions, observe via the human |
|
||||
| LRN-084 | 2026-07-01 | protection hook enforces PROD not the full branch-flow; exemption masked the rule-vs-guard divergence | a guard exempts a class / checks one predicate — verify it encodes full intent |
|
||||
| LRN-085 | 2026-07-01 | Idempotent CLI install/update: `command -v` skip-if-present guard + detect channel (`npm ls -g` vs native symlink) before choosing updater; never `npm --force` over a bin npm doesn't own | any installer/updater for a CLI with >1 install channel |
|
||||
| LRN-086 | 2026-07-02 | External-tool-generated skill: prove provenance by mtime (not repo grep), gitignore + regen via install-step; guard regen on ABSENCE when the tool co-writes a user-editable config | any untracked skill/dir a tool (ctx7, etc.) drops into the repo |
|
||||
|
||||
---
|
||||
|
||||
@@ -926,3 +927,13 @@ rules:
|
||||
- **Pattern**: (a) idempotent install step = `command -v <bin>` guard → skip-if-present with version echo, install only in `else`/`elif`. For a BINARY this IS a deterministic oracle (contrast [[LRN-054]]: conversation-state presence has none → don't skip-branch). (b) a CLI can ship via >1 channel (npm vs native). npm can't clobber a bin symlink it doesn't own → EEXIST; `npm --force` = wrong (npm itself says "recklessly", breaks native self-update). Detect channel first: `npm ls -g <pkg>` succeeds → npm-managed → npm; else native → `claude update` self-updater. (c) install ≠ update: first-time installer skips-if-present; the update script does the channel-aware upgrade.
|
||||
- **Future application**: any installer/updater for a CLI reachable via multiple channels — guard with `command -v`, branch the updater on detected channel, never blind `--force` over a foreign-owned bin. Caveat [[LRN-036]]: `command -v` needs the bin dir on PATH in shelled-out/hook contexts.
|
||||
- **Reference**: [[BLK-014]], mirrors RTK/GSD guard in install-plugins.sh. Related [[LRN-005]] (plugin enable idempotency), [[LRN-039]] (installer config drift).
|
||||
|
||||
---
|
||||
|
||||
## LRN-086 — External-tool-generated skill: prove provenance by mtime, gitignore + regen-on-absence (not unconditional) when the tool co-writes a user-editable config
|
||||
|
||||
- **Date**: 2026-07-02
|
||||
- **Context**: `skills/find-docs/` showed untracked. `grep -rniE 'find-docs' --include='*.sh'` → 0 hits → wrongly read "hand-authored first-party skill, commit it". FALSE. Generator = external binary `ctx7 setup --claude --cli` (CLI+Skills mode), not any repo script. Oracle that flipped it: mtime `skills/find-docs/SKILL.md` (23:16:59.637) == ctx7 `~/.config/context7/credentials.json` write, same setup run → ctx7 co-created it. User held the correct premise; my repo-only grep was too narrow.
|
||||
- **Pattern**: (a) provenance of an untracked artifact — a repo-script grep is BLIND to external-binary generators. Correlate its mtime with the tool's OWN files (creds/config) + read the tool's subcommands (`ctx7 setup --claude/--cli/--mcp`, `remove`) before deciding hand-authored vs tool-owned. (b) `ctx7 setup --claude --cli` writes TWO files 0.13s apart: `~/.claude/skills/find-docs/SKILL.md` (`~/.claude/skills` = symlink to repo `skills/` → lands IN repo) AND `~/.claude/rules/context7.md` (global config, real dir, NOT in repo, user-editable). (c) login ≠ setup: `ctx7 login` = auth/rate-limits only (help = only `--no-browser`), does NOT trigger setup. Orthogonal.
|
||||
- **Rule**: tool-generated skill → gitignore it (like `skills-external/frontend-design/`) + regenerate via an install step, do NOT vendor. gitignore coherence: ignoring an artifact REQUIRES an install-step that regenerates it, else a fresh clone loses it. BUT when the same `setup` ALSO (re)writes a user-editable config, guard regen on ABSENCE (`[ ! -f .../find-docs/SKILL.md ]`) — an every-run `setup` would silently clobber that config once customized. Contrast frontend-design: unconditional re-sync is fine (its file is not user-editable).
|
||||
- **Future application**: before gitignore-vs-commit on any untracked skill/dir, PROVE provenance (mtime + tool subcommands), never trust a repo grep alone. Tool-owned → gitignore + install-step regen; gate the regen on absence iff the generator co-writes anything the user may hand-edit. Reuses [[LRN-085]] presence-guard oracle (file presence = deterministic). See [[LRN-084]] (guard scope vs full intent), install-plugins.sh Step 6, commit `01d8b8f`.
|
||||
|
||||
Reference in New Issue
Block a user