From 94ce345aa2833f7f69f233a78268e684be53b570 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 2 Nov 2026 11:48:46 +0100 Subject: [PATCH] docs(phase5): higgsfield citers, MIGRATION fenced steps + real-dir impeccable, gate header, /profile allowed-tools, wording --- CHANGELOG.md | 5 ++- MIGRATION.md | 67 +++++++++++++++++++++--------- README.md | 12 +++--- USAGE.md | 2 +- hooks/session-start.sh | 3 +- hooks/statusline.sh | 9 ++-- lib/design-gate.md | 12 +++--- lib/design-tool-gate.sh | 18 ++++---- lib/plugin-gate.md | 10 ++--- lib/tests/design-tool-gate.test.sh | 2 +- link.sh | 5 +-- skills/profile/SKILL.md | 3 ++ 12 files changed, 93 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8434a8a..b682c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project ### Added - **Secure-by-default guardrails**: `rules/secure-by-default.md` (always on) makes six domains baseline on every project (the Supabase and cloud-function detail lives in the path rules `rules/supabase.md` and `rules/cloud-functions.md`), plus systematic API and access hygiene (auth on every route, CORS, secrets, passwords hashed with argon2id or bcrypt, never compared in clear, logged or hardcoded): hosting (rate limit, CDN and firewall, hard spend cap), Supabase (RLS on every table, owner-scoped policies, no service role key client-side), SMS and email (recorded consent, unsubscribe, STOP), cloud functions (no self-trigger, instance cap, budget stop), injection (bound values in raw escapes, `format()` for dynamic SQL, allowlisted filters, no shell into a DB tool), exposure (no data in the console, no production source map, no debug flag, no secret in hydrated state, data attributes, hidden fields or shipped comments). `/guardrails` audits them: a stdlib Python scanner (`skills/guardrails/scripts/scan.py`, FAIL / WARN / MANUAL, exit 1 on FAIL) then judgment, report in `.claude/audits/GUARDRAILS.md`. The security-auditor gate runs the scanner's `api` and `supabase` domains and blocks on FAIL. Items only a provider dashboard can set stay MANUAL, never claimed done. An optional read-only live probe (`skills/guardrails/scripts/probe.py`, `--live`) confirms a finding from outside on a target the user owns and names: anon-read, cross-user, no-auth route, CORS reflection and a capped rate-limit burst, verdicts OPEN / CLOSED / SKIPPED / ERROR. An `exposure` block in the plan adds three read-only probes, meant for a production build or a staging URL: a served or inline source map for the page's scripts, a stack trace in a 404 or a user-named error route, sensitive keys in a JSON response (identifier-shaped names printed, never values); a target the probe could not observe is SKIPPED or ERROR, never CLOSED, and every plan path must start with `/`. It sends GET, HEAD and OPTIONS only (one opt-in POST burst, capped at 25), requires `--authorized`, takes secrets from the environment never the command line, never follows a redirect to another host, and stops at a request budget. After the report, `/guardrails` proposes fixes (plan phase, so Fable when the router can switch), applies only the ones the user accepts through the `bugfixer` executor and the `lib/verify-secure-loop.md` gates, then re-scans: each accepted fix is a contract criterion whose oracle is the scanner (`--assert-absent RULE:path`, marker `GUARDRAILS-CLEAR`), and a full pass against the pre-fix baseline (`--baseline`, marker `GUARDRAILS-NO-NEW`) catches regressions; a live probe replays on the user's go; two rounds at most, residuals reported open; `--report-only` keeps the audit alone. Suites: `lib/tests/guardrails-scan.test.sh` (clean fixture plus one mutant per rule, check modes, `gates.sh` integration) and `lib/tests/guardrails-probe.test.sh` (probe logic against a localhost fixture server). -- **/a11y skill**: accessibility leaves `/guardrails` and becomes its own skill. Same A11Y-* rules (img alt, field label, click without keyboard, focus outline removed, positive tabindex) on the shared scan engine (`skills/guardrails/scripts/scanner.py`, a `Catalogue` per CLI; `skills/a11y/scripts/scan.py`, markers `A11Y-CLEAR` / `A11Y-NO-NEW`), a Tab-only walk of the main flow on `--live` through `/browse` (marked not done otherwise), report `.claude/audits/A11Y.md`, fixes proposed with the alt and label wording as the user's choice, applied through the bugfix circuit (`bugfixer`, verify-secure gates, `bugfix/a11y-`), re-pass against a baseline. The keyboard, alt and label doctrine moves from `rules/secure-by-default.md` to the lazy `rules/a11y.md` (loads on UI files only; `rules/web-building.md` points at it). `/guardrails` scans `injection` (INJ-*) and `exposure` (EXP-*) instead, with per-language SQL patterns, shared `code_files` / `hits` / `dedupe_lines` / `client_reachable` helpers and a walker that lists files over 1 MB by path; `--domain a11y` is a usage error there. `/web-validate` keeps full WCAG conformance. Suite `lib/tests/a11y-scan.test.sh`; routing row `reflect`; profiles audit, dev, web, web-full, full, max. +- **/a11y skill**: accessibility leaves `/guardrails` and becomes its own skill. Same A11Y-* rules (img alt, field label, click without keyboard, focus outline removed, positive tabindex) on the shared scan engine (`skills/guardrails/scripts/scanner.py`, a `Catalogue` per CLI; `skills/a11y/scripts/scan.py`, markers `A11Y-CLEAR` / `A11Y-NO-NEW`), a Tab-only walk of the main flow on `--live` through `/browse` (marked not done otherwise), report `.claude/audits/A11Y.md`, fixes proposed with the alt and label wording as the user's choice, applied through the bugfix circuit (`bugfixer`, verify-secure gates, `bugfix/a11y-`), re-pass against a baseline. The keyboard, alt and label doctrine moves from `rules/secure-by-default.md` to the lazy `rules/a11y.md` (loads on UI files only; `rules/web-building.md` points at it). `/guardrails` scans `injection` (INJ-*) and `exposure` (EXP-*) instead, with per-language SQL patterns, shared `code_files` / `hits` / `dedupe_lines` / `client_reachable` helpers and a walker that lists files over 1 MB by path; `--domain a11y` is a usage error there. `/web-validate` keeps full WCAG conformance. Suite `lib/tests/a11y-scan.test.sh`; routing row `reflect`; profiles audit, dev, web, full, max. - **model-router mod**: `mods/model-router/`, a Claude Code mod (function-hooks plugin), routes every repo skill and agent from phase rows (`plan`, `reflect`, `orchestrate`, `escalate`, `judge`, `audit`, `implement`, `write`, `verify`, `explore`, `apply`, `mechanical`; built-ins Explore on sonnet/medium, Plan on opus/xhigh). A typed skill routes the main loop to its row, and a best-tier row holds across turns in a run slot until `/route clear`, `/route off`, a user `/model` or a typed skill on a non-best row. Agents get their row's model at spawn (within the tier, upward only) and its effort on every step; explicit Agent params win. Orchestrators declare their phases through the `mcp__model-router__route` tool. `ultrathink` in a prompt sets the turn's minimum effort and `/route effort=max` holds until `/route clear`; the built-in `/effort` is not a lever inside a run. `/route show` names the run slot (`main: run `), and a `null` row in the override drops a default row. The model gets a `route` tool and the user a `/route` command (`show|clear|off|on|reload|pending|ask on|off|forget ||model= effort=|switch on|off|verbose on|off`). Optional per-machine config `~/.claude/model-router.json`, where `"enabled": false` turns it off on that machine. The spinner suffix and the status line show the route in force. It loads in every session through the tracked symlink `skills/model-router` (`model-router@skills-dir`). `make doctor` gains a Mods section; suite `make test suite=lib/tests/mods.test.sh`. Known limits: a main-loop switch (a `/model` hand pick excepted) runs only while the cold read it costs (the context minus what the target model's prompt cache holds) fits `upgradeMaxTokens` (200000) or `downgradeMaxTokens` (120000), and a downgrade also needs `mainModelSwitch` (on by default, off on any non-boolean value); the hooks send full model ids, so the `models` table has to follow new versions. - **model-router first-use confirmation**: `mods/model-router/routing.json` (tracked) is the single source of the phase table and of every skill and agent row, and keeps the decisions: `confirmed`, `changed` (`from`/`to`), `projects` exceptions keyed by the origin remote reduced to `host/path` (credentials and local paths never stored), and `ask`. The first use of a rowed typed skill, a rowed agent spawn or a main-loop phase declared through the `route` tool opens a dialog with context: the skill's description (first sentence of its `SKILL.md` frontmatter) or the agent's, the phase with its `about` line (a new field on each of the 12 phases) and the model id and effort the next step really runs on. A row offers Later, Keep or Change; a main-loop phase Later or Keep. Change asks the model (fable, opus, sonnet, haiku with their tier), then the effort among those the phases of that model use (skipped when there is only one), then Everywhere or This project only; the pair maps to an existing phase (rows stay phase names, the same phase counts as Keep, a pair no phase offers is added by hand as a new phase). A skill-row change toasts the model and effort it now runs on, with the `/route switch on` hint when the main loop holds back a downgrade; a free-text answer counts as Later. One dialog at a time, never in headless (`-p`) runs or inside a sub-agent. Only a dialog answer, `/route ask on|off` or `/route forget` (which takes decisions back; a changed row returns to its shipped phase, the frontmatter floors stay yours to realign) writes the file (serialized, 64 KiB cap, never created when absent); each write asks you to commit it from the config repo. `/route pending` lists unconfirmed rows and phases. Layers: routing.json < `~/.claude/model-router.json` (its `ask` wins); a project's `.claude/model-router.json` is never read. Tests: `mods/model-router/hooks/register.test.ts`. - **model-router `/model` scope**: a `/model ` typed in the composer, or a pick in the `/model` picker, with a model the table knows asks where it applies. The picker's switch is held first (PreModelSwitch deny; the engine prints that a hook blocked it); a pick while another dialog is open is refused with `answer the open dialog first`. This project writes the full id as `model` into the project's `.claude/settings.local.json` (created if absent, refused through a link) and sets a sticky model route. This conversation sets the sticky route only. Everywhere runs the native `/model` (user `settings.json`). Both non-native answers drop the run slot and keep a sticky effort. With the picker's Default, an unknown name, a headless run or another origin, the native command runs with no question. A model chosen in that dialog always switches: it bypasses the cold-read caps and the `mainUpgrade` / `mainModelSwitch` flags, and while it is marked down or outside a known window it waits and the automatic chain decides. A native switch or `/clear` drops it; `/route model=` keeps the caps. Known limits: the `/config` Model row still writes user `settings.json`; a dialog never answered has no timeout. Tests: `mods/model-router/hooks/register.test.ts`. @@ -23,6 +23,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project - **Architecture defaults carrier**: `lib/architecture-defaults.md`, read before proposing a stack (new project, scaffolding, stack brainstorm, whole-project rewrite): public sites never SPA, Rust by default, web APIs versioned. Path rules `rules/supabase.md` and `rules/cloud-functions.md` hold the full Supabase and cloud-function domains. Suites `lib/tests/user-rules.test.sh` and `lib/tests/doctor-automem.test.sh`. - **Packs**: nine skills-dir packs under `skills/pack-/` (design, scroll3d, seo, web-validate, gstack-dev, gstack-browser, gstack-design, higgsfield, extras), each a manifest plus tracked symlinks into `skills-external/`. The installers only fill `skills-external/`; a pack is on or off as a unit. `lib/pack-census.sh` checks the packs (every skill linked once, targets resolve, doc citers) and runs in `make test`. - **Profiles as settings fragments**: `lib/profiles/.json` replaces the flat-link profiles. `lib/profile.sh` verbs: `set`, `enable`, `disable`, `current` (`--plain` for hooks), `list`; `-C ` targets a project, `make profile cmd="set X" dir=/path` and `make profile-current dir=/path`. A project with no local profile runs the manifest defaults (= `full`). +- Nine profiles: `full`, `max`, `minimal`, `dev`, `design`, `web`, `seo`, `qa`, `audit`. `backend` (= `dev`) and `web-full` (= `full`) were identical fragments and are gone; the census refuses two equal fragments. - **`cc [profile]`**: `lib/cc.sh`, sourced from `~/.bashrc`, starts a conversation under a profile fragment through `--settings`. - The design gate, the plugin gate and advisor, the statusline, the session banner and `doctor.sh` read `profile.sh current --plain`. `doctor.sh` gains Packs and Profiles sections and checks that `cc.sh` is sourced. @@ -51,7 +52,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project - `settings.json` sets `"autoMemoryEnabled": false`. `make doctor` gains an Auto memory section (the setting, plus leftover files under `~/.claude/projects/*/memory/`) and checks the `~/.claude/rules` symlink (8 links). The session-start health check includes `rules`. - `lib/tests/doctrine-citers.test.sh`: the file-citation census also reads nested `lib//` paths, `~/.claude/` and `$HOME/.claude/` prefixes (mapped to this repo) and `templates/project-rules/`; a bare `.claude/rules/` citation resolves by citer (this repo's own rules from `.claude/rules/` or `rules/`, else `templates/project-rules/`); T6 also scans `templates/` and `.claude/rules/`, T3 keeps its roots. - `link.sh` no longer links the design and scroll skills flat; impeccable moves to `skills-external/impeccable`. Docs and routing (`CLAUDE.global.md`, `/profile`, README, USAGE, ARCHITECTURE) speak packs. -- Known limit: `cc x web` on a project in `dev` keeps the higgsfield connectors that `dev` denies (`deniedMcpServers` is a union); `profile.sh set web` in the project lifts them. +- Known limit: `cc x web` on a project in `dev` keeps them denied (`deniedMcpServers` is a union); `profile.sh set web` in the project lifts them. - Measured headless on 2026-11-02: dev = `pack-gstack-dev`, 41 tools, 0 higgsfield; web = the six web packs, 199 tools, both connectors `connected` and 158 higgsfield tools listed in init (the stderr line "blocked by enterprise policy: claude.ai higgsfield, claude.ai Higgsfield AI" appeared on the deny profiles dev, qa, seo and minimal: that is `deniedMcpServers` working); qa = `pack-gstack-browser pack-web-validate`; seo = qa + `pack-gstack-dev pack-seo`; qa and seo 41 tools, 0 higgsfield; reload canary in one flagless session (id `ee65507c-a958-411b-9580-8aca8105e326`): `/seo` unavailable on minimal, `profile.sh enable seo`, `/reload-plugins` -> "Reloaded: 3 plugins · 2 skills · 32 agents · 7 hooks", then `/seo` and `/pack-seo:seo` both load the SEO skill. `profile.sh current --plain` median 30 ms (target 50). - Listing budget with the packs: measured headless on 2026-11-02 with `--model haiku` (name-only skills, entries 124 on full, 90 on dev): full default 58, 40000 11, 50000 0, 60000 0; dev default 9, 40000 and above 0. Set `SLASH_COMMAND_TOOL_CHAR_BUDGET=50000` in `settings.json` `env`, the smallest tested value with 0 name-only on full. Cost, estimated: full (48.5k - 30.3k bytes) / 4, about 4.5k tokens; dev 30.0k to 36.8k bytes, about 1.7k tokens. `env` is global, so every profile pays. Descriptions are no longer truncated at 50000 (natural size 48.5k). The default budget's absolute value was not read; it may depend on the model's context window. diff --git a/MIGRATION.md b/MIGRATION.md index d75f99c..17190f5 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -201,26 +201,55 @@ make doctor ### Profiles and packs (2026-11) Run on every machine that pulls this version (the live tree may still be in -an old profile). Step 3 is the only one that removes a real directory -(`make plugin` runs `rm -rf skills-external/impeccable` before the move). +an old profile). Run steps 1 and 2 before any commit on that machine: the +removed `.gitignore` lines expose the old links as untracked files. Step 3 +is the only one that removes a real directory (`make plugin` replaces +`skills-external/impeccable` on a refresh); steps 1 and 2 use `mv`, never +`rm -r`. + +1. From the repo root. `git pull --autostash` (a plain `git pull` aborts + when `settings.json` is modified locally and the incoming commits touch + it; autostash keeps your UI writes), then restore the user-scope plugins + the old `profile.sh` had toggled. Never `git checkout -- settings.json`: + it would drop your UI writes. + + ```bash + cd ~/.claude + git pull --autostash + ep="$(mktemp)"; next="$(mktemp)" + git show HEAD:settings.json | jq .enabledPlugins > "$ep" + jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0]' settings.json > "$next" + cp "$next" settings.json; rm -f "$ep" "$next" + ``` + +2. Old layout. List the flat links first, then remove the links of + `skills-disabled/` and the links of `skills/` that are not kept + (model-router, darwin-skill, the seven superpowers, the agent-skills + trio). If `skills/impeccable` or `skills-disabled/impeccable` is a real + directory, `mv` it to `skills-external/impeccable` (never `rm`). + + ```bash + cd ~/.claude + find skills skills-disabled -maxdepth 1 -type l + mkdir -p skills-external + for d in skills skills-disabled; do + if [ -d "$d/impeccable" ] && [ ! -L "$d/impeccable" ] \ + && [ ! -e skills-external/impeccable ]; then + mv "$d/impeccable" skills-external/impeccable + fi + done + find skills-disabled -maxdepth 1 -type l -delete + find skills -maxdepth 1 -type l \ + ! -name model-router ! -name darwin-skill \ + ! -name observability-and-instrumentation \ + ! -name deprecation-and-migration ! -name ci-cd-and-automation \ + ! -name brainstorming ! -name writing-plans \ + ! -name subagent-driven-development ! -name test-driven-development \ + ! -name requesting-code-review ! -name using-git-worktrees \ + ! -name writing-skills -delete + rmdir skills-disabled; rm -f .active-profile + ``` -1. From the repo root (`cd ~/.claude`): `git pull --autostash` (a plain - `git pull` aborts when `settings.json` is modified locally and the - incoming commits touch it; autostash keeps your UI writes), then restore - the user-scope plugins the old `profile.sh` had toggled: - `ep="$(mktemp)"; next="$(mktemp)"; git show HEAD:settings.json | jq - .enabledPlugins > "$ep" && jq --slurpfile ep "$ep" '.enabledPlugins = - $ep[0]' settings.json > "$next" && cp "$next" settings.json; rm -f "$ep" - "$next"` (never `git checkout -- settings.json`: it would drop your UI - writes). -2. Old layout: `find skills skills-disabled -maxdepth 1 -type l` lists the - flat links; remove every `skills-disabled/` link, and in `skills/` - everything except model-router - (the tracked link to `mods/model-router`), darwin-skill, - the seven superpowers and the agent-skills trio. If - `skills-disabled/impeccable` is a directory: `mv skills-disabled/impeccable - skills-external/impeccable`. Then `rmdir skills-disabled; rm -f - .active-profile`. 3. `make link` (link.sh no longer links the design and scroll skills flat), `make plugin` (fills `skills-external/`; impeccable ends in `skills-external/impeccable`). diff --git a/README.md b/README.md index f205ac9..bb0f9c1 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ ctx7 login # optional: OAuth / API key for higher rate limits | Component | Type | Description | Docs | |---|---|---|---| | **Superpowers skills** | Vendored (7, always on) | brainstorming, writing-plans, subagent-driven development, TDD, code review request, git worktrees, writing-skills — pinned v6.4.1 in plugins.lock.json, no plugin, no session injection | [obra/superpowers](https://github.com/obra/superpowers) | -| **GStack** | Git submodule (per profile) | Product workflow skills: plan reviews, design, browser QA, security (`cso`), `health`. Linked by pack-gstack-dev, pack-gstack-browser and pack-gstack-design; 9 broken or doctrine-breaking skills are denylisted in `lib/gstack-removed.sh`. | [garrytan/gstack](https://github.com/garrytan/gstack) | +| **GStack** | Git submodule (per profile) | Product workflow skills: plan reviews, design, browser QA, security (`cso`), `health`. Linked by pack-gstack-dev, pack-gstack-browser and pack-gstack-design; 9 broken or doctrine-breaking skills are denylisted in `lib/gstack-removed.list`. | [garrytan/gstack](https://github.com/garrytan/gstack) | | **GSD v2** | External CLI | Multi-session orchestration: crash recovery, cost tracking, parallel workers, context-fresh execution. | [gsd-build/gsd-2](https://github.com/gsd-build/gsd-2) | | **RTK** | CLI + hook (always on) | Rust Token Killer: the `hooks/rtk-rewrite.sh` PreToolUse hook rewrites Bash commands through `rtk` to cut output tokens. Zero passive cost. | [rtk-ai/rtk](https://github.com/rtk-ai/rtk) | | **security-guidance** | Plugin (always on) | Security hook. Regex layer and commit/push review on; the Stop-time diff review is off (`ENABLE_STOP_REVIEW=0`). | [anthropics/claude-code](https://github.com/anthropics/claude-code) | @@ -382,8 +382,8 @@ npm i -g @21st-dev/cli an interactive terminal) and installs the skill pack that drives it: `21st-ui-build`, `-ui-explore`, `-ui-review`, `-cli-use`, `-ai`, plus the publishing skills `-registry`, `-design-sync` and `-video`. `21st-ui-build` -and `21st-cli-use` sit in pack-design (on under `full`, `design`, `web` and -`web-full`). `-ui-explore`, `-ui-review` and `-ai` sit in pack-extras (on +and `21st-cli-use` sit in pack-design (on under `full`, `design` and +`web`). `-ui-explore`, `-ui-review` and `-ai` sit in pack-extras (on under `max`, or after `bash lib/profile.sh enable extras`). `-registry`, `-design-sync` and `-video` stay unlinked in `skills-external/`. @@ -423,7 +423,7 @@ The copies are machine-owned and gitignored. They follow upstream `main`, so a prompt change arrives with no diff to review, and a skill that upstream removes keeps its last local copy. -The pack is off by default and belongs to no profile. It costs nothing until +The pack is off by default and on in `max` only. It costs nothing until you ask for it: ```bash @@ -434,7 +434,7 @@ bash lib/profile.sh disable higgsfield The pack (`skills/pack-higgsfield/skills/`) holds the 8 `higgsfield-*` skills. -`higgsfield-websites` is kept apart. It helps with landing pages inside the +`higgsfield-websites` is one of them. It helps with landing pages inside the design stack (assets, references), and `higgsfield website create|deploy|publish` stays unused. Claude runs `bash lib/profile.sh enable higgsfield` on a named media ask, then `/reload-plugins` (Skill routing in `CLAUDE.global.md`) and checks the price @@ -477,7 +477,7 @@ make scan-secrets [repos="…"] # gitleaks sweep of this repo's history and ~/. make help # list make targets make onboard # onboard an existing project (run from its dir) make seo-connect # connect a Google account for /seo FULL (OAuth consent) -make profile cmd="set X" dir=/path/to/project # activate a skill profile (web/seo/web-full/full/max/backend/design/dev/qa/audit/minimal) +make profile cmd="set X" dir=/path/to/project # activate a skill profile (web/seo/full/max/design/dev/qa/audit/minimal) make profile-list # list skill profiles make profile-current dir=/path/to/project # effective profile of this project and conversation make new-skill name=myskill # scaffold agent + skill files diff --git a/USAGE.md b/USAGE.md index a273652..87faef3 100644 --- a/USAGE.md +++ b/USAGE.md @@ -214,7 +214,7 @@ Hotfix/quick fix → tout OFF (skills superpowers vendorisés, toujours **GSD v2** n'est pas un plugin Claude Code — c'est un CLI externe. Il ne consomme pas de tokens passifs. Tu le lances dans un terminal séparé avec `gsd`, puis `/gsd auto` pour le mode autonome. -**Profils et packs.** Un profil se règle par projet (`/profile set web` puis `/reload-plugins`) ou par conversation (`cc web`, la conversation est figée: relance-la pour changer). Sans profil, c'est `full`. Un `--settings` édité en cours de session reste sans effet. `cc x web` sur un projet en `dev` garde les connecteurs higgsfield refusés (union); `set web` dans le projet les rend. +**Profils et packs.** Un profil se règle par projet (`/profile set web` puis `/reload-plugins`) ou par conversation (`cc web`, la conversation est figée: relance-la pour changer). Neuf profils: `full`, `max`, `minimal`, `dev`, `design`, `web`, `seo`, `qa`, `audit`. Sans profil, c'est `full`. Un `--settings` édité en cours de session reste sans effet. `cc x web` sur un projet en `dev` garde les connecteurs higgsfield refusés (union); `set web` dans le projet les rend. --- diff --git a/hooks/session-start.sh b/hooks/session-start.sh index 7d7195a..79a0b3e 100644 --- a/hooks/session-start.sh +++ b/hooks/session-start.sh @@ -65,7 +65,8 @@ unset _gg_lib # ── Toggle plugin detection ── # One profile.sh run, shared with detect_gstack through PROFILE_PLAIN. -PROFILE_PLAIN="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null)" || PROFILE_PLAIN="" +PROFILE_PLAIN="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current \ + --plain 2>/dev/null)" || PROFILE_PLAIN="" export PROFILE_PLAIN TOGGLE_ACTIVE=() diff --git a/hooks/statusline.sh b/hooks/statusline.sh index 53b8a7d..fb5ad28 100755 --- a/hooks/statusline.sh +++ b/hooks/statusline.sh @@ -6,7 +6,8 @@ INPUT=$(cat) MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "?"') DIR=$(echo "$INPUT" | jq -r '.cwd // "?"') -PROJ=$(echo "$INPUT" | jq -r '.workspace.project_dir // .cwd // "."' 2>/dev/null) +PROJ=$(echo "$INPUT" \ + | jq -r '.workspace.project_dir // .cwd // "."' 2>/dev/null) FOLDER="${DIR##*/}" PCT=$(echo "$INPUT" | jq -r \ '.context_window.used_percentage // 0' \ @@ -24,10 +25,12 @@ REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Profile of this project and conversation: `profile.sh current --plain` # (two jq calls) on the session's project dir. `(conv)` = a --settings # conversation. Any failure -> "?". -_plain="$(bash "$REPO/lib/profile.sh" -C "$PROJ" current --plain 2>/dev/null)" || _plain="" +_plain="$(bash "$REPO/lib/profile.sh" -C "$PROJ" current --plain \ + 2>/dev/null)" || _plain="" PROFILE="$(sed -n 's/^profile=//p' <<<"$_plain" | head -1)" [ -n "$PROFILE" ] || PROFILE="?" -[ "$(sed -n 's/^source=//p' <<<"$_plain" | head -1)" = flag ] && PROFILE="$PROFILE (conv)" +_src="$(sed -n 's/^source=//p' <<<"$_plain" | head -1)" +[ "$_src" = flag ] && PROFILE="$PROFILE (conv)" # Effort level: the live value when the harness exports it (skill/agent # `effort:` shifts included, BDR-107), else the persisted settings.json key diff --git a/lib/design-gate.md b/lib/design-gate.md index 5bc06f7..cd22927 100644 --- a/lib/design-gate.md +++ b/lib/design-gate.md @@ -66,11 +66,13 @@ Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it) design toolchain: INCOMPLETE off: pack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill - → run: bash ~/.claude/lib/profile.sh set web (or: enable design) + → run: bash ~/.claude/lib/profile.sh set web + or: bash ~/.claude/lib/profile.sh enable design + or: bash ~/.claude/lib/profile.sh enable ui-ux-pro-max@ui-ux-pro-max-skill then /reload-plugins - - **source=local or default** → `profile.sh set web` (or `enable design`), - then `/reload-plugins`. + - **source=local or default** → `profile.sh set web`, or one `profile.sh + enable ` per entry listed as off, then `/reload-plugins`. - **source=flag** (the conversation runs under `claude --settings`, frozen) → relaunch it with a design profile: `cc web`. - **the `21st` CLI TRIPS the gate** when absent (required for Build), it is @@ -191,9 +193,9 @@ or profile, never a lone tool. ## IMPORTANT -- Remedy is ALWAYS the printed line (`profile.sh set web` / `enable design` +- Remedy is ALWAYS the printed line (`profile.sh set web` / `enable ` + `/reload-plugins`, or `cc web` under a flag), never an atomic - tool toggle — `current --plain` is the single source of what's active. + tool toggle; `current --plain` is the single source of what's active. - the `21st` CLI is REQUIRED (it trips the gate) and no profile can install it — the gate names the two commands; surface them to the user. Signed out → exit 12: ask `! 21st login`, wait, re-run; explicit opt-out diff --git a/lib/design-tool-gate.sh b/lib/design-tool-gate.sh index 0186d0a..cab3e96 100755 --- a/lib/design-tool-gate.sh +++ b/lib/design-tool-gate.sh @@ -13,8 +13,9 @@ # 11 ready-but-unverified (21st could not answer) · 12 sign-in # required · 2 error (profile.sh failed or gave no pack lines). # Remedy on 10: source=flag → relaunch `cc web` (a --settings -# conversation is frozen); else `profile.sh set web` (or `enable design`) -# then /reload-plugins. The CLI is a global npm install either way. +# conversation is frozen); else `profile.sh set web`, or `enable ` / +# `enable ` per missing entry, then /reload-plugins. The CLI is +# a global npm install either way. # READY also needs the packs to resolve: every skills/pack-/skills/* # entry of pack-design and pack-gstack-design must have a SKILL.md. # Usage: design-tool-gate.sh (no argument; env DESIGN_GATE_PROFILE_SH, @@ -29,11 +30,8 @@ NEEDED=(pack-design pack-gstack-design "plugin:ui-ux-pro-max@ui-ux-pro-max-skill") # ---- 21st CLI on PATH + sign-in state --------------------------------------- -# Same sanitized-PATH problem for `21st` (an npm global bin): a PATH repair -# for the 21st CLI only (claude is no longer called here). The npm global -# bin dir is often missing from a hook's PATH. Probe for the binary directly -# and prepend the dir that has it, otherwise a perfectly installed CLI reads -# as "missing" and trips the gate. +# A hook's PATH often lacks the npm global bin dir: find `21st` there and +# prepend its dir, or an installed CLI reads as missing and trips the gate. ensure_21st_on_path() { command -v 21st >/dev/null 2>&1 && return local cand @@ -125,8 +123,10 @@ print_remedy() { echo " → run: bash ~/.claude/lib/profile.sh set web" for k in "${missing[@]}"; do case "$k" in - pack-*) echo " or: profile.sh enable ${k#pack-}" ;; - *) echo " (enable the plugin in a profile: set web)" ;; + pack-*) + echo " or: bash ~/.claude/lib/profile.sh enable ${k#pack-}" ;; + *) + echo " or: bash ~/.claude/lib/profile.sh enable ${k#plugin:}" ;; esac done echo " then /reload-plugins" diff --git a/lib/plugin-gate.md b/lib/plugin-gate.md index 1983981..6bffbf1 100644 --- a/lib/plugin-gate.md +++ b/lib/plugin-gate.md @@ -12,15 +12,15 @@ Agent(subagent_type="plugin-probe", description="plugin gate — probe", prompt="Run your probes from . Emit the PROBE REPORT.") ``` -## 2. VALIDATION CHECKPOINT (main loop — between probe and reasoner) +## 2. VALIDATION CHECKPOINT (main loop: between probe and reasoner) Validate the PROBE REPORT before any reasoning: - `PROFILE` block holds a `profile=` line. - At least one project signal present (MANIFESTS / FRAMEWORK-DEPS / TSX-JSX-COUNT > 0 / DOCKER-COUNT > 0 / EMBEDDED hits). Else print - `⚠️ No project signals detected — recommendations will be conservative.` + `⚠️ No project signals detected: recommendations will be conservative.` and continue. -- `CHECKPOINT profile-sh=UNAVAILABLE` → print `⚠️ profile.sh unavailable — +- `CHECKPOINT profile-sh=UNAVAILABLE` → print `⚠️ profile.sh unavailable: recommendations will be advisory only, no auto-activation.` and SKIP step 5 (apply) entirely. - PROBE REPORT missing/unparsable → retry the probe ONCE fresh; a 2nd @@ -44,7 +44,7 @@ Show the returned PLUGIN CHECK block. answered. - OK → print `✅ Plugin check passed — [active plugins] — complexity: %`. -## 5. APPLY GATE (main loop — only when the flow auto-activates) +## 5. APPLY GATE (main loop: only when the flow auto-activates) If any plugin has ⚡ ENABLE status: 1. List the changes: @@ -60,7 +60,7 @@ If any plugin has ⚡ ENABLE status: refuses (rc 2, nothing written), so there is nothing to roll back: stop at the first non-zero rc, print its stderr, and continue with the current config. "customize" → user picks. "no" → proceed with current config. -3. After a successful write print `✅ Applied N change(s) — run +3. After a successful write print `✅ Applied N change(s): run /reload-plugins to load the packs in this session (connectors and model: next session).` In a `--settings` conversation (`PROFILE :` block says `source=flag`) the advisor emits no enable for a pack the flag turns off; diff --git a/lib/tests/design-tool-gate.test.sh b/lib/tests/design-tool-gate.test.sh index c388c74..72a7130 100755 --- a/lib/tests/design-tool-gate.test.sh +++ b/lib/tests/design-tool-gate.test.sh @@ -55,7 +55,7 @@ plain on off off flag dev; out="$(gate_run in "$WORK/bin")"; rc=$? expect T3-remedy-flag 10 "relaunch this conversation with a design profile: cc web" expect T3-names 10 "off: pack-gstack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill" plain on on off local web; out="$(gate_run in "$WORK/bin")"; rc=$? -expect T3a-plugin 10 "enable the plugin in a profile: set web" +expect T3a-plugin 10 "profile.sh enable ui-ux-pro-max@ui-ux-pro-max-skill" plain on on on local web mkdir -p "$WORK/repo/skills/pack-design/skills" ln -s /nonexistent "$WORK/repo/skills/pack-design/skills/x" diff --git a/link.sh b/link.sh index 3fa1bf6..5fee1c1 100644 --- a/link.sh +++ b/link.sh @@ -72,9 +72,8 @@ else echo "⚠️ GStack submodule not found — run: git submodule update --init" fi -# impeccable is NOT here: its installer writes the skill straight into -# skills/ (and its agents into agents/) at --scope=global, so there is no -# skills-external/ copy to symlink. See install-plugins.sh Step 8d. +# impeccable is NOT here: it lives in skills-external/impeccable (moved +# there by install-plugins.sh Step 8d) and pack-design links it. # The design and scroll skills are pack symlinks now (skills/pack-*). EXTERNAL_SKILLS=(observability-and-instrumentation deprecation-and-migration ci-cd-and-automation brainstorming writing-plans diff --git a/skills/profile/SKILL.md b/skills/profile/SKILL.md index 107e9a6..06c98f7 100644 --- a/skills/profile/SKILL.md +++ b/skills/profile/SKILL.md @@ -10,6 +10,9 @@ description: | "active profile", "quel profil", "profil design", "active les skills design", "enable higgsfield", "désactive gstack", "réduire le listing". argument-hint: list | show | current | set | unset | enable | disable | diff +allowed-tools: + - Bash + - Read --- # /profile — packs per project and per conversation