@davehardy20/pi-mulch
Pi package that integrates Mulch priming, search, draft review, and session-aware learning workflows.
Package details
Install @davehardy20/pi-mulch from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@davehardy20/pi-mulch- Package
@davehardy20/pi-mulch- Version
0.1.1- Published
- May 21, 2026
- Downloads
- 35/mo · 35/wk
- Author
- davehardy20
- License
- MIT
- Types
- extension
- Size
- 67.3 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@davehardy20/pi-mulch
Pi package for Mulch-aware priming, search, status, and draft review workflows.
What it adds
- session-start Mulch detection (
mulchorml) - one-time repo-local prompt to run
mulch initwhen.mulch/is missing - hidden
before_agent_startpriming viamulch prime - touched-file tracking from common Pi tool activity
- LLM-callable tools:
mulch_primemulch_searchmulch_querymulch_learnmulch_status
- user commands:
/mulch-init/mulch-prime/mulch-search/mulch-query/mulch-learn/mulch-status/mulch-review/mulch-apply
- session-end draft generation gated on clean post-turn-linter status
Install
From npm:
pi install npm:@davehardy20/pi-mulch
For one run only:
pi -e npm:@davehardy20/pi-mulch
From a local checkout during development:
pi install /absolute/path/to/pi-mulch
Settings
Configure in ~/.pi/agent/settings.json:
{
"mulch": {
"enabled": true,
"command": null,
"cliCandidates": ["mulch", "ml"],
"injectionMode": "manifest",
"primeBudget": 4000,
"promptOnMissingInit": true,
"persistInitDecline": true,
"draftMode": "session-end",
"draftDir": ".mulch/drafts",
"initStateFile": ".pi/mulch-integration.json",
"maxTrackedFiles": 24,
"llmTools": [
"mulch_prime",
"mulch_search",
"mulch_query",
"mulch_learn",
"mulch_status"
]
}
}
Use top-level mulch settings. Do not put this config under Pi's top-level
extensions key, because Pi reserves extensions for extension file paths and
package sources, not per-extension config.
If ~/.pi/agent/settings.json is missing, invalid, or does not contain Mulch
settings, pi-mulch uses its built-in defaults. Repo-local .pi/settings.json
files are ignored for Mulch configuration.
For safety:
commandandcliCandidatesare only honored from global Pi settingsdraftDirandinitStateFileare always confined to the current repo root, even if configured otherwise
Draft workflow
The extension is designed to create draft Mulch learnings at
session end. You should not need to run ml learn and ml record ... just to get draft records created when draftMode is set to
"session-end".
Normal flow
- Pi session runs with the extension enabled.
- The extension injects Mulch context at
before_agent_start. - When
draftModeis"session-end", relevant files were touched, and the post-turn-linter finished cleanly, the extension can generate draft records at session end. - Drafts are written to
.mulch/drafts/. - You review drafts with
/mulch-review. - You apply drafts with
/mulch-apply. - After applying drafts to real Mulch records, run
ml syncto validate and commit.mulch/changes.
Important distinction
- Automatic when enabled: session-end draft generation into
.mulch/drafts/ - Manual review step:
/mulch-reviewand/mulch-apply - Manual persistence/sync step:
ml sync
When to use ml learn and ml record
Use ml learn and ml record ... when you want to create or curate
Mulch records directly yourself, outside the extension's automatic
draft workflow.
Build and test
npm run typecheck
npm run test
npm run build