prjct-cli 0.13.2 → 0.15.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.
Files changed (193) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/bin/prjct +10 -13
  3. package/core/agentic/memory-system/semantic-memories.ts +2 -1
  4. package/core/agentic/plan-mode/plan-mode.ts +2 -1
  5. package/core/agentic/prompt-builder.ts +22 -43
  6. package/core/agentic/services.ts +5 -5
  7. package/core/agentic/smart-context.ts +7 -2
  8. package/core/command-registry/core-commands.ts +54 -29
  9. package/core/command-registry/optional-commands.ts +64 -0
  10. package/core/command-registry/setup-commands.ts +18 -3
  11. package/core/commands/analysis.ts +21 -68
  12. package/core/commands/analytics.ts +247 -213
  13. package/core/commands/base.ts +1 -1
  14. package/core/commands/index.ts +41 -36
  15. package/core/commands/maintenance.ts +300 -31
  16. package/core/commands/planning.ts +233 -22
  17. package/core/commands/setup.ts +3 -8
  18. package/core/commands/shipping.ts +14 -18
  19. package/core/commands/types.ts +8 -6
  20. package/core/commands/workflow.ts +105 -100
  21. package/core/context/generator.ts +317 -0
  22. package/core/context-sync.ts +7 -350
  23. package/core/data/index.ts +13 -32
  24. package/core/data/md-ideas-manager.ts +155 -0
  25. package/core/data/md-queue-manager.ts +4 -3
  26. package/core/data/md-shipped-manager.ts +90 -0
  27. package/core/data/md-state-manager.ts +11 -7
  28. package/core/domain/agent-generator.ts +23 -63
  29. package/core/events/index.ts +143 -0
  30. package/core/index.ts +17 -14
  31. package/core/infrastructure/capability-installer.ts +13 -149
  32. package/core/infrastructure/migrator/project-scanner.ts +2 -1
  33. package/core/infrastructure/path-manager.ts +4 -6
  34. package/core/infrastructure/setup.ts +3 -0
  35. package/core/infrastructure/uuid-migration.ts +750 -0
  36. package/core/outcomes/recorder.ts +2 -1
  37. package/core/plugin/loader.ts +4 -7
  38. package/core/plugin/registry.ts +3 -3
  39. package/core/schemas/index.ts +23 -25
  40. package/core/schemas/state.ts +1 -0
  41. package/core/serializers/ideas-serializer.ts +187 -0
  42. package/core/serializers/index.ts +16 -0
  43. package/core/serializers/shipped-serializer.ts +108 -0
  44. package/core/session/utils.ts +3 -9
  45. package/core/storage/ideas-storage.ts +273 -0
  46. package/core/storage/index.ts +204 -0
  47. package/core/storage/queue-storage.ts +297 -0
  48. package/core/storage/shipped-storage.ts +223 -0
  49. package/core/storage/state-storage.ts +235 -0
  50. package/core/storage/storage-manager.ts +175 -0
  51. package/package.json +1 -1
  52. package/packages/web/app/api/projects/[id]/momentum/route.ts +257 -0
  53. package/packages/web/app/api/sessions/current/route.ts +132 -0
  54. package/packages/web/app/api/sessions/history/route.ts +96 -14
  55. package/packages/web/app/globals.css +5 -0
  56. package/packages/web/app/layout.tsx +2 -0
  57. package/packages/web/app/project/[id]/code/layout.tsx +18 -0
  58. package/packages/web/app/project/[id]/code/page.tsx +408 -0
  59. package/packages/web/app/project/[id]/page.tsx +359 -389
  60. package/packages/web/app/project/[id]/reports/page.tsx +59 -0
  61. package/packages/web/app/project/[id]/reports/print/page.tsx +58 -0
  62. package/packages/web/components/ActivityTimeline/ActivityTimeline.tsx +0 -1
  63. package/packages/web/components/AgentsCard/AgentsCard.tsx +64 -34
  64. package/packages/web/components/AgentsCard/AgentsCard.types.ts +1 -0
  65. package/packages/web/components/AppSidebar/AppSidebar.tsx +135 -11
  66. package/packages/web/components/BentoCard/BentoCard.constants.ts +3 -3
  67. package/packages/web/components/BentoCard/BentoCard.tsx +2 -1
  68. package/packages/web/components/BentoGrid/BentoGrid.tsx +2 -2
  69. package/packages/web/components/BlockersCard/BlockersCard.tsx +65 -57
  70. package/packages/web/components/BlockersCard/BlockersCard.types.ts +1 -0
  71. package/packages/web/components/CommandBar/CommandBar.tsx +67 -0
  72. package/packages/web/components/CommandBar/index.ts +1 -0
  73. package/packages/web/components/DashboardContent/DashboardContent.tsx +35 -5
  74. package/packages/web/components/DateGroup/DateGroup.tsx +1 -1
  75. package/packages/web/components/EmptyState/EmptyState.tsx +39 -21
  76. package/packages/web/components/EmptyState/EmptyState.types.ts +1 -0
  77. package/packages/web/components/EventRow/EventRow.tsx +4 -4
  78. package/packages/web/components/EventRow/EventRow.utils.ts +3 -3
  79. package/packages/web/components/HeroSection/HeroSection.tsx +52 -15
  80. package/packages/web/components/HeroSection/HeroSection.types.ts +4 -4
  81. package/packages/web/components/HeroSection/HeroSection.utils.ts +7 -3
  82. package/packages/web/components/IdeasCard/IdeasCard.tsx +94 -27
  83. package/packages/web/components/IdeasCard/IdeasCard.types.ts +1 -0
  84. package/packages/web/components/MasonryGrid/MasonryGrid.tsx +18 -0
  85. package/packages/web/components/MasonryGrid/index.ts +1 -0
  86. package/packages/web/components/MomentumWidget/MomentumWidget.tsx +119 -0
  87. package/packages/web/components/MomentumWidget/MomentumWidget.types.ts +16 -0
  88. package/packages/web/components/MomentumWidget/index.ts +2 -0
  89. package/packages/web/components/NowCard/NowCard.tsx +81 -56
  90. package/packages/web/components/NowCard/NowCard.types.ts +1 -0
  91. package/packages/web/components/PageHeader/PageHeader.tsx +24 -0
  92. package/packages/web/components/PageHeader/index.ts +1 -0
  93. package/packages/web/components/ProgressRing/ProgressRing.constants.ts +2 -2
  94. package/packages/web/components/ProjectAvatar/ProjectAvatar.tsx +2 -2
  95. package/packages/web/components/ProjectColorDot/ProjectColorDot.tsx +37 -0
  96. package/packages/web/components/ProjectColorDot/index.ts +1 -0
  97. package/packages/web/components/ProjectSelectorModal/ProjectSelectorModal.tsx +104 -0
  98. package/packages/web/components/ProjectSelectorModal/index.ts +1 -0
  99. package/packages/web/components/Providers/Providers.tsx +4 -1
  100. package/packages/web/components/QueueCard/QueueCard.tsx +78 -25
  101. package/packages/web/components/QueueCard/QueueCard.types.ts +1 -0
  102. package/packages/web/components/QueueCard/QueueCard.utils.ts +3 -3
  103. package/packages/web/components/RecoverCard/RecoverCard.tsx +72 -0
  104. package/packages/web/components/RecoverCard/RecoverCard.types.ts +16 -0
  105. package/packages/web/components/RecoverCard/index.ts +2 -0
  106. package/packages/web/components/RoadmapCard/RoadmapCard.tsx +101 -33
  107. package/packages/web/components/RoadmapCard/RoadmapCard.types.ts +1 -0
  108. package/packages/web/components/ShipsCard/ShipsCard.tsx +71 -28
  109. package/packages/web/components/ShipsCard/ShipsCard.types.ts +2 -0
  110. package/packages/web/components/SparklineChart/SparklineChart.tsx +20 -18
  111. package/packages/web/components/StatsMasonry/StatsMasonry.tsx +95 -0
  112. package/packages/web/components/StatsMasonry/index.ts +1 -0
  113. package/packages/web/components/StreakCard/StreakCard.tsx +37 -35
  114. package/packages/web/components/TasksCounter/TasksCounter.tsx +1 -1
  115. package/packages/web/components/TechStackBadges/TechStackBadges.tsx +12 -4
  116. package/packages/web/components/TerminalDock/DockToggleTab.tsx +29 -0
  117. package/packages/web/components/TerminalDock/TerminalDock.tsx +386 -0
  118. package/packages/web/components/TerminalDock/TerminalDockTab.tsx +130 -0
  119. package/packages/web/components/TerminalDock/TerminalTabBar.tsx +142 -0
  120. package/packages/web/components/TerminalDock/index.ts +2 -0
  121. package/packages/web/components/VelocityBadge/VelocityBadge.tsx +8 -3
  122. package/packages/web/components/VelocityCard/VelocityCard.tsx +49 -47
  123. package/packages/web/components/WeeklyReports/PrintableReport.tsx +259 -0
  124. package/packages/web/components/WeeklyReports/ReportPreviewCard.tsx +187 -0
  125. package/packages/web/components/WeeklyReports/WeekCalendar.tsx +288 -0
  126. package/packages/web/components/WeeklyReports/WeeklyReports.tsx +149 -0
  127. package/packages/web/components/WeeklyReports/index.ts +4 -0
  128. package/packages/web/components/WeeklySparkline/WeeklySparkline.tsx +16 -4
  129. package/packages/web/components/WeeklySparkline/WeeklySparkline.types.ts +1 -0
  130. package/packages/web/components/charts/SessionsChart.tsx +6 -3
  131. package/packages/web/components/ui/dialog.tsx +143 -0
  132. package/packages/web/components/ui/drawer.tsx +135 -0
  133. package/packages/web/components/ui/select.tsx +187 -0
  134. package/packages/web/context/GlobalTerminalContext.tsx +538 -0
  135. package/packages/web/lib/commands.ts +81 -0
  136. package/packages/web/lib/generate-week-report.ts +285 -0
  137. package/packages/web/lib/parse-prjct-files.ts +56 -55
  138. package/packages/web/lib/project-colors.ts +58 -0
  139. package/packages/web/lib/projects.ts +58 -5
  140. package/packages/web/lib/services/projects.server.ts +11 -1
  141. package/packages/web/next-env.d.ts +1 -1
  142. package/packages/web/package.json +5 -1
  143. package/templates/commands/analyze.md +39 -3
  144. package/templates/commands/ask.md +58 -3
  145. package/templates/commands/bug.md +117 -26
  146. package/templates/commands/dash.md +95 -158
  147. package/templates/commands/done.md +130 -148
  148. package/templates/commands/feature.md +125 -103
  149. package/templates/commands/git.md +18 -3
  150. package/templates/commands/idea.md +121 -38
  151. package/templates/commands/init.md +124 -20
  152. package/templates/commands/migrate-all.md +63 -28
  153. package/templates/commands/migrate.md +140 -0
  154. package/templates/commands/next.md +115 -5
  155. package/templates/commands/now.md +146 -82
  156. package/templates/commands/pause.md +89 -74
  157. package/templates/commands/redo.md +6 -4
  158. package/templates/commands/resume.md +141 -59
  159. package/templates/commands/ship.md +103 -231
  160. package/templates/commands/spec.md +98 -8
  161. package/templates/commands/suggest.md +22 -2
  162. package/templates/commands/sync.md +192 -203
  163. package/templates/commands/undo.md +6 -4
  164. package/core/data/agents-manager.ts +0 -76
  165. package/core/data/analysis-manager.ts +0 -83
  166. package/core/data/base-manager.ts +0 -156
  167. package/core/data/ideas-manager.ts +0 -81
  168. package/core/data/outcomes-manager.ts +0 -96
  169. package/core/data/project-manager.ts +0 -75
  170. package/core/data/roadmap-manager.ts +0 -118
  171. package/core/data/shipped-manager.ts +0 -65
  172. package/core/data/state-manager.ts +0 -214
  173. package/core/state/index.ts +0 -25
  174. package/core/state/manager.ts +0 -376
  175. package/core/state/types.ts +0 -185
  176. package/core/utils/project-capabilities.ts +0 -156
  177. package/core/view-generator.ts +0 -536
  178. package/packages/web/app/project/[id]/stats/loading.tsx +0 -43
  179. package/packages/web/app/project/[id]/stats/page.tsx +0 -253
  180. package/templates/agent-assignment.md +0 -72
  181. package/templates/analysis/project-analysis.md +0 -78
  182. package/templates/checklists/accessibility.md +0 -33
  183. package/templates/commands/build.md +0 -17
  184. package/templates/commands/decision.md +0 -226
  185. package/templates/commands/fix.md +0 -79
  186. package/templates/commands/help.md +0 -61
  187. package/templates/commands/progress.md +0 -14
  188. package/templates/commands/recap.md +0 -14
  189. package/templates/commands/roadmap.md +0 -52
  190. package/templates/commands/status.md +0 -17
  191. package/templates/commands/task.md +0 -63
  192. package/templates/commands/work.md +0 -44
  193. package/templates/commands/workflow.md +0 -12
