continuous-improvement 3.23.0 → 3.24.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +17 -0
- package/QUICKSTART.md +19 -20
- package/README.md +71 -18
- package/SKILL.md +4 -0
- package/bin/companion-preference-status.mjs +2 -5
- package/bin/generate-plugin-manifests.mjs +21 -2
- package/bin/harvest-friction.mjs +10 -8
- package/bin/install.mjs +4 -14
- package/bin/mcp-server.mjs +4 -9
- package/bin/observe.mjs +3 -3
- package/bin/reconcile-instinct-hashes.mjs +226 -0
- package/commands/discipline.md +5 -2
- package/commands/reconcile.md +1 -1
- package/commands/superpowers.md +1 -1
- package/commands/verify-install.md +8 -3
- package/hooks/companion-preference.mjs +2 -5
- package/hooks/config-guard.mjs +94 -0
- package/hooks/gateguard.mjs +39 -39
- package/hooks/goal-drift-stop.mjs +2 -2
- package/hooks/query-cost-nudge.mjs +2 -2
- package/hooks/recall-briefing.mjs +2 -2
- package/hooks/route-prompt.mjs +2 -5
- package/hooks/session.mjs +2 -2
- package/hooks/workflow-distill.mjs +2 -2
- package/lib/config-guard-gate.mjs +243 -0
- package/lib/destructive-bash.mjs +216 -0
- package/lib/gateguard-state.mjs +5 -1
- package/lib/plugin-metadata.mjs +12 -1
- package/lib/skill-catalog.mjs +169 -0
- package/llms.txt +12 -1
- package/package.json +2 -2
- package/plugins/beginner.json +1 -1
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
- package/plugins/continuous-improvement/README.md +1 -2
- package/plugins/continuous-improvement/bin/mcp-server.mjs +4 -9
- package/plugins/continuous-improvement/bin/observe.mjs +3 -3
- package/plugins/continuous-improvement/commands/discipline.md +5 -2
- package/plugins/continuous-improvement/commands/reconcile.md +1 -1
- package/plugins/continuous-improvement/commands/superpowers.md +1 -1
- package/plugins/continuous-improvement/commands/verify-install.md +8 -3
- package/plugins/continuous-improvement/hooks/companion-preference.mjs +2 -5
- package/plugins/continuous-improvement/hooks/config-guard.mjs +94 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +39 -39
- package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +2 -2
- package/plugins/continuous-improvement/hooks/hooks.json +10 -0
- package/plugins/continuous-improvement/hooks/query-cost-nudge.mjs +2 -2
- package/plugins/continuous-improvement/hooks/recall-briefing.mjs +2 -2
- package/plugins/continuous-improvement/hooks/route-prompt.mjs +2 -5
- package/plugins/continuous-improvement/hooks/session.mjs +2 -2
- package/plugins/continuous-improvement/hooks/workflow-distill.mjs +2 -2
- package/plugins/continuous-improvement/lib/config-guard-gate.mjs +243 -0
- package/plugins/continuous-improvement/lib/destructive-bash.mjs +216 -0
- package/plugins/continuous-improvement/lib/gateguard-state.mjs +5 -1
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +12 -1
- package/plugins/continuous-improvement/skills/README.md +0 -1
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +4 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +1 -1
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +17 -2
- package/plugins/continuous-improvement/skills/reconcile/SKILL.md +0 -1
- package/plugins/expert.json +1 -1
- package/skills/README.md +1 -2
- package/skills/deploy-receipt.md +1 -1
- package/skills/gateguard.md +17 -2
- package/skills/reconcile.md +0 -1
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +0 -77
- package/skills/safety-guard.md +0 -77
|
@@ -34,7 +34,6 @@ skill set on disk.
|
|
|
34
34
|
- `reconcile` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, then carries the known-good state through to a landed PR: stage by filename, commit one concern, push the feature branch, verify the push landed, open the PR, and after the PR merges fast-forward the default branch and check it out.
|
|
35
35
|
- `recovery-classification` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. After any failure in the verification ladder or auto-loop, classify the failure class before retrying — provider, tool-schema, deterministic-policy, git, worktree, runtime — so retry-vs-pause-vs-self-heal-vs-stop is an intentional decision, not a generic 'try again'.
|
|
36
36
|
- `roast` — Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Convene a 5-persona adversarial council (Contrarian, Expansionist, Logician, Researcher, Buyer) that attacks an idea from every angle, then a Judge returns one GO / RESHAPE / KILL verdict plus the cheapest 48-hour test to de-risk it — so you pressure-test an idea before sinking time into building the wrong thing.
|
|
37
|
-
- `safety-guard` — Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
|
|
38
37
|
- `simplicity-review` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Reviews the current diff for over-engineering (code that could reuse an existing file, a stdlib or native feature, or fewer lines) and reports trim findings without touching code, so 'it works' is never mistaken for 'it is the minimum that works'.
|
|
39
38
|
- `skill-distillation` — Enforces Law 7 (Learn From Every Session) of the 7 Laws of AI Agent Discipline. Distills repeated successful tool sequences into reusable draft instincts, so a pattern that worked three times becomes a captured recipe instead of being re-derived from scratch every session.
|
|
40
39
|
- `state-reconciliation` — Enforces Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Pre-dispatch invariant: reconcile DB-vs-disk-vs-memory state before any unit runs, so a stale flag, missing artifact, or out-of-sync row never re-dispatches a unit that already completed or never started.
|
|
@@ -42,6 +42,8 @@ Before executing, state:
|
|
|
42
42
|
- Build passes
|
|
43
43
|
- You can explain what changed in one sentence
|
|
44
44
|
|
|
45
|
+
"Done" is an audit, not a hope: settle the actual result against the Verification you stipulated in Law 2.
|
|
46
|
+
|
|
45
47
|
## Law 5: Reflect After Every Session
|
|
46
48
|
|
|
47
49
|
After non-trivial tasks:
|
|
@@ -59,6 +61,8 @@ After non-trivial tasks:
|
|
|
59
61
|
|
|
60
62
|
The "Rule to add" field feeds Law 7 — it becomes an instinct with 0.6 starting confidence.
|
|
61
63
|
|
|
64
|
+
This block is the ledger: what worked and what failed are the session's gains and losses; the rule to add is what you carry into the session you will not be in.
|
|
65
|
+
|
|
62
66
|
The "Iteration — Next best recommendations" field feeds Law 6. List the **top 3 ranked** core-development moves based on the current code state — what to build, fix, refactor, or investigate next so the feature/system advances. Item #1 is the strongest recommendation; #2 and #3 are alternative directions the user can pick from. NOT git plumbing (commit, push, PR), NOT pure CI ceremony (run tests, type-check), NOT deploy steps. Those belong in the end-of-run summary, not here.
|
|
63
67
|
|
|
64
68
|
Format per item: `<verb> <object at path:line> (<why, one clause grounded in current context>)`.
|
|
@@ -157,7 +157,7 @@ The rollback command is **printed**, not run. The skill's job is to give the ope
|
|
|
157
157
|
- `finishing-a-development-branch` (vendored, third-party/superpowers/) — runs first; reports the merge. This skill runs after.
|
|
158
158
|
- `verification-loop` — same Law 4 family; this skill is the deploy-seam specialization
|
|
159
159
|
- `proceed-with-the-recommendation` — routing-table row for "Merge / close branch" should pair `finishing-a-development-branch` with this skill when the project is auto-deploy
|
|
160
|
-
- `
|
|
160
|
+
- `gateguard` — orthogonal; gateguard gates the destructive op, this verifies post-deploy state
|
|
161
161
|
|
|
162
162
|
## Close-the-Loop Rule
|
|
163
163
|
|
|
@@ -77,7 +77,7 @@ Before creating {file_path}, present these facts:
|
|
|
77
77
|
|
|
78
78
|
### Destructive Bash Gate (every destructive command)
|
|
79
79
|
|
|
80
|
-
Triggers on
|
|
80
|
+
Triggers on structured rules that ignore flag order and spelling — `rm` with any recursive plus any force flag (`rm -r -f`, `rm -Rf`, `rm --recursive --force`), `git clean` with a force flag and no dry run, `git checkout -- <path>` or `git checkout .`, `git restore <path>` unless it is `--staged` only, `find … -delete`, `git push` with a `+refspec`, `git stash drop|clear` — plus the original substring list (`rm -rf`, `git reset --hard`, `git push --force`, `git branch -D`, `drop table`, `truncate `, `Remove-Item -Recurse`, etc.). Each command is judged after `&&`, `||`, `|`, `;` splitting, and a commit message, PR body or title value is blanked first so prose never trips it. The deny reason prints `Matched rule: <id>` so a block is explainable; the classifier is `lib/destructive-bash.mjs`. Plain file writes through Bash (`cat > file`, `sed -i`) are deliberately not gated.
|
|
81
81
|
|
|
82
82
|
```
|
|
83
83
|
1. List all files/data this command will modify or delete
|
|
@@ -154,10 +154,24 @@ The inline `_gateguard_facts_presented: true` retry still works on harnesses tha
|
|
|
154
154
|
|
|
155
155
|
Set the `CI_GATEGUARD_EXCLUDE` environment variable to opt specific low-risk paths out of the gate entirely — an LLM-maintained prose wiki, a generated scratch directory, anything where the fact-forcing pause costs more than it saves. The value is a comma-separated list of path substrings, each matched case-insensitively against the forward-slash-normalized file path, so `/mywiki/` excludes `D:\Vault\MyWiki\notes\x.md`. Unset or empty (the default) changes nothing: every mutating file call is gated exactly as before, and a call that touches a mix of excluded and non-excluded paths still gates the non-excluded ones. Set it per project in `.claude/settings.json` under `env`, or globally in `~/.claude/settings.json`.
|
|
156
156
|
|
|
157
|
+
An exclusion is never silent. When every target of a call is excluded, `hooks/gateguard.mjs` still allows it but prints one stderr line naming the fragment that matched (`gateguard: skipped by CI_GATEGUARD_EXCLUDE (fragment "docs/wiki" matched docs/wiki/page.md)`). A catch-all fragment that every path contains (`/`, `.`, any single character) is honoured too, but the line says what it really is: the file gate is off for this session. Destructive Bash is never excluded. If `/verify-install` reports the probe write went through, check this variable before concluding the hook is not wired.
|
|
158
|
+
|
|
157
159
|
### Locking edits to the current repo
|
|
158
160
|
|
|
159
161
|
A fact-list can't catch a wrong-repo or wrong-worktree write — you can present perfect facts about the wrong file, in the wrong checkout. Set `CI_GATEGUARD_TARGET_LOCK=block` to make the runtime hook (`hooks/gateguard.mjs`) refuse any mutating call whose **absolute** target canonicalizes outside the session project root (`CLAUDE_PROJECT_DIR`, or the git toplevel). Relative paths resolve under the current directory (= the root) and always pass; only an absolute path into a different tree is denied, and the deny reason names both the stray target and the expected root. This runs before the fact gate and independent of clearance — a wrong-repo write is wrong even with facts. Unset (the default) checks nothing, so legitimate out-of-root edits (`~/.claude`, a `/tmp` scratch file, a sibling repo) are unaffected; turn it on per session in a multi-worktree or headless run where cross-repo writes are the real risk. Paths already covered by `CI_GATEGUARD_EXCLUDE` are never target-locked.
|
|
160
162
|
|
|
163
|
+
### Migrating from `safety-guard` (retired 2026-08-07)
|
|
164
|
+
|
|
165
|
+
`safety-guard` was a prose-only tier-2 skill describing three "modes" it never implemented — no hook, no command, no logger ever shipped with it. Every mode it described is already enforced here by the runtime hook (`hooks/gateguard.mjs`):
|
|
166
|
+
|
|
167
|
+
| Retired `safety-guard` mode | What enforces it now |
|
|
168
|
+
|---|---|
|
|
169
|
+
| Careful — warn on `rm -rf`, `git push --force`, `git reset --hard`, `DROP TABLE`, `chmod 777`, `--no-verify` … | [Destructive Bash Gate](#destructive-bash-gate-every-destructive-command). Its pattern set is a superset of the retired watch list, and it blocks rather than warns. |
|
|
170
|
+
| Freeze — restrict writes to one directory tree | `CI_GATEGUARD_TARGET_LOCK=block` (above). Canonicalizes the absolute target against the session project root and refuses strays — before the fact gate, independent of clearance. |
|
|
171
|
+
| Guard — careful + freeze together | Both of the above; they compose. Narrow the surface further with `CI_GATEGUARD_EXCLUDE`. |
|
|
172
|
+
|
|
173
|
+
If you previously opted into `safety-guard` for autonomous or production-adjacent runs, set `CI_GATEGUARD_TARGET_LOCK=block` for that session instead. That is a real refusal, not a checklist the agent can talk itself out of.
|
|
174
|
+
|
|
161
175
|
### Limitations and guarantees
|
|
162
176
|
|
|
163
177
|
- **Honor system.** Clearance is recorded by `ci_gateguard_clear`, the `gateguard-clear.mjs` CLI, a manual state-file write, or the inline `_gateguard_facts_presented` flag where the harness allows it (see "Clearing the gate" above). The hook can't verify the investigation actually happened; the 50-file cap — counted per session — bounds damage from stuck loops or rogue agents.
|
|
@@ -188,5 +202,6 @@ The standalone `gateguard-ai` Python/CLI package referenced in earlier drafts of
|
|
|
188
202
|
|
|
189
203
|
## Related Skills
|
|
190
204
|
|
|
191
|
-
- `safety
|
|
205
|
+
- `worktree-safety` — validates the worktree root before a source write; this skill gates the write itself
|
|
206
|
+
- `reconcile` — git ground truth before a destructive git action
|
|
192
207
|
- `code-reviewer` — Post-edit review (GateGuard is pre-edit investigation)
|
|
@@ -177,6 +177,5 @@ git branch -d <type>/<slug> # delete the merged feature branch (safe
|
|
|
177
177
|
|
|
178
178
|
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
179
179
|
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
180
|
-
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
181
180
|
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
182
181
|
- **`commit-commands:commit-push-pr`** — the external-plugin equivalent of the commit → push → PR tail; `reconcile` reimplements it inline so the flow works with no companion installed. For a TDD-gated single-defect variant, use `/ship`.
|
package/plugins/expert.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "continuous-improvement",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"mode": "expert",
|
|
5
5
|
"description": "Expert mode: tune confidence, manage instincts, and persist plans on disk. Adds safety, token-budget, and strategic-compact skills plus the /learn-eval command so long sessions stay sharp and learnings survive context resets.",
|
|
6
6
|
"tools": [
|
package/skills/README.md
CHANGED
|
@@ -28,11 +28,10 @@ These add concrete enforcement to the 7 Laws. Tier-1 skills are the always-on mi
|
|
|
28
28
|
|
|
29
29
|
## Tier 2 — additional skills for **expert** mode
|
|
30
30
|
|
|
31
|
-
Tier-2 skills layer on top of tier-1 for users running `npx continuous-improvement install --mode expert`. They cover
|
|
31
|
+
Tier-2 skills layer on top of tier-1 for users running `npx continuous-improvement install --mode expert`. They cover response-depth control and context-window discipline that matter once an agent runs longer or more aggressively. Autonomous-mode write safety lives in tier-1 `gateguard` (`CI_GATEGUARD_TARGET_LOCK=block`), which replaced the retired `safety-guard` skill on 2026-08-07.
|
|
32
32
|
|
|
33
33
|
| Skill | What it does | When it pays off |
|
|
34
34
|
|-------|--------------|------------------|
|
|
35
|
-
| `safety-guard` | Three-mode runtime guard (careful/freeze/guard) that blocks destructive commands and locks edits to a directory | Autonomous loops, prod systems, `--dangerously-skip-permissions` sessions |
|
|
36
35
|
| `token-budget-advisor` | Heuristic input/output token estimator that offers 25%/50%/75%/100% depth choices before answering | Long sessions where response size matters |
|
|
37
36
|
| `strategic-compact` | Manual phase-boundary checklist for deciding when to run `/compact` (research→plan, plan→implement, debug→next) instead of relying on arbitrary auto-compaction | Multi-phase tasks that approach context limits |
|
|
38
37
|
| `wild-risa-balance` | Decision-framing lens that pairs WILD (Wild/Imaginative/Limitless/Disruptive) generation with RISA (Realistic/Important/Specific/Agreeable) execution, used to split recommendation lists into bold pilots above a safe baseline | Multi-item recommendation blocks where bold options keep losing to safe ones in a flat list |
|
package/skills/deploy-receipt.md
CHANGED
|
@@ -157,7 +157,7 @@ The rollback command is **printed**, not run. The skill's job is to give the ope
|
|
|
157
157
|
- `finishing-a-development-branch` (vendored, third-party/superpowers/) — runs first; reports the merge. This skill runs after.
|
|
158
158
|
- `verification-loop` — same Law 4 family; this skill is the deploy-seam specialization
|
|
159
159
|
- `proceed-with-the-recommendation` — routing-table row for "Merge / close branch" should pair `finishing-a-development-branch` with this skill when the project is auto-deploy
|
|
160
|
-
- `
|
|
160
|
+
- `gateguard` — orthogonal; gateguard gates the destructive op, this verifies post-deploy state
|
|
161
161
|
|
|
162
162
|
## Close-the-Loop Rule
|
|
163
163
|
|
package/skills/gateguard.md
CHANGED
|
@@ -77,7 +77,7 @@ Before creating {file_path}, present these facts:
|
|
|
77
77
|
|
|
78
78
|
### Destructive Bash Gate (every destructive command)
|
|
79
79
|
|
|
80
|
-
Triggers on
|
|
80
|
+
Triggers on structured rules that ignore flag order and spelling — `rm` with any recursive plus any force flag (`rm -r -f`, `rm -Rf`, `rm --recursive --force`), `git clean` with a force flag and no dry run, `git checkout -- <path>` or `git checkout .`, `git restore <path>` unless it is `--staged` only, `find … -delete`, `git push` with a `+refspec`, `git stash drop|clear` — plus the original substring list (`rm -rf`, `git reset --hard`, `git push --force`, `git branch -D`, `drop table`, `truncate `, `Remove-Item -Recurse`, etc.). Each command is judged after `&&`, `||`, `|`, `;` splitting, and a commit message, PR body or title value is blanked first so prose never trips it. The deny reason prints `Matched rule: <id>` so a block is explainable; the classifier is `lib/destructive-bash.mjs`. Plain file writes through Bash (`cat > file`, `sed -i`) are deliberately not gated.
|
|
81
81
|
|
|
82
82
|
```
|
|
83
83
|
1. List all files/data this command will modify or delete
|
|
@@ -154,10 +154,24 @@ The inline `_gateguard_facts_presented: true` retry still works on harnesses tha
|
|
|
154
154
|
|
|
155
155
|
Set the `CI_GATEGUARD_EXCLUDE` environment variable to opt specific low-risk paths out of the gate entirely — an LLM-maintained prose wiki, a generated scratch directory, anything where the fact-forcing pause costs more than it saves. The value is a comma-separated list of path substrings, each matched case-insensitively against the forward-slash-normalized file path, so `/mywiki/` excludes `D:\Vault\MyWiki\notes\x.md`. Unset or empty (the default) changes nothing: every mutating file call is gated exactly as before, and a call that touches a mix of excluded and non-excluded paths still gates the non-excluded ones. Set it per project in `.claude/settings.json` under `env`, or globally in `~/.claude/settings.json`.
|
|
156
156
|
|
|
157
|
+
An exclusion is never silent. When every target of a call is excluded, `hooks/gateguard.mjs` still allows it but prints one stderr line naming the fragment that matched (`gateguard: skipped by CI_GATEGUARD_EXCLUDE (fragment "docs/wiki" matched docs/wiki/page.md)`). A catch-all fragment that every path contains (`/`, `.`, any single character) is honoured too, but the line says what it really is: the file gate is off for this session. Destructive Bash is never excluded. If `/verify-install` reports the probe write went through, check this variable before concluding the hook is not wired.
|
|
158
|
+
|
|
157
159
|
### Locking edits to the current repo
|
|
158
160
|
|
|
159
161
|
A fact-list can't catch a wrong-repo or wrong-worktree write — you can present perfect facts about the wrong file, in the wrong checkout. Set `CI_GATEGUARD_TARGET_LOCK=block` to make the runtime hook (`hooks/gateguard.mjs`) refuse any mutating call whose **absolute** target canonicalizes outside the session project root (`CLAUDE_PROJECT_DIR`, or the git toplevel). Relative paths resolve under the current directory (= the root) and always pass; only an absolute path into a different tree is denied, and the deny reason names both the stray target and the expected root. This runs before the fact gate and independent of clearance — a wrong-repo write is wrong even with facts. Unset (the default) checks nothing, so legitimate out-of-root edits (`~/.claude`, a `/tmp` scratch file, a sibling repo) are unaffected; turn it on per session in a multi-worktree or headless run where cross-repo writes are the real risk. Paths already covered by `CI_GATEGUARD_EXCLUDE` are never target-locked.
|
|
160
162
|
|
|
163
|
+
### Migrating from `safety-guard` (retired 2026-08-07)
|
|
164
|
+
|
|
165
|
+
`safety-guard` was a prose-only tier-2 skill describing three "modes" it never implemented — no hook, no command, no logger ever shipped with it. Every mode it described is already enforced here by the runtime hook (`hooks/gateguard.mjs`):
|
|
166
|
+
|
|
167
|
+
| Retired `safety-guard` mode | What enforces it now |
|
|
168
|
+
|---|---|
|
|
169
|
+
| Careful — warn on `rm -rf`, `git push --force`, `git reset --hard`, `DROP TABLE`, `chmod 777`, `--no-verify` … | [Destructive Bash Gate](#destructive-bash-gate-every-destructive-command). Its pattern set is a superset of the retired watch list, and it blocks rather than warns. |
|
|
170
|
+
| Freeze — restrict writes to one directory tree | `CI_GATEGUARD_TARGET_LOCK=block` (above). Canonicalizes the absolute target against the session project root and refuses strays — before the fact gate, independent of clearance. |
|
|
171
|
+
| Guard — careful + freeze together | Both of the above; they compose. Narrow the surface further with `CI_GATEGUARD_EXCLUDE`. |
|
|
172
|
+
|
|
173
|
+
If you previously opted into `safety-guard` for autonomous or production-adjacent runs, set `CI_GATEGUARD_TARGET_LOCK=block` for that session instead. That is a real refusal, not a checklist the agent can talk itself out of.
|
|
174
|
+
|
|
161
175
|
### Limitations and guarantees
|
|
162
176
|
|
|
163
177
|
- **Honor system.** Clearance is recorded by `ci_gateguard_clear`, the `gateguard-clear.mjs` CLI, a manual state-file write, or the inline `_gateguard_facts_presented` flag where the harness allows it (see "Clearing the gate" above). The hook can't verify the investigation actually happened; the 50-file cap — counted per session — bounds damage from stuck loops or rogue agents.
|
|
@@ -188,5 +202,6 @@ The standalone `gateguard-ai` Python/CLI package referenced in earlier drafts of
|
|
|
188
202
|
|
|
189
203
|
## Related Skills
|
|
190
204
|
|
|
191
|
-
- `safety
|
|
205
|
+
- `worktree-safety` — validates the worktree root before a source write; this skill gates the write itself
|
|
206
|
+
- `reconcile` — git ground truth before a destructive git action
|
|
192
207
|
- `code-reviewer` — Post-edit review (GateGuard is pre-edit investigation)
|
package/skills/reconcile.md
CHANGED
|
@@ -177,6 +177,5 @@ git branch -d <type>/<slug> # delete the merged feature branch (safe
|
|
|
177
177
|
|
|
178
178
|
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
179
179
|
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
180
|
-
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
181
180
|
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
182
181
|
- **`commit-commands:commit-push-pr`** — the external-plugin equivalent of the commit → push → PR tail; `reconcile` reimplements it inline so the flow works with no companion installed. For a TDD-gated single-defect variant, use `/ship`.
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: safety-guard
|
|
3
|
-
tier: "2"
|
|
4
|
-
description: Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
|
|
5
|
-
origin: continuous-improvement
|
|
6
|
-
disable-model-invocation: true
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Safety Guard — Prevent Destructive Operations
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
- When working on production systems
|
|
14
|
-
- When agents are running autonomously (full-auto mode)
|
|
15
|
-
- When you want to restrict edits to a specific directory
|
|
16
|
-
- During sensitive operations (migrations, deploys, data changes)
|
|
17
|
-
|
|
18
|
-
## How It Works
|
|
19
|
-
|
|
20
|
-
Three modes of protection:
|
|
21
|
-
|
|
22
|
-
### Mode 1: Careful Mode
|
|
23
|
-
|
|
24
|
-
Intercepts destructive commands before execution and warns:
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Watched patterns:
|
|
28
|
-
- rm -rf (especially /, ~, or project root)
|
|
29
|
-
- git push --force
|
|
30
|
-
- git reset --hard
|
|
31
|
-
- git checkout . (discard all changes)
|
|
32
|
-
- DROP TABLE / DROP DATABASE
|
|
33
|
-
- docker system prune
|
|
34
|
-
- kubectl delete
|
|
35
|
-
- chmod 777
|
|
36
|
-
- sudo rm
|
|
37
|
-
- npm publish (accidental publishes)
|
|
38
|
-
- Any command with --no-verify
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
When detected: shows what the command does, asks for confirmation, suggests safer alternative.
|
|
42
|
-
|
|
43
|
-
### Mode 2: Freeze Mode
|
|
44
|
-
|
|
45
|
-
Locks file edits to a specific directory tree:
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
/safety-guard freeze src/components/
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Any Write/Edit outside `src/components/` is blocked with an explanation. Useful when you want an agent to focus on one area without touching unrelated code.
|
|
52
|
-
|
|
53
|
-
### Mode 3: Guard Mode (Careful + Freeze combined)
|
|
54
|
-
|
|
55
|
-
Both protections active. Maximum safety for autonomous agents.
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
/safety-guard guard --dir src/api/ --allow-read-all
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Agents can read anything but only write to `src/api/`. Destructive commands are blocked everywhere.
|
|
62
|
-
|
|
63
|
-
### Unlock
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
/safety-guard off
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Implementation
|
|
70
|
-
|
|
71
|
-
Currently implemented as skill-side discipline: when restricted-mode is active, the agent reads this skill and refuses Bash, Write, Edit, and MultiEdit calls that violate the rules before invoking the tool. There is no bundled tool-call gate today — the same enforcement gap that existed for `gateguard` before issue #106 / PR #108. A future runtime version would track via a follow-up issue.
|
|
72
|
-
|
|
73
|
-
## Integration
|
|
74
|
-
|
|
75
|
-
- Enable by default for `codex -a never` sessions
|
|
76
|
-
- Pair with observability risk scoring in continuous-improvement v2
|
|
77
|
-
- Logs all blocked actions to `~/.claude/safety-guard.log`
|
package/skills/safety-guard.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: safety-guard
|
|
3
|
-
tier: "2"
|
|
4
|
-
description: Enforces Law 3 (One Thing at a Time) of the 7 Laws of AI Agent Discipline by scoping edits to a directory and blocking destructive shell commands. Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
|
|
5
|
-
origin: continuous-improvement
|
|
6
|
-
disable-model-invocation: true
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Safety Guard — Prevent Destructive Operations
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
- When working on production systems
|
|
14
|
-
- When agents are running autonomously (full-auto mode)
|
|
15
|
-
- When you want to restrict edits to a specific directory
|
|
16
|
-
- During sensitive operations (migrations, deploys, data changes)
|
|
17
|
-
|
|
18
|
-
## How It Works
|
|
19
|
-
|
|
20
|
-
Three modes of protection:
|
|
21
|
-
|
|
22
|
-
### Mode 1: Careful Mode
|
|
23
|
-
|
|
24
|
-
Intercepts destructive commands before execution and warns:
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Watched patterns:
|
|
28
|
-
- rm -rf (especially /, ~, or project root)
|
|
29
|
-
- git push --force
|
|
30
|
-
- git reset --hard
|
|
31
|
-
- git checkout . (discard all changes)
|
|
32
|
-
- DROP TABLE / DROP DATABASE
|
|
33
|
-
- docker system prune
|
|
34
|
-
- kubectl delete
|
|
35
|
-
- chmod 777
|
|
36
|
-
- sudo rm
|
|
37
|
-
- npm publish (accidental publishes)
|
|
38
|
-
- Any command with --no-verify
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
When detected: shows what the command does, asks for confirmation, suggests safer alternative.
|
|
42
|
-
|
|
43
|
-
### Mode 2: Freeze Mode
|
|
44
|
-
|
|
45
|
-
Locks file edits to a specific directory tree:
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
/safety-guard freeze src/components/
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Any Write/Edit outside `src/components/` is blocked with an explanation. Useful when you want an agent to focus on one area without touching unrelated code.
|
|
52
|
-
|
|
53
|
-
### Mode 3: Guard Mode (Careful + Freeze combined)
|
|
54
|
-
|
|
55
|
-
Both protections active. Maximum safety for autonomous agents.
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
/safety-guard guard --dir src/api/ --allow-read-all
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Agents can read anything but only write to `src/api/`. Destructive commands are blocked everywhere.
|
|
62
|
-
|
|
63
|
-
### Unlock
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
/safety-guard off
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Implementation
|
|
70
|
-
|
|
71
|
-
Currently implemented as skill-side discipline: when restricted-mode is active, the agent reads this skill and refuses Bash, Write, Edit, and MultiEdit calls that violate the rules before invoking the tool. There is no bundled tool-call gate today — the same enforcement gap that existed for `gateguard` before issue #106 / PR #108. A future runtime version would track via a follow-up issue.
|
|
72
|
-
|
|
73
|
-
## Integration
|
|
74
|
-
|
|
75
|
-
- Enable by default for `codex -a never` sessions
|
|
76
|
-
- Pair with observability risk scoring in continuous-improvement v2
|
|
77
|
-
- Logs all blocked actions to `~/.claude/safety-guard.log`
|