@caupulican/pi-adaptative 0.80.7 → 0.80.8

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/dist/core/reload-blockers.d.ts +2 -0
  4. package/dist/core/reload-blockers.d.ts.map +1 -1
  5. package/dist/core/reload-blockers.js +8 -2
  6. package/dist/core/reload-blockers.js.map +1 -1
  7. package/dist/core/settings-manager.d.ts.map +1 -1
  8. package/dist/core/settings-manager.js.map +1 -1
  9. package/dist/core/skills.d.ts.map +1 -1
  10. package/dist/core/skills.js +7 -3
  11. package/dist/core/skills.js.map +1 -1
  12. package/dist/core/system-prompt.d.ts.map +1 -1
  13. package/dist/core/system-prompt.js +3 -0
  14. package/dist/core/system-prompt.js.map +1 -1
  15. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  16. package/dist/modes/interactive/components/settings-selector.js +1 -1
  17. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  18. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  19. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  20. package/dist/modes/interactive/interactive-mode.js +88 -26
  21. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  22. package/docs/adaptive-extension-shared-state-audit.md +43 -0
  23. package/docs/settings.md +2 -2
  24. package/docs/skills.md +3 -3
  25. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  26. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  27. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  28. package/examples/extensions/sandbox/package-lock.json +2 -2
  29. package/examples/extensions/sandbox/package.json +1 -1
  30. package/examples/extensions/with-deps/package-lock.json +2 -2
  31. package/examples/extensions/with-deps/package.json +1 -1
  32. package/npm-shrinkwrap.json +12 -12
  33. package/package.json +4 -4
