@pi-kode/context0.1.0
Standalone pi extension: PIKODE.md / .pi/rules (with CLAUDE.md / .claude/rules compatibility) memory and context loading
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@pi-kode/context
Standalone pi extension for loading project memory instructions (PIKODE.md, .pi/rules, with full CLAUDE.md and .claude/rules compatibility), composing the session system prompt, and providing bundled planning, verification, and review resources.
Capabilities
Memory and Instruction Loading
Memory is loaded automatically on session_start, session_tree, and session_compact. Both pi-kode (PIKODE.md / .pi/rules) and Claude-compatible (CLAUDE.md / .claude/rules) files are loaded together:
Global memory:
~/.pi/PIKODE.mdand~/.claude/CLAUDE.mdAncestor hierarchy: Walks from the filesystem root down to the working directory (
cwd), loadingPIKODE.md,.pi/PIKODE.md,PIKODE.local.md,CLAUDE.md,.claude/CLAUDE.md, andCLAUDE.local.mdat each level.Project rules: Recursively loads
.mdfiles from<cwd>/.pi/rules/and<cwd>/.claude/rules/in alphabetical order (symlinks are skipped).Path-scoped rules: Rule files in
.pi/rules/or.claude/rules/with YAML frontmatter definingpaths:globs are loaded lazily only when a matching file undercwdis read viareadorRead:--- paths: - "src/**/*.ts" --- Rule instructions here...Descendant directory instructions: Reading a file in a subdirectory of
cwd(viareadorRead) lazily loads anyPIKODE.md,.pi/PIKODE.md,CLAUDE.md, or.claude/CLAUDE.mdalong intermediate directories betweencwdand that file, appending them to the tool result.@importdirectives: Memory and rule files can reference additional files using@relative/path.md(outside fenced code blocks), resolved relative to the importing file up to a maximum depth of 5. Imports outsidecwdand files larger than 200 KB are skipped.Deduplication: Files are deduplicated by canonical realpath, and the extension guards against duplicate registration in the same session.
System Prompt Composition
On before_agent_start, the extension composes the session system prompt from:
- The bundled working-agreement prompt (
lib/resources/system.md) - Permission-mode guidance
- Runtime, active model, and working directory metadata
- Active registered tools and their descriptions
piproject context files and loaded unscoped memory instructions- Discovered skills, custom sections, and prompt/tool guidelines
Bundled Skills and Prompts
Discovered automatically via resources_discover:
- Skills
compat-plan— plan substantial coding changes before implementation (usesEnterPlanMode/ExitPlanModewhen available).compat-verify— verify completed code changes with relevant project checks before reporting success.
- Prompt templates
pk-review— inspect current changes for correctness, regressions, and missing verification.
Commands
| Command | Description |
|---|---|
/pk-memory |
Show loaded PIKODE.md, .pi/rules, CLAUDE.md, and .claude/rules memory instructions. |
/pk-prompt |
Inspect the active composed system prompt and tools. |
Installation
@pi-kode/context is published as a public npm package under the @pi-kode scope.
Install it with pi:
pi install npm:@pi-kode/context
To install project-locally instead of globally:
pi install npm:@pi-kode/context -l
Peer Dependencies
@earendil-works/pi-coding-agent(1.5.2)typebox(1.3.27)
Contributing & Development
See CONTRIBUTING.md for local setup, running type checks, architecture guidelines, and the release process.