You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/track-code-change.sh
+5-10Lines changed: 5 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -146,19 +146,14 @@ if [ $? -ne 0 ]; then
146
146
BELT="white"
147
147
fi
148
148
149
-
# Use json_escape for all dynamic strings embedded in the context JSON value
150
-
ESCAPED_TECH=$(json_escape "$TECH")
151
-
ESCAPED_FILE_PATH=$(json_escape "$FILE_PATH")
152
-
ESCAPED_TOOL_NAME=$(json_escape "$TOOL_NAME")
153
-
ESCAPED_BELT=$(json_escape "$BELT")
154
-
155
149
if [ "$IS_FIRST_EVER"="true" ];then
156
-
CONTEXT="CodeSensei micro-lesson trigger: The user just encountered ${ESCAPED_TECH} for the FIRST TIME (file: ${ESCAPED_FILE_PATH}). Their belt level is ${ESCAPED_BELT}. Provide a brief 2-sentence explanation of what ${ESCAPED_TECH} is and why it matters for their project. Adapt language to their belt level. Keep it concise and non-intrusive — weave it naturally into your response, don't stop everything for a lecture."
150
+
CONTEXT="🥋 CodeSensei micro-lesson trigger: The user just encountered '$TECH' for the FIRST TIME (file: $FILE_PATH). Their belt level is '$BELT'. Provide a brief 2-sentence explanation of what $TECH is and why it matters for their project. Adapt language to their belt level. Keep it concise and non-intrusive — weave it naturally into your response, don't stop everything for a lecture."
157
151
else
158
-
CONTEXT="CodeSensei inline insight: Claude just used ${ESCAPED_TOOL_NAME} on ${ESCAPED_FILE_PATH} (${ESCAPED_TECH}). The user's belt level is ${ESCAPED_BELT}. Provide a brief 1-2 sentence explanation of what this change does and why, adapted to their belt level. Keep it natural and non-intrusive — weave it into your response as a quick teaching moment."
152
+
CONTEXT="🥋 CodeSensei inline insight: Claude just used '$TOOL_NAME' on '$FILE_PATH' ($TECH). The user's belt level is '$BELT'. Provide a brief 1-2 sentence explanation of what this change does and why, adapted to their belt level. Keep it natural and non-intrusive — weave it into your response as a quick teaching moment."
159
153
fi
160
154
161
-
# Build final output — context is already a JSON string from json_escape (with quotes)
Copy file name to clipboardExpand all lines: scripts/track-command.sh
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -144,20 +144,18 @@ if [ $? -ne 0 ]; then
144
144
BELT="white"
145
145
fi
146
146
147
-
# Use json_escape for all dynamic strings embedded in the context JSON value
148
-
ESCAPED_CONCEPT=$(json_escape "$CONCEPT")
149
-
ESCAPED_CMD=$(json_escape "$(printf '%s'"$COMMAND"| head -c 80)")
150
-
ESCAPED_BELT=$(json_escape "$BELT")
147
+
SAFE_CMD=$(printf '%s'"$COMMAND"| head -c 80 | tr '"'"'"| tr '\\''/')
151
148
152
149
if [ "$IS_FIRST_EVER"="true" ] && [ -n"$CONCEPT" ];then
153
-
CONTEXT="CodeSensei micro-lesson trigger: The user just encountered ${ESCAPED_CONCEPT} for the FIRST TIME (command: ${ESCAPED_CMD}). Their belt level is ${ESCAPED_BELT}. Provide a brief 2-sentence explanation of what ${ESCAPED_CONCEPT} means and why it matters. Adapt language to their belt level. Keep it concise and non-intrusive."
150
+
CONTEXT="🥋 CodeSensei micro-lesson trigger: The user just encountered '$CONCEPT' for the FIRST TIME (command: $SAFE_CMD). Their belt level is '$BELT'. Provide a brief 2-sentence explanation of what $CONCEPT means and why it matters. Adapt language to their belt level. Keep it concise and non-intrusive."
154
151
elif [ -n"$CONCEPT" ];then
155
-
CONTEXT="CodeSensei inline insight: Claude just ran a ${ESCAPED_CONCEPT} command (${ESCAPED_CMD}). The user's belt level is ${ESCAPED_BELT}. Provide a brief 1-sentence explanation of what this command does, adapted to their belt level. Keep it natural and non-intrusive."
152
+
CONTEXT="🥋 CodeSensei inline insight: Claude just ran a '$CONCEPT' command ($SAFE_CMD). The user's belt level is '$BELT'. Provide a brief 1-sentence explanation of what this command does, adapted to their belt level. Keep it natural and non-intrusive."
156
153
else
157
-
CONTEXT="CodeSensei inline insight: Claude just ran a shell command (${ESCAPED_CMD}). The user's belt level is ${ESCAPED_BELT}. If this command is educational, briefly explain what it does in 1 sentence. If trivial, skip the explanation."
154
+
CONTEXT="🥋 CodeSensei inline insight: Claude just ran a shell command ($SAFE_CMD). The user's belt level is '$BELT'. If this command is educational, briefly explain what it does in 1 sentence. If trivial, skip the explanation."
158
155
fi
159
156
160
-
# Build final output — context is already a JSON string from json_escape (with quotes)
0 commit comments