@@ -2,25 +2,33 @@
2
2
  allowed-tools: [Read, Write, Bash]
3
3
  description: 'Complete current task with session metrics'
4
4
  timestamp-rule: 'GetTimestamp() for all timestamps'
5
- architecture: 'MD-first - MD files are source of truth'
5
+ architecture: 'Write-Through (JSON MD Events)'
6
+ storage-layer: true
7
+ source-of-truth: 'storage/state.json'
8
+ claude-context: 'context/now.md'
9
+ backend-sync: 'sync/pending.json'
6
10
  ---
7
11
 
8
12
  # /p:done - Complete Current Task with Session Metrics
9
13
 
10
- ## Architecture: MD-First
14
+ ## Architecture: Write-Through Pattern
11
15
 
12
- **Source of Truth**: `core/now.md`, `core/next.md`, `progress/shipped.md`
16
+ ```
17
+ User Action → Storage (JSON) → Context (MD) → Sync Events
18
+ ```
13
19
 
14
- MD files are the source of truth. Write directly to MD files.
20
+ **Source of Truth**: `storage/state.json`
21
+ **Claude Context**: `context/now.md` (generated)
22
+ **Backend Sync**: `sync/pending.json` (events)
15
23
 
16
24
  ## Context Variables
17
25
  - `{projectId}`: From `.prjct/prjct.config.json`
