PanCode
All tutorials

Context and memory4 min read

Keep a long coding task on track

See what fills the context, carry your decisions through a handoff, and resume the right branch of a long task.

Written for
v0.9.0
Works in
Terminal · Desktop alpha
Basis
Documented workflow
Updated
Terminal /context panel after one turn: 12.3k / 272k tokens in use (4.5%), split into system prompt, tool definitions, agent fleet, project context, messages, tool results and assistant output, with 205k free and a 54.4k autocompact reserve; autocompact runs at 80% with 12 active tools, and the next request has 227k of headroom.
/context: the window size, the tokens in use, and what fills them. Terminal · v0.9.2
On this pageGive the project a starting point Inspect before the context fills Reduce with a stated purpose Hand off a defined continuation Recover an interrupted transition explicitly Keep memory reviewable

Long coding work needs more than saved chat history. You need the current objective, the decisions that still apply, the relevant files, and the checks left to run. PanCode gives you controls for inspecting that context and continuing after a session grows.

Four controls for a long task

  1. /context

    Inspect

    Usage, reserved output, remaining headroom, and any pending handoff.

  2. history grows

    /context compact

    Reduce

    A focused summary that keeps what you name.

  3. the work continues

    /handoff

    Hand off

    A continuation bound to this branch and its decisions.

  4. a transition stops

    /context recover

    Recover

    Reduce or deliver, chosen explicitly by its ID.

Inspect first; reduce, hand off, or recover only for a stated reason.

Give the project a starting point

A project handbook orients the model toward the repository's structure and rules. The context commands prepare a PANCODE.md handbook and a structural code index called the codemap.

Shell

pancode context init
pancode context index

Review generated project material as you would any other change. Keep build commands and verification expectations specific to the project: an incorrect handbook makes the wrong answer easier to repeat.

The codemap locates structural information without reading every file into the conversation. It does not replace reading a function before changing its behavior.

Inspect before the context fills

In the terminal, /context shows usage, output reservation, remaining headroom, and any pending handoff. On the desktop alpha, the Session column has Context and Branches cards, and typing / in the composer offers /context, /tree, /fork, and /handoff.

  1. Terminal /context panel after one turn: 12.3k / 272k tokens in use (4.5%), split into system prompt, tool definitions, agent fleet, project context, messages, tool results and assistant output, with 205k free and a 54.4k autocompact reserve; autocompact runs at 80% with 12 active tools, and the next request has 227k of headroom.

    01 /context: the window size, the tokens in use, and what fills them. Terminal · v0.9.2

  2. Terminal after /fork: a notice that the conversation forked into a new session while the original is unchanged and workspace files were not rewound, then the Session tree dock showing where the fork came from, a legend, and the first 10 of 35 turns (You, Panos, tool calls and tool results), with the selected turn's id, time and what Enter does.

    02 /tree after /fork: the branch records where it came from, and Enter continues from an earlier turn. Terminal · v0.9.1

The terminal's context window, and a forked conversation in /tree.

Watch what you are accumulating. A large test log, an old exploration branch, and a current design decision should not carry the same weight. Ask the agent to cite the file or tool result behind an important conclusion instead of a remembered paraphrase.

Reduce with a stated purpose

/context compact Keep the objective, decisions, changed files, test results, and remaining work.

After compaction

Read the continuation. Compaction reduces history; it does not prove that the model kept every fact. If an important constraint disappears, restate it with its source.

Hand off a defined continuation

/handoff <goal> prepares a continuation around a stated goal. A useful goal says what the receiving session should do next and which work must stay intact.

Example handoff goal

/handoff Fix the empty-input parser bug: keep the failing case in tests/parser.test.ts, the chosen approach of validating before tokenizing, and rerun the parser tests before finishing.

Handoffs are bound to the active conversation branch and its decisions. A fork can recall earlier notes without inheriting permission to resume its parent's pending transition. Use /tree and /fork deliberately, and confirm which branch you are continuing.

To return to a session after quitting, run the pancode --resume <id> line from the exit summary; a prefix works when it matches one session, and pancode --continue reopens the most recent one.

Recover an interrupted transition explicitly

If /context shows a pending handoff, use its exact ID:

/context recover <handoffId> reduce
/context recover <handoffId> deliver

These are two different recoveries, not two commands to run in turn. Choose reduce when the reduction has not committed and another attempt remains; choose deliver when the validated commit exists. The continuity guide explains those states.

A restarted process records an interrupted handoff as paused and waits for your command. Do not create a new handoff just because a pending one looks unfamiliar.

Keep memory reviewable

Proactive memory is separate from the working context. Open /memory and use its Review tab to approve a proposed lesson with a, or press x twice to reject it; an observation about one repository should not quietly become a rule for every project.

Global, procedural, runtime, and agent lessons wait for you. A repository note can become a lesson automatically once two other sessions demonstrate it with no contradiction, and a later contradiction demotes it. pancode memory consolidate merges duplicate claims and demotes lessons that no longer hold, with no model call.

In /settings, under Context and memory, Memory connection and Memory model choose where memory's model calls run. Memory runs on rules by default, and its model steps are opt-in; with no route set, one you turn on uses your chat route. Turning Proactive memory off stops task memory, the memory section of the prompt and the memory_note tool.

Stored memory is not fine-tuning of the underlying model. Its value depends on selection, scope, and whether it is still relevant.

Boundaries

  • A summary is a model's reduction, so check it against sources when it matters.
  • A handoff belongs to the branch that prepared it; a fork recalls its notes but cannot resume it.
  • Only lessons influence later sessions, and a repository note can become one automatically after two other sessions demonstrate it, so check /memory.

By Anthony Kougkas · PanCode

Continue with the documentation