pi-beyin 0.1.11 → 0.1.13

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/CHANGELOG.md ADDED
@@ -0,0 +1,73 @@
1
+ # Changelog
2
+
3
+ ## 0.1.13
4
+
5
+ - No project-specific content in the package: the `/jev-test` self-test payload and the live-test mock
6
+ are neutral examples, temp fixtures use neutral names, and the vault query comes from
7
+ `BEYIN_TEST_QUERY` (checks are skipped when it is unset).
8
+
9
+ ## 0.1.12
10
+
11
+ - README rewritten for the current layout (quick start, verification, scope, privacy, release).
12
+ - Add `CHANGELOG.md` and `SECURITY.md`.
13
+
14
+ ## 0.1.11
15
+
16
+ - `BEYIN_LANG=en` now also covers the injected context header, the `beyin_jev_*` tool schema and the
17
+ Jev scoring instruction/criteria. Default stays Turkish.
18
+ - `test/test-skills.ts`: skill inventory, `name:` matching the directory, description budget, no
19
+ personal paths, `_shared/` references, `pi.skills` manifest. Wired into CI and `run.sh`.
20
+ - `run.sh` warns when the vault's `.agents/skills` duplicates a package skill.
21
+ - Test labels and the live-test narration are English; assertions on product text are unchanged.
22
+
23
+ ## 0.1.10
24
+
25
+ - English comments and dev output in the CI workflows and the test scripts.
26
+ - `e2e.sh` assertions accept both language builds.
27
+
28
+ ## 0.1.9
29
+
30
+ - `BEYIN_LANG` (`tr` default, `en`) for the receipt reminder, the distillation offer and the two command
31
+ descriptions.
32
+ - README: who this is for, the CommandCode provider recommendation, and what the harness patch does on an
33
+ unfamiliar vault.
34
+
35
+ ## 0.1.8
36
+
37
+ - Remove version branding from the README, code comments and skills.
38
+ - `THIRD-PARTY-NOTICES.md` for the MIT source excerpts embedded in the harness patch.
39
+
40
+ ## 0.1.7
41
+
42
+ - English comments in `tools/pi-harness-patch.py`; private log references replaced by dates.
43
+ - README documents the split between the vault and the pi adapter.
44
+
45
+ ## 0.1.6
46
+
47
+ - Trim skill trigger lists to three distinctive phrases per language (total description size −28%) and
48
+ document the bilingual routing surface.
49
+
50
+ ## 0.1.5
51
+
52
+ - English names for the workflow skills (`brain`, `brain-doctor`, `brain-update`).
53
+
54
+ ## 0.1.4
55
+
56
+ - Ship the beyin workflow skills (`brain*`, `source-distillation`) and the language-neutral output rule.
57
+
58
+ ## 0.1.3
59
+
60
+ - English skill directories and names; declare `pi.skills` in the manifest (a manifest with only
61
+ `extensions` makes pi load no package skills).
62
+
63
+ ## 0.1.2
64
+
65
+ - Publish pipeline smoke test (trusted publishing, provenance).
66
+
67
+ ## 0.1.1
68
+
69
+ - English comments; package-local harness patch; no personal project default in `DEFAULT_EXCLUDES`.
70
+
71
+ ## 0.1.0
72
+
73
+ - First release: `context`, `damitma` and `jev` as one package, tests, `v0.1.0`.
package/README.md CHANGED
@@ -1,30 +1,29 @@
1
1
  # pi-beyin