18
26
  - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
19
- - `{nowPath}`: `{globalPath}/core/now.md`
20
- - `{nextPath}`: `{globalPath}/core/next.md`
21
- - `{sessionPath}`: `{globalPath}/sessions/current.json`
22
- - `{archiveDir}`: `{globalPath}/sessions/archive`
23
- - `{memoryPath}`: `{globalPath}/memory/context.jsonl`
27
+ - `{statePath}`: `{globalPath}/storage/state.json`
28
+ - `{nowContextPath}`: `{globalPath}/context/now.md`
29
+ - `{syncPath}`: `{globalPath}/sync/pending.json`
30
+ - `{memoryPath}`: `{globalPath}/memory/events.jsonl`
31
+ - `{sessionsPath}`: `{globalPath}/progress/sessions`
24
32
 
25
33
  ## Accuracy Calculation
26
34
 
@@ -43,47 +51,33 @@ IF file not found:
43
51
  OUTPUT: "No prjct project. Run /p:init first."
44
52
  STOP
45
53
 
46
- ## Step 2: Check Session State
54
+ ## Step 2: Check Current State
47
55
 
48
- ### Read now.md (source of truth)
49
- READ: `{nowPath}`
56
+ ### Read state.json (source of truth)
57
+ READ: `{statePath}`
50
58
 
