Skip to content

Commit 51f8190

Browse files
josealekhineclaude
andcommitted
feat: add precise timestamps for session correlation
Update timestamp format in ctx add commands for better session correlation: - Tasks now include #added:YYYY-MM-DD-HHMM tag - Learnings use YYYY-MM-DD-HHMM (was YYYY-MM-DD) - Decisions use YYYY-MM-DD-HHMM (was YYYY-MM-DD) This enables correlating context entries to sessions by timestamp overlap, helping trace when decisions/learnings were added. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 862a273 commit 51f8190

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

.context/TASKS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@
131131
- `#in-progress` — currently being worked on (add inline, don't move task)
132132

133133
### Phase 12: Timestamp-Based Session Correlation `#priority:medium` `#area:cli`
134-
- [ ] Add timestamp to formatTask() in add.go — currently tasks have no timestamp, add `#added:YYYY-MM-DD-HHMM` or similar
135-
- [ ] Increase timestamp precision in formatLearning() — change from YYYY-MM-DD to YYYY-MM-DD-HHMM
136-
- [ ] Increase timestamp precision in formatDecision() — change from YYYY-MM-DD to YYYY-MM-DD-HHMM
134+
- [x] Add timestamp to formatTask() in add.go — currently tasks have no timestamp, add `#added:YYYY-MM-DD-HHMM` or similar
135+
- [x] Increase timestamp precision in formatLearning() — change from YYYY-MM-DD to YYYY-MM-DD-HHMM
136+
- [x] Increase timestamp precision in formatDecision() — change from YYYY-MM-DD to YYYY-MM-DD-HHMM
137137
- [ ] Add start_time field to session summary files — record when session began
138138
- [ ] Add last_update_time field to session summary files — update on each ctx add call during session
139139
- [ ] Document timestamp correlation approach in AGENT_PLAYBOOK.md — explain how to correlate entries to sessions by time overlap

internal/cli/add.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ func runAdd(cmd *cobra.Command, args []string) error {
111111
}
112112

113113
func formatDecision(content string) string {
114-
date := time.Now().Format("2006-01-02")
114+
// Use YYYY-MM-DD-HHMM for precise timestamp correlation with sessions
115+
timestamp := time.Now().Format("2006-01-02-1504")
115116
return fmt.Sprintf(`## [%s] %s
116117
117118
**Status**: Accepted
@@ -123,20 +124,23 @@ func formatDecision(content string) string {
123124
**Rationale**: [Add rationale here]
124125
125126
**Consequences**: [Add consequences here]
126-
`, date, content, content)
127+
`, timestamp, content, content)
127128
}
128129

129130
func formatTask(content string, priority string) string {
131+
// Use YYYY-MM-DD-HHMM timestamp for session correlation
132+
timestamp := time.Now().Format("2006-01-02-1504")
130133
var priorityTag string
131134
if priority != "" {
132135
priorityTag = fmt.Sprintf(" #priority:%s", priority)
133136
}
134-
return fmt.Sprintf("- [ ] %s%s\n", content, priorityTag)
137+
return fmt.Sprintf("- [ ] %s%s #added:%s\n", content, priorityTag, timestamp)
135138
}
136139

137140
func formatLearning(content string) string {
138-
date := time.Now().Format("2006-01-02")
139-
return fmt.Sprintf("- **[%s]** %s\n", date, content)
141+
// Use YYYY-MM-DD-HHMM for precise timestamp correlation with sessions
142+
timestamp := time.Now().Format("2006-01-02-1504")
143+
return fmt.Sprintf("- **[%s]** %s\n", timestamp, content)
140144
}
141145

142146
func formatConvention(content string) string {

0 commit comments

Comments
 (0)