claude-dev-env 1.17.5 → 1.19.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/hooks/blocking/content-search-to-zoekt-redirector.py +6 -2
- package/hooks/blocking/content_search_zoekt_block_payload.py +9 -5
- package/hooks/blocking/content_search_zoekt_redirect_guidance.py +7 -1
- package/hooks/blocking/test_content_search_to_zoekt_redirector_integration.py +8 -1
- package/hooks/blocking/test_content_search_to_zoekt_redirector_unit.py +7 -2
- package/hooks/hooks.json +15 -0
- package/package.json +1 -1
- package/hooks/HOOK_SPECS_PROMPT_WORKFLOW.md +0 -64
- package/hooks/blocking/prompt_workflow_clipboard.py +0 -63
- package/hooks/blocking/prompt_workflow_gate_config.py +0 -113
- package/hooks/blocking/prompt_workflow_gate_core.py +0 -289
- package/hooks/blocking/prompt_workflow_validate.py +0 -218
- package/hooks/blocking/test_prompt_workflow_clipboard.py +0 -54
- package/hooks/blocking/test_prompt_workflow_gate_core.py +0 -195
- package/hooks/blocking/test_prompt_workflow_validate.py +0 -339
- package/rules/prompt-workflow-context-controls.md +0 -48
- package/skills/agent-prompt/SKILL.md +0 -199
- package/skills/prompt-generator/ARCHITECTURE.md +0 -18
- package/skills/prompt-generator/REFERENCE.md +0 -254
- package/skills/prompt-generator/REFINEMENT_PIPELINE_RUNBOOK.md +0 -177
- package/skills/prompt-generator/SKILL.md +0 -354
- package/skills/prompt-generator/TARGET_OUTPUT.md +0 -133
- package/skills/prompt-generator/evals/prompt-generator.json +0 -207
- package/skills/prompt-generator/templates/skill-from-ground-up.md +0 -104
- package/skills/prompt-generator/templates/skill-refinement-package.md +0 -109
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
# Prompt generator -- reference
|
|
2
|
-
|
|
3
|
-
## Canonical resources
|
|
4
|
-
|
|
5
|
-
When authoring or refining prompts, ground decisions in these sources. If guidance conflicts, defer to the higher tier.
|
|
6
|
-
|
|
7
|
-
### Tier 1: Anthropic (primary authority for Claude)
|
|
8
|
-
|
|
9
|
-
- https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview -- overview, links to all sub-guides
|
|
10
|
-
- https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices -- the single living reference for Claude's latest models.
|
|
11
|
-
- https://transformer-circuits.pub/2026/emotions/index.html -- emotion concepts research (April 2026). Key takeaways: clear criteria and escape routes, collaborative framing, positive task framing, inviting transparency. Full catalog: `packages/claude-dev-env/docs/emotion-informed-prompt-design.md`.
|
|
12
|
-
- https://www.anthropic.com/research/emotion-concepts-function -- blog summary of the above paper.
|
|
13
|
-
- https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking -- adaptive thinking reference; replaces manual budget_tokens with effort-based control.
|
|
14
|
-
- https://claude.com/blog/harnessing-claudes-intelligence -- harness evolution: primitives Claude already knows, what to stop doing in the harness, deliberate boundaries (context economics, caching, typed tools). Local inventory: `docs/references/anthropic-harnessing-claudes-intelligence-technique-inventory.md`.
|
|
15
|
-
- https://github.com/anthropics/skills/tree/main/skills/claude-api -- Anthropic `claude-api` Agent Skill for hands-on API/tool patterns from that post (Hook 10). Platform entry: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/claude-api-skill
|
|
16
|
-
|
|
17
|
-
### Tier 2: Major labs (strong secondary, often transfers across models)
|
|
18
|
-
|
|
19
|
-
- https://platform.openai.com/docs/guides/prompt-engineering -- six strategies: write clear instructions, provide reference text, split complex tasks, give models time to think, use external tools, test systematically.
|
|
20
|
-
- https://deepmind.google/research/ -- learning resources and chain-of-thought research.
|
|
21
|
-
- https://www.microsoft.com/en-us/research/blog/ -- publications and applied research.
|
|
22
|
-
|
|
23
|
-
### Tier 3: Courses, communities, individuals (supplementary)
|
|
24
|
-
|
|
25
|
-
**Courses:**
|
|
26
|
-
|
|
27
|
-
- https://www.deeplearning.ai/short-courses/ -- Andrew Ng's courses. "ChatGPT Prompt Engineering for Developers" (with OpenAI) is the foundational one.
|
|
28
|
-
- https://course.fast.ai/ -- Jeremy Howard's top-down teaching style.
|
|
29
|
-
- https://www.elementsofai.com/ -- University of Helsinki introductory course.
|
|
30
|
-
- https://ocw.mit.edu/search/?t=Artificial%20Intelligence -- MIT OpenCourseWare AI curriculum.
|
|
31
|
-
|
|
32
|
-
**Communities and individuals:**
|
|
33
|
-
|
|
34
|
-
- https://discuss.huggingface.co/ -- open-source model community.
|
|
35
|
-
- https://www.latent.space/ -- AI engineering perspective (Latent Space Podcast & Newsletter).
|
|
36
|
-
- https://simonwillison.net/ -- practical LLM experiments. His "LLM" tag is especially valuable.
|
|
37
|
-
|
|
38
|
-
### Conflict resolution rule
|
|
39
|
-
|
|
40
|
-
If sources disagree, apply tier order: Anthropic first, then OpenAI/Google/Microsoft, then community. Tier 1 wins when conflicting with lower tiers.
|
|
41
|
-
|
|
42
|
-
### Outcome preview gate and digest (`prompt-generator`)
|
|
43
|
-
|
|
44
|
-
See SKILL.md §§107-115 (Phases 4-5) and `TARGET_OUTPUT.md` for the full contract. **Clipboard safety:** `extract_fenced_xml_content` concatenates every ` ```xml ` block—follow §7 sample formatting so clipboard copy stays the lone artifact body.
|
|
45
|
-
|
|
46
|
-
### Outcome preview gate and digest (`prompt-generator`)
|
|
47
|
-
|
|
48
|
-
Human checkpoint before the paste-ready artifact ships: the orchestrator runs an **Outcome preview** turn (`### Outcome preview` bullets built from the **preview summary**, defined in SKILL.md Terminology) plus **AskUserQuestion** (**Ship** recommended first, two contextual alternates, **Refine with free text**), then emits `Audit`, a single ` ```xml ` fence, and **`## Outcome digest`** after the fence. Rationale matches collaborative checkpoints in `templates/skill-from-ground-up.md` and the refinement pattern in `templates/skill-refinement-package.md`. `ARCHITECTURE.md` lists all files in this skill package.
|
|
49
|
-
|
|
50
|
-
**Clipboard safety:** `prompt_workflow_gate_core.extract_fenced_xml_content` concatenates every ` ```xml ` block in the message—follow the sample formatting rules in SKILL.md section 7 so clipboard copy stays the lone artifact body. Full contract: `TARGET_OUTPUT.md`.
|
|
51
|
-
|
|
52
|
-
## Harness design patterns (Anthropic blog, April 2026)
|
|
53
|
-
|
|
54
|
-
Primary URL: https://claude.com/blog/harnessing-claudes-intelligence. Structured inventory: `docs/references/anthropic-harnessing-claudes-intelligence-technique-inventory.md`.
|
|
55
|
-
|
|
56
|
-
### Mechanism doc map (Hook 11)
|
|
57
|
-
|
|
58
|
-
Jump from concept to the platform specs the post names:
|
|
59
|
-
|
|
60
|
-
- [Bash tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool) / [Text editor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool)
|
|
61
|
-
- [Code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) / [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling)
|
|
62
|
-
- [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool)
|
|
63
|
-
- [Agent Skills overview](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview)
|
|
64
|
-
- [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows) / [Context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) / [Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction)
|
|
65
|
-
- [Subagents](https://code.claude.com/docs/en/sub-agents)
|
|
66
|
-
- [System prompts](https://platform.claude.com/docs/en/release-notes/system-prompts) / [Working with the Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) / [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
|
|
67
|
-
- [Model migration guide — hard-coded filters](https://platform.claude.com/docs/en/about-claude/models/migration-guide#additional-recommended-changes)
|
|
68
|
-
- [Harness design for long-running applications](https://www.anthropic.com/engineering/harness-design-long-running-apps)
|
|
69
|
-
- [Claude Code auto-mode](https://www.anthropic.com/engineering/claude-code-auto-mode)
|
|
70
|
-
- [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
|
|
71
|
-
|
|
72
|
-
### Context stack (Hook 5)
|
|
73
|
-
|
|
74
|
-
- **Context editing:** Remove stale tool results and thinking blocks selectively ([Context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing)).
|
|
75
|
-
- **Subagents:** Fork fresh windows for isolated subtasks; post cites **+2.8%** BrowseComp vs best single-agent for Opus 4.6 ([Subagents](https://code.claude.com/docs/en/sub-agents)).
|
|
76
|
-
- **Compaction:** Summarize prior context for long horizons ([Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction)); effectiveness varies by model generation (see Hook 9 table).
|
|
77
|
-
- **Memory folder:** Persist agent-chosen state via the memory tool / files ([Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool)).
|
|
78
|
-
|
|
79
|
-
### Prompt caching (Hook 6)
|
|
80
|
-
|
|
81
|
-
The Messages API is stateless. Maximize [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching): **stable prefix first, dynamic tail last**; **append** via messages; **avoid mid-session model switches** (use a subagent for cheaper models); **treat tool list as cached prefix**; use **tool search** to append without invalidation; **advance breakpoints** toward the latest message. Cached tokens cost **10% of base input**.
|
|
82
|
-
|
|
83
|
-
### Typed tools vs bash strings (Hook 7)
|
|
84
|
-
|
|
85
|
-
Promote actions to **dedicated tools** with typed arguments when the harness must intercept, gate, render (e.g., **modals**), or audit—**hard-to-reverse** steps (e.g., external API calls) for user confirmation; **write/edit** paths with **staleness checks** so concurrent edits are not blindly overwritten ([Harnessing Claude's intelligence](https://claude.com/blog/harnessing-claudes-intelligence)).
|
|
86
|
-
|
|
87
|
-
### Standing review: dedicated tools vs general bash + policy (Hook 8)
|
|
88
|
-
|
|
89
|
-
Re-evaluate promotions as models improve—e.g., Claude Code **auto-mode** (secondary reviewer over bash strings) can **reduce** bespoke tools **only** where users accept that trust profile; **high-stakes** actions still warrant dedicated tools ([Claude Code auto-mode](https://www.anthropic.com/engineering/claude-code-auto-mode)).
|
|
90
|
-
|
|
91
|
-
### Benchmark vignettes — motivation only, not guarantees (Hook 9)
|
|
92
|
-
|
|
93
|
-
| Vignette | Outcome stated in the post |
|
|
94
|
-
|----------|----------------------------|
|
|
95
|
-
| SWE-bench Verified | Claude 3.5 Sonnet **49%** with bash + editor only (then SOTA framing) |
|
|
96
|
-
| BrowseComp + output filtering | Opus 4.6 **45.3% → 61.6%** |
|
|
97
|
-
| BrowseComp + subagents | Opus 4.6 **+2.8%** vs best single-agent |
|
|
98
|
-
| BrowseComp + compaction | Sonnet 4.5 **43%** flat; Opus 4.5 **68%**; Opus 4.6 **84%** (same setup) |
|
|
99
|
-
| BrowseComp-Plus + memory folder | Sonnet 4.5 **60.4% → 67.2%** |
|
|
100
|
-
| Prompt caching | Cached tokens **10%** the cost of base input tokens |
|
|
101
|
-
|
|
102
|
-
## NotebookLM Audio Overview customization (example)
|
|
103
|
-
|
|
104
|
-
Adapt `[FOCUS AREA]` per notebook. Pair with Deep Dive + Longer in the product UI when that matches the user's plan.
|
|
105
|
-
|
|
106
|
-
```text
|
|
107
|
-
Target audience: [Expert-level listener profile -- skip beginner padding.]
|
|
108
|
-
|
|
109
|
-
Focus: [FOCUS AREA -- single notebook-specific paragraph.]
|
|
110
|
-
|
|
111
|
-
Style: [Technical depth, anti-patterns, implications for builders.]
|
|
112
|
-
|
|
113
|
-
Prioritize: [Technical depth and specific findings over marketing tone or generic summaries.]
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Agent checklist pattern
|
|
117
|
-
|
|
118
|
-
For long tasks, optional checklist the model can mirror:
|
|
119
|
-
|
|
120
|
-
```text
|
|
121
|
-
Copy this checklist and mark items as you go:
|
|
122
|
-
|
|
123
|
-
Progress:
|
|
124
|
-
- [ ] ...
|
|
125
|
-
- [ ] ...
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Agentic state management
|
|
129
|
-
|
|
130
|
-
For `agent-harness` prompts that span multiple context windows, include state persistence and multi-window patterns. Based on Anthropic's guidance:
|
|
131
|
-
|
|
132
|
-
### Context awareness
|
|
133
|
-
|
|
134
|
-
Claude 4.6 tracks its remaining context window. Include harness capabilities so Claude can plan accordingly:
|
|
135
|
-
|
|
136
|
-
```text
|
|
137
|
-
<context_management>
|
|
138
|
-
Your context window will be automatically compacted as it approaches its limit, allowing you to continue working indefinitely from where you left off. Do not stop tasks early due to token budget concerns. As you approach the limit, save current progress and state before the context window refreshes. Always be as persistent and autonomous as possible and complete tasks fully.
|
|
139
|
-
</context_management>
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Multi-window workflow
|
|
143
|
-
|
|
144
|
-
Anthropic recommends differentiating the first context window from subsequent ones:
|
|
145
|
-
|
|
146
|
-
**First window:** Set up the framework -- write tests, create setup scripts, establish the todo-list.
|
|
147
|
-
|
|
148
|
-
**Subsequent windows:** Iterate on the todo-list, using state files to resume.
|
|
149
|
-
|
|
150
|
-
Key patterns from Anthropic:
|
|
151
|
-
- Have the model write tests in a **structured format** (e.g. `tests.json` with `{id, name, status}`) before starting work. Remind: "It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality."
|
|
152
|
-
- Encourage **setup scripts** (e.g. `init.sh`) to start servers, run test suites, and linters. This prevents repeated work across windows.
|
|
153
|
-
- When starting fresh, be **prescriptive about resumption**: "Review progress.txt, tests.json, and the git logs."
|
|
154
|
-
- Provide **verification tools** (Playwright, computer use) for autonomous UI testing.
|
|
155
|
-
|
|
156
|
-
### State tracking
|
|
157
|
-
|
|
158
|
-
```text
|
|
159
|
-
<state_management>
|
|
160
|
-
Track progress in structured + freeform files:
|
|
161
|
-
- tests.json: structured test status {id, name, status}
|
|
162
|
-
- progress.txt: freeform session notes and next steps
|
|
163
|
-
- Use git commits as checkpoints for rollback
|
|
164
|
-
|
|
165
|
-
When approaching context limits, save current state before the window refreshes.
|
|
166
|
-
Do not stop tasks early due to token budget concerns.
|
|
167
|
-
</state_management>
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Encouraging complete context usage
|
|
171
|
-
|
|
172
|
-
```text
|
|
173
|
-
This is a very long task, so it may be beneficial to plan out your work clearly. It's encouraged to spend your entire output context working on the task - just make sure you don't run out of context with significant uncommitted work. Continue working systematically until you have completed this task.
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Research prompt pattern
|
|
177
|
-
|
|
178
|
-
For `research` prompt types, include structured investigation with hypothesis tracking:
|
|
179
|
-
|
|
180
|
-
```text
|
|
181
|
-
<research_approach>
|
|
182
|
-
Search for this information in a structured way. As you gather data, develop several competing hypotheses. Track your confidence levels in your progress notes to improve calibration. Regularly self-critique your approach and plan. Update a hypothesis tree or research notes file to persist information and provide transparency. Break down this complex research task systematically.
|
|
183
|
-
</research_approach>
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Evaluation loop
|
|
187
|
-
|
|
188
|
-
For prompt drafts that must hold up over time:
|
|
189
|
-
|
|
190
|
-
1. Run the draft on 2-3 representative user utterances.
|
|
191
|
-
2. Note failure modes (skipped steps, wrong format, over-refusal).
|
|
192
|
-
3. Tighten **constraints** or add **examples** for the failure class only.
|
|
193
|
-
|
|
194
|
-
Anthropic's **self-correction chaining** pattern extends this: generate a draft, have Claude review it against criteria, then have Claude refine based on the review. Each step can be a separate API call for inspection and branching.
|
|
195
|
-
|
|
196
|
-
## Anti-test-fixation pattern
|
|
197
|
-
|
|
198
|
-
```text
|
|
199
|
-
Write general-purpose solutions using the standard tools available. Implement logic that works correctly for all valid inputs, not just the test cases. Tests verify correctness -- they do not define the solution. If a test seems incorrect or the task is unreasonable, flag it rather than working around it.
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Commit-and-execute pattern
|
|
203
|
-
|
|
204
|
-
```text
|
|
205
|
-
When deciding how to approach a problem, choose an approach and commit to it. Avoid revisiting decisions unless you encounter new information that directly contradicts your reasoning. If you are weighing two approaches, pick one and see it through. You can always course-correct later if the chosen approach fails.
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Debug JSON schema (prompt-generator pipeline)
|
|
209
|
-
|
|
210
|
-
Use **only** when the user explicitly requests debug output (for example `show debug`, `full audit table`, `raw internal object`). Default assistant turns complete the normal handoff first: one `xml` fence + **`## Outcome digest`** (see also `TARGET_OUTPUT.md`); this JSON object is an optional appendix **after** that handoff.
|
|
211
|
-
|
|
212
|
-
Shape (field names stable for internal audit helpers and Stop-hook leak detection):
|
|
213
|
-
|
|
214
|
-
```json
|
|
215
|
-
{
|
|
216
|
-
"pipeline_mode": "internal_section_refinement_with_final_audit",
|
|
217
|
-
"scope_block": {
|
|
218
|
-
"target_local_roots": ["..."],
|
|
219
|
-
"target_canonical_roots": ["..."],
|
|
220
|
-
"target_file_globs": ["..."],
|
|
221
|
-
"comparison_basis": "...",
|
|
222
|
-
"completion_boundary": "..."
|
|
223
|
-
},
|
|
224
|
-
"required_sections": ["role", "background", "instructions", "constraints", "output_format", "illustrations"],
|
|
225
|
-
"base_prompt_xml": "<role>...</role><background>...</background><instructions>...</instructions><constraints>...</constraints><illustrations>...</illustrations><output_format>...</output_format>",
|
|
226
|
-
"section_scope_rule": "Each refiner edits exactly one section and returns sibling sections unchanged.",
|
|
227
|
-
"section_output_contract": {
|
|
228
|
-
"required_fields": ["improved_block", "rationale", "concise_diff"]
|
|
229
|
-
},
|
|
230
|
-
"merge_output_contract": {
|
|
231
|
-
"required_fields": ["canonical_prompt_xml"]
|
|
232
|
-
},
|
|
233
|
-
"audit_output_contract": {
|
|
234
|
-
"required_fields": [
|
|
235
|
-
"overall_status",
|
|
236
|
-
"checklist_results",
|
|
237
|
-
"evidence_quotes",
|
|
238
|
-
"source_refs",
|
|
239
|
-
"corrective_edits",
|
|
240
|
-
"retry_count"
|
|
241
|
-
]
|
|
242
|
-
},
|
|
243
|
-
"checklist_results": {
|
|
244
|
-
"<row_name>": {
|
|
245
|
-
"status": "pass|fail",
|
|
246
|
-
"evidence_quote": "exact quote used for verification",
|
|
247
|
-
"source_ref": "URL or local path",
|
|
248
|
-
"fix_if_fail": "concrete edit text (empty only if pass)"
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
`checklist_results` keys must include all **15** compliance row ids from `SKILL.md` §11 (for example `reversible_action_and_safety_check_guidance`, `scope_terms_explicit_and_anchored`).
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# Prompt Refinement Pipeline Runbook
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
Validate deterministic behavior for:
|
|
6
|
-
|
|
7
|
-
1. Base prompt generation (`/prompt-generator`)
|
|
8
|
-
2. Six section refiners (owned by `/prompt-generator`)
|
|
9
|
-
3. Merge + final audit with citation-grounded checks
|
|
10
|
-
4. Targeted fix + capped re-audit loop
|
|
11
|
-
|
|
12
|
-
## Sample Input
|
|
13
|
-
|
|
14
|
-
Use this command:
|
|
15
|
-
|
|
16
|
-
```text
|
|
17
|
-
/prompt-generator Create a trusted final system prompt for a coding agent that edits files safely, follows user scope, and returns concise status updates.
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Expected Stage Artifacts
|
|
21
|
-
|
|
22
|
-
1. **Base stage**
|
|
23
|
-
- Scope block is present and explicit:
|
|
24
|
-
- `target_local_roots`
|
|
25
|
-
- `target_canonical_roots` (if applicable)
|
|
26
|
-
- `target_file_globs`
|
|
27
|
-
- `comparison_basis`
|
|
28
|
-
- `completion_boundary`
|
|
29
|
-
- XML scaffold includes all sections — verified by the Stop hook at runtime; each required section tag must have both an opening and a closing tag:
|
|
30
|
-
- `<role>`
|
|
31
|
-
- `<background>`
|
|
32
|
-
- `<instructions>`
|
|
33
|
-
- `<constraints>`
|
|
34
|
-
- `<output_format>`
|
|
35
|
-
- `<illustrations>`
|
|
36
|
-
- Includes internal refinement object with:
|
|
37
|
-
- `pipeline_mode: internal_section_refinement_with_final_audit`
|
|
38
|
-
- `required_sections` list with all six sections
|
|
39
|
-
- section/merge/audit output contracts
|
|
40
|
-
|
|
41
|
-
2. **Section refinement stage**
|
|
42
|
-
- Exactly 6 agent runs, one per section.
|
|
43
|
-
- Each section output includes:
|
|
44
|
-
- `improved_block`
|
|
45
|
-
- `rationale`
|
|
46
|
-
- `concise_diff`
|
|
47
|
-
- No section agent edits another section.
|
|
48
|
-
|
|
49
|
-
3. **Merge stage**
|
|
50
|
-
- One canonical merged prompt with all six sections.
|
|
51
|
-
|
|
52
|
-
4. **Audit stage**
|
|
53
|
-
- Output includes:
|
|
54
|
-
- `overall_status`
|
|
55
|
-
- `checklist_results`
|
|
56
|
-
- `corrective_edits`
|
|
57
|
-
- `retry_count`
|
|
58
|
-
- Every checklist item includes:
|
|
59
|
-
- `status`
|
|
60
|
-
- `evidence_quote` (direct quote)
|
|
61
|
-
- `source_ref`
|
|
62
|
-
- `fix_if_fail`
|
|
63
|
-
|
|
64
|
-
5. **Final output**
|
|
65
|
-
- One complete prompt block that is copy-pasteable.
|
|
66
|
-
- Internal refinement object is not shown unless debug output was requested.
|
|
67
|
-
- Default output must not leak the raw internal refinement object fields.
|
|
68
|
-
|
|
69
|
-
## Deterministic Checklist Coverage
|
|
70
|
-
|
|
71
|
-
Audit report must include all check IDs:
|
|
72
|
-
|
|
73
|
-
- `structured_scoped_instructions`
|
|
74
|
-
- `sequential_steps_present`
|
|
75
|
-
- `positive_framing`
|
|
76
|
-
- `acceptance_criteria_defined`
|
|
77
|
-
- `safety_reversibility_language`
|
|
78
|
-
- `reversible_action_and_safety_check_guidance`
|
|
79
|
-
- `concrete_output_contract`
|
|
80
|
-
- `scope_boundary_present`
|
|
81
|
-
- `explicit_scope_anchors_present`
|
|
82
|
-
- `all_instructions_artifact_bound`
|
|
83
|
-
- `scope_terms_explicit_and_anchored`
|
|
84
|
-
- `completion_boundary_measurable`
|
|
85
|
-
- `citation_grounding_policy_present`
|
|
86
|
-
- `source_priority_rules_present`
|
|
87
|
-
- `artifact_language_confidence`
|
|
88
|
-
|
|
89
|
-
## Citation and Grounding Validation
|
|
90
|
-
|
|
91
|
-
For each factual compliance claim in the audit:
|
|
92
|
-
|
|
93
|
-
- Include a source citation
|
|
94
|
-
- Include a word-for-word quote
|
|
95
|
-
- If unsupported, explicitly return "I don't know"
|
|
96
|
-
|
|
97
|
-
Source priority must be applied in this order:
|
|
98
|
-
|
|
99
|
-
1. Official vendor docs (external behavior)
|
|
100
|
-
2. Local project files (local behavior)
|
|
101
|
-
3. Academic / named experts
|
|
102
|
-
4. Reputable external URLs
|
|
103
|
-
5. Blog/community content
|
|
104
|
-
|
|
105
|
-
## Non-pass Loop Validation
|
|
106
|
-
|
|
107
|
-
If `overall_status` is `fail`:
|
|
108
|
-
|
|
109
|
-
1. Apply only targeted edits listed in `corrective_edits`
|
|
110
|
-
2. Re-run audit
|
|
111
|
-
3. Stop after retry cap (`max_retries: 2` unless explicitly overridden)
|
|
112
|
-
4. Return unresolved failures with evidence if still failing at cap
|
|
113
|
-
|
|
114
|
-
## Ownership and Execution-Intent Validation
|
|
115
|
-
|
|
116
|
-
- Prompt refinement remains inside `/prompt-generator`.
|
|
117
|
-
- `/agent-prompt` is used only after explicit execution/delegation intent.
|
|
118
|
-
- Execution handoffs that go through `/agent-prompt` carry scope-block context in the execution prompt as needed.
|
|
119
|
-
- Final refined prompt content is treated as artifact text during refinement and audit.
|
|
120
|
-
- Execution steps (when requested) are bound to scope block artifacts.
|
|
121
|
-
|
|
122
|
-
## Scope-Phrasing Validation
|
|
123
|
-
|
|
124
|
-
- Reject ambiguous scope wording such as "this session", "current files", "here", "above", or "as needed" when used as scope boundaries.
|
|
125
|
-
- Require artifact-bound replacements using explicit roots, globs, comparison basis, and measurable completion boundary.
|
|
126
|
-
|
|
127
|
-
## Runtime Hook Gate Validation
|
|
128
|
-
|
|
129
|
-
Validate fail-closed runtime gates:
|
|
130
|
-
|
|
131
|
-
1. **Stop leakage/scope/checklist gate**
|
|
132
|
-
- **Section-presence gate (Stop)** — Block responses where the fenced XML artifact is missing any of the five required section tag pairs: `role`, `background`, `instructions`, `constraints`, `output_format`.
|
|
133
|
-
- Block responses that leak raw internal refinement object fields unless debug intent is explicit.
|
|
134
|
-
- Block responses missing deterministic checklist rows when audit output is present.
|
|
135
|
-
- Block responses using ambiguous scope phrasing in scope-bound sections.
|
|
136
|
-
- Block responses containing negative keywords (no, not, don't, never, avoid, etc.) inside fenced XML artifacts.
|
|
137
|
-
- Block responses containing hedging language (might be, possibly, I think, etc.) inside fenced XML artifacts.
|
|
138
|
-
|
|
139
|
-
## Context-Footprint Controls
|
|
140
|
-
|
|
141
|
-
- Keep baseline prompt-workflow policy minimal by default.
|
|
142
|
-
- Store stable enforcement text in hooks/rules; avoid repeating full policy blocks in prompt artifacts.
|
|
143
|
-
- Load heavy skills on demand based on explicit task intent.
|
|
144
|
-
- Prefer canonical references and compact outputs over repeated long policy text.
|
|
145
|
-
|
|
146
|
-
## Deterministic vs Semantic Boundary
|
|
147
|
-
|
|
148
|
-
- **Deterministic (fail-closed):**
|
|
149
|
-
- Missing required scope anchors (when Stop guard applies)
|
|
150
|
-
- Raw internal object leakage without debug intent
|
|
151
|
-
- Missing required checklist rows in audit output
|
|
152
|
-
- Missing required XML sections (`role`, `background`, `instructions`, `constraints`, `output_format`) in the fenced artifact (opening and closing tags)
|
|
153
|
-
- Ambiguous scope terms in scope-bound text
|
|
154
|
-
- Negative keywords inside fenced XML artifacts
|
|
155
|
-
- Hedging language inside fenced XML artifacts
|
|
156
|
-
- **Semantic-only (auditor layer):**
|
|
157
|
-
- Overall quality/readability of scope wording beyond banned-term checks
|
|
158
|
-
- Whether instruction binding quality is "good enough" beyond explicit anchor presence
|
|
159
|
-
- Whether context compaction is optimal for a specific task
|
|
160
|
-
|
|
161
|
-
## Doc Alignment Validation
|
|
162
|
-
|
|
163
|
-
Each major workflow requirement added in skills text must map to at least one principle:
|
|
164
|
-
|
|
165
|
-
- Structured/scoped instructions
|
|
166
|
-
- Clear sequential process
|
|
167
|
-
- Positive framing
|
|
168
|
-
- Explicit acceptance criteria
|
|
169
|
-
- Concrete output format contract
|
|
170
|
-
- Reversibility/safety constraints
|
|
171
|
-
|
|
172
|
-
## Traceability Validation
|
|
173
|
-
|
|
174
|
-
Each major requirement in skill text should point to:
|
|
175
|
-
|
|
176
|
-
- Anthropic best-practice URL, and/or
|
|
177
|
-
- Local source file path used as authority
|