51
- IF file exists AND has task content:
52
- PARSE MD format:
53
- - Look for `**Task description**` (bold text = current task)
54
- - Look for `Started: {timestamp}`
55
- - Look for `Session: {sessionId}`
56
- - Look for `Estimate: {estimate}` (optional)
57
- EXTRACT: {task}, {startedAt}, {sessionId}, {estimate}
58
- GOTO Step 3 (Session Completion)
59
-
60
- ### Try structured session (for detailed metrics)
61
- READ: `{sessionPath}`
59
+ IF file not found OR no currentTask:
60
+ OUTPUT: "⚠️ No active task to complete. Use /p:now to start one."
61
+ STOP
62
62
 
63
- IF file exists:
64
- PARSE as JSON
65
- EXTRACT: {session} object
66
- ELSE:
67
- CREATE session from now.md data
63
+ PARSE JSON
64
+ EXTRACT: {currentTask}
68
65
 
69
- IF no task in now.md:
66
+ IF {currentTask.status} != "active":
70
67
  OUTPUT: "⚠️ No active task to complete. Use /p:now to start one."
71
68
  STOP
72
69
 
73
- ## Step 3: Session Completion
70
+ ## Step 3: Calculate Metrics
74
71
 
75
- ### Calculate Final Duration
76
72
  SET: {now} = GetTimestamp()
