secondbrainos-mcp-server 1.10.8 → 1.10.9
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 +3 -9
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -735,15 +735,9 @@ Every agent on SBOS needs a correct clock and a name for the user. Do this once,
|
|
|
735
735
|
|
|
736
736
|
1. **Basic memories.** Check memory for the user's timezone (IANA name, e.g. \`Asia/Karachi\`), name, email, and location. Every timestamp you pass to SBOS is derived from that timezone. **Derive before you ask.** The environment already knows most of this, and asking a user to type what their machine can tell you is the wrong first impression for a start flow. Read the timezone from the system. On macOS use \`readlink /etc/localtime\` (the IANA name is the tail of the path; \`systemsetup -gettimezone\` needs admin and will fail), on Linux \`timedatectl show -p Timezone --value\` or the same \`readlink\`. Take the email from the session context if it is there. Only what genuinely cannot be derived, typically name and location, is worth a question, and then ask in one short line for the missing pieces together, confirming what you already derived rather than re-asking it. Never present a menu of guessed timezones or infer a person's name from their email domain and offer it back as a choice. Save all four once you have them. **Keep memories true: whenever you change something a memory describes — a script you rewrite, a path you move, a setting you re-wire — update that memory in the same turn. A stale memory is worse than no memory, because the next session trusts it.** **Write short memories — a preference, a name, a path, a one-liner, anything that fits in a line or two — directly into the memory index file itself. Reserve a separate memory file for a fact that is genuinely large and nuanced enough to need one, and leave a pointer to it in the index. Most SBOS memories are short and belong in the index.**
|
|
737
737
|
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:
|
|
738
|
-
- \`.claude/hooks/current-time.sh\`: a
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
TZ_NAME="\${1:-UTC}"
|
|
742
|
-
U=\$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
743
|
-
L=\$(TZ="\$TZ_NAME" date +"%Y-%m-%dT%H:%M:%S%z")
|
|
744
|
-
printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"Current time — UTC: %s | %s: %s"}}\\n' "\$U" "\$TZ_NAME" "\$L"
|
|
745
|
-
\`\`\`
|
|
746
|
-
- 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.
|
|
738
|
+
- \`.claude/hooks/current-time.sh\`: a bash script that takes an IANA timezone as its only argument (default UTC), reads the PreToolUse payload on stdin, and prints **one line of JSON**. It does two jobs: it injects the current time, and it denies any logging call whose timestamp is more than 30 seconds off the real clock, handing back the exact value to retry with. **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. The blocking half matters because injected context arrives with the tool *result*, after the arguments were written: on the first logging call of a session the agent has no time in context at all, and on later calls it holds only the time from the previous call, stale by however long the work in between took. Injection alone never gives the agent the current time at the moment it needs it. Timestamps further off than an hour, past or future, are treated as deliberate and pass untouched, so backdated and scheduled events still work.
|
|
739
|
+
Do not write the script from memory. Fetch it with \`runPromptChain\` using \`entity: "prompts"\` and \`entity_id: "recoUyWDJOaKhvdIK"\`, then follow the instructions it returns exactly. That record is the single source of truth for this script; it carries the current version, the tolerances, and the tests. Make the script executable once written.
|
|
740
|
+
- 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 guards every logging call: it injects the current time, and it rejects a timestamp more than 30 seconds off the real clock. Verify it once by making a logging call with a deliberately stale timestamp (a few minutes old). The call must come back denied, with a reason naming the drift and the exact value to use; retry with that value verbatim and it must succeed. Do not verify by simply checking that the time appears in your context — that passes even when the call you made was wrong, because the injection arrives after the arguments were written. Only the denial proves the hook is working.
|
|
747
741
|
- Add \`Bash(<absolute path>/.claude/hooks/current-time.sh:*)\` to \`permissions.allow\` so it runs without prompting.
|
|
748
742
|
3. Say in one line what you set up, or that it was already there.
|
|
749
743
|
|