@codyswann/lisa 2.329.0 → 2.330.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 (103) hide show
  1. package/all/copy-overwrite/scripts/lisa-enforcement-fallback.sh +4 -2
  2. package/all/copy-overwrite/scripts/lisa-hooks/block-instruction-file-edits.sh +142 -0
  3. package/all/merge/.claude/settings.json +9 -0
  4. package/dist/cli/index.d.ts.map +1 -1
  5. package/dist/cli/index.js +3 -15
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/cli/standards-proof-cmd.d.ts +22 -0
  8. package/dist/cli/standards-proof-cmd.d.ts.map +1 -1
  9. package/dist/cli/standards-proof-cmd.js +18 -0
  10. package/dist/cli/standards-proof-cmd.js.map +1 -1
  11. package/dist/cli/workstation-cmd.d.ts +91 -0
  12. package/dist/cli/workstation-cmd.d.ts.map +1 -0
  13. package/dist/cli/workstation-cmd.js +127 -0
  14. package/dist/cli/workstation-cmd.js.map +1 -0
  15. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  16. package/dist/core/upstream-evidence-manifest.js +25 -8
  17. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  18. package/dist/opencode/hooks-installer.d.ts.map +1 -1
  19. package/dist/opencode/hooks-installer.js +1 -41
  20. package/dist/opencode/hooks-installer.js.map +1 -1
  21. package/dist/opencode/plugin-catalog.d.ts +25 -0
  22. package/dist/opencode/plugin-catalog.d.ts.map +1 -0
  23. package/dist/opencode/plugin-catalog.js +47 -0
  24. package/dist/opencode/plugin-catalog.js.map +1 -0
  25. package/dist/opencode/plugin-templates/lisa-block-instruction-file-edits.ts +72 -0
  26. package/package.json +1 -1
  27. package/plugins/lisa/.claude-plugin/plugin.json +14 -1
  28. package/plugins/lisa/.codex-plugin/hooks.json +13 -0
  29. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  30. package/plugins/lisa/.codex-plugin/skills/lisa-setup-workstation/SKILL.md +27 -6
  31. package/plugins/lisa/commands/setup/workstation.md +2 -0
  32. package/plugins/lisa/hooks/block-instruction-file-edits.agy.sh +58 -0
  33. package/plugins/lisa/hooks/block-instruction-file-edits.sh +142 -0
  34. package/plugins/lisa/skills/lisa-setup-workstation/SKILL.md +27 -6
  35. package/plugins/lisa-agy/commands/lisa/setup/workstation.md +2 -0
  36. package/plugins/lisa-agy/hooks/block-instruction-file-edits.agy.sh +58 -0
  37. package/plugins/lisa-agy/hooks/block-instruction-file-edits.sh +142 -0
  38. package/plugins/lisa-agy/hooks.json +13 -0
  39. package/plugins/lisa-agy/plugin.json +1 -1
  40. package/plugins/lisa-agy/skills/lisa-setup-workstation/SKILL.md +27 -6
  41. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  43. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  44. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-copilot/.claude-plugin/plugin.json +14 -1
  47. package/plugins/lisa-copilot/commands/lisa/setup/workstation.md +2 -0
  48. package/plugins/lisa-copilot/hooks/block-instruction-file-edits.sh +142 -0
  49. package/plugins/lisa-copilot/skills/lisa-setup-workstation/SKILL.md +27 -6
  50. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-cursor/commands/lisa/setup/workstation.md +2 -0
  52. package/plugins/lisa-cursor/hooks/block-instruction-file-edits.sh +142 -0
  53. package/plugins/lisa-cursor/hooks/hooks.json +8 -0
  54. package/plugins/lisa-cursor/skills/lisa-setup-workstation/SKILL.md +27 -6
  55. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-expo-agy/plugin.json +1 -1
  58. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  62. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  63. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  67. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  68. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  72. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  73. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  77. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  78. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  82. package/plugins/lisa-rails-agy/plugin.json +1 -1
  83. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  87. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  88. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  92. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  93. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  95. package/plugins/src/base/.claude-plugin/plugin.json +13 -0
  96. package/plugins/src/base/commands/setup/workstation.md +2 -0
  97. package/plugins/src/base/hooks/block-instruction-file-edits.agy.sh +58 -0
  98. package/plugins/src/base/hooks/block-instruction-file-edits.sh +142 -0
  99. package/plugins/src/base/skills/lisa-setup-workstation/SKILL.md +27 -6
  100. package/scripts/build-plugins.sh +2 -1
  101. package/scripts/generate-agy-plugin-artifacts.mjs +11 -0
  102. package/scripts/lib/per-agent-hook-filter.mjs +10 -0
  103. package/scripts/lisa-enforcement-fallback.sh +4 -2
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ # Antigravity (agy) PreToolUse adapter for Lisa's instruction-file guard.
3
+ #
4
+ # agy sends `{toolCall:{name:"run_command",args:{CommandLine:"..."}}}` and
5
+ # expects an allow/deny JSON object on stdout. The canonical hook consumes the
6
+ # Claude Bash-hook envelope and communicates denial with exit status 2. This
7
+ # adapter only translates protocols; all classification stays in the canonical
8
+ # block-instruction-file-edits.sh beside it (same delegation pattern as
9
+ # block-shell-json-parsing.agy.sh).
10
+ #
11
+ # Scope note: agy plugin hooks match `run_command`, so only the Bash arm of the
12
+ # guard reaches agy — an agy file-edit tool call writing AGENTS.md cannot be
13
+ # intercepted. That gap is accepted and recorded here rather than papered over.
14
+ #
15
+ # Fail-open on missing runtimes: a missed refusal here costs context bloat in a
16
+ # markdown file, not data loss.
17
+ set -uo pipefail
18
+
19
+ allow() {
20
+ printf '%s\n' '{"decision":"allow"}'
21
+ exit 0
22
+ }
23
+
24
+ deny() {
25
+ local reason="$1"
26
+ if command -v jq >/dev/null 2>&1; then
27
+ jq -cn --arg reason "$reason" '{decision:"deny",reason:$reason}'
28
+ else
29
+ printf '%s\n' '{"decision":"allow"}'
30
+ fi
31
+ exit 0
32
+ }
33
+
34
+ input="$(cat 2>/dev/null || true)"
35
+ [ -z "$input" ] && allow
36
+ command -v jq >/dev/null 2>&1 || allow
37
+
38
+ tool_name="$(printf '%s' "$input" | jq -r '.toolCall.name // empty' 2>/dev/null || true)"
39
+ [ "$tool_name" != "run_command" ] && allow
40
+ command_str="$(printf '%s' "$input" | jq -r '.toolCall.args.CommandLine // empty' 2>/dev/null || true)"
41
+ [ -z "$command_str" ] && allow
42
+
43
+ hook_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
44
+ canonical_hook="$hook_dir/block-instruction-file-edits.sh"
45
+ [ -r "$canonical_hook" ] || allow
46
+
47
+ canonical_input="$(jq -cn --arg command "$command_str" '{tool_name:"Bash",tool_input:{command:$command}}')"
48
+ canonical_output=""
49
+ canonical_status=0
50
+ if canonical_output="$(printf '%s' "$canonical_input" | /bin/bash "$canonical_hook" 2>&1)"; then
51
+ canonical_status=0
52
+ else
53
+ canonical_status=$?
54
+ fi
55
+
56
+ [ "$canonical_status" -eq 0 ] && allow
57
+ [ -n "$canonical_output" ] || canonical_output="Blocked: AGENTS.md / CLAUDE.md are human-authored session-instruction files."
58
+ deny "$canonical_output"
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env bash
2
+ # PreToolUse hook: refuse agent writes to the session-instruction files.
3
+ #
4
+ # `AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md` are the files
5
+ # every agent loads at session start. They are human-authored and curated on
6
+ # purpose — Lisa's own contract says so in two places:
7
+ # - plugins/src/base/rules/reference/project-learnings.md
8
+ # - plugins/src/base/skills/lisa-debrief-apply/SKILL.md ("CLAUDE.md is
9
+ # human-authored ... apply never writes to any of the three")
10
+ #
11
+ # Nothing enforced it, so agents appended their own findings anyway: one fleet
12
+ # repo reached 949 lines of ticket-keyed trap dumps in `AGENTS.md` while its
13
+ # learnings ledger held 22. Every one of those lines is charged to the context
14
+ # of every later session in that project, forever. Prose did not hold; this is
15
+ # the executable control that does.
16
+ #
17
+ # Blocked signatures:
18
+ # 1. Write / Edit / MultiEdit / NotebookEdit whose target basename is one of
19
+ # the instruction files;
20
+ # 2. Bash output redirection (`>`, `>>`), `tee`, or `sed -i` aimed at one.
21
+ # Reads (`cat AGENTS.md`, `rg pattern AGENTS.md`) never fire.
22
+ #
23
+ # Exemptions (allowed):
24
+ # - `LISA_ALLOW_INSTRUCTION_FILE_WRITE` set — the operator's explicit override,
25
+ # named in the refusal so a human who really wants the edit can take it;
26
+ # - payloads carrying a `<!-- LISA_` marker: Lisa's own marker-bounded regions
27
+ # (the agy project-learnings bridge, cross-pollinate's rule section) replace
28
+ # in place on re-run and cannot grow the file;
29
+ # - paths under `node_modules/` or `dist/` — vendored copies, not the host's.
30
+ set -euo pipefail
31
+
32
+ input="$(cat)"
33
+
34
+ command -v jq >/dev/null 2>&1 || exit 0
35
+
36
+ # The operator's override. Checked before anything else so it is always the
37
+ # cheapest way out of a refusal a human deliberately wants to overrule.
38
+ if [ -n "${LISA_ALLOW_INSTRUCTION_FILE_WRITE:-}" ]; then
39
+ exit 0
40
+ fi
41
+
42
+ tool_name="$(printf '%s' "$input" | jq -r '.tool_name // empty')"
43
+ [ -n "$tool_name" ] || exit 0
44
+
45
+ # Lisa's own bounded bridges write marked regions. A payload carrying a marker
46
+ # is replacing a delimited block, not appending prose, so it cannot be the
47
+ # unbounded growth this guard exists to stop.
48
+ if printf '%s' "$input" | grep -q '<!-- LISA_'; then
49
+ exit 0
50
+ fi
51
+
52
+ # Basename match, case-insensitively: `agents.md` and `AGENTS.md` are the same
53
+ # file on the macOS checkouts this fleet runs on.
54
+ is_instruction_file() {
55
+ local candidate="$1"
56
+ case "$candidate" in
57
+ */node_modules/* | node_modules/* | */dist/* | dist/*) return 1 ;;
58
+ esac
59
+ local base="${candidate##*/}"
60
+ case "$(printf '%s' "$base" | tr '[:upper:]' '[:lower:]')" in
61
+ agents.md | claude.md | copilot-instructions.md) return 0 ;;
62
+ esac
63
+ return 1
64
+ }
65
+
66
+ refuse() {
67
+ local target="$1"
68
+ cat >&2 <<EOF
69
+ BLOCKED: refusing to write \`$target\`.
70
+
71
+ WHY: this is a session-instruction file, not a place to record what you just
72
+ learned. Every line in it is loaded into the context of every agent, in every
73
+ future session, in this project, forever. It is human-curated on purpose. An
74
+ agent appending its own findings is how these files grow into hundreds of lines
75
+ of stale, ticket-specific trivia that every later session pays for and half of
76
+ which was only ever true once.
77
+
78
+ WHERE IT GOES INSTEAD — take the first one that fits:
79
+
80
+ 1. Every agent genuinely needs this in every session, and only in this project.
81
+ That is a project rule — but do not write it yourself. Capture it with
82
+ \`/lisa:persist-learning\` so it lands in the learnings ledger with provenance
83
+ and a confidence score. The gardener (\`/lisa:learnings:audit\`) then proposes
84
+ promotion into \`.claude/rules/PROJECT_RULES.md\` as a human-gated ticket.
85
+
86
+ 2. It changes how an existing skill should behave. Edit that skill's SKILL.md.
87
+ Knowledge belongs next to the procedure it modifies, not in a global preamble.
88
+
89
+ 3. It is true beyond this project. Propose it upstream to Lisa via
90
+ \`/lisa:cross-pollinate\`, or open an issue on CodySwannGT/lisa. A local copy of
91
+ a general rule silently drifts the moment upstream changes.
92
+
93
+ 4. None of the above — it is background someone may want to look up, not a
94
+ standing instruction. Write it into the project documentation (\`wiki/\` or
95
+ \`docs/\`).
96
+
97
+ If a human explicitly asked for this edit, they can re-run with
98
+ \`LISA_ALLOW_INSTRUCTION_FILE_WRITE=1\` set, which bypasses this guard.
99
+ EOF
100
+ exit 2
101
+ }
102
+
103
+ case "$tool_name" in
104
+ Write | Edit | MultiEdit | NotebookEdit | Update)
105
+ # `file_path` covers Write/Edit; `edits[].file_path` covers the MultiEdit
106
+ # shapes that carry a path per edit; `notebook_path` covers NotebookEdit.
107
+ paths="$(printf '%s' "$input" | jq -r '
108
+ [ .tool_input.file_path?,
109
+ .tool_input.path?,
110
+ .tool_input.notebook_path?,
111
+ (.tool_input.edits? // [] | .[].file_path?)
112
+ ] | map(select(. != null and . != "")) | .[]' 2>/dev/null || true)"
113
+ while IFS= read -r candidate; do
114
+ [ -n "$candidate" ] || continue
115
+ if is_instruction_file "$candidate"; then
116
+ refuse "$candidate"
117
+ fi
118
+ done <<EOF
119
+ $paths
120
+ EOF
121
+ ;;
122
+ Bash)
123
+ command_str="$(printf '%s' "$input" | jq -r '.tool_input.command // empty')"
124
+ [ -n "$command_str" ] || exit 0
125
+ # Fast path: no instruction filename mentioned means nothing to classify.
126
+ if ! printf '%s' "$command_str" |
127
+ grep -Eqi '(agents|claude|copilot-instructions)\.md'; then
128
+ exit 0
129
+ fi
130
+ # Write signatures only. A bare mention (`cat AGENTS.md`, `rg x AGENTS.md`)
131
+ # is a read and must stay allowed — the filename has to appear as the target
132
+ # of a redirection, a tee, or an in-place sed.
133
+ write_target='[^ |;&]*(agents|claude|copilot-instructions)\.md'
134
+ if printf '%s' "$command_str" |
135
+ grep -Eqi ">>?[[:space:]]*['\"]?$write_target|tee([[:space:]]+-[a-z]+)*[[:space:]]+['\"]?$write_target|sed[[:space:]]+[^|;&]*-i[^|;&]*$write_target"; then
136
+ refuse "$(printf '%s' "$command_str" |
137
+ grep -Eoi "$write_target" | head -1)"
138
+ fi
139
+ ;;
140
+ esac
141
+
142
+ exit 0
@@ -37,5 +37,18 @@
37
37
  ]
38
38
  }
39
39
  ]
40
+ },
41
+ "lisa-block-instruction-file-edits": {
42
+ "PreToolUse": [
43
+ {
44
+ "matcher": "run_command",
45
+ "hooks": [
46
+ {
47
+ "type": "command",
48
+ "command": "bash \"$HOME/.gemini/config/plugins/lisa/hooks/block-instruction-file-edits.agy.sh\""
49
+ }
50
+ ]
51
+ }
52
+ ]
40
53
  }
41
54
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -25,15 +25,36 @@ repository, and nothing here duplicates that manifest.
25
25
 
26
26
  ## Usage
27
27
 
28
+ **Start here — this is the entry point that presumes nothing:**
29
+
30
+ ```sh
31
+ npx -y @codyswann/lisa@latest workstation # report what is present and missing
32
+ npx -y @codyswann/lisa@latest workstation --install # install what is missing
33
+ ```
34
+
35
+ That form needs only Node. No checkout, no agent, no Lisa install — npx resolves
36
+ the package into its own cache.
37
+
38
+ **Why it matters:** this skill exists to prepare a machine with *no coding agent*
39
+ and *no checkout*. But a skill can only be invoked by typing a slash command into
40
+ an agent, and Lisa ships as a devDependency, so it does not exist until a repo is
41
+ cloned and its dependencies installed. Both are exactly the state this is meant to
42
+ create — so as a skill alone, the bootstrap was unreachable in the one scenario it
43
+ was designed for. The CLI is the way in; the skill is the surface for people who
44
+ already have an agent.
45
+
46
+ Every flag is the same either way:
47
+
28
48
  ```sh
29
- node scripts/cli.mjs # report what is present and missing
30
- node scripts/cli.mjs --install # install what is missing
31
- node scripts/cli.mjs --install --agents=claude,codex # only these agents
32
- node scripts/cli.mjs --provider=bitwarden # credential manager (asked if a TTY)
33
- node scripts/cli.mjs --json # machine-readable plan
34
- node scripts/cli.mjs --print-dockerfile # an image that runs this same script
49
+ lisa workstation --install --agents=claude,codex # only these agents
50
+ lisa workstation --provider=bitwarden # credential manager (asked if a TTY)
51
+ lisa workstation --json # machine-readable plan
52
+ lisa workstation --print-dockerfile # an image that runs this same script
35
53
  ```
36
54
 
55
+ Inside an agent, `/lisa:setup:workstation` runs the identical script; and the
56
+ script itself is directly runnable as `node scripts/cli.mjs …`.
57
+
37
58
  Nothing is installed or written without `--install`. Exit status is non-zero when a required
38
59
  tool is absent or an install fails, so this is usable as a gate.
39
60
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "AWS CDK-specific Lisa plugin.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -52,6 +52,19 @@
52
52
  {
53
53
  "type": "command",
54
54
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-shell-json-parsing.sh"
55
+ },
56
+ {
57
+ "type": "command",
58
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-instruction-file-edits.sh"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "matcher": "Write|Edit|MultiEdit",
64
+ "hooks": [
65
+ {
66
+ "type": "command",
67
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/block-instruction-file-edits.sh"
55
68
  }
56
69
  ]
57
70
  },
@@ -5,3 +5,5 @@ argument-hint: "[--install] [--agents=claude,codex] [--provider=bitwarden] [--js
5
5
  ---
6
6
 
7
7
  Use the /lisa-setup-workstation skill to report and optionally install the coding agents, credential manager, and base tools this machine needs. $ARGUMENTS
8
+
9
+ Note: on a machine with no agent and no checkout — which is what this prepares — reach the same bootstrap without Lisa installed at all: `npx -y @codyswann/lisa@latest workstation --install`.
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env bash
2
+ # PreToolUse hook: refuse agent writes to the session-instruction files.
3
+ #
4
+ # `AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md` are the files
5
+ # every agent loads at session start. They are human-authored and curated on
6
+ # purpose — Lisa's own contract says so in two places:
7
+ # - plugins/src/base/rules/reference/project-learnings.md
8
+ # - plugins/src/base/skills/lisa-debrief-apply/SKILL.md ("CLAUDE.md is
9
+ # human-authored ... apply never writes to any of the three")
10
+ #
11
+ # Nothing enforced it, so agents appended their own findings anyway: one fleet
12
+ # repo reached 949 lines of ticket-keyed trap dumps in `AGENTS.md` while its
13
+ # learnings ledger held 22. Every one of those lines is charged to the context
14
+ # of every later session in that project, forever. Prose did not hold; this is
15
+ # the executable control that does.
16
+ #
17
+ # Blocked signatures:
18
+ # 1. Write / Edit / MultiEdit / NotebookEdit whose target basename is one of
19
+ # the instruction files;
20
+ # 2. Bash output redirection (`>`, `>>`), `tee`, or `sed -i` aimed at one.
21
+ # Reads (`cat AGENTS.md`, `rg pattern AGENTS.md`) never fire.
22
+ #
23
+ # Exemptions (allowed):
24
+ # - `LISA_ALLOW_INSTRUCTION_FILE_WRITE` set — the operator's explicit override,
25
+ # named in the refusal so a human who really wants the edit can take it;
26
+ # - payloads carrying a `<!-- LISA_` marker: Lisa's own marker-bounded regions
27
+ # (the agy project-learnings bridge, cross-pollinate's rule section) replace
28
+ # in place on re-run and cannot grow the file;
29
+ # - paths under `node_modules/` or `dist/` — vendored copies, not the host's.
30
+ set -euo pipefail
31
+
32
+ input="$(cat)"
33
+
34
+ command -v jq >/dev/null 2>&1 || exit 0
35
+
36
+ # The operator's override. Checked before anything else so it is always the
37
+ # cheapest way out of a refusal a human deliberately wants to overrule.
38
+ if [ -n "${LISA_ALLOW_INSTRUCTION_FILE_WRITE:-}" ]; then
39
+ exit 0
40
+ fi
41
+
42
+ tool_name="$(printf '%s' "$input" | jq -r '.tool_name // empty')"
43
+ [ -n "$tool_name" ] || exit 0
44
+
45
+ # Lisa's own bounded bridges write marked regions. A payload carrying a marker
46
+ # is replacing a delimited block, not appending prose, so it cannot be the
47
+ # unbounded growth this guard exists to stop.
48
+ if printf '%s' "$input" | grep -q '<!-- LISA_'; then
49
+ exit 0
50
+ fi
51
+
52
+ # Basename match, case-insensitively: `agents.md` and `AGENTS.md` are the same
53
+ # file on the macOS checkouts this fleet runs on.
54
+ is_instruction_file() {
55
+ local candidate="$1"
56
+ case "$candidate" in
57
+ */node_modules/* | node_modules/* | */dist/* | dist/*) return 1 ;;
58
+ esac
59
+ local base="${candidate##*/}"
60
+ case "$(printf '%s' "$base" | tr '[:upper:]' '[:lower:]')" in
61
+ agents.md | claude.md | copilot-instructions.md) return 0 ;;
62
+ esac
63
+ return 1
64
+ }
65
+
66
+ refuse() {
67
+ local target="$1"
68
+ cat >&2 <<EOF
69
+ BLOCKED: refusing to write \`$target\`.
70
+
71
+ WHY: this is a session-instruction file, not a place to record what you just
72
+ learned. Every line in it is loaded into the context of every agent, in every
73
+ future session, in this project, forever. It is human-curated on purpose. An
74
+ agent appending its own findings is how these files grow into hundreds of lines
75
+ of stale, ticket-specific trivia that every later session pays for and half of
76
+ which was only ever true once.
77
+
78
+ WHERE IT GOES INSTEAD — take the first one that fits:
79
+
80
+ 1. Every agent genuinely needs this in every session, and only in this project.
81
+ That is a project rule — but do not write it yourself. Capture it with
82
+ \`/lisa:persist-learning\` so it lands in the learnings ledger with provenance
83
+ and a confidence score. The gardener (\`/lisa:learnings:audit\`) then proposes
84
+ promotion into \`.claude/rules/PROJECT_RULES.md\` as a human-gated ticket.
85
+
86
+ 2. It changes how an existing skill should behave. Edit that skill's SKILL.md.
87
+ Knowledge belongs next to the procedure it modifies, not in a global preamble.
88
+
89
+ 3. It is true beyond this project. Propose it upstream to Lisa via
90
+ \`/lisa:cross-pollinate\`, or open an issue on CodySwannGT/lisa. A local copy of
91
+ a general rule silently drifts the moment upstream changes.
92
+
93
+ 4. None of the above — it is background someone may want to look up, not a
94
+ standing instruction. Write it into the project documentation (\`wiki/\` or
95
+ \`docs/\`).
96
+
97
+ If a human explicitly asked for this edit, they can re-run with
98
+ \`LISA_ALLOW_INSTRUCTION_FILE_WRITE=1\` set, which bypasses this guard.
99
+ EOF
100
+ exit 2
101
+ }
102
+
103
+ case "$tool_name" in
104
+ Write | Edit | MultiEdit | NotebookEdit | Update)
105
+ # `file_path` covers Write/Edit; `edits[].file_path` covers the MultiEdit
106
+ # shapes that carry a path per edit; `notebook_path` covers NotebookEdit.
107
+ paths="$(printf '%s' "$input" | jq -r '
108
+ [ .tool_input.file_path?,
109
+ .tool_input.path?,
110
+ .tool_input.notebook_path?,
111
+ (.tool_input.edits? // [] | .[].file_path?)
112
+ ] | map(select(. != null and . != "")) | .[]' 2>/dev/null || true)"
113
+ while IFS= read -r candidate; do
114
+ [ -n "$candidate" ] || continue
115
+ if is_instruction_file "$candidate"; then
116
+ refuse "$candidate"
117
+ fi
118
+ done <<EOF
119
+ $paths
120
+ EOF
121
+ ;;
122
+ Bash)
123
+ command_str="$(printf '%s' "$input" | jq -r '.tool_input.command // empty')"
124
+ [ -n "$command_str" ] || exit 0
125
+ # Fast path: no instruction filename mentioned means nothing to classify.
126
+ if ! printf '%s' "$command_str" |
127
+ grep -Eqi '(agents|claude|copilot-instructions)\.md'; then
128
+ exit 0
129
+ fi
130
+ # Write signatures only. A bare mention (`cat AGENTS.md`, `rg x AGENTS.md`)
131
+ # is a read and must stay allowed — the filename has to appear as the target
132
+ # of a redirection, a tee, or an in-place sed.
133
+ write_target='[^ |;&]*(agents|claude|copilot-instructions)\.md'
134
+ if printf '%s' "$command_str" |
135
+ grep -Eqi ">>?[[:space:]]*['\"]?$write_target|tee([[:space:]]+-[a-z]+)*[[:space:]]+['\"]?$write_target|sed[[:space:]]+[^|;&]*-i[^|;&]*$write_target"; then
136
+ refuse "$(printf '%s' "$command_str" |
137
+ grep -Eoi "$write_target" | head -1)"
138
+ fi
139
+ ;;
140
+ esac
141
+
142
+ exit 0
@@ -25,15 +25,36 @@ repository, and nothing here duplicates that manifest.
25
25
 
26
26
  ## Usage
27
27
 
28
+ **Start here — this is the entry point that presumes nothing:**
29
+
30
+ ```sh
31
+ npx -y @codyswann/lisa@latest workstation # report what is present and missing
32
+ npx -y @codyswann/lisa@latest workstation --install # install what is missing
33
+ ```
34
+
35
+ That form needs only Node. No checkout, no agent, no Lisa install — npx resolves
36
+ the package into its own cache.
37
+
38
+ **Why it matters:** this skill exists to prepare a machine with *no coding agent*
39
+ and *no checkout*. But a skill can only be invoked by typing a slash command into
40
+ an agent, and Lisa ships as a devDependency, so it does not exist until a repo is
41
+ cloned and its dependencies installed. Both are exactly the state this is meant to
42
+ create — so as a skill alone, the bootstrap was unreachable in the one scenario it
43
+ was designed for. The CLI is the way in; the skill is the surface for people who
44
+ already have an agent.
45
+
46
+ Every flag is the same either way:
47
+
28
48
  ```sh
29
- node scripts/cli.mjs # report what is present and missing
30
- node scripts/cli.mjs --install # install what is missing
31
- node scripts/cli.mjs --install --agents=claude,codex # only these agents
32
- node scripts/cli.mjs --provider=bitwarden # credential manager (asked if a TTY)
33
- node scripts/cli.mjs --json # machine-readable plan
34
- node scripts/cli.mjs --print-dockerfile # an image that runs this same script
49
+ lisa workstation --install --agents=claude,codex # only these agents
50
+ lisa workstation --provider=bitwarden # credential manager (asked if a TTY)
51
+ lisa workstation --json # machine-readable plan
52
+ lisa workstation --print-dockerfile # an image that runs this same script
35
53
  ```
36
54
 
55
+ Inside an agent, `/lisa:setup:workstation` runs the identical script; and the
56
+ script itself is directly runnable as `node scripts/cli.mjs …`.
57
+
37
58
  Nothing is installed or written without `--install`. Exit status is non-zero when a required
38
59
  tool is absent or an install fails, so this is usable as a gate.
39
60
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.329.0",
3
+ "version": "2.330.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -5,3 +5,5 @@ argument-hint: "[--install] [--agents=claude,codex] [--provider=bitwarden] [--js
5
5
  ---
6
6
 
7
7
  Use the /lisa-setup-workstation skill to report and optionally install the coding agents, credential manager, and base tools this machine needs. $ARGUMENTS
8
+
9
+ Note: on a machine with no agent and no checkout — which is what this prepares — reach the same bootstrap without Lisa installed at all: `npx -y @codyswann/lisa@latest workstation --install`.