kimetsu-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +46 -0
- package/README.md +58 -0
- package/extensions/kimetsu.ts +41 -0
- package/package.json +25 -0
- package/skills/kimetsu-brain/SKILL.md +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Licensed under either of MIT or Apache-2.0 at your option.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 RodCor
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Apache License
|
|
30
|
+
|
|
31
|
+
Version 2.0, January 2004
|
|
32
|
+
http://www.apache.org/licenses/
|
|
33
|
+
|
|
34
|
+
Copyright (c) 2026 RodCor
|
|
35
|
+
|
|
36
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
37
|
+
you may not use this file except in compliance with the License.
|
|
38
|
+
You may obtain a copy of the License at
|
|
39
|
+
|
|
40
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
+
|
|
42
|
+
Unless required by applicable law or agreed to in writing, software
|
|
43
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
44
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
45
|
+
See the License for the specific language governing permissions and
|
|
46
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# kimetsu-pi
|
|
2
|
+
|
|
3
|
+
Kimetsu brain as a Pi.dev package: persistent, cross-session memory for the Pi coding agent.
|
|
4
|
+
|
|
5
|
+
## What it is
|
|
6
|
+
|
|
7
|
+
Pi (the Pi.dev coding agent) has no MCP support, so this package brings Kimetsu's
|
|
8
|
+
persistent memory to Pi through Pi's own extension points instead:
|
|
9
|
+
|
|
10
|
+
- **Extension** (`extensions/kimetsu.ts`) — a TypeScript Pi extension that hooks into
|
|
11
|
+
Pi lifecycle events (`session_start`, `agent_end`, `session_shutdown`) and shells out
|
|
12
|
+
to the `kimetsu` binary to warm, load, and persist brain context around each session.
|
|
13
|
+
- **Skill** (`skills/kimetsu-brain/SKILL.md`) — a Pi skill that teaches the agent when
|
|
14
|
+
and how to consult and record memories during a task.
|
|
15
|
+
|
|
16
|
+
## Prerequisite
|
|
17
|
+
|
|
18
|
+
The `kimetsu` binary must be on `PATH`. Install it with:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install -g kimetsu-ai
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or via cargo, or one of the prebuilt archives — see
|
|
25
|
+
[github.com/RodCor/kimetsu](https://github.com/RodCor/kimetsu) for all install options.
|
|
26
|
+
|
|
27
|
+
If the binary is not found, the extension silently no-ops on every lifecycle hook —
|
|
28
|
+
Pi's startup and session behavior are completely unaffected.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pi install npm:kimetsu-pi
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## What it does on each event
|
|
37
|
+
|
|
38
|
+
| Pi lifecycle event | Kimetsu command run |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `session_start` | `kimetsu brain warm` then `kimetsu brain context-hook` |
|
|
41
|
+
| `agent_end` | `kimetsu brain stop-hook` |
|
|
42
|
+
| `session_shutdown` | `kimetsu brain session-end-hook` |
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npm install
|
|
48
|
+
npm test
|
|
49
|
+
npm run typecheck
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT OR Apache-2.0
|
|
55
|
+
|
|
56
|
+
## See also
|
|
57
|
+
|
|
58
|
+
Main project: [github.com/RodCor/kimetsu](https://github.com/RodCor/kimetsu)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Kimetsu brain extension for Pi (earendil-works/pi).
|
|
2
|
+
// Published as the `kimetsu-pi` npm package. Shells out to the kimetsu binary
|
|
3
|
+
// on Pi lifecycle events to load brain context at session start and record
|
|
4
|
+
// audit markers on session end. If kimetsu is not on PATH the exec silently
|
|
5
|
+
// fails; Pi startup is unaffected.
|
|
6
|
+
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
function kimetsuExec(args: string[]): Promise<void> {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
try {
|
|
12
|
+
const child = spawn("kimetsu", args, {
|
|
13
|
+
stdio: "ignore",
|
|
14
|
+
shell: false,
|
|
15
|
+
windowsHide: true,
|
|
16
|
+
});
|
|
17
|
+
child.on("error", () => resolve()); // binary not on PATH — silent no-op
|
|
18
|
+
child.on("close", () => resolve());
|
|
19
|
+
} catch {
|
|
20
|
+
resolve(); // any unexpected error — silent no-op
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function (pi: any) {
|
|
26
|
+
// session_start fires once when Pi starts up or a new session begins.
|
|
27
|
+
pi.on("session_start", async (_event: any, _ctx: any) => {
|
|
28
|
+
await kimetsuExec(["brain", "warm"]);
|
|
29
|
+
await kimetsuExec(["brain", "context-hook"]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// agent_end fires after the LLM turn completes (maps to Kimetsu stop-hook).
|
|
33
|
+
pi.on("agent_end", async (_event: any, _ctx: any) => {
|
|
34
|
+
await kimetsuExec(["brain", "stop-hook"]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// session_shutdown fires on clean session close (maps to session-end-hook).
|
|
38
|
+
pi.on("session_shutdown", async (_event: any, _ctx: any) => {
|
|
39
|
+
await kimetsuExec(["brain", "session-end-hook"]);
|
|
40
|
+
});
|
|
41
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kimetsu-pi",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Kimetsu brain as a Pi.dev package — persistent cross-session memory for the Pi coding agent.",
|
|
5
|
+
"keywords": ["pi-package", "pi", "kimetsu", "memory", "extension", "skill"],
|
|
6
|
+
"homepage": "https://github.com/RodCor/kimetsu-pi#readme",
|
|
7
|
+
"repository": { "type": "git", "url": "git+https://github.com/RodCor/kimetsu-pi.git" },
|
|
8
|
+
"license": "MIT OR Apache-2.0",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"pi": {
|
|
11
|
+
"extensions": ["./extensions"],
|
|
12
|
+
"skills": ["./skills"]
|
|
13
|
+
},
|
|
14
|
+
"files": ["extensions/", "skills/", "README.md", "LICENSE"],
|
|
15
|
+
"engines": { "node": ">=16" },
|
|
16
|
+
"scripts": {
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"typescript": "^5.5.0",
|
|
23
|
+
"vitest": "^2.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kimetsu-brain
|
|
3
|
+
description: Use Kimetsu brain shell commands as a persistent memory sidecar across Pi sessions.
|
|
4
|
+
---
|
|
5
|
+
Kimetsu is a persistent brain sidecar accessible via the `kimetsu` CLI. Use it
|
|
6
|
+
when the task may benefit from prior session knowledge, workflow memory, or
|
|
7
|
+
durable cross-session context.
|
|
8
|
+
|
|
9
|
+
Brain-first workflow:
|
|
10
|
+
1. Before planning or editing broad coding, review, debugging, or setup tasks,
|
|
11
|
+
run `kimetsu brain context <query>` and read the returned capsules as working
|
|
12
|
+
context before deciding on a plan.
|
|
13
|
+
2. After solving a non-obvious problem, run `kimetsu brain record` with a
|
|
14
|
+
concrete, actionable lesson and 2-5 domain tags so future sessions benefit.
|
|
15
|
+
3. Run `kimetsu brain status` when you need to know whether the brain is
|
|
16
|
+
initialized, has accepted memories, or has pending proposals.
|
|
17
|
+
|
|
18
|
+
Optional mode: Kimetsu brain context is a preferred first step for non-trivial
|
|
19
|
+
work. If the binary is unavailable, note the absence and continue normally.
|