fix(agents): close the 10 prose BUGS-FOUND items, root quoting and $HOME refusal

Handover: rooted reads, whole-line PROJECT_ROOT read with a one-line
pre-paste rule, BDR status filter. plugin-gate: single-quoted templates,
unsafe roots printed never run, apply check against the git common dir,
$HOME refused (and in profile.sh). Advisor: minimal only from project
signals, no extras token, ctx7 wording, print-only plugin remedy. Packs
vocabulary in onboard/tour; graphify labels match the trap.
This commit is contained in:
bchanot committed 2026-11-13 20:43:59 +01:00
1 parent a967fd93dc
commit 77041e5360
17 files changed
+192 -98

No files matched your search

+3 -3
View File
@@ -52,9 +52,9 @@ rules/context7.md
graphify-out/
.ctx7-cache/
# graphify's vendored skill — written into the repo by `graphify claude
# install` (install-plugins.sh STEP graphify), since ~/.claude/skills is a
# symlink to skills/. Untracked so a tool upgrade stops dirtying the tree.
# graphify's vendored skill — written by `graphify install` (install-plugins.sh
# STEP graphify) into ~/.claude/skills, a symlink to skills/.
# Untracked so a tool upgrade stops dirtying the tree.
# test-prompts.json is hand-written for darwin and stays tracked.
skills/graphify/SKILL.md
skills/graphify/references/
+7 -6
View File
@@ -176,11 +176,12 @@ Tu veux...
| `/route` | Voir ou fixer la route du mod model-router | show / clear / off / on / reload / pending / ask on\|off / ask-tier on\|off / <phase> / model=… effort=… / switch on\|off / classify on\|off (classifieur de prompt) / verbose on\|off (transitions seules) ; `clear`, `off` et `/clear` réarment le garde d'écriture (voir ci-dessous) |
| `/profile` | Changer le profil de packs du projet (`set`), ou l'état effectif (`current`) | Profils dans `lib/profiles/*.json`, packs dans `skills/pack-*/` |
> Cette table couvre les skills personnels principaux. `/seo` et `/geo` (pack-seo)
> et `/web-validate` (pack-web-validate) vivent dans des packs : un profil qui laisse
> le pack éteint les masque (`/profile current`). Les packs gstack-dev,
> gstack-browser et gstack-design, les plugins (pr-review-toolkit…) et marketplaces externes en ajoutent beaucoup d'autres ;
> `/skills-perso` liste tes skills personnels.
> Cette table couvre les skills personnels principaux. `/seo` et `/geo`
> (pack-seo) et `/web-validate` (pack-web-validate) vivent dans des packs : un profil
> qui laisse le pack éteint les masque (`/profile current`). Les packs
> gstack-dev, gstack-browser et gstack-design, les plugins
> (pr-review-toolkit…) et marketplaces externes en ajoutent beaucoup
> d'autres ; `/skills-perso` liste tes skills personnels.
---
@@ -1019,7 +1020,7 @@ SIGNALS: simple, CLI/embedded
COST: ~0t (skills superpowers vendorisés, toujours actifs, 0 t passif)
RECOMMENDATIONS:
SET : minimal (embedded : tous les packs éteints)
↻ SET : minimal (embedded : tous les packs éteints)
NOTE : skills superpowers (brainstorming, writing-plans...) restent
disponibles par nom bare, même pour un
firmware minimal.
+17 -6
View File
@@ -106,7 +106,9 @@ ROUTING: follow $HOME/.claude/lib/effort-shift.md (phases via mcp__model-router_
git rev-parse --is-inside-work-tree 2>/dev/null || { echo "NOT_GIT_REPO"; exit 1; }
# Project root
PROJECT_ROOT=$(git rev-parse --show-toplevel)
# Sentinel keeps a trailing newline that $(...) would strip
PROJECT_ROOT=$(git rev-parse --show-toplevel; printf x)
PROJECT_ROOT=${PROJECT_ROOT%x}; PROJECT_ROOT=${PROJECT_ROOT%$'\n'}
cd "$PROJECT_ROOT"
# First commit (the start of the project)
@@ -123,6 +125,9 @@ PIPELINE_BASE_SHA=$(git rev-parse HEAD)
```
If not in a git repo: stop and report `STATUS: BLOCKED — not a git repository`.
A `PROJECT_ROOT` holding a newline or control character (`case
"$PROJECT_ROOT" in *[[:cntrl:]]*`) → `STATUS: BLOCKED` before anything
is written, the PACKAGE line cannot carry it.
---
@@ -1110,6 +1115,10 @@ it, don't recompute) or resolved in 9.1–9.5:
`is_local_business` (`IS_LOCAL_BUSINESS`), `deployed_url`
(`DEPLOYED_URL`), `period` (`FIRST_COMMIT_DATE` → `LAST_COMMIT_DATE`,
reformatted DD/MM/YYYY).
- `PROJECT_ROOT` — its own line `PROJECT_ROOT: <path>`, the STEP 1
`PROJECT_ROOT` verbatim (the `PROJECT` line is space-separated and
mis-parses a root holding a space; the doc-writer reads this line
whole).
- `SCORES` — `SCORE_SEO_BEFORE/AFTER`, `SCORE_GEO_BEFORE/AFTER`,
`SCORE_HARDEN_BEFORE/AFTER`, `SCORE_VALIDATE_AFTER` (web) or
`SCORE_CSO_BEFORE/AFTER` (non-web), each with the pass-status and
@@ -1136,7 +1145,7 @@ contract.
Dispatch the two-mode pipeline (BDR-077 — synthesis on opus, render on the
sonnet pin, full PACKAGE both times per LRN-126). Mint a RUNID first
(`RUNID=$(date +%s)`); the draft crosses via the run-scoped, gitignored
`.audit/handover-draft-<RUNID>.md`; clean it after 9.7.
`"${PROJECT_ROOT:?}/.audit/handover-draft-<RUNID>.md"`; clean it after 9.7.
FIRST — synthesize:
@@ -1163,6 +1172,7 @@ prompt: "MODE: render
RUNID: <RUNID>
PACKAGE:
LANG: <LANG>
PROJECT_ROOT: <PROJECT_ROOT>
PROJECT: name=<name> root=<root> type=<type> sub-type=<sub-type>
is_local_business=<bool> deployed_url=<url> period=<first→last>
SCORES: seo=<before→after,status> geo=<before→after,status>
@@ -1199,8 +1209,9 @@ Parse the returned `HANDOVER-DOC REPORT`:
add the bullet:
- Memory: <value>
For unreadable IDs, give the remedy: `bash ~/.claude/lib/memory.sh -C
<root> status <ID> "<word>, …"` (a status word, e.g. resolved or
open), then re-run.
'<root>' status <ID> "<word>, …"` (a status word, e.g. resolved or
open), then re-run. A root holding `'` → print the remedy with a
warning that the path needs manual quoting, never run it.
- `STATUS: BLOCKED` → surface the report verbatim (including which
PACKAGE field the doc-writer flagged) and stop — do not retry or
patch the PACKAGE silently. Re-run PUSH STATE READ and add the same
@@ -1208,5 +1219,5 @@ Parse the returned `HANDOVER-DOC REPORT`:
- Push: <state>
In BOTH branches, then clean the transient draft:
`rm -f ".audit/handover-draft-${RUNID}.md"` (run-scoped, gitignored —
cleanup keeps `.audit/` from accumulating stranded drafts).
`rm -f "${PROJECT_ROOT:?}/.audit/handover-draft-${RUNID}.md"` (run-scoped,
gitignored — cleanup keeps `.audit/` from accumulating stranded drafts).
+62 -18
View File
@@ -18,6 +18,9 @@ parent already resolved:
- `LANG` — output language (`fr` | `en`).
- `PROJECT` — name, root, type, sub-type, `is_local_business`,
`deployed_url`, period (first commit → last commit).
- `PROJECT_ROOT` — the project root on its own line, `PROJECT_ROOT: <path>`.
Read it whole-line (a path may hold spaces); every git and file read
below is rooted on it.
- `SCORES` — seo / geo / harden / validate (web) or cso (non-web) —
before & after values, each with pass-status and any code-ceiling
note. Source of truth for §2 — do not recompute.
@@ -52,8 +55,8 @@ The parent dispatches this agent TWICE, with the FULL PACKAGE both times
- **`MODE: synthesize`** — dispatched with `model: "opus"` (judgment tier;
call-site override over the sonnet pin). Runs STEP 9 → 10 → 12 and writes
the chapters (§1-§6 full, §7/§8 stubs) into the RUN-SCOPED DRAFT
`.audit/handover-draft-<RUNID>.md`, ending the file with the line
`DRAFT COMPLETE — RUNID: <RUNID>`. Then emits a `SYNTH REPORT`
`"${ROOT:?}/.audit/handover-draft-<RUNID>.md"`, ending the file with
the line `DRAFT COMPLETE — RUNID: <RUNID>`. Then emits a `SYNTH REPORT`
(template below, `MEMORY:` line mandatory on DONE) and STOPS — STEP 13-16, the final MD, HTML and PDF are NEVER
this mode's job.
- **`MODE: render`** — runs on its sonnet row (frontmatter = off-state floor). FIRST loads the
@@ -79,9 +82,23 @@ MEMORY: unreadable BLK: <IDs comma-separated | none> | no blockers file | reader
## STEP 9 — LOAD MEMORY REGISTRIES
The PACKAGE `PROJECT_ROOT` value pasted between the markers below is
exactly one line with no control character, checked BEFORE the paste: a
value holding a newline or a control character → `STATUS: BLOCKED`
before any Bash call (the block cannot see a newline, `read -r` keeps
only the first line and a line equal to `ROOT_END` would close the
heredoc).
```bash
ROOT="<PROJECT root from the PACKAGE>"
MEMORY_DIR="$ROOT/.claude/memory"
# Whole-line read of the PACKAGE `PROJECT_ROOT: <path>` value (spaces kept,
# nothing expanded): replace the placeholder line with the path, never
# paste it into a double-quoted literal. This block opens EVERY Bash call
# that uses $ROOT (the shell keeps no state between calls).
IFS= read -r ROOT <<'ROOT_END'
<PROJECT root from the PACKAGE>
ROOT_END
case "$ROOT" in *[[:cntrl:]]*) echo "ROOT_UNSAFE"; exit 1 ;; esac
MEMORY_DIR="${ROOT:?}/.claude/memory"
test -d "$MEMORY_DIR" || MEMORY_DIR=""
# Blocker statuses through the shared reader (BDR-129): never parsed by hand.
B="$MEMORY_DIR/blockers.md"
@@ -96,6 +113,21 @@ SYNTH REPORT `MEMORY:` line. `blockers: no-file` → no blocker in §5,
`MEMORY: no blockers file`. `blockers: reader-unavailable` → no blocker
in §5, `MEMORY: reader unavailable`.
Decision statuses come from the same shared reader, never from the
entry prose:
```bash
bash "$HOME/.claude/lib/memory.sh" -C "${ROOT:?}" index decision
```
Only BDRs whose current word is `accepted`, `implemented` or `proposed`
feed §6.1; `superseded` and `deprecated` ones are left out. A decision
whose word is empty is counted as unreadable, not dropped silently.
A `ROOT_UNSAFE` print (the first line of the root holds a control
character) or a pre-paste refusal (see above) → `STATUS: BLOCKED` naming
the PACKAGE `PROJECT_ROOT` field.
If memory dir exists, read each file in full for the narrative fields
(titles, decisions, why, alternatives, cause, solution, journal
summaries). A blocker's status is never taken from the file's prose,
@@ -116,22 +148,29 @@ final report that memory was unavailable.
## STEP 10 — GIT HISTORY SUMMARY
Every git command is rooted on the PACKAGE root (`$ROOT`, STEP 9), never
on the working directory:
```bash
git log --reverse --format='%h|%aI|%an|%s' | head -200
git log --name-only --format='---COMMIT---' | grep -v '^---' | sort -u | head -50
git -C "${ROOT:?}" log --reverse --format='%h|%aI|%an|%s' | head -200
git -C "${ROOT:?}" log --name-only --format='---COMMIT---' \
| grep -v '^---' | sort -u | head -50
git log --diff-filter=A --name-only --format='' | sort -u | wc -l # added
git log --diff-filter=M --name-only --format='' | sort -u | wc -l # modified
git log --diff-filter=D --name-only --format='' | sort -u | wc -l # deleted
git -C "${ROOT:?}" log --diff-filter=A --name-only --format='' \
| sort -u | wc -l # added
git -C "${ROOT:?}" log --diff-filter=M --name-only --format='' \
| sort -u | wc -l # modified
git -C "${ROOT:?}" log --diff-filter=D --name-only --format='' \
| sort -u | wc -l # deleted
git tag --sort=-creatordate | head -5
git -C "${ROOT:?}" tag --sort=-creatordate | head -5
```
Cluster commits into 3-7 chronological phases based on commit message
themes. Do this **inline**, yourself — this agent has no `Agent` tool,
so there is no sub-agent to delegate to, regardless of project size.
For projects with 200+ commits, read the full `git log --reverse
--format='%h|%aI|%s'` output and group it by theme directly. For each
For projects with 200+ commits, read the full `git -C "${ROOT:?}" log
--reverse --format='%h|%aI|%s'` output and group it by theme directly. For each
phase: name, commit count, 2-line summary. Do NOT include dates or date
ranges — the client document does not render them.
@@ -339,7 +378,8 @@ End with two callouts:
## 5. Ce qui vous reste à faire
[Action-only checklist for the client. Pull from:
**`.claude/audits/HUMAN-ACTIONS.md` FIRST when present** (the /seo//geo
**`"${ROOT:?}/.claude/audits/HUMAN-ACTIONS.md"` FIRST when present**
(the /seo//geo
audit-end checklist — carry its automation notes, vulgarized), then open
blockers from STEP 9 (unreadable ones excluded), ongoing-monitoring items, external platforms to
claim, content updates only the client can make, deploy steps if
@@ -419,10 +459,14 @@ visibilité."]
### 6.1 Choix techniques importants
[Vulgarize 3–7 BDR entries. Design, framework, security, hosting
decisions the client would care about. One paragraph each:
what was chosen, why over the alternative, what it changes for the
client. Drop entries the client cannot act on or care about.]
[Vulgarize 3–7 BDR entries whose STEP 9 status is accepted,
implemented or proposed (superseded and deprecated ones stay out).
Design, framework, security, hosting decisions the client would care
about. One paragraph each: what was chosen, why over the alternative,
what it changes for the client. Drop entries the client cannot act on
or care about. Close §6.1 with one method sentence: superseded and
deprecated decisions are left out, and "status unreadable (n)" counts those with
an empty status word.]
### 6.2 Comment on en est arrivé là (phases)
@@ -503,7 +547,7 @@ des audits de santé. Pour toute question, contactez [contact].*
---
> **MODE BOUNDARY.** STEP 12 is the last synthesize-mode step: write the
> drafted chapters to `.audit/handover-draft-<RUNID>.md` (+ the
> drafted chapters to `"${ROOT:?}/.audit/handover-draft-<RUNID>.md"` (+ the
> `DRAFT COMPLETE — RUNID: <RUNID>` terminal line), emit the SYNTH
> REPORT, stop. Everything below (STEP 13-16) is `MODE: render` and
> operates ON that draft.
+8 -5
View File
@@ -214,8 +214,8 @@ RULE: IF "simple" OR "hotfix":
→ recommend the lightweight skill only (see Skill routing by task size); a REQUEST-only
signal drives no SET and no DISABLE (both are project-wide, persistent)
RULE: IF "embedded" signal (firmware, bare-metal, microcontroller, or Makefile+C without Node/Rust/Go):
→ all packs off (profile `minimal`)
RULE: IF "embedded" signal from a project-level probe (`platformio.ini`, linker script, or Makefile+C without Node/Rust/Go):
→ all packs off (profile `minimal`, `↻ SET : minimal`)
→ superpowers skills stay on (vendored, no toggle): useful for initial
design brainstorm on complex drivers, unnecessary for single-function
patches; just don't invoke them, no disable needed
@@ -223,6 +223,9 @@ RULE: IF "embedded" signal (firmware, bare-metal, microcontroller, or Makefile+C
→ Recommend workflow: /analyze <file> → /hotfix (patch) or /bugfix (investigation) or /ship-feature (multi-file)
→ NOTE: print "embedded project detected — minimal plugin footprint recommended"
RULE: IF "embedded" keywords appear in the REQUEST only (firmware, bare-metal, microcontroller, driver, kernel…), no project-level probe:
→ NOTE only, no SET and no DISABLE (both are project-wide, persistent)
RULE: IF `browser-qa` signal (e2e tests, Playwright/Cypress/Puppeteer in deps):
→ pack gstack-browser ON — browser automation and QA
→ ctx7 CLI OPTIONAL (depends on framework version)
@@ -260,7 +263,7 @@ the command. Never write files directly.
| one pack off | — | `⚠️ DISABLE : … — disable <pack or full plugin id>` |
`<pack>` is one of design, scroll3d, seo, web-validate, gstack-dev,
gstack-browser, gstack-design, higgsfield, extras. Managed plugins take
gstack-browser, gstack-design, higgsfield. Managed plugins take
their full id, never the bare name: `ui-ux-pro-max@ui-ux-pro-max-skill`,
`pr-review-toolkit@claude-code-plugins`.
@@ -278,7 +281,7 @@ generation service; explicit user ask only (CLAUDE.md "Skill routing").
## BLOCK if
- Superpowers skills missing → `make plugin` (vendors them) then `make link`
- Superpowers skills missing → run `make plugin` in your claude-config checkout (vendors them) then `make link`
## WARN (no block)
@@ -286,7 +289,7 @@ generation service; explicit user ask only (CLAUDE.md "Skill routing").
- Multi-session feature + `gsd` CLI not installed → `npm install -g gsd-pi`
- **Next.js/React 18+/Prisma/Supabase detected + context7 not configured**
→ Risk: Claude may generate code using outdated APIs (App Router changes frequently)
→ Fix: `npm install -g ctx7` (`make plugin` from the claude-config repo pins the version and wires find-docs)
→ Fix: `npm install -g ctx7` (`make plugin` in your claude-config checkout installs ctx7 (latest, plugins.lock.json pins `latest`) and wires find-docs)
→ Or standalone: `ctx7 docs /vercel/next.js "middleware"`
→ Free higher rate limits: `ctx7 login` (OAuth) or API key from context7.com/dashboard
→ Type "force" to proceed without context7 (not recommended for fast-evolving libs)
+8 -7
View File
@@ -687,16 +687,17 @@ else
fi
if command -v graphify &>/dev/null; then
_graphify_ok=1
info "Running graphify install (dependencies)..."
info "Running graphify install (appends its block to ~/.claude/CLAUDE.md; the exit trap reverts the repo copy)..."
graphify install 2>/dev/null || { warn "graphify install failed — run manually"; _graphify_ok=0; }
info "Configuring Claude Code integration..."
info "Running graphify claude install (CLAUDE.md block + PreToolUse hook; the exit trap reverts both)..."
(cd "$REPO" && graphify claude install) 2>/dev/null || warn "graphify claude install failed"
# Success message gated on the real outcome (LRN-071 class: an
# unconditional ok after `|| warn` lies when a step failed).
# The message below is gated on `graphify install` only (LRN-071 class:
# an unconditional ok after `|| warn` lies when a step failed); `graphify
# claude install` just warns, the trap reverts what it wrote.
if [ "$_graphify_ok" -eq 1 ]; then
ok "Graphify configured for Claude Code"
ok "Graphify installed (its CLAUDE.md block and hook reverted by the guard)"
else
warn "Graphify NOT fully configured — re-run the failed step manually"
warn "Graphify install failed — re-run it manually"
fi
fi
echo ""
@@ -1268,7 +1269,7 @@ echo " 🔄 gsd v2 — standalone CLI 'gsd' (gsd-pi, not a Claud
echo " 🔄 pr-review-toolkit — /review-pr + 6 PR agents (~2.2k tokens when enabled) [claude-code-plugins]"
echo " 🔄 ui-ux-pro-max — user scope (~780 tokens when enabled)"
echo " 🔄 context7 CLI — ctx7 (npm global, standalone or MCP setup)"
echo " 🔄 graphifyy (CLI: graphify) — codebase knowledge graph (pipx, PreToolUse hook)"
echo " 🔄 graphifyy (CLI: graphify) — codebase knowledge graph (pipx; its CLAUDE.md block and hook are reverted by the guard)"
echo " 🔄 emil-design-eng — UI polish, animations, component craft (curl → symlink)"
echo " 🔄 frontend-design — distinctive frontend interfaces, anti-AI-slop (anthropic-agent-skills)"
echo " 🔄 impeccable — /impeccable design verbs + 61-rule deterministic detector (npx impeccable detect)"
+27 -20
View File
@@ -41,24 +41,28 @@ PROBE REPORT (ground truth — do not re-detect):
Show the returned PLUGIN CHECK block. The advisor emits tokens only; the
main loop builds every command from the fixed templates of step 5, never
pastes the advisor's text into a shell. Before running ANY command (the
step-4 diff included) check each token: a profile name is one of the advisor's own set
(web, seo, dev, design, qa, audit, minimal; never `full`, `max` or a
pastes the advisor's text into a shell. A PROJECT_ROOT holding `'`, a
newline or a control character is never substituted into a template: print
the commands with the root shown as `'<root>'` and a warning that the
user must quote it by hand, and run nothing. Before running ANY command (the step-4 diff
included) check each token: a profile name is one of the advisor's own
set (web, seo, dev, design, qa, audit, minimal; never `full`, `max` or a
user-added profile) and matches `^[a-z0-9][a-z0-9-]*$` with an existing
`$HOME/.claude/lib/profiles/<name>.json`;
a pack is one of design, scroll3d, seo, web-validate, gstack-dev,
gstack-browser, gstack-design, extras (`higgsfield` is never accepted from an
advisor token: paid service, explicit user ask only); a plugin is one of the
two managed full ids `ui-ux-pro-max@ui-ux-pro-max-skill`,
`pr-review-toolkit@claude-code-plugins`. A token matching none is printed as
rejected and skipped, never run.
`$HOME/.claude/lib/profiles/<name>.json`; a pack is one of design, scroll3d,
seo, web-validate, gstack-dev, gstack-browser, gstack-design (`higgsfield`
and `extras` are never accepted from an advisor token: paid or
credit-metered services, explicit user ask only, `profile.sh enable extras`
by hand); a plugin is one of the two managed full ids
`ui-ux-pro-max@ui-ux-pro-max-skill`, `pr-review-toolkit@claude-code-plugins`.
A token matching none is printed as rejected and skipped, never run.
For a `↻ SET <profile>` line run
`bash "$HOME/.claude/lib/profile.sh" -C "<PROJECT_ROOT>" diff "<profile>"` and
`bash "$HOME/.claude/lib/profile.sh" -C '<PROJECT_ROOT>' diff '<profile>'` and
print its `→ off` lines under it as "turns off" (none → "turns off: nothing")
and its `→ on` lines as "turns on" (none → "turns on: nothing").
The diff exits non-zero on a bad name, an unknown profile or a missing
profiles dir: on any non-zero exit print "turns off: unknown" and continue.
- `ACTION REQUIRED? YES` → offer: A) fix plugins B) type "force". STOP until
- `ACTION REQUIRED? YES` → offer: A) fix plugins (print "run `make plugin`
in your claude-config checkout", run nothing) B) type "force". STOP until
answered.
- OK → print `✅ Plugin check passed — [active plugins] — complexity: <score>%`.
@@ -66,10 +70,13 @@ profiles dir: on any non-zero exit print "turns off: unknown" and continue.
Trigger: a `↻ SET`, `⚡ ENABLE` or `⚠️ DISABLE` line. Under `source=flag`
(`PROFILE :` block) the advisor emits only `relaunch: cc <name> <profile>`:
nothing is applied. Apply only when
`git -C "<PROJECT_ROOT>" rev-parse --show-toplevel` equals PROJECT_ROOT;
otherwise print the commands and apply nothing ("no git root yet: run them
after git init").
nothing is applied. Apply only when the parent of
`git -C '<PROJECT_ROOT>' rev-parse --path-format=absolute --git-common-dir`
(the root profile.sh writes at, same in a linked worktree) equals
PROJECT_ROOT and PROJECT_ROOT is not `$HOME`;
otherwise print the commands and apply nothing, naming the cause: no git
root yet (run them after git init), a linked worktree or submodule, or
PROJECT_ROOT is `$HOME`.
1. List the changes, saying they are project-wide and persist in
`<PROJECT_ROOT>/.claude/settings.local.json`:
```
@@ -82,9 +89,9 @@ after git init").
```
2. "yes" → run the changes in order, the SET first, then the deltas (after
"customize" too). Each one is
`bash "$HOME/.claude/lib/profile.sh" -C "<PROJECT_ROOT>" set "<name>"`,
`... enable "<pack | full plugin id>"` or
`... disable "<pack | full plugin id>"` (same prefix). Each call
`bash "$HOME/.claude/lib/profile.sh" -C '<PROJECT_ROOT>' set '<name>'`,
`... enable '<pack | full plugin id>'` or
`... disable '<pack | full plugin id>'` (same prefix). Each call
writes `.claude/settings.local.json` atomically or refuses (rc 2, nothing
written): stop at the first non-zero rc, print its stderr, and continue
with the current config. "customize" → user picks. "no" → proceed with
@@ -93,7 +100,7 @@ after git init").
/reload-plugins to load the packs in this session (connectors and model:
next session).` Say the change is project-wide and persists in
`<PROJECT_ROOT>/.claude/settings.local.json`. Print the undo: after a SET:
`bash "$HOME/.claude/lib/profile.sh" -C "<PROJECT_ROOT>" unset`, after
`bash "$HOME/.claude/lib/profile.sh" -C '<PROJECT_ROOT>' unset`, after
deltas the inverse enable / disable.
**Never auto-activate without showing the list and getting confirmation.
+10 -3
View File
@@ -37,8 +37,8 @@
# and the statusline (supersedes `show --plain`, BDR-024).
#
# Exit: 0 ok · 2 usage, unknown profile or pack, not a project root (no
# CLAUDE.md and no .git), unreadable or invalid local JSON; nothing
# is written on any refusal.
# CLAUDE.md and no .git), refusing $HOME as the project root,
# unreadable or invalid local JSON; nothing is written on any refusal.
# ============================================================
set -euo pipefail
@@ -70,6 +70,12 @@ home_or_above() { # $1 dir
case "$HOME/" in "$1"/*) return 0 ;; esac
return 1
}
is_home() { # $1 dir: same physical dir as $HOME (symlinks resolved)
local d h
d="$(cd -P "$1" 2>/dev/null && pwd -P)" || return 1
h="$(cd -P "$HOME" 2>/dev/null && pwd -P)" || return 1
[ "$d" = "$h" ]
}
git_root() { # $1 dir → parent of the git common dir, unless $HOME or above
local common root
common="$(git -C "$1" rev-parse --path-format=absolute --git-common-dir \
@@ -82,7 +88,7 @@ git_root() { # $1 dir → parent of the git common dir, unless $HOME or above
find_root() { # $1 dir → the project root (see header)
local d="$1"
git_root "$d" && return 0
while [ "$d" != / ] && [ "$d" != "$HOME" ]; do
while [ "$d" != / ] && ! is_home "$d"; do
if [ -d "$d/.claude" ] || [ -f "$d/CLAUDE.md" ] || [ -e "$d/.git" ]; then
echo "$d"; return 0
fi
@@ -91,6 +97,7 @@ find_root() { # $1 dir → the project root (see header)
echo "$1"
}
require_project_root() {
is_home "$PROJECT" && die "refusing \$HOME as the project root: $PROJECT"
[ -f "$PROJECT/CLAUDE.md" ] || [ -e "$PROJECT/.git" ] \
|| die "not a project root (no CLAUDE.md and no .git): $PROJECT"
}
+7
View File
@@ -178,6 +178,13 @@ check T26-home-rc "$rc" 0
check T26-home-local "$([ -f "$H2/work/.claude/settings.local.json" ] && echo yes)" yes
check T26-home-not-root "$([ -e "$H2/.claude" ] && echo leaked)" ""
# a root that is $HOME (even through a symlink) is refused, rc 2, nothing written
H3="$FX/home3"; mkdir -p "$H3"; printf '# h\n' > "$H3/CLAUDE.md"; ln -s "$H3" "$FX/home3-link"
out="$(HOME="$FX/home3-link" PX "$H3" set devx 2>&1)"; rc=$?
check T27-home-root-rc "$rc" 2
check_has T27-home-root-msg "$out" "refusing \$HOME as the project root"
check T27-home-root-nothing "$([ -e "$H3/.claude" ] && echo leaked)" ""
# timing: two jq calls, under 100 ms here (spec target 50 ms, measured in Task 12)
t0=$(date +%s%N); P current --plain >/dev/null; t1=$(date +%s%N)
ms=$(( (t1 - t0) / 1000000 )); echo "current --plain: ${ms} ms"
+2 -2
View File
@@ -163,8 +163,8 @@ check SB10-gate-vocab "$(gone lib/plugin-gate.md \
'Pre-fetch ctx7|Enable ui-ux-pro-max \(')" 1
gate="$(cat "$ROOT/lib/plugin-gate.md")"
check SB10-gate-diff "$(has "$gate" 'profile.sh" -C')" 1
check SB10-gate-diff2 "$(has "$gate" 'diff "<profile>"')" 1
check SB10-gate-root "$(has "$gate" 'rev-parse --show-toplevel')" 1
check SB10-gate-diff2 "$(has "$gate" "diff '<profile>'")" 1
check SB10-gate-root "$(has "$gate" '--git-common-dir')" 1
check SB10-gate-rejected "$(has "$gate" 'rejected')" 1
check SB10-gate-quoted "$(gone lib/plugin-gate.md '-C <PROJECT_ROOT>')" 1
check SB10-advisor-fullid "$(has "$(cat "$ROOT/agents/plugin-advisor.md")" \
+1 -1
View File
@@ -34,7 +34,7 @@
"source": "pypi:graphifyy",
"version": "latest",
"managed_by": "pipx",
"note": "Codebase knowledge graph. CLI is 'graphify'. Install: pipx install graphifyy && graphify install && graphify claude install. Adds PreToolUse hook for Glob/Grep. pipx/PyPI ONLY — never npm/npx: a different publisher (rhanka/graphify) squats the same 'graphifyy' name on npm, a version-shadowing shim with its own conflicting 'graphify' bin."
"note": "Codebase knowledge graph. CLI is 'graphify'. Install: `make plugin` (pipx install graphifyy, then graphify install and graphify claude install; the installer's exit trap reverts the CLAUDE.md block and PreToolUse hook it writes into the repo). pipx/PyPI ONLY — never npm/npx: a different publisher (rhanka/graphify) squats the same 'graphifyy' name on npm, a version-shadowing shim with its own conflicting 'graphify' bin."
},
"semgrep": {
"source": "pypi:semgrep",
+3 -1
View File
@@ -40,7 +40,9 @@ so the user does not assume Claude has hung.
## STEP 0 — PLUGIN CHECK + AUTO-ACTIVATE
Run `$HOME/.claude/lib/plugin-gate.md`. Feed request (dispatch plugin-probe →
checkpoint → dispatch plugin-advisor; gates stay in this loop — BDR-077).
- ACTION REQUIRED → show RECOMMENDATIONS block, offer: A) fix plugins B) type "force". STOP.
- ACTION REQUIRED → show RECOMMENDATIONS block, offer: A) fix plugins
(print "run `make plugin` in your claude-config checkout", run nothing)
B) type "force". STOP.
- PROPOSED CHANGES exist → show list, ask "Apply? (yes / no / customize)". Apply on confirm.
- OK → `✅ Plugin check passed — [active plugins] — complexity: <score>%`, continue.
+21 -18
View File
@@ -252,7 +252,7 @@ Pour chaque fast-lib détectée :
⚠️ ctx7 non installé — risque de code utilisant des APIs obsolètes
sur : [liste fast-libs]
Install : `npm install -g ctx7`
Version épinglée et find-docs : `make plugin` depuis le dépôt claude-config
Installe ctx7 (latest, plugins.lock.json pin `latest`) et find-docs : `make plugin` depuis le dépôt claude-config
Ou continuer sans (non recommandé pour fast-libs).
```
Demander : `yes install now / continue without / skip audit`.
@@ -384,12 +384,12 @@ passer ce chemin dans chaque brief d'audit.
|---|---|---|
| `analyze` | Déjà fait en STEP 5 | L3a |
| `code-clean` | Spawn subagent `general-purpose` (audit-only, `model="opus"`, `effort="xhigh"` — BDR-076: dispatched audits off the session model) | L3a |
| `cso` | Si gstack ON → Skill(cso). Sinon → Agent general-purpose avec checklist OWASP + deps audit | L3a |
| `cso` | Si `pack gstack-dev on` → Skill(cso). Sinon → Agent general-purpose avec checklist OWASP + deps audit | L3a |
| `doc` | Spawn subagent `doc-syncer` (auto-mode OFF, report-only) | L3a |
| `seo` | Subagents seo-analyzer + geo-analyzer en parallèle | L3b |
| `design-review` | Si gstack ON → Skill design-review. Sinon → Agent ui-ux-pro-max context statique | L3b |
| `perf` | Si gstack ON + URL → Lighthouse. Sinon → static bundle audit | L3b |
| `a11y` | Si gstack ON + URL → axe-core. Sinon → Agent static a11y audit | L3b |
| `design-review` | Si `pack gstack-design on` → Skill design-review. Sinon → Agent ui-ux-pro-max context statique | L3b |
| `perf` | Si `pack gstack-browser on` + URL → Lighthouse. Sinon → static bundle audit | L3b |
| `a11y` | Si `pack gstack-browser on` + URL → axe-core. Sinon → Agent static a11y audit | L3b |
### STEP 6 dispatch (L3a portion)
@@ -423,17 +423,17 @@ Agent(
**Décision selon plugin state :**
```bash
# gstack actif ?
# pack gstack-dev actif ? (`profile.sh current`)
bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -q '^pack-gstack-dev=on'
```
- **gstack ON** → invoquer le skill cso via Skill tool en lui passant le contexte archétype :
- **`pack gstack-dev on`** → invoquer le skill cso via Skill tool en lui passant le contexte archétype :
```
Skill(skill="cso", args="comprehensive --report-only --output .onboard-audit/cso.md --archetype <archetype> --context-file .onboard-audit/archetype-context.md")
```
Note : le skill cso écrit son rapport lui-même ; on redirige via `--output` si supporté, sinon on capture la sortie et on écrit `.onboard-audit/cso.md` dans le skill parent. Les flags `--archetype` / `--context-file` informent le skill même s'il ne les consomme pas nativement (lisibilité + compat future).
- **gstack OFF** → fallback via Agent general-purpose, prompt **archetype-adaptive** :
- **`pack gstack-dev off`** → fallback via Agent general-purpose, prompt **archetype-adaptive** :
```
Agent(
subagent_type="general-purpose",
@@ -530,7 +530,7 @@ bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -
En complément de cso (ON) OU du fallback (OFF) — un moteur SAST déterministe
à côté de l'audit grep/raisonné. cso est un submodule gstack non modifiable ;
semgrep vit dans cet agent local. Lancé dans les DEUX branches gstack.
semgrep vit dans cet agent local. Lancé dans les DEUX branches (pack gstack-dev on / off).
```
Agent(
@@ -547,7 +547,8 @@ Agent(
)
```
Si semgrep absent → l'agent rend DEGRADED (checklist seule) + recommande
`make plugin` ; NON bloquant en onboard (audit, pas gate).
`make plugin` (dans ton checkout claude-config) ; NON bloquant en
onboard (audit, pas gate).
**Onboard n'a PAS de boucle verify→dev (`lib/verify-secure-loop.md`) — par
conception.** onboard produit un RAPPORT d'audit, pas une modification à
@@ -607,8 +608,10 @@ Options :
Pré-check ressources navigateur :
```bash
# gstack actif ?
# pack gstack-browser actif ?
bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -q '^pack-gstack-browser=on'
# pack gstack-design actif ? (condition du dispatch design-review)
bash "$HOME"/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -q '^pack-gstack-design=on'
# URL déployée fournie par l'utilisateur en STEP 3 ?
echo "${BRIEF_deployed_url:-none}"
# dev server launchable ?
@@ -636,7 +639,7 @@ Agent(
- Core Web Vitals (estimé si pas d'URL live)
- headings hierarchy, alt attrs, images formats
- i18n / lang attribute
Si URL live fournie AND gstack actif: utiliser les outils live.
Si URL live fournie AND `pack gstack-browser on`: utiliser les outils live.
Sinon: audit statique sur le code (HTML templates, Astro pages, Next Metadata API, etc.).
Write report to `<PROJECT_ROOT>/.onboard-audit/seo.md`.
Structure sections par catégorie, chaque issue cite fichier:ligne + sévérité.
@@ -670,7 +673,7 @@ Agent(
#### Dispatch design-review (si `design-review` dans audit_stack)
**Cas gstack ON + URL live OU dev server launchable :**
**Cas `pack gstack-design on` + URL live OU dev server launchable :**
```
Skill(
skill="design-review",
@@ -679,7 +682,7 @@ Skill(
```
Si le skill ne supporte pas `--output`, capturer la sortie et écrire à la main vers `.onboard-audit/design.md`.
**Cas gstack OFF OU pas de site déployable (ex: react-spa sans dev server):**
**Cas `pack gstack-design off` OU pas de site déployable (ex: react-spa sans dev server):**
```
Agent(
subagent_type="general-purpose",
@@ -703,7 +706,7 @@ Agent(
8. Interactions : focus visible, hover states, disabled states
9. Micro-interactions (billboard design ? transform scale(0.97) on :active ?)
Write report to `<PROJECT_ROOT>/.onboard-audit/design.md`.
Note en haut : "STATIC MODE — gstack inactif ou pas de dev server ; audit limité au code."
Note en haut : "STATIC MODE — pack gstack-design off ou pas de dev server ; audit limité au code."
Max 500 lignes. Cite fichier:ligne.
"""
)
@@ -715,7 +718,7 @@ Agent(
#### Dispatch perf (si `perf` dans audit_stack)
**Cas gstack ON + URL live :**
**Cas `pack gstack-browser on` + URL live :**
```
Skill(
skill="browse",
@@ -724,7 +727,7 @@ Skill(
```
Puis parser le JSON Lighthouse (scores perf/a11y/bp/seo/pwa + top opportunities) → écrire `.onboard-audit/perf.md`.
**Cas gstack OFF OU pas d'URL :**
**Cas `pack gstack-browser off` OU pas d'URL :**
```
Agent(
subagent_type="general-purpose",
@@ -759,7 +762,7 @@ Agent(
#### Dispatch a11y (si `a11y` dans audit_stack)
**Cas gstack ON + URL live :**
**Cas `pack gstack-browser on` + URL live :**
```
Skill(
skill="browse",
+7 -3
View File
@@ -13,9 +13,13 @@ dispatched, gates in this loop).
/plugin-check is READ-ONLY advisory: SKIP the gate's step 5 (apply) — show
the commands the main loop builds from the gate's step-5 templates (`set` /
`enable` / `disable`, with `-C "<PROJECT_ROOT>"`), after the gate's token
check, for the user instead. Never write: the user runs them (`lib/profile.sh` `set <profile>` / `enable <pack>` writes the
project's `.claude/settings.local.json`, never the user scope).
`enable` / `disable`, with `-C '<PROJECT_ROOT>'`), after the gate's token
check, for the user instead. A PROJECT_ROOT holding `'`, a newline or a
control character is never substituted: print the commands with the root shown as `'<root>'` and a warning that
the user must quote it by hand, run nothing.
Never write: the user runs them
(`lib/profile.sh` `set <profile>` / `enable <pack>` writes the project's
`.claude/settings.local.json`, never the user scope).
If `$HOME/.claude/lib/plugin-gate.md` unreachable: emit `Plugin gate include
missing.` and STOP.
+3 -1
View File
@@ -24,7 +24,9 @@ $ARGUMENTS
## STEP 0 — PLUGIN CHECK + AUTO-ACTIVATE
Run `$HOME/.claude/lib/plugin-gate.md`. Feed request (dispatch plugin-probe →
checkpoint → dispatch plugin-advisor; gates stay in this loop — BDR-077).
- ACTION REQUIRED → show RECOMMENDATIONS block, offer: A) fix plugins B) type "force". STOP.
- ACTION REQUIRED → show RECOMMENDATIONS block, offer: A) fix plugins
(print "run `make plugin` in your claude-config checkout", run nothing)
B) type "force". STOP.
- PROPOSED CHANGES exist → show list, ask "Apply? (yes / no / customize)". Apply on confirm.
- OK → `✅ Plugin check passed — [active plugins] — complexity: <score>%`, continue.
+3 -2
View File
@@ -152,8 +152,9 @@ honestly in the summary. Never loop past 3.
```
semgrep ABSENT → DEGRADED (checklist only) is surfaced in the
report, not a silent downgrade and not a blocker.
2. gstack ON (`/cso` available) → **iteration 1 only**, dispatch a cso
posture audit (deps CVE, OWASP) in audit mode; fold its findings in.
2. `pack gstack-dev on` (`profile.sh current`; `/cso` available) →
**iteration 1 only**, dispatch a cso posture audit (deps CVE, OWASP)
in audit mode; fold its findings in.
3. Fix policy (skip in `--report-only`): CRITICAL/HIGH → fix now.
MEDIUM/LOW → fix only if local and behavior-preserving, else leave
`open`. Every fix minimal, CLAUDE.md security defaults apply.
+3 -2
View File
@@ -308,8 +308,9 @@ else
fi
# NOT updated here, deliberately (audit 2026-07-02):
# - graphify Claude integration (`graphify claude install`): rewrites curated
# CLAUDE.md / .claude/settings.json (BDR-028 guard territory) — re-run
# MANUALLY only if a graphify upgrade changes its hook format.
# CLAUDE.md / .claude/settings.json (BDR-028 guard territory) — run
# `make plugin` in your claude-config checkout (its exit trap reverts the
# drift); never run `graphify claude install` by hand.
# - gsd: pinned in plugins.lock.json — Step 4 reinstalls the PIN, it does not
# advance it. Bump the lock deliberately, then re-run.