#3539·Archon

bug(providers): Pi sendQuery ignores persistSession and always writes a session JSONL

Author: skargaklopCreated Sep 26, 2026Updated Sep 26, 2026

Problem

In-process Pi queries always persist a session transcript, even when the caller asks for an ephemeral session.

On current main, resolvePiSession() creates a durable session whenever there is no resume id:

typescript
if (!resumeSessionId) {
  return { sessionManager: SessionManager.create(cwd), resumeFailed: false };
}

packages/providers/src/community/pi/provider.ts also calls resolvePiSession(cwd, resumeSessionId, requestOptions?.forkSession) and never forwards requestOptions.persistSession.

SessionManager.create(cwd) writes ~/.pi/agent/sessions/<encoded-cwd>/<uuid>.jsonl. Claude already honors AgentRequestOptions.persistSession, and the Pi CLI --no-session flag maps to SessionManager.inMemory(). Archon's Pi provider does not.

This matters for fire-and-forget calls such as title generation and context: fresh workflow nodes. Those transcripts are not resume state. On a long workflow they accumulate under the workflow CWD slug and make later context windows harder to reason about. A local audit of title sessions showed two-message throwaway calls still persisted as JSONL.

Possible solution

  1. Extend resolvePiSession() with persistSession = true.
  2. When there is no resumeSessionId and persistSession === false, return SessionManager.inMemory(cwd) instead of SessionManager.create(cwd).
  3. Pass requestOptions?.persistSession from packages/providers/src/community/pi/provider.ts.
  4. In packages/core/src/services/title-generator.ts, set persistSession: false on the title SendQueryOptions. Title generation is not resumable.
  5. In packages/workflows/src/dag-executor.ts, set persistSession: false when node.context === 'fresh'. Fresh-context nodes already refuse resume, so their JSONL is leftover transcript, not session state.
  6. Add unit coverage for:
    • no resume id + persistSession: false => SessionManager.inMemory
    • no resume id + default/true => SessionManager.create
    • title generation always requests persistSession: false
    • a fresh-context DAG node forwards persistSession: false

I verified this against main today. I have a local patch, but I cannot push a branch to coleam00/Archon (403). Happy to open a PR from a fork if that is preferred.