@tinoy/pi-canon 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 +21 -0
- package/README.md +30 -0
- package/canon.ts +1751 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tinoy Thomas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @tinoy/pi-canon
|
|
2
|
+
|
|
3
|
+
Durable system-prompt rules ("canon") for pi. Rules and learned facts are stored
|
|
4
|
+
on disk, scoped by model (`global` or a model id) and audience (`all`, `parent`,
|
|
5
|
+
`foreman`, `subagent`), and injected into every matching session's system prompt.
|
|
6
|
+
Runtime edits reach running sessions as notices; the injected block is a
|
|
7
|
+
session-start snapshot, so a running session's prompt never changes mid-session.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi install npm:@tinoy/pi-canon
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
- **Store** — `~/.pi/agent/canon/canon.json`: `{entries: [{id, text, model, audience, reason?, category?}], categories: [{id, title, description?}]}`. Written atomically; a missing or corrupt store reads as empty.
|
|
16
|
+
- **Tools** — `canon_add`, `canon_remove`, `canon_edit`, `canon_category`.
|
|
17
|
+
- **Commands** — `/canon` (list, add, remove, edit, category management) and `/canon-dump`.
|
|
18
|
+
- **Injection** — the block is appended at `before_agent_start` and re-normalized on every provider request, so a run started by an injected message carries the same bytes as an interactive prompt.
|
|
19
|
+
- **Peer notices** — entry changes are broadcast over the pi-intercom bus (namespace `canon`); receivers match the entry scope against their own model and audience.
|
|
20
|
+
- **Tail sections** — another extension contributes prompt text through the `canon:section` event; its ids are published on `canon:sections`.
|
|
21
|
+
|
|
22
|
+
## Dependencies
|
|
23
|
+
|
|
24
|
+
pi supplies these, so they are declared as peer dependencies with `*` and are not
|
|
25
|
+
bundled: `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, `typebox`.
|
|
26
|
+
`@tinoy/pi-ext-lib` is a plain dependency.
|
|
27
|
+
|
|
28
|
+
## Licence
|
|
29
|
+
|
|
30
|
+
MIT — see the repository [LICENSE](../../LICENSE).
|