73
+ SET: {startedAt} = {currentTask.startedAt}
77
74
 
78
- For each event in {session.timeline}:
79
- Track start/resume/pause/complete times
80
- Calculate total active time
81
-
82
- SET: {duration} = total active seconds
75
+ ### Calculate Duration
76
+ SET: {durationSeconds} = seconds between {startedAt} and {now}
83
77
  SET: {durationFormatted} = format as "Xh Ym" or "Xm"
84
78
 
85
79
  ### Calculate Git Metrics
86
- BASH: `git rev-list --count --since="{session.startedAt}" HEAD 2>/dev/null || echo "0"`
80
+ BASH: `git rev-list --count --since="{startedAt}" HEAD 2>/dev/null || echo "0"`
87
81
  CAPTURE as {commits}
88
82
 
89
83
  BASH: `git diff --stat HEAD~{commits} 2>/dev/null || git diff --stat`
@@ -93,59 +87,49 @@ PARSE output for:
93
87
  - {linesRemoved}: deletions
94
88
 
95
89
  ### Calculate Accuracy (if estimate exists)
96
- IF {session.estimateSeconds} exists AND > 0:
97
- {accuracy} = 100 - Math.abs(((duration - estimateSeconds) / estimateSeconds) * 100)
90
+ IF {currentTask.estimateSeconds} exists AND > 0:
91
+ {accuracy} = 100 - Math.abs(((durationSeconds - estimateSeconds) / estimateSeconds) * 100)
98
92
  {accuracy} = Math.max(0, Math.min(100, {accuracy})) // Cap between 0-100
99
93
  {accuracyLabel} = accuracy >= 80 ? "✅" : accuracy >= 50 ? "⚠️" : "❌"
100
94
  ELSE:
101
95
  {accuracy} = null
102
96
  {accuracyLabel} = null
103
97
 
