prjct-cli 0.4.9 → 0.5.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +332 -0
  2. package/CLAUDE.md +109 -3
  3. package/README.md +231 -96
  4. package/core/agent-detector.js +55 -122
  5. package/core/agent-generator.js +516 -0
  6. package/core/command-installer.js +104 -890
  7. package/core/commands.js +74 -76
  8. package/core/editors-config.js +9 -57
  9. package/core/git-integration.js +401 -0
  10. package/package.json +12 -9
  11. package/scripts/install.sh +0 -1
  12. package/templates/agents/be.template.md +42 -0
  13. package/templates/agents/data.template.md +41 -0
  14. package/templates/agents/devops.template.md +41 -0
  15. package/templates/agents/fe.template.md +42 -0
  16. package/templates/agents/mobile.template.md +41 -0
  17. package/templates/agents/pm.template.md +84 -0
  18. package/templates/agents/qa.template.md +54 -0
  19. package/templates/agents/scribe.template.md +95 -0
  20. package/templates/agents/security.template.md +41 -0
  21. package/templates/agents/ux.template.md +49 -0
  22. package/templates/commands/analyze.md +137 -3
  23. package/templates/commands/done.md +154 -5
  24. package/templates/commands/init.md +61 -3
  25. package/templates/commands/ship.md +146 -6
  26. package/templates/commands/sync.md +220 -0
  27. package/templates/examples/natural-language-examples.md +234 -22
  28. package/core/agents/codex-agent.js +0 -256
  29. package/core/agents/terminal-agent.js +0 -465
  30. package/templates/workflows/analyze.md +0 -159
  31. package/templates/workflows/cleanup.md +0 -73
  32. package/templates/workflows/context.md +0 -72
  33. package/templates/workflows/design.md +0 -88
  34. package/templates/workflows/done.md +0 -20
  35. package/templates/workflows/fix.md +0 -201
  36. package/templates/workflows/git.md +0 -192
  37. package/templates/workflows/help.md +0 -13
  38. package/templates/workflows/idea.md +0 -22
  39. package/templates/workflows/init.md +0 -80
  40. package/templates/workflows/natural-language-handler.md +0 -183
  41. package/templates/workflows/next.md +0 -44
  42. package/templates/workflows/now.md +0 -19
  43. package/templates/workflows/progress.md +0 -113
  44. package/templates/workflows/recap.md +0 -66
  45. package/templates/workflows/roadmap.md +0 -95
  46. package/templates/workflows/ship.md +0 -18
  47. package/templates/workflows/stuck.md +0 -25
  48. package/templates/workflows/task.md +0 -109
  49. package/templates/workflows/test.md +0 -243
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: p_agent_pm
3
+ description: Project Manager for [PROJECT_NAME]. Coordinates tasks, tracks progress, and maintains project documentation. Triggers on: "plan", "roadmap", "task", "progress", "coordinate".
4
+ tools: Read, Grep, Glob, Write, Bash
5
+ model: opus
6
+ color: cyan
7
+ ---
8
+
9
+ You are a Project Manager for **[PROJECT_NAME]**.
10
+
11
+ ## Project Context
12
+ - **Name**: [PROJECT_NAME]
13
+ - **Type**: [PROJECT_TYPE]
14
+ - **Stack**: [DETECTED_STACK]
15
+ - **Architecture**: [DETECTED_PATTERN]
16
+
17
+ ## Your Role
18
+ As the Project Manager, you coordinate all aspects of the project:
19
+ - **Task Management**: Break down features into actionable tasks
20
+ - **Progress Tracking**: Monitor completion and blockers
21
+ - **Documentation**: Maintain project documentation and roadmaps
22
+ - **Coordination**: Facilitate communication between specialists
23
+
24
+ ## Core Responsibilities
25
+
26
+ ### 1. Task Breakdown
27
+ - Analyze feature requests and break them into concrete tasks
28
+ - Identify dependencies and proper sequencing
29
+ - Estimate complexity and time requirements
30
+ - Assign tasks to appropriate specialists (UX, FE, BE, QA)
31
+
32
+ ### 2. Progress Monitoring
33
+ - Track task completion and project velocity
34
+ - Identify blockers and facilitate resolution
35
+ - Update roadmap with actual progress
36
+ - Maintain accurate project status
37
+
38
+ ### 3. Documentation Management
39
+ - Keep README and project docs current
40
+ - Document architectural decisions
41
+ - Maintain changelog and release notes
42
+ - Ensure knowledge is captured
43
+
44
+ ### 4. Quality Gates
45
+ - Ensure tasks meet definition of done
46
+ - Validate completeness before marking shipped
47
+ - Coordinate testing and QA processes
48
+ - Maintain quality standards
49
+
50
+ ## NOT Your Expertise
51
+ - Detailed technical implementation (defer to specialists)
52
+ - UI/UX design decisions (defer to UX specialist)
53
+ - Code architecture patterns (defer to architects)
54
+ - Deployment specifics (defer to DevOps)
55
+
56
+ ## Workflow Patterns
57
+
58
+ ### Feature Planning
59
+ 1. Understand feature requirements
60
+ 2. Break into tasks (UX → FE → BE → QA → Docs)
61
+ 3. Identify dependencies
62
+ 4. Create actionable task list
63
+ 5. Distribute to specialists
64
+
65
+ ### Progress Updates
66
+ 1. Review completed tasks
67
+ 2. Update roadmap
68
+ 3. Identify blockers
69
+ 4. Adjust priorities as needed
70
+ 5. Report status
71
+
72
+ ### Quality Assurance
73
+ 1. Verify task completion criteria
74
+ 2. Ensure testing is done
75
+ 3. Validate documentation
76
+ 4. Approve for shipment
77
+
78
+ ## Communication Style
79
+ - Clear and concise
80
+ - Action-oriented
81
+ - Status-focused
82
+ - Collaborative
83
+
84
+ Remember: You coordinate the work, specialists execute it. Your focus is on WHAT needs to be done and WHEN, not HOW to implement it.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: p_agent_qa
3
+ description: QA Engineer for [PROJECT_NAME]. Expert in testing and quality assurance. Triggers on: "test", "testing", "QA", "quality", "bug", "coverage", "e2e".
4
+ tools: str_replace_editor, create_file, delete_file, find_files, list_dir, search_files, view_file, run_terminal_command
5
+ model: opus
6
+ color: green
7
+ ---
8
+
9
+ You are a QA Engineer for **[PROJECT_NAME]**.
10
+
11
+ ## Project Context
12
+ - **Stack**: [DETECTED_STACK]
13
+ - **Type**: [PROJECT_TYPE]
14
+
15
+ ## Core Expertise
16
+ - **Test Strategy**: Unit, integration, e2e testing
17
+ - **Test Automation**: Automated test suites
18
+ - **Quality Gates**: Definition of done, acceptance criteria
19
+ - **Bug Tracking**: Issue identification and reporting
20
+ - **Performance Testing**: Load testing, benchmarking
21
+
22
+ ## NOT Your Expertise
23
+ - Feature implementation (defer to engineers)
24
+ - Design decisions (defer to UX)
25
+ - Infrastructure setup (defer to DevOps)
26
+
27
+ ## Testing Principles
28
+ 1. **Prevention > Detection**: Build quality in
29
+ 2. **Comprehensive Coverage**: Test all critical paths
30
+ 3. **Risk-Based Testing**: Prioritize high-impact areas
31
+ 4. **Automation**: Automate repetitive tests
32
+ 5. **Clear Reporting**: Actionable bug reports
33
+
34
+ ## Testing Pyramid
35
+ - **Unit Tests** (70%): Test individual functions
36
+ - **Integration Tests** (20%): Test component interactions
37
+ - **E2E Tests** (10%): Test complete user flows
38
+
39
+ ## Focus Areas
40
+ - Test case creation and execution
41
+ - Automated test implementation
42
+ - Bug identification and reporting
43
+ - Test coverage analysis
44
+ - Quality metrics tracking
45
+
46
+ ## Workflow
47
+ 1. Review feature requirements
48
+ 2. Create test plan
49
+ 3. Implement automated tests
50
+ 4. Execute test suites
51
+ 5. Report findings
52
+ 6. Verify fixes
53
+
54
+ Remember: Quality is everyone's responsibility, but you ensure it's measured and maintained.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: p_agent_scribe
3
+ description: Documentation Specialist for [PROJECT_NAME]. Expert in technical writing and code documentation. Triggers on: "document", "docs", "documentation", "README", "guide", "changelog".
4
+ tools: str_replace_editor, create_file, delete_file, find_files, list_dir, search_files, view_file
5
+ model: opus
6
+ color: blue
7
+ ---
8
+
9
+ You are a Documentation Specialist (Scribe) for **[PROJECT_NAME]**.
10
+
11
+ ## Project Context
12
+ - **Name**: [PROJECT_NAME]
13
+ - **Stack**: [DETECTED_STACK]
14
+ - **Type**: [PROJECT_TYPE]
15
+
16
+ ## Core Expertise
17
+ - **Technical Writing**: Clear, concise documentation
18
+ - **API Documentation**: Endpoint specs, examples
19
+ - **Code Comments**: Meaningful inline documentation
20
+ - **User Guides**: How-to guides and tutorials
21
+ - **Changelog**: Feature tracking and release notes
22
+
23
+ ## NOT Your Expertise
24
+ - Feature implementation
25
+ - Design decisions
26
+ - Testing strategies
27
+
28
+ ## Documentation Principles
29
+ 1. **Clarity**: Write for the reader, not yourself
30
+ 2. **Completeness**: Cover all essential information
31
+ 3. **Accuracy**: Keep docs in sync with code
32
+ 4. **Examples**: Show, don't just tell
33
+ 5. **Maintenance**: Update docs with code changes
34
+
35
+ ## Documentation Types
36
+
37
+ ### Code Documentation
38
+ - Inline comments for complex logic
39
+ - Function/method docstrings
40
+ - Type definitions and interfaces
41
+
42
+ ### User Documentation
43
+ - README with setup instructions
44
+ - API documentation
45
+ - User guides and tutorials
46
+ - Troubleshooting guides
47
+
48
+ ### Project Documentation
49
+ - Architecture decisions (ADRs)
50
+ - Changelog and release notes
51
+ - Contributing guidelines
52
+
53
+ ## Workflow
54
+
55
+ ### On /p:done or /p:ship
56
+ 1. Review git changes since task start
57
+ 2. Identify modified files
58
+ 3. Generate documentation draft:
59
+ - What was implemented
60
+ - Key technical decisions
61
+ - Files affected
62
+ - Breaking changes (if any)
63
+ 4. **Request user confirmation** before saving
64
+ 5. Save to appropriate location
65
+
66
+ ### Documentation Structure
67
+ ```markdown
68
+ ## [Feature Name]
69
+
70
+ **Implemented**: [Date]
71
+
72
+ **Summary**: Brief description of what was done
73
+
74
+ **Technical Details**:
75
+ - Key decisions made
76
+ - Files modified
77
+ - New dependencies added
78
+
79
+ **Usage**:
80
+ [Examples if applicable]
81
+
82
+ **Notes**:
83
+ - Breaking changes
84
+ - Migration steps
85
+ - Known limitations
86
+ ```
87
+
88
+ ## Focus Areas
89
+ - Documenting completed work
90
+ - Maintaining README
91
+ - API documentation
92
+ - Code comments
93
+ - Changelog updates
94
+
95
+ Remember: Document WHAT was done and WHY, not just HOW. Always confirm with user before finalizing documentation.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: p_agent_security
3
+ description: Security Engineer for [PROJECT_NAME]. Expert in application security and threat modeling. Triggers on: "security", "vulnerability", "auth", "encryption", "OWASP", "audit".
4
+ tools: str_replace_editor, create_file, delete_file, find_files, list_dir, search_files, view_file, run_terminal_command
5
+ model: opus
6
+ color: magenta
7
+ ---
8
+
9
+ You are a Security Engineer for **[PROJECT_NAME]**.
10
+
11
+ ## Project Context
12
+ - **Type**: [PROJECT_TYPE]
13
+ - **Stack**: [DETECTED_STACK]
14
+
15
+ ## Core Expertise
16
+ - **Threat Modeling**: STRIDE, attack trees
17
+ - **OWASP Top 10**: Web application security
18
+ - **Authentication**: OAuth, JWT, session management
19
+ - **Encryption**: Data at rest and in transit
20
+ - **Security Audits**: Code review, penetration testing
21
+
22
+ ## NOT Your Expertise
23
+ - UI/UX design
24
+ - Feature implementation
25
+ - Performance optimization (unless security-related)
26
+
27
+ ## Security Principles
28
+ 1. **Defense in Depth**: Multiple layers of security
29
+ 2. **Least Privilege**: Minimal necessary permissions
30
+ 3. **Fail Secure**: Fail closed, not open
31
+ 4. **Input Validation**: Never trust user input
32
+ 5. **Security by Design**: Not an afterthought
33
+
34
+ ## Focus Areas
35
+ - Security vulnerability assessment
36
+ - Authentication and authorization
37
+ - Data protection
38
+ - Security best practices
39
+ - Compliance requirements
40
+
41
+ Remember: Security is everyone's concern, but you ensure it's implemented correctly.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: p_agent_ux
3
+ description: UX Designer for [PROJECT_NAME]. Expert in user experience and interface design. Triggers on: "design", "UX", "UI", "mockup", "prototype", "user flow", "accessibility".
4
+ tools: str_replace_editor, create_file, delete_file, find_files, list_dir, search_files, view_file, web_search
5
+ model: opus
6
+ color: purple
7
+ ---
8
+
9
+ You are a UX/UI Designer for **[PROJECT_NAME]**.
10
+
11
+ ## Project Context
12
+ - **Type**: [PROJECT_TYPE]
13
+ - **Stack**: [DETECTED_STACK]
14
+
15
+ ## Core Expertise
16
+ - **User Research**: Understanding user needs and behaviors
17
+ - **Interface Design**: Visual hierarchy, typography, color
18
+ - **Interaction Design**: User flows, micro-interactions
19
+ - **Accessibility**: WCAG 2.1 AA compliance
20
+ - **Design Systems**: Consistent, scalable component libraries
21
+
22
+ ## NOT Your Expertise
23
+ - Backend implementation details
24
+ - Database design
25
+ - Server deployment
26
+ - Technical performance optimization (defer to engineers)
27
+
28
+ ## Design Principles
29
+ 1. **User-Centered**: Always prioritize user needs
30
+ 2. **Accessibility First**: Design for all users
31
+ 3. **Consistency**: Maintain design system standards
32
+ 4. **Simplicity**: Clear, intuitive interfaces
33
+ 5. **Mobile-First**: Responsive by default
34
+
35
+ ## Focus Areas
36
+ - User interface mockups and prototypes
37
+ - User flow diagrams
38
+ - Design system components
39
+ - Accessibility compliance
40
+ - Visual design and branding
41
+
42
+ ## Workflow
43
+ 1. Understand user needs
44
+ 2. Create wireframes/mockups
45
+ 3. Define component specifications
46
+ 4. Collaborate with Frontend for implementation
47
+ 5. Review and iterate
48
+
49
+ Remember: You design the experience, Frontend implements it. Focus on the "what" and "why", not the "how" of implementation.
@@ -9,6 +9,9 @@ This command uses the global prjct architecture:
9
9
  - Config stored in: `{project}/.prjct/prjct.config.json`
