Skip to content

Sessions

How mikan separates platform chat history from the agent harness's structured sessions.

Platform chat history

log.jsonl keeps human-readable platform messages used to bootstrap thread or reply context.

Harness structured context

sessions/*.jsonl stores tool results and agent turns so the mikan agent harness can continue work.

Fixed scope

Threads, reply chains, and shared channels map to fixed session files so different conversations do not contaminate each other.

PlatformsessionKey ruleNotes
Slacktop-level / DM: conversationId; thread: conversationId:threadTsthread sessions are fixed files bootstrapped from recent chat history
DiscordDM: channelId; shared top-level: channelId:messageId; reply/thread: rooted idreplies in shared channels continue the root message session
Telegramprivate: chatId; shared top-level: chatId:messageId; reply chain: root replyno native thread model; shared sessions are inferred from reply chains

A session key always belongs to exactly one conversation. Platform adapters may supply a scoped key, but conversation intake and the runtime reject a key whose conversation prefix differs from the incoming conversation. Conversation identities and scoped suffixes also reject path separators, control characters, and the special . / .. segments before they can influence session storage. Thread session files keep their existing names and persistence behavior; the sessions module additionally rejects symlink session targets and proves derived paths remain inside the conversation’s sessions/ directory.

  • Directoryworkspace/
    • log.jsonl platform message history
    • Directorysessions/
      • current points to the active top-level session
      • *.jsonl structured harness session context, including tool results
      • scope-derived files fixed session files for thread / reply scopes

A new scoped session is seeded from at most 200 applicable platform messages from the previous 14 days. Top-level sessions rotate on a biweekly boundary. Rotation changes the active structured context file; it does not delete older JSONL files.