claude-dev-env 1.0.0 → 1.2.1

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 CHANGED
@@ -2,19 +2,47 @@
2
2
 
3
3
  Consistent development standards for Claude Code across every repo. Install once, get TDD enforcement, code quality hooks, specialized agents, and battle-tested rules everywhere.
4
4
 
5
- ## Install
5
+ ## Quick Start
6
+
7
+ ### Prerequisites
8
+
9
+ - **Node.js 18+** (includes `npx`)
10
+ - **Python 3.8+** (for hook scripts)
11
+ - **Claude Code CLI** installed and working
12
+
13
+ ### Install
6
14
 
7
15
  ```bash
8
16
  npx claude-dev-env
9
17
  ```
10
18
 
11
- To uninstall:
19
+ That's it. The installer will:
20
+
21
+ 1. Detect your Python 3 command (`python3`, `python`, or `py -3`)
22
+ 2. Copy 13 rules, 4 docs, 34 agents, 11 commands, and 14 skills to `~/.claude/`
23
+ 3. Copy 90+ hook scripts to `~/.claude/hooks/`
24
+ 4. Merge 31 hook groups into `~/.claude/settings.json` (preserves your existing hooks)
25
+ 5. Write a manifest to `~/.claude/.claude-dev-env-manifest.json` for clean uninstall
26
+
27
+ ### Verify
28
+
29
+ Start a new Claude Code session. You should see hook activity on your first prompt (code-rules-reminder, hook-structure-context). Run any slash command like `/commit` or `/readability-review` to confirm commands loaded.
30
+
31
+ ### Update
32
+
33
+ Run the same command again. It overwrites existing files and updates hook entries in place:
12
34
 
13
35
  ```bash
14
- npx claude-dev-env --uninstall
36
+ npx claude-dev-env
15
37
  ```
16
38
 
17
- The installer copies rules, docs, agents, commands, and skills to `~/.claude/` and merges hooks into `~/.claude/settings.json`. It auto-detects your Python 3 command for hook scripts. Running it again updates existing files in place.
39
+ ### Uninstall
40
+
41
+ Removes only the files this package installed (tracked via manifest) and cleans hook entries from `settings.json`:
42
+
43
+ ```bash
44
+ npx claude-dev-env --uninstall
45
+ ```
18
46
 
19
47
  ## What This Solves
20
48
 
@@ -200,9 +228,9 @@ Installed rules merge with your project's `.claude/` config. To override a rule
200
228
 
201
229
  Installed hooks run alongside any hooks already in your `settings.json` or `settings.local.json`. The installer preserves existing hook entries.
202
230
 
203
- ## Agent Gate Installer
231
+ ## Agent Gate
204
232
 
