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:
1 parent
a967fd93dc
commit
77041e5360
17 files changed
+192
-98
No files matched your search
@@ -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).
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user