104
- ### Update Session Object
98
+ ## Step 4: Update Storage (SOURCE OF TRUTH)
99
+
100
+ ### Prepare completed task
105
101
  ```json
106
102
  {
107
- "id": "{session.id}",
108
- "projectId": "{projectId}",
109
- "task": "{session.task}",
103
+ "id": "{currentTask.id}",
104
+ "description": "{currentTask.description}",
110
105
  "status": "completed",
111
- "startedAt": "{session.startedAt}",
112
- "pausedAt": null,
106
+ "startedAt": "{currentTask.startedAt}",
113
107
  "completedAt": "{now}",
114
- "duration": {duration},
115
- "estimate": "{session.estimate}",
116
- "estimateSeconds": {session.estimateSeconds},
108
+ "sessionId": "{currentTask.sessionId}",
109
+ "duration": {durationSeconds},
110
+ "estimate": "{currentTask.estimate}",
111
+ "estimateSeconds": {currentTask.estimateSeconds},
117
112
  "accuracy": {accuracy},
118
113
  "metrics": {
119
114
  "filesChanged": {filesChanged},
120
115
  "linesAdded": {linesAdded},
121
116
  "linesRemoved": {linesRemoved},
122
- "commits": {commits},
123
- "snapshots": {session.metrics.snapshots}
124
- },
125
- "timeline": [
126
- ...{session.timeline},
127
- {"type": "complete", "at": "{now}"}
128
- ]
117
+ "commits": {commits}
118
+ }
129
119
  }
130
120
  ```
131
121
 
132
- ## Step 4: Archive Session
133
-
134
- ### Create Archive Directory
135
- GET: {yearMonth} = YYYY-MM from {now}
136
- ENSURE: `{archiveDir}/{yearMonth}` exists
137
-
138
- BASH: `mkdir -p {archiveDir}/{yearMonth}`
139
-
140
- ### Write Archived Session
141
- WRITE: `{archiveDir}/{yearMonth}/{session.id}.json`
142
- Content: Updated session object from Step 3
143
-
144
- ## Step 5: Clear Current State (MD)
122
+ ### Update state.json
123
+ READ: `{statePath}`
124
+ SET: state.previousTask = completed task object
125
+ SET: state.currentTask = null
126
+ SET: state.lastUpdated = {now}
127
+ WRITE: `{statePath}`
145
128
 
146
- ### Clear now.md (SOURCE OF TRUTH)
129
+ ## Step 5: Generate Context (FOR CLAUDE)
147
130
 
148
- WRITE: `{nowPath}`
131
+ ### Clear now.md
132
+ WRITE: `{nowContextPath}`
149
133
 
150
134
  ```markdown
151
135
  # NOW
@@ -155,19 +139,50 @@ _No active task_
155
139
  Use `/p:now <task>` to start working.
156
140
  ```
157
141
 
158
- ### Clear session.json
159
- WRITE: `{sessionPath}`
160
- Content:
142
+ ## Step 6: Queue Sync Event (FOR BACKEND)
143
+
144
+ READ: `{syncPath}` or create empty array
145
+ APPEND event:
161
146
  ```json
162
- {}
147
+ {
148
+ "type": "task.completed",
149
+ "path": ["state"],
150
+ "data": {
151
+ "taskId": "{currentTask.id}",
152
+ "description": "{currentTask.description}",
153
+ "startedAt": "{currentTask.startedAt}",
154
+ "completedAt": "{now}",
155
+ "duration": {durationSeconds},
156
+ "accuracy": {accuracy},
157
+ "metrics": {
158
+ "filesChanged": {filesChanged},
159
+ "linesAdded": {linesAdded},
160
+ "linesRemoved": {linesRemoved},
161
+ "commits": {commits}
162
+ }
163
+ },
164
+ "timestamp": "{now}",
165
+ "projectId": "{projectId}"
166
+ }
163
167
  ```
168
+ WRITE: `{syncPath}`
169
+
170
+ ## Step 7: Log to Daily Session (for Dashboard Charts)
171
+
172
+ GET: {date} = YYYY-MM-DD from {now}
173
+ GET: {yearMonth} = YYYY-MM from {now}
174
+ SET: {dailySessionPath} = `{sessionsPath}/{yearMonth}/{date}.jsonl`
164
175
 