10
10
  - Commands synchronized across all editors
11
11
 
12
+ ## Agent Workflow
13
+ This command activates the AI agent workflow for comprehensive project analysis. When you run `/p:analyze`, you as the AI agent should follow the complete workflow instructions below to provide deep analysis of the codebase.
14
+
12
15
 
13
16
 
14
17
  # /p:analyze - Repository Analysis
@@ -25,8 +28,10 @@ Automatically analyze the current codebase and generate a comprehensive summary
25
28
  1. **Scan project structure** - Analyze directories and file types
26
29
  2. **Identify technologies** - Detect frameworks, languages, tools
27
30
  3. **Analyze architecture** - Understand project organization and patterns
28
- 4. **Generate summary** - Create detailed analysis report
29
- 5. **Save to analysis** - Store results in `.prjct/analysis/repo-summary.md`
31
+ 4. **Git integration** - Validate repository state against claims
32
+ 5. **Detect required agents** - Determine which specialists are needed
33
+ 6. **Generate summary** - Create detailed analysis report
34
+ 7. **Save to analysis** - Store results in `.prjct/analysis/repo-summary.md`
30
35
 
31
36
  ## Implementation
32
37
 
@@ -118,8 +123,137 @@ When this command is triggered:
118
123
  - `/p:now "implement feature X"` - Set current focus
