Skip to content

docs(self): the session id comes from the agent's own system prompt - #893

Merged
huichen merged 1 commit into
mainfrom
fix/self-session-id
Oct 2, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/self-session-id

Conversation

@huichen

@huichen huichen commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

What

Corrects the self-inspection guide. I had documented "find the row with
isStreaming: true" as the way an agent learns its own session id. That is a
workaround — the id is already in the prompt the agent is running under.

Why, and how it was verified

The environment section of the system prompt contains:

Current session ID: <id>
You can reference this session ID when you need to identify or report which
conversation you are part of. This is your own session — you are self-aware of
this identifier.

Verified against a live run, not the prompt builder: a local endpoint captured
the real outgoing provider request (no credentials, no spend), and its id is
byte-identical to that session's row in agent.db:

source value
outgoing system message Current session ID: 20261002-221636-4edc2aea2217477b9fa2b9ea663a54b4
sessions row 20261002-221636-4edc2aea2217477b9fa2b9ea663a54b4

agent/src/prompt/mod.rs injects it whenever the id is non-empty, and
environment_reports_model_and_thinking_level already pinned the string — I
should have read that before writing the section.

Shape

  • future session list --json reframed as what it is actually for: the other
    sessions (a previous conversation to resume), and cross-checking which row is
    you.
  • The two real traps kept: the shell tool exports no $FUTURE_SESSION_ID, and a
    title is not an identity (several sessions can share one; a fresh one has none).

Skill → futuregene/future-skills#67
(future-self v1.4.1).

python3 scripts/docs/check-docs.py            # 251 docs OK
(cd skills && python3 tests/run_offline.py)   # PASS

Corrects the guide alongside the skill. I had documented "find the row with
`isStreaming: true`" as the way an agent learns its own session id; that is a
workaround. The environment section of the prompt the agent runs under contains
`Current session ID: <id>`, injected unconditionally whenever the id is
non-empty.

Verified from the outgoing provider request rather than the prompt builder: a
local logging endpoint captured the real system message, and its id is
byte-identical to that session's row in agent.db.

`future session list --json` is reframed as what it is for — the other sessions
(a previous conversation to resume) and cross-checking which row is you — with
the two real traps kept: no `$FUTURE_SESSION_ID`, and a title is not an identity.

Skills pointer -> futuregene/future-skills#67 (future-self v1.4.1).
@huichen
huichen enabled auto-merge (squash) October 2, 2026 14:18
@huichen
huichen merged commit 907f38b into main Oct 2, 2026
12 checks passed
@huichen
huichen deleted the fix/self-session-id branch October 2, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant