@dezycro-ai/agent-plugin 2.0.0
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/.claude-plugin/plugin.json +7 -0
- package/LICENSE +18 -0
- package/PERSONAS.md +309 -0
- package/README.md +125 -0
- package/bin/resolve-auth.js +112 -0
- package/dist/hooks/lib/authoring.d.ts +118 -0
- package/dist/hooks/lib/authoring.js +277 -0
- package/dist/hooks/lib/config.d.ts +28 -0
- package/dist/hooks/lib/config.js +175 -0
- package/dist/hooks/lib/controller-match.d.ts +16 -0
- package/dist/hooks/lib/controller-match.js +96 -0
- package/dist/hooks/lib/coverage.d.ts +17 -0
- package/dist/hooks/lib/coverage.js +66 -0
- package/dist/hooks/lib/hashing.d.ts +8 -0
- package/dist/hooks/lib/hashing.js +49 -0
- package/dist/hooks/lib/logging.d.ts +13 -0
- package/dist/hooks/lib/logging.js +72 -0
- package/dist/hooks/lib/publish-spec.d.ts +17 -0
- package/dist/hooks/lib/publish-spec.js +64 -0
- package/dist/hooks/lib/quality-gate.d.ts +67 -0
- package/dist/hooks/lib/quality-gate.js +187 -0
- package/dist/hooks/lib/router.d.ts +32 -0
- package/dist/hooks/lib/router.js +717 -0
- package/dist/hooks/lib/state.d.ts +34 -0
- package/dist/hooks/lib/state.js +238 -0
- package/dist/hooks/lib/undo.d.ts +11 -0
- package/dist/hooks/lib/undo.js +71 -0
- package/dist/hooks/lib/verify.d.ts +28 -0
- package/dist/hooks/lib/verify.js +94 -0
- package/dist/hooks/lib/workbook.d.ts +21 -0
- package/dist/hooks/lib/workbook.js +77 -0
- package/dist/hooks/types.d.ts +249 -0
- package/dist/hooks/types.js +14 -0
- package/hooks/companion-runner +108 -0
- package/hooks/hooks.json +74 -0
- package/install.js +84 -0
- package/package.json +50 -0
- package/prompts/existing-work-ranker.md +47 -0
- package/prompts/prd-drafter.md +53 -0
- package/prompts/prd-question.md +66 -0
- package/prompts/trd-context-gate.md +57 -0
- package/prompts/trd-discovery.md +71 -0
- package/prompts/trd-drafter.md +63 -0
- package/prompts/trd-question.md +61 -0
- package/prompts/trd-reviewer.md +74 -0
- package/prompts/workbook-sweep.md +89 -0
- package/setup.js +35 -0
- package/skills/author/SKILL.md +285 -0
- package/skills/import-features/SKILL.md +428 -0
- package/skills/init/SKILL.md +133 -0
- package/skills/publish-spec/SKILL.md +101 -0
- package/skills/status/SKILL.md +76 -0
- package/skills/sync/SKILL.md +76 -0
- package/skills/verify/SKILL.md +248 -0
- package/skills/work/SKILL.md +201 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: author
|
|
3
|
+
description: Author or revise a Dezycro PRD or TRD via the V2 guided flow — discovery, clarifying Q&A, drafting, and quality gates. Use when the user wants to write or significantly revise a PRD or TRD for a feature. Accepts an optional feature name or UUID and flags `--doc prd | --doc trd` and `--revise-existing`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Author PRD/TRD (V2 Guided Flow)
|
|
7
|
+
|
|
8
|
+
You are walking the user through guided authoring of a Dezycro PRD or TRD. The driver is a state machine; you persist transitions and the QA transcript so the loop survives compaction.
|
|
9
|
+
|
|
10
|
+
## Hard Rules — Read Before Anything Else
|
|
11
|
+
|
|
12
|
+
1. **No TRD without an APPROVED PRD.** Per EC-14 — refuse early in `DETECT_INTENT` if the feature has no PRD or the PRD is not `APPROVED`. Offer to author the PRD first.
|
|
13
|
+
2. **TRD quality gate is non-negotiable.** Deterministic checks + P-9 reviewer must both pass before `change_document_status(trdId, APPROVED)`. The `PreToolUse:change_document_status` hook will block the call belt-and-suspenders.
|
|
14
|
+
3. **Min-context gate is non-negotiable.** `MIN_CONTEXT_GATE` must pass deterministic checks AND P-7 before drafting a TRD.
|
|
15
|
+
4. **Suppress pillar-3 auto-logging while authoring.** Always start the session by calling `companion-runner authoring-state --set=enter ...`. The Stop hook reads `companion-state.json:authoringMode` and skips the workbook sweep. Always call `--set=exit` on FINALIZE / cancel.
|
|
16
|
+
5. **Intent statements during authoring DO NOT go to the workbook.** Decisions, assumptions, issues raised during authoring belong in the draft itself, not as `add_decision` / `add_issue` / `add_assumption` calls.
|
|
17
|
+
6. **No placeholders, no hallucinations.** Every claim in the draft must be grounded in the seed, QA transcript, repo discovery, or PRD content. If you cannot ground a section, it goes into `## Open Questions`.
|
|
18
|
+
|
|
19
|
+
## State Machine (TRD §5.5.1)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
IDLE
|
|
23
|
+
└─→ DETECT_INTENT (seed gathering)
|
|
24
|
+
├─→ SCAN_EXISTING_WORK (skippable, PRD)
|
|
25
|
+
├─→ CLARIFY (adaptive depth, interruptible)
|
|
26
|
+
├─→ PROPOSE_PLACEMENT (PRD only, skippable)
|
|
27
|
+
├─→ CREATE_FEATURE (PRD only, new features)
|
|
28
|
+
├─→ TRD_DISCOVERY (TRD only)
|
|
29
|
+
├─→ MIN_CONTEXT_GATE (TRD only, non-skippable)
|
|
30
|
+
├─→ DRAFT
|
|
31
|
+
├─→ ITERATE (skippable)
|
|
32
|
+
├─→ QUALITY_GATE (TRD only, non-skippable)
|
|
33
|
+
└─→ FINALIZE
|
|
34
|
+
└─→ IDLE
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Skip phrases**: `skip`, `draft it`, `just write it`, `next` — case-insensitive, trailing punctuation OK. These short-circuit the current step EXCEPT in `MIN_CONTEXT_GATE` and `QUALITY_GATE`.
|
|
38
|
+
|
|
39
|
+
**Skill arguments** (`$ARGUMENTS`):
|
|
40
|
+
- positional: feature name or UUID (optional — drives DETECT_INTENT)
|
|
41
|
+
- `--doc prd` | `--doc trd` (defaults: see DETECT_INTENT)
|
|
42
|
+
- `--revise-existing` (TRD only, per TRD §5.5.4)
|
|
43
|
+
|
|
44
|
+
## Step 0: Read Repo Config
|
|
45
|
+
|
|
46
|
+
Read `.dezycro/config.json` from the repo root. If missing, tell the user:
|
|
47
|
+
|
|
48
|
+
> No `.dezycro/config.json` found. Run `/dezycro:init` first to set up this repository.
|
|
49
|
+
|
|
50
|
+
Stop. Otherwise extract `workspaceId` and `projectId`.
|
|
51
|
+
|
|
52
|
+
## Step 1: DETECT_INTENT
|
|
53
|
+
|
|
54
|
+
Parse `$ARGUMENTS`. Three sub-paths:
|
|
55
|
+
|
|
56
|
+
**(a) Feature provided + `--doc trd`** → TRD flow. Validate PRD is APPROVED (see Step 2 TRD).
|
|
57
|
+
**(b) Feature provided + `--doc prd`** → PRD flow for an existing feature (typically `--revise-existing` style PRD edits). Confirm with user before reopening if PRD is already APPROVED (EC-10).
|
|
58
|
+
**(c) No `--doc` or no feature** → ask the user via `AskUserQuestion`:
|
|
59
|
+
- "Are we authoring a PRD (new feature concept) or a TRD (technical design for an existing feature)?"
|
|
60
|
+
|
|
61
|
+
For a **PRD with no feature seed**, prompt the user for a one-paragraph seed describing the problem they want to solve. Store it; you'll feed it into P-2 / P-3 / P-4.
|
|
62
|
+
|
|
63
|
+
For a **TRD**, resolve the feature ID via `search_features` (mirror `/dezycro:work` Step 2). Call `list_feature_documents(workspaceId, featureId)`:
|
|
64
|
+
- If no PRD or PRD `status != "APPROVED"` → **REFUSE per EC-14**:
|
|
65
|
+
> Cannot author TRD: no approved PRD exists for this feature. Run `/dezycro:author --doc prd` first.
|
|
66
|
+
- Otherwise capture `prdDocId` and call `get_document(workspaceId, featureId, prdDocId)` to load `prdContent`. Also check if a TRD already exists — if so and `--revise-existing` not passed, ask: "A TRD exists for this feature. Revise it (re-enter authoring) or cancel?"
|
|
67
|
+
|
|
68
|
+
Once the doc type and (for TRD) the feature are known, **enter authoring mode** by running:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
${CLAUDE_PLUGIN_ROOT}/hooks/companion-runner authoring-state \
|
|
72
|
+
--set=enter --doc-id=<docId-or-placeholder> --doc-type=<PRD|TRD> \
|
|
73
|
+
--feature-id=<featureId-or-empty> --seed=<short-seed-text>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
(For PRDs on a brand-new feature, you won't have `docId` yet — use a temporary id like `prd-pending-<ts>` and re-enter once you've created the feature in CREATE_FEATURE.)
|
|
77
|
+
|
|
78
|
+
This sets `authoringMode=true` so the Stop hook will skip the workbook sweep for this session.
|
|
79
|
+
|
|
80
|
+
## Step 2: Route by Doc Type
|
|
81
|
+
|
|
82
|
+
### Step 2A: PRD Flow (TRD §5.5.2)
|
|
83
|
+
|
|
84
|
+
#### SCAN_EXISTING_WORK (skippable)
|
|
85
|
+
|
|
86
|
+
Call `search_features(workspaceId, projectId, query=keyTermsFromSeed)`. Take up to the top 10 results.
|
|
87
|
+
|
|
88
|
+
Read `${CLAUDE_PLUGIN_ROOT}/prompts/existing-work-ranker.md` (this is P-2). Substitute `{{seed_paragraph}}` and `{{search_results_json}}` with the seed and the search-result JSON, then **invoke P-2 in your own context** — produce the strict JSON output the prompt specifies. Show the user the top 3 results with a one-line rationale each.
|
|
89
|
+
|
|
90
|
+
Ask: "Is your feature an extension of any of these, or genuinely new?" If the user picks an adjacent feature, switch to a revise-PRD flow on that feature. If "new" or skip phrase → continue.
|
|
91
|
+
|
|
92
|
+
#### CLARIFY (interruptible, adaptive)
|
|
93
|
+
|
|
94
|
+
Loop:
|
|
95
|
+
1. Read `${CLAUDE_PLUGIN_ROOT}/prompts/prd-question.md` (P-3). Substitute placeholders with the seed, `answered_categories_json` (categories you've already covered), the QA transcript so far, and the adjacent-features JSON.
|
|
96
|
+
2. Invoke P-3 in context to produce the next question (one at a time, JSON-validated).
|
|
97
|
+
3. If `should_stop=true`, exit the loop and continue to PROPOSE_PLACEMENT.
|
|
98
|
+
4. Otherwise ask the user the `next_question`. Use `AskUserQuestion` with the provided `options` when `question_kind == "multiple_choice"`; otherwise open-ended.
|
|
99
|
+
5. Append the answer to `.dezycro/authoring-transcript.json` (under `qaTurns`) so it survives compaction.
|
|
100
|
+
6. If the user's message matches a skip phrase, exit the loop and continue.
|
|
101
|
+
|
|
102
|
+
#### PROPOSE_PLACEMENT (skippable)
|
|
103
|
+
|
|
104
|
+
Call `suggest_placement(workspaceId, projectId, seedSummary)`. Show the proposed directory; let the user override or accept. Skip phrase → use the top suggestion.
|
|
105
|
+
|
|
106
|
+
#### CREATE_FEATURE
|
|
107
|
+
|
|
108
|
+
Call `create_feature(workspaceId, projectId, name, directoryId)`. Capture the new `featureId` and the auto-created PRD `docId`. **Re-enter authoring** with the now-real `docId`:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
${CLAUDE_PLUGIN_ROOT}/hooks/companion-runner authoring-state \
|
|
112
|
+
--set=enter --doc-id=<real-prd-docId> --doc-type=PRD --feature-id=<featureId>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### DRAFT
|
|
116
|
+
|
|
117
|
+
Read `${CLAUDE_PLUGIN_ROOT}/prompts/prd-drafter.md` (P-4). Substitute `{{seed}}`, `{{qa_transcript_json}}`, `{{adjacent_features_json}}`, and `{{existing_content_or_null}}`. Invoke P-4 in context to produce the PRD Markdown. Validate it locally (≥500 chars, required section headings present per the P-4 system prompt).
|
|
118
|
+
|
|
119
|
+
Write the draft to the document:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
update_document(workspaceId, featureId, docId, content=<the draft>)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### ITERATE (skippable)
|
|
126
|
+
|
|
127
|
+
Accept user edits. For substantive revisions, re-invoke P-4 with the prior draft as `existing_content`. For minor wording, edit directly.
|
|
128
|
+
|
|
129
|
+
#### FINALIZE
|
|
130
|
+
|
|
131
|
+
Call `change_document_status(workspaceId, featureId, docId, status=APPROVED)`. **PRD finalize is NOT gated** — the PreToolUse hook lets it through.
|
|
132
|
+
|
|
133
|
+
Then exit authoring mode:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
${CLAUDE_PLUGIN_ROOT}/hooks/companion-runner authoring-state --set=exit
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Tell the user:
|
|
140
|
+
> PRD `<name>` approved. To author the TRD, run `/dezycro:author <feature-name> --doc trd`.
|
|
141
|
+
|
|
142
|
+
Command stops here.
|
|
143
|
+
|
|
144
|
+
### Step 2B: TRD Flow (TRD §5.5.3)
|
|
145
|
+
|
|
146
|
+
#### TRD_DISCOVERY
|
|
147
|
+
|
|
148
|
+
Build a structured repo + workbook context bundle:
|
|
149
|
+
|
|
150
|
+
1. **Stack detection** — read `package.json`, `pom.xml`, `build.gradle.kts`, `requirements.txt`, `go.mod`, etc. Note the language / framework.
|
|
151
|
+
2. **Controller / service / repository structure** — list a couple of representative paths via Glob (e.g., `**/controllers/**`, `**/services/**`, `**/repositories/**`).
|
|
152
|
+
3. **Migrations** — find the migrations dir (Flyway / Liquibase / Alembic / etc.).
|
|
153
|
+
4. **Queue / messaging config** — Kafka, Pub/Sub, NATS, etc. — grep around for clues.
|
|
154
|
+
5. **Auth config** — Spring Security, Zitadel, OAuth, etc.
|
|
155
|
+
6. **Workbook** — call `get_workbook(workspaceId, featureId)`. Capture assumptions, decisions, open issues.
|
|
156
|
+
|
|
157
|
+
Read `${CLAUDE_PLUGIN_ROOT}/prompts/trd-discovery.md` (P-5). Substitute `{{prd_content}}`, `{{repo_context_json}}` (the bundle you just built), and `{{workbook_json}}`. Invoke P-5 in context to produce `discoverySummary` JSON (strict schema: `confirmed_context`, `likely_conventions`, `missing_context`).
|
|
158
|
+
|
|
159
|
+
Persist it: append `discoverySummary` to `.dezycro/authoring-transcript.json` (your in-context state machine should also keep it in memory for the rest of the flow).
|
|
160
|
+
|
|
161
|
+
Show the user a compact summary:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Confirmed (from PRD / workbook): N facts
|
|
165
|
+
Likely conventions (inferred from repo): N facts
|
|
166
|
+
Missing context (needs Q&A): N items across <category list>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### CLARIFY
|
|
170
|
+
|
|
171
|
+
Read `${CLAUDE_PLUGIN_ROOT}/prompts/trd-question.md` (P-6). Substitute `{{discovery_summary_json}}`, `{{answered_categories_json}}`, `{{qa_transcript_json}}`. Invoke P-6 in context.
|
|
172
|
+
|
|
173
|
+
Loop the same way as the PRD CLARIFY step. Crucially: P-6 will NOT stop early until every category in `{DATA_MODEL, API_CONTRACT, STATE_OR_PERSISTENCE, FAILURE_MODES, MIGRATION_OR_ROLLOUT}` has either an answer or evidence in confirmed_context / likely_conventions.
|
|
174
|
+
|
|
175
|
+
If the user uses a skip phrase mid-loop, exit immediately — but warn them that MIN_CONTEXT_GATE may bounce the draft back.
|
|
176
|
+
|
|
177
|
+
#### MIN_CONTEXT_GATE (NON-SKIPPABLE)
|
|
178
|
+
|
|
179
|
+
This gate has two layers:
|
|
180
|
+
|
|
181
|
+
**Deterministic** — `lib/quality-gate.js:minContextGate` is the canonical implementation. For each of the five required categories (`data_model`, `api_contracts`, `state_or_persistence`, `failure_modes`, `migration_or_rollout`):
|
|
182
|
+
|
|
183
|
+
- gather entries from `discoverySummary.confirmed_context[category]` ∪ `discoverySummary.likely_conventions[category]` ∪ `qaTurns` whose `category` matches.
|
|
184
|
+
- require ≥ 1 entry AND combined evidence string (whitespace-normalized) is ≥ 80 characters.
|
|
185
|
+
|
|
186
|
+
If any category fails, return to CLARIFY and surface the missing list. Do not proceed.
|
|
187
|
+
|
|
188
|
+
**LLM layer (P-7)** — only if deterministic passes. Read `${CLAUDE_PLUGIN_ROOT}/prompts/trd-context-gate.md` (P-7). Substitute `{{discovery_summary_json}}` and `{{qa_transcript_json}}`. Invoke P-7 in context. If `ready=false`, surface the `missing` map and `rationale` to the user, return to CLARIFY.
|
|
189
|
+
|
|
190
|
+
If both layers pass → proceed to DRAFT.
|
|
191
|
+
|
|
192
|
+
#### DRAFT
|
|
193
|
+
|
|
194
|
+
Read `${CLAUDE_PLUGIN_ROOT}/prompts/trd-drafter.md` (P-8). Substitute `{{prd_content}}`, `{{discovery_summary_json}}`, `{{qa_transcript_json}}`, `{{existing_content_or_null}}`. Invoke P-8 in context to produce the TRD Markdown.
|
|
195
|
+
|
|
196
|
+
**Critical**: per P-8's contract, use the `Confirmed / Recommended Defaults / Open Questions` sub-structure where appropriate. Do NOT promote inferences to confirmed facts.
|
|
197
|
+
|
|
198
|
+
Write the draft via `update_document(workspaceId, featureId, trdId, content=<draft>)`.
|
|
199
|
+
|
|
200
|
+
**Then update the draft sidecar** — this is what the PreToolUse:change_document_status hook reads to enforce the deterministic gate belt-and-suspenders. Write the draft to `.dezycro/authoring-current-draft.json` with the shape:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"docId": "<trdId>",
|
|
205
|
+
"docType": "TRD",
|
|
206
|
+
"content": "<full TRD markdown>",
|
|
207
|
+
"prdDocId": "<prdDocId>",
|
|
208
|
+
"prdContent": "<full PRD markdown>",
|
|
209
|
+
"updatedTs": "<ISO timestamp>"
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Refresh this sidecar **every time** the TRD draft changes (DRAFT and any substantive ITERATE revision). The hook gates `change_document_status` against whatever is in the sidecar.
|
|
214
|
+
|
|
215
|
+
#### ITERATE (skippable)
|
|
216
|
+
|
|
217
|
+
Accept user edits; re-run P-8 for substantive revisions; refresh the sidecar after each rewrite.
|
|
218
|
+
|
|
219
|
+
#### QUALITY_GATE (NON-SKIPPABLE)
|
|
220
|
+
|
|
221
|
+
**Deterministic layer** — `lib/quality-gate.js:deterministicTrdGate` is the canonical implementation. Verify locally before invoking P-9:
|
|
222
|
+
|
|
223
|
+
- TRD content ≥ 1000 chars (trimmed).
|
|
224
|
+
- Required H2 sections present: `## Architecture`, `## Data Model`, `## API Contracts`, `## Failure Modes` (or `## Failure Modes and Edge ...`), `## Migration` (or `## Migration / Rollout`), `## Open Questions` (heading-case-insensitive).
|
|
225
|
+
- No placeholder tokens: regex `\b(TBD|TODO|FIXME|fill in later|to be determined)\b` (case-insensitive).
|
|
226
|
+
- PRD pillar coverage: parse the PRD's `^## Pillar \d+:\s*(.+)$` headings; each pillar name must appear verbatim in the TRD body.
|
|
227
|
+
|
|
228
|
+
If any of these fail → return to ITERATE with the blocking issues. Do not invoke P-9.
|
|
229
|
+
|
|
230
|
+
**P-9 layer** — read `${CLAUDE_PLUGIN_ROOT}/prompts/trd-reviewer.md`. Substitute `{{prd_content}}`, `{{trd_content}}`, `{{discovery_summary_json}}`. Invoke P-9 in context to produce the strict JSON output.
|
|
231
|
+
|
|
232
|
+
**Code-side enforcement** — per TRD §6.9 / `lib/quality-gate.js:enforceP9Result`, regardless of what `approved` says, the gate REJECTS if any of these are true:
|
|
233
|
+
- `score < 0.85`
|
|
234
|
+
- `suspected_inventions` contains any architecture / data-model / API-contract / migration / auth / queue / verifier-behavior claim (case-insensitive substring match).
|
|
235
|
+
|
|
236
|
+
On rejection: show `blocking_issues` and `suspected_inventions` to the user, return to ITERATE.
|
|
237
|
+
|
|
238
|
+
On pass: proceed to FINALIZE.
|
|
239
|
+
|
|
240
|
+
#### FINALIZE
|
|
241
|
+
|
|
242
|
+
Call `change_document_status(workspaceId, featureId, trdId, status=APPROVED)`. The PreToolUse hook will re-run the deterministic gate against the sidecar — if anything has drifted since your local check, the hook will block. If that happens, refresh the sidecar and try again.
|
|
243
|
+
|
|
244
|
+
On success, exit authoring mode:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
${CLAUDE_PLUGIN_ROOT}/hooks/companion-runner authoring-state --set=exit
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Tell the user:
|
|
251
|
+
> TRD `<name>` approved. You can now `/dezycro:work` this feature.
|
|
252
|
+
|
|
253
|
+
## Cancellation
|
|
254
|
+
|
|
255
|
+
If the user says "cancel" or "stop authoring" at any point, exit cleanly:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
${CLAUDE_PLUGIN_ROOT}/hooks/companion-runner authoring-state --set=exit
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Do NOT call `change_document_status` on the draft — leave the doc in `DRAFT` for the user to revisit.
|
|
262
|
+
|
|
263
|
+
## Compaction Survival
|
|
264
|
+
|
|
265
|
+
If your context is compacted mid-flow, the next `SessionStart` will inject the transcript summary because `authoringMode=true` on disk. On resume:
|
|
266
|
+
1. Re-read `.dezycro/authoring-transcript.json`.
|
|
267
|
+
2. Re-read `.dezycro/authoring-current-draft.json` if it exists (TRD only).
|
|
268
|
+
3. Ask the user where you left off ("It looks like we were drafting the TRD for `<feature>`. Want to keep iterating or restart from CLARIFY?").
|
|
269
|
+
|
|
270
|
+
## Prompt Reference
|
|
271
|
+
|
|
272
|
+
Read each prompt file from disk, substitute `{{placeholders}}` with current state (string replacement), and invoke the LLM call **in your own context** — do not shell out to a separate LLM API.
|
|
273
|
+
|
|
274
|
+
| Step | Prompt file | Section |
|
|
275
|
+
|---|---|---|
|
|
276
|
+
| SCAN_EXISTING_WORK (PRD) | `prompts/existing-work-ranker.md` | TRD §6.2 (P-2) |
|
|
277
|
+
| CLARIFY (PRD) | `prompts/prd-question.md` | TRD §6.3 (P-3) |
|
|
278
|
+
| DRAFT (PRD) | `prompts/prd-drafter.md` | TRD §6.4 (P-4) |
|
|
279
|
+
| TRD_DISCOVERY | `prompts/trd-discovery.md` | TRD §6.5 (P-5) |
|
|
280
|
+
| CLARIFY (TRD) | `prompts/trd-question.md` | TRD §6.6 (P-6) |
|
|
281
|
+
| MIN_CONTEXT_GATE LLM | `prompts/trd-context-gate.md` | TRD §6.7 (P-7) |
|
|
282
|
+
| DRAFT (TRD) | `prompts/trd-drafter.md` | TRD §6.8 (P-8) |
|
|
283
|
+
| QUALITY_GATE LLM | `prompts/trd-reviewer.md` | TRD §6.9 (P-9) |
|
|
284
|
+
|
|
285
|
+
Each prompt declares its strict JSON output schema (where applicable). If the JSON fails to parse, log it, treat as "no signal" for that step, and ask the user to retry the step.
|