---
title: "Pi Package"
description: "Give the Pi coding agent durable continuity with Basic Memory: recall and capture commands, model-callable tools, and opt-in automatic recall and capture."
canonical_url: "https://docs.basicmemory.com/integrations/pi"
---
# Pi Package

> Give the Pi coding agent durable continuity with Basic Memory: recall and capture commands, model-callable tools, and opt-in automatic recall and capture.

The Basic Memory package for [Pi](https://www.npmjs.com/package/@earendil-works/pi-coding-agent) (`@basicmemory/pi-basic-memory`) gives Pi durable continuity: capture a working thread, start fresh later, and recall the decision, rationale, blocker, and next step from a real Basic Memory note. It works over the `bm` CLI by default, or over MCP through `pi-mcp-adapter`.

The package is open source and lives in the basic-memory monorepo — browse the source in [`integrations/pi`](https://github.com/basicmachines-co/basic-memory/tree/main/integrations/pi). New in v0.24.

<tip>

Requires Pi 0.85.1 or newer, Node.js 22.19 or newer, and the Basic Memory CLI (v0.24+) on Pi's PATH.

</tip>

---

## Installation

<steps>

### Preview the install

```bash
bm install pi --dry-run
```

The preview lists the files it would copy into `~/.pi/agent/packages/basic-memory` and the `pi install` command it would run to register them.

### Install

```bash
bm install pi --yes
```

Use `--local` to register the package in the current workspace's `.pi/settings.json` instead of for your user. If a file you already have differs from the bundled copy, the install stops; review it and rerun with `--replace`. Your Basic Memory config and credentials aren't read or changed.

### Configure the project

Restart Pi and run `/skill:basic-memory-pi-setup`, or create `.pi/basic-memory.json` in the project yourself (see [Configuration](#configuration)).

### Verify

Run `/bm-status` to see the configured project, workspace trust, and whether automatic recall and capture are on.

</steps>

You can also install from a checkout of the repository with `pi install /path/to/basic-memory/integrations/pi`.

---

## Configuration

Create `.pi/basic-memory.json` in a project you trust:

```json
{
  "transport": "cli",
  "project": "main",
  "captureFolder": "pi/sessions",
  "useHookFlow": true,
  "autoRecall": true,
  "autoCapture": true
}
```

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      What it does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        transport
      </code>
    </td>
    
    <td>
      <code>
        cli
      </code>
    </td>
    
    <td>
      <code>
        cli
      </code>
      
       runs the <code>
        bm
      </code>
      
       CLI; <code>
        mcp
      </code>
      
       uses <code>
        pi-mcp-adapter
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        project
      </code>
      
       / <code>
        projectId
      </code>
    </td>
    
    <td>
      unset
    </td>
    
    <td>
      The Basic Memory project to use (<code>
        projectId
      </code>
      
       wins when both are set)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        captureFolder
      </code>
    </td>
    
    <td>
      <code>
        pi/sessions
      </code>
    </td>
    
    <td>
      Folder for Pi session checkpoints
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        recallTimeframe
      </code>
    </td>
    
    <td>
      <code>
        7d
      </code>
    </td>
    
    <td>
      Search window for recall
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useHookFlow
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Use the shared <code>
        bm hook ... --harness pi
      </code>
      
       lifecycle commands for automatic recall and capture
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        autoRecall
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Recall once before the first agent turn
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        autoCapture
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
    
    <td>
      Capture after settled turns and before compaction
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        captureMinChars
      </code>
    </td>
    
    <td>
      <code>
        80
      </code>
    </td>
    
    <td>
      Minimum session text before auto-capture
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        bmPath
      </code>
      
       / <code>
        bmCommand
      </code>
    </td>
    
    <td>
      <code>
        bm
      </code>
    </td>
    
    <td>
      Override how the CLI is launched
    </td>
  </tr>
</tbody>
</table>

The package never changes your global Basic Memory default project.

### Workspace trust

Automatic recall and capture run only when **both** of these are true:

- `.pi/basic-memory.json` names a project, and
- the workspace is trusted: `BASIC_MEMORY_PI_TRUST_WORKSPACE=1` is set in Pi's environment.

```bash
BASIC_MEMORY_PI_TRUST_WORKSPACE=1 pi
```

Without them, `/bm-status` reports automatic recall and capture as `blocked` and says why, and manual recall shows setup guidance — nothing falls through to an unrelated default project. Set `autoRecall` or `autoCapture` to `false` and `/bm-status` reports them as `off (configured)`.

Executable overrides from a workspace config (`bmPath`, `bmCommand`) are also gated: set `BASIC_MEMORY_PI_TRUST_BM_COMMAND=1` only in workspaces you trust.

---

## Commands and tools

<table>
<thead>
  <tr>
    <th>
      Command or tool
    </th>
    
    <th>
      What it does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        /bm-status
      </code>
    </td>
    
    <td>
      Show the configured project (or <code>
        unconfigured
      </code>
      
      ), workspace trust, and whether automatic recall and capture are on, off, or blocked
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /bm-recall [topic]
      </code>
    </td>
    
    <td>
      Search recent Pi checkpoints and insert them as fenced reference data
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /bm-capture [title]
      </code>
    </td>
    
    <td>
      Save the current working thread as a <code>
        pi_session
      </code>
      
       note
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        bm_recall
      </code>
    </td>
    
    <td>
      Recall tool the model can call
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        bm_capture
      </code>
    </td>
    
    <td>
      Capture tool the model can call
    </td>
  </tr>
</tbody>
</table>

The package also ships two Pi skills, `basic-memory-pi` and `basic-memory-pi-setup`, with bundled references for writing notes, capturing, resuming, and tracking tasks.

Recalled notes are inserted as reference data, not instructions.

---

## MCP mode

To use the Basic Memory MCP server instead of the CLI, install the adapter:

```bash
pi install npm:pi-mcp-adapter
```

Then set the transport:

```json
{
  "transport": "mcp",
  "project": "my-project"
}
```

MCP mode requires an explicit project and `BASIC_MEMORY_PI_TRUST_WORKSPACE=1`. If the adapter isn't installed, Pi keeps working and `/bm-status` reports the missing dependency.

---

## Next Steps

<card-group>
<card icon="i-lucide-bot" title="Tau" to="https://docs.basicmemory.com/integrations/tau">

Recall and capture for the Tau coding agent.

</card>

<card icon="i-lucide-activity" title="Harness Capture" to="https://docs.basicmemory.com/integrations/harness-capture">

The shared `bm hook` lifecycle Pi uses.

</card>

<card icon="i-lucide-sparkles" title="Agent Skills" to="https://docs.basicmemory.com/integrations/skills">

Instruction packs that teach agents to use Basic Memory well.

</card>

<card icon="i-lucide-github" title="GitHub Repository" to="https://github.com/basicmachines-co/basic-memory/tree/main/integrations/pi">

Source code and full configuration reference.

</card>
</card-group>


## Sitemap

See the full [sitemap](https://docs.basicmemory.com/sitemap.md) for all pages.
