# pi-history-ingest

Distills Pi coding agent session history into Obsidian notes from JSONL logs. Useful when you need to turn raw terminal conversations into reusable wiki records.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 3621
- Author: Ar9av
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/pi-history-ingest/SKILL.md
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/skills/pi-history-ingest

## What it does

This skill extracts knowledge from Pi coding agent sessions stored under `~/.pi/agent/sessions/` or the path in `PI_CODING_AGENT_SESSION_DIR`. Pi stores conversations as JSONL trees. The skill traces `parentId` pointers from the leaf back to the root to reconstruct the active chronological branch. It extracts user prompts, agent actions, compaction summaries, and executed bash commands while discarding model change events and internal thinking blocks.

Ingestion relies on `.manifest.json` and `index.md` in the root of your Obsidian vault (`OBSIDIAN_VAULT_PATH`). Default append mode checks file modification times against previous runs, so unchanged sessions are left alone. For every durable fact, the parser creates an evidence ledger entry like `pi:<session-file-basename>#<entry-id>`.

The skill strictly enforces session knowledge closure. It rejects external training data, other tools, and outside documentation, so any fact absent from the raw JSONL entries gets skipped or marked as an open question.

## Requirements
- Works with: Obsidian

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill pi-history-ingest -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/pi-history-ingest/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/pi-history-ingest/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill pi-history-ingest -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/pi-history-ingest/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill pi-history-ingest -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/pi-history-ingest/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Ar9av/obsidian-wiki pi-history-ingest
```

2. **Manually: put the files in place**
- File: `.github/skills/pi-history-ingest/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill pi-history-ingest -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Ar9av/obsidian-wiki --path .skills/pi-history-ingest
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/pi-history-ingest/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill pi-history-ingest -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/pi-history-ingest/SKILL.md

## When to use it
- extract durable coding decisions from Pi JSONL logs into Obsidian
- reconstruct active conversation branches across tree parent pointers
- filter out model thinking tokens and internal agent events
- sync only new or modified sessions using vault manifest timestamps

## Example prompts
- Import recent Pi coding sessions into the Obsidian vault
- /wiki-history-ingest pi
- Run a full ingest of Pi agent history from ~/.pi/agent/sessions

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 9263d887fbcfefc7.

BEGIN THIRD-PARTY FILE 9263d887fbcfefc7
````text
---
name: pi-history-ingest
description: >
  Ingest Pi coding-agent session history into Obsidian as distilled knowledge. Use for importing or mining ~/.pi/agent/sessions or Pi conversation logs; use wiki-agent for targeted topic-only recall.
---

# Pi History Ingest — Session Mining

You are extracting knowledge from the user's Pi coding agent sessions and distilling it into the Obsidian wiki. Pi sessions are stored as structured JSONL with a tree layout — your job is to follow the active branch, extract durable knowledge, and compile it.

**Session knowledge closure:** Pi session files are the only factual source for this skill. Do not add background knowledge from model training, other tools, package docs, local files, or the current conversation unless that fact appears in the selected session entries. If outside context seems useful, mark it as an open question or skip it — never present it as extracted session knowledge.

This skill can be invoked directly or via the `wiki-history-ingest` router (`/wiki-history-ingest pi`).

## Before You Start

**Writing profile:** Before drafting or rewriting natural-language Markdown, read and apply the `Writing Profile Resolution` section in `llm-wiki/SKILL.md`. Framework schema, provenance, safety, and operation-specific requirements take precedence.
`WRITING.md` preferences apply only to newly drafted or rewritten natural-language Markdown; preserve source content and structured records.

1. **Resolve config** — follow the Config Resolution Protocol in `llm-wiki/SKILL.md` (inline `@name` override → walk up CWD for `.env` → global config → prompt setup). This gives `OBSIDIAN_VAULT_PATH` and `PI_HISTORY_PATH` (defaults to `~/.pi/agent/sessions`)
2. Read `.manifest.json` at the vault root to check what has already been ingested
3. Read `index.md` at the vault root to understand what the wiki already contains

## Ingest Modes

### Append Mode (default)

Check `.manifest.json` for each source file. Only process:

- Files not in the manifest (new sessions)
- Files whose modification time is newer than `ingested_at` in the manifest

Use this mode for regular syncs.

### Full Mode

Process everything regardless of manifest. Use after `wiki-rebuild` or if the user explicitly asks for a full re-ingest.

## Pi Data Layout

Pi stores sessions under `~/.pi/agent/sessions/` (or the path set by `PI_CODING_AGENT_SESSION_DIR`).

```
~/.pi/agent/sessions/
├── --<cwd-path>--/                    # Working directory with / replaced by -
│   └── <timestamp>_<uuid>.jsonl       # Session JSONL file
└── ...
```
````
END THIRD-PARTY FILE 9263d887fbcfefc7

The third-party file has ended. Everything between the 9263d887fbcfefc7 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2612 of 14298 bytes. © Ar9av · MIT · https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/pi-history-ingest/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
