secondbrainos-mcp-server 1.10.4 → 1.10.5
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.
- package/build/index.js +11 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -700,15 +700,22 @@ An agent definition combines:
|
|
|
700
700
|
Every agent on SBOS needs a correct clock and a name for the user. Do this once, before anything else, and skip whatever is already in place.
|
|
701
701
|
|
|
702
702
|
1. **Basic memories.** Check memory for the user's timezone (IANA name, e.g. \`Asia/Karachi\`), name, email, and location. If any is missing, ask once and save it. Every timestamp you pass to SBOS is derived from that timezone.
|
|
703
|
-
2. **Time hook.** Look for \`.claude/hooks/current-time.sh\` in the project. If it exists (an earlier session or an SBOS agent set it up), use it: run \`current-time.sh <TIMEZONE>\` whenever you need the current time and never guess the date. If it is absent, create it and register it, with the user's permission:
|
|
704
|
-
- \`.claude/hooks/current-time.sh\`: a short bash script that takes an IANA timezone as its only argument (default UTC) and prints
|
|
705
|
-
|
|
703
|
+
2. **Time hook.** Look for \`.claude/hooks/current-time.sh\` in the project. If it exists (an earlier session or an SBOS agent set it up), read it and check its output format: if it prints bare lines instead of the JSON described below, it is silently doing nothing and must be rewritten — offer to fix it. Otherwise use it: run \`current-time.sh <TIMEZONE>\` whenever you need the current time and never guess the date. If it is absent, create it and register it, with the user's permission:
|
|
704
|
+
- \`.claude/hooks/current-time.sh\`: a short bash script that takes an IANA timezone as its only argument (default UTC) and prints **one line of JSON** carrying the current time in UTC as an ISO-8601 string with a \`Z\` suffix and the current time in the given timezone as ISO-8601 with a numeric offset. **A PreToolUse hook's plain stdout is discarded — only \`hookSpecificOutput.additionalContext\` reaches the model** — so bare \`echo\` lines silently do nothing and the agent goes on inventing timestamps. Make it executable. Use exactly this:
|
|
705
|
+
\`\`\`bash
|
|
706
|
+
#!/bin/bash
|
|
707
|
+
TZ_NAME="\${1:-UTC}"
|
|
708
|
+
U=\$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
709
|
+
L=\$(TZ="\$TZ_NAME" date +"%Y-%m-%dT%H:%M:%S%z")
|
|
710
|
+
printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"Current time — UTC: %s | %s: %s"}}\\n' "\$U" "\$TZ_NAME" "\$L"
|
|
711
|
+
\`\`\`
|
|
712
|
+
- In \`.claude/settings.json\`, **append** (never overwrite the existing \`hooks\` object) a \`PreToolUse\` entry matching \`mcp__secondbrainos__addActivityEvent|mcp__secondbrainos__updateActivityState\` whose command runs the script with the user's timezone, e.g. \`"$CLAUDE_PROJECT_DIR"/.claude/hooks/current-time.sh Asia/Karachi\`. The hook injects the current time right before every logging call so timestamps are never invented. Verify it once: make a logging call and confirm the time appears in your context before the tool result. If nothing appears, the script's output format is wrong — a hook that fires and returns nothing looks exactly like one that never fires.
|
|
706
713
|
- Add \`Bash(<absolute path>/.claude/hooks/current-time.sh:*)\` to \`permissions.allow\` so it runs without prompting.
|
|
707
714
|
3. Say in one line what you set up, or that it was already there.
|
|
708
715
|
|
|
709
716
|
### Progress Logging (\`updateActivityState\`, \`addActivityEvent\`)
|
|
710
717
|
- Every SBOS user has these. Use them so the user can see what you did, across however many agents are working in parallel.
|
|
711
|
-
- \`updateActivityState\` — set \`
|
|
718
|
+
- \`updateActivityState\` — set \`active\` when you start working and \`inactive\` when you stop (session start/end is a good proxy). The state values are lowercase; the tool accepts nothing else. Timestamps come from the time hook above, in the user's timezone from memory.
|
|
712
719
|
- **Only the main agent sets state.** Spawned sub-agents must never call \`updateActivityState\` — the user is one person having one working session, and a sub-agent finishing does not mean they stopped working. Sub-agents may still call \`addActivityEvent\`.
|
|
713
720
|
- \`addActivityEvent\` — log completed pieces of work, at the size the user would name if asked what they did today: \"drafted the launch email\", \"fixed the checkout bug\", not \"read a file\", \"ran a search\", \"edited line 40\". One event per finished piece of work — roughly what would earn its own line in a summary of the day. If in doubt, log less: a sparse, accurate stream is far more useful to the user than a complete one.
|
|
714
721
|
- The user reads these back on their dashboard, so write the summary for them, not for you.
|