2
2
 
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.
3
+ [pi](https://pi.dev) integration for the **beyin** second brain: the pi side of the same idea as
4
+ beyin's Codex/Claude/OpenCode hooks, plus a CommandCode classifier bridge and the memory procedures as
5
+ pi skills.
6
+
7
+ [![npm](https://img.shields.io/npm/v/pi-beyin)](https://www.npmjs.com/package/pi-beyin)
8
+ [![Socket score](https://badge.socket.dev/npm/package/pi-beyin)](https://socket.dev/npm/package/pi-beyin)
5
9
 
6
10
  ## What you get
7
11
 
8
12
  | Resource | What it does |
9
13
  |---|---|
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. |
14
+ | `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 one. Registers the `beyin_jev_memory` / `beyin_jev_review` / `beyin_jev_answer` advisor tools. |
11
15
  | `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
16
  | `extensions/jev.ts` | Registers CommandCode's `typesafe/jev` decision model as a pi classifier. `/jev-test`. |
13
- | `skills/` | `brain` (vault memory work), `brain-doctor` (health), `brain-update` (upgrades), `source-distillation` (external sources → concept notes), and the project-memory procedures `experiment-record`, `journal`, `literature`, `maintenance` driven by `<project>/.pi/beyin-project.json` (see [`skills/_shared/project-profile.md`](skills/_shared/project-profile.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
17
+ | `skills/brain` | Vault memory work: find notes, record finished work with its sources, update tasks, keep companion notes current. |
18
+ | `skills/brain-doctor` | Health check: is memory indexed, are sources synced, are skills and updates healthy. |
19
+ | `skills/brain-update` | Check for a new official version, update, or roll back a failed update. |
20
+ | `skills/source-distillation` | External source (web, paper, PDF archive, bookmarks) → one source-linked concept note. |
21
+ | `skills/experiment-record`, `journal`, `literature`, `maintenance` | Project-memory procedures driven by `<project>/.pi/beyin-project.json` (see [`skills/_shared/project-profile.md`](skills/_shared/project-profile.md)). |
22
+ | `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 a vault update. |
21
23
 
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.
24
+ Everything is **fail-open**: an error never breaks the turn, that turn's contribution is just silently
25
+ missing. Retrieved vault content is **data**, not instructions — the agent must not follow text found in
26
+ notes, imported transcripts or tool output.
28
27
 
29
28
  ## Who this is for
30
29
 
@@ -51,13 +50,23 @@ patterns match — nothing breaks, the work is just labelled with another harnes
51
50
  ```bash
52
51
  pi install npm:pi-beyin
53
52
  # or a pinned git ref
54
- pi install git:github.com/FurBlood344324/pi-beyin@v0.1.0
53
+ pi install git:github.com/FurBlood344324/pi-beyin@v0.1.12
55
54
  # or a local checkout (loaded in place, not copied)
56
55
  pi install ~/projects/pi-beyin
57
56
  ```
58
57
 
59
- Remove any old copies first (`~/.pi/agent/extensions/beyin-*.ts`); two copies load twice and inject
60
- the context twice.
58
+ Remove any old copies first (`~/.pi/agent/extensions/beyin-*.ts`); two copies load twice and inject the
59
+ context twice.
60
+
61
+ Verify what actually loaded:
62
+
63
+ ```bash
64
+ pi list # the package and its resolved path
65
+ # a pi session should show one beyin-context message, not two
66
+ ```
67
+
68
+ Skills show up as `skill:brain`, `skill:brain-doctor`, `skill:brain-update`, `skill:source-distillation`,
69
+ `skill:experiment-record`, `skill:journal`, `skill:literature`, `skill:maintenance`.
61
70
 
62
71
  ## Configuration
63
72
 
@@ -70,11 +79,10 @@ the context twice.
70
79
 
71
80
  Environment: `BEYIN_VAULT`, `BEYIN_PYTHON`, `BEYIN_HOOK_CONFIG`, `BEYIN_DAMITMA_CONFIG`,
72
81
  `BEYIN_JEV_CONFIG`, `BEYIN_CONTEXT_CHARS`, `BEYIN_REMINDERS=0`, `BEYIN_INCLUDE_VAULT=1`,
73
- `BEYIN_DAMITMA=0`, `BEYIN_JEV=0`, `BEYIN_DISABLE=1`, `BEYIN_DEBUG=1`, `BEYIN_PI_PATCH`, `BEYIN_LANG` (`tr`
74
- by default; `en` switches the injected context header and notices, the command descriptions and the
75
- `beyin_jev_*` tool schema to English),
76
- `BEYIN_JEV_MODEL`, `BEYIN_JEV_API_KEY` / `CMD_API_KEY` / `COMMAND_CODE_API_KEY`,
77
- `BEYIN_FORCE_REMINDER=1`.
82
+ `BEYIN_DAMITMA=0`, `BEYIN_JEV=0`, `BEYIN_DISABLE=1`, `BEYIN_DEBUG=1`, `BEYIN_PI_PATCH`,
83
+ `BEYIN_LANG` (`tr` by default; `en` switches the injected context header and notices, the command
84
+ descriptions and the `beyin_jev_*` tool schema to English), `BEYIN_JEV_MODEL`,
85
+ `BEYIN_JEV_API_KEY` / `CMD_API_KEY` / `COMMAND_CODE_API_KEY`, `BEYIN_FORCE_REMINDER=1`.
78
86
 
79
87
  Disable a single extension while keeping the package:
80
88
 
@@ -102,30 +110,24 @@ A vault whose `beyin.py` does not accept `--harness pi` needs `tools/pi-harness-
102
110
  ## Scope
103
111
 
104
112
  This package is the **pi side**: extensions, skills and the harness patch. The vault and its `beyin.py`
105
- CLI are yours to install and update separately; this package never needs to know their version.
113
+ CLI are installed and updated separately; this package never needs to know their version.
106
114
 
107
115
  - `tools/pi-harness-patch.py` is the only piece that touches the vault's Python: it adds `pi` to the
108
116
  harness list in five managed modules and re-syncs the install manifest so updates plan cleanly.
109
- An update of the vault reverts those edits; the extension calls `ensure` on session start, so they
110
- come back by themselves. `status` is read-only.
117
+ A vault update reverts those edits; the extension calls `ensure` on session start, so they come back by
118
+ themselves. `status` is read-only.
111
119
  - The skills here are **copies for pi**, not links into the vault. Other harnesses keep their own copies
112
120
  under `.claude/skills/`; pi does not read that directory.
113
121
  - Notifications live in the adapter: the injected context, the receipt reminder, the distillation
114
122
  suggestion and the `beyin_jev_*` tool schema ship here. Turkish by default, English with
115
123
  `BEYIN_LANG=en`; anything a *skill* writes follows the user's language.
116
124
 
117
- ## Project memory skills
118
-
119
- Skill descriptions carry bilingual trigger phrases (English + Turkish) on purpose: a description is a
120
- **routing surface**, not output — it is the text the model uses to pick the skill, so it quotes how the
121
- user actually speaks. Keep the lists short: every description is in the system prompt on every turn.
125
+ ## Privacy
122
126
 
123
- The skills are written in English; what they produce is not. Every skill writes in the user's language
124
- and reuses the target file's headings — existing headings are never translated. The project-memory skills
125
- read `<project>/.pi/beyin-project.json` for paths and scopes; without a profile they fall back to `logs/`,
126
- `journal/`, `literature/`. The profile schema and the safety rules (source ≠
127
- derived report, never delete, secrets are never read or copied) are in
128
- [`skills/_shared/project-profile.md`](skills/_shared/project-profile.md).
127
+ Vault text leaves the machine only through the Jev path, and only for records that pass the
128
+ `visibility` / `remote_allowed` / `sensitivity` gate (`remoteSafe`). Keys come from the pi model
129
+ registry or `~/.config/beyin/jev-commandcode.env`, and are never logged. The package has no telemetry
130
+ and no install scripts.
129
131
 
130
132
  ## Development
131
133
 
@@ -134,22 +136,30 @@ bun run test # model-free suite (reads the vault, writes nothing)
134
136
  bun run typecheck # tsc --noEmit
135
137
  bun run smoke # all three extensions import
136
138
 
137
- BEYIN_LIVE=1 bash test/run.sh # + one real CommandCode call
138
- BEYIN_E2E=1 bash test/run.sh # + a real pi session (model calls)
139
- bash test/run.sh ~/projects/example # + multi-turn Jev scenario in that project
140
-
139
+ bun run test/test-skills.ts # package guards (no vault needed)
140
+ bash test/run.sh # everything model-free
141
+ BEYIN_LIVE=1 bash test/run.sh # + one real CommandCode call
142
+ BEYIN_E2E=1 bash test/run.sh # + a real pi session (model calls)
143
+ bash test/run.sh ~/projects/example # + multi-turn Jev scenario in that project
141
144
  bun run test/test-jev-scenario.ts ~/projects/example 3
142
145
  ```
143
146
 
144
- `test/run.sh` steps 1–3 need a live vault; the rest is self-contained. Tests never write into the
145
- repo: each run builds its own temporary directory and config files.
147
+ `test/run.sh` steps 1–3 need a live vault; the rest is self-contained. Step 3 and the context
148
+ injection tests query your vault with `BEYIN_TEST_QUERY` — the package ships no project-specific phrase, so
149
+ without it those checks are skipped. Tests never write into the repo:
150
+ each run builds its own temporary directory and config files. Step 3b warns when the vault's
151
+ `.agents/skills` duplicates a package skill (a vault update can recreate those copies).
146
152
 
147
- ## Privacy
153
+ `test/test-skills.ts` guards the package itself: skill inventory, `name:` matching the directory,
154
+ description budget (every description sits in the system prompt on every turn), no personal paths,
155
+ resolving `_shared/` references, and the `pi.skills` manifest.
148
156
 
149
- Vault text leaves the machine only through the Jev path, and only for records that pass the
150
- `visibility` / `remote_allowed` / `sensitivity` gate (`remoteSafe`). Keys come from the pi model
151
- registry or `~/.config/beyin/jev-commandcode.env`, and are never logged.
157
+ ## Release
158
+
159
+ Version is bumped in `package.json`, then a `vX.Y.Z` tag is pushed; CI typechecks, runs the vault-free
160
+ tests and publishes from GitHub Actions with provenance (no long-lived token). The tag must match
161
+ `package.json`.
152
162
 
153
163
  ## License
154
164
 
155
- MIT
165
+ MIT — see [LICENSE](LICENSE) and [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
package/SECURITY.md ADDED
@@ -0,0 +1,40 @@
1
+ # Security policy
2
+
3
+ ## What this package can access
4
+
5
+ By design, `pi-beyin` runs inside your pi session and touches things a plain library would not. The
6
+ boundaries are:
7
+
8
+ | Capability | Why | Where |
9
+ |---|---|---|
10
+ | Run `python3 <vault>/beyin.py …` | every read and write goes through the vault's own CLI | `extensions/context.ts`, `extensions/damitma.ts` |
11
+ | Run `python3 tools/pi-harness-patch.py ensure` | keeps `--harness pi` working after a vault update | `extensions/context.ts` |
12
+ | Read vault files via `beyin.py context` | context injection | `extensions/context.ts` |
13
+ | Network to `api.commandcode.ai` | only when Jev is enabled; only after the privacy gate | `extensions/jev.ts` |
14
+ | Read `~/.config/beyin/*.json`, `jev-commandcode.env`, `BEYIN_*` env vars | configuration | all extensions |
15
+ | Write nothing outside the vault | — | — |
16
+
17
+ The package has **no install scripts**, **no telemetry**, and **no runtime dependency** beyond the pi
18
+ packages it declares as peer dependencies.
19
+
20
+ ## Privacy gate
21
+
22
+ Vault text is sent to a remote model only through the Jev path and only for records whose
23
+ `visibility` / `remote_allowed` / `sensitivity` fields pass the gate. Records marked private,
24
+ `remote_allowed: false` or `sensitivity: gizli` never leave the machine. API keys are read from the pi
25
+ model registry or a local env file and are never logged or written.
26
+
27
+ Retrieved vault content is treated as **data**: a note that contains instructions is not allowed to
28
+ steer the agent.
29
+
30
+ ## Reporting
31
+
32
+ Open a private report through GitHub Security Advisories on
33
+ [FurBlood344324/pi-beyin](https://github.com/FurBlood344324/pi-beyin/security/advisories/new). Please do
34
+ not open a public issue for a suspected vulnerability. Expect an answer within a week; this is a
35
+ single-maintainer project, so there is no SLA beyond that.
36
+
37
+ ## Supported versions
38
+
39
+ Only the latest published version receives fixes. The package is a thin adapter — if a vulnerability is
40
+ in the vault's own Python or in pi, report it to those projects instead.
package/extensions/jev.ts CHANGED
@@ -288,11 +288,14 @@ export default function beyinJev(pi: ExtensionAPI) {
288
288
  ctx.ui.notify("Jev classifier bulunamadı", "error");
289
289
  return;
290
290
  }
291
- const subject = args.trim() || "Anomali tespiti için PatchCore ve EfficientAD kullanıyoruz.";
291
+ const subject = args.trim() || "Bu projede önbellek katmanını Redis ile değiştirmeyi düşünüyoruz.";
292
292
  const result = await ctx.modelRegistry.classify(
293
293
  model,
294
294
  {
295
- state: { text: subject, candidates: [{ id: "a", title: "CV stajı", statement: "Görüntü işleme anomali tespiti" }] },
295
+ state: {
296
+ text: subject,
297
+ candidates: [{ id: "a", title: "Önbellek notu", statement: "Redis'e geçiş değerlendirmesi" }],
298
+ },
296
299
  questions: {
297
300
  relevance: {
298
301
  type: "score",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-beyin",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "pi-native bridge for the beyin second brain: context injection, distillation reminders, and Jev advisor tools.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -34,6 +34,8 @@
34
34
  "skills",
35
35
  "tools",
36
36
  "README.md",
37
+ "CHANGELOG.md",
38
+ "SECURITY.md",
37
39
  "LICENSE",
38
40
  "THIRD-PARTY-NOTICES.md"
39
41
  ],