@@ -0,0 +1,43 @@
1
+ # Pi adaptive extension shared-state audit
2
+
3
+ Date: 2026-06-04
4
+ Scope: `~/.pi/agent/extensions`, TypeScript sources, excluding `node_modules`, `dist`, `build`, `.git`, and coverage folders.
5
+
6
+ ## Classification legend
7
+
8
+ - **Tenant-scoped**: mutable state is under a current session/tenant key; tools should not list or mutate other tenants by default.
9
+ - **User-global guarded**: state is intentionally shared across Pi sessions because it represents a user-level transport, daemon, or coordinator. The extension must document this and guard mutating actions.
10
+ - **Utility/no durable mutable state**: no relevant shared durable state, or only bounded artifacts with no session/task ownership implications.
11
+
12
+ ## Audit table
13
+
14
+ | Extension/file | Shared artifacts found | Classification | Status / evidence |
15
+ | --- | --- | --- | --- |
16
+ | `harness-stack/index.ts` | Previously global `tasks.json`, `team-peers.json`, `team-agent-runs/`, `runs/`; global UI preset `state.json` remains. | Tenant-scoped for orchestration; user-global for UI preset only. | Patched to `~/.pi/agent/harness-stack/tenants/<tenant-id>/...`. Behavioral two-session proof: `/tmp/harness-stack-isolation-check.mjs` PASS, cross-session task/binding invisibility and no global task/run artifacts. |
17
+ | `task-scheduler/index.ts` | Previously global `jobs.json`, `runs/`, `logs/`, `output/`, `tick.lock`. | Tenant-scoped. | Patched to `~/.pi/agent/task-scheduler/tenants/<tenant-id>/...`. Behavioral two-session proof: `/tmp/task-scheduler-isolation-check.mjs` PASS; cross-session status/pause/remove blocked as not found. |
18
+ | `task-steps/index.ts` | `task-steps/tenants/<tenant>/state.json`, background jobs/logs/output. | Tenant-scoped. | Already hardened before this round; tool descriptions say current-session tenant only. |
19
+ | `subagent/index.ts` | `subagent-background/sessions/<tenant>/...`, `subagent-runs/sessions/<tenant>/...`, persistent user/project agent dirs. | Tenant-scoped for runs; user/project agent dirs are deliberate durable assets. | Already hardened before this round; `agent_runtime` only lists/controls current-session tenant runs and prune requires sweep+memory evidence. |
20
+ | `continuous-learning/index.ts` | Auto-learn state/lock, run logs, per-tenant learner artifacts, Automata writes. | Mixed: tenant-scoped artifacts/concurrency; user-global learner lease is deliberate coordination. | Already patched before this round for per-session tenant artifact dirs, per-tenant concurrency, prompt/log cleanup, and memory-first validation tree. |
21
+ | `adaptative-agent/index.ts` | Adaptive work/truth/renewal state, reload coordinator awareness. | User-global adaptive coordinator with guardrails. | Previously patched: auto-learn sessions ignored in reload blockers; adaptive state records evidence and renewal requires judged packets/source audit. |
22
+ | `pi-auto-reload/index.ts` | `pi-auto-reload-state.json/.lock`, `pi-active-turns.json/.lock`, handoff/config. | User-global guarded coordinator. | Intentional cross-session reload coordination so sessions do not reload over active foreground turns; README updated to document global coordinator files and auto-learn exclusion. |
23
+ | `pi-chat/*` | `~/.pi/pi-chat/config.json`, `identity.json`, `peers.json`, `devices.json`, `sessions/local/audit.jsonl`, pairing QR artifacts, socket/relay runtime. | User-global guarded transport endpoint. | Inspected constants/state/tools/commands/local-mesh/qrcode. README/tool guidelines/status/setup text updated: user-global transport state, metadata-only audit, no message body persistence, token-gated TCP, no shell execution. |
24
+ | `mobile-gateway/index.ts`, `mobile-gateway/daemon.cjs` | `~/.pi/agent/mobile-gateway/runtime.json`, `daemon.log`, Telegram offset, WhatsApp session/QR files, daemon process. | User-global guarded singleton. | Patched: start records owner tenant/session, daemon persists owner metadata, status/logs expose `singletonScope=user-global`, cross-tenant stop refuses unless `confirm=yes-stop-global-mobile-gateway`. Behavioral guard proof: `/tmp/mobile-gateway-singleton-guard-check.mjs` PASS. |
25
+ | `pi-chat/src/qrcode.ts` | Pairing QR `.svg/.txt` under pi-chat pairing dir. | User-global guarded artifact. | Artifacts contain short-lived pairing URI/token, private mode best-effort; documented under pi-chat transport guardrails. |
26
+ | `mobile-gateway/README.md`, `pi-chat/README.md`, `pi-auto-reload/README.md` | Documentation state. | Guardrail documentation. | Updated to make deliberate global/singleton behavior auditable for future agents. |
27
+ | `bash-guard/index.ts` | No durable mutable state. | Utility/no durable mutable state. | Pattern hits were static block-rule names, not shared files. |
28
+ | `ask-user-question.ts` | No durable mutable state found. | Utility/no durable mutable state. | UI question helper; no cross-tenant file store. |
29
+ | `context.ts`, `learning-review.ts`, `md-link.ts`, `lib/context-limits.ts` | No high-risk shared runtime state found in audit; bounded helper behavior. | Utility/no durable mutable state or read-only/helper artifacts. | No patch needed from this sweep. |
30
+ | `antigravity-ui/index.ts`, `web-fetch/index.ts`, `web-search/index.ts`, `google-image-search/index.ts`, `youtube-search/index.ts`, `video-extract/index.ts`, `trello/index.ts`, `rg-tool.ts` | No high-risk shared session/task state found in TypeScript audit. | Utility/no durable mutable state. | No patch needed from this sweep. |
31
+
32
+ ## Validation evidence
33
+
34
+ - Harness-stack behavioral isolation: `node /tmp/harness-stack-isolation-check.mjs` -> PASS.
35
+ - Task-scheduler behavioral isolation: `node /tmp/task-scheduler-isolation-check.mjs` -> PASS.
36
+ - Mobile-gateway singleton guard: `node /tmp/mobile-gateway-singleton-guard-check.mjs` -> PASS.
37
+ - Focused extension builds: `esbuild` passed for `harness-stack`, `task-scheduler`, `mobile-gateway`, and `pi-chat`.
38
+ - Core prompt behavior source/test: MAPE + tenant-safety + Automata-memory guardrails added to `packages/coding-agent/src/core/system-prompt.ts`; `packages/coding-agent/test/system-prompt.test.ts` covers them.
39
+ - Full repo validation previously passed after prompt changes: `npm run check`.
40
+
41
+ ## Runtime activation note
42
+
43
+ The authorized source repo `/mnt/d/GitHub/mine/pi-adaptative` has the updated prompt source and built source `packages/coding-agent/dist/core/system-prompt.js` contains the new rules after `npm run build`. The global `pi` package was relinked with `npm link` from `/mnt/d/GitHub/mine/pi-adaptative/packages/coding-agent`; `readlink -f $(which pi)` now resolves to `/mnt/d/GitHub/mine/pi-adaptative/packages/coding-agent/dist/cli.js`, and the global package path `/home/caudev/.nvm/versions/node/v22.22.3/lib/node_modules/@caupulican/pi-adaptative` resolves to the authorized source package. The active global runtime `dist/core/system-prompt.js` contains the MAPE, tenant-safety, and Automata-memory prompt lines for new Pi sessions.
package/docs/settings.md CHANGED
@@ -118,7 +118,7 @@ Hard stops still require explicit foreground approval even in `full`: publishing
118
118
  | `autoLearn.longSessionContextPercent` | number | `70` | Trigger when current context usage reaches this percent |
