Keep context across sessions

Write down what the next session needs, close to the work it describes.

Use a thread for lasting context

A thread is a directory in your workspace. Keep its purpose and standing instructions in context.md, source material in in/, and results in out/.

onboarding/
  context.md
  in/
    interview-notes.md
  out/
    proposed-changes.md

The folder can hold other files your work needs. It does not have to be a code project.

Write instructions that survive a handoff

Use context.md for the goal, constraints, important references, and working conventions. Keep current decisions and next steps in a clearly named note. Ask the agent to update these when the plan changes.

Before you finish, record what changed, what is still unresolved,
and the next step. Include the paths of the files a new session should read.

Layer broad and specific instructions

A parent thread can describe the wider project; a child thread can hold one narrower task. The thread skill reads ancestor context from broad to specific, then the current thread’s context. Keep instructions at the level where they apply.

A shape describes a folder structure you want to reuse. A loop describes how to work through a repeatable process. Neither is the conversation itself.

Coordinate across threads

When the work spans several threads, keep priorities and cross-thread decisions in the Index thread. An agent working there can inspect the other threads, start or contact their sessions, and bring the results together. Keep detailed source material and outputs in the threads that own the work.

Reorganize without losing sessions

As work grows, ask an agent to rename or move threads into a structure that fits. Haicue’s thread-move operation preserves session associations and updates stored references to the moved threads. You can coordinate these changes from the Index thread.

Understand the boundary

Two sessions on a thread can read the same files. They do not automatically share every message, tool result, or private reasoning step. Ask a new session to read the relevant files, and give it a specific handoff.

The context meter describes the agent conversation, not the amount of material stored in the thread. Saving a file preserves it; the next agent still needs to read it.

Inspect before acting

hai thread.inspect projects/onboarding
hai thread switch projects/onboarding

thread.inspect reads the thread’s context and state. thread switch changes the calling session’s current thread and clears its Stay pin. Use the second command only when moving the work.