Correct the Pi advice: per-agent skills are the design; per-agent extensions via adapterConfig.command

This commit is contained in:
Sam
2026-11-11 08:13:48 +11:00
parent 77014d035b
commit 47aacfd6d1
7 changed files with 802 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
---
type: session
id: session.paperclip-harness.paperclip-pi-local-adapter-config-resolution-limits-and-agen
title: Paperclip Pi-local adapter: config resolution limits and agent history sources
status: active
source_of_truth: false
freshness: current
last_reviewed: 2026-11-10
tags:
- pack/paperclip-harness
- agent-memory/session
- paperclip
- pi-local-adapter
- agent-config
- skills
- extensions
- session-history
- pi-settings
---
# Paperclip Pi-local adapter: config resolution limits and agent history sources
Discovery turn in the Paperclip harness workspace (papertrail/artemis_control etc.). Advisor question: can an external picker write per-agent config (skills/extensions) for Paperclip-spawned Pi agents?
Key findings (evidence-backed):
- pi-config extension registers 5 commands: /config-add, /config-remove, /config-list, /config-show, /config-setup. picker.ts is an overlay listing ~/.agents/skills and ~/.agents/extensions, marking active in project vs globally.
- Those commands write plain JSON: `<project>/.pi/settings.json` (-l mode) or `~/.pi/agent/settings.json` (default global). Shape: {"packages":[ "npm:pi-memctx", {"source":"git:https://gitea…/pi-config","extensions":[...]}, {"source":"/home/sam/.agents","skills":["nixos-workflow"],"extensions":[]} ]}.
- Installed @paperclipai/adapter-pi-local runs: `pi --mode json --append-system-prompt <rendered> --provider <p> --model <m> --thinking <t> --tools read,bash,edit,write,grep,find,ls --session ~/.pi/paperclips/<timestamp>-<agentId>.jsonl --skill <dir built from agent desiredSkills>`.
- Consequences: (1) skills are per-agent via desiredSkills + POST /api/agents/{id}/skills/sync (supported lever); (2) isolation leaks — injected skills symlinked into shared ~/.pi/agent/skills and not removed per run, --no-skills not passed; (3) tool list fixed at read,bash,edit,write,grep,find,ls — extensions cannot add tools; (4) project-local .pi/settings.json unlikely honoured for Paperclip runs: Pi loads project settings only from trusted path, ~/.pi/agent/trust.json has 14 entries none matching Paperclip worktrees or ~/paperclip-agents, and worktree paths change per task (…/worktrees/AUD-165-…).
- Recommendations: identity/instructions/model/budget/skills controlled by Paperclip per agent (instructions bundle at ~/.paperclip/instances/default/companies/<co>/agents/<id>/instructions/AGENTS.md); extensions only one global set; folder-level .pi/settings.json only for manual terminal use; per-agent extensions would require adapter change (per-agent config dir, --no-skills + explicit set, stale link cleanup) — a Paperclip feature request.
- Agent history available with no new plumbing: ~/.pi/paperclips/*.jsonl (178 session files; name `<timestamp>-<agentId>.jsonl`, full conversation JSONL v3 with type=session header containing id/timestamp/cwd and model_change records); GET /api/agents/{id}/task-sessions maps task to session file + cwd (task-sessions JSON shows adapterType pi_local, taskKey, sessionParamsJson.cwd under /tmp/pc-sandbox-*/.paperclip/worktrees/<task>, sessionId path). runtime-state gives current state; run log in Agents>agents.
- Written into docs/PLAN-INTERFACE.md and committed as 77014d0 (documentation only; no running layout changed).
## Evidence
- Confidence: 90%
- Reason: Rich discovery about adapter behavior, config file locations, and history sources; durable and reusable.
## Related
- [[packs/paperclip-harness/00-system/pi-agent/memory-manifest|Memory Manifest]]
## Related learned memories <!-- same-turn-2026-11-10 21:03:21 -->
- observation: [[packs/paperclip-harness/60-observations/tmp-repository-structure-and-configuration-patterns|Pi-local adapter constraints: fixed tool list and leaking skill symlinks]]
- action: [[packs/paperclip-harness/40-actions/2026-11-10-wrote-docs-ui-layout-md-and-three-live-layout-mockups|Committed docs/PLAN-INTERFACE.md advise on Paperclip vs Pi config ownership]]
- session: [[packs/paperclip-harness/80-sessions/paperclip-pi-local-adapter-config-resolution-limits-and-agen|Paperclip Pi-local adapter: config resolution limits and agent history sources]]
- session: [[packs/paperclip-harness/80-sessions/rich-discovery-pi-2026-11-10-21-03-21|Rich discovery: .pi 2026-11-10 21:03:21]]
- context: [[packs/paperclip-harness/20-context/home|.pi]]
- runbook: [[packs/paperclip-harness/70-runbooks/tmp-deployment-operations|.pi deployment operations]]

View File

@@ -0,0 +1,131 @@
---
type: session
id: session.paperclip-harness.rich-discovery-pi-2026-11-10-21-03-21
title: Rich discovery: .pi 2026-11-10 21:03:21
status: active
source_of_truth: false
freshness: current
last_reviewed: 2026-11-10
tags:
- pack/paperclip-harness
- agent-memory/session
- autolearn
- rich-discovery
- repo/pi
---
# Rich discovery: .pi 2026-11-10 21:03:21
Sanitized rich discovery snapshot captured automatically from the completed turn.
## Source paths observed
- `etc/profiles/per-user/sam/bin/pi`
- `nix/store/rg248h9sz8dylm8p6a9w9fj4zrv4sgm5-pi-coding-agent-0.82.1/bin/pi`
- `nix/store/rg248h9sz8dylm8p6a9w9fj4zrv4sgm5-pi-coding-agent-0.82.1/lib/node_modules/pi-monorepo/docs/compaction.md`
- `.pi/agent/settings.json`
- `nix/store/rg248h9sz8dylm8p6a9w9fj4zrv4sgm5-pi-coding-agent-0.82.1/lib/node_modules/pi-monorepo/docs/packages.md`
- `nix/store/rg248h9sz8dylm8p6a9w9fj4zrv4sgm5-pi-coding-agent-0.82.1/lib/node_modules/pi-monorepo/docs/sdk.md`
- `github.com/user/repo`
- `.pi/agent/skills`
- `home/sam/.local/share/tuios/worktrees/office-test-1/card-t1-build-skeleton-and-13ob`
- `home/sam/.local/share/tuios/worktrees/office-test-1/card-t2-recipe-content-3yto`
- `home/sam/ai_chat/general_chat/chat_chat`
- `home/sam/ai_chat/sys_config/devops`
- `home/sam/ai_chat/sys_config/neovim_config`
- `home/sam/ai_chat/sys_config/nixos_config`
- `home/sam/paseo/projects/central_ai_llm_master`
- `home/sam/paseo/projects/drone_fire_fighting`
- `home/sam/.pi/paperclips/2026-10-16T01-58-49-725Z-403de1f7-645c-4d35-bc7e-19b01d77bacc.jsonl`
- `home/sam/paseo/projects/artemis_control`
- `tmp/pc-sandbox-2026-11-10/.paperclip/worktrees/AUD-166-add-a-changelog-entry-for-the-harness`
- `home/sam/.pi/paperclips/2026-11-10T04-55-52`
- `extensions/pi-config/index.ts`
- `extensions/tavily-search/index.ts`
- `home/sam/.agents`
- `.pi/agent/trust.json`
- `.paperclip/instances/default/companies`
## Final answer snapshot
Advice only — nothing built. Written into `docs/PLAN-INTERFACE.md` as well.
## Your picker, and what it actually writes
`pi-config` registers five commands — `/config-add`, `/config-remove`, `/config-list`, `/config-show`, `/config-setup` — and `picker.ts` is the overlay: a filtered list of `~/.agents/skills` and `~/.agents/extensions` showing which are active in the project and which are active globally.
What the commands change is plain JSON:
```
<project>/.pi/settings.json project settings ("-l" mode)
~/.pi/agent/settings.json global settings
```
in the shape:
```json
{"packages": [
"npm:pi-memctx",
{"source": "git:https://gitea…/pi-config", "extensions": ["extensions/pi-config/index.ts", "extensions/tavily-search/index.ts"]},
{"source": "/home/sam/.agents", "skills": ["nixos-workflow"], "extensions": []}
]}
```
So yes: **that JSON is the interface**, and anything that can write a file can compose an agent's context exactly as the picker does. The real question is which of those files Pi actually reads on a Paperclip run.
## What Paperclip actually runs
From the installed `@paperclipai/adapter-pi-local`:
```
pi --mode json --append-system-prompt <rendered>
--provider <p> --model <m> --thinking <t>
--tools read,bash,edit,write,grep,find,ls
--session ~/.pi/paperclips/<timestamp>-<agentId>.jsonl
--skill <a directory built from that agent's desired skills>
```
Four consequences:
1. **Skills are already per agent** — `desiredSkills` and `POST /api/agents/{id}/skills/sync`. That is the supported lever, and the `--skill` directory is built from it.
2. **The isolation leaks.** Injected skills are symlinked into the *shared* `~/.pi/agent/skills` and are not removed when another agent runs, and `--no-skills` is not passed. A skill one agent had can remain visible to another.
3. **The tool list is fixed** at `read,bash,edit,write,grep,find,ls`. An agent cannot gain a tool by being handed an extension.
4. **Project-local `.pi/settings.json` is unlikely to be honoured for Paperclip runs.** Pi loads project settings only from a trusted path, and `~/.pi/agent/trust.json` has 14 entries — none is a Paperclip worktree or `~/paperclip-agents`. And a worktree path changes every task (`…/worktrees/AUD-165-…`), so there is nothing stable to trust.
That is the direct answer to your "if it uses /.pi in each folder it might be possible" — it *is* possible for you at a terminal, and *not reliable* for a Paperclip-spawned Pi, for two independent reasons.
## So, honestly
- **Identity, instructions, model, budget, skills: Paperclip.** They are already per agent, and the instructions bundle at `~/.paperclip/instances/default/companies/<co>/agents/<id>/instructions/AGENTS.md` is your real per-agent context control.
- **Extensions: one global set.** There is no per-agent extension mechanism in this adapter. Pretending otherwise gives you agents whose behaviour depends on which one ran last.
- **Folder-level `.pi/settings.json`: useful for you, not for the factory.** Keep it for when you open Pi in a folder by hand.
- **If per-agent extensions are genuinely wanted**, the change belongs in the adapter — a per-agent config directory, plus `--no-skills` with an explicit set and stale links removed. That is a Paperclip feature request, not something a terminal can arrange from outside.
## Seeing the agents does give you their history
- `~/.pi/paperclips/*.jsonl` — **178 session files** here, one per run, named `<timestamp>-<agentId>.jsonl`, each the full conversation.
- `GET /api/agents/{id}/task-sessions` maps a task to its session file and working directory.
- The run log is already visible in `Agents>agents`; `runtime-state` gives current state.
So an `Agents>history` panel is feasible with no new plumbing: list an agent's sessions, open one, render the transcript, link back to the task. Read-only, and the natural next panel after your tests.
Committed as `77014d0` — documentation only, nothing in the running layout changed.
## Evidence
- Confidence: 86%
- Reason: Preserve full sanitized discovery detail from a rich investigation turn
## Related
- [[packs/paperclip-harness/00-system/pi-agent/memory-manifest|Memory Manifest]]
## Related learned memories <!-- same-turn-2026-11-10 21:03:21 -->
- observation: [[packs/paperclip-harness/60-observations/tmp-repository-structure-and-configuration-patterns|Pi-local adapter constraints: fixed tool list and leaking skill symlinks]]
- action: [[packs/paperclip-harness/40-actions/2026-11-10-wrote-docs-ui-layout-md-and-three-live-layout-mockups|Committed docs/PLAN-INTERFACE.md advise on Paperclip vs Pi config ownership]]
- session: [[packs/paperclip-harness/80-sessions/paperclip-pi-local-adapter-config-resolution-limits-and-agen|Paperclip Pi-local adapter: config resolution limits and agent history sources]]
- session: [[packs/paperclip-harness/80-sessions/rich-discovery-pi-2026-11-10-21-03-21|Rich discovery: .pi 2026-11-10 21:03:21]]
- context: [[packs/paperclip-harness/20-context/home|.pi]]
- runbook: [[packs/paperclip-harness/70-runbooks/tmp-deployment-operations|.pi deployment operations]]