ambient context: give every project's model a clock #135

Merged
michal merged 1 commits from feat/ambient-context into main 2026-10-01 23:33:38 +00:00
Owner

Models consuming projects don't know today's date. Always-on, for every project:

  • initialize instructions + begin_session briefing: [context] now: Thu 2026-10-02 10:30 +01:00 Europe/London (09:30 UTC) — project: <name> (frozen at session start by design);
  • get_current_time virtual tool (ungated catalogs, same pattern as read_prompts);
  • per-result trailer: every tools/call response gets a trailing [context] now: … content item at the endpoint send site — covers upstream results, virtual tools, gate intercepts and failure results, and keeps a days-old LibreChat session on today's date (~15 tokens, minute precision, appended as a separate item so JSON-parsing clients are untouched);
  • mcpd agent/project chat system blocks append the same line every turn.

MCPLOCAL_AMBIENT_TZ (IANA name, read by both services) adds the local rendering; unset/invalid → UTC only.

Tests: new ambient-time, plugin-ambient-context, project-mcp-endpoint-ambient suites + extended gate/endpoint/chat-service assertions. Full ./tests.sh --short green (the one mcpd failure was a missing local prisma generate, pre-existing).

🤖 Generated with Claude Code

Models consuming projects don't know today's date. Always-on, for every project: - **initialize instructions + begin_session briefing**: `[context] now: Thu 2026-10-02 10:30 +01:00 Europe/London (09:30 UTC) — project: <name>` (frozen at session start by design); - **`get_current_time` virtual tool** (ungated catalogs, same pattern as `read_prompts`); - **per-result trailer**: every `tools/call` response gets a trailing `[context] now: …` content item at the endpoint send site — covers upstream results, virtual tools, gate intercepts and failure results, and keeps a days-old LibreChat session on today's date (~15 tokens, minute precision, appended as a separate item so JSON-parsing clients are untouched); - **mcpd agent/project chat** system blocks append the same line every turn. `MCPLOCAL_AMBIENT_TZ` (IANA name, read by both services) adds the local rendering; unset/invalid → UTC only. Tests: new `ambient-time`, `plugin-ambient-context`, `project-mcp-endpoint-ambient` suites + extended gate/endpoint/chat-service assertions. Full `./tests.sh --short` green (the one mcpd failure was a missing local `prisma generate`, pre-existing). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
michal added 1 commit 2026-10-01 23:33:33 +00:00
ambient context: give every project's model a clock
Some checks failed
CI/CD / lint (pull_request) Successful in 1m16s
CI/CD / test (pull_request) Successful in 1m26s
CI/CD / typecheck (pull_request) Successful in 3m25s
CI/CD / smoke (pull_request) Failing after 1m57s
CI/CD / build (pull_request) Successful in 5m9s
CI/CD / publish (pull_request) Has been skipped
979e9720c0
Models consuming projects have no idea what day it is. Three always-on
layers from mcplocal plus one from mcpd:

- initialize instructions and the begin_session briefing carry
  '[context] now: <date/time> — project: <name>' (frozen at session
  start by design);
- a get_current_time virtual tool (ungated catalogs only, same pattern
  as read_prompts);
- every tools/call result gets a trailing '[context] now: …' content
  item at the endpoint send site — the only chokepoint that also covers
  virtual tools, gate intercepts and failure results, and the layer
  that keeps a days-old chat session current;
- mcpd agent/project chat system blocks append the same line each turn.

Time renders as UTC plus an optional local timezone from
MCPLOCAL_AMBIENT_TZ (IANA name; both services read it; invalid or unset
means UTC only). ~15 tokens per stamp, minute precision.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
michal merged commit 45b875ae2c into main 2026-10-01 23:33:38 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: michal/mcpctl#135