205
- This repo also includes an npm installer for [agent-gate](https://github.com/jl-cmd/agent-gate), a prompt evaluation gate for Claude Code. See [`installer/README.md`](installer/README.md) for details.
233
+ For a prompt evaluation gate that reviews prompts before execution, see [agent-gate](https://github.com/jl-cmd/agent-gate):
206
234
 
207
235
  ```bash
208
236
  npx agent-gate-installer
package/bin/install.mjs CHANGED
@@ -81,13 +81,14 @@ function mergeHooks(pythonCommand) {
81
81
  }
82
82
  if (!settings.hooks) settings.hooks = {};
83
83
  const installedHooksDir = join(CLAUDE_HOME, 'hooks');
84
+ const pluginRootDir = CLAUDE_HOME;
84
85
  let groupCount = 0;
85
86
  for (const [eventType, matcherGroups] of Object.entries(hooksConfig.hooks)) {
86
87
  if (!settings.hooks[eventType]) settings.hooks[eventType] = [];
87
88
  for (const sourceGroup of matcherGroups) {
88
89
  const rewrittenHooks = sourceGroup.hooks.map(hook => {
89
90
  let command = hook.command;
90
- command = command.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, installedHooksDir.replace(/\\/g, '/'));
91
+ command = command.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, pluginRootDir.replace(/\\/g, '/'));
91
92
  command = command.replace(/^python3\b/, pythonCommand);
92
93
  return { ...hook, command };
93
94
  });
@@ -0,0 +1,362 @@
1
+ # Emotion-Informed Prompt Design for agent-gate
2
+
3
+ Design document. Review before implementation.
4
+
5
+ ---
6
+
7
+ ## Source Material
8
+
9
+ **Paper:** "Emotion Concepts and their Function in a Large Language Model" (Anthropic, April 2026)
10
+ - https://transformer-circuits.pub/2026/emotions/index.html
11
+ - https://www.anthropic.com/research/emotion-concepts-function
12
+
13
+ **Official guidance:** https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
14
+
15
+ **Reference repo:** https://github.com/OuterSpacee/claude-emotion-prompting (7 principles and 9 anti-patterns grounded in the paper; its system prompt templates use collaborative language and include examples, though they omit XML tags and output format specification)
16
+
17
+ **Cross-model caveat:** The paper studied Sonnet 4.5. Agent-gate targets Opus 4.6. The emotion-vector mechanism has not been validated across models. The changes below align with Anthropic's official best practices for Opus 4.6 independently; the paper findings serve as additional supporting rationale.
18
+
19
+ ---
20
+
21
+ ## Design Principles
22
+
23
+ Five paper findings shape how each surface is written:
24
+
25
+ | Principle | Research basis | How it applies |
26
+ |---|---|---|
27
+ | Clear criteria and escape routes | Desperation vectors activate on repeated failure + unclear success criteria, driving fabrication | Every path has explicit next steps. The model always knows what to do next. |
28
+ | Collaborative framing | Compliance pressure activates anxiety, which drives sycophancy over accuracy | Frame evaluation as collaborative improvement. Use roles and motivation. |
29
+ | Positive engagement | Curiosity/interest states correlate with measurably better output quality | Frame the coaching task as helping the user, with constructive energy. |
30
+ | Invite transparency | Suppressing uncertainty trains concealment, not resolution | Invite "I don't know" and placeholder notation. Permission to express uncertainty. |
31
+ | Constructive tone | Post-training RLHF creates a gloomy default; constructive framing counterbalances | Active, forward-looking language throughout. |
32
+
33
+ ---
34
+
35
+ ## Surface-by-Surface Specifications
36
+
37
+ Each surface shows the target text and the rationale for that framing.
38
+
39
+ ### Surface 1: Gate Directive (UserPromptSubmit injection)
40
+
41
+ **File:** `packages/agent-gate-claude/src/agent_gate_claude/config/constants.py`
42
+ **Constant:** `USER_PROMPT_SUBMIT_GATE_DIRECTIVE`
43
+
44
+ **Target text:**
45
+ ```
46
+ <prompt_gate>
47
+ A prompt evaluation step helps ensure clear, actionable work before execution begins.
48
+
49
+ Call {evaluate_tool_name} with a single `request` object as your first tool action. Before calling it, gather concrete project context using Read, Glob, Grep, WebFetch, WebSearch, and Context7 — actual file paths, existing patterns, and current official documentation make the assessment specific and useful.
50
+
51
+ If the rubric scores low, the gate asks you to coach the user toward a clearer prompt via AskUserQuestion, then unlocks bounded discovery tools for further context gathering.
52
+
53
+ Write, Edit, Bash, Agent, and Task become available after the gate clears. Discovery tools (Read, Glob, Grep, WebFetch, WebSearch, Context7) are available throughout.
54
+
55
+ For library or API behavior, fetch official documentation rather than relying on training-data recollection.
56
+
57
+ The PreToolUse hook ensures this ordering — if a tool is called before the gate clears, the hook will redirect you to call evaluate_prompt first.
58
+ </prompt_gate>
59
+ ```
60
+
61
+ **Rationale:**
62
+ - XML wrapper per Anthropic: "Use consistent, descriptive tag names across your prompts"
63
+ - "helps ensure" — collaborative framing with motivation (Anthropic: "Providing context or motivation behind your instructions helps Claude better understand your goals")
64
+ - "become available after" — positive framing (Anthropic: "Tell Claude what to do instead of what not to do")
65
+ - Discovery tools listed as available throughout — the model always knows what it can use right now
66
+ - Enforcement notice as information ("ensures this ordering", "will redirect") — the model learns the constraint proactively rather than discovering it through denial (which would trigger the desperation pattern the paper identifies)
67
+
68
+ ---
69
+
70
+ ### Surface 2: Tool Description (evaluate_prompt)
71
+
72
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/config/constants.py`
73
+ **Constant:** `EVALUATE_PROMPT_TOOL_DESCRIPTION`
74
+
75
+ **Target text:**
76
+ ```
77
+ Evaluate the user's prompt against five quality dimensions before proceeding with execution tools.
78
+
79
+ Before calling this tool, use Read, Glob, and Grep to gather concrete project context. Use WebFetch, WebSearch, and Context7 to look up current official documentation for any library, API, or platform in the prompt. Cite official documentation sources only (the library's own docs domain or platform provider docs such as docs.anthropic.com, docs.python.org). Cite exact URLs inline.
80
+
81
+ For each rubric category below threshold, encode specific findings as assessment suggestions — actual file paths, cited API patterns, concrete details. Specific values make the draft prompt confirmable; vague phrases leave blanks.
82
+
83
+ Pass a single `request` object with: `assessment` (required — JSON object with five keys: target_and_action, scope, clarity_of_intent, success_criteria, output_expectations, each mapping to {"score": 1-5, "suggestions": [...]}), `original_prompt` or `prompt` for user text, optional `planned_execution` or `rubric`, optional `session_identifier`, optional `require_canonical_confirmation`, optional `confirmation_phase` (set to "ack" for follow-up confirmation call).
84
+
85
+ When categories score below threshold: the return includes coaching guidance with a draft prompt block. Present this via AskUserQuestion so the user can refine their intent. When the average score is below 3.0, question-first mode activates — call AskUserQuestion, then call this tool with confirmation_phase ack to unlock bounded discovery.
86
+
87
+ When all categories pass: a canonical prompt is returned for user confirmation via AskUserQuestion. After the user confirms, call this tool with confirmation_phase ack to complete the evaluation. Execution tools become available after the ack call.
88
+ ```
89
+
90
+ **Rationale:**
91
+ - "quality dimensions" — frames as improvement. "coaching guidance" — collaborative.
92
+ - "become available" / "refine their intent" — positive framing throughout
93
+ - Conditional flow details preserved — Anthropic: "Claude's latest models are trained for precise instruction following and benefit from explicit direction to use specific tools." Tool descriptions are machine-facing contracts where completeness matters.
94
+ - `require_canonical_confirmation` removed — confirmation is now always the flow (Surface 9)
95
+
96
+ ---
97
+
98
+ ### Surface 3: Failing-Path Preamble
99
+
100
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/config/constants.py`
101
+ **Constants:** `ASK_USER_QUESTION_FAILING_CANON_AND_MISSION`, `ASK_USER_QUESTION_FAILING_AGENT_GUIDANCE`, `ANTI_HALLUCINATION_DRAFT_RULES`
102
+
103
+ **`ASK_USER_QUESTION_FAILING_CANON_AND_MISSION` target:**
104
+ ```
105
+ CANONICAL REFERENCE (prompt quality): {PROMPT_ENGINEERING_CANON_URL}
106
+ ANTI-HALLUCINATION REFERENCE: {ANTI_HALLUCINATION_GUIDANCE_URL}
107
+ These are the authoritative references for this coaching step.
108
+
109
+ Your role here: help the user sharpen their prompt so the intent, scope, and success criteria are clear enough to act on. The user may not be familiar with prompt engineering — explain gaps in plain language and offer concrete improvements.
110
+
111
+ Your next action is AskUserQuestion. Present the draft block and options below, then wait for the user's response before any other work.
112
+ ```
113
+
114
+ **`ASK_USER_QUESTION_FAILING_AGENT_GUIDANCE` target:**
115
+ ```
116
+ <coaching_guidance>
117
+ Follow these steps in order:
118
+
119
+ 1) Call AskUserQuestion next with the options and draft block below.
120
+ 2) Build your choices from the rubric-aligned option lines. Each choice should resolve a specific gap identified in the assessment.
121
+ 3) Include "Proceed as-is" and "Let me rephrase" as the final two options. Aim for 3-5 total choices.
122
+ 4) Ground every element in the user message, files read this session, or official documentation fetched this turn. Use [BRANCH], [REPO], [FILE_PATH], or [PR_NUMBER] placeholders for values you haven't verified. Do not invent repositories, branches, PR numbers, or product facts not in those sources.
123
+ 5) Include the DRAFT_PROMPT_FOR_USER: block below verbatim in your AskUserQuestion question text. You may correct obvious errors in the draft before presenting it.
124
+ 6) Align suggestions with Anthropic's prompt engineering guidance: clear instructions, sufficient context, bounded scope, verifiable success criteria, explicit output expectations.
125
+ </coaching_guidance>
126
+ ```
127
+
128
+ **`ANTI_HALLUCINATION_DRAFT_RULES` target:**
129
+ ```
130
+ When assembling the draft prompt (reference: {ANTI_HALLUCINATION_GUIDANCE_URL}):
131
+ - Ground claims in the user message, planned_execution, files read via Read/Glob/Grep, or official documentation fetched via WebFetch/WebSearch/Context7 this turn.
132
+ - Fetch official docs for library or API behavior and cite the URL — training data may be outdated.
133
+ - Use [BRANCH], [REPO], [FILE_PATH], or [PR_NUMBER] placeholders for genuinely unknown values.
134
+ - Say "I don't know" when you lack a source rather than constructing plausible specifics.
135
+ ```
136
+
137
+ **Rationale for Surface 3:**
138
+ - Role-setting per Anthropic: "Setting a role in the system prompt focuses Claude's behavior and tone"
139
+ - "Your next action is" — direct positive instruction
140
+ - Numbered steps per Anthropic: "Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters" (Section: "Be clear and direct"). Numbered format makes compliance auditable.
141
+ - Step 4 keeps concrete anti-hallucination guardrail alongside placeholder guidance — concrete rules strengthen factual grounding
142
+ - "Say 'I don't know'" — positive instruction, permission to express uncertainty
143
+
144
+ ---
145
+
146
+ ### Surface 4: Passing-Path Reply
147
+
148
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/config/constants.py`
149
+ **Constant:** `PASSING_ASSESSMENT_GATE_CLEARED_REPLY`
150
+
151
+ **Target text:**
152
+ ```
153
+ All rubric categories passed. Proceed with your planned execution using tools.
154
+
155
+ Ground your work in files you have read and official documentation you have fetched. Use [PLACEHOLDER] notation for file paths, branch names, or API specifics you have not verified this session. When you encounter something uncertain during execution, verify it rather than assuming.
156
+ ```
157
+
158
+ **Rationale:**
159
+ - "Ground your work in" — positive instruction for how to proceed
160
+ - "verify it rather than assuming" — positive action for uncertainty
161
+ - Shorter per Anthropic: "more direct and grounded... less verbose"
162
+ - This constant is only reached via `confirmation_phase ack` after Surface 9 — the user has already confirmed via AskUserQuestion. Surface 9 must land before this text change.
163
+
164
+ ---
165
+
166
+ ### Surface 5: Low-Score Question-First Reply
167
+
168
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/server.py`
169
+ **Constant:** `LOW_SCORE_QUESTION_FIRST_REPLY`
170
+
171
+ **Target text:**
172
+ ```
173
+ The prompt needs more detail before discovery tools can help effectively. Present the options and draft block below via AskUserQuestion so the user can clarify their intent. After their response, call evaluate_prompt with confirmation_phase ack and the same session_identifier to continue.
174
+ ```
175
+
176
+ **Rationale:**
177
+ - "needs more detail" — describes the situation with motivation ("before discovery tools can help effectively")
178
+ - "so the user can clarify their intent" — collaborative framing
179
+ - "to continue" — forward-looking
180
+
181
+ ---
182
+
183
+ ### Surface 6: Discovery Mode Enabled Reply
184
+
185
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/server.py`
186
+ **Constant:** `DISCOVERY_MODE_ENABLED_REPLY`
187
+
188
+ **Target text:**
189
+ ```
190
+ The user has clarified their intent. Discovery tools are now available to gather context for the task. Use Read, Glob, Grep, WebFetch, WebSearch, and Context7 within the exploration budget, then call evaluate_prompt with a full assessment grounded in what you found.
191
+ ```
192
+
193
+ **Rationale:**
194
+ - "The user has clarified" — acknowledges the collaborative exchange
195
+ - Named specific tools — removes ambiguity
196
+ - "grounded in what you found" — connects discovery to assessment quality
197
+
198
+ ---
199
+
200
+ ### Surface 7: Draft Prompt Builder
201
+
202
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/server.py`
203
+ **Function:** `_build_draft_improved_prompt()`
204
+
205
+ **Target structure:**
206
+ ```
207
+ DRAFT_PROMPT_FOR_USER:
208
+ Here is a structured version of your request. Review each section — confirm what looks right, adjust what doesn't, and fill in any blanks.
209
+
210
+ ---
211
+ Goal: [user prompt + target suggestions]
212
+ Scope: [scope suggestions or "looks clear"]
213
+ Constraints / intent: [clarity suggestions or "looks clear"]
214
+ Success criteria: [criteria suggestions or "looks clear"]
215
+ Output format: [output suggestions or "looks clear"]
216
+ Planned approach (if relevant): [planned_execution]
217
+ ---
218
+ ```
219
+
220
+ **Rationale:**
221
+ - "confirm what looks right, adjust what doesn't, and fill in any blanks" — three positive actions
222
+ - "looks clear" — natural language for passing fields
223
+
224
+ ---
225
+
226
+ ### Surface 8: Canonical Prompt Builder
227
+
228
+ **File:** `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/canonical_prompt_builder.py`
229
+ **Function:** `build_canonical_user_prompt_block()`
230
+
231
+ **Target role section:**
232
+ ```
233
+ You are a coding agent working on this task. Deliver clear, verifiable outcomes and flag uncertainties you encounter along the way.
234
+ ```
235
+
236
+ **Target instructions format for passing categories:**
237
+ ```
238
+ - Target and action: incorporate [suggestion]
239
+ - Scope: addressed in the prompt; maintain during execution
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Surface 9: Mandatory User Confirmation (Architectural Change)
245
+
246
+ **Files:**
247
+ - `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/server.py` (flow logic)
248
+ - `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/config/constants.py` (remove optional confirmation constants)
249
+ - `packages/agent-gate-core/src/agent_gate_core/config/constants.py` (remove env var constants)
250
+ - `packages/agent-gate-claude/src/agent_gate_claude/config/constants.py` (remove canonical confirmation suffix)
251
+ - `packages/agent-gate-prompt-refinement/src/agent_gate_prompt_refinement/assessment_models.py` (remove `require_canonical_confirmation` field)
252
+
253
+ **Design goal:** Every gate traversal requires explicit user confirmation before clearing. The user always sees what Claude plans to do and approves it.
254
+
255
+ **Target flow (two paths):**
256
+ 1. Low score (avg < 3.0) -> question-first -> user clarifies -> bounded discovery -> re-evaluate -> user confirms canonical prompt -> clears
257
+ 2. Normal/passing score -> canonical prompt shown via AskUserQuestion -> user confirms -> `confirmation_phase ack` -> clears
258
+
259
+ **Code changes:**
260
+
261
+ 1. **Remove `_canonical_confirmation_effective()` conditional** in `server.py` — the passing path always keeps the bridge and returns canonical prompt + AskUserQuestion instruction
262
+
263
+ 2. **Remove opt-in infrastructure:**
264
+ - `require_canonical_confirmation` field from `EvaluatePromptRequest`
265
+ - `REQUIRE_CANONICAL_CONFIRMATION_ENVIRONMENT_KEY` and `REQUIRE_CANONICAL_CONFIRMATION_ENVIRONMENT_ACTIVE_VALUE` from core constants
266
+ - `USER_PROMPT_SUBMIT_CANONICAL_CONFIRMATION_SUFFIX` from claude constants
267
+ - Environment variable check in `gate_trigger.py`
268
+
269
+ 3. **Simplify `evaluate_prompt()` passing branch:** After `_all_categories_passing()` returns True, always build canonical block, keep bridge in `confirm_canonical` phase, return phase-two confirmation reply
270
+
271
+ 4. **Ensure re-evaluation after discovery also requires confirmation:** When the low-score path reaches a second `evaluate_prompt` call with a full assessment and all categories pass, that path also goes through canonical confirmation — not silent clearing
272
+
273
+ 5. **Update `PASSING_ASSESSMENT_GATE_CLEARED_REPLY`:** This constant is now only reached via `confirmation_phase ack` — it is the post-confirmation message, never the initial response to a passing rubric
274
+
275
+ 6. **Update `EVALUATE_PROMPT_TOOL_DESCRIPTION`:** Remove references to optional confirmation mode; confirmation is always the flow
276
+
277
+ 7. **Fix the middle path (not-all-passing, avg >= 3.0):** Currently (server.py line 275-281) this path clears the bridge immediately and returns AskUserQuestion instruction — the model is free to use Write/Edit/Bash because the bridge is gone. This violates the invariant. **Fix:** Keep the bridge active on this path too. Set phase to `confirm_canonical`, build canonical block, return phase-two confirmation reply — same as the all-passing path. The AskUserQuestion coaching from the failing assessment still appears in the question text, but the bridge stays until the user confirms.
278
+
279
+ 8. **Update `CANONICAL_CONFIRMATION_ACK_WRONG_PHASE_REPLY`:** Current text references `require_canonical_confirmation` which is being removed. Rephrase to: "Canonical prompt confirmation is not pending for this gate. Call evaluate_prompt with an assessment first. After all categories pass, confirm the canonical prompt via AskUserQuestion, then call evaluate_prompt with confirmation_phase ack."
280
+
281
+ 9. **Update `ASK_USER_QUESTION_PHASE_TWO_AGENT_RULES`:** Contains "STRICT RULES (phase two):" which contradicts the cross-cutting pattern. Rephrase to numbered steps with positive framing (consistent with Surface 3 fix).
282
+
283
+ 10. **Update `ASK_USER_QUESTION_PHASE_TWO_OPENING`:** Contains "blocked tools are allowed" — change to "execution tools become available" per cross-cutting pattern.
284
+
285
+ 11. **Define "Proceed as-is" behavior:** When the user selects "Proceed as-is" on a failing prompt, the gate clears without requiring a second canonical confirmation step. The user has already made an explicit human-in-the-loop decision. Double-confirmation adds no safety value and degrades UX.
286
+
287
+ 12. **Update both file copies:** `hooks/gate_trigger.py` and `packages/agent-gate-claude/hooks/gate_trigger.py` are identical copies — both need Surface 1 changes and env-var removal.
288
+
289
+ **Invariant:** No path clears without explicit user interaction (either `confirmation_phase ack` after AskUserQuestion, or "Proceed as-is" selection). No silent auto-clearing.
290
+
291
+ ---
292
+
293
+ ## Cross-Cutting Patterns
294
+
295
+ These patterns apply across all surfaces:
296
+
297
+ ### 1. Use collaborative language
298
+
299
+ | Pattern | Example | Anthropic basis |
300
+ |---|---|---|
301
+ | Set a role | "Your role here: help the user sharpen their prompt" | "Setting a role focuses Claude's behavior and tone" |
302
+ | Provide motivation | "helps ensure clear, actionable work" | "Providing context or motivation helps Claude better understand your goals" |
303
+ | Frame as partnership | "so the user can clarify their intent" | Collaborative framing activates positive engagement |
304
+ | Inform about constraints | "The PreToolUse hook ensures this ordering" | Proactive awareness prevents repeated-failure pattern |
305
+
306
+ ### 2. Use positive framing
307
+
308
+ | Pattern | Example | Anthropic basis |
309
+ |---|---|---|
310
+ | State what to do | "become available after" | "Tell Claude what to do instead of what not to do" |
311
+ | Positive uncertainty | "Say 'I don't know'" / "Use [PLACEHOLDER]" | Permission to express uncertainty |
312
+ | Forward-looking language | "to continue" / "verify it rather than assuming" | Direct next action |
313
+ | Keep concrete guardrails | "Do not invent repositories, branches, PR numbers" | Anti-hallucination needs concrete rules |
314
+
315
+ ### 3. Use XML structure
316
+
317
+ Multi-section prompt surfaces use XML tags: `<prompt_gate>`, `<coaching_guidance>`. Per Anthropic: "Use consistent, descriptive tag names across your prompts. Nest tags when content has a natural hierarchy."
318
+
319
+ ### 4. Use numbered steps for sequential procedures
320
+
321
+ Per Anthropic: "Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters." The coaching guidance is a sequence where order matters.
322
+
323
+ ### 5. Keep model-facing text focused on actions
324
+
325
+ The model needs to know: what to do, in what order, and what tools are available. Internal mechanics (bridge files, score thresholds, phase names) stay in code.
326
+
327
+ ---
328
+
329
+ ## Design Scope
330
+
331
+ - The gate evaluates the same five rubric categories with the same thresholds — this design changes communication, not evaluation
332
+ - The phase-aware enforcement hook (`hooks/gate_enforcer.py`) already handles all phases correctly and requires no changes
333
+ - The package-level enforcer (`packages/agent-gate-claude/hooks/gate_enforcer.py`) lacks phase logic; the phase-aware version is canonical in production
334
+ - Emotion-informed framing shapes how the gate talks to the model, not the user
335
+ - Constructive framing throughout — no forced enthusiasm or artificial tone
336
+
337
+ ---
338
+
339
+ ## Implementation Order
340
+
341
+ Changes apply in this order (dependency-aware, each step independently testable):
342
+
343
+ **Phase A — Architectural change (Surface 9, must land first):**
344
+ 1. Remove opt-in confirmation infrastructure (env var, request field, suffix constant, env check in both gate_trigger.py copies)
345
+ 2. Make `evaluate_prompt()` passing branch always require canonical confirmation
346
+ 3. Fix the middle path (not-all-passing, avg >= 3.0) to also keep bridge and require confirmation
347
+ 4. Ensure re-evaluation after discovery also requires confirmation
348
+ 5. Update `CANONICAL_CONFIRMATION_ACK_WRONG_PHASE_REPLY` to remove `require_canonical_confirmation` reference
349
+ 6. Define "Proceed as-is" behavior — clears gate without second canonical confirmation
350
+ 7. Update tests for mandatory confirmation flow (15 tests: 3 delete, 7 rewrite, 3 update field usage, 2 update assertions)
351
+
352
+ **Phase B — Prompt text changes (Surfaces 1-8, order within phase is flexible):**
353
+ 8. Gate directive (`USER_PROMPT_SUBMIT_GATE_DIRECTIVE`) — XML wrapper, positive enforcement notice
354
+ 9. Passing-path reply (`PASSING_ASSESSMENT_GATE_CLEARED_REPLY`) — now only reached via ack
355
+ 10. Low-score + discovery replies (server.py constants) — small, self-contained
356
+ 11. Anti-hallucination rules (`ANTI_HALLUCINATION_DRAFT_RULES`) — shared across paths
357
+ 12. Failing-path preamble (composed constants) — numbered steps, XML wrapper, depends on #11
358
+ 13. Phase-two constants (`ASK_USER_QUESTION_PHASE_TWO_AGENT_RULES`, `ASK_USER_QUESTION_PHASE_TWO_OPENING`) — align with Surface 3 language
359
+ 14. Tool description (`EVALUATE_PROMPT_TOOL_DESCRIPTION`) — keep conditional flow detail, remove optional confirmation references
360
+ 15. Draft prompt builder (server.py function + constants) — display text changes
361
+ 16. Canonical prompt builder — role and instruction format tweaks
362
+ 17. Update remaining text-assertion tests (3 tests: "STRICT RULES" markers, directive text)
@@ -40,6 +40,7 @@ def get_question_from_stdin() -> str:
40
40
 
