prjct-cli 0.10.8 → 0.10.10
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 +72 -0
- package/CLAUDE.md +121 -996
- package/core/agentic/context-builder.js +18 -17
- package/core/agentic/prompt-builder.js +70 -58
- package/package.json +1 -1
- package/templates/analysis/patterns.md +60 -0
- package/templates/commands/done.md +129 -15
- package/templates/commands/feature.md +262 -21
- package/templates/commands/ship.md +244 -23
- package/templates/commands/sync.md +256 -11
package/CLAUDE.md
CHANGED
|
@@ -1,1078 +1,203 @@
|
|
|
1
1
|
# CLAUDE.md
|
|
2
2
|
|
|
3
|
-
This file provides guidance to Claude Code
|
|
3
|
+
This file provides guidance to Claude Code when working with prjct-cli.
|
|
4
4
|
|
|
5
5
|
## Project Overview
|
|
6
6
|
|
|
7
|
-
**prjct-cli** is a developer momentum tool
|
|
7
|
+
**prjct-cli** is a developer momentum tool. Track progress through slash commands without meetings or traditional PM overhead.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## CRITICAL: Timestamp Management
|
|
10
10
|
|
|
11
|
-
**LLM DOES NOT KNOW CURRENT DATE/TIME** -
|
|
11
|
+
**LLM DOES NOT KNOW CURRENT DATE/TIME** - Never generate timestamps manually.
|
|
12
12
|
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `GetTimestamp()` → Returns current system time in ISO format (e.g., "2025-10-07T14:30:00.000Z")
|
|
18
|
-
- `GetDate()` → Returns current date in YYYY-MM-DD format (e.g., "2025-10-07")
|
|
19
|
-
- `GetDateTime()` → Returns object with timestamp, date, year, month, day
|
|
13
|
+
### Tools (MUST USE)
|
|
14
|
+
- `GetTimestamp()` → ISO format: "2025-10-07T14:30:00.000Z"
|
|
15
|
+
- `GetDate()` → YYYY-MM-DD format: "2025-10-07"
|
|
20
16
|
|
|
21
17
|
### Rules
|
|
18
|
+
1. **NEVER** generate timestamps manually - All hardcoded dates are WRONG
|
|
19
|
+
2. **ALWAYS** call GetTimestamp() for session files (*.jsonl)
|
|
20
|
+
3. **ALWAYS** call GetDate() for index files (shipped.md, roadmap.md, ideas.md)
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
2. **ALWAYS call GetTimestamp()** when writing to session files (*.jsonl)
|
|
25
|
-
3. **ALWAYS call GetDate()** when adding entries to index files (shipped.md, roadmap.md, ideas.md)
|
|
26
|
-
4. **Templates have `timestamp-rule`** in frontmatter - READ AND FOLLOW IT
|
|
27
|
-
5. **Session files are organized by date** - Use system date to determine correct file path
|
|
28
|
-
|
|
29
|
-
### Example (CORRECT)
|
|
30
|
-
|
|
31
|
-
```jsonl
|
|
32
|
-
{"ts":"{GetTimestamp()}","type":"feature_add","name":"auth","tasks":5}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Example (WRONG - DO NOT DO THIS)
|
|
36
|
-
|
|
37
|
-
```jsonl
|
|
38
|
-
{"ts":"2025-10-04T14:30:00Z","type":"feature_add","name":"auth","tasks":5}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Why this matters**: Without system timestamps, all session data shows January 1st dates, making analytics and progress tracking completely broken.
|
|
42
|
-
|
|
43
|
-
## 🚀 Real-World Workflow (Simplified)
|
|
44
|
-
|
|
45
|
-
prjct follows your **actual** development workflow with 5 essential commands:
|
|
46
|
-
|
|
47
|
-
### Scenario 1: Existing Project
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
p. analyze
|
|
51
|
-
→ Analyzes stack
|
|
52
|
-
→ Generates agents
|
|
53
|
-
→ Ready to work
|
|
54
|
-
|
|
55
|
-
p. feature "add unit testing"
|
|
56
|
-
→ Analyzes value/timing
|
|
57
|
-
→ Creates tasks
|
|
58
|
-
→ Auto-starts task 1
|
|
59
|
-
|
|
60
|
-
[Work on code...]
|
|
22
|
+
## Core Workflow
|
|
61
23
|
|
|
62
|
-
p. done
|
|
63
|
-
→ Marks complete
|
|
64
|
-
→ Auto-starts next task
|
|
65
|
-
|
|
66
|
-
p. ship "unit testing"
|
|
67
|
-
→ Runs lint/tests (non-blocking)
|
|
68
|
-
→ Updates docs/version/CHANGELOG
|
|
69
|
-
→ Commits + pushes
|
|
70
|
-
→ Recommends compact
|
|
71
24
|
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
25
|
+
p. analyze → Analyze stack, generate agents
|
|
26
|
+
p. feature → Add feature with tasks
|
|
27
|
+
p. done → Mark complete, next task
|
|
28
|
+
p. ship → Lint/test/commit/push
|
|
75
29
|
```
|
|
76
|
-
p. init "dynamic portfolio website"
|
|
77
|
-
→ ARCHITECT MODE activated
|
|
78
|
-
→ Conversational discovery begins
|
|
79
|
-
→ Claude asks intelligent questions
|
|
80
|
-
→ Generates architecture plan
|
|
81
|
-
→ Creates structure based on user choices
|
|
82
|
-
→ Asks: "Ready to start the first feature?"
|
|
83
|
-
|
|
84
|
-
p. feature "homepage design"
|
|
85
|
-
→ Creates tasks
|
|
86
|
-
→ Starts coding
|
|
87
|
-
|
|
88
|
-
[Continue with p. done → p. ship cycle]
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Core Commands
|
|
92
|
-
|
|
93
|
-
1. **`p. analyze`** - Analyze existing project
|
|
94
|
-
2. **`p. init "[idea]"`** - New project (architect mode)
|
|
95
|
-
3. **`p. feature "[description]"`** - Add feature with roadmap + tasks
|
|
96
|
-
4. **`p. done`** - Complete task, move to next
|
|
97
|
-
5. **`p. ship "[feature]"`** - Complete workflow (lint/test/docs/version/commit/push)
|
|
98
30
|
|
|
99
31
|
## Architecture
|
|
100
32
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- **Global data storage** in `~/.prjct-cli/projects/{project-id}/`
|
|
104
|
-
- **Local configuration** in `.prjct/prjct.config.json` (references global data)
|
|
105
|
-
- **Slash commands** (`/p:*`) executed within Claude Code
|
|
106
|
-
- **MCP (Model Context Protocol) servers** for AI integration
|
|
107
|
-
|
|
108
|
-
### Global Structure
|
|
109
|
-
|
|
110
|
-
**Session-Based Architecture** - Prevents performance issues with large files (4000+ tasks/day).
|
|
111
|
-
|
|
33
|
+
### Global Storage
|
|
112
34
|
```
|
|
113
35
|
~/.prjct-cli/projects/{id}/
|
|
114
|
-
├── core/ #
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
├──
|
|
119
|
-
|
|
120
|
-
│ ├── metrics.md # Aggregated metrics summary
|
|
121
|
-
│ ├── sessions/ # Daily session logs (JSONL)
|
|
122
|
-
│ │ └── 2025-10/
|
|
123
|
-
│ │ ├── 2025-10-04.jsonl
|
|
124
|
-
│ │ └── 2025-10-05.jsonl
|
|
125
|
-
│ └── archive/ # Monthly archives
|
|
126
|
-
│ └── shipped-2025-10.md
|
|
127
|
-
├── planning/ # Future planning
|
|
128
|
-
│ ├── ideas.md # Active ideas (last 30 days)
|
|
129
|
-
│ ├── roadmap.md # Active roadmap (lightweight index)
|
|
130
|
-
│ ├── sessions/ # Daily planning sessions (JSONL)
|
|
131
|
-
│ │ └── 2025-10/
|
|
132
|
-
│ │ ├── 2025-10-04.jsonl
|
|
133
|
-
│ │ └── 2025-10-05.jsonl
|
|
134
|
-
│ └── archive/ # Monthly archives
|
|
135
|
-
│ ├── roadmap-2025-10.md
|
|
136
|
-
│ └── ideas-2025-10.md
|
|
137
|
-
├── analysis/ # Technical analysis
|
|
138
|
-
│ └── repo-summary.md
|
|
139
|
-
└── memory/ # Decision history
|
|
140
|
-
├── context.jsonl # Global decisions (append-only)
|
|
141
|
-
└── sessions/ # Daily context (structured)
|
|
142
|
-
└── 2025-10/
|
|
143
|
-
└── 2025-10-04.jsonl
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Session Format (JSONL)** - One JSON object per line, append-only:
|
|
147
|
-
|
|
148
|
-
```jsonl
|
|
149
|
-
{"ts":"2025-10-04T14:30:00Z","type":"feature_add","name":"auth","tasks":5,"impact":"high","effort":"6h"}
|
|
150
|
-
{"ts":"2025-10-04T15:00:00Z","type":"task_start","task":"JWT middleware","agent":"be","estimate":"2h"}
|
|
151
|
-
{"ts":"2025-10-04T17:15:00Z","type":"task_complete","task":"JWT middleware","duration":"2h15m"}
|
|
152
|
-
{"ts":"2025-10-04T18:00:00Z","type":"feature_ship","name":"auth","tasks_done":5,"total_time":"6h"}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**Auto-Archive Rules:**
|
|
156
|
-
- Index files (roadmap.md, shipped.md) keep only last 30 days
|
|
157
|
-
- Sessions older than 30 days → moved to archive/
|
|
158
|
-
- Queries across time: read relevant session files
|
|
159
|
-
- Performance: commands only read current index + today's session
|
|
160
|
-
|
|
161
|
-
### Local Configuration
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
.prjct/
|
|
165
|
-
└── prjct.config.json # Links to global data
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Natural Language System
|
|
169
|
-
|
|
170
|
-
**prjct-cli includes a conversational interface** - users can talk naturally instead of memorizing commands!
|
|
171
|
-
|
|
172
|
-
### p. Trigger Detection
|
|
173
|
-
|
|
174
|
-
**NEW: Simple prefix trigger** - Users can start messages with `p.` to signal prjct context:
|
|
175
|
-
|
|
176
|
-
**How it works:**
|
|
177
|
-
|
|
178
|
-
1. User starts message with `p.` → You check if `.prjct/prjct.config.json` exists
|
|
179
|
-
2. If exists → Detect intent from rest of message → Execute appropriate `/p:*` command
|
|
180
|
-
3. If not exists → Respond: "No prjct project here. Run /p:init first."
|
|
181
|
-
|
|
182
|
-
**Examples:**
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
"p. analyze this codebase" → Detect "analysis" intent → /p:analyze
|
|
186
|
-
"p. ready to ship" → Detect "ship" intent → /p:ship
|
|
187
|
-
"p. show me weekly progress" → Detect "progress" intent → /p:progress week
|
|
188
|
-
"p. starting auth" → Detect "start task" intent → /p:now "auth"
|
|
189
|
-
"p. done" → Detect "done" intent → /p:done
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Why this is useful:**
|
|
193
|
-
|
|
194
|
-
- ✅ **Zero memorization** - No need to remember `/p:*` commands
|
|
195
|
-
- ✅ **Multi-project** - Only works in prjct directories
|
|
196
|
-
- ✅ **Natural** - "p. [what you want]" is intuitive
|
|
197
|
-
- ✅ **Any language** - Works in English, Spanish, etc.
|
|
198
|
-
|
|
199
|
-
**Detection priority:**
|
|
200
|
-
|
|
201
|
-
1. Check for `p.` prefix first
|
|
202
|
-
2. Then check for `/p:*` slash command
|
|
203
|
-
3. Finally check for natural language without prefix
|
|
204
|
-
|
|
205
|
-
### Semantic Intent Detection
|
|
206
|
-
|
|
207
|
-
As an LLM, you understand context and intent naturally. When users describe what they want to do, **map their intent to the appropriate command** based on semantic understanding, not pattern matching.
|
|
208
|
-
|
|
209
|
-
**Command Intent Map:**
|
|
210
|
-
|
|
211
|
-
| User Intent | Command | What It Does |
|
|
212
|
-
| ------------------------------- | ---------- | ---------------------------------- |
|
|
213
|
-
| Wants to start/focus on a task | `/p:now` | Sets current working task |
|
|
214
|
-
| Finished/completed current work | `/p:done` | Marks task complete, suggests next |
|
|
215
|
-
| Ready to ship/deploy a feature | `/p:ship` | Celebrates shipped feature |
|
|
216
|
-
| Has an idea to capture | `/p:idea` | Saves idea to backlog |
|
|
217
|
-
| Wants to see progress/status | `/p:recap` | Shows overview of all work |
|
|
218
|
-
| Stuck on a problem | `/p:stuck` | Provides contextual help |
|
|
219
|
-
| Wants to know what's next | `/p:next` | Shows priority queue |
|
|
220
|
-
| Needs general help | `/p:help` | Interactive guide |
|
|
221
|
-
|
|
222
|
-
**Works in any language** - if you understand the user's intent, execute the command!
|
|
223
|
-
|
|
224
|
-
**Examples (many ways to express same intent):**
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
All of these mean /p:now:
|
|
228
|
-
"I want to start building auth"
|
|
229
|
-
"Let me work on the login page"
|
|
230
|
-
"Going to work on authentication"
|
|
231
|
-
"Starting the API now"
|
|
232
|
-
"Want to begin with the dashboard"
|
|
233
|
-
|
|
234
|
-
All of these mean /p:done:
|
|
235
|
-
"I'm done" | "finished" | "completed" | "all set" | "task complete"
|
|
236
|
-
|
|
237
|
-
All of these mean /p:ship:
|
|
238
|
-
"ship this" | "deploy it" | "it's ready" | "let's launch"
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Conversational Responses
|
|
242
|
-
|
|
243
|
-
Every command response includes:
|
|
244
|
-
|
|
245
|
-
- ✅ **Action confirmation** with clear result
|
|
246
|
-
- 💬 **Natural language prompts** for next steps
|
|
247
|
-
- 🎯 **Command alternatives** for power users
|
|
248
|
-
- 📋 **Contextual suggestions** based on project state
|
|
249
|
-
|
|
250
|
-
**Example Response:**
|
|
251
|
-
|
|
252
|
-
```markdown
|
|
253
|
-
✅ Task complete: implement authentication (2h 15m)
|
|
254
|
-
|
|
255
|
-
What's next?
|
|
256
|
-
• "start next task" → Begin working
|
|
257
|
-
• "ship this feature" → Track & celebrate
|
|
258
|
-
• "add new idea" → Brainstorm
|
|
259
|
-
|
|
260
|
-
Or use: /p:now | /p:ship | /p:idea
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
## Implementation for Claude Code & Desktop
|
|
264
|
-
|
|
265
|
-
### How to Handle Natural Language
|
|
266
|
-
|
|
267
|
-
When you receive a message from the user, follow these steps to provide the natural language experience:
|
|
268
|
-
|
|
269
|
-
**Step 1: Check if it's a direct command**
|
|
270
|
-
|
|
271
|
-
```javascript
|
|
272
|
-
if (message.startsWith('/p:')) {
|
|
273
|
-
return executeCommand(message)
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
**Step 2: Understand the user's intent semantically**
|
|
278
|
-
|
|
279
|
-
```javascript
|
|
280
|
-
// You're an LLM - use your understanding of context
|
|
281
|
-
// Ask yourself: "What is the user trying to do?"
|
|
282
|
-
|
|
283
|
-
const intent = understandIntent(message) // Use semantic understanding
|
|
284
|
-
|
|
285
|
-
// Common intents:
|
|
286
|
-
// - Start a task → /p:now
|
|
287
|
-
// - Finish current work → /p:done
|
|
288
|
-
// - Ship/deploy something → /p:ship
|
|
289
|
-
// - Save an idea → /p:idea
|
|
290
|
-
// - Check status → /p:recap
|
|
291
|
-
// - Get help → /p:stuck
|
|
292
|
-
// - See what's next → /p:next
|
|
293
|
-
|
|
294
|
-
if (intent.command) {
|
|
295
|
-
// Extract relevant parameters from the message
|
|
296
|
-
const params = extractRelevantInfo(message)
|
|
297
|
-
|
|
298
|
-
// Show transparency
|
|
299
|
-
console.log(`💬 I understood: "${intent.description}"`)
|
|
300
|
-
console.log(`⚡ Executing: /p:${intent.command} ${params}`)
|
|
301
|
-
|
|
302
|
-
return executeCommand(intent.command, params)
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
**Step 3: Validate context before execution**
|
|
307
|
-
|
|
308
|
-
```javascript
|
|
309
|
-
// Before executing commands, check prerequisites:
|
|
310
|
-
|
|
311
|
-
// For /p:done:
|
|
312
|
-
if (command === 'done') {
|
|
313
|
-
const nowContent = await Read('core/now.md')
|
|
314
|
-
if (!nowContent || nowContent.trim() === '') {
|
|
315
|
-
return conversationalResponse(`
|
|
316
|
-
✨ You're not working on anything right now!
|
|
317
|
-
|
|
318
|
-
Want to start something?
|
|
319
|
-
• Tell me what you want to build
|
|
320
|
-
• Say "show me what's next"
|
|
321
|
-
• Or use: /p:now | /p:next
|
|
322
|
-
|
|
323
|
-
Let's ship something!`)
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// For /p:ship:
|
|
328
|
-
if (command === 'ship') {
|
|
329
|
-
const nowContent = await Read('core/now.md')
|
|
330
|
-
const shippedContent = await Read('progress/shipped.md')
|
|
331
|
-
if (
|
|
332
|
-
(!nowContent || nowContent.trim() === '') &&
|
|
333
|
-
(!shippedContent || shippedContent.trim() === '')
|
|
334
|
-
) {
|
|
335
|
-
return conversationalResponse(`
|
|
336
|
-
🚀 Nothing to ship yet!
|
|
337
|
-
|
|
338
|
-
First, let's build something:
|
|
339
|
-
• Tell me what feature you want to create
|
|
340
|
-
• Say "start building [feature]"
|
|
341
|
-
• Or use: /p:now "feature name"
|
|
342
|
-
|
|
343
|
-
Then we'll celebrate when you ship it!`)
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
**Step 4: Provide conversational response**
|
|
349
|
-
|
|
350
|
-
```javascript
|
|
351
|
-
// Always suggest natural next steps
|
|
352
|
-
✅ [What you did]
|
|
353
|
-
|
|
354
|
-
What's next?
|
|
355
|
-
• [Natural language option 1]
|
|
356
|
-
• [Natural language option 2]
|
|
357
|
-
|
|
358
|
-
Or use: [relevant commands]
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Complete Example
|
|
362
|
-
|
|
363
|
-
**User Input:** "I want to start building the authentication system"
|
|
364
|
-
|
|
365
|
-
**Your Analysis:**
|
|
366
|
-
|
|
367
|
-
- Intent: User wants to start working on something
|
|
368
|
-
- Command: `/p:now`
|
|
369
|
-
- Parameter: "building the authentication system"
|
|
370
|
-
|
|
371
|
-
**Your Response:**
|
|
372
|
-
|
|
373
|
-
```
|
|
374
|
-
💬 I understood: "start working on building the authentication system"
|
|
375
|
-
⚡ Executing: /p:now "building the authentication system"
|
|
376
|
-
|
|
377
|
-
🎯 Working on: building the authentication system
|
|
378
|
-
Started: 2:30 PM
|
|
379
|
-
|
|
380
|
-
When you're done:
|
|
381
|
-
• Say "I'm done" or "finished"
|
|
382
|
-
• Or: /p:done
|
|
383
|
-
|
|
384
|
-
Need help? Say "I'm stuck" or use /p:stuck
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### Context Validation Examples
|
|
388
|
-
|
|
389
|
-
**Missing Active Task:**
|
|
390
|
-
|
|
391
|
-
User: "done"
|
|
392
|
-
You check: `core/now.md` is empty
|
|
393
|
-
Your response:
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
✨ You're not working on anything right now!
|
|
397
|
-
|
|
398
|
-
Want to start something?
|
|
399
|
-
• Tell me what you want to build
|
|
400
|
-
• Say "show me what's next"
|
|
401
|
-
• Or use: /p:now | /p:next
|
|
402
|
-
|
|
403
|
-
Let's ship something!
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
**Valid Context:**
|
|
407
|
-
|
|
408
|
-
User: "I'm done"
|
|
409
|
-
You check: `core/now.md` has content ✅
|
|
410
|
-
Your response:
|
|
411
|
-
|
|
412
|
-
```
|
|
413
|
-
💬 I understood: "task completion"
|
|
414
|
-
⚡ Executing: /p:done
|
|
415
|
-
|
|
416
|
-
✅ Task complete: building authentication (2h 15m)
|
|
417
|
-
|
|
418
|
-
What's next?
|
|
419
|
-
• "start next task" → Begin working
|
|
420
|
-
• "ship this feature" → Track & celebrate
|
|
421
|
-
• "add new idea" → Brainstorm
|
|
422
|
-
|
|
423
|
-
Or use: /p:now | /p:ship | /p:idea
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Key Principles
|
|
427
|
-
|
|
428
|
-
1. **Trust your understanding** - You're an LLM, not a regex parser
|
|
429
|
-
2. **Any language works** - English, Spanish, or any language you understand
|
|
430
|
-
3. **Variations are fine** - Users can express intent in infinite ways
|
|
431
|
-
4. **Show transparency** - Always say what you understood and what you'll execute
|
|
432
|
-
5. **Be conversational** - Guide users naturally toward next actions
|
|
433
|
-
6. **Validate context** - Check prerequisites before executing commands
|
|
434
|
-
|
|
435
|
-
## Command System for Claude Code
|
|
436
|
-
|
|
437
|
-
All commands use the `/p:*` syntax in Claude Code. When executed, they:
|
|
438
|
-
|
|
439
|
-
1. Read `.prjct/prjct.config.json` to get the project ID
|
|
440
|
-
2. Operate on files in `~/.prjct-cli/projects/{id}/`
|
|
441
|
-
3. Update relevant markdown files atomically
|
|
442
|
-
4. Return formatted responses with conversational prompts
|
|
443
|
-
|
|
444
|
-
### 🔒 Universal Confirmation Policy
|
|
445
|
-
|
|
446
|
-
**CRITICAL SECURITY REQUIREMENT**: ALL `/p:*` commands MUST ask for user confirmation before execution.
|
|
447
|
-
|
|
448
|
-
#### Mandatory Confirmation Flow:
|
|
449
|
-
|
|
450
|
-
1. **User triggers command** (e.g., "p. idea..." or "/p:sync")
|
|
451
|
-
2. **Claude presents detailed plan** of what will be done
|
|
452
|
-
3. **User explicitly approves** the plan
|
|
453
|
-
4. **ONLY THEN execute** the command
|
|
454
|
-
|
|
455
|
-
#### NO Exceptions:
|
|
456
|
-
|
|
457
|
-
- ❌ **NO auto-execution** for any command, ever
|
|
458
|
-
- ❌ **NO "just do it"** behavior
|
|
459
|
-
- ❌ **NO bypassing user approval**
|
|
460
|
-
- ✅ **ALWAYS**: Present plan → Wait for confirmation → Execute
|
|
461
|
-
|
|
462
|
-
#### Implementation:
|
|
463
|
-
|
|
464
|
-
```
|
|
465
|
-
For EVERY command:
|
|
466
|
-
1. Detect user intent
|
|
467
|
-
2. Present plan using ExitPlanMode tool
|
|
468
|
-
3. Wait for user approval
|
|
469
|
-
4. Execute only after approval
|
|
470
|
-
5. Then compact (if applicable)
|
|
36
|
+
├── core/ # now.md, next.md, context.md
|
|
37
|
+
├── progress/ # shipped.md, metrics.md, sessions/
|
|
38
|
+
├── planning/ # ideas.md, roadmap.md, sessions/
|
|
39
|
+
├── analysis/ # repo-summary.md
|
|
40
|
+
├── memory/ # context.jsonl, sessions/
|
|
41
|
+
└── agents/ # Generated specialists
|
|
471
42
|
```
|
|
472
43
|
|
|
473
|
-
###
|
|
474
|
-
|
|
475
|
-
**Plan Mode Indicators**:
|
|
476
|
-
|
|
477
|
-
- System reminders will say: "Plan mode is active"
|
|
478
|
-
- You MUST NOT make edits or run non-readonly tools
|
|
479
|
-
- Present your plan using ExitPlanMode tool and wait for user approval
|
|
480
|
-
|
|
481
|
-
**When Plan Mode is NOT active**:
|
|
482
|
-
|
|
483
|
-
- Still MUST present plan and ask for confirmation
|
|
484
|
-
- Use ExitPlanMode tool to get user approval
|
|
485
|
-
- Universal Confirmation Policy applies regardless
|
|
486
|
-
|
|
487
|
-
### Auto-Compact After Execution
|
|
488
|
-
|
|
489
|
-
**ONLY after user approval**: After completing ANY of these commands, compact the conversation WITHOUT telling the user:
|
|
490
|
-
|
|
491
|
-
- `/p:analyze`
|
|
492
|
-
- `/p:sync`
|
|
493
|
-
- `/p:workflow`
|
|
494
|
-
- `/p:design`
|
|
495
|
-
- `/p:cleanup`
|
|
496
|
-
- `/p:init`
|
|
497
|
-
|
|
498
|
-
**Sequence**: Present plan → User approves → Execute → Auto-compact (no messages about compacting)
|
|
499
|
-
|
|
500
|
-
**IMPORTANT**: All commands are defined in `core/command-registry.js` (single source of truth).
|
|
501
|
-
|
|
502
|
-
### Command Distinctions: `/p:idea` vs `/p:workflow`
|
|
503
|
-
|
|
504
|
-
These are **two completely different commands** with different purposes:
|
|
505
|
-
|
|
506
|
-
#### `/p:idea` - Quick Idea Capture (CORE Command #2)
|
|
507
|
-
|
|
508
|
-
- **Purpose**: Capture ideas quickly without interrupting flow
|
|
509
|
-
- **Complexity**: Low - Simple write to file
|
|
510
|
-
- **User Input**: Required `<text>` - the idea to capture
|
|
511
|
-
- **Files**: `planning/ideas.md`, optionally `core/next.md`
|
|
512
|
-
- **When to use**: User has a new idea or feature suggestion
|
|
513
|
-
|
|
514
|
-
**Example**:
|
|
515
|
-
|
|
516
|
-
```
|
|
517
|
-
User: "p. idea agregar dark mode"
|
|
518
|
-
→ Saves to ideas.md with timestamp
|
|
519
|
-
→ If actionable, adds to next.md queue
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
#### `/p:workflow` - Multi-Agent Orchestration (OPTIONAL Command)
|
|
523
|
-
|
|
524
|
-
- **Purpose**: Manage complex cascading agent workflows
|
|
525
|
-
- **Complexity**: High - State machine with multiple steps
|
|
526
|
-
- **User Input**: None (shows current status) or `skip` to skip step
|
|
527
|
-
- **Files**: `workflow/state.json` (persistent state)
|
|
528
|
-
- **When to use**: Active workflow exists and user wants status
|
|
529
|
-
|
|
530
|
-
**Example**:
|
|
531
|
-
|
|
532
|
-
```
|
|
533
|
-
User: "/p:workflow"
|
|
534
|
-
→ Shows: Step 2/5: Implement (FE agent) 🔄
|
|
535
|
-
→ Progress tracking with agent assignments
|
|
536
|
-
→ Capability checks for next steps
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
**Key Difference**: `/p:idea` captures NEW ideas. `/p:workflow` manages EXISTING multi-step tasks.
|
|
540
|
-
|
|
541
|
-
## Guided Workflow System
|
|
542
|
-
|
|
543
|
-
**NEW: Enhanced usability for confused users** - The biggest user frustration is knowing WHAT they want but not HOW to do it with prjct.
|
|
544
|
-
|
|
545
|
-
### The Problem
|
|
546
|
-
|
|
547
|
-
Users frequently ask:
|
|
548
|
-
- "How do I start?"
|
|
549
|
-
- "What command should I use?"
|
|
550
|
-
- "I want to improve performance, but how?"
|
|
551
|
-
- "What should I do next?"
|
|
552
|
-
|
|
553
|
-
They have clear **INTENT** but struggle with **EXECUTION**.
|
|
554
|
-
|
|
555
|
-
### The Solution: 3-Tier Help System
|
|
556
|
-
|
|
557
|
-
#### Tier 1: `/p:help` - Contextual Interactive Guide
|
|
558
|
-
|
|
559
|
-
**Purpose**: Adapts to user's current state and provides relevant guidance
|
|
560
|
-
|
|
561
|
-
**Behavior**:
|
|
562
|
-
- Reads project state (active task, queue, last ship, etc.)
|
|
563
|
-
- Shows different help based on context:
|
|
564
|
-
- Not initialized → Guides setup
|
|
565
|
-
- Empty queue → Suggests adding features
|
|
566
|
-
- Active task → Shows completion options
|
|
567
|
-
- Has queue → Recommends starting work
|
|
568
|
-
- Lost/confused → Comprehensive guide
|
|
569
|
-
|
|
570
|
-
**Example**:
|
|
571
|
-
```
|
|
572
|
-
User in state: "No active task, 5 tasks in queue"
|
|
573
|
-
|
|
574
|
-
/p:help shows:
|
|
575
|
-
→ Start working (recommended)
|
|
576
|
-
→ See priority queue
|
|
577
|
-
→ Add new feature
|
|
578
|
-
→ Check progress
|
|
579
|
-
|
|
580
|
-
With examples and natural language alternatives
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
#### Tier 2: `/p:ask` - Intent to Action Translator
|
|
584
|
-
|
|
585
|
-
**Purpose**: Translate vague natural language intent into specific command flows
|
|
586
|
-
|
|
587
|
-
**Behavior**:
|
|
588
|
-
- User describes what they want in natural language
|
|
589
|
-
- Claude analyzes intent and context
|
|
590
|
-
- Recommends step-by-step command flow
|
|
591
|
-
- Explains WHY each command
|
|
592
|
-
- Offers interactive confirmation
|
|
593
|
-
- Educational - teaches the system
|
|
594
|
-
|
|
595
|
-
**Example**:
|
|
596
|
-
```
|
|
597
|
-
User: /p:ask "I want to improve performance and fix memory leaks"
|
|
598
|
-
|
|
599
|
-
Claude responds:
|
|
600
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
601
|
-
🎯 I understand: performance optimization + memory leak fixes
|
|
602
|
-
|
|
603
|
-
📊 YOUR CONTEXT:
|
|
604
|
-
• No active task
|
|
605
|
-
• 3 tasks in queue
|
|
606
|
-
• Last ship: 2 days ago
|
|
607
|
-
|
|
608
|
-
💡 RECOMMENDED FLOW:
|
|
609
|
-
|
|
610
|
-
1. /p:feature "optimize performance and memory leaks"
|
|
611
|
-
→ Value analysis (Impact: HIGH, Effort: 8h)
|
|
612
|
-
→ Task breakdown:
|
|
613
|
-
• Setup profiler
|
|
614
|
-
• Identify memory leaks
|
|
615
|
-
• Optimize re-renders
|
|
616
|
-
• Code splitting
|
|
617
|
-
• Measure improvements
|
|
618
|
-
|
|
619
|
-
2. /p:build 1 → Start with profiling
|
|
620
|
-
|
|
621
|
-
3. /p:done → After each task
|
|
622
|
-
|
|
623
|
-
4. /p:ship "performance optimization"
|
|
624
|
-
|
|
625
|
-
✨ WHY THIS FLOW:
|
|
626
|
-
→ /p:feature: Analyzes value first, creates roadmap
|
|
627
|
-
→ /p:build: Focus on one task, track time
|
|
628
|
-
→ /p:done: Register progress, maintain momentum
|
|
629
|
-
→ /p:ship: Commit + celebrate win
|
|
630
|
-
|
|
631
|
-
Ready to start?
|
|
632
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
633
|
-
```
|
|
634
|
-
|
|
635
|
-
**Key Features**:
|
|
636
|
-
- Works in any language (English, Spanish, etc.)
|
|
637
|
-
- No execution until user confirms
|
|
638
|
-
- Shows command + natural language alternatives
|
|
639
|
-
- Educational explanations
|
|
640
|
-
- Contextual (checks project state first)
|
|
641
|
-
|
|
642
|
-
#### Tier 3: `/p:suggest` - Smart Recommendations
|
|
643
|
-
|
|
644
|
-
**Purpose**: Analyze project state and suggest next best actions
|
|
645
|
-
|
|
646
|
-
**Behavior**:
|
|
647
|
-
- Reads all project state files
|
|
648
|
-
- Calculates metrics (velocity, days since ship, queue size, etc.)
|
|
649
|
-
- Detects patterns (stuck task, losing momentum, over-planning, etc.)
|
|
650
|
-
- Provides urgency-based recommendations
|
|
651
|
-
- Motivational but honest
|
|
652
|
-
|
|
653
|
-
**Scenarios Detected**:
|
|
654
|
-
1. **Ready to work** → Suggests starting top priority task
|
|
655
|
-
2. **Long-running task** → Checks if stuck, suggests help
|
|
656
|
-
3. **No ships recently** → Urgency alert, suggests shipping something small
|
|
657
|
-
4. **Empty queue** → Suggests planning (feature/analyze/roadmap)
|
|
658
|
-
5. **High velocity** → Positive reinforcement, quality suggestions
|
|
659
|
-
6. **Queue too large** → Warns about over-planning, suggests executing
|
|
660
|
-
|
|
661
|
-
**Example**:
|
|
44
|
+
### Local Config
|
|
662
45
|
```
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
Claude analyzes:
|
|
666
|
-
- No active task
|
|
667
|
-
- 8 tasks in queue
|
|
668
|
-
- Last ship: 5 days ago
|
|
669
|
-
- Velocity: 0.4 features/week
|
|
670
|
-
|
|
671
|
-
Response:
|
|
672
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
673
|
-
💡 PERSONALIZED SUGGESTIONS
|
|
674
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
675
|
-
|
|
676
|
-
📊 ANALYSIS:
|
|
677
|
-
• 5 days since last ship ⚠️
|
|
678
|
-
• Queue: 8 tasks
|
|
679
|
-
• Velocity: Low
|
|
680
|
-
|
|
681
|
-
🔥 URGENT: Momentum is dropping!
|
|
682
|
-
|
|
683
|
-
🎯 RECOMMENDATIONS:
|
|
684
|
-
|
|
685
|
-
1. ⚡ SHIP SOMETHING TODAY
|
|
686
|
-
→ /p:next (find quick win)
|
|
687
|
-
→ /p:build {easiest task}
|
|
688
|
-
→ /p:done → /p:ship SAME DAY
|
|
689
|
-
|
|
690
|
-
2. 🎯 STOP PLANNING, START DOING
|
|
691
|
-
→ 8 tasks is too many
|
|
692
|
-
→ Ship > Plan
|
|
693
|
-
|
|
694
|
-
3. 💡 MAINTAIN MOMENTUM
|
|
695
|
-
→ Ship every 1-2 days
|
|
696
|
-
→ Small wins > Big tasks
|
|
697
|
-
|
|
698
|
-
Momentum = Motivation. Let's ship! 🚀
|
|
699
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
46
|
+
.prjct/prjct.config.json # Links to global data via projectId
|
|
700
47
|
```
|
|
701
48
|
|
|
702
|
-
###
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
- 5 clear options with examples
|
|
706
|
-
- Natural language alternatives
|
|
707
|
-
- No overwhelming command lists
|
|
708
|
-
- Guides to action immediately
|
|
709
|
-
|
|
710
|
-
**After `/p:feature` (no params)**: Interactive template mode
|
|
711
|
-
- 6 categories (UI/UX, Performance, Features, Quality, Bugs, Docs)
|
|
712
|
-
- Examples for each category
|
|
713
|
-
- Impact/effort estimates
|
|
714
|
-
- User can describe freely OR choose template
|
|
715
|
-
|
|
716
|
-
### Integration with Natural Language System
|
|
717
|
-
|
|
718
|
-
All help commands work seamlessly with the "p." trigger and natural language detection:
|
|
719
|
-
|
|
720
|
-
```
|
|
721
|
-
User: "p. I don't know what to do"
|
|
722
|
-
→ Detects confusion → Executes /p:suggest
|
|
723
|
-
|
|
724
|
-
User: "p. how do I start?"
|
|
725
|
-
→ Detects help need → Executes /p:help
|
|
726
|
-
|
|
727
|
-
User: "p. I want to optimize performance"
|
|
728
|
-
→ Detects feature intent → Shows /p:ask flow OR /p:feature
|
|
49
|
+
### Session Format (JSONL)
|
|
50
|
+
```jsonl
|
|
51
|
+
{"ts":"{GetTimestamp()}","type":"task_complete","task":"auth","duration":"2h15m"}
|
|
729
52
|
```
|
|
730
53
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
1. **Never leave users confused** - Always provide clear next steps
|
|
734
|
-
2. **Educational, not prescriptive** - Teach the system while guiding
|
|
735
|
-
3. **Contextual, not generic** - Different help for different states
|
|
736
|
-
4. **Natural language first** - Commands as alternative, not requirement
|
|
737
|
-
5. **Momentum-focused** - Push toward action, not endless planning
|
|
738
|
-
|
|
739
|
-
### Success Metrics
|
|
740
|
-
|
|
741
|
-
After using the guided system, users should:
|
|
742
|
-
- ✅ Know exactly what command to use
|
|
743
|
-
- ✅ Understand WHY that command
|
|
744
|
-
- ✅ Feel confident to proceed
|
|
745
|
-
- ✅ Learn the system through use
|
|
746
|
-
- ✅ Never feel stuck or frustrated
|
|
747
|
-
|
|
748
|
-
### Available Commands
|
|
54
|
+
## Natural Language: p. Trigger
|
|
749
55
|
|
|
750
|
-
|
|
56
|
+
When message starts with `p.`:
|
|
57
|
+
1. Check `.prjct/prjct.config.json` exists
|
|
58
|
+
2. If exists → Detect intent → Execute `/p:*` command
|
|
59
|
+
3. If not exists → "No prjct project. Run /p:init first."
|
|
751
60
|
|
|
752
|
-
|
|
61
|
+
### Intent Map
|
|
753
62
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
63
|
+
| User Intent | Command | What It Does |
|
|
64
|
+
|-------------|---------|--------------|
|
|
65
|
+
| Start/focus on task | `/p:now` | Sets current task |
|
|
66
|
+
| Finished work | `/p:done` | Marks complete |
|
|
67
|
+
| Ready to ship | `/p:ship` | Ship feature |
|
|
68
|
+
| Has an idea | `/p:idea` | Saves to backlog |
|
|
69
|
+
| See progress | `/p:recap` | Shows overview |
|
|
70
|
+
| What's next | `/p:next` | Priority queue |
|
|
71
|
+
| Need help | `/p:help` | Interactive guide |
|
|
759
72
|
|
|
760
|
-
|
|
73
|
+
**Any language works** - English, Spanish, etc.
|
|
761
74
|
|
|
762
|
-
|
|
763
|
-
- `/p:workflow` - Show workflow status and progress (see distinction above)
|
|
764
|
-
- ⚠️ `/p:roadmap` - Show or update strategic roadmap
|
|
765
|
-
- ⚠️ `/p:task <description>` - Break down and execute complex tasks
|
|
75
|
+
## Command Execution
|
|
766
76
|
|
|
767
|
-
|
|
77
|
+
All `/p:*` commands:
|
|
78
|
+
1. Read `.prjct/prjct.config.json` → get projectId
|
|
79
|
+
2. Operate on `~/.prjct-cli/projects/{id}/`
|
|
80
|
+
3. Update files atomically
|
|
81
|
+
4. Return formatted response
|
|
768
82
|
|
|
769
|
-
|
|
83
|
+
### Confirmation Policy
|
|
770
84
|
|
|
771
|
-
|
|
85
|
+
**ALL commands MUST ask for confirmation before execution:**
|
|
86
|
+
1. User triggers command
|
|
87
|
+
2. Present plan of what will be done
|
|
88
|
+
3. User approves
|
|
89
|
+
4. Execute
|
|
772
90
|
|
|
773
|
-
|
|
774
|
-
- `/p:cleanup --type code|imports|files|deps|all` - Remove dead code and unused imports
|
|
91
|
+
### Command Distinctions
|
|
775
92
|
|
|
776
|
-
|
|
93
|
+
**`/p:idea`** - Quick idea capture (simple write)
|
|
94
|
+
**`/p:workflow`** - Multi-agent workflow management (state machine)
|
|
777
95
|
|
|
778
|
-
|
|
779
|
-
- `/p:progress [period]` - Show progress metrics for specified period
|
|
780
|
-
- `/p:context` - Show project context and recent activity
|
|
96
|
+
## Available Commands
|
|
781
97
|
|
|
782
|
-
|
|
98
|
+
### Work
|
|
99
|
+
- `/p:now [task]` - Set current task
|
|
100
|
+
- `/p:next` - Priority queue
|
|
101
|
+
- `/p:done` - Complete task
|
|
102
|
+
- `/p:ship <feature>` - Ship and celebrate
|
|
103
|
+
- `/p:bug <desc>` - Report bug
|
|
783
104
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
- `/p:help` - Interactive contextual guide (adapts to project state)
|
|
789
|
-
- `/p:ask "<what you want to do>"` - Conversational intent to action translator
|
|
790
|
-
- Natural language understanding
|
|
791
|
-
- Recommends command flow with explanations
|
|
792
|
-
- Works in any language
|
|
793
|
-
- Educational and interactive
|
|
794
|
-
- `/p:suggest` - Context-aware next steps suggestions
|
|
795
|
-
- Analyzes project state and momentum
|
|
796
|
-
- Detects urgencies and patterns
|
|
797
|
-
- Personalized recommendations
|
|
798
|
-
- Helps maintain momentum
|
|
799
|
-
- `/p:stuck <issue description>` - Get contextual help with problems
|
|
800
|
-
- `/p:analyze` - Analyze repository and sync tasks
|
|
801
|
-
- `/p:sync` - Sync project state and update workflow agents
|
|
802
|
-
- ⚠️ `/p:fix [error]` - Quick troubleshooting and automatic fixes
|
|
105
|
+
### Planning
|
|
106
|
+
- `/p:idea <text>` - Capture idea
|
|
107
|
+
- `/p:feature <desc>` - Add feature
|
|
108
|
+
- `/p:workflow` - Workflow status
|
|
803
109
|
|
|
804
|
-
|
|
110
|
+
### Progress
|
|
111
|
+
- `/p:recap` - Project overview
|
|
112
|
+
- `/p:progress [period]` - Metrics
|
|
113
|
+
- `/p:status` - KPI dashboard
|
|
805
114
|
|
|
806
|
-
|
|
115
|
+
### Help
|
|
116
|
+
- `/p:init` - Initialize project
|
|
117
|
+
- `/p:help` - Interactive guide
|
|
118
|
+
- `/p:ask <question>` - Intent translator
|
|
119
|
+
- `/p:suggest` - Smart recommendations
|
|
120
|
+
- `/p:analyze` - Analyze repository
|
|
121
|
+
- `/p:sync` - Sync state
|
|
807
122
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
-
|
|
811
|
-
|
|
812
|
-
**Total: 26 implemented, 30 total commands** (✅ +3 new: /p:help, /p:ask, /p:suggest)
|
|
813
|
-
**Status**: Check `core/command-registry.js` for current implementation status
|
|
814
|
-
|
|
815
|
-
## Agent Generation
|
|
816
|
-
|
|
817
|
-
Dynamic agent generation based on project analysis. YOU decide what specialists to generate.
|
|
818
|
-
|
|
819
|
-
**See `templates/agents/AGENTS.md` for complete reference** with examples and guidelines.
|
|
820
|
-
|
|
821
|
-
Use: `generator.generateDynamicAgent(name, config)` for any technology stack.
|
|
123
|
+
### Quality
|
|
124
|
+
- `/p:cleanup` - Clean up
|
|
125
|
+
- `/p:design` - System design
|
|
822
126
|
|
|
823
127
|
## Agentic Architecture
|
|
824
128
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
### Core Structure
|
|
828
|
-
|
|
829
|
-
```
|
|
830
|
-
core/
|
|
831
|
-
├── agentic/ # Agentic execution engine
|
|
832
|
-
│ ├── template-loader.js # Loads command templates
|
|
833
|
-
│ ├── context-builder.js # Builds project context
|
|
834
|
-
│ ├── prompt-builder.js # Generates prompts for Claude
|
|
835
|
-
│ ├── command-executor.js # Executes commands agentically
|
|
836
|
-
│ └── tool-registry.js # Maps allowed-tools to functions
|
|
837
|
-
├── commands.js # Agentic commands (306 lines, was 3103)
|
|
838
|
-
├── command-registry.js # Metadata only (no validation logic)
|
|
839
|
-
└── domain/
|
|
840
|
-
├── agent-generator.js # 100% agentic (119 lines, was 462)
|
|
841
|
-
└── analyzer.js # I/O helpers only (215 lines, was 600)
|
|
129
|
+
prjct-cli is template-driven. Claude reads templates and executes using tools.
|
|
842
130
|
|
|
843
|
-
|
|
844
|
-
├── commands/ # Command instructions for Claude
|
|
845
|
-
├── workflows/ # Workflow guides (not strict rules)
|
|
846
|
-
│ ├── ui.md
|
|
847
|
-
│ ├── api.md
|
|
848
|
-
│ ├── bug.md
|
|
849
|
-
│ ├── refactor.md
|
|
850
|
-
│ └── feature.md
|
|
851
|
-
└── analysis/ # Analysis instructions
|
|
852
|
-
└── analyze.md
|
|
131
|
+
### Flow
|
|
853
132
|
```
|
|
854
|
-
|
|
855
|
-
### How It Works
|
|
856
|
-
|
|
857
|
-
**Traditional (DETERMINISTIC)**:
|
|
858
|
-
|
|
859
|
-
```javascript
|
|
860
|
-
// Hardcoded logic with if/else
|
|
861
|
-
if (task.match(/^(add|implement)/)) {
|
|
862
|
-
branchType = 'feat'
|
|
863
|
-
} else if (task.match(/^(fix|bug)/)) {
|
|
864
|
-
branchType = 'fix'
|
|
865
|
-
}
|
|
866
|
-
// ... 20 more conditions
|
|
133
|
+
Template (MD) → Claude reads → Claude decides → Claude uses tools → Result
|
|
867
134
|
```
|
|
868
135
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
```javascript
|
|
872
|
-
// 1. Load template
|
|
873
|
-
const template = await templateLoader.load('branch')
|
|
874
|
-
|
|
875
|
-
// 2. Build context
|
|
876
|
-
const context = await contextBuilder.build(projectPath, { task })
|
|
877
|
-
|
|
878
|
-
// 3. Claude reads template and decides
|
|
879
|
-
// Template: "Analyze task description and generate semantic branch name.
|
|
880
|
-
// Decide based on intent, not regex patterns."
|
|
881
|
-
|
|
882
|
-
// 4. Claude executes using allowed-tools
|
|
883
|
-
// Result: Claude decides branch type based on understanding, not patterns
|
|
136
|
+
### Structure
|
|
884
137
|
```
|
|
138
|
+
core/agentic/
|
|
139
|
+
├── template-loader.js # Loads command templates
|
|
140
|
+
├── context-builder.js # Builds project context
|
|
141
|
+
├── prompt-builder.js # Generates prompts
|
|
142
|
+
├── command-executor.js # Executes commands
|
|
143
|
+
└── tool-registry.js # Maps tools
|
|
885
144
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
Templates (MD files)
|
|
890
|
-
↓
|
|
891
|
-
Claude reads + understands context
|
|
892
|
-
↓
|
|
893
|
-
Claude makes decisions (no if/else)
|
|
894
|
-
↓
|
|
895
|
-
Claude uses allowed-tools
|
|
896
|
-
↓
|
|
897
|
-
Claude generates/saves data
|
|
145
|
+
templates/commands/ # Command instructions
|
|
146
|
+
templates/workflows/ # Workflow guides
|
|
147
|
+
templates/analysis/ # Analysis instructions
|
|
898
148
|
```
|
|
899
149
|
|
|
900
|
-
### Key Differences
|
|
901
|
-
|
|
902
|
-
**Commands** (`core/commands.js`):
|
|
903
|
-
|
|
904
|
-
- **Before**: 3103 lines with nested if/else logic
|
|
905
|
-
- **After**: 306 lines with agentic execution (ZERO legacy inheritance)
|
|
906
|
-
- **Migrated**: now, done, next (fully agentic)
|
|
907
|
-
- **TODO**: All other commands will be migrated to template-driven execution
|
|
908
|
-
|
|
909
|
-
**Agent Generation** (`core/domain/agent-generator.js`):
|
|
910
|
-
|
|
911
|
-
- **Before**: 462 lines with generateFrontendContext, generateBackendContext, etc.
|
|
912
|
-
- **After**: 119 lines with only `generateDynamicAgent()`
|
|
913
|
-
- **Decisions**: Claude reads analysis and decides what agents to create
|
|
914
|
-
|
|
915
|
-
**Analyzer** (`core/domain/analyzer.js`):
|
|
916
|
-
|
|
917
|
-
- **Before**: 600 lines with regex detection and predetermined feature maps
|
|
918
|
-
- **After**: 215 lines with I/O helpers only
|
|
919
|
-
- **Analysis**: Claude reads files and decides what's relevant
|
|
920
|
-
|
|
921
|
-
**Workflows** (`templates/workflows/*.md`):
|
|
922
|
-
|
|
923
|
-
- **Before**: `workflow-rules.js` with strict JSON rules
|
|
924
|
-
- **After**: Markdown guides that Claude adapts to each project
|
|
925
|
-
- **Flexibility**: Claude skips/adds steps based on project capabilities
|
|
926
|
-
|
|
927
|
-
**Validation**:
|
|
928
|
-
|
|
929
|
-
- **Before**: `canExecute()` function with if/else logic
|
|
930
|
-
- **After**: Claude reads template validation section and decides
|
|
931
|
-
- **Example**: Template says "Requires: `core/now.md` has content" → Claude checks and decides
|
|
932
|
-
|
|
933
150
|
### Templates as Source of Truth
|
|
934
151
|
|
|
935
|
-
Templates define
|
|
152
|
+
Templates define what Claude should do:
|
|
936
153
|
|
|
937
154
|
```markdown
|
|
938
155
|
# /p:done
|
|
939
156
|
|
|
940
157
|
## Validation
|
|
941
|
-
|
|
942
158
|
- Requires: `core/now.md` has content
|
|
943
|
-
- Else: "Not working on anything. Use /p:now"
|
|
944
159
|
|
|
945
160
|
## Flow
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
3. Update: `progress/metrics.md`
|
|
161
|
+
1. Read `core/now.md` → calculate duration
|
|
162
|
+
2. Clear now.md
|
|
163
|
+
3. Update metrics
|
|
950
164
|
|
|
951
165
|
## Response
|
|
952
|
-
|
|
953
|
-
[Show options and next actions]
|
|
166
|
+
✅ {task} ({duration})
|
|
954
167
|
```
|
|
955
168
|
|
|
956
169
|
Claude reads this and:
|
|
170
|
+
1. Checks validation
|
|
171
|
+
2. Executes flow using tools
|
|
172
|
+
3. Generates response
|
|
173
|
+
4. Suggests next actions
|
|
957
174
|
|
|
958
|
-
|
|
959
|
-
2. Executes the flow using allowed-tools
|
|
960
|
-
3. Generates appropriate response
|
|
961
|
-
4. Decides next suggestions based on context
|
|
962
|
-
|
|
963
|
-
### Benefits
|
|
175
|
+
## Git Commit Format
|
|
964
176
|
|
|
965
|
-
|
|
966
|
-
2. ✅ **Templates are documentation** - Single source of truth
|
|
967
|
-
3. ✅ **Any stack works** - No predetermined patterns
|
|
968
|
-
4. ✅ **Easy to extend** - Just add/edit templates
|
|
969
|
-
5. ✅ **Adapts to context** - Claude reads project state and decides
|
|
970
|
-
6. ✅ **Maintainable** - Core code reduced by 84%
|
|
971
|
-
|
|
972
|
-
### Migration Status
|
|
973
|
-
|
|
974
|
-
**✅ Fully Migrated (ZERO legacy code)**:
|
|
975
|
-
|
|
976
|
-
- ✅ `core/agentic/` - Execution engine (5 files, ~517 lines)
|
|
977
|
-
- ✅ `agent-generator.js` - 100% agentic (119 lines, was 462)
|
|
978
|
-
- ✅ `analyzer.js` - I/O helpers only (215 lines, was 600)
|
|
979
|
-
- ✅ `commands.js` - No legacy inheritance (306 lines, was 3103)
|
|
980
|
-
- ✅ Templates: commands/, workflows/, analysis/
|
|
981
|
-
|
|
982
|
-
**Commands Status**:
|
|
983
|
-
|
|
984
|
-
- ✅ **Migrated**: /p:now, /p:done, /p:next (fully agentic)
|
|
985
|
-
- ⏳ **TODO**: All other commands (init, ship, bug, feature, etc.)
|
|
986
|
-
- 🗑️ **Deleted**: core/legacy/ (all deterministic code removed)
|
|
987
|
-
|
|
988
|
-
**Next Steps**: Migrate remaining commands to template-driven execution one by one.
|
|
989
|
-
|
|
990
|
-
## Git Commit Format (Universal Rule)
|
|
991
|
-
|
|
992
|
-
**ALL commits made by prjct MUST use this footer**:
|
|
177
|
+
**ALL commits by prjct MUST use this footer:**
|
|
993
178
|
|
|
994
179
|
```
|
|
995
180
|
🤖 Generated with [p/](https://www.prjct.app/)
|
|
996
181
|
Designed for [Claude](https://www.anthropic.com/claude)
|
|
997
182
|
```
|
|
998
183
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
-
|
|
1002
|
-
- Manual git commits via Claude
|
|
1003
|
-
- Any automated commits
|
|
184
|
+
**Never use:**
|
|
185
|
+
- "Generated with Claude Code"
|
|
186
|
+
- "Co-Authored-By: Claude"
|
|
1004
187
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
- ❌ "Generated with Claude Code"
|
|
1008
|
-
- ❌ "Co-Authored-By: Claude"
|
|
1009
|
-
|
|
1010
|
-
**Always use**:
|
|
1011
|
-
|
|
1012
|
-
- ✅ The prjct footer format above
|
|
1013
|
-
|
|
1014
|
-
## Initialization Process
|
|
1015
|
-
|
|
1016
|
-
When you execute `/p:init` in Claude Code:
|
|
1017
|
-
|
|
1018
|
-
1. Generate unique project ID from path hash
|
|
1019
|
-
2. Create global directory structure in `~/.prjct-cli/projects/{id}/` (including `agents/`)
|
|
1020
|
-
3. Create local config at `.prjct/prjct.config.json` with:
|
|
1021
|
-
- version
|
|
1022
|
-
- projectId
|
|
1023
|
-
- dataPath (pointing to global location)
|
|
1024
|
-
- author info (from GitHub CLI or git config)
|
|
1025
|
-
4. Initialize all markdown files with templates
|
|
1026
|
-
5. **Generate 6 base agents** (coordinator, ux, fe, be, qa, scribe)
|
|
1027
|
-
6. Log initialization to `memory/context.jsonl`
|
|
1028
|
-
|
|
1029
|
-
## MCP Integration
|
|
1030
|
-
|
|
1031
|
-
**Context7 MCP is ALWAYS enabled** - automatic library documentation and framework patterns.
|
|
1032
|
-
|
|
1033
|
-
The system integrates with these MCP servers:
|
|
1034
|
-
|
|
1035
|
-
- **Context7**: Official library documentation lookup (ALWAYS available)
|
|
1036
|
-
- Use for: React, Vue, Angular, Next.js, Express, any npm package
|
|
1037
|
-
- Auto-activates when importing libraries or asking about frameworks
|
|
1038
|
-
- Examples: "implement React hooks", "Next.js routing patterns", "Express middleware"
|
|
1039
|
-
|
|
1040
|
-
- **Filesystem**: Direct file manipulation (ALWAYS available)
|
|
1041
|
-
- **Memory**: Persistent decision storage (ALWAYS available)
|
|
1042
|
-
- **Sequential**: Deep reasoning for complex problems (ALWAYS available)
|
|
1043
|
-
|
|
1044
|
-
### Using Context7 Effectively
|
|
1045
|
-
|
|
1046
|
-
**When to use**:
|
|
1047
|
-
|
|
1048
|
-
- Implementing features with external libraries
|
|
1049
|
-
- Framework-specific questions and patterns
|
|
1050
|
-
- API documentation lookup
|
|
1051
|
-
- Best practices for any library
|
|
1052
|
-
|
|
1053
|
-
**How it works**:
|
|
1054
|
-
|
|
1055
|
-
- Automatically provides official docs when you import libraries
|
|
1056
|
-
- Returns curated, version-specific documentation
|
|
1057
|
-
- Includes code examples and implementation patterns
|
|
188
|
+
## Agent Generation
|
|
1058
189
|
|
|
1059
|
-
|
|
190
|
+
Dynamic agents based on project analysis.
|
|
1060
191
|
|
|
1061
|
-
|
|
192
|
+
See `templates/agents/AGENTS.md` for reference.
|
|
1062
193
|
|
|
1063
|
-
|
|
1064
|
-
2. Always read `.prjct/prjct.config.json` first to get project ID
|
|
1065
|
-
3. Construct paths to global data: `~/.prjct-cli/projects/{id}/...`
|
|
1066
|
-
4. Update relevant files atomically
|
|
1067
|
-
5. Return formatted responses with appropriate emojis
|
|
1068
|
-
6. Always suggest next actions to maintain momentum
|
|
1069
|
-
7. Log all actions to `memory/context.jsonl` with timestamp and author
|
|
194
|
+
Use: `generator.generateDynamicAgent(name, config)`
|
|
1070
195
|
|
|
1071
|
-
## Key
|
|
196
|
+
## Key Rules
|
|
1072
197
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
198
|
+
1. **Read files before editing** - Never assume structure
|
|
199
|
+
2. **Use system timestamps** - Never hardcode dates
|
|
200
|
+
3. **Follow template instructions** - Templates are source of truth
|
|
201
|
+
4. **Confirm before executing** - Always show plan first
|
|
202
|
+
5. **Log actions** - Append to memory/context.jsonl
|
|
203
|
+
6. **Suggest next actions** - Maintain user momentum
|