119
119
  | `autoLearn.cooldownMinutes` | number | `120` | Per-session-tenant cooldown between learner launches |
120
120
  | `autoLearn.leaseMinutes` | number | `90` | Shared-state lease duration for a running background learner |
121
- | `autoLearn.maxConcurrentLearners` | number | `2` | Maximum running Auto Learn background learners across all session tenants |
121
+ | `autoLearn.maxConcurrentLearners` | number | `2` | Maximum running Auto Learn background learners per session tenant |
122
122
  | `autoLearn.applyHighConfidence` | boolean | `false` | Allow the learner to apply high-confidence memory candidates; broader write authority is controlled by `autonomy.mode` |
123
123
  | `autoLearn.reflectionReview` | boolean | `true` | When Auto Learn is enabled, also run bounded post-turn reflection after corrective or complex turns |
124
124
  | `autoLearn.reflectionMinToolCalls` | number | `5` | Trigger reflection review after this many tool calls in one completed turn |
@@ -126,7 +126,7 @@ Hard stops still require explicit foreground approval even in `full`: publishing
126
126
 
127
127
  Use `/settings` → **Auto Learn Advanced** to override the active autonomy preset, including the scavenger model and reflection review. The submenu lets you choose whether to save globally or to the current project's `.pi/settings.json`. The model picker prioritizes models from currently configured subscription/API accounts and still offers a manual custom-pattern entry. Use `/autonomy status` for the compact preset dashboard, `/auto-learn status` to inspect trigger state, reflection cooldown, and running leases, or `/auto-learn run` to start one learner immediately.
128
128
 
129
- When enabled, Auto Learn uses a shared state file under the Auto Learn audit/log directory to coordinate non-colliding background learners across sessions. Each long session gets its own tenant lease, and all learners read/renew the same state before scavenging stored histories for tooling capability and agent-behavior improvements. Learners also query available user/project memory first, using existing rules, preferences, corrections, and project facts to polish candidates, avoid duplicates, and improve accuracy. Internal Auto Learn prompt, log, and worker-session history artifacts are pruned after a fixed 7-day retention window; active leases are skipped so running learners are not raced. Provider/user history pruning is delegated to the continuous-learning tool after it records a learning outcome: only files older than 7 days whose current fingerprint still matches a successfully extracted index entry are deleted, and active/current sessions are protected.
129
+ When enabled, Auto Learn keeps a small shared state file for visibility/cooldowns, but prompt/log/session artifacts are isolated under per-session-tenant directories so one session's learner does not consume another session's concurrency budget. Learners must confront available user/project memory first, using existing rules, preferences, corrections, and project facts to decide whether each candidate is useful, unique versus merge/upgrade-worthy, and agent-improving. Candidate validation is chunked/vectorized instead of one memory query per candidate. Successful Auto Learn workers purge their internal prompt/log/session artifacts after exit; the 7-day retention pruner is a fallback for unfinished or failed artifacts, and active leases are skipped so running learners are not raced. Provider/user history pruning is delegated to the continuous-learning tool after it records a learning outcome: only files older than 7 days whose current fingerprint still matches a successfully extracted index entry are deleted, and active/current sessions are protected.
130
130
 
