feat(tools,scheduler): agent time-awareness — get_current_time tool + schedule add --run-at#6441
Merged
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 18, 2026 02:37
…un-at Zeph had no mechanism for the agent to reason about wall-clock time: no tool to query the current time, no time signal injected into the system prompt, and the scheduler's internal one-shot primitive had no CLI or tool-level entry point. Adds a chrono-free, mockable ClockSource abstraction (zeph-common), a get_current_time tool built on it (zeph-tools), an opt-in periodic time-reminder injection into the volatile system prompt, and `zeph schedule add --run-at <rfc3339>` exposing the existing TaskMode::OneShot primitive. Also fixes scheduler hydration, which previously skipped one-shot rows entirely and, once loaded, discarded the user's prompt via a Value::Null config. BREAKING CHANGE: `zeph schedule add` positional argument order is now `<PROMPT> [CRON]` (was `<CRON> <PROMPT>`) — required by clap, which forbids an optional positional preceding a required one once --run-at made the cron argument optional. Pre-1.0.0, documented in CHANGELOG. Closes #6361
bug-ops
force-pushed
the
feat/issue-6361/agent-time-awareness
branch
from
July 18, 2026 02:39
7f96e39 to
cbdf1db
Compare
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClockSourceabstraction (zeph-common), reusing the existingtimestamp.rsRFC3339 formatting helpers instead of adding a chrono dependency.get_current_timetool (zeph-tools) built on that clock, wired into all three production executor chains (CLI, daemon, ACP) via one shared clock instance.agent.time_reminder_enabled/agent.time_reminder_interval_requests, default off) into the volatile system-prompt block, counted in agent turn-cycles rather than literal per-model-requests (the mandated injection hook is architecturally unreachable at per-request granularity — see PR discussion).zeph schedule add --run-at <rfc3339>, exposing the existingTaskMode::OneShotscheduler primitive that previously had no CLI or tool-level entry point.Scheduler::init()hydration, which previously skipped one-shot rows entirely (a CLI-added--run-atjob never fired), and — once that was fixed — was found to discard the user's prompt via aValue::Nullconfig on hydration (akind="custom"one-shot job fired a generic fallback instead of the real prompt). Both are now fixed with regression tests.Breaking change (pre-1.0.0)
zeph schedule addpositional argument order changed from<CRON> <PROMPT>to<PROMPT> [CRON]. This was required by clap, which rejects an optional positional preceding a required one once--run-atmade thecronargument optional. An old-order invocation now fails loudly on cron validation rather than silently misparsing. Documented in CHANGELOG.md.Scope note
Spec
.local/specs/070-agent-time-awareness/spec.md's US-004 (an agent-callable one-shot reminder-creation tool, as opposed to CLI-only) is deferred — the existingschedulernative tool already handles natural-language deferred/periodic scheduling and was left untouched. This PR fully delivers issue #6361's three literal asks (current-time tool, periodic reminder, one-shot CLI scheduling) and closes it.Process note
This went through 2 rounds of architecture critique (a scheduler-hydration blocker was found and fixed before implementation started) and 2 rounds of implementation critique (a critical hydration prompt-loss defect and a significant clock-sharing gap were found post-implementation and fixed), plus clean independent security and performance audits.
Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 14323 passed, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"gitleaks protect --staged.local/testing/playbooks/agent-time-awareness.md.local/testing/coverage-status.mdCloses #6361