aiblueprint-cli 1.4.107 → 1.4.109
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/README.md +10 -3
- package/agents-config/claude-config/mods/agent4everything/.claude-plugin/plugin.json +5 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/register.ts +96 -0
- package/agents-config/claude-config/mods/aiblueprint/.claude-plugin/plugin.json +71 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/register.tsx +309 -0
- package/agents-config/claude-config/mods/aiblueprint/tests/band.test.tsx +74 -0
- package/agents-config/claude-config/mods/aiblueprint/types/index.d.ts +14 -0
- package/agents-config/claude-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/claude-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/skills/agents-manager/SKILL.md +15 -453
- package/agents-config/skills/apex/SKILL.md +14 -110
- package/agents-config/skills/app-icon/SKILL.md +22 -117
- package/agents-config/skills/appstore-connect/SKILL.md +22 -85
- package/agents-config/skills/audit-memories/SKILL.md +13 -139
- package/agents-config/skills/audit-skills/SKILL.md +6 -65
- package/agents-config/skills/environments-manager/SKILL.md +14 -238
- package/agents-config/skills/grill-me/SKILL.md +8 -22
- package/agents-config/skills/hooks-manager/SKILL.md +8 -54
- package/agents-config/skills/rules-manager/SKILL.md +11 -192
- package/agents-config/skills/skill-manager/SKILL.md +19 -158
- package/agents-config/skills/skill-manager/references/description-recommandation.md +15 -85
- package/agents-config/skills/test-audit/CAMPAIGN.md +117 -0
- package/agents-config/skills/test-audit/LICENSE +23 -0
- package/agents-config/skills/test-audit/SKILL.md +169 -0
- package/agents-config/skills/test-audit/agents/openai.yaml +10 -0
- package/agents-config/skills/test-audit/assets/codex-icon.svg +1 -0
- package/agents-config/skills/use-style/SKILL.md +8 -48
- package/dist/cli.js +1182 -1107
- package/package.json +1 -1
|
@@ -5,75 +5,16 @@ argument-hint: "[audit|fix] [project-root]"
|
|
|
5
5
|
disable-model-invocation: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Audit skill discovery cost and placement from current files plus observable Codex and Claude session evidence. Treat missing telemetry as uncertainty, not proof that a skill has never been useful.
|
|
11
|
-
|
|
12
|
-
## Invocation guard
|
|
13
|
-
|
|
14
|
-
Proceed only when the current user message explicitly invokes `$audit-skills`.
|
|
15
|
-
|
|
16
|
-
- `$audit-skills audit [project-root]`: produce a read-only audit. This is the default.
|
|
17
|
-
- `$audit-skills fix [project-root]`: audit first, then apply only high-confidence corrections.
|
|
18
|
-
|
|
19
|
-
Resolve `project-root` from the argument or current repository. Preserve unrelated dirty changes and record Git status for every modified repository.
|
|
20
|
-
|
|
21
|
-
## Audit
|
|
22
|
-
|
|
23
|
-
Run the deterministic inventory as a bounded job:
|
|
8
|
+
Proceed only on an explicit `$audit-skills` invocation. Default `audit`; `fix` applies only high-confidence corrections after the ledger exists. Resolve `project-root` from the argument or current repo. Preserve unrelated dirty changes.
|
|
24
9
|
|
|
25
10
|
```bash
|
|
26
|
-
bun ~/.agents/skills/audit-skills/scripts/audit-skills.mjs
|
|
27
|
-
--project "$PWD" \
|
|
28
|
-
--format markdown
|
|
11
|
+
bun ~/.agents/skills/audit-skills/scripts/audit-skills.mjs --project "$PWD" --format markdown
|
|
29
12
|
```
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- explicit user references such as `$skill-name` or `/skill-name`;
|
|
34
|
-
- Claude `Skill` tool calls;
|
|
35
|
-
- agent reads of a matching `SKILL.md`;
|
|
36
|
-
- working directories associated with observed use;
|
|
37
|
-
- Claude `disable-model-invocation` and Codex `policy.allow_implicit_invocation` controls;
|
|
38
|
-
- name collisions and hardcoded project-root references.
|
|
39
|
-
|
|
40
|
-
Report these evidence classes separately:
|
|
41
|
-
|
|
42
|
-
- `OBSERVED_USER`: explicitly named by a user in scanned history;
|
|
43
|
-
- `OBSERVED_MODEL`: loaded or invoked by an agent in scanned history;
|
|
44
|
-
- `UNOBSERVED`: no matching evidence in scanned sources;
|
|
45
|
-
- `EXPLICIT_ONLY`: protected for both Claude and Codex;
|
|
46
|
-
- `INVOCATION_MISMATCH`: protected on only one platform;
|
|
47
|
-
- `LOCALITY_CANDIDATE`: global skill with a project-specific runtime dependency or at least two observed uses confined to one project;
|
|
48
|
-
- `NAME_COLLISION`: same skill name discovered globally and locally.
|
|
49
|
-
|
|
50
|
-
Include scan coverage and limitations. Cursor ACP stores are opaque blobs and are not counted unless a reliable parser becomes available. Never label `UNOBSERVED` as “never used” without naming the scanned time range and sources.
|
|
51
|
-
|
|
52
|
-
## Fix
|
|
53
|
-
|
|
54
|
-
Apply changes only after the audit ledger exists.
|
|
55
|
-
|
|
56
|
-
Safe automatic corrections:
|
|
57
|
-
|
|
58
|
-
1. Mirror an existing explicit-only decision across platforms: add `disable-model-invocation: true` when Codex already blocks implicit invocation, or add `policy.allow_implicit_invocation: false` when Claude already blocks it.
|
|
59
|
-
2. Mark a skill explicit-only when its own instructions already require direct user invocation but one or both platform controls are missing.
|
|
60
|
-
3. Repair metadata made stale by a move or rename.
|
|
61
|
-
|
|
62
|
-
Require explicit user direction or a project-specific runtime dependency before moving a skill between scopes. Multiple uses confined to one project justify review, not automatic relocation; a single observed use is insufficient evidence.
|
|
63
|
-
|
|
64
|
-
When moving a skill:
|
|
65
|
-
|
|
66
|
-
1. copy the complete directory, including scripts, references, assets, and `agents/openai.yaml`;
|
|
67
|
-
2. rewrite absolute self-paths and dependencies to their new canonical locations;
|
|
68
|
-
3. validate the destination before removing the source;
|
|
69
|
-
4. use `trash` for source removal;
|
|
70
|
-
5. search all skill roots and plugin/profile metadata for stale references;
|
|
71
|
-
6. confirm the name is discovered exactly once in the intended scope.
|
|
72
|
-
|
|
73
|
-
For unobserved skills, recommend rather than mutate unless their own text clearly establishes user-only intent. Rarely used incident, security, recovery, and migration skills remain protected from usage-only pruning.
|
|
14
|
+
Report every inventoried skill with scan coverage and one evidence class: `OBSERVED_USER`, `OBSERVED_MODEL`, `UNOBSERVED`, `EXPLICIT_ONLY`, `INVOCATION_MISMATCH`, `LOCALITY_CANDIDATE`, `NAME_COLLISION`. Cursor ACP stores are opaque. Do not label `UNOBSERVED` as never used without naming the scanned range.
|
|
74
15
|
|
|
75
|
-
|
|
16
|
+
Safe automatic fixes: mirror an existing explicit-only decision across Claude/Codex; add missing explicit-only controls when the skill text already requires direct invocation; repair stale move/rename metadata. Move a skill between scopes only with explicit user direction or a project-specific runtime dependency. Copy the full directory, rewrite self-paths, validate, `trash` the source, then confirm the name is discovered once.
|
|
76
17
|
|
|
77
|
-
|
|
18
|
+
Recommend rather than mutate unobserved skills. Protect incident, security, recovery, and migration skills from usage-only pruning.
|
|
78
19
|
|
|
79
|
-
|
|
20
|
+
Done when every skill has a row, every recommendation cites evidence, and — on `fix` — touched skills validate and Git status distinguishes this run.
|
|
@@ -1,195 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: environments-manager
|
|
3
3
|
description: Set up per-worktree environments for Claude Code, Cursor, or Codex. Use for worktree-ready repos, IDE environment config, worktree-up/down scripts, or dev.sh wiring.
|
|
4
|
-
disable-model-invocation:
|
|
5
|
-
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Ask before writing. Use the host's question UI. Shared logic lives in `scripts/*.sh`; IDE configs only point at those files. Read a matching `examples/` file before writing, then adapt.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
1. Ask what a fresh worktree should do (multi-select): copy ignored env files; install deps; isolate or seed a data backend; run codegen. Capture extra project steps in one follow-up.
|
|
11
|
+
2. Ask the backend. PostgreSQL → [postgresql.md](references/postgresql.md). Convex → [convex.md](references/convex.md). None → skip isolation. Any other backend: research official docs and an in-repo example; do not guess CLI flags; summarize before editing.
|
|
12
|
+
3. Ask which IDEs to wire (Claude Code, Cursor, Codex). Generate `scripts/` once. Then load [claude.md](references/claude.md), [cursor.md](references/cursor.md), and/or [codex.md](references/codex.md) for linking config only.
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Required files: `scripts/worktree-up.sh`, `scripts/worktree-down.sh`, `scripts/dev.sh` (all must end in `.sh`). Put them on the source checkout, not only the current worktree.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
Resolve paths as `WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"` and `SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-}}"`. Claude: use `WorktreeCreate`, never `SessionStart`; the wrapper adds the worktree then runs `worktree-up.sh` with `ROOT_WORKTREE_PATH` — see [claude.md](references/claude.md). Hook wrappers must survive a missing `/dev/tty`, a wrong default Node version, and CLI prompts.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
`worktree-up.sh` is idempotent: `set -euo pipefail`, cd to the worktree, then the selected steps in order. Prefer `.worktreeinclude` for Claude env copy. Detect the lockfile for install. Read resource names from env/config or setup metadata; never invent them from branch names. Provide a reset escape hatch via `<PROJECT>_RESET_<RESOURCE>=1`.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
`worktree-down.sh` cleans only resources this setup created. Missing tools: print one line and exit 0.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
`dev.sh` picks a free port from `${DEV_PORT_START:-3910}`. Never hardcode a port.
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
| :--- | :--- |
|
|
24
|
-
| Copy ignored env files from the source checkout | Copy `.env`, `.env.local`, `.env.development.local` when the source has them and the worktree does not. For Claude Code, prefer `.worktreeinclude` when possible. |
|
|
25
|
-
| Install dependencies | `pnpm install`, `bun install`, `yarn install`, or `npm install` based on lockfile. |
|
|
26
|
-
| Isolate or seed a data backend | Load the backend reference when it exists. Otherwise use researcher agents to discover the project's backend, docs, and current best setup pattern before writing scripts. |
|
|
27
|
-
| Run codegen | Project-specific codegen such as Prisma, Drizzle, Convex, generated types, or SDK generation. |
|
|
28
|
-
|
|
29
|
-
If the user has project-specific steps such as seed data, S3/R2 sync, local services, webhook tunnels, fixture generation, or env cloning, ask one follow-up free-form question to capture them.
|
|
30
|
-
|
|
31
|
-
### Step 2: Which data backend, if any?
|
|
32
|
-
|
|
33
|
-
Ask which backend needs worktree isolation or seeding. Use the answer to decide which reference to load:
|
|
34
|
-
|
|
35
|
-
| Backend | Action |
|
|
36
|
-
| :--- | :--- |
|
|
37
|
-
| None | Keep setup to env copy, install, codegen, and dev scripts. |
|
|
38
|
-
| PostgreSQL | Load `references/postgresql.md`. |
|
|
39
|
-
| Convex | Load `references/convex.md`. |
|
|
40
|
-
| Other SQL or non-SQL backend | Use researcher agents to inspect the repo, official docs, and current CLI behavior. Then write a narrow project-specific approach instead of adapting PostgreSQL or Convex by analogy. |
|
|
41
|
-
|
|
42
|
-
For unknown backends, do not guess commands, reset behavior, file formats, import/export semantics, or production-safety flags. Ask researcher agents to find the official docs and at least one in-repo example or closely matching project pattern. Summarize the discovered approach before editing scripts.
|
|
43
|
-
|
|
44
|
-
### Step 3: Which IDEs should be wired up?
|
|
45
|
-
|
|
46
|
-
Ask a multi-select with options: Claude Code, Cursor, Codex. The user can pick any combination. Generate the shared `scripts/` directory once.
|
|
47
|
-
|
|
48
|
-
### Step 4: Apply each selected IDE
|
|
49
|
-
|
|
50
|
-
For each selected IDE, read the matching reference file and apply only its linking config. Do not duplicate script logic in IDE config; the IDE config points at `scripts/worktree-up.sh`, `scripts/worktree-down.sh`, and `scripts/dev.sh`.
|
|
51
|
-
|
|
52
|
-
- Claude Code -> load `references/claude.md`
|
|
53
|
-
- Cursor -> load `references/cursor.md`
|
|
54
|
-
- Codex -> load `references/codex.md`
|
|
55
|
-
|
|
56
|
-
## Shared Shape
|
|
57
|
-
|
|
58
|
-
Every project that uses this skill ends up with:
|
|
59
|
-
|
|
60
|
-
```text
|
|
61
|
-
scripts/
|
|
62
|
-
├── worktree-up.sh # idempotent setup
|
|
63
|
-
├── worktree-down.sh # cleanup before worktree teardown
|
|
64
|
-
├── dev.sh # start dev server on a free port
|
|
65
|
-
└── (project-specific helpers, all *.sh)
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Plus one or more IDE config files. The IDE config is thin; all logic lives in `scripts/`.
|
|
69
|
-
|
|
70
|
-
Naming convention: every generated script MUST end in `.sh`. No bare `worktree-up`, no `dev`. IDE configs reference scripts by full filename (`scripts/worktree-up.sh`, not `scripts/worktree-up`). This is enforced in every reference file and example.
|
|
71
|
-
|
|
72
|
-
## Environment Variable Cascade
|
|
73
|
-
|
|
74
|
-
Each IDE exposes different variables. The shared scripts accept all of them, in this priority:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
78
|
-
SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-}}"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
| Platform | Worktree path | Source checkout path | Setup trigger |
|
|
82
|
-
| :--- | :--- | :--- | :--- |
|
|
83
|
-
| Codex | `$CODEX_WORKTREE_PATH` | `$CODEX_SOURCE_TREE_PATH` | `[setup] script` in TOML, runs once per worktree. |
|
|
84
|
-
| Cursor | `pwd` inside worktree | `$ROOT_WORKTREE_PATH` | `setup-worktree-unix` in JSON, runs once per worktree. |
|
|
85
|
-
| Claude | `pwd` inside worktree after wrapper `cd` | `$CLAUDE_PROJECT_DIR` from the hook, re-exported as `ROOT_WORKTREE_PATH` by the wrapper | `WorktreeCreate` hook, runs once per worktree. |
|
|
86
|
-
|
|
87
|
-
Important about Claude Code: do not use `SessionStart` for setup; it fires every session. Use the `WorktreeCreate` hook, which fires once when `claude --worktree` creates the worktree. The Claude wrapper script (`scripts/claude-worktree-create.sh`) is responsible for calling `git worktree add` itself, then handing off to `scripts/worktree-up.sh` inside the new worktree with `ROOT_WORKTREE_PATH` set. See `references/claude.md`.
|
|
88
|
-
|
|
89
|
-
If no env var yields a source checkout, fall back to a project-specific absolute path only when you can infer it confidently. Otherwise ask the user during Step 1.
|
|
90
|
-
|
|
91
|
-
## `scripts/worktree-up.sh`
|
|
92
|
-
|
|
93
|
-
Setup must be idempotent: reruns are safe. Build the script from the user's Step 1 selections and any backend reference loaded in Step 2. Required behavior in order:
|
|
94
|
-
|
|
95
|
-
1. `set -euo pipefail`.
|
|
96
|
-
2. Resolve `WORKTREE_PATH` and `SOURCE_PATH`.
|
|
97
|
-
3. `cd "$WORKTREE_PATH"`.
|
|
98
|
-
4. If env copying was selected, copy `.env`, `.env.local`, `.env.development.local` only when the source has them and the worktree does not.
|
|
99
|
-
5. If dependency install was selected, detect the lockfile and run the matching install.
|
|
100
|
-
6. If backend isolation/seeding was selected, apply the backend reference or the researched project-specific approach.
|
|
101
|
-
7. If codegen was selected, run the project's codegen command.
|
|
102
|
-
8. Append any free-form project-specific steps from Step 1.
|
|
103
|
-
|
|
104
|
-
Base template, before backend-specific additions:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
#!/usr/bin/env bash
|
|
108
|
-
set -euo pipefail
|
|
109
|
-
|
|
110
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
111
|
-
SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-$HOME/Developer/projects/<repo>}}"
|
|
112
|
-
|
|
113
|
-
cd "$WORKTREE_PATH"
|
|
114
|
-
|
|
115
|
-
# Copy ignored env files.
|
|
116
|
-
# NOTE for Claude Code users: .worktreeinclude handles this natively. Prefer it
|
|
117
|
-
# over the cp loop when the project uses Claude's --worktree.
|
|
118
|
-
for f in .env .env.local .env.development.local; do
|
|
119
|
-
if [[ -f "$SOURCE_PATH/$f" && ! -f "$WORKTREE_PATH/$f" ]]; then
|
|
120
|
-
cp "$SOURCE_PATH/$f" "$WORKTREE_PATH/$f"
|
|
121
|
-
echo "copied $f"
|
|
122
|
-
fi
|
|
123
|
-
done
|
|
124
|
-
|
|
125
|
-
# Install deps.
|
|
126
|
-
if [[ -f pnpm-lock.yaml ]]; then pnpm install
|
|
127
|
-
elif [[ -f bun.lock || -f bun.lockb ]]; then bun install
|
|
128
|
-
elif [[ -f yarn.lock ]]; then yarn install
|
|
129
|
-
elif [[ -f package-lock.json ]]; then npm install
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
|
-
# Backend isolation/seeding and codegen go here.
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## `scripts/worktree-down.sh`
|
|
136
|
-
|
|
137
|
-
Cleanup runs before the IDE destroys the worktree. Keep cleanup scoped to resources that the setup script created or selected explicitly.
|
|
138
|
-
|
|
139
|
-
1. `set -euo pipefail`.
|
|
140
|
-
2. Resolve `WORKTREE_PATH`.
|
|
141
|
-
3. `cd "$WORKTREE_PATH"`.
|
|
142
|
-
4. Run backend-specific cleanup only when the loaded backend reference requires it.
|
|
143
|
-
5. Remove copied local env files only if that is appropriate for the project.
|
|
144
|
-
6. If required tools or env files are missing, print one short message and exit 0.
|
|
145
|
-
|
|
146
|
-
Never guess resource names from branch names. Read names from the worktree's env/config files or from deterministic setup metadata created by `worktree-up.sh`.
|
|
147
|
-
|
|
148
|
-
## `scripts/dev.sh`
|
|
149
|
-
|
|
150
|
-
Pick a free port so multiple worktrees can run in parallel.
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
#!/usr/bin/env bash
|
|
154
|
-
set -euo pipefail
|
|
155
|
-
|
|
156
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
157
|
-
cd "$WORKTREE_PATH"
|
|
158
|
-
|
|
159
|
-
port="${DEV_PORT_START:-3910}"
|
|
160
|
-
while lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1; do
|
|
161
|
-
port=$((port + 1))
|
|
162
|
-
done
|
|
163
|
-
|
|
164
|
-
echo "Starting app on http://localhost:$port"
|
|
165
|
-
exec pnpm dev -p "$port" # adjust for the project package manager
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Standard Actions
|
|
169
|
-
|
|
170
|
-
Every project should expose these four actions through the IDE's own mechanism:
|
|
171
|
-
|
|
172
|
-
| Action | Command (typical) |
|
|
173
|
-
| :--- | :--- |
|
|
174
|
-
| Dev | `scripts/dev.sh` |
|
|
175
|
-
| Typecheck | `pnpm ts` / `bun run typecheck` |
|
|
176
|
-
| Unit tests | `pnpm test:ci` / `bun test` |
|
|
177
|
-
| Lint | `pnpm lint:ci` / `bun run lint` |
|
|
178
|
-
|
|
179
|
-
Add `E2E` as an action only if the suite is cheap enough to run interactively.
|
|
180
|
-
|
|
181
|
-
## Universal Guardrails
|
|
182
|
-
|
|
183
|
-
- Never commit secrets. Copying ignored env files into a local worktree is fine; logging them is not.
|
|
184
|
-
- Never put fragile multi-line shell programs inside an IDE config file. Keep all logic in `scripts/`; the IDE config just calls those scripts.
|
|
185
|
-
- Never hardcode a dev port. Pick a free one starting from `${DEV_PORT_START:-3910}`.
|
|
186
|
-
- Setup must be idempotent. Provide a reset escape hatch for stateful resources via env var (`<PROJECT>_RESET_<RESOURCE>=1`).
|
|
187
|
-
- Print resource names and redacted hosts only.
|
|
188
|
-
- The scripts and IDE config must live on the source checkout / main branch, not only the current worktree, or future worktrees will have nothing to copy.
|
|
189
|
-
- Never destroy or import from production data by default. Any setup step that exports from a shared source and replays into a worktree must reject production-looking refs unless the user explicitly approved an override env var.
|
|
190
|
-
- Hook wrappers must survive a missing `/dev/tty`, a wrong default Node version, and CLI prompts. See `references/claude.md` -> "Hook Robustness" for the concrete fixes.
|
|
191
|
-
|
|
192
|
-
Use this production-source guard in backend references or project-specific helpers:
|
|
24
|
+
Never commit or log secrets. Never embed multi-line programs in IDE config. Never destroy or import production data unless the user set an override env var. Put this guard in any import/replay helper:
|
|
193
25
|
|
|
194
26
|
```bash
|
|
195
27
|
assert_non_prod_ref() {
|
|
@@ -202,62 +34,6 @@ assert_non_prod_ref() {
|
|
|
202
34
|
}
|
|
203
35
|
```
|
|
204
36
|
|
|
205
|
-
|
|
37
|
+
Expose Dev, typecheck, unit tests, and lint through the IDE; add E2E only if cheap.
|
|
206
38
|
|
|
207
|
-
After
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
bash -n scripts/worktree-up.sh scripts/worktree-down.sh scripts/dev.sh
|
|
211
|
-
git status --short
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
If Python 3.11+ is available, validate generated TOML:
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
python3 - <<'PY'
|
|
218
|
-
import tomllib
|
|
219
|
-
with open(".codex/environments/environment.toml", "rb") as f:
|
|
220
|
-
tomllib.load(f)
|
|
221
|
-
PY
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
For JSON configs:
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
python3 -c "import json; json.load(open('.cursor/worktrees.json'))"
|
|
228
|
-
python3 -c "import json; json.load(open('.claude/settings.json'))"
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## References
|
|
232
|
-
|
|
233
|
-
Load only the references relevant to the selected backend and IDE:
|
|
234
|
-
|
|
235
|
-
- `references/postgresql.md` - PostgreSQL isolation, reset, and cleanup.
|
|
236
|
-
- `references/convex.md` - Convex local/cloud deployments, allowlisted seeding, env cloning, and cleanup.
|
|
237
|
-
- `references/claude.md` - Claude Code WorktreeCreate/WorktreeRemove wiring.
|
|
238
|
-
- `references/cursor.md` - Cursor worktree setup wiring.
|
|
239
|
-
- `references/codex.md` - Codex local environment TOML.
|
|
240
|
-
|
|
241
|
-
## Examples
|
|
242
|
-
|
|
243
|
-
Working examples live under `examples/`. Read the relevant example before writing files into a real project, but do not copy verbatim. The user's selections, backend reference, and project conventions determine which sections survive.
|
|
244
|
-
|
|
245
|
-
```text
|
|
246
|
-
examples/
|
|
247
|
-
├── scripts/
|
|
248
|
-
│ ├── worktree-up.sh
|
|
249
|
-
│ ├── worktree-down.sh
|
|
250
|
-
│ ├── dev.sh
|
|
251
|
-
│ ├── convex-selective-seed.sh
|
|
252
|
-
│ ├── claude-worktree-create.sh
|
|
253
|
-
│ └── claude-worktree-remove.sh
|
|
254
|
-
├── claude/
|
|
255
|
-
│ ├── .worktreeinclude
|
|
256
|
-
│ ├── settings.json
|
|
257
|
-
│ └── commands/
|
|
258
|
-
├── cursor/
|
|
259
|
-
│ └── worktrees.json
|
|
260
|
-
└── codex/
|
|
261
|
-
└── environments/
|
|
262
|
-
└── environment.toml
|
|
263
|
-
```
|
|
39
|
+
After writing: `bash -n` the three scripts, `git status --short`, and parse generated TOML/JSON when those files exist.
|
|
@@ -4,28 +4,14 @@ description: Grill the user in rapid batches to sharpen a plan, decision, or ide
|
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Grill Me
|
|
8
|
-
|
|
9
7
|
Stress-test the user's thinking until both sides share a precise, actionable understanding.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
6. After the reply, summarize what is established, call out contradictions or missing dependencies, and investigate any newly discoverable facts.
|
|
19
|
-
7. Ask the next batch of 10 questions. Continue until the important branches of the decision tree are resolved. If fewer than 10 meaningful decisions remain, ask only those remaining; never add filler questions to reach 10.
|
|
20
|
-
8. Present the final shared understanding as a compact decision brief: goal, scope, constraints, chosen approach, rejected alternatives, risks, and acceptance criteria.
|
|
21
|
-
9. Ask for explicit confirmation that the brief is correct before acting on it.
|
|
22
|
-
|
|
23
|
-
## Question quality
|
|
24
|
-
|
|
25
|
-
- Ask decisions only the user can make; investigate facts yourself.
|
|
26
|
-
- Challenge assumptions and compare credible alternatives instead of merely collecting preferences.
|
|
27
|
-
- Keep each question independently answerable and concise enough for a spoken response.
|
|
28
|
-
- Do not repeat settled questions unless new evidence invalidates the earlier answer.
|
|
29
|
-
- Match the user's language.
|
|
9
|
+
1. Resolve discoverable facts from the environment. Ask only decisions the user can make.
|
|
10
|
+
2. Recommend voice input: microphone is fastest; short answers keyed `1` through `10` are enough.
|
|
11
|
+
3. Ask exactly 10 numbered questions in one batch. Lead with the highest-leverage unresolved decisions. Include a concise **Recommended answer** on every question.
|
|
12
|
+
4. Invite one grouped reply. Accept terse answers, skips, or blanket acceptance of the recommendations.
|
|
13
|
+
5. Summarize what is established, investigate new facts, then ask the next batch. If fewer than 10 decisions remain, ask only those.
|
|
14
|
+
6. Present a compact decision brief: goal, scope, constraints, chosen approach, rejected alternatives, risks, and acceptance criteria.
|
|
15
|
+
7. Get explicit confirmation before acting on it.
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
Challenge assumptions. Compare credible alternatives. Match the user's language. Do not implement until the brief is confirmed.
|
|
@@ -4,61 +4,15 @@ description: Create, edit, configure, and debug hooks for Claude Code, Codex, an
|
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Configure Claude Code, Codex, and Cursor hooks as event-driven commands or prompts. Treat platform syntax as distinct.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. Identify the platform and load [router.md](references/router.md).
|
|
10
|
+
2. Load the platform file: [claude-code.md](references/claude-code.md), [codex.md](references/codex.md), or [cursor.md](references/cursor.md).
|
|
11
|
+
3. Pick the scope, file path, lifecycle event, and a command hook (deterministic) or prompt hook (reasoning, if supported).
|
|
12
|
+
4. Validate the native config and run the platform smoke check.
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
Across agents, keep one portable script plus a small adapter per platform. Report unsupported features.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
2. Load the platform reference: `claude-code.md`, `codex.md`, or `cursor.md`.
|
|
15
|
-
3. Identify the scope and file path for that platform.
|
|
16
|
-
4. Select a supported lifecycle event and adapt the shared payload/decision contract.
|
|
17
|
-
5. Choose a command hook for deterministic shell logic, or a prompt hook when natural-language reasoning is required and the platform supports it.
|
|
18
|
-
6. Validate the native config and run the platform-specific smoke check.
|
|
16
|
+
Load as needed: [hook-types.md](references/hook-types.md), [command-vs-prompt.md](references/command-vs-prompt.md), [matchers.md](references/matchers.md), [input-output-schemas.md](references/input-output-schemas.md), [examples.md](references/examples.md), [troubleshooting.md](references/troubleshooting.md).
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"hooks": {
|
|
25
|
-
"PreToolUse": [
|
|
26
|
-
{
|
|
27
|
-
"matcher": "Bash",
|
|
28
|
-
"hooks": [
|
|
29
|
-
{ "type": "command", "command": "./.claude/hooks/check.sh", "timeout": 30000 }
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Command hooks receive JSON on stdin and may return JSON on stdout. Prompt hooks receive `#$ARGUMENTS` and should return a structured decision. Blocking hooks use `{"decision":"block","reason":"..."}`; non-blocking hooks may return a `systemMessage`.
|
|
38
|
-
|
|
39
|
-
## Safety requirements
|
|
40
|
-
|
|
41
|
-
- Check `stop_hook_active` in `Stop` and `SubagentStop` hooks to prevent recursive blocking.
|
|
42
|
-
- Set reasonable timeouts, especially for external commands.
|
|
43
|
-
- Use `$CLAUDE_PROJECT_DIR` or another trusted absolute path for scripts.
|
|
44
|
-
- Validate hook JSON with `jq` before relying on it.
|
|
45
|
-
- Keep blocking rules selective so normal work is not accidentally interrupted.
|
|
46
|
-
- Ensure referenced scripts are executable.
|
|
47
|
-
|
|
48
|
-
## Shared router
|
|
49
|
-
|
|
50
|
-
When the user asks for a hook that should work across agents, define one portable script with a small adapter per platform. Keep platform-specific event names, input fields, output decisions, exit codes, timeouts, and config paths in the references rather than pretending the formats are identical. Report unsupported features explicitly.
|
|
51
|
-
|
|
52
|
-
## References
|
|
53
|
-
|
|
54
|
-
- `references/router.md`: select a platform, map shared lifecycle intent, and avoid unsupported assumptions.
|
|
55
|
-
- `references/claude-code.md`: Claude settings, events, handlers, and `/hooks` verification.
|
|
56
|
-
- `references/codex.md`: Codex config layers, `hooks.json`, trust, and restart/worktree caveats.
|
|
57
|
-
- `references/cursor.md`: Cursor `.cursor/hooks.json`, hook scripts, and native response mapping.
|
|
58
|
-
- `references/research-sources.md`: first-party documentation sources and refresh policy.
|
|
59
|
-
- `references/hook-types.md`: shared event concepts, input/output, and blocking behavior.
|
|
60
|
-
- `references/command-vs-prompt.md`: choose command versus prompt hooks.
|
|
61
|
-
- `references/matchers.md`: regex and MCP matcher patterns.
|
|
62
|
-
- `references/input-output-schemas.md`: event schemas and response fields.
|
|
63
|
-
- `references/examples.md`: notifications, logging, formatting, tests, and safety examples.
|
|
64
|
-
- `references/troubleshooting.md`: debug, JSON, matcher, permission, and timeout checks.
|
|
18
|
+
Check `stop_hook_active` on Stop/SubagentStop. Use trusted absolute paths, timeouts, and `jq` validation. Keep blocking rules selective.
|