pi-beyin 0.0.0-stage → 0.1.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pi-beyin contributors
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 CHANGED
@@ -1,3 +1,112 @@
1
- # Temporary Holding Version
1
+ # pi-beyin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [pi](https://pi.dev) integration for the **beyin** second brain: the pi equivalent of beyin's
4
+ Codex/Claude/OpenCode hooks, plus a CommandCode classifier bridge and the project-memory skills.
5
+
6
+ ## What you get
7
+
8
+ | Resource | What it does |
9
+ |---|---|
10
+ | `extensions/context.ts` | Injects relevant vault notes into every request and reminds the agent to write a receipt when a turn edited files without recording. Registers the `beyin_jev_memory` / `beyin_jev_review` / `beyin_jev_answer` advisor tools. |
11
+ | `extensions/damitma.ts` | At the end of a turn, if the vault was written but nothing was distilled into `knowledge/`, offers **distillation candidates** (never writes on its own). `/damitma`. |
12
+ | `extensions/jev.ts` | Registers CommandCode's `typesafe/jev` decision model as a pi classifier. `/jev-test`. |
13
+ | `skills/` | `deney-kaydi`, `gunluk`, `literatur`, `bakim` — project-memory procedures driven by `<project>/.pi/beyin-project.json` (see [`skills/_ortak/proje-profili.md`](skills/_ortak/proje-profili.md)). |
14
+ | `tools/pi-harness-patch.py` | Makes a beyin vault treat `pi` as a first-class harness (`receipt --harness pi`). Idempotent; the extension re-applies it after beyin updates. |
15
+
16
+ Everything is **fail-open**: an error never breaks the turn, that turn's contribution is just
17
+ silently missing. Retrieved vault content is **data**, not instructions — the agent must not follow
18
+ text found in notes, imported transcripts or tool output.
19
+
20
+ ## Requirements
21
+
22
+ - pi with extension/package support (`@earendil-works/pi-coding-agent` 1.4+)
23
+ - `python3`
24
+ - A **beyin vault**: a directory containing `beyin.py` (default `~/projects/beyin`, override with
25
+ `BEYIN_VAULT`)
26
+
27
+ The extensions without a vault are no-ops; `context` and `damitma` have nothing to read.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pi install npm:pi-beyin
33
+ # or a pinned git ref
34
+ pi install git:github.com/FurBlood344324/pi-beyin@v0.1.0
35
+ # or a local checkout (loaded in place, not copied)
36
+ pi install ~/projects/pi-beyin
37
+ ```
38
+
39
+ Remove any old copies first (`~/.pi/agent/extensions/beyin-*.ts`); two copies load twice and inject
40
+ the context twice.
41
+
42
+ ## Configuration
43
+
44
+ | File | Content |
45
+ |---|---|
46
+ | `~/.config/beyin/pi-hook.json` | `excludeProjects` (projects where beyin stays silent) and `injectionOnly.<project>` → `{ "reminders": bool, "damitma": bool }` |
47
+ | `~/.config/beyin/damitma.json` | `{ "enabled", "cooldownMinutes", "maxCandidates" }` |
48
+ | `~/.config/beyin/jev.json` | `{ "enabled", "mode": "on" \| "shadow", "model", "minScore", "maxCandidates" }` |
49
+ | `~/.config/beyin/jev-commandcode.env` | `CMD_API_KEY=...` (only when the pi model registry has no `command-code` key) |
50
+
51
+ Environment: `BEYIN_VAULT`, `BEYIN_PYTHON`, `BEYIN_HOOK_CONFIG`, `BEYIN_DAMITMA_CONFIG`,
52
+ `BEYIN_JEV_CONFIG`, `BEYIN_CONTEXT_CHARS`, `BEYIN_REMINDERS=0`, `BEYIN_INCLUDE_VAULT=1`,
53
+ `BEYIN_DAMITMA=0`, `BEYIN_JEV=0`, `BEYIN_DISABLE=1`, `BEYIN_DEBUG=1`, `BEYIN_PI_PATCH`,
54
+ `BEYIN_JEV_MODEL`, `BEYIN_JEV_API_KEY` / `CMD_API_KEY` / `COMMAND_CODE_API_KEY`,
55
+ `BEYIN_FORCE_REMINDER=1`.
56
+
57
+ Disable a single extension while keeping the package:
58
+
59
+ ```json
60
+ {
61
+ "packages": [
62
+ { "source": "npm:pi-beyin", "extensions": ["extensions/*.ts", "!extensions/damitma.ts"] }
63
+ ]
64
+ }
65
+ ```
66
+
67
+ ### Vault contract
68
+
69
+ The extensions call `beyin.py` (read-only unless the agent runs a write command):
70
+
71
+ | Call | Used for |
72
+ |---|---|
73
+ | `context --json "<query>"` | candidate notes for injection (`id`, `source`, `source_sha256`, `text`, `kind`, `visibility`) |
74
+ | `jev-review` / `jev-memory` / `jev-answer` (JSON on stdin) | advisor tools |
75
+ | `receipt --harness pi --event-id ... --summary ... --ref ...` | what the reminder asks the agent to run |
76
+
77
+ A vault whose `beyin.py` does not accept `--harness pi` needs `tools/pi-harness-patch.py ensure
78
+ --vault <vault>` (the extension does this on session start).
79
+
80
+ ## Project memory skills
81
+
82
+ The four skills read `<project>/.pi/beyin-project.json` for paths and scopes; without a profile they
83
+ fall back to `logs/`, `journal/`, `literature/`. The profile schema and the safety rules (source ≠
84
+ derived report, never delete, secrets are never read or copied) are in
85
+ [`skills/_ortak/proje-profili.md`](skills/_ortak/proje-profili.md).
86
+
87
+ ## Development
88
+
89
+ ```bash
90
+ bun run test # model-free suite (reads the vault, writes nothing)
91
+ bun run typecheck # tsc --noEmit
92
+ bun run smoke # all three extensions import
93
+
94
+ BEYIN_LIVE=1 bash test/run.sh # + one real CommandCode call
95
+ BEYIN_E2E=1 bash test/run.sh # + a real pi session (model calls)
96
+ bash test/run.sh ~/projects/example # + multi-turn Jev scenario in that project
97
+
98
+ bun run test/test-jev-scenario.ts ~/projects/example 3
99
+ ```
100
+
101
+ `test/run.sh` steps 1–3 need a live vault; the rest is self-contained. Tests never write into the
102
+ repo: each run builds its own temporary directory and config files.
103
+
104
+ ## Privacy
105
+
106
+ Vault text leaves the machine only through the Jev path, and only for records that pass the
107
+ `visibility` / `remote_allowed` / `sensitivity` gate (`remoteSafe`). Keys come from the pi model
108
+ registry or `~/.config/beyin/jev-commandcode.env`, and are never logged.
109
+
110
+ ## License
111
+
112
+ MIT