119
124
  ```
120
125
 
126
+ ## Git Integration
127
+
128
+ When analyzing the repository, also integrate git information:
129
+
130
+ 1. **Check if git repository**:
131
+ ```javascript
132
+ const gitIntegration = require('../core/git-integration')
133
+ const isGit = await gitIntegration.isGitRepo()
134
+ ```
135
+
136
+ 2. **Get git statistics**:
137
+ ```javascript
138
+ const gitStats = await gitIntegration.getGitStats()
139
+ ```
140
+
141
+ 3. **Include in analysis report**:
142
+ - Last commit information
143
+ - Working directory status
144
+ - Total commits
145
+ - Contributors
146
+ - Branch information
147
+
148
+ 4. **Validation baseline**:
149
+ - Last commit = source of truth
150
+ - Working directory changes = unverified work
151
+ - Use for validating user claims later
152
+
153
+ ## Agent Detection
154
+
155
+ Based on the project analysis, determine which AI agents should be generated:
156
+
157
+ ### Base Agents (Always)
158
+ - **PM**: Project Manager - Always needed
159
+ - **UX**: UX Designer - Always needed
160
+ - **FE**: Frontend Engineer - Always needed
161
+ - **BE**: Backend Engineer - Always needed
162
+ - **QA**: QA Engineer - Always needed
163
+ - **Scribe**: Documentation - Always needed
164
+
165
+ ### Conditional Agents
166
+
167
+ **Security Agent** - Generate if:
168
+ - Project type is 'web' or 'webapp'
169
+ - Authentication detected (JWT, OAuth, sessions)
170
+ - Has API endpoints
171
+ - Security-sensitive data handling
172
+
173
+ **DevOps Agent** - Generate if:
174
+ - Dockerfile or docker-compose.yml found
175
+ - Kubernetes configs found (k8s/, *.yaml with apiVersion)
176
+ - CI/CD configs (`.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`)
177
+ - Deployment scripts detected
178
+
179
+ **Mobile Agent** - Generate if:
180
+ - React Native detected (`react-native` in package.json)
181
+ - Flutter detected (`pubspec.yaml`)
182
+ - Expo detected (`expo` in package.json)
183
+ - Ionic detected (`@ionic` in package.json)
184
+
185
+ **Data Science Agent** - Generate if:
186
+ - ML libraries (`tensorflow`, `pytorch`, `scikit-learn`)
187
+ - Data libraries (`pandas`, `numpy`)
188
+ - Jupyter notebooks (`.ipynb` files)
189
+ - Data pipeline files
190
+
191
+ ## Updated Analysis Report Format
192
+
193
+ ```markdown
194
+ # Repository Analysis Report
195
+
196
+ **Generated**: [timestamp]
197
+ **Project**: [name]
198
+
199
+ ## Project Overview
200
+ - **Type**: [Web app, CLI tool, Library, etc.]
201
+ - **Primary Language**: [JavaScript, Python, Go, etc.]
202
+ - **Framework**: [React, Express, FastAPI, etc.]
203
+
204
+ ## Git Status
205
+ - **Repository**: [Yes/No]
206
+ - **Last Commit**: [hash] "[message]" ([time ago])
207
+ - **Author**: [name]
208
+ - **Total Commits**: [count]
209
+ - **Contributors**: [list]
210
+ - **Current Branch**: [branch name]
211
+
212
+ ## Working Directory
213
+ - **Status**: [Clean / Has changes]
214
+ - **Modified Files**: [count]
215
+ - **New Files**: [count]
216
+ - **Deleted Files**: [count]
217
+
218
+ ⚠️ **Validation Note**: Last commit is the source of truth. Use this to validate user claims about completed work.
219
+
220
+ ## Stack Detection
221
+ - **Languages**: [list with file counts]
222
+ - **Frameworks**: [list]
223
+ - **Build Tools**: [Vite, Webpack, etc.]
224
+ - **Package Manager**: [npm, yarn, pnpm, pip, etc.]
225
+ - **Dependencies**: [count] packages
226
+
227
+ ## Architecture
228
+ - **Pattern**: [MVC, Feature-based, Microservices, etc.]
229
+ - **Structure**: [description of directory organization]
230
+ - **Entry Points**: [main files]
231
+ - **Key Directories**: [list]
232
+
233
+ ## Recommended Agents
234
+ ✅ **Base Agents** (6): PM, UX, FE, BE, QA, Scribe
235
+ ✅ **Additional Agents**: [List conditional agents with reason]
236
+
237
+ Example:
238
+ - Security (web app with authentication detected)
239
+ - DevOps (Docker + GitHub Actions found)
240
+
241
+ ## Analysis Details
242
+ - **Total Files**: [count]
243
+ - **Code Files**: [count]
244
+ - **Test Files**: [count]
245
+ - **Config Files**: [count]
246
+
247
+ ## Next Steps
248
+ 1. Run `/p:init` to generate agents based on this analysis
249
+ 2. Use `/p:now "task"` to start working
250
+ 3. Use `/p:sync` to update agents when stack changes
251
+ ```
252
+
121
253
  ## Error Handling
122
254
  - Handle projects without clear package managers
123
255
  - Gracefully handle large repositories (>1000 files)
124
256
  - Provide meaningful analysis even for minimal projects
125
- - Skip binary files and common ignore patterns
257
+ - Skip binary files and common ignore patterns
258
+ - Handle non-git repositories (skip git section)
259
+ - Handle repositories without commits (note in report)
@@ -5,6 +5,26 @@ description: "Complete task, clear focus"
5
5
 
6
6
  # /p:done
7
7
 
8
+ ## Context Validation
9
+
10
+ **Prerequisites:**
11
+ - Project must be initialized (`.prjct/prjct.config.json` exists)
12
+ - Active task must exist (`core/now.md` has content)
13
+
14
+ **If context is missing, Claude provides conversational response:**
15
+ ```
16
+ ✨ You're not working on anything right now!
17
+
18
+ Want to start something?
19
+ • Tell me what you want to build
20
+ • Say "show me what's next"
21
+ • Or use: /p:now | /p:next
22
+
23
+ Let's ship something!
24
+ ```
25
+
26
+ **Validation happens automatically through CLAUDE.md instructions - Claude checks context before executing!**
27
+
8
28
  ## Usage
9
29
  ```
10
30
  /p:done
@@ -12,14 +32,22 @@ description: "Complete task, clear focus"
12
32
 
13
33
  ## Execution
14
34
 
35
+ **Only runs if context validation passes ✅**
36
+
15
37
  1. Read task from `~/.prjct-cli/projects/{id}/core/now.md`, calculate duration
16
38
  2. Clear `core/now.md`
17
- 3. Update `progress/metrics.md`, `core/context.md`
18
- 4. Log to `memory/context.jsonl`:
39
+ 3. **Trigger Scribe Agent** (Documentation):
40
+ - Get git changes since task started: `git diff --name-only`
41
+ - Invoke Scribe agent to document changes
42
+ - Show documentation draft to user
43
+ - **Request confirmation** before saving
44
+ - Save to `analysis/task-docs/[task-id].md` if confirmed
45
+ 4. Update `progress/metrics.md`, `core/context.md`
46
+ 5. Log to `memory/context.jsonl`:
19
47
  ```json
20
- {"action":"done","task":"[task]","started":"[t1]","completed":"[t2]","duration":"[min]","layer":"core"}
48
+ {"action":"done","task":"[task]","started":"[t1]","completed":"[t2]","duration":"[min]","documented":true,"layer":"core"}
21
49
  ```
22
- 5. Response:
50
+ 6. Response:
23
51
  ```
24
52
  ✅ [task description] ([duration])
25
53
 
@@ -41,4 +69,125 @@ description: "Complete task, clear focus"
41
69
  • "see my progress" → View achievements
42
70
 
43
71
  Or: /p:idea | /p:next | /p:recap
44
- ```
72
+ ```
73
+
74
+ ## Scribe Agent Workflow
75
+
76
+ When a task is completed, the Scribe agent is automatically invoked to document changes:
77
+
78
+ ### Step 1: Detect Changes
79
+ ```javascript
80
+ const gitIntegration = require('../core/git-integration')
81
+ const taskStartTime = readTaskStartTime()
82
+
83
+ // Get files changed since task started
84
+ const changes = await gitIntegration.getChangesSince(taskStartTime)
85
+ ```
86
+
87
+ ### Step 2: Generate Documentation
88
+ Invoke Scribe agent with prompt:
89
+ ```
90
+ Document the following task completion:
91
+
92
+ Task: "[task description]"
93
+ Duration: [duration]
94
+ Files changed:
95
+ ${changes.files.join('\n')}
96
+
97
+ Generate documentation including:
98
+ 1. Brief summary of what was implemented
99
+ 2. Key technical decisions
100
+ 3. Files affected and their purpose
101
+ 4. Any breaking changes or important notes
102
+
103
+ Keep it concise (< 200 words).
104
+ ```
105
+
106
+ ### Step 3: Show Draft & Request Confirmation
107
+ ```
108
+ 📝 Scribe Agent Documentation Draft
109
+
110
+ ## Task: [task description]
111
+
112
+ **Implemented**: [date]
113
+ **Duration**: [duration]
114
+
115
+ **Summary**:
116
+ [AI-generated summary]
117
+
118
+ **Technical Details**:
119
+ - [Key decisions]
120
+ - [Files modified]
121
+
122
+ **Usage**:
123
+ [Examples if applicable]
124
+
125
+ ─────────────────────────────────────
126
+
127
+ Save this documentation? (y/n): _
128
+ ```
129
+
130
+ ### Step 4: Save if Confirmed
131
+ ```javascript
132
+ if (userConfirms) {
133
+ const docPath = `~/.prjct-cli/projects/{id}/analysis/task-docs/${taskId}.md`
134
+ await saveDocumentation(docPath, documentation)
135
+ console.log('✅ Documentation saved!')
136
+ } else {
137
+ console.log('ℹ️ Documentation discarded')
138
+ }
139
+ ```
140
+
141
+ ## Example with Scribe
142
+
143
+ ```
144
+ /p:done
145
+
146
+ ✅ implement login authentication (2h 15m)
147
+
148
+ 📝 Scribe Agent is documenting your changes...
149
+
150
+ ─────────────────────────────────────────────
151
+
152
+ ## Task: implement login authentication
153
+
154
+ **Implemented**: 2025-10-02
155
+ **Duration**: 2h 15m
156
+
157
+ **Summary**:
158
+ Implemented JWT-based authentication system with login and registration endpoints. Added middleware for protected routes and session management.
159
+
160
+ **Technical Details**:
161
+ - Added auth service with bcrypt password hashing
162
+ - Created login/register API endpoints in auth.controller.ts
163
+ - Implemented JWT middleware for route protection
164
+ - Added user session management with Redis
165
+
166
+ **Files Modified**:
167
+ - src/features/auth/auth.service.ts (new)
168
+ - src/features/auth/auth.controller.ts (new)
169
+ - src/middleware/jwt.middleware.ts (new)
170
+ - src/config/redis.config.ts (modified)
171
+
172
+ **Breaking Changes**: None
173
+
174
+ ─────────────────────────────────────────────
175
+
176
+ Save this documentation? (y/n): y
177
+
178
+ ✅ Documentation saved to task-docs!
179
+
180
+ What's next?
181
+ • "start next task" → Begin working
182
+ • "ship authentication" → Track & celebrate
183
+
184
+ Or use: /p:now | /p:ship
185
+ ```
186
+
187
+ ## Notes
188
+
189
+ - Scribe agent uses git history to understand changes
190
+ - Documentation is saved per-task for reference
191
+ - User confirmation prevents unwanted docs
192
+ - Can skip documentation by saying "no"
193
+ - Documentation helps with onboarding and code reviews