@blxzer/cursor-trellis 0.3.6 → 0.4.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/CHANGELOG.md +39 -1
- package/README.md +10 -6
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +11 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +2 -1
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +7 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +61 -2
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +4 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +4 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.4.0.json +9 -0
- package/dist/migrations/manifests/0.4.1.json +9 -0
- package/dist/templates/common/{skills/check.md → bundled-skills/cstl-check/SKILL.md} +55 -7
- package/dist/templates/common/bundled-skills/cstl-check/references/fowler-12-smells.md +28 -0
- package/dist/templates/common/bundled-skills/cstl-handoff/SKILL.md +117 -0
- package/dist/templates/common/bundled-skills/cstl-micro-grill/SKILL.md +6 -0
- package/dist/templates/common/skills/brainstorm.md +15 -0
- package/dist/templates/cursor/agents/cstl-check.md +14 -0
- package/dist/templates/cursor/commands/handoff.md +99 -0
- package/dist/templates/markdown/index.d.ts +6 -0
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +6 -0
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/guides/artifact-locale-guide.md.txt +93 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +7 -7
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +10 -8
- package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -0
- package/dist/templates/markdown/spec/guides/goal-release-regression-runbook.md.txt +132 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +37 -0
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +139 -0
- package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +4 -0
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +138 -0
- package/dist/templates/markdown/spec/guides/verification-strength-guide.md.txt +1 -0
- package/dist/templates/trellis/CONTEXT.md +53 -0
- package/dist/templates/trellis/docs/adr/README.md +21 -0
- package/dist/templates/trellis/index.d.ts +14 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +29 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/pool/README.md +103 -0
- package/dist/templates/trellis/pool/items/.gitkeep +0 -0
- package/dist/templates/trellis/pool/plan.md +26 -0
- package/dist/templates/trellis/scripts/common/artifact_locale.py +16 -0
- package/dist/templates/trellis/scripts/common/pool_store.py +702 -0
- package/dist/templates/trellis/scripts/common/task_dashboard.py +8 -0
- package/dist/templates/trellis/scripts/common/task_dependencies.py +673 -0
- package/dist/templates/trellis/scripts/common/task_gates.py +58 -5
- package/dist/templates/trellis/scripts/common/task_store.py +256 -0
- package/dist/templates/trellis/scripts/common/test_depends_mode_block.py +489 -0
- package/dist/templates/trellis/scripts/common/test_pool_store.py +428 -0
- package/dist/templates/trellis/scripts/common/test_task_dependencies.py +345 -0
- package/dist/templates/trellis/scripts/pool.py +192 -0
- package/dist/templates/trellis/scripts/task.py +66 -1
- package/dist/templates/trellis/scripts/verify_evidence_probe.py +138 -0
- package/dist/templates/trellis/tasks/locale/en/default-prd.md +8 -0
- package/dist/templates/trellis/tasks/locale/zh/default-prd.md +8 -0
- package/dist/templates/trellis/workflow.md +34 -2
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +7 -0
- package/dist/utils/manifest-prune.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Session Handoff (cstl-handoff)
|
|
2
|
+
|
|
3
|
+
Condense the current session into a **portable** handoff document (`cstl-handoff-{yyyyMMdd-HHmmss}-{slug}.md`), written to the **OS temp directory** (does not pollute the workspace), so a new agent can continue without the original session. This command is the Cursor invocation surface for the `cstl-handoff` skill — mirror of `common/bundled-skills/cstl-handoff/SKILL.md`; keep the two aligned when editing.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to use / when not
|
|
8
|
+
|
|
9
|
+
At stage boundaries first ask: **does the work still continue in this session?**
|
|
10
|
+
|
|
11
|
+
1. **Continue** — default preference: keep going in this session
|
|
12
|
+
2. **Clear** — context can be dropped; clear and restart
|
|
13
|
+
3. **Handoff** — the work needs to travel → this command
|
|
14
|
+
4. **Subagent** — a side branch can run in parallel while the main session stays → dispatch a subagent (optionally with a handoff file)
|
|
15
|
+
5. **Compact** — same harness, same directory, only intent compression needed → use the platform compact
|
|
16
|
+
|
|
17
|
+
**Handoff only when the work needs to travel**: switch harness, switch directory / repo, hand to a colleague, or fork a side branch. Same harness + same directory continuation → compact / continue, not handoff.
|
|
18
|
+
|
|
19
|
+
## How this differs from a task `handoff.md` (read first)
|
|
20
|
+
|
|
21
|
+
| | This command (session handoff) | Task `handoff.md` |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| What | Portable cross-session summary | Child-task integration / implementation-window **delivery evidence** |
|
|
24
|
+
| Where | OS temp directory (volatile) | `.cstl/tasks/<task>/` (durable, archived with the task) |
|
|
25
|
+
| Lifecycle | Single transfer; dead once the work lands | Kept with the task evidence for Parent / review traces |
|
|
26
|
+
|
|
27
|
+
A task directory's `handoff.md` is the evidence file for `integrate-child` / `review-child`, **not** a session handoff document; the temp file this command produces is **not** task evidence.
|
|
28
|
+
|
|
29
|
+
## Steps
|
|
30
|
+
|
|
31
|
+
1. **Read the user argument**: the "next-session purpose" passed on invocation decides which whys to keep (trim key decision rationale by purpose — do not take everything verbatim).
|
|
32
|
+
2. **Write the temp file** (path rules below).
|
|
33
|
+
3. **Report the full absolute path** (required): temp paths are long and differ per OS; the user must get the path first.
|
|
34
|
+
4. **Remind about volatility**: the temp file may be cleaned by the environment (Codex clears temp across sessions; `/private/tmp` is lost on reboot). For cross-hour / cross-harness continuation, ask the user to copy it to a durable location immediately.
|
|
35
|
+
|
|
36
|
+
### Path rules
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
$env:TEMP\cstl-handoff-{yyyyMMdd-HHmmss}-{slug}.md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Windows: `$env:TEMP` (i.e. `%TEMP%`)
|
|
43
|
+
- Linux / macOS: `$TMPDIR/cstl-handoff-{yyyyMMdd-HHmmss}-{slug}.md` (`/tmp` when `$TMPDIR` is unset)
|
|
44
|
+
- Always report the **full absolute path** to the user after writing — never just the filename.
|
|
45
|
+
|
|
46
|
+
## Content template (English skeleton)
|
|
47
|
+
|
|
48
|
+
> Follow `artifact_locale` when the project uses it; English by default.
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# Session handoff — <work summary>
|
|
52
|
+
|
|
53
|
+
> Generated by cstl-handoff at <time> · Next-session purpose: <user argument>
|
|
54
|
+
|
|
55
|
+
## Goal
|
|
56
|
+
<what the in-flight work is trying to achieve>
|
|
57
|
+
|
|
58
|
+
## Done
|
|
59
|
+
- <items>
|
|
60
|
+
|
|
61
|
+
## Not done / Blocked
|
|
62
|
+
- <items>
|
|
63
|
+
|
|
64
|
+
## Next steps
|
|
65
|
+
1. <ordered steps>
|
|
66
|
+
|
|
67
|
+
## Key whys (trimmed by next-session purpose)
|
|
68
|
+
- <decision + reason; whys unrelated to this purpose can be omitted>
|
|
69
|
+
|
|
70
|
+
## Facts vs unverified beliefs
|
|
71
|
+
- Facts: <verified>
|
|
72
|
+
- Beliefs (unverified): <assumptions — never write them as facts>
|
|
73
|
+
|
|
74
|
+
## Pointers (reference paths only, never copy bodies)
|
|
75
|
+
- Task: `.cstl/tasks/<task>/` (prd.md / design.md / implement.md / verify.md)
|
|
76
|
+
- Context: `CONTEXT.md` · Research: `<task>/research/`
|
|
77
|
+
- Prototype evidence (if a prototype was involved): `<task>/research/prototype-<slug>.py` (see `.cstl/spec/guides/prototype-guide.md` §9)
|
|
78
|
+
- Other: ADR / issue / commit / diff paths or URLs
|
|
79
|
+
|
|
80
|
+
## Suggested skills (for the continuing agent)
|
|
81
|
+
- <skill name list, e.g. cstl-brainstorm, cstl-check, cstl-continue>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Rules
|
|
85
|
+
|
|
86
|
+
- **Reference, don't copy**: anything already on disk (spec / PRD / ADR / issue / commit / diff) gets a path or URL only, never pasted verbatim.
|
|
87
|
+
- **Redact**: API keys, tokens, passwords, PII → replace with `<REDACTED>` before writing; when unsure, write `<REDACTED>`.
|
|
88
|
+
- **Facts vs beliefs**: unverified assumptions must be marked, never written as verified facts — the continuing agent will treat the document as a contract and will not re-check.
|
|
89
|
+
- **Prototype evidence pointer**: when the session involved a prototype, list the prototype evidence path in the pointers section and confirm the evidence is captured before cleanup.
|
|
90
|
+
- **Delivery**: have the new agent **read the file path**; do not stuff the summary into shell quotes to launch the new agent (backticks / `$(...)` get swallowed and silently truncated).
|
|
91
|
+
|
|
92
|
+
## Anti-patterns
|
|
93
|
+
|
|
94
|
+
- ❌ Treating handoff as a long-lived document: it is a transit document for a single transfer and dies once the work lands (long-term facts belong in `AGENTS.md` / spec, not handoff)
|
|
95
|
+
- ❌ Pasting large spec / PRD / diff bodies (should reference paths only)
|
|
96
|
+
- ❌ Stuffing the summary into shell quotes to launch the next agent (silent truncation risk)
|
|
97
|
+
- ❌ Not reporting the full path / not reminding about temp volatility
|
|
98
|
+
- ❌ Writing a handoff for same-harness same-directory continuation (should compact / continue)
|
|
99
|
+
- ❌ Writing keys / tokens into the document
|
|
@@ -33,4 +33,10 @@ export declare const guidesCursorContextInjectionGuideContent: string;
|
|
|
33
33
|
export declare const guidesCursorNativeModesGuideContent: string;
|
|
34
34
|
export declare const guidesVerificationStrengthGuideContent: string;
|
|
35
35
|
export declare const guidesInjectionBudgetGuideContent: string;
|
|
36
|
+
export declare const guidesArtifactLocaleGuideContent: string;
|
|
37
|
+
export declare const guidesDebugLoopGuideContent: string;
|
|
38
|
+
export declare const guidesGoalReleaseRegressionRunbookContent: string;
|
|
39
|
+
export declare const guidesPrototypeGuideContent: string;
|
|
40
|
+
export declare const guidesTestDisciplineGuideContent: string;
|
|
41
|
+
export declare const guidesCrossPlatformThinkingGuideContent: string;
|
|
36
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,eAAO,MAAM,eAAe,EAAE,MAAuC,CAAC;AAGtE,eAAO,MAAM,qBAAqB,EAAE,MACK,CAAC;AAG1C,eAAO,MAAM,yBAAyB,QAAwB,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,MACH,CAAC;AAQrC,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAElC,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,yBAAyB,EAAE,MAEvC,CAAC;AACF,eAAO,MAAM,6BAA6B,EAAE,MAE3C,CAAC;AACF,eAAO,MAAM,kCAAkC,EAAE,MAEhD,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5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O,MAAM,6BAA6B,EAAE,MAE3C,CAAC;AACF,eAAO,MAAM,kCAAkC,EAAE,MAEhD,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5C,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,MAEhC,CAAC;AACF,eAAO,MAAM,oCAAoC,EAAE,MAElD,CAAC;AACF,eAAO,MAAM,mCAAmC,EAAE,MAEjD,CAAC;AACF,eAAO,MAAM,yCAAyC,EAAE,MACiB,CAAC;AAC1E,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,qCAAqC,EAAE,MAEnD,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5C,CAAC;AACF,eAAO,MAAM,wCAAwC,EAAE,MACiB,CAAC;AACzE,eAAO,MAAM,mCAAmC,EAAE,MAEjD,CAAC;AACF,eAAO,MAAM,sCAAsC,EAAE,MAEpD,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AACF,eAAO,MAAM,yCAAyC,EAAE,MACiB,CAAC;AAC1E,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,uCAAuC,EAAE,MACiB,CAAC"}
|
|
@@ -58,4 +58,10 @@ export const guidesCursorContextInjectionGuideContent = readLocalTemplate("spec/
|
|
|
58
58
|
export const guidesCursorNativeModesGuideContent = readLocalTemplate("spec/guides/cursor-native-modes-guide.md.txt");
|
|
59
59
|
export const guidesVerificationStrengthGuideContent = readLocalTemplate("spec/guides/verification-strength-guide.md.txt");
|
|
60
60
|
export const guidesInjectionBudgetGuideContent = readLocalTemplate("spec/guides/injection-budget-guide.md.txt");
|
|
61
|
+
export const guidesArtifactLocaleGuideContent = readLocalTemplate("spec/guides/artifact-locale-guide.md.txt");
|
|
62
|
+
export const guidesDebugLoopGuideContent = readLocalTemplate("spec/guides/debug-loop-guide.md.txt");
|
|
63
|
+
export const guidesGoalReleaseRegressionRunbookContent = readLocalTemplate("spec/guides/goal-release-regression-runbook.md.txt");
|
|
64
|
+
export const guidesPrototypeGuideContent = readLocalTemplate("spec/guides/prototype-guide.md.txt");
|
|
65
|
+
export const guidesTestDisciplineGuideContent = readLocalTemplate("spec/guides/test-discipline-guide.md.txt");
|
|
66
|
+
export const guidesCrossPlatformThinkingGuideContent = readLocalTemplate("spec/guides/cross-platform-thinking-guide.md.txt");
|
|
61
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAW,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAEtE,oDAAoD;AACpD,MAAM,CAAC,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,gDAAgD,CACjD,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAW,iBAAiB,CACxE,2CAA2C,CAC5C,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAW,iBAAiB,CACvE,0CAA0C,CAC3C,CAAC;AACF,MAAM,CAAC,MAAM,2BAA2B,GAAW,iBAAiB,CAClE,qCAAqC,CACtC,CAAC;AACF,MAAM,CAAC,MAAM,yCAAyC,GACpD,iBAAiB,CAAC,oDAAoD,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAW,iBAAiB,CAClE,oCAAoC,CACrC,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAW,iBAAiB,CACvE,0CAA0C,CAC3C,CAAC;AACF,MAAM,CAAC,MAAM,uCAAuC,GAClD,iBAAiB,CAAC,kDAAkD,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Human-Reviewed Artifact Locale Guide
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Let PRD / DESIGN / IMPLEMENT / VERIFY / HANDOFF follow the user's language (Chinese or English) without turning Trellis into a full i18n product.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Non-goals
|
|
8
|
+
|
|
9
|
+
| In scope | Out of scope |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Workspace / task `artifact_locale` | Full CLI `--help` / stderr i18n |
|
|
12
|
+
| `task.py create` PRD seed language | Auto-translating archived tasks |
|
|
13
|
+
| Session / planning hints for artifact language | Bilingual mirrors of `workflow.md` or `.cursor/rules` |
|
|
14
|
+
| `prd.md` / `design.md` / `implement.md` / `verify.md` / `handoff.md` | `task.json` field names or gate enums |
|
|
15
|
+
|
|
16
|
+
**Rollback:** `python ./.cstl/scripts/task.py artifact-locale set zh` or remove `artifact_locale` from `.cstl/config.yaml`. For a single task, delete `task.json` → `meta.artifact_locale`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. Configuration
|
|
21
|
+
|
|
22
|
+
### Workspace default (`.cstl/config.yaml`)
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
# Human-reviewed artifact locale (zh | en)
|
|
26
|
+
artifact_locale: zh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Default when unset: **`zh`** (matches current dogfood and User Rules for Simplified Chinese replies).
|
|
30
|
+
|
|
31
|
+
### CLI
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
# Resolved locale (workspace default)
|
|
35
|
+
python ./.cstl/scripts/task.py artifact-locale get
|
|
36
|
+
|
|
37
|
+
# Resolved locale for one task (includes task override)
|
|
38
|
+
python ./.cstl/scripts/task.py artifact-locale get --task .cstl/tasks/<dir>
|
|
39
|
+
|
|
40
|
+
# Workspace default
|
|
41
|
+
python ./.cstl/scripts/task.py artifact-locale set en
|
|
42
|
+
python ./.cstl/scripts/task.py artifact-locale set zh
|
|
43
|
+
|
|
44
|
+
# Per-task override
|
|
45
|
+
python ./.cstl/scripts/task.py artifact-locale set zh --task .cstl/tasks/<dir>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Invalid values print a warning and fall back to the next layer (`task` → `workspace` → `zh`).
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 3. What respects locale
|
|
53
|
+
|
|
54
|
+
| Artifact | Mechanism |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `prd.md` on `task.py create` | Locale template under `.cstl/tasks/locale/{zh,en}/default-prd.md` |
|
|
57
|
+
| `design.md` / `implement.md` | Agent planning (session context + `cstl-brainstorm`) |
|
|
58
|
+
| `verify.md` / `handoff.md` | Agent execution / finish (same session hint) |
|
|
59
|
+
| Optional `tasks/templates/*` copies | Agent follows guide; English paths stay canonical |
|
|
60
|
+
|
|
61
|
+
**Does not change:** existing files in a task directory, CLI diagnostics, hooks, or machine gate names.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 4. Dogfood checklist
|
|
66
|
+
|
|
67
|
+
1. `artifact-locale set en` → `task.py create "Locale EN" --slug locale-dogfood-en` → `prd.md` uses `## Goal`, `## Requirements`.
|
|
68
|
+
2. `artifact-locale set zh` → `task.py create "Locale ZH" --slug locale-dogfood-zh` → `prd.md` uses `## 目标`, `## 需求`.
|
|
69
|
+
3. With workspace `en`, `artifact-locale set zh --task <dir>` → next create for that task only uses Chinese if `meta.artifact_locale` was set before create (override applies to resolved locale for that task).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 5. Orthogonal `locale` settings
|
|
74
|
+
|
|
75
|
+
| Setting | Purpose |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| **`artifact_locale`** (this guide) | Human-reviewed task artifacts |
|
|
78
|
+
| Retrieval / semantic `locale` | Code search ranking and plan language |
|
|
79
|
+
| smart-search `locale-scope` | External research evidence language |
|
|
80
|
+
|
|
81
|
+
Do not merge these keys; they solve different problems.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 6. Rollback
|
|
86
|
+
|
|
87
|
+
1. `artifact-locale set zh` (workspace).
|
|
88
|
+
2. Remove `meta.artifact_locale` from any task that should follow workspace only.
|
|
89
|
+
3. Revert code/templates if needed — default `zh` keeps dogfood behavior without config.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
**Core principle:** Product language follows the user for artifacts they review; infrastructure stays English unless explicitly scoped.
|
|
@@ -40,7 +40,7 @@ print("Run: script.py <args>")
|
|
|
40
40
|
|
|
41
41
|
# GOOD - Platform-aware wording
|
|
42
42
|
print("Usage: python on Windows, python3 elsewhere")
|
|
43
|
-
print("Run: {{PYTHON_CMD}} ./.
|
|
43
|
+
print("Run: {{PYTHON_CMD}} ./.trellis/scripts/task.py <args>")
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
**Rule 2**: When generating config files at init time, use placeholder + platform detection:
|
|
@@ -281,7 +281,7 @@ make the intended decision. Otherwise a transient sandbox/network failure hides
|
|
|
281
281
|
the hint for the rest of the session.
|
|
282
282
|
|
|
283
283
|
**Rule 2**: If a local command can provide the needed value, try it with a short
|
|
284
|
-
timeout and captured output. For example, `
|
|
284
|
+
timeout and captured output. For example, `trellis --version` already runs the
|
|
285
285
|
CLI's version comparison logic and can support an actionable update prompt
|
|
286
286
|
without duplicating npm registry parsing.
|
|
287
287
|
|
|
@@ -356,7 +356,7 @@ When making platform-related changes, check **all these locations**:
|
|
|
356
356
|
|
|
357
357
|
### Code Locations
|
|
358
358
|
- [ ] `src/templates/` - Template files for new projects
|
|
359
|
-
- [ ] `.
|
|
359
|
+
- [ ] `.trellis/scripts/` - Project's own scripts (if self-hosting)
|
|
360
360
|
- [ ] `dist/` - Built output (rebuild after changes)
|
|
361
361
|
|
|
362
362
|
### Search Pattern
|
|
@@ -530,7 +530,7 @@ subprocess.run(["./script.py"]) # FileNotFoundError
|
|
|
530
530
|
|
|
531
531
|
```
|
|
532
532
|
src/templates/script.py ← Updated
|
|
533
|
-
.
|
|
533
|
+
.trellis/scripts/script.py ← Forgot to sync!
|
|
534
534
|
```
|
|
535
535
|
|
|
536
536
|
### 4. "Python 3 is always python3"
|
|
@@ -606,8 +606,8 @@ included with Trellis, verify the whole distribution path:
|
|
|
606
606
|
- [ ] `pnpm build` copies the asset into `dist/templates/**`.
|
|
607
607
|
- [ ] `npm pack --dry-run --json` includes the expected `dist/**` path.
|
|
608
608
|
- [ ] The built binary installs the asset in a fresh temp repository.
|
|
609
|
-
- [ ] `.
|
|
610
|
-
- [ ] `
|
|
609
|
+
- [ ] `.trellis/.template-hashes.json` tracks the generated asset path.
|
|
610
|
+
- [ ] `trellis update --dry-run` reports `Already up to date!` in that temp
|
|
611
611
|
repository.
|
|
612
612
|
|
|
613
613
|
**Why this matters**: docs/changelog text can move independently from the code
|
|
@@ -628,7 +628,7 @@ git -C "$tmpdir" init -q
|
|
|
628
628
|
cd "$tmpdir"
|
|
629
629
|
node /path/to/Trellis/packages/cli/bin/trellis.js init -u smoke --yes --cursor
|
|
630
630
|
test -f .cursor/skills/<skill>/SKILL.md
|
|
631
|
-
grep -q '<skill>' .
|
|
631
|
+
grep -q '<skill>' .trellis/.template-hashes.json
|
|
632
632
|
node /path/to/Trellis/packages/cli/bin/trellis.js update --dry-run
|
|
633
633
|
)
|
|
634
634
|
```
|
|
@@ -96,19 +96,21 @@ When research is purely **codebase exploration** (no external web search, no fil
|
|
|
96
96
|
|
|
97
97
|
### Method 2.5: Cursor++ BYOK proxy map (publishable bundle)
|
|
98
98
|
|
|
99
|
-
**What it is:** A reversible patch to Cursor++ `extension.js` resolver
|
|
99
|
+
**What it is:** A reversible patch to Cursor++ `extension.js` **subagent model resolver** that maps `subagentType` → BYOK catalog **slug** (`model-xxxxx`), evaluated **before** the inherit-parent branch. Obfuscated symbol names change per build (historical `WPeLc8`; 2026-08+ profile `ZiKp4I`). Script uses multi-profile detection.
|
|
100
100
|
|
|
101
|
-
**Trellis ships (every `cstl init` / `cstl update`, strategy C):** `.cstl/local/cursor2plus/` — `patch_wpelc8.py`, `README.md`, `config.local.json.example`. Native Cursor API users can ignore this directory.
|
|
101
|
+
**Trellis ships (every `cstl init` / `cstl update`, strategy C):** `.cstl/local/cursor2plus/` — `patch_wpelc8.py`, `README.md`, **`UPGRADE-NOTE.md`** (upgrade re-apply), `config.local.json.example`. Native Cursor API users can ignore this directory.
|
|
102
102
|
|
|
103
103
|
**Operator workflow (Cursor++ BYOK only):**
|
|
104
104
|
|
|
105
|
-
1. Fill **`~/.ccursor/trellis-task-models.
|
|
106
|
-
2. Optionally override per repo: **`.cstl/local/subagent-models.
|
|
105
|
+
1. Fill **`~/.ccursor/trellis-task-models.json5`** (user-wide) with `subagent_type` → displayName/apiModel from **`~/.ccursor/providers.json`**.
|
|
106
|
+
2. Optionally override per repo: **`.cstl/local/subagent-models.json5`** (project wins on same key).
|
|
107
107
|
3. If paths are not auto-detected: copy `config.local.json.example` → `config.local.json`, or run `python patch_wpelc8.py --bootstrap`, or set `TRELLIS_CCURSOR_HOME` / `TRELLIS_CURSOR2PLUS_EXTENSION`.
|
|
108
|
-
4. From `.cstl/local/cursor2plus/`: `python patch_wpelc8.py --print-map` →
|
|
109
|
-
5. **Verify:**
|
|
108
|
+
4. From `.cstl/local/cursor2plus/`: `python patch_wpelc8.py --check-compat` → `--print-map` → `--apply --approve` → **Developer: Reload Window**.
|
|
109
|
+
5. **Verify:** A≠B probe (parent model ≠ map target) or `resolvedModelId` matches slug.
|
|
110
110
|
|
|
111
|
-
**Revert:** `python patch_wpelc8.py --revert`; Reload Window.
|
|
111
|
+
**Revert:** `python patch_wpelc8.py --revert`; Reload Window.
|
|
112
|
+
|
|
113
|
+
**After any Cursor / Cursor++ upgrade:** assume patch is stale — follow **`.cstl/local/cursor2plus/UPGRADE-NOTE.md`** (`--check-compat`, re-apply, or add a new resolver profile if symbols moved).
|
|
112
114
|
|
|
113
115
|
**Cursor++ sidebar / Cursor Settings:** Do **not** wire `cstl-*` BYOK routing; use JSON + patch.
|
|
114
116
|
|
|
@@ -203,7 +205,7 @@ When a dispatch is imminent:
|
|
|
203
205
|
|
|
204
206
|
### Technical note
|
|
205
207
|
|
|
206
|
-
Client layer still only builds override rows for built-in types such as `explore`. Cursor Settings entries for custom agent **names** do not reach the BYOK proxy override list for `cstl-*`. **Method 2.5** patches Cursor++ `
|
|
208
|
+
Client layer still only builds override rows for built-in types such as `explore`. Cursor Settings entries for custom agent **names** do not reach the BYOK proxy override list for `cstl-*`. **Method 2.5** patches Cursor++ subagent model resolver (profile-bound; see `UPGRADE-NOTE.md`) so `taskToolCall` sets `resolvedModelId` from a local `subagentType → slug` table before inherit-parent. **Method 3** bypasses Task routing (user picks model in a new chat).
|
|
207
209
|
|
|
208
210
|
---
|
|
209
211
|
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Debug Loop Guide
|
|
2
|
+
|
|
3
|
+
> **Purpose**: 调试纪律 —— 先建 tight、red-capable 反馈环,再假设、再修,一次到位找到并修对;与 `cstl-break-loop` 划界(诊断进行中 vs 修完后防再发),互不替代。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Purpose / Non-goals
|
|
8
|
+
|
|
9
|
+
**Purpose.** Hard bugs and performance regressions are not solved by reading code — they are solved by building a **tight, red-capable feedback loop** first, then letting hypotheses consume it. This guide defines the discipline: build the loop → reproduce → hypothesise → probe one variable at a time → freeze the loop as a regression → clean up and hand off to prevention.
|
|
10
|
+
|
|
11
|
+
**Non-goals**
|
|
12
|
+
|
|
13
|
+
- **Not a mandate for every bug.** A lightweight bug (obvious at a glance, provable in a single step) may skip the full loop — but you must state **one sentence** explaining why the full cycle was skipped.
|
|
14
|
+
- **Not a replacement for `cstl-break-loop`.** This guide owns *diagnosis in progress*; break-loop owns *post-fix root cause classification / prevention / knowledge capture* (see §2).
|
|
15
|
+
- **No production instrumentation** unless the user explicitly permits it. If you cannot build a loop without instrumenting production, stop and ask (see Phase 1 "genuinely cannot build a loop").
|
|
16
|
+
- **Not TDD ceremony.** Phase 5 freezes the loop as a test *or* a repeatable command — whichever is the correct seam.
|
|
17
|
+
|
|
18
|
+
## 2. Boundary with cstl-break-loop
|
|
19
|
+
|
|
20
|
+
| | **debug-loop-guide** (this guide) | **cstl-break-loop** |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| 时机 | 诊断与修复**进行中**(建环 → 修) | 修复**完成后**(深分析) |
|
|
23
|
+
| 目标 | 一次到位找到并修对(red 环、假设表、修复、清理) | 根因分类(A–E)、为何修失败、防再发机制、入 spec |
|
|
24
|
+
| 输出 | 红环、3–5 假设排名、修复、回归、清理 | 5 维分析、prevention、knowledge capture 到 guides |
|
|
25
|
+
| 触发 | 用户报 bug / 性能回归,进入诊断 | `/cstl:break-loop` 或修完后的任务收尾 |
|
|
26
|
+
|
|
27
|
+
**二者不互相替代**:debug-loop-guide 结束时若只修完没做根因分类,同类 bug 会再发;cstl-break-loop 不帮你找到原因(它在修完之后才启动)。Phase 6 的 post-mortem 钩子负责把两者接起来。
|
|
28
|
+
|
|
29
|
+
## 3. Hard rule: no red-capable loop → no hypotheses
|
|
30
|
+
|
|
31
|
+
> **硬纪律:无 red-capable 反馈环,不得进入假设阶段;禁止先读代码猜原因。**
|
|
32
|
+
|
|
33
|
+
A **red-capable** loop is **one command** that you have **already run at least once** (show the invocation and its redacted output), and that simultaneously:
|
|
34
|
+
|
|
35
|
+
- **Drives the path of the user's symptom** — it exercises the actual bug code path, not "it didn't crash".
|
|
36
|
+
- **Can go red and green** — it goes red on *this* bug and turns green once fixed.
|
|
37
|
+
- **Is as deterministic, fast, and agent-runnable as possible** — seconds, unattended; a human in the loop only via the PowerShell HITL template (§12).
|
|
38
|
+
|
|
39
|
+
If you catch yourself reading code to build a theory before this command exists — **stop**. Jumping straight to a hypothesis is the exact failure this discipline prevents. No red-capable command, no Phase 2.
|
|
40
|
+
|
|
41
|
+
**If you genuinely cannot build a loop**: stop and say so explicitly. List what you tried. Ask the user for (a) access to the environment that reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) **explicit permission** to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
42
|
+
|
|
43
|
+
## 4. Lightweight escape hatch
|
|
44
|
+
|
|
45
|
+
A lightweight bug — one visible at a glance, provable in a single step (typo, obvious off-by-one, missing export) — may skip the full cycle. The only requirement: **one sentence explaining why the full loop was skipped** (e.g. "single-line typo, provable by one compile run; full loop skipped"). Hard bugs and performance regressions **default to the full loop**.
|
|
46
|
+
|
|
47
|
+
## 5. Redact
|
|
48
|
+
|
|
49
|
+
This guide makes you show commands, outputs and captured artifacts. **Redact every secret first** — write `<REDACTED>` in its place.
|
|
50
|
+
|
|
51
|
+
- Build loops against **env vars** so credentials stay in the environment, never in what you show.
|
|
52
|
+
- Captured artifacts carry auth headers: **quote only the lines that carry the signal**, not the whole blob.
|
|
53
|
+
- If the redacted output is not enough to diagnose the bug, say so and ask the user — do not leak secrets to move faster.
|
|
54
|
+
|
|
55
|
+
## 6. Phase 1 — Build a tight feedback loop
|
|
56
|
+
|
|
57
|
+
**This is the phase.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on *this* bug — you will find the cause; bisection, hypothesis-testing, and instrumentation just consume it. If you don't have one, no amount of staring at code will save you. Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
58
|
+
|
|
59
|
+
### Ways to construct one — try them in roughly this order
|
|
60
|
+
|
|
61
|
+
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
62
|
+
2. **Curl / HTTP script** against a running dev server.
|
|
63
|
+
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
64
|
+
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
65
|
+
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
66
|
+
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
67
|
+
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
68
|
+
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can bisect it.
|
|
69
|
+
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
70
|
+
10. **HITL PowerShell script** (§12). Last resort. If a human must click, drive *them* with a structured loop so it is still a loop. Captured output feeds back to you.
|
|
71
|
+
|
|
72
|
+
### Tighten the loop
|
|
73
|
+
|
|
74
|
+
Treat the loop as a product. Once you have *a* loop, **tighten** it:
|
|
75
|
+
|
|
76
|
+
- Can I make it **faster**? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
77
|
+
- Can I make the **signal sharper**? (Assert on the specific symptom, not "didn't crash".)
|
|
78
|
+
- Can I make it **more deterministic**? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
79
|
+
|
|
80
|
+
A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is a debugging superpower.
|
|
81
|
+
|
|
82
|
+
### Non-deterministic bugs
|
|
83
|
+
|
|
84
|
+
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it is debuggable.
|
|
85
|
+
|
|
86
|
+
### Completion criterion — a tight loop that goes red
|
|
87
|
+
|
|
88
|
+
Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (show the invocation and its output, redacted), and that is:
|
|
89
|
+
|
|
90
|
+
- [ ] **Red-capable** — drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring".
|
|
91
|
+
- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
|
|
92
|
+
- [ ] **Fast** — seconds, not minutes.
|
|
93
|
+
- [ ] **Agent-runnable** — unattended; a human in the loop only via the HITL template (§12).
|
|
94
|
+
|
|
95
|
+
No red-capable command, no Phase 2.
|
|
96
|
+
|
|
97
|
+
## 7. Phase 2 — Reproduce + minimise
|
|
98
|
+
|
|
99
|
+
Run the loop. Watch it go red — the bug appears.
|
|
100
|
+
|
|
101
|
+
Confirm:
|
|
102
|
+
|
|
103
|
+
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
104
|
+
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
105
|
+
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
106
|
+
|
|
107
|
+
### Minimise
|
|
108
|
+
|
|
109
|
+
Once it is red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what is load-bearing for the failure. A minimal repro shrinks the Phase 3 hypothesis space (fewer moving parts to suspect) and becomes the clean Phase 5 regression. Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green.
|
|
110
|
+
|
|
111
|
+
Do not proceed until you have reproduced **and** minimised.
|
|
112
|
+
|
|
113
|
+
## 8. Phase 3 — Ranked falsifiable hypotheses (show user)
|
|
114
|
+
|
|
115
|
+
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
116
|
+
|
|
117
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
118
|
+
|
|
119
|
+
> Format: "If `<X>` is the cause, then `<changing Y>` will make the bug disappear / `<changing Z>` will make it worse."
|
|
120
|
+
|
|
121
|
+
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
122
|
+
|
|
123
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they have already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
124
|
+
|
|
125
|
+
## 9. Phase 4 — One-variable probes / instrumentation
|
|
126
|
+
|
|
127
|
+
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
128
|
+
|
|
129
|
+
Tool preference:
|
|
130
|
+
|
|
131
|
+
1. **Debugger / REPL inspection** if the environment supports it. One breakpoint beats ten logs.
|
|
132
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
133
|
+
3. Never "log everything and grep".
|
|
134
|
+
|
|
135
|
+
**Tag every debug log with a unique prefix**, e.g. `[DEBUG-a4f2]` (or any equivalent uniform prefix). Cleanup at the end becomes a **single grep**: `grep -rn "\[DEBUG-" .` / `rg "\[DEBUG-"` — every tagged line dies, untagged lines survive.
|
|
136
|
+
|
|
137
|
+
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
138
|
+
|
|
139
|
+
## 10. Phase 5 — Regression (freeze the loop)
|
|
140
|
+
|
|
141
|
+
Freeze the loop as a test **or** a repeatable command — whichever has a **correct seam**.
|
|
142
|
+
|
|
143
|
+
A correct seam is one where the test/command exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that cannot replicate the chain that triggered the bug), a regression there gives false confidence.
|
|
144
|
+
|
|
145
|
+
**If no correct seam exists, that itself is the finding.** Note it — the architecture is preventing the bug from being locked down. Flag it for Phase 6 / break-loop.
|
|
146
|
+
|
|
147
|
+
If a correct seam exists:
|
|
148
|
+
|
|
149
|
+
1. Turn the minimised repro into a failing test (or a repeatable command) at that seam.
|
|
150
|
+
2. Watch it fail.
|
|
151
|
+
3. Apply the fix.
|
|
152
|
+
4. Watch it pass.
|
|
153
|
+
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
154
|
+
|
|
155
|
+
This phase hands off to the test-discipline scope (P08) without being absorbed by it: the loop here is bug-driven; test-discipline owns the general testing strategy.
|
|
156
|
+
|
|
157
|
+
## 11. Phase 6 — Cleanup + post-mortem hook
|
|
158
|
+
|
|
159
|
+
Required before declaring done:
|
|
160
|
+
|
|
161
|
+
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
162
|
+
- [ ] Regression passes (or absence of seam is documented)
|
|
163
|
+
- [ ] All `[DEBUG-...]` instrumentation removed — one grep, zero hits
|
|
164
|
+
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
165
|
+
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
166
|
+
|
|
167
|
+
**Post-mortem hook:** then ask *what would have prevented this bug?* If the answer involves architectural change (no good test seam, tangled callers, hidden coupling), or the bug is worth classifying, run **`cstl-break-loop`** (root cause category A–E, why fixes failed, prevention mechanisms) and/or update the relevant spec/guide via **`cstl-update-spec`**. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
168
|
+
|
|
169
|
+
## 12. PowerShell HITL template
|
|
170
|
+
|
|
171
|
+
PowerShell 7 (user environment). Copy this file, edit the steps below, and run it. The agent runs the script; the user follows prompts in their terminal. Two helpers:
|
|
172
|
+
|
|
173
|
+
- `Step "instruction"` → show instruction, wait for Enter
|
|
174
|
+
- `$var = Capture "question"` → show question, read response; the returned value is echoed back, where the agent reads it — so capture observations, and leave signing in to the user as a `Step`
|
|
175
|
+
|
|
176
|
+
At the end, captured values are printed as `KEY=VALUE` for the agent to parse.
|
|
177
|
+
|
|
178
|
+
```powershell
|
|
179
|
+
# Human-in-the-loop reproduction loop (PowerShell 7).
|
|
180
|
+
# Usage: ./hitl-loop.ps1
|
|
181
|
+
# Edit the "--- edit below ---" section per bug, then run it.
|
|
182
|
+
|
|
183
|
+
$ErrorActionPreference = 'Stop'
|
|
184
|
+
|
|
185
|
+
function Step {
|
|
186
|
+
param([Parameter(Mandatory)][string]$Instruction)
|
|
187
|
+
Write-Host ''
|
|
188
|
+
Write-Host ">>> $Instruction" -ForegroundColor Cyan
|
|
189
|
+
[void](Read-Host " [Enter when done] ")
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function Capture {
|
|
193
|
+
param([Parameter(Mandatory)][string]$Question)
|
|
194
|
+
Write-Host ''
|
|
195
|
+
Write-Host ">>> $Question" -ForegroundColor Cyan
|
|
196
|
+
$answer = Read-Host " > "
|
|
197
|
+
Write-Host " (captured: $answer)"
|
|
198
|
+
return $answer
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# --- edit below ---------------------------------------------------------
|
|
202
|
+
|
|
203
|
+
Step "Open the app at http://localhost:3000 and sign in."
|
|
204
|
+
|
|
205
|
+
$ERRORED = Capture "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
206
|
+
|
|
207
|
+
$ERROR_MSG = Capture "Paste the error message (or 'none'):"
|
|
208
|
+
|
|
209
|
+
# --- edit above ---------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
Write-Host ''
|
|
212
|
+
Write-Host '--- Captured ---' -ForegroundColor Green
|
|
213
|
+
Write-Host "ERRORED=$ERRORED"
|
|
214
|
+
Write-Host "ERROR_MSG=$ERROR_MSG"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Adaptation notes for the agent: keep the loop **agent-runnable** where possible (headless/HTTP/CLI first); HITL only when a human must click or sign in. Never ask the user to paste secrets into the loop output — capture observations, leave signing in to the user as a `Step`.
|
|
218
|
+
|
|
219
|
+
## 13. Completion checklist
|
|
220
|
+
|
|
221
|
+
- [ ] Phase 1 loop exists, ran at least once, red-capable, deterministic, fast, agent-runnable (or escape hatch justified in one sentence)
|
|
222
|
+
- [ ] Phase 2: reproduced the user's exact symptom; repro minimised until every element is load-bearing
|
|
223
|
+
- [ ] Phase 3: 3–5 ranked falsifiable hypotheses, each with a stated prediction; shown to user
|
|
224
|
+
- [ ] Phase 4: one variable per probe; debug logs tagged `[DEBUG-...]`
|
|
225
|
+
- [ ] Phase 5: loop frozen as test or repeatable command at a correct seam (or absence of seam documented)
|
|
226
|
+
- [ ] Phase 6: original repro green, instrumentation removed (one grep, zero hits), post-mortem hook to `cstl-break-loop` / `cstl-update-spec` decided
|
|
227
|
+
- [ ] Everything shown to the user redacted (`<REDACTED>`, credentials via env)
|