Quartermaster-Labs

Pi On Demand Context — AI skill for Claude Code

AI community

Pi extension: auto-load CLAUDE.md / AGENTS.md context when the model navigates dirs with bash cd.

How to install Pi On Demand Context

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Quartermaster-Labs/pi-on-demand-context and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Pi On Demand Context does

Pi extension: auto-load CLAUDE.md / AGENTS.md context when the model navigates dirs with bash cd.

Alternatives in AI

  • Open Multi Agent — TypeScript multi-agent orchestration engine — one runTeam() call from goal to result 5.8k ★
  • Axonhub — ⚡️ Open-source AI Gateway — Use any SDK to call 100+ LLMs 3.2k ★
  • Gentle AI — Agent Skills Index — When working on this project, load the relevant skill(s) BEFORE writing any code 1.9k ★

README

pi-on-demand-context

A [pi](https://github.com/earendil-works/pi-coding-agent) extension that auto-loads `CLAUDE.md` / `AGENTS.md` context files when the model works in a directory — by `cd`-ing into it, or by touching a file there with `read` / `edit` / `write` / `grep` / `ls` / `find`. No special tools, no flags.

Pi loads context files for the **launch directory** (and its parents) at startup. Deeper directories stay invisible: `cd services/api` mid-session and its `CLAUDE.md` never enters the conversation. This extension closes that gap — the moment the model touches a new directory, that directory's context files are injected into the conversation, once, durably, before the model's next response.

How it works

  • **Triggers** — after every tool result, the extension resolves which directory the tool touched:

    • bash — a cd moves the tracked working dir. A plain cd is resolved against the last known dir; cd ... && pwd (or ; pwd) trusts pwd's output, which handles cd -, ~, $VAR, $(...), and paths with spaces.
    • read / edit / write — the touched file's directory.
    • grep / ls / find — the searched directory.

    File tools do **not** move the bash working dir (bash subshells own that); they just load context.

  • **Discovery** — walks from the touched dir **upwards**, collecting `CLAUDE.md` / `AGENTS.md` (64 KB cap per file), stopping at pi's launch dir so it never scans above the project. Files are ordered deepest-first — deeper files override broader parents where they conflict.

  • **Injection** — not-yet-seen files are sent as one **durable** message (`sendMessage`, `deliverAs: "steer"`), awaited inside the `tool_result` hook so it lands right after the tool result — before the model's next thinking block. Being durable session history, it is never re-sent: no per-call token tax, and revisiting a dir costs nothing.

  • **TUI** — the injection renders as a single compact line, `loaded