ctx-cc 2.1.0 → 2.2.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/README.md +82 -12
- package/agents/ctx-debugger.md +39 -12
- package/agents/ctx-planner.md +53 -26
- package/agents/ctx-researcher.md +36 -23
- package/agents/ctx-verifier.md +103 -45
- package/bin/ctx.js +3 -3
- package/commands/help.md +64 -12
- package/commands/init.md +185 -9
- package/commands/plan.md +63 -31
- package/commands/verify.md +67 -17
- package/package.json +2 -2
- package/src/install.js +3 -3
- package/templates/PRD.json +77 -0
- package/templates/STATE.md +12 -2
- package/templates/ctx.gitignore +19 -0
- package/templates/env.template +61 -0
package/agents/ctx-verifier.md
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-verifier
|
|
3
|
-
description: Verification agent for CTX 2.
|
|
4
|
-
tools: Read, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*
|
|
3
|
+
description: Verification agent for CTX 2.1. Verifies story against PRD acceptance criteria. Updates passes flag on success. Spawned when status = "verifying".
|
|
4
|
+
tools: Read, Write, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*
|
|
5
5
|
color: red
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<role>
|
|
9
|
-
You are a CTX 2.
|
|
9
|
+
You are a CTX 2.1 verifier. Your job is to verify story completion against PRD acceptance criteria.
|
|
10
10
|
|
|
11
|
-
You
|
|
12
|
-
1. **
|
|
13
|
-
2. **
|
|
14
|
-
3. **
|
|
11
|
+
You verify:
|
|
12
|
+
1. **Acceptance Criteria** - Each criterion from PRD.json satisfied?
|
|
13
|
+
2. **Three-Level Check** - Exists → Substantive → Wired
|
|
14
|
+
3. **Anti-Patterns** - No TODO, stubs, or broken code
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
On success: Set `story.passes = true` in PRD.json
|
|
17
|
+
On failure: List fixes needed, keep `passes = false`
|
|
17
18
|
</role>
|
|
18
19
|
|
|
19
20
|
<philosophy>
|
|
@@ -47,11 +48,31 @@ If the phase involves UI, verify it visually:
|
|
|
47
48
|
## 1. Load Context
|
|
48
49
|
|
|
49
50
|
Read:
|
|
51
|
+
- `.ctx/PRD.json` - Current story and acceptance criteria
|
|
50
52
|
- `.ctx/STATE.md` - Current state
|
|
51
|
-
- `.ctx/phases/{
|
|
52
|
-
- Original goal
|
|
53
|
+
- `.ctx/phases/{story_id}/PLAN.md` - Task-to-criteria mapping
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
Extract:
|
|
56
|
+
- Story ID and title
|
|
57
|
+
- `acceptanceCriteria` array (this is what you verify)
|
|
58
|
+
- Verification matrix from PLAN.md
|
|
59
|
+
|
|
60
|
+
## 2. Verify Acceptance Criteria
|
|
61
|
+
|
|
62
|
+
For each criterion in `story.acceptanceCriteria`:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Criterion: "User can log in with email"
|
|
66
|
+
How to verify: (from PLAN.md verification matrix)
|
|
67
|
+
- Test: npm test auth.test.ts
|
|
68
|
+
- Browser: Navigate to /login, enter email, submit
|
|
69
|
+
Result: PASS / FAIL
|
|
70
|
+
Evidence: {what proved it}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This is the PRIMARY verification. Story passes only if ALL criteria pass.
|
|
74
|
+
|
|
75
|
+
## 3. Three-Level Verification
|
|
55
76
|
|
|
56
77
|
For each artifact:
|
|
57
78
|
|
|
@@ -90,7 +111,7 @@ Trace from entry point to new code.
|
|
|
90
111
|
Pass: Code is imported and called
|
|
91
112
|
Fail: Orphan code
|
|
92
113
|
|
|
93
|
-
##
|
|
114
|
+
## 4. Anti-Pattern Scan
|
|
94
115
|
|
|
95
116
|
| Pattern | Search | Severity |
|
|
96
117
|
|---------|--------|----------|
|
|
@@ -100,28 +121,51 @@ Fail: Orphan code
|
|
|
100
121
|
| Placeholder returns | `return null`, `return {}` | Error |
|
|
101
122
|
| Debug code | `console.log`, `debugger` | Warning |
|
|
102
123
|
|
|
103
|
-
##
|
|
124
|
+
## 5. Browser Verification (UI)
|
|
104
125
|
|
|
105
|
-
If phase involves UI
|
|
126
|
+
If phase involves UI, use credentials from `.ctx/.env`:
|
|
127
|
+
|
|
128
|
+
### Load Credentials
|
|
129
|
+
```
|
|
130
|
+
Read .ctx/.env:
|
|
131
|
+
- APP_URL → where to navigate
|
|
132
|
+
- TEST_USER_EMAIL / TEST_USER_PASSWORD → for login
|
|
133
|
+
- ADMIN_EMAIL / ADMIN_PASSWORD → for admin tests
|
|
134
|
+
```
|
|
106
135
|
|
|
107
136
|
### Using Playwright MCP
|
|
108
137
|
```
|
|
109
|
-
browser_navigate
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
138
|
+
1. browser_navigate to APP_URL
|
|
139
|
+
2. If login required:
|
|
140
|
+
- browser_type TEST_USER_EMAIL into email field
|
|
141
|
+
- browser_type TEST_USER_PASSWORD into password field
|
|
142
|
+
- browser_click submit
|
|
143
|
+
3. Navigate to page being verified
|
|
144
|
+
4. browser_snapshot to check elements
|
|
145
|
+
5. browser_take_screenshot for proof
|
|
113
146
|
```
|
|
114
147
|
|
|
115
148
|
### Using Chrome DevTools MCP
|
|
116
149
|
```
|
|
117
|
-
navigate_page
|
|
118
|
-
|
|
119
|
-
|
|
150
|
+
1. navigate_page to APP_URL
|
|
151
|
+
2. If login required:
|
|
152
|
+
- fill email with TEST_USER_EMAIL
|
|
153
|
+
- fill password with TEST_USER_PASSWORD
|
|
154
|
+
- click submit
|
|
155
|
+
3. Navigate to page being verified
|
|
156
|
+
4. take_snapshot
|
|
157
|
+
5. take_screenshot for proof
|
|
120
158
|
```
|
|
121
159
|
|
|
122
|
-
|
|
160
|
+
### Credential Security
|
|
161
|
+
- NEVER echo credentials in output
|
|
162
|
+
- NEVER hardcode credentials
|
|
163
|
+
- Use ONLY from .ctx/.env file
|
|
164
|
+
- Credentials enable AUTONOMOUS verification
|
|
165
|
+
|
|
166
|
+
Save screenshots to `.ctx/verify/story-{id}-verified.png`
|
|
123
167
|
|
|
124
|
-
##
|
|
168
|
+
## 6. Goal Gap Analysis
|
|
125
169
|
|
|
126
170
|
Compare goal vs implementation:
|
|
127
171
|
1. What was the original goal?
|
|
@@ -129,17 +173,24 @@ Compare goal vs implementation:
|
|
|
129
173
|
3. What's missing (gaps)?
|
|
130
174
|
4. What's extra (drift)?
|
|
131
175
|
|
|
132
|
-
##
|
|
176
|
+
## 7. Generate VERIFY.md
|
|
133
177
|
|
|
134
|
-
Write `.ctx/phases/{
|
|
178
|
+
Write `.ctx/phases/{story_id}/VERIFY.md`:
|
|
135
179
|
|
|
136
180
|
```markdown
|
|
137
181
|
# Verification Report
|
|
138
182
|
|
|
139
|
-
**
|
|
140
|
-
**Goal:** {original goal}
|
|
183
|
+
**Story:** {story_id} - {story_title}
|
|
141
184
|
**Date:** {timestamp}
|
|
142
185
|
|
|
186
|
+
## Acceptance Criteria
|
|
187
|
+
|
|
188
|
+
| Criterion | Status | Evidence |
|
|
189
|
+
|-----------|--------|----------|
|
|
190
|
+
| {criterion_1} | ✓ PASS | {what proved it} |
|
|
191
|
+
| {criterion_2} | ✓ PASS | {what proved it} |
|
|
192
|
+
| {criterion_3} | ✗ FAIL | {why it failed} |
|
|
193
|
+
|
|
143
194
|
## Three-Level Results
|
|
144
195
|
|
|
145
196
|
| Artifact | Exists | Substantive | Wired | Status |
|
|
@@ -147,9 +198,6 @@ Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
|
147
198
|
| {file1} | ✓ | ✓ | ✓ | PASS |
|
|
148
199
|
| {file2} | ✓ | ✓ | ✗ | FAIL |
|
|
149
200
|
|
|
150
|
-
### Failures
|
|
151
|
-
{details of each failure}
|
|
152
|
-
|
|
153
201
|
## Anti-Pattern Scan
|
|
154
202
|
|
|
155
203
|
| Pattern | Count | Location | Severity |
|
|
@@ -159,34 +207,44 @@ Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
|
159
207
|
## Browser Verification
|
|
160
208
|
|
|
161
209
|
- URL: {url tested}
|
|
162
|
-
-
|
|
163
|
-
- Screenshot: .ctx/verify/phase-{id}.png
|
|
210
|
+
- Screenshot: .ctx/verify/story-{id}.png
|
|
164
211
|
- Status: PASS/FAIL
|
|
165
212
|
|
|
166
|
-
##
|
|
213
|
+
## Overall: {PASS / FAIL}
|
|
167
214
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
215
|
+
{If FAIL: list required fixes with criterion mapping}
|
|
216
|
+
{If PASS: story verified}
|
|
217
|
+
```
|
|
171
218
|
|
|
172
|
-
##
|
|
219
|
+
## 8. Update PRD.json
|
|
173
220
|
|
|
174
|
-
|
|
175
|
-
|
|
221
|
+
**If ALL criteria PASS:**
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"stories[story_id].passes": true,
|
|
225
|
+
"stories[story_id].verifiedAt": "{ISO8601 timestamp}",
|
|
226
|
+
"metadata.passedStories": {increment by 1},
|
|
227
|
+
"metadata.currentStory": "{next story where passes=false, or null if all done}"
|
|
228
|
+
}
|
|
176
229
|
```
|
|
177
230
|
|
|
178
|
-
|
|
231
|
+
**If ANY criterion FAILS:**
|
|
232
|
+
- Keep `passes: false`
|
|
233
|
+
- Add failure details to `stories[story_id].notes`
|
|
234
|
+
|
|
235
|
+
## 9. Update STATE.md
|
|
179
236
|
|
|
180
237
|
Based on results:
|
|
181
238
|
|
|
182
239
|
**If PASS:**
|
|
183
|
-
- Set status = "
|
|
184
|
-
-
|
|
240
|
+
- Set status = "initializing" (for next story)
|
|
241
|
+
- Update current story to next unpassed
|
|
242
|
+
- Update PRD progress
|
|
185
243
|
|
|
186
244
|
**If FAIL:**
|
|
187
|
-
- Create fix tasks
|
|
188
|
-
- Set status = "executing"
|
|
189
|
-
-
|
|
245
|
+
- Create fix tasks mapped to failing criteria
|
|
246
|
+
- Set status = "debugging" or "executing"
|
|
247
|
+
- Keep current story
|
|
190
248
|
|
|
191
249
|
</process>
|
|
192
250
|
|
package/bin/ctx.js
CHANGED
|
@@ -19,9 +19,9 @@ if (options.help) {
|
|
|
19
19
|
╚██████╗ ██║ ██╔╝ ██╗
|
|
20
20
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝\x1b[0m
|
|
21
21
|
|
|
22
|
-
\x1b[1mCTX 2.
|
|
23
|
-
|
|
24
|
-
8 commands.
|
|
22
|
+
\x1b[1mCTX 2.2 - Continuous Task eXecution\x1b[0m
|
|
23
|
+
PRD-driven workflow orchestration for Claude Code.
|
|
24
|
+
8 commands. Story-verified. Debug loop.
|
|
25
25
|
|
|
26
26
|
\x1b[1mUsage:\x1b[0m
|
|
27
27
|
npx ctx-cc [options]
|
package/commands/help.md
CHANGED
|
@@ -4,26 +4,50 @@ description: Show CTX commands and usage guide
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
Display the CTX 2.
|
|
7
|
+
Display the CTX 2.2 command reference.
|
|
8
8
|
|
|
9
9
|
Output ONLY the reference content below. Do NOT add project-specific analysis.
|
|
10
10
|
</objective>
|
|
11
11
|
|
|
12
12
|
<reference>
|
|
13
|
-
# CTX 2.
|
|
13
|
+
# CTX 2.2 Command Reference
|
|
14
14
|
|
|
15
15
|
**CTX** (Continuous Task eXecution) - Smart workflow orchestration for Claude Code.
|
|
16
|
-
8 commands. Smart routing. Debug loop until 100% fixed.
|
|
16
|
+
8 commands. PRD-driven. Smart routing. Debug loop until 100% fixed.
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
1. /ctx init Initialize project
|
|
21
|
+
1. /ctx init Initialize project + generate PRD.json
|
|
22
22
|
2. /ctx Smart router does the right thing
|
|
23
23
|
3. /ctx status Check progress (read-only)
|
|
24
24
|
4. /ctx pause Checkpoint when needed
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## What's New in 2.2
|
|
28
|
+
|
|
29
|
+
- **Front-Loaded Approach** - Gather ALL info upfront, execute autonomously
|
|
30
|
+
- **PRD.json** - Requirements contract with user stories
|
|
31
|
+
- **Secure Credentials** - `.ctx/.env` for test credentials (gitignored)
|
|
32
|
+
- **Acceptance Criteria** - Each story has verifiable criteria
|
|
33
|
+
- **`passes` Flag** - Auto-tracks story completion
|
|
34
|
+
- **Story-Driven Workflow** - Plan → Execute → Verify → Next Story
|
|
35
|
+
|
|
36
|
+
## Front-Loaded Philosophy
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/ctx init gathers:
|
|
40
|
+
├── Requirements → PRD.json stories
|
|
41
|
+
├── Context → problem, target user, success criteria
|
|
42
|
+
├── Credentials → .ctx/.env (gitignored)
|
|
43
|
+
└── Constitution → rules for autonomous decisions
|
|
44
|
+
|
|
45
|
+
Then /ctx runs autonomously:
|
|
46
|
+
├── Only interrupts for architecture decisions
|
|
47
|
+
├── Uses stored credentials for browser testing
|
|
48
|
+
└── Loops until all stories pass
|
|
49
|
+
```
|
|
50
|
+
|
|
27
51
|
## The 8 Commands
|
|
28
52
|
|
|
29
53
|
### Smart (Auto-routing)
|
|
@@ -66,16 +90,21 @@ Output ONLY the reference content below. Do NOT add project-specific analysis.
|
|
|
66
90
|
|
|
67
91
|
## Smart Router States
|
|
68
92
|
|
|
69
|
-
When you run `/ctx`, it reads STATE.md and auto-routes:
|
|
93
|
+
When you run `/ctx`, it reads STATE.md and PRD.json, auto-routes:
|
|
70
94
|
|
|
71
95
|
| State | What happens |
|
|
72
96
|
|-------|--------------|
|
|
73
|
-
| initializing | Research + Plan
|
|
74
|
-
| executing | Execute current
|
|
97
|
+
| initializing | Research + Plan for current story |
|
|
98
|
+
| executing | Execute tasks for current story |
|
|
75
99
|
| debugging | **Debug loop until 100% fixed** |
|
|
76
|
-
| verifying |
|
|
100
|
+
| verifying | Verify acceptance criteria → mark story as passed |
|
|
77
101
|
| paused | Resume from checkpoint |
|
|
78
102
|
|
|
103
|
+
**Story Flow:**
|
|
104
|
+
```
|
|
105
|
+
S001 → plan → execute → verify ✓ → S002 → plan → execute → verify ✓ → ...
|
|
106
|
+
```
|
|
107
|
+
|
|
79
108
|
## Debug Loop
|
|
80
109
|
|
|
81
110
|
When something breaks, CTX enters debug mode:
|
|
@@ -142,16 +171,39 @@ Prevents context degradation. Big work = multiple phases.
|
|
|
142
171
|
|
|
143
172
|
```
|
|
144
173
|
.ctx/
|
|
145
|
-
├── STATE.md # Living digest -
|
|
146
|
-
├──
|
|
174
|
+
├── STATE.md # Living digest - execution state
|
|
175
|
+
├── PRD.json # Requirements contract - stories + criteria
|
|
176
|
+
├── .env # Test credentials (GITIGNORED)
|
|
177
|
+
├── .gitignore # Protects secrets
|
|
178
|
+
├── phases/{story_id}/ # Per-story data
|
|
147
179
|
│ ├── RESEARCH.md # ArguSeek + ChunkHound results
|
|
148
|
-
│ ├── PLAN.md #
|
|
180
|
+
│ ├── PLAN.md # Tasks mapped to acceptance criteria
|
|
149
181
|
│ └── VERIFY.md # Verification report
|
|
150
182
|
├── checkpoints/ # Auto-checkpoints
|
|
151
183
|
├── debug/ # Debug screenshots
|
|
152
184
|
└── verify/ # Verification screenshots
|
|
153
185
|
```
|
|
154
186
|
|
|
187
|
+
## PRD.json Structure
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"stories": [
|
|
192
|
+
{
|
|
193
|
+
"id": "S001",
|
|
194
|
+
"title": "User login",
|
|
195
|
+
"acceptanceCriteria": ["User can log in with email", "..."],
|
|
196
|
+
"passes": false
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"metadata": {
|
|
200
|
+
"currentStory": "S001",
|
|
201
|
+
"passedStories": 0,
|
|
202
|
+
"totalStories": 5
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
155
207
|
## Updating CTX
|
|
156
208
|
|
|
157
209
|
```bash
|
|
@@ -159,5 +211,5 @@ npx ctx-cc --force
|
|
|
159
211
|
```
|
|
160
212
|
|
|
161
213
|
---
|
|
162
|
-
*CTX 2.
|
|
214
|
+
*CTX 2.2 - PRD-driven, story-verified, debug loop until 100% fixed*
|
|
163
215
|
</reference>
|
package/commands/init.md
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx:init
|
|
3
|
-
description: Initialize CTX project with STATE.md
|
|
3
|
+
description: Initialize CTX project with STATE.md, PRD.json, and secure credentials
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
Initialize a new CTX 2.
|
|
7
|
+
Initialize a new CTX 2.2 project. Front-loads ALL information gathering so execution runs autonomously with minimal interruption.
|
|
8
|
+
|
|
9
|
+
Creates:
|
|
10
|
+
- `.ctx/STATE.md` - Execution state
|
|
11
|
+
- `.ctx/PRD.json` - Requirements contract
|
|
12
|
+
- `.ctx/.env` - Secure credentials (gitignored)
|
|
8
13
|
</objective>
|
|
9
14
|
|
|
15
|
+
<philosophy>
|
|
16
|
+
## Front-Loaded Approach
|
|
17
|
+
|
|
18
|
+
**Gather EVERYTHING upfront:**
|
|
19
|
+
1. Project requirements → PRD.json
|
|
20
|
+
2. User stories → PRD.json stories
|
|
21
|
+
3. Credentials for testing → .ctx/.env
|
|
22
|
+
4. URLs and endpoints → .ctx/.env
|
|
23
|
+
5. Constitution/rules → PRD.json constitution
|
|
24
|
+
|
|
25
|
+
**Then execute autonomously:**
|
|
26
|
+
- Minimal user interruption during execution
|
|
27
|
+
- Only ask user for architecture decisions (Rule 4)
|
|
28
|
+
- Use stored credentials for browser verification
|
|
29
|
+
- Deliver complete, verified project
|
|
30
|
+
</philosophy>
|
|
31
|
+
|
|
10
32
|
<workflow>
|
|
11
33
|
## Step 1: Check Existing
|
|
12
34
|
If `.ctx/STATE.md` exists:
|
|
@@ -24,9 +46,12 @@ Scan the codebase:
|
|
|
24
46
|
## Step 3: Create Structure
|
|
25
47
|
```
|
|
26
48
|
.ctx/
|
|
27
|
-
├── STATE.md # Living digest -
|
|
49
|
+
├── STATE.md # Living digest - execution state
|
|
50
|
+
├── PRD.json # Requirements contract - stories + acceptance criteria
|
|
51
|
+
├── .env # Credentials for testing (GITIGNORED)
|
|
52
|
+
├── .gitignore # Protects secrets
|
|
28
53
|
├── phases/ # Phase-specific data
|
|
29
|
-
│ └── {
|
|
54
|
+
│ └── {story_id}/
|
|
30
55
|
│ ├── RESEARCH.md
|
|
31
56
|
│ ├── PLAN.md
|
|
32
57
|
│ └── VERIFY.md
|
|
@@ -35,6 +60,13 @@ Scan the codebase:
|
|
|
35
60
|
└── archive/ # Archived states
|
|
36
61
|
```
|
|
37
62
|
|
|
63
|
+
**Create `.ctx/.gitignore`:**
|
|
64
|
+
```
|
|
65
|
+
.env
|
|
66
|
+
*.secrets
|
|
67
|
+
credentials.json
|
|
68
|
+
```
|
|
69
|
+
|
|
38
70
|
## Step 4: Initialize STATE.md
|
|
39
71
|
Create STATE.md from template with:
|
|
40
72
|
- Project name (from package.json or directory name)
|
|
@@ -49,33 +81,177 @@ chunkhound index . --output .ctx/chunks.json
|
|
|
49
81
|
```
|
|
50
82
|
This enables semantic code search during planning.
|
|
51
83
|
|
|
52
|
-
## Step 6:
|
|
84
|
+
## Step 6: Gather Requirements
|
|
53
85
|
Ask user: **"What do you want to build/fix/improve?"**
|
|
54
86
|
|
|
55
|
-
|
|
87
|
+
Then ask follow-up questions to elicit user stories:
|
|
88
|
+
- **"What are the main features/outcomes?"** (becomes stories)
|
|
89
|
+
- **"How will you know each is done?"** (becomes acceptance criteria)
|
|
90
|
+
- **"Any constraints or rules?"** (becomes constitution)
|
|
91
|
+
|
|
92
|
+
## Step 7: Generate PRD.json
|
|
93
|
+
Create PRD.json with gathered information:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"$schema": "https://ctx.dev/schemas/prd.json",
|
|
98
|
+
"version": "1.0",
|
|
99
|
+
"project": {
|
|
100
|
+
"name": "{{project_name}}",
|
|
101
|
+
"description": "{{project_description}}",
|
|
102
|
+
"stack": "{{tech_stack}}",
|
|
103
|
+
"created": "{{timestamp}}"
|
|
104
|
+
},
|
|
105
|
+
"constitution": {
|
|
106
|
+
"principles": ["{{from user or defaults}}"],
|
|
107
|
+
"always": ["{{from user or defaults}}"],
|
|
108
|
+
"never": ["{{from user or defaults}}"],
|
|
109
|
+
"askFirst": ["{{from user or defaults}}"]
|
|
110
|
+
},
|
|
111
|
+
"stories": [
|
|
112
|
+
{
|
|
113
|
+
"id": "S001",
|
|
114
|
+
"title": "{{story_title}}",
|
|
115
|
+
"description": "{{story_description}}",
|
|
116
|
+
"acceptanceCriteria": ["{{criterion_1}}", "{{criterion_2}}"],
|
|
117
|
+
"priority": 1,
|
|
118
|
+
"phase": 1,
|
|
119
|
+
"passes": false,
|
|
120
|
+
"verifiedAt": null,
|
|
121
|
+
"notes": ""
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"metadata": {
|
|
125
|
+
"totalStories": {{count}},
|
|
126
|
+
"passedStories": 0,
|
|
127
|
+
"currentStory": "S001",
|
|
128
|
+
"lastUpdated": "{{timestamp}}"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Story Generation Rules:**
|
|
134
|
+
- Each distinct feature/outcome = one story
|
|
135
|
+
- Max 3 acceptance criteria per story (keep atomic)
|
|
136
|
+
- Ordered by dependency (foundation first)
|
|
137
|
+
- All stories start with `passes: false`
|
|
138
|
+
|
|
139
|
+
## Step 8: Gather Credentials for Testing
|
|
140
|
+
|
|
141
|
+
Ask user about testing requirements:
|
|
142
|
+
|
|
143
|
+
**"Will this project need browser testing?"**
|
|
144
|
+
If yes, gather:
|
|
145
|
+
- **App URL** (local dev, staging, or production)
|
|
146
|
+
- **Test user credentials** (email/password for login flows)
|
|
147
|
+
- **Admin credentials** (if admin features exist)
|
|
148
|
+
|
|
149
|
+
**"Are there external APIs or services?"**
|
|
150
|
+
If yes, gather:
|
|
151
|
+
- **API keys** (third-party services)
|
|
152
|
+
- **Database URLs** (if direct DB testing needed)
|
|
153
|
+
- **OAuth tokens** (if OAuth flows)
|
|
154
|
+
|
|
155
|
+
**"Any other secrets needed for testing?"**
|
|
156
|
+
- Environment-specific values
|
|
157
|
+
- Feature flags
|
|
158
|
+
- Test data identifiers
|
|
159
|
+
|
|
160
|
+
## Step 9: Create .ctx/.env
|
|
161
|
+
|
|
162
|
+
Write credentials to `.ctx/.env`:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# CTX Test Credentials - DO NOT COMMIT
|
|
166
|
+
# Generated by /ctx init
|
|
167
|
+
|
|
168
|
+
# App URLs
|
|
169
|
+
APP_URL=http://localhost:3000
|
|
170
|
+
STAGING_URL=
|
|
171
|
+
|
|
172
|
+
# Test User
|
|
173
|
+
TEST_USER_EMAIL=
|
|
174
|
+
TEST_USER_PASSWORD=
|
|
175
|
+
|
|
176
|
+
# Admin User (if applicable)
|
|
177
|
+
ADMIN_EMAIL=
|
|
178
|
+
ADMIN_PASSWORD=
|
|
179
|
+
|
|
180
|
+
# API Keys
|
|
181
|
+
API_KEY=
|
|
182
|
+
|
|
183
|
+
# Database (if applicable)
|
|
184
|
+
DATABASE_URL=
|
|
185
|
+
|
|
186
|
+
# Other Secrets
|
|
187
|
+
# Add as needed
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**IMPORTANT:**
|
|
191
|
+
- Create `.ctx/.gitignore` with `.env` entry
|
|
192
|
+
- Warn user: "Credentials stored in .ctx/.env - NEVER commit this file"
|
|
193
|
+
- Verify .gitignore is in place before proceeding
|
|
194
|
+
|
|
195
|
+
## Step 10: Link STATE.md to PRD
|
|
196
|
+
Update STATE.md to reference current story:
|
|
197
|
+
- **Current Story**: S001 - {{title}}
|
|
198
|
+
|
|
199
|
+
Do NOT start planning yet. Set status to "initializing".
|
|
56
200
|
The user will run `/ctx` to begin the research + planning phase.
|
|
57
201
|
</workflow>
|
|
58
202
|
|
|
59
203
|
<output_format>
|
|
60
204
|
```
|
|
61
|
-
[CTX 2.
|
|
205
|
+
[CTX 2.2] Initialized
|
|
62
206
|
|
|
63
207
|
Project: {{name}}
|
|
64
208
|
Stack: {{language}} + {{framework}}
|
|
65
209
|
Directory: .ctx/
|
|
66
210
|
|
|
211
|
+
PRD: {{story_count}} stories
|
|
212
|
+
S001: {{story_1_title}} ⬜
|
|
213
|
+
S002: {{story_2_title}} ⬜
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
Constitution:
|
|
217
|
+
Principles: {{count}}
|
|
218
|
+
Always: {{count}}
|
|
219
|
+
Never: {{count}}
|
|
220
|
+
|
|
221
|
+
Credentials:
|
|
222
|
+
App URL: {{configured | not set}}
|
|
223
|
+
Test User: {{configured | not set}}
|
|
224
|
+
API Keys: {{count}} configured
|
|
225
|
+
⚠️ Stored in .ctx/.env (gitignored)
|
|
226
|
+
|
|
67
227
|
Integrations:
|
|
68
228
|
ArguSeek: ready
|
|
69
229
|
ChunkHound: {{indexed | not found}}
|
|
230
|
+
Browser Testing: {{ready | needs credentials}}
|
|
70
231
|
|
|
71
|
-
|
|
232
|
+
Ready for autonomous execution.
|
|
233
|
+
Next: Run /ctx to start planning for S001
|
|
72
234
|
```
|
|
73
235
|
</output_format>
|
|
74
236
|
|
|
75
237
|
<success_criteria>
|
|
76
238
|
- [ ] .ctx/ directory created
|
|
239
|
+
- [ ] .ctx/.gitignore created (protects .env)
|
|
77
240
|
- [ ] STATE.md initialized with detected info
|
|
241
|
+
- [ ] PRD.json created with user stories
|
|
242
|
+
- [ ] Constitution defined (user or defaults)
|
|
243
|
+
- [ ] All stories have acceptance criteria
|
|
244
|
+
- [ ] .ctx/.env created with credentials (if provided)
|
|
78
245
|
- [ ] ChunkHound index attempted
|
|
79
|
-
- [ ] User prompted for goal
|
|
80
246
|
- [ ] Status set to "initializing"
|
|
247
|
+
- [ ] User warned about credential security
|
|
81
248
|
</success_criteria>
|
|
249
|
+
|
|
250
|
+
<security_reminders>
|
|
251
|
+
**CRITICAL - Credential Security:**
|
|
252
|
+
1. NEVER commit `.ctx/.env` to version control
|
|
253
|
+
2. NEVER echo credentials in logs or output
|
|
254
|
+
3. ALWAYS verify `.ctx/.gitignore` exists before storing secrets
|
|
255
|
+
4. WARN user if `.gitignore` is missing or incomplete
|
|
256
|
+
5. Use credentials ONLY for automated testing
|
|
257
|
+
</security_reminders>
|