Back to the catalog

gemini-time-injector

Inject real wall-clock time into the model on every Gemini CLI lifecycle event. Cures the LLM's blind spot for elapsed time.

Open source Open in the app JSON README (API)

About

Inject real wall-clock time into the model on every Gemini CLI lifecycle event. Cures the LLM's blind spot for elapsed time.

Details

Kind
Plugins
Topic
AI, RAG & memory
Publisher
kongyo2
Origin
gemini
Category
ferramentas
Version
0.1.0
Stars
1
Last push
2026-05-13T09:54:20Z
Repository state
ativo
Language
JavaScript
License
MIT
Added
2026-08-30 14:13:39
Updated
2026-08-30 14:13:39
Origin id
kongyo2/gemini-time-injector

README

# gemini-time-injector

A [Gemini CLI](https://github.com/google-gemini/gemini-cli) extension that
gives the model a sense of real-world time.

LLMs have no built-in clock. Once a session begins they cannot tell:

- what day or time it is right now,
- how long the user took to reply,
- how long a tool call (compile, test run, shell command) actually took,
- how long the overall session has been running.

`gemini-time-injector` plugs into every Gemini CLI hook event and pushes the
current wall-clock time back into the model's context — so the model can
reason about elapsed time the same way you do.

## What it does

| Hook event      | What gets injected                                                       |
| --------------- | ------------------------------------------------------------------------ |
| `SessionStart`  | Current UTC + local time, timezone, and a primer note for the model.     |
| `BeforeAgent`   | Refreshed wall-clock time, session elapsed, idle gap since last event.   |
| `BeforeTool`    | (silent) records tool start time for accurate duration measurement.      |
| `AfterTool`     | Tool name, exact tool duration, current wall-clock time.                 |
| `AfterAgent`    | (system message) turn duration, suppressed from the model.               |
| `SessionEnd`    | Final session duration; cleans up state.                                 |

Injected content is wrapped by the CLI in `<hook_context>…</hook_context>`
so the model can see it but it does not pollute the user-facing transcript.

## Install

```bash
gemini extensions install https://github.com/kongyo2/gemini-time-injector
```

…or, for local development:

```bash
git clone https://github.com/kongyo2/gemini-time-injector
gemini extensions link ./gemini-time-injector
```

After installing, restart your Gemini CLI session. You should see a
`time-injector: session start …` system message once per session.

### Requirements

- Gemini CLI ≥ 0.44 (hooks + extension support).
- Node.js ≥ 20 (uses ESM, `node:test`, top-level `import.meta.url`).

## License

MIT

More