Tools
Time Awareness
๐ Time Context โ zero-dependency Python tool for Hermes Agent (plugin) and OpenClaw (MCP). Accurate time, timezone, and message-delay awareness.
README
<div align="center">
# ๐ Time Context
**A zero-dependency CLI tool that gives any AI agent accurate time, timezone, and message-delay awareness.**
<br>
[](LICENSE)
[](https://python.org)
</div>
---
## Overview
Large language models have **no inherent sense of time**. Without external context, they cannot know:
- What time it is right now
- Which timezone the user is in
- Whether the last message arrived 5 seconds or 5 hours ago
- Whether the user is actively chatting or returning to a cold conversation
**Time Context** solves this by providing a structured temporal block that any agent can consume:
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Temporal Context
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Server time: 2026-07-07 12:03:45 UTC
Server tz: CST (UTC+08:00)
User time: 2026-07-07 13:03:45
User tz: Asia/Jayapura (UTC+09:00)
Delay: 28s ago
Note: User is actively chatting (delay <5min)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## Quick Start
```bash
# 1. Install (zero dependencies โ pure Python stdlib)
curl -fsSL https://raw.githubusercontent.com/Alfnnnnyy/Time-Awareness-Plugin/main/time_context.py \
-o /usr/local/bin/time_context.py && chmod +x /usr/local/bin/time_context.py
# 2. Set your timezone
export USER_TIMEZONE="Asia/Jayapura"
# 3. Run it
python3 /usr/local/bin/time_context.py
```
Output formats:
```bash
time_context.py # Plain (default)
time_context.py --format markdown # Markdown table
time_context.py --format json # JSON
time_context.py --session chat-123 # With delay tracking
```
---
## Integration
### Any agent โ standalone CLI
```bash
# One-shot
python3 /usr/local/bin/time_context.py --format markdown
# Pipe into your prompt
echo "Current time context: $(python3 /usr/local/bin/time_context.py --format json)"
```
### Claude Code
Create `~/.claude/commands/time.md`:
````markdown
---
description: "Show current time, timezone, and message delay"
---
Run this to get accurate temporal context:
```bash
python3 /usr/local/bin/time_context.py --format markdown
```
````
Then use `/time` during any Claude Code session.
### OpenCode / Codex CLI
Both tools read `AGENTS.md` from your project root โ a plain markdown file
that gets injected into the agent's system prompt on every turn.
```bash
# Create AGENTS.md at your project root
cat > AGENTS.md << 'EOF'
## Temporal Context
Before every response, you MUST run the following command to get the
accurate current time, user timezone, and message delay:
python3 ~/.time-context/time_context.py
Use this to reference the correct time, adjust for timezone,
and consider whether the user is actively chatting.
EOF
```
Or download the ready-made file:
```bash
curl -fsSL https://raw.githubusercontent.com/Alfnnnnyy/Time-Awareness-Plugin/main/examples/AGENTS.md \
-o AGENTS.md
```
> **Codex CLI** also supports `AGENTS.override.md` โ create that instead
> if you want local overrides that won't be committed to the repo.
### Hermes Agent
Install as a native plugin for automatic injection on every turn:
```bash
# Copy plugin files
mkdir -p ~/.hermes/plugins/time-awareness
cp plugin.yaml __init__.py ~/.hermes/plugins/time-awareness/
# Enable
hermes plugins enable time-awareness
hermes config set plugins.entries.time-awareness.user_timezone "Asia/Jayapura"
# Restart Hermes gateway
/restart
```
Once enabled, temporal context is injected automatically โ no manual command needed.
---
## Configuration
| Variable | Default | Description |
|---|---|---|
| `USER_TIMEZONE` | `"UTC"` | Any IANA timezone (e.g. `"Asia/Jayapura"`, `"America/New_York"`) |
| `TIME_CONTEXT_STATE` | `~/.time-context/session_state.json` | Path to session state file for delay tracking |
---
## Timezone Reference
Supports **~600 IANA timezones**. Common examples:
| Location | IANA Timezone | Offset |
|---|---|---|
| Jayapura, Indonesia (WIT) | `Asia/Jayapura` | +09:00 |
| Jakarta, Indonesia (WIB) | `Asia/Jakarta` | +07:00 |
| Makassar, Indonesia (WITA) | `Asia/Makassar` | +08:00 |
| Tokyo, Japan | `Asia/Tokyo` | +09:00 |
| Shanghai / Beijing | `Asia/Shanghai` | +08:00 |
| London, UK | `Europe/London` | +00:00/+01:00 |
| New York, USA | `America/New_York` | -05:00/-04:00 |
> Run `python3 -c "import zoneinfo; print(*sorted(zoneinfo.available_timezones()), sep='\\n')"` to see them all.
---
## How It Works
`time_context.py` is a single-file, zero-dependency Python script that:
1. Reads the current UTC time (`datetime.now(timezone.utc)`)
2. Resolves the user's timezone from `USER_TIMEZONE` (or falls back to UTC)
3. Calculates the server timezone offset from `time.timezone`
4. Converts UTC to user local time
5. Tracks message delay per session via a JSON file in `~/.time-context/`
6. Outputs the formatted block in your chosen format
### Hermes plugin mode
When loaded as a Hermes plugin, the `pre_llm_call` hook fires automatically before every API call. The temporal context is injected into the **user message** โ not the system prompt โ so the prompt cache stays warm. Delay tracking uses in-memory state (the plugin runs in a long-lived process).
---
## Project Structure
```
time-context/
โโโ README.md # This file
โโโ LICENSE # MIT
โโโ time_context.py # โญ Universal CLI script (use this)
โโโ plugin.yaml # Hermes plugin manifest
โโโ __init__.py # Hermes plugin code
โโโ install.sh # Interactive installer
โโโ examples/
โโโ CLAUDE.md # Claude Code / Codex CLI integration
โโโ AGENTS.md # OpenCode integration
```
> Use `time_context.py` for any agent. The `plugin.yaml` + `__init__.py` are only needed for Hermes native-plugin mode.
---
## Requirements
- **Python 3.9+** (stdlib only โ `zoneinfo` built in)
- Nothing else
---
## License
MIT ยฉ [Alfnnnnyy](https://github.com/Alfnnnnyy)
tools
Comments
Sign in to leave a comment