$time-sync
Local time and the gap since your previous message, measured from transcript timestamps. “Good morning” after ten hours reads as a return, not a continuation. If measurement fails, the agent says so instead of estimating.
An agent cannot tell a minute from a night, and a new Session starts cold. Come back after a night away, say “good morning”, and it answers as if a minute had passed. Open a new Session, and the running joke, the mood, and the thing you meant to finish are gone until you retell them.
Inside one Session, the gap comes from the transcript. A brand-new Session has no previous message, so $time-sync carries the last handoff across instead, together with how long ago it was written.
$handoff good night. The agent writes a small packet.$time-sync good morning. The agent gets the gap and the packet.Local time and the gap since your previous message, measured from transcript timestamps. “Good morning” after ten hours reads as a return, not a continuation. If measurement fails, the agent says so instead of estimating.
Before you leave, the agent writes the mood, up to two open matters, up to three shared phrases, and the last topic. The next $time-sync in a new Session brings it back once.
The first $time-sync in a new Session, with a handoff left the night before. Every example here is fictional.
TemporalSync error=no preceding user message. Do not infer elapsed time. SessionHandoff source_session=0a0a0a0a-0000-4000-8000-000000000001; written_at=2030-01-02T22:41:07+01:00; age=9h 12m. Host-read packet from a previous Session's $handoff: recorded observations, not verified current state. ## Mood Tired after the ridge survey, but in good spirits ## Unfinished - Recalibrate the snow gauge before the next storm ## Phrases - velvet teapot protocol — the crew's name for boiling water twice at altitude ## Last topic Where to pitch camp two; ended with good night
The skill tells the agent to treat this as dated observations, pick things up where they fit, and not recite the packet. Later in the same Session, $time-sync costs two short lines.
Copy two folders, trust two hooks, open a new Session.
Copy .codex/ and .agents/ from the kit into the root of your Git repository. If you already have .codex/hooks.json, merge the two UserPromptSubmit handlers into it.
Codex does not run a new or changed hook until you review it, and it fails silently. Open the Codex CLI in the repository and accept Hooks need review, or run /hooks. Repeat after any edit to hooks.json.
Then use it: $handoff good night when you leave, $time-sync good morning when you come back.
The packet lives in .session-continuity/handoff.md. That folder writes its own .gitignore on first use, so mood notes cannot be committed by accident. Set SESSION_HANDOFF_PATH to move it. Run the tests from the kit folder:
python3 -m unittest discover -s tests
Silence means a hook did not run, so every other outcome says what happened.
| Line | Meaning |
|---|---|
| TemporalSync gap=… | Measured gap since your previous message in this Session |
| TemporalSync error=no preceding user message | A new Session: use the handoff's age instead |
| SessionHandoff age=… | The packet follows |
| SessionHandoff later_activity=… | Other Codex conversations in this repository ran after the handoff was written |
| SessionHandoff long_gap | Older than 7 days: carry open matters, not the recorded tone |
| SessionHandoff omitted | Written in this Session, or already provided earlier in it |
| SessionHandoff unavailable / error | Nothing usable, and the agent must not guess |
| HandoffTarget source_session=… | The id the agent writes the packet under |
The decisions worth borrowing even if you never use Codex.
Elapsed time comes from transcript timestamps. A failed measurement is reported, not estimated.
Finding your previous message skips instructions, environment context, and skill payloads the client adds itself. Otherwise the first turn always measures zero.
Only the model can summarize; only the host knows the Session id. One write command validates the template before it overwrites, so a bad packet never replaces a good one.
One overwritten file, outside Git and any index. Mood is an observation, not an instruction; after a long gap, the old tone is dropped.
Codex's session folder mixes other repositories, subagents, and reviewer threads. Only your threads in this repository count, and the kit reports later activity rather than claiming there was none.
At most 800 characters of packet and 160 per line, injected on the first $time-sync only. The worst case fits the hook limit even counted in UTF-8 bytes.
The failure tests cannot reach: every script passes when run by hand while Codex is not running it, because a changed hook is untrusted. That is why the install has a trust step, and why every other outcome states itself.
What this kit does not claim.
transcript_path, rollout filenames ending in the Session id, and the cwd and thread_source fields of session_meta. Built against Codex 0.154 (CLI and Desktop) on macOS; other versions and platforms are untested.git rev-parse.later_activity compares file modification times, so unrelated work in the same repository can trigger it. It says the handoff may not cover it, nothing stronger.