From 7ef20576c0726fc06a7956e694016102e1a92183 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:58:50 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++ README.md | 3 ++ hooks/hooks.json | 15 +++++++ hooks/setup-temporal-context.sh | 71 +++++++++++++++++++++++++++++++++ plugin.lock.json | 49 +++++++++++++++++++++++ 5 files changed, 149 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 hooks/hooks.json create mode 100644 hooks/setup-temporal-context.sh create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..b8a778f --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "time-awareness", + "description": "Automatic temporal context with environment variables for time-aware Claude Code sessions", + "version": "1.0.0", + "author": { + "name": "Time Awareness Developer" + }, + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ab011b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# time-awareness + +Automatic temporal context with environment variables for time-aware Claude Code sessions diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..a0a175d --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "${CLAUDE_PLUGIN_ROOT}/hooks/setup-temporal-context.sh", + "timeout": 60 + } + ] + } + ] + } +} diff --git a/hooks/setup-temporal-context.sh b/hooks/setup-temporal-context.sh new file mode 100644 index 0000000..536f56b --- /dev/null +++ b/hooks/setup-temporal-context.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Claude Code Temporal Context Hook +# Exports comprehensive temporal environment variables on session start + +# ===== ISO 8601 UTC Timestamp ===== +export CLAUDE_TIMESTAMP_UTC=$(date -u +"%Y-%m-%dT%H:%M:%SZ") +export CLAUDE_DATE_UTC=$(date -u +"%Y-%m-%d") +export CLAUDE_TIME_UTC=$(date -u +"%H:%M:%S") + +# ===== Local Timestamp ===== +export CLAUDE_TIMESTAMP_LOCAL=$(date +"%Y-%m-%dT%H:%M:%S%z") +export CLAUDE_DATE_LOCAL=$(date +"%Y-%m-%d") +export CLAUDE_TIME_LOCAL=$(date +"%H:%M:%S") +export CLAUDE_TIMEZONE=$(date +"%Z") +export CLAUDE_TIMEZONE_OFFSET=$(date +"%z") + +# ===== Day/Week Context ===== +export CLAUDE_DAY_OF_WEEK=$(date +"%A") +export CLAUDE_DAY_OF_WEEK_NUM=$(date +"%u") +export CLAUDE_DAY_OF_MONTH=$(date +"%d") +export CLAUDE_DAY_OF_YEAR=$(date +"%j") +export CLAUDE_WEEK_OF_YEAR=$(date +"%V") +export CLAUDE_MONTH=$(date +"%B") +export CLAUDE_MONTH_NUM=$(date +"%m") +export CLAUDE_YEAR=$(date +"%Y") +export CLAUDE_QUARTER=$(( ($(date +%-m)-1)/3 + 1 )) + +# ===== Time Period Flags ===== +HOUR=$(date +%-H) + +# Market hours (NYSE: 9:30 AM - 4:00 PM ET) +export CLAUDE_IS_MARKET_HOURS="false" +if [ "$CLAUDE_TIMEZONE" = "EST" ] || [ "$CLAUDE_TIMEZONE" = "EDT" ]; then + if [ $HOUR -ge 9 ] && [ $HOUR -lt 16 ]; then + if [ $HOUR -eq 9 ] && [ $(date +%-M) -lt 30 ]; then + CLAUDE_IS_MARKET_HOURS="false" + else + CLAUDE_IS_MARKET_HOURS="true" + fi + fi +fi +export CLAUDE_IS_MARKET_HOURS + +# Business hours (9 AM - 5 PM local) +export CLAUDE_IS_BUSINESS_HOURS="false" +if [ $HOUR -ge 9 ] && [ $HOUR -lt 17 ]; then + CLAUDE_IS_BUSINESS_HOURS="true" +fi +export CLAUDE_IS_BUSINESS_HOURS + +# Weekend check +export CLAUDE_IS_WEEKEND="false" +if [ "$CLAUDE_DAY_OF_WEEK_NUM" -ge 6 ]; then + CLAUDE_IS_WEEKEND="true" +fi +export CLAUDE_IS_WEEKEND + +# ===== Unix Timestamp ===== +export CLAUDE_UNIX_TIMESTAMP=$(date +%s) + +# ===== Relative Time ===== +export CLAUDE_HOUR_12=$(date +"%I %p") +export CLAUDE_HOUR_24=$(date +"%H") + +# ===== Human-Readable Summary ===== +export CLAUDE_TIME_SUMMARY="$CLAUDE_DAY_OF_WEEK, $CLAUDE_MONTH $CLAUDE_DAY_OF_MONTH, $CLAUDE_YEAR at $CLAUDE_TIME_LOCAL $CLAUDE_TIMEZONE" + +# ===== Output temporal context to session ===== +echo "🕐 Temporal Context Loaded: $CLAUDE_TIME_SUMMARY" +echo "📅 $CLAUDE_DATE_LOCAL | ⏰ Week $CLAUDE_WEEK_OF_YEAR, Q$CLAUDE_QUARTER | 🌍 $CLAUDE_TIMEZONE" +echo "💼 Business Hours: $CLAUDE_IS_BUSINESS_HOURS | 📈 Market Hours: $CLAUDE_IS_MARKET_HOURS | 🎉 Weekend: $CLAUDE_IS_WEEKEND" diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..eff076f --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,49 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:Sycochucky/claude-code-toolkit:plugins/time-awareness", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "3a42e5d24bcb6828a9f7af402468fc00b9f60a4a", + "treeHash": "148e88d28a7222be276c736975d4c48c82dea4e06ce8c722f0bc23caa910567e", + "generatedAt": "2025-11-28T10:12:49.993814Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "time-awareness", + "description": "Automatic temporal context with environment variables for time-aware Claude Code sessions", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "1c65556d1b99d1e98cc82338ae1253ad69580866cee465562b6e72048b831a78" + }, + { + "path": "hooks/setup-temporal-context.sh", + "sha256": "e886154a453cc0c9fbf9667036445b1b0dd3ca1b894a95adfecdcdf93b073164" + }, + { + "path": "hooks/hooks.json", + "sha256": "6c26cb8a78c4c34ed94e3621c0ad5601473caaec94d79418decad257bf8b0384" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "07177a2d50bb4ec49863a7e14d76183bd4ea7cf7fd797299eb6c05f2f14968b7" + } + ], + "dirSha256": "148e88d28a7222be276c736975d4c48c82dea4e06ce8c722f0bc23caa910567e" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file