131
131
  ```json
132
132
  {
package/docs/skills.md CHANGED
@@ -63,12 +63,12 @@ For project-level Claude Code skills, add to `.pi/settings.json`:
63
63
 
64
64
  ## How Skills Work
65
65
 
66
- 1. At startup, pi scans skill locations enough to validate and register them
67
- 2. The system prompt includes only lazy-loadable skill file locations; skill frontmatter and instructions are not injected upfront
66
+ 1. At startup, pi scans skill locations and extracts names and descriptions
67
+ 2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
68
68
  3. When a task matches, the agent uses `read` to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
69
69
  4. The agent follows the instructions, using relative paths to reference scripts and assets
70
70
 
71
- This is progressive disclosure: locations are always available, while frontmatter and full instructions load on-demand.
71
+ This is progressive disclosure: names and descriptions are always in context, while full instructions load on-demand.
72
72
 
73
73
  ## Skill Commands
74
74
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.80.7",
3
+ "version": "0.80.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.80.7",
9
+ "version": "0.80.8",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.80.7",
4
+ "version": "0.80.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.80.7",
4
+ "version": "0.80.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "0.80.7",
3
+ "version": "0.80.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "0.80.7",
9
+ "version": "0.80.8",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.80.7",
4
+ "version": "0.80.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.80.7",
3
+ "version": "0.80.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.80.7",
9
+ "version": "0.80.8",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.80.7",
4
+ "version": "0.80.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.80.7",
3
+ "version": "0.80.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@caupulican/pi-adaptative",
9
- "version": "0.80.7",
9
+ "version": "0.80.8",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.7",
13
- "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.7",
14
- "@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.7",
12
+ "@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.8",
13
+ "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
14
+ "@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.8",
15
15
  "@silvia-odwyer/photon-node": "0.3.4",
16
16
  "chalk": "5.6.2",
17
17
  "cross-spawn": "7.0.6",
@@ -474,11 +474,11 @@
474
474
  }
475
475
  },
476
476
  "node_modules/@earendil-works/pi-agent-core": {
477
- "version": "0.80.7",
478
- "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.80.7.tgz",
477
+ "version": "0.80.8",
478
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.80.8.tgz",
479
479
  "license": "MIT",
480
480
  "dependencies": {
481
- "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.7",
481
+ "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
482
482
  "ignore": "7.0.5",
483
483
  "typebox": "1.1.38",
484
484
  "yaml": "2.9.0"
@@ -488,8 +488,8 @@
488
488
  }
489
489
  },
490
490
  "node_modules/@earendil-works/pi-ai": {
491
- "version": "0.80.7",
492
- "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.80.7.tgz",
491
+ "version": "0.80.8",
492
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.80.8.tgz",
493
493
  "license": "MIT",
494
494
  "dependencies": {
495
495
  "@anthropic-ai/sdk": "0.91.1",
@@ -511,8 +511,8 @@
511
511
  }
512
512
  },
513
513
  "node_modules/@earendil-works/pi-tui": {
514
- "version": "0.80.7",
515
- "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.80.7.tgz",
514
+ "version": "0.80.8",
515
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.80.8.tgz",
516
516
  "license": "MIT",
517
517
  "dependencies": {
518
518
  "get-east-asian-width": "1.6.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.80.7",
3
+ "version": "0.80.8",
4
4
  "description": "Adaptive fork of Pi coding agent for self-evolving agent harness experiments",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -41,9 +41,9 @@
41
41
  "prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
42
42
  },
43
43
  "dependencies": {
44
- "@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.7",
45
- "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.7",
46
- "@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.7",
44
+ "@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.8",
45
+ "@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
46
+ "@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.8",
47
47
  "@silvia-odwyer/photon-node": "0.3.4",
48
48
  "chalk": "5.6.2",
49
49
  "cross-spawn": "7.0.6",