Skip to content

Commit dfa8ec0

Browse files
Update memento to 0.9.0
1 parent 2c4c45a commit dfa8ec0

File tree

9 files changed

+163
-19
lines changed

9 files changed

+163
-19
lines changed

.claude/commands/mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
allowed-tools: Bash(sh:.memento/scripts/mode-switch.sh)
2+
allowed-tools: Bash(sh .memento/scripts/mode-switch.sh)
33
argument-hint: [mode-name]
44
description: List available modes or switch to a specific mode
55
---

.claude/commands/ticket.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
---
2-
allowed-tools: Bash(sh:.memento/scripts/ticket-context.sh)
2+
allowed-tools: Bash(sh .memento/scripts/ticket-context.sh)
33
argument-hint: [ticket-name]
4-
description: List tickets or load specific ticket context
4+
description: Manage tickets stored as .md files in .memento/tickets/ directories
55
---
66
# Ticket Management
77

88
!`sh .memento/scripts/ticket-context.sh $ARGUMENTS`
99

10-
11-
12-
I now have the current ticket status and context loaded.
10+
I now have ticket information loaded. Use Read tool to access actual ticket content.

.memento/hooks/definitions/acronym-expander.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Automatically expands configured acronyms in prompts",
88
"event": "UserPromptSubmit",
99
"enabled": true,
10-
"command": "/Users/dazheng/workspace/hypernative/hypernative-apply/.memento/hooks/scripts/acronym-expander.sh",
10+
"command": "./.memento/hooks/scripts/acronym-expander.sh",
1111
"priority": 150,
1212
"requirements": {
1313
"commands": [

.memento/hooks/definitions/git-context-loader.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Loads current git status on each user prompt",
88
"event": "UserPromptSubmit",
99
"enabled": true,
10-
"command": "/Users/dazheng/workspace/hypernative/hypernative-apply/.memento/hooks/scripts/git-context-loader.sh",
10+
"command": "./.memento/hooks/scripts/git-context-loader.sh",
1111
"continueOnError": true,
1212
"priority": 95,
1313
"requirements": {

.memento/hooks/definitions/memento-routing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Routes modes, workflows, and tickets based on user prompts",
88
"event": "UserPromptSubmit",
99
"enabled": true,
10-
"command": "/Users/dazheng/workspace/hypernative/hypernative-apply/.memento/hooks/scripts/memento-routing.sh",
10+
"command": "./.memento/hooks/scripts/memento-routing.sh",
1111
"priority": 100,
1212
"requirements": {
1313
"commands": [

.memento/hooks/definitions/project-overview.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"description": "Loads project overview including tickets status at session start",
88
"event": "SessionStart",
99
"enabled": true,
10-
"command": "/Users/dazheng/workspace/hypernative/hypernative-apply/.memento/hooks/scripts/project-overview.sh",
10+
"command": "./.memento/hooks/scripts/project-overview.sh",
1111
"continueOnError": true,
1212
"priority": 85,
1313
"requirements": {

.memento/hooks/scripts/memento-routing.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,16 @@ if [ -n "$TICKET_REQUEST" ]; then
259259
echo ""
260260
echo "### Working with Tickets"
261261
echo ""
262-
echo "- Tickets are simple markdown files that serve as persistent workspaces"
263-
echo "- Use your file editing tools to update ticket content directly"
264-
echo "- Tickets survive between sessions - use them to track progress and share context"
265-
echo "- When working on large tasks, create multiple tickets and delegate to sub-agents"
262+
echo "- **Tickets are markdown files stored in .memento/tickets/{status}/ directories**"
263+
echo "- **File locations**: .memento/tickets/next/, .memento/tickets/in-progress/, .memento/tickets/done/"
264+
echo "- **To read ticket content: Use Read tool with full file path like .memento/tickets/next/ticket-name.md**"
265+
echo "- **To edit tickets: Use Edit tool directly on the .md files**"
266+
echo "- **Important: There is NO CLI command to read ticket content - always use Read tool**"
267+
echo "- **CLI commands only manage ticket lifecycle (create/move/list/delete)**"
268+
echo "- Example file paths:"
269+
echo " - .memento/tickets/next/fix-login-bug.md"
270+
echo " - .memento/tickets/in-progress/add-feature.md"
271+
echo " - .memento/tickets/done/completed-task.md"
266272
echo ""
267273

268274
# Output ticket content
@@ -304,10 +310,16 @@ if [ -z "$TICKET_REQUEST" ]; then
304310
echo ""
305311
echo "### Working with Tickets"
306312
echo ""
307-
echo "- Tickets are simple markdown files that serve as persistent workspaces"
308-
echo "- Use your file editing tools to update ticket content directly"
309-
echo "- Tickets survive between sessions - use them to track progress and share context"
310-
echo "- When working on large tasks, create multiple tickets and delegate to sub-agents"
313+
echo "- **Tickets are markdown files stored in .memento/tickets/{status}/ directories**"
314+
echo "- **File locations**: .memento/tickets/next/, .memento/tickets/in-progress/, .memento/tickets/done/"
315+
echo "- **To read ticket content: Use Read tool with full file path like .memento/tickets/next/ticket-name.md**"
316+
echo "- **To edit tickets: Use Edit tool directly on the .md files**"
317+
echo "- **Important: There is NO CLI command to read ticket content - always use Read tool**"
318+
echo "- **CLI commands only manage ticket lifecycle (create/move/list/delete)**"
319+
echo "- Example file paths:"
320+
echo " - .memento/tickets/next/fix-login-bug.md"
321+
echo " - .memento/tickets/in-progress/add-feature.md"
322+
echo " - .memento/tickets/done/completed-task.md"
311323
echo ""
312324
# Low-confidence patterns (case-insensitive) - exclude explicit ticket: requests
313325
elif echo "$PROMPT" | grep -qi 'ticket' && ! echo "$PROMPT" | grep -qi '^[[:space:]]*ticket[[:space:]]*:'; then

.memento/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"integrations": [],
1818
"agents": [],
19-
"updated": "2025-08-13T06:32:44.266Z"
19+
"updated": "2025-08-13T14:02:51.275Z"
2020
},
2121
"versions": {
2222
"modes": {

.memento/scripts/record-session.sh

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
project_root="${PWD}"
5+
tickets_dir="${project_root}/.memento/tickets"
6+
statuses=("next" "in-progress" "done")
7+
ticket_name_raw="${1:-}"
8+
9+
sanitize() {
10+
printf '%s' "$1" \
11+
| tr -d '\000-\037\177' \
12+
| sed -E \
13+
-e 's/\.+/-/g' \
14+
-e 's#[/\\]+#-#g' \
15+
-e 's/[^a-zA-Z0-9_-]/-/g' \
16+
-e 's/-{2,}/-/g' \
17+
-e 's/^-+//; s/-+$//' \
18+
| cut -c1-100
19+
}
20+
21+
rand_hex() {
22+
od -An -N3 -tx1 /dev/urandom | tr -d ' \n'
23+
}
24+
25+
iso_now_utc() {
26+
date -u +"%Y-%m-%dT%H:%M:%SZ"
27+
}
28+
29+
local_now() {
30+
date +"%Y-%m-%d %H:%M:%S"
31+
}
32+
33+
json_escape() {
34+
# Escape backslashes and double quotes for JSON strings
35+
printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'
36+
}
37+
38+
find_existing_ticket() {
39+
local name="$1"
40+
local p
41+
for s in "${statuses[@]}"; do
42+
p="${tickets_dir}/${s}/${name}.md"
43+
if [ -f "$p" ]; then
44+
printf '%s\n' "$p"
45+
return 0
46+
fi
47+
done
48+
return 1
49+
}
50+
51+
ticket_name="$ticket_name_raw"
52+
if [ -n "$ticket_name" ]; then
53+
ticket_name="$(sanitize "$ticket_name")"
54+
fi
55+
56+
timestamp="$(iso_now_utc)"
57+
local_time="$(local_now)"
58+
59+
if [ -z "$ticket_name" ]; then
60+
ticket_name="session-$(date +%F)-$(rand_hex)"
61+
fi
62+
63+
ticket_path=""
64+
if existing_path="$(find_existing_ticket "$ticket_name")"; then
65+
is_new=false
66+
session_section=$(cat <<EOF
67+
68+
---
69+
70+
## Session Entry - ${local_time}
71+
72+
### Summary
73+
<!-- AI_SUMMARY_START -->
74+
[AI will generate a comprehensive summary here based on recent work, changes made, and next steps]
75+
<!-- AI_SUMMARY_END -->
76+
77+
### Context
78+
```
79+
No automatic context
80+
```
81+
EOF
82+
)
83+
printf '%s' "$session_section" >> "$existing_path"
84+
ticket_path="$existing_path"
85+
else
86+
is_new=true
87+
ticket_path="${tickets_dir}/next/${ticket_name}.md"
88+
mkdir -p "$(dirname "$ticket_path")"
89+
cat > "$ticket_path" <<EOF
90+
# ${ticket_name}
91+
92+
## Description
93+
Session-based ticket created for AI summarization.
94+
95+
## Tasks
96+
- [ ] Review session context
97+
- [ ] Define specific tasks based on work completed
98+
99+
## Session Entry - ${local_time}
100+
101+
### Summary
102+
<!-- AI_SUMMARY_START -->
103+
[AI will generate a comprehensive summary here based on recent work, changes made, and next steps]
104+
<!-- AI_SUMMARY_END -->
105+
106+
### Context
107+
```
108+
No automatic context
109+
```
110+
111+
---
112+
Created: ${timestamp}
113+
EOF
114+
fi
115+
116+
if [ "$is_new" = true ]; then
117+
message="Created new ticket: ${ticket_name}"
118+
else
119+
message="Updated existing ticket: ${ticket_name}"
120+
fi
121+
122+
tn_esc="$(json_escape "$ticket_name")"
123+
tp_esc="$(json_escape "$ticket_path")"
124+
msg_esc="$(json_escape "$message")"
125+
126+
printf '{\n'
127+
printf ' "success": true,\n'
128+
printf ' "ticketName": "%s",\n' "$tn_esc"
129+
printf ' "ticketPath": "%s",\n' "$tp_esc"
130+
printf ' "isNew": %s,\n' "$is_new"
131+
printf ' "message": "%s"\n' "$msg_esc"
132+
printf '}\n'
133+
134+

0 commit comments

Comments
 (0)