165
- ## Step 6: Log Completion
176
+ BASH: `mkdir -p {sessionsPath}/{yearMonth}`
166
177
 
167
- Metrics are calculated from session history and memory log.
168
- No separate metrics.json needed - all data is in MD files and JSONL logs.
178
+ APPEND to: `{dailySessionPath}`
169
179
 
170
- ## Step 8: Log to Memory
180
+ Single line (JSONL format):
181
+ ```json
182
+ {"ts":"{now}","type":"task_complete","task":"{currentTask.description}","duration":"{durationFormatted}","sessionId":"{currentTask.sessionId}"}
183
+ ```
184
+
185
+ ## Step 8: Log to Memory (AUDIT TRAIL)
171
186
 
172
187
  APPEND to: `{memoryPath}`
173
188
 
@@ -175,23 +190,23 @@ Single line (JSONL format):
175
190
 
176
191
  IF {accuracy} exists:
177
192
  ```json
178
- {"timestamp":"{now}","action":"session_completed","sessionId":"{session.id}","task":"{session.task}","duration":{duration},"estimate":{estimateSeconds},"accuracy":{accuracy},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
193
+ {"timestamp":"{now}","action":"task_completed","taskId":"{currentTask.id}","sessionId":"{currentTask.sessionId}","task":"{currentTask.description}","duration":{durationSeconds},"estimate":{estimateSeconds},"accuracy":{accuracy},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
179
194
  ```
180
195
 
181
196
  ELSE:
182
197
  ```json
183
- {"timestamp":"{now}","action":"session_completed","sessionId":"{session.id}","task":"{session.task}","duration":{duration},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
198
+ {"timestamp":"{now}","action":"task_completed","taskId":"{currentTask.id}","sessionId":"{currentTask.sessionId}","task":"{currentTask.description}","duration":{durationSeconds},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
184
199
  ```
185
200
 
186
201
  ## Output
187
202
 
188
203
  SUCCESS (with estimate):
189
204
  ```
190
- ✅ {session.task} ({durationFormatted})
205
+ ✅ {currentTask.description} ({durationFormatted})
191
206
 
192
207
  Estimate: {estimate} | Actual: {durationFormatted} | {accuracyLabel} Accuracy: {accuracy}%
193
208
 
194
- Session: {session.id}
209
+ Session: {currentTask.sessionId}
195
210
  Files: {filesChanged} | +{linesAdded}/-{linesRemoved}
196
211
  Commits: {commits}
197
212
 
@@ -203,9 +218,9 @@ Next:
203
218
 
204
219
  SUCCESS (without estimate):
205
220
  ```
206
- ✅ {session.task} ({durationFormatted})
221
+ ✅ {currentTask.description} ({durationFormatted})
207
222
 
208
- Session: {session.id}
223
+ Session: {currentTask.sessionId}
209
224
  Files: {filesChanged} | +{linesAdded}/-{linesRemoved}
210
225
  Commits: {commits}
211
226
 
@@ -220,26 +235,40 @@ Next:
220
235
  | Error | Response | Action |
221
236
  |-------|----------|--------|
222
237
  | Config not found | "No prjct project" | STOP |
223
- | No session/task | "No active task" | STOP |
238
+ | No current task | "No active task" | STOP |
224
239
  | Git fails | Use zeros for metrics | CONTINUE |
225
- | Archive fails | Log warning | CONTINUE |
226
240
  | Write fails | Log warning | CONTINUE |
227
241
 
242
+ ## File Structure Reference
243
+
244
+ ```
245
+ ~/.prjct-cli/projects/{projectId}/
246
+ ├── storage/
247
+ │ └── state.json # Source of truth
248
+ ├── context/
249
+ │ └── now.md # Generated (cleared on done)
250
+ ├── sync/
251
+ │ └── pending.json # Events for backend
252
+ ├── progress/
253
+ │ └── sessions/{YYYY-MM}/ # Daily session logs
254
+ └── memory/
255
+ └── events.jsonl # Audit trail
256
+ ```
257
+
228
258
  ## Examples