41
41
  def main() -> None:
42
42
  system = platform.system()
43
+ wsl_mode = is_wsl()
43
44
 
44
45
  project_name = get_project_name()
45
46
  question_text = get_question_from_stdin()
@@ -49,7 +50,7 @@ def main() -> None:
49
50
  if system == "Windows":
50
51
  sound_windows()
51
52
  notify_windows(project_name, question_text)
52
- elif is_wsl():
53
+ elif wsl_mode:
53
54
  sound_wsl()
54
55
  notify_wsl(project_name, question_text)
55
56
  elif system == "Linux":
@@ -156,15 +156,18 @@ def notify_ntfy(title: str, message: str, priority: str = "high") -> None:
156
156
 
157
157
 
158
158
  def notify_linux() -> None:
159
- subprocess.Popen(
160
- [
161
- "notify-send", "-t", LINUX_NOTIFICATION_TIMEOUT_MS,
162
- "-u", "normal", "-i", "dialog-warning",
163
- DEFAULT_LINUX_TOAST_TITLE, DEFAULT_LINUX_TOAST_MESSAGE,
164
- ],
165
- stdout=subprocess.DEVNULL,
166
- stderr=subprocess.DEVNULL
167
- )
159
+ try:
160
+ subprocess.Popen(
161
+ [
162
+ "notify-send", "-t", LINUX_NOTIFICATION_TIMEOUT_MS,
163
+ "-u", "normal", "-i", "dialog-warning",
164
+ DEFAULT_LINUX_TOAST_TITLE, DEFAULT_LINUX_TOAST_MESSAGE,
165
+ ],
166
+ stdout=subprocess.DEVNULL,
167
+ stderr=subprocess.DEVNULL
168
+ )
169
+ except FileNotFoundError:
170
+ return
168
171
 
169
172
 
170
173
  def sound_windows() -> None:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "1.0.0",
3
+ "version": "1.2.1",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {