pi-legion 0.16.0 → 2.0.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.
Files changed (89) hide show
  1. package/CONTRIBUTING.md +58 -0
  2. package/README.md +313 -640
  3. package/agents/advisor.md +7 -5
  4. package/agents/centurion.md +53 -0
  5. package/agents/designer.md +33 -33
  6. package/agents/planner.md +1 -2
  7. package/agents/prototype.md +2 -2
  8. package/agents/reviewer.md +67 -31
  9. package/agents/scout.md +6 -2
  10. package/agents/worker.md +12 -3
  11. package/docs/contracts/esc-abort-v1.md +131 -0
  12. package/docs/contracts/esc-cascade-v2.md +100 -0
  13. package/docs/design.md +44 -25
  14. package/docs/legion-v2-contract.md +461 -0
  15. package/docs/legion-v2-delivery.md +62 -0
  16. package/docs/retire-hardening-contract.md +125 -0
  17. package/docs/subagents-teams.md +76 -0
  18. package/docs/tui-viewer-contract.md +276 -0
  19. package/docs/vexillatio-contract.md +162 -0
  20. package/index.ts +1462 -286
  21. package/package.json +12 -9
  22. package/skills/pi-legion/SKILL.md +74 -96
  23. package/src/agents/agents.ts +6 -11
  24. package/src/agents/overrides.ts +2 -1
  25. package/src/agents/paths.ts +1 -1
  26. package/src/agents/settings.ts +268 -20
  27. package/src/api.ts +47 -48
  28. package/src/{herdr → backends/legacy}/client.ts +14 -69
  29. package/src/{shared → backends/legacy}/cursor-chat.ts +2 -2
  30. package/src/{herdr → backends/legacy}/runner.ts +22 -9
  31. package/src/backends/legacy/types.ts +138 -0
  32. package/src/extension/auto-doctor.ts +144 -0
  33. package/src/extension/budget.ts +2 -2
  34. package/src/extension/child-guard.ts +214 -201
  35. package/src/extension/event-bus.ts +263 -0
  36. package/src/extension/legion-commands.ts +719 -0
  37. package/src/extension/legion-doctor.ts +888 -0
  38. package/src/extension/legion-stop.ts +150 -0
  39. package/src/extension/legion-tools.ts +816 -0
  40. package/src/extension/notify.ts +24 -19
  41. package/src/extension/playbook.ts +20 -89
  42. package/src/extension/recycle.ts +2 -7
  43. package/src/extension/runtime.ts +655 -105
  44. package/src/extension/scout-guard.ts +483 -0
  45. package/src/extension/slash.ts +89 -438
  46. package/src/extension/spawn-hints.ts +79 -0
  47. package/src/extension/summary.ts +17 -58
  48. package/src/legion/budget.ts +165 -0
  49. package/src/legion/db.ts +242 -0
  50. package/src/legion/events.ts +150 -0
  51. package/src/legion/mail.ts +412 -0
  52. package/src/legion/nodes.ts +461 -0
  53. package/src/legion/rebuild.ts +533 -0
  54. package/src/legion/state-machine.ts +313 -0
  55. package/src/legion/usage.ts +101 -0
  56. package/src/runs/acceptance.ts +82 -25
  57. package/src/runs/args.ts +51 -5
  58. package/src/runs/hygiene.ts +335 -0
  59. package/src/runs/orchestrator.ts +790 -1683
  60. package/src/runs/owner.ts +61 -0
  61. package/src/runs/provision.ts +135 -0
  62. package/src/runs/store.ts +44 -17
  63. package/src/runs/verify-queue.ts +195 -0
  64. package/src/shared/name.ts +29 -0
  65. package/src/shared/output-cap.ts +57 -0
  66. package/src/shared/progress.ts +57 -135
  67. package/src/shared/session.ts +243 -171
  68. package/src/shared/types.ts +107 -208
  69. package/src/supervisor/child-memory.ts +140 -0
  70. package/src/supervisor/proc-tree.ts +103 -0
  71. package/src/supervisor/rpc-supervisor.ts +1033 -0
  72. package/src/supervisor/types.ts +153 -0
  73. package/src/supervisor/ui-proxy.ts +226 -0
  74. package/src/tui/chat-items.ts +330 -0
  75. package/src/tui/live-overlay.ts +874 -0
  76. package/src/tui/status.ts +553 -27
  77. package/src/tui/tree-view.ts +808 -0
  78. package/src/tui/viz/canvas.ts +119 -0
  79. package/src/tui/viz/layout.ts +111 -0
  80. package/src/tui/viz/model.ts +123 -0
  81. package/src/tui/viz/palette.ts +188 -0
  82. package/src/tui/viz/panels.ts +530 -0
  83. package/src/tui/viz/railway.ts +313 -0
  84. package/src/tui/viz/rate.ts +211 -0
  85. package/src/tui/viz/view.ts +228 -0
  86. package/src/extension/parent-label.ts +0 -115
  87. package/src/profiles/classify.ts +0 -375
  88. package/src/profiles/profiles.ts +0 -730
  89. package/src/runs/layout.ts +0 -258
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-legion",
3
- "version": "0.16.0",
3
+ "version": "2.0.0",
4
4
  "description": "Herdr-backed subagents for Pi: visible, steerable, resumable child agents in Herdr panes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,12 +46,14 @@
46
46
  ],
47
47
  "scripts": {
48
48
  "typecheck": "tsc --noEmit",
49
- "test": "node --experimental-strip-types --test test/unit/*.test.ts",
50
- "test:integration": "node --experimental-strip-types --test test/integration/*.test.ts",
51
- "test:live": "node --experimental-strip-types --test test/live/*.test.ts",
49
+ "test": "env -u PI_SUBAGENT_ALLOW_NESTED -u PI_SUBAGENT_CHILD -u PI_SUBAGENT_UTILITY_CHILD -u PI_SUBAGENT_MAX_DEPTH -u PI_SUBAGENT_PARENT_PATH -u PI_LEGION_DB -u PI_LEGION_NODE_ID node --experimental-strip-types --test test/unit/*.test.ts",
50
+ "test:integration": "env -u PI_SUBAGENT_ALLOW_NESTED -u PI_SUBAGENT_CHILD -u PI_SUBAGENT_UTILITY_CHILD -u PI_SUBAGENT_MAX_DEPTH -u PI_SUBAGENT_PARENT_PATH -u PI_LEGION_DB -u PI_LEGION_NODE_ID node --experimental-strip-types --test test/integration/*.test.ts",
51
+ "test:live": "env -u PI_SUBAGENT_ALLOW_NESTED -u PI_SUBAGENT_CHILD -u PI_SUBAGENT_UTILITY_CHILD -u PI_SUBAGENT_MAX_DEPTH -u PI_SUBAGENT_PARENT_PATH -u PI_LEGION_DB -u PI_LEGION_NODE_ID node --experimental-strip-types --test test/live/*.test.ts",
52
52
  "test:all": "npm run typecheck && npm run test && npm run test:integration",
53
- "test:docker": "bash test/docker/verify-1-child-guard.sh && bash test/docker/verify-2-task-appendix.sh && bash test/docker/verify-3-readonly.sh && bash test/docker/verify-4-acceptance.sh && bash test/docker/verify-5-blocked.sh && bash test/docker/verify-6-cache.sh && bash test/docker/verify-7-budget.sh && bash test/docker/verify-8-verify-command.sh && bash test/docker/verify-9-worktree.sh && bash test/docker/verify-10-fallback.sh && bash test/docker/verify-11-nested-alias.sh && bash test/docker/verify-12-workspace.sh",
54
- "prepublishOnly": "npm run typecheck && npm run test && npm run test:integration"
53
+ "test:docker": "env -u PI_SUBAGENT_ALLOW_NESTED -u PI_SUBAGENT_CHILD -u PI_SUBAGENT_UTILITY_CHILD -u PI_SUBAGENT_MAX_DEPTH -u PI_SUBAGENT_PARENT_PATH sh -c 'echo \"RPC mainline Docker checks only; legacy Herdr workspace/kind/notification scenarios are archived under test/legacy/docker and require pi-legion v0.16.x\" && bash test/docker/verify-1-child-guard.sh && bash test/docker/verify-2-task-appendix.sh && bash test/docker/verify-3-readonly.sh && bash test/docker/verify-4-acceptance.sh && bash test/docker/verify-5-blocked.sh && bash test/docker/verify-6-cache.sh && bash test/docker/verify-7-budget.sh && bash test/docker/verify-8-verify-command.sh && bash test/docker/verify-9-worktree.sh && bash test/docker/verify-10-fallback.sh && bash test/docker/verify-11-nested-alias.sh'",
54
+ "prepublishOnly": "npm run typecheck && npm run test && npm run test:integration",
55
+ "mock-llm": "node --experimental-strip-types test/mock-llm/cli.ts",
56
+ "test:mock-llm": "env -u PI_SUBAGENT_ALLOW_NESTED -u PI_SUBAGENT_CHILD -u PI_SUBAGENT_UTILITY_CHILD -u PI_SUBAGENT_MAX_DEPTH -u PI_SUBAGENT_PARENT_PATH -u PI_LEGION_DB -u PI_LEGION_NODE_ID node --experimental-strip-types --test test/unit/mock-llm*.test.ts test/integration/mock-llm*.test.ts test/integration/railway-mock-e2e.test.ts"
55
57
  },
56
58
  "peerDependencies": {
57
59
  "@earendil-works/pi-agent-core": "*",
@@ -78,9 +80,10 @@
78
80
  }
79
81
  },
80
82
  "devDependencies": {
81
- "@earendil-works/pi-agent-core": "^0.85.1",
82
- "@earendil-works/pi-coding-agent": "^0.85.1",
83
- "@earendil-works/pi-tui": "^0.85.1",
83
+ "@earendil-works/pi-agent-core": "^1.0.0",
84
+ "@earendil-works/pi-ai": "^1.0.0",
85
+ "@earendil-works/pi-coding-agent": "^1.0.0",
86
+ "@earendil-works/pi-tui": "^1.0.0",
84
87
  "@types/node": "^22.0.0",
85
88
  "typebox": "^1.3.30",
86
89
  "typescript": "^5.6.0"
@@ -1,120 +1,98 @@
1
1
  ---
2
2
  name: pi-legion
3
- description: "Delegate with the subagent tool whenever a loaded role matches the job (search, scout, planner, worker, reviewer, oracle, or any user agent in ~/.pi/agent/agents). Prefer subagent over doing that work yourself. Do not run herdr CLI to launch agents."
3
+ description: "Use the subagent tool to delegate to a loaded role; use centurion for recursive squads and /legion to inspect the tree. Pi Legion v2 runs headless Pi RPC children and records their shared tree state in legion.db."
4
4
  ---
5
5
 
6
6
  # Pi Legion
7
7
 
8
- The launch path is frozen. Do not invent herdr commands.
8
+ Use the `subagent` tool to delegate to a matching loaded role. Prefer the
9
+ specific role that fits the task; use a `centurion` when the task needs a
10
+ recursive team, a frozen squad contract, and a tree-shaped delivery. Do not
11
+ launch child processes manually.
9
12
 
10
- The system prompt lists **every loaded role** each turn, including user agents
11
- such as `search`. Use the matching name. Do not curl the web yourself when a
12
- search/research role exists.
13
+ ## Dispatch
13
14
 
14
15
  ```text
15
16
  subagent({ agent: "search", task: "<query>" })
16
17
  subagent({ agent: "worker", task: "<task card>" })
17
- subagent({ agent: "worker", task: "<task card>", worktree: true })
18
+ subagent({ agent: "centurion", task: "<目标 + 验收清单>" })
18
19
  subagent({ tasks: [
19
20
  { agent: "reviewer", task: "<lane A>" },
20
21
  { agent: "reviewer", task: "<lane B>" },
21
22
  ] })
22
23
  ```
23
24
 
24
- That is the entire dispatch. The tool creates the type tab, splits panes, starts
25
- agents, shows status **above the input**, and queues a completion when a child
26
- finishes. If this session is idle it wakes immediately; if it is still working,
27
- the notice waits until the current turn ends. **Same agent type = one tab,
28
- different panes.** A scout and a reviewer get two tabs; two scouts share one.
29
-
30
- **First action is the `subagent` tool.** Do not `test HERDR_ENV`, do not
31
- `herdr --help`, do not `herdr agent` / `herdr pane`, do not `pane split` /
32
- `agent start` / `agent prompt` / `agent wait`. Those are the old ritual; the
33
- plugin will block them. Prefer one `tasks[]` call over two separate launches.
34
-
35
- **Isolation is your call.** Pass `worktree: true` when another parent may write
36
- this repo, or when the child should ship via MR (own branch, do not touch the
37
- current checkout). Pass `worktree: false` to edit this checkout in place. Omit
38
- it to use the role default (bundled `worker` isolates).
39
-
40
- Then return control. Completions arrive as `Background task completed: **name**`.
41
- The plugin recycles the child's pane (and the type tab when empty) when the
42
- turn finishes. Do not `retire` or close panes yourself. `resume` from the
43
- session file if you need the child again. `collect` after auto-watch returns
44
- the cached snapshot; `retire` after auto-recycle is a no-op. Pass `async: false`
45
- only for a short foreground run.
46
-
47
- Parallel children launched together finish at different times; their completion
48
- notices are merged and delivered as one grouped message — read it once and
49
- synthesize a combined summary instead of reacting per child. If you need
50
- first-finished-first or know runtimes differ wildly, call
51
- `subagent({ action: "wait", all: true, timeoutMs })` (or `wait` with `name`)
52
- to block for results.
53
-
54
- A completion notice reading `collect timed out … the agent is still alive` is a
55
- progress signal, not a verdict: the child keeps running and will notify again
56
- when it truly finishes. Check `status` and the child's session tail before
57
- deciding to steer or continue — a `continue` while it is mid-turn appends to
58
- its queue rather than interrupting.
59
-
60
- ## Task cards
61
-
62
- Write the work, the paths, and the output location. The plugin **already
63
- appends** frozen constraints to every child:
64
-
65
- - do not prompt / wait on / send-keys to any other pane
66
- - do not read or close panes that are not yours
67
- - do not spawn nested agents
68
- - writers: isolated worktree branch; commit there and open an MR, do not write the parent checkout
69
- - end with `{"ok": true|false, "reason": "..."}` on its own line
70
-
71
- Do **not** add a wakeup instruction. Never tell a child to
72
- `herdr agent prompt` this pane.
73
-
74
- Read-only roles (`scout`, `reviewer`) still have `bash` for reconnaissance;
75
- writes are blocked by the child-guard. You do not need to repeat “do not `rm`”
76
- in the task unless you want extra emphasis.
25
+ That is the dispatch path: Pi Legion starts headless `pi --mode rpc` child
26
+ processes under a tree-aware supervisor. A `centurion` leads its own squad and
27
+ may recursively dispatch when its role and inherited depth budget allow it;
28
+ ordinary roles should not be assumed to have that permission. Give every child
29
+ a concrete task and acceptance criteria. Children communicate through the
30
+ Legion tools, not by starting another runtime or editing the shared tree ledger
31
+ directly.
32
+
33
+ ## Legion visualization
34
+
35
+ In an interactive Pi session, `/legion` opens the paged Legion tree. Navigate
36
+ with `j`/`k` or the arrow keys, use Enter/Space to expand or collapse, `/` to
37
+ search, and PageUp/PageDown to scroll; `q` or Esc closes the tree. Press `o` on
38
+ the selected node, or use a component-routed mouse click in the full-screen
39
+ tree, to open its live overlay. `/legion <name>` opens a node directly. If
40
+ short names are ambiguous, use the full node ID shown in command completion.
41
+ Esc closes an overlay and unsubscribes its node's live feed. OSC 8 links are
42
+ visual anchors only; they do not open overlays or route clicks.
43
+
44
+ ## Tree tools and phases
45
+
46
+ Child nodes have access to:
47
+
48
+ - `legion_mail` for asynchronous messages along permitted parent/child/sibling
49
+ tree edges. Cross-squad mail must be routed through the relevant centurions;
50
+ there is no direct bypass to the root.
51
+ - `legion_tree` for read-only machine state. Observation does not interrupt the
52
+ node being observed.
53
+ - `legion_phase` for centurions to request a phase transition. The supervisor
54
+ validates and records the transition; do not claim a phase change from chat
55
+ text alone.
56
+
57
+ A squad's four work phases are **planning → implementing → reviewing →
58
+ verifying**. Planning writes `.pi-legion/contract.md` with interfaces, file
59
+ ownership, and acceptance commands before implementation starts. Reviewing
60
+ uses independent review; verifying runs the contract's `legion-verify`
61
+ commands under the supervisor, without an LLM deciding whether they passed.
62
+
63
+ ## Delivery, resume, and isolation
64
+
65
+ A centurion owns a Git worktree for its subtree; squad members share that
66
+ worktree, and a nested centurion gets a nested Git worktree. Each squad
67
+ squashes its subtree into an MR for its parent. MRs move upward until the root
68
+ reviews and merges into the default branch. Do not merge a child squad's work
69
+ at the wrong level.
70
+
71
+ Resume uses saved run records and Pi session files. Parent shutdown does not
72
+ leave detached child processes; recovery follows the tree's resume chain.
73
+ Keep the run/session records while the squad may need to resume. The
74
+ `legion.db` file is a machine-owned shared ledger: use `legion_mail`,
75
+ `legion_tree`, and `legion_phase`, not direct database access.
76
+
77
+ A Git worktree is workspace separation, not a security sandbox. Read-only
78
+ checks remain guardrails rather than a process boundary; never rely on them to
79
+ protect against intentional writes. Pi Legion v2 supports `kind: pi`; for a
80
+ role that requires a non-Pi CLI, use the Herdr-era 0.16.x release line rather
81
+ than expecting v2 to launch it.
77
82
 
78
83
  ## Later control
79
84
 
80
- ```text
81
- subagent({ action: "steer", name, message })
82
- subagent({ action: "continue", name, message })
83
- subagent({ action: "resume", name, message })
84
- subagent({ action: "status", name })
85
- subagent({ action: "list" })
86
- ```
87
-
88
- If a child is waiting on a tool approval, the parent TUI gets a confirm
89
- (`onBlocked: forward`). Do not invent a `steer` just to type `y`.
90
-
91
- ## Model profiles
92
-
93
- Roles do not pin a vendor model. To bind capability tiers without switching the
94
- parent session each time:
85
+ Steer, inspect, collect, resume, or retire children with the `subagent` tool:
95
86
 
96
87
  ```text
97
- /subagents-refresh-provider-models <provider>
98
- /subagents-generate-profiles <provider>
99
- /subagents-load-profile <provider>.quota
88
+ subagent({ action: "status", name: "worker-0" })
89
+ subagent({ action: "collect", name: "worker-0" })
90
+ subagent({ action: "steer", name: "worker-0", message: "Focus on the parser tests." })
91
+ subagent({ action: "resume", name: "worker-0" })
92
+ subagent({ action: "retire", name: "worker-0" })
100
93
  ```
101
94
 
102
- `scout` → cheap, `planner` → medium, `worker`/`reviewer`/`oracle` → strong.
103
- `/subagents-profiles` lists saved files; `/subagents-check-profile <name>`
104
- verifies they still resolve.
105
-
106
- ## Listing roles
107
-
108
- `/subagents-agents [user|project|both]` shows every role the `subagent` tool
109
- can spawn in this session — grouped by layer (builtin / user / project), each
110
- with the model a launch would actually resolve (and where it came from),
111
- kind, aliases, and the defining file. The same scope semantics as the tool's
112
- `agentScope`; re-reads agent files on every invocation.
113
-
114
- ## Isolation
115
-
116
- Child-guard blocks `herdr agent prompt` and foreign `pane read`, and it blocks
117
- writes for read-only roles. Writer roles (`worker`) run in an isolated git
118
- worktree on their own branch and ship via MR — they must not write the parent
119
- checkout. Herdr is still **one trust domain**: never put secrets on screen
120
- while children run. Do not treat a pane as a sandbox.
95
+ For a blocked extension UI request, the RPC supervisor bubbles the request up
96
+ to the root Pi UI for human response by default. A child completion or a
97
+ `legion_mail` message is not a substitute for checking its saved result and
98
+ machine-recorded state.
@@ -18,7 +18,6 @@ import {
18
18
  type AcceptanceConfig,
19
19
  type AcceptanceCriterion,
20
20
  type OnBlockedPolicy,
21
- type Placement,
22
21
  type SystemPromptMode,
23
22
  type ToolBudgetConfig,
24
23
  type TurnBudgetConfig,
@@ -35,6 +34,7 @@ export const BUILTIN_AGENT_NAMES = [
35
34
  "planner",
36
35
  "reviewer",
37
36
  "worker",
37
+ "centurion",
38
38
  "advisor",
39
39
  "designer",
40
40
  "prototype",
@@ -78,11 +78,6 @@ function extraAgentDirs(): string[] {
78
78
 
79
79
  const VALID_KINDS: ReadonlySet<string> = new Set(AGENT_KINDS);
80
80
 
81
- const VALID_PLACEMENTS: ReadonlySet<string> = new Set([
82
- "split-down",
83
- "split-right",
84
- "new-tab",
85
- ]);
86
81
  const VALID_ON_BLOCKED: ReadonlySet<string> = new Set([
87
82
  "forward",
88
83
  "auto-approve",
@@ -382,6 +377,7 @@ export function parseAgentDocument(
382
377
  // Defaults chosen to match pi-subagents conventions (design §6.1).
383
378
  inheritProjectContext: bool(fm.inheritProjectContext) ?? true,
384
379
  inheritSkills: bool(fm.inheritSkills) ?? false,
380
+ ...(bool(fm.inheritExtensions) !== undefined ? { inheritExtensions: bool(fm.inheritExtensions) } : {}),
385
381
  kind: enumOr<AgentKind>(fm.kind, VALID_KINDS, "pi"),
386
382
  systemPrompt: body,
387
383
  source,
@@ -393,6 +389,8 @@ export function parseAgentDocument(
393
389
  applyCapabilityFields(config, fm);
394
390
  applyBehaviorFields(config, fm);
395
391
  applyHerdrFields(config, fm);
392
+ const team = str(fm.team);
393
+ if (team) config.extraFields = { ...(config.extraFields ?? {}), team };
396
394
 
397
395
  config.unenforcedFields = unenforcedFieldsIn(config);
398
396
  return config;
@@ -471,6 +469,7 @@ function applyBehaviorFields(config: AgentConfig, fm: AgentFrontmatter): void {
471
469
  setIf(config, "completionGuard", bool(fm.completionGuard));
472
470
  setIf(config, "maxSubagentDepth", int(fm.maxSubagentDepth));
473
471
  setIf(config, "allowNestedSubagents", bool(fm.allowNestedSubagents));
472
+ setIf(config, "utility", bool(fm.utility));
474
473
  setIf(config, "disabled", bool(fm.disabled));
475
474
  setIf(config, "worktree", bool(fm.worktree));
476
475
  setIf(config, "steer", bool(fm.steer));
@@ -484,12 +483,8 @@ function applyBehaviorFields(config: AgentConfig, fm: AgentFrontmatter): void {
484
483
  }
485
484
  }
486
485
 
487
- /** herdr-specific placement and blocking policy. */
486
+ /** Transitional blocked-policy frontmatter retained for approval handling. */
488
487
  function applyHerdrFields(config: AgentConfig, fm: AgentFrontmatter): void {
489
- const placement = str(fm.placement);
490
- if (placement && VALID_PLACEMENTS.has(placement)) {
491
- config.placement = placement as Placement;
492
- }
493
488
  const onBlocked = str(fm.onBlocked);
494
489
  if (onBlocked && VALID_ON_BLOCKED.has(onBlocked)) {
495
490
  config.onBlocked = onBlocked as OnBlockedPolicy;
@@ -25,17 +25,18 @@ export const OVERRIDE_FIELDS = [
25
25
  "thinking",
26
26
  "output",
27
27
  "kind",
28
- "placement",
29
28
  "onBlocked",
30
29
  "systemPromptMode",
31
30
  "systemPrompt",
32
31
  // booleans
33
32
  "inheritProjectContext",
34
33
  "inheritSkills",
34
+ "inheritExtensions",
35
35
  "defaultProgress",
36
36
  "async",
37
37
  "completionGuard",
38
38
  "allowNestedSubagents",
39
+ "utility",
39
40
  "disabled",
40
41
  "worktree",
41
42
  "steer",
@@ -8,7 +8,7 @@
8
8
  import * as os from "node:os";
9
9
  import * as path from "node:path";
10
10
 
11
- /** Directory that holds `settings.json`, `agents/`, and `profiles/`. */
11
+ /** Directory that holds `settings.json` and user-defined `agents/`. */
12
12
  export function getAgentDir(): string {
13
13
  const configured = process.env.PI_CODING_AGENT_DIR;
14
14
  if (configured === "~") return os.homedir();