229
259
 
230
260
  ### Example 1: Full Session Completion (with estimate)
231
- **Session:**
261
+ **State:**
232
262
  ```json
233
263
  {
234
- "id": "sess_abc12345",
235
- "task": "implement authentication",
236
- "status": "active",
237
- "startedAt": "2025-12-07T10:00:00.000Z",
238
- "estimate": "2h",
239
- "estimateSeconds": 7200,
240
- "timeline": [
241
- {"type": "start", "at": "2025-12-07T10:00:00.000Z"}
242
- ]
264
+ "currentTask": {
265
+ "id": "550e8400-e29b-41d4-a716-446655440000",
266
+ "description": "implement authentication",
267
+ "status": "active",
268
+ "startedAt": "2025-12-07T10:00:00.000Z",
269
+ "estimate": "2h",
270
+ "estimateSeconds": 7200
271
+ }
243
272
  }
244
273
  ```
245
274
 
@@ -256,7 +285,7 @@ Next:
256
285
 
257
286
  Estimate: 2h | Actual: 2h 15m | ✅ Accuracy: 88%
258
287
 
259
- Session: sess_abc12345
288
+ Session: 550e8400-e29b-41d4-a716-446655440000
260
289
  Files: 5 | +120/-30
261
290
  Commits: 3
262
291
 
@@ -266,12 +295,12 @@ Next:
266
295
  • /p:progress - View metrics
267
296
  ```
268
297
 
269
- ### Example 1b: Session Completion (without estimate)
298
+ ### Example 2: Session Completion (without estimate)
270
299
  **Output:**
271
300
  ```
272
301
  ✅ implement authentication (2h 15m)
273
302
 
274
- Session: sess_abc12345
303
+ Session: 550e8400-e29b-41d4-a716-446655440000
275
304
  Files: 5 | +120/-30
276
305
  Commits: 3
277
306
 
@@ -281,55 +310,8 @@ Next:
281
310
  • /p:progress - View metrics
282
311
  ```
283
312
 
284
- ### Example 2: Session with Pauses
285
- **Session with multiple pause/resume:**
286
- ```json
287
- {
288
- "id": "sess_xyz98765",
289
- "task": "fix login bug",
290
- "timeline": [
291
- {"type": "start", "at": "2025-12-07T09:00:00.000Z"},
292
- {"type": "pause", "at": "2025-12-07T10:00:00.000Z"},
293
- {"type": "resume", "at": "2025-12-07T14:00:00.000Z"},
294
- {"type": "pause", "at": "2025-12-07T15:30:00.000Z"},
295
- {"type": "resume", "at": "2025-12-07T16:00:00.000Z"}
296
- ]
297
- }
298
- ```
299
-
300
- **Completion at 17:00:**
301
- - Active time: 1h + 1.5h + 1h = 3.5h
302
- - Duration: 3h 30m
303
-
313
+ ### Example 3: No Active Task
304
314
  **Output:**
305
315
  ```
306
- fix login bug (3h 30m)
307
-
308
- Session: sess_xyz98765
309
- Files: 2 | +45/-12
310
- Commits: 1
311
-
312
- Next:
313
- • /p:now - Start next task
314
- • /p:ship - Ship completed work
315
- • /p:progress - View metrics
316
- ```
317
-
318
- ### Example 3: Legacy Fallback (No Session)
319
- **now.md content:**
320
- ```
321
- # NOW
322
-
323
- **quick fix**
324
-
325
- Started: 2025-12-07T16:45:00.000Z
326
- ```
327
-
328
- **Output:**
329
- ```
330
- ✅ quick fix (15m)
331
-
332
- Next:
333
- • /p:now - Start next task
334
- • /p:ship - Ship completed work
316
+ ⚠️ No active task to complete. Use /p:now to start one.
335
317
  ```