pi-herdsman 0.1.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.
package/docs/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # Pi Herdsman documentation
2
+
3
+ [Repository README](../README.md)
4
+
5
+ This directory is the canonical product documentation for `pi-herdsman`.
6
+
7
+ Pi Herdsman is built around asynchronous orchestration: managed workers can continue
8
+ independently while the lead Pi session remains the user's interactive session.
9
+ The exact lifecycle semantics live on [Lifecycle](concepts/lifecycle.md).
10
+
11
+ The documentation follows one-source-of-truth ownership: every public concept
12
+ has one canonical page. Audience pages route readers to those pages instead of
13
+ copying their full contracts.
14
+
15
+ ## Choose your path
16
+
17
+ ### Use Pi Herdsman from the UI
18
+
19
+ Start with [Getting started](getting-started.md).
20
+
21
+ This path is for people who want to install Pi Herdsman, delegate work without
22
+ leaving the lead conversation, configure agent definitions and placement,
23
+ observe managed agents, focus their panes, and use lead controls
24
+ without reading the structured model-facing API first.
25
+
26
+ Continue with:
27
+
28
+ - [`/workers` commands](reference/commands.md)
29
+ - [Status widget](reference/status-widget.md)
30
+ - [Configuration](reference/configuration.md)
31
+ - [Agent definitions](guides/agent-definitions.md)
32
+ - [Customizing bundled agents](guides/customizing-agents.md)
33
+ - [Agent-definition schema](reference/agent-definition-schema.md)
34
+ - [Recovery](guides/recovery.md)
35
+
36
+ ### Coordinate through agent APIs
37
+
38
+ Start with [Agent coordination API](agent-api.md).
39
+
40
+ This path is for model and agent coordination behavior: non-blocking assignment,
41
+ exact worker identity, lifecycle, delegation, owner clarification, handoffs, and
42
+ failure handling.
43
+
44
+ Continue with:
45
+
46
+ - [`worker` API](reference/worker.md)
47
+ - [`ask_owner` API](reference/ask-owner.md)
48
+ - [Workers and identity](concepts/workers.md)
49
+ - [Lifecycle](concepts/lifecycle.md)
50
+ - [Delegation](concepts/delegation.md)
51
+ - [Handoffs and files](guides/handoffs.md)
52
+ - [Worker states](reference/worker-states.md)
53
+ - [Errors](reference/errors.md)
54
+
55
+ For chief supervision of independent leads, read [Supervision](concepts/supervision.md)
56
+ and its [complete reference contract](reference/supervision.md).
57
+
58
+ ### Develop Pi Herdsman
59
+
60
+ Maintainer-only material stays separate from both product paths:
61
+
62
+ - [Validation](development/validation.md)
63
+ - [Smoke testing](development/smoke-testing.md)
64
+ - [Documentation maintenance](development/documentation.md)
65
+
66
+ The repository directories still group pages by content type (`concepts`,
67
+ `guides`, `reference`, and `development`). The documentation index is
68
+ audience-first so readers do not need to understand that internal grouping
69
+ before choosing the material relevant to them.
70
+
71
+ ## Canonical ownership
72
+
73
+ | Subject | Canonical page |
74
+ | ------------------------------------- | --------------------------------------------------------------- |
75
+ | Human UI first use | [Getting started](getting-started.md) |
76
+ | Agent/API first use | [Agent coordination API](agent-api.md) |
77
+ | Asynchronous orchestration | [Lifecycle](concepts/lifecycle.md) |
78
+ | Worker identity | [Workers and identity](concepts/workers.md) |
79
+ | State transitions | [Lifecycle](concepts/lifecycle.md) |
80
+ | Delegation model | [Delegation](concepts/delegation.md) |
81
+ | Creating definitions | [Agent definitions](guides/agent-definitions.md) |
82
+ | Overrides and prompt composition | [Customizing bundled agents](guides/customizing-agents.md) |
83
+ | `files`, body references, and results | [Handoffs and files](guides/handoffs.md) |
84
+ | Operator recovery | [Recovery](guides/recovery.md) |
85
+ | `worker` request contract | [`worker` API](reference/worker.md) |
86
+ | `ask_owner` contract | [`ask_owner` API](reference/ask-owner.md) |
87
+ | Pi Herdsman supervision concept | [Supervision](concepts/supervision.md) |
88
+ | Chief and staff tools | [Supervision reference](reference/supervision.md) |
89
+ | Frontmatter fields | [Agent-definition schema](reference/agent-definition-schema.md) |
90
+ | Public worker states | [Worker states](reference/worker-states.md) |
91
+ | `/workers` human commands | [`/workers` commands](reference/commands.md) |
92
+ | Settings | [Configuration](reference/configuration.md) |
93
+ | TUI worker widget | [Status widget](reference/status-widget.md) |
94
+ | Error categories | [Errors](reference/errors.md) |
95
+ | Repository checks | [Validation](development/validation.md) |
96
+ | Live acceptance | [Smoke testing](development/smoke-testing.md) |
97
+
98
+ When another page needs one of these subjects, it summarizes only enough to
99
+ establish context and links to the canonical page instead of restating the full
100
+ contract.
101
+
102
+ Root `SKILL.md` remains optional model-facing reinforcement of the
103
+ self-contained runtime operational contract plus deeper coordination guidance.
104
+ Runtime remains authoritative and does not depend on the skill.
@@ -0,0 +1,103 @@
1
+ # Agent coordination API
2
+
3
+ [Documentation index](README.md) · [Human UI path](getting-started.md) · [supervision reference](reference/supervision.md)
4
+
5
+ This is the entry point for model and agent-facing Pi Herdsman coordination.
6
+ Pi Herdsman is opinionated about coordination semantics, not the workflow built on
7
+ top of them. The API provides assignment, control, lifecycle, clarification, and
8
+ handoff primitives without prescribing a planning, implementation, or review
9
+ process.
10
+
11
+ Exact request schemas, states, lifecycle rules, and error behavior remain on
12
+ their canonical pages.
13
+
14
+ If you only want to configure, observe, focus, or stop agents from Pi's TUI,
15
+ begin with [Getting started](getting-started.md) instead.
16
+
17
+ For an active chief supervising independent leads, use the [`staff` and
18
+ `chief` contracts](reference/supervision.md).
19
+
20
+ ## Prerequisites
21
+
22
+ Installation and supported versions are owned by
23
+ [Getting started](getting-started.md#1-check-requirements). The lead Pi session
24
+ must run inside [herdr](https://github.com/herdrdev/herdr).
25
+
26
+ ## First use
27
+
28
+ The exact controller contract is the [`worker` API](reference/worker.md).
29
+ Start by inspecting the current roster and authoritative visible workers:
30
+
31
+ ```json
32
+ { "action": "list" }
33
+ ```
34
+
35
+ Then delegate to a fresh worker by definition:
36
+
37
+ ```json
38
+ {
39
+ "action": "delegate",
40
+ "definition": "implementer",
41
+ "task": "Implement the approved change"
42
+ }
43
+ ```
44
+
45
+ `delegate` is non-blocking orchestration. It returns after the worker has accepted
46
+ the assignment, not when the worker finishes.
47
+
48
+ The owner remains free to make useful progress, coordinate other independent
49
+ work, or end its turn normally. It must not poll the worker. Completion or an
50
+ `ask_owner` question is delivered back to the exact owner asynchronously.
51
+
52
+ The detailed lifecycle contract, including result delivery, one-assignment
53
+ cleanup, blocked work, settling, and delegating-worker completion, is owned by
54
+ [Lifecycle](concepts/lifecycle.md).
55
+
56
+ The examples above establish the first-use path only. Use the
57
+ [`worker` API](reference/worker.md) for exact accepted fields, validation,
58
+ control eligibility, session continuation, fork behavior, and return shapes.
59
+
60
+ ## Understand worker identity
61
+
62
+ Read [Workers and identity](concepts/workers.md) for the identity model behind
63
+ controller operations. The logical worker identity is exposed as `worker` for
64
+ live control; physical herdr and Pi identifiers are validation evidence.
65
+
66
+ For the exact public state vocabulary, see
67
+ [Worker states](reference/worker-states.md).
68
+
69
+ ## Delegate deliberately
70
+
71
+ Read [Delegation](concepts/delegation.md) for lead and delegating-worker
72
+ ownership and delegation limits.
73
+
74
+ A worker that genuinely needs an owner decision uses the separate
75
+ [`ask_owner` API](reference/ask-owner.md). The exact owner answers through the
76
+ controller's `reply` action; ordinary active worker work is not an owner
77
+ question.
78
+
79
+ ## Pass evidence through handoffs
80
+
81
+ Read [Handoffs and files](guides/handoffs.md) for `files`, result paths, body
82
+ references, and coordination artifacts. That guide owns the evidence-transfer
83
+ workflow; the `worker` reference owns the accepted request fields.
84
+
85
+ ## Handle failures conservatively
86
+
87
+ Use [Errors](reference/errors.md) for exact public error categories and
88
+ [Recovery](guides/recovery.md) for operator recovery procedures. Do not infer
89
+ control authority from the status widget or from stale physical-process
90
+ observations.
91
+
92
+ ## Human UI is a separate surface
93
+
94
+ The lead TUI exposes `/workers`, the status widget, definition
95
+ configuration, layout selection, focus navigation, and emergency Stop all.
96
+ Those are human-facing surfaces and are documented separately:
97
+
98
+ - [`/workers` commands](reference/commands.md)
99
+ - [Status widget](reference/status-widget.md)
100
+ - [Configuration](reference/configuration.md)
101
+ - [Getting started](getting-started.md)
102
+
103
+ They do not replace the structured agent coordination contracts linked above.
@@ -0,0 +1,100 @@
1
+ # Delegation
2
+
3
+ [Documentation index](../README.md)
4
+
5
+ Delegation is bounded, direct, and ownership-local.
6
+
7
+ ## Lead
8
+
9
+ The lead Pi session may delegate to any discovered effective agent definition.
10
+ The lead retains architecture, global scope, acceptance, integration, and final
11
+ decision authority.
12
+
13
+ ## Delegating worker
14
+
15
+ A lead-launched worker becomes delegation-enabled when its effective definition
16
+ has a non-empty `workers` list and its tool policy permits the `worker` tool.
17
+ The worker receives only the definitions named by its effective `workers` list.
18
+
19
+ A delegating worker:
20
+
21
+ - delegates only to its permitted worker definitions;
22
+ - owns only its direct workers;
23
+ - integrates direct worker results into its own assignment;
24
+ - remains subordinate to the lead's approved objective.
25
+
26
+ Worker-started workers are leaves. Their effective metadata and launch policy
27
+ remove the `workers` allowlist and `worker` capability. This keeps the supported
28
+ structure bounded:
29
+
30
+ ```text
31
+ lead
32
+ └── delegating worker
33
+ └── worker
34
+ ```
35
+
36
+ A lead may have many direct workers, and each direct worker that is explicitly
37
+ delegation-enabled may have its own direct workers. A delegation-capable worker
38
+ remains a worker at every depth; it is not a separate public role.
39
+
40
+ ## Inferred `worker` capability
41
+
42
+ A non-empty `workers` field implies the `worker` tool when the definition uses
43
+ an explicit non-empty `tools` allowlist. An omitted tool allowlist keeps Pi's
44
+ default tool policy rather than creating a `worker`-only list.
45
+
46
+ Explicit denial wins:
47
+
48
+ - `excludeTools: ["worker"]` prevents inference.
49
+ - `noTools: true` prevents inferred `worker` unless `worker` is explicitly
50
+ present in `tools`.
51
+ - An explicit exclusion wins over an explicit allow.
52
+
53
+ The exact field semantics live in the
54
+ [agent-definition schema](../reference/agent-definition-schema.md).
55
+
56
+ ## Parallelism
57
+
58
+ Delegate genuinely independent or context-heavy work. Prefer workers for broad
59
+ file inspection, large logs or command output, and dataset analysis. Keep small,
60
+ tightly coupled work local.
61
+
62
+ Do not:
63
+
64
+ - delegate overlapping writers to one worktree;
65
+ - delegate review before the writer finishes;
66
+ - duplicate supplied reconnaissance;
67
+ - continue dependent work while a required worker is active.
68
+
69
+ A useful pattern is:
70
+
71
+ ```text
72
+ delegating worker
73
+ ├── scout: bounded reconnaissance
74
+ └── local independent analysis
75
+
76
+ worker result arrives
77
+ ↓
78
+ delegating worker integrates both
79
+ ```
80
+
81
+ ## Clarification across ownership edges
82
+
83
+ A worker may ask its exact direct owner through `ask_owner`.
84
+
85
+ A delegating worker may ask its own direct owner when its unresolved direct
86
+ workers are themselves validly blocked on owner questions. Ordinary active
87
+ worker work or an undelivered worker result still blocks escalation. Questions
88
+ are not automatically forwarded through an ownership chain.
89
+
90
+ ## Closing
91
+
92
+ Closing a delegating worker cascades through its directly owned workers first.
93
+ Cleanup remains ownership-safe: if a required worker cannot be proved or
94
+ closed, the delegating worker is preserved rather than destructively guessing.
95
+
96
+ ## See also
97
+
98
+ - [`ask_owner` API](../reference/ask-owner.md)
99
+ - [Lifecycle](lifecycle.md)
100
+ - [Handoffs and files](../guides/handoffs.md)
@@ -0,0 +1,149 @@
1
+ # Lifecycle
2
+
3
+ [Documentation index](../README.md)
4
+
5
+ The public lifecycle is assignment-centric. It deliberately does not mirror raw
6
+ herdr process states one-for-one.
7
+
8
+ ## Assignment flow
9
+
10
+ A normal assignment moves conceptually through:
11
+
12
+ ```text
13
+ accepted
14
+ ↓
15
+ working
16
+ ↓
17
+ worker completes
18
+ ↓
19
+ settling
20
+ ↓ result delivered once
21
+ cleanup
22
+ ↓
23
+ gone
24
+ ```
25
+
26
+ The authoritative final result is correlated to the accepted assignment request
27
+ ID.
28
+
29
+ ## Clarification flow
30
+
31
+ A worker that requires an owner decision stays on the same assignment:
32
+
33
+ ```text
34
+ working
35
+ ↓ ask_owner
36
+ blocked
37
+ ↓ owner reply
38
+ working
39
+ ↓ completion
40
+ settling
41
+ ↓ result delivery
42
+ cleanup → gone
43
+ ```
44
+
45
+ `reply` is not a new assignment and does not create another final result.
46
+
47
+ ## Public state is a safe-control projection
48
+
49
+ The public states are:
50
+
51
+ - `working`
52
+ - `blocked`
53
+ - `settling`
54
+ - `unknown`
55
+
56
+ See [Worker states](../reference/worker-states.md) for their exact control
57
+ meaning.
58
+
59
+ Raw herdr lifecycle alone is insufficient. Mailbox handoff, pending result
60
+ delivery, pending owner questions, and cleanup may make a worker unsafe to
61
+ control until convergence is complete.
62
+
63
+ ## Asynchronous orchestration
64
+
65
+ Delegation does not suspend the owning controller until a worker finishes.
66
+
67
+ `delegate` returns after the task has been durably accepted. The worker then runs
68
+ independently in its managed Pi session while the owner remains available for
69
+ other useful work and, for a lead Pi session, continued user interaction.
70
+
71
+ The owner must not poll for completion. It may continue with work that does not
72
+ depend on the result or end its turn normally. Worker completion or an
73
+ `ask_owner` question is delivered back to that same owner when attention is
74
+ required.
75
+
76
+ Conceptually:
77
+
78
+ ```text
79
+ assignment accepted
80
+ ↓
81
+ owner remains available
82
+ ↓
83
+ worker runs independently
84
+ ↓
85
+ result or question returns to the owner
86
+ ```
87
+
88
+ This is asynchronous but not fire-and-forget. The owner retains explicit
89
+ assignment ownership, can steer eligible active work, receives clarification
90
+ requests, and remains responsible for result delivery and lifecycle control.
91
+
92
+ ## Exactly-once assignment result
93
+
94
+ Each accepted task request maps to one final assignment result. Each managed
95
+ worker generation receives exactly one assignment; a completed worker is not
96
+ available for another task.
97
+
98
+ Result publication and cleanup are separate convergence steps. A worker may
99
+ therefore appear `settling` after its model has finished. Cleanup follows
100
+ exactly-once delivery for both completed and failed terminal results.
101
+
102
+ ## Session continuation
103
+
104
+ Worker cleanup does not delete the Pi session. To continue completed context,
105
+ use the exact returned session with `delegate.session`; Pi Herdsman starts a new
106
+ worker generation for the new assignment. The continuation uses the saved cwd
107
+ and session history together with the current effective authorized definition
108
+ configuration. Use `delegate.definition` with `fork` when a separate derived
109
+ session is required.
110
+
111
+ ## Steering is different
112
+
113
+ `steer` changes the current active assignment. It does not create an independent
114
+ result.
115
+
116
+ Steering is at-least-once at the worker boundary: a worker can apply a steer
117
+ before its acknowledgement write becomes durable. If that acknowledgement
118
+ write fails, retrying the same request may apply the steer again.
119
+
120
+ Use `steer` only when `worker list` reports `steer` in `available_actions`.
121
+
122
+ ## Delegating worker completion
123
+
124
+ Direct worker work is a completion gate for a delegating worker.
125
+
126
+ A delegating worker cannot publish its own final result while:
127
+
128
+ - a direct worker has ordinary active work; or
129
+ - a completed direct-worker result has not yet been delivered to the delegating worker.
130
+
131
+ This completion gate does not create a separate public delegating-worker state.
132
+ The delegating worker's own state projection remains authoritative.
133
+
134
+ ## Restart and recovery
135
+
136
+ Durable mailbox state allows exact managed workers to be reconstructed after a
137
+ controller restart. Live metadata can be rebuilt only when exact herdr and Pi
138
+ identity still match.
139
+
140
+ Unknown evidence remains `unknown`; recovery never rebinds stale metadata to a
141
+ different worker generation.
142
+
143
+ ## See also
144
+
145
+ - [Pi Herdsman](supervision.md) for lead supervision that does not alter worker
146
+ assignment ownership.
147
+ - [Workers and identity](workers.md)
148
+ - [Worker states](../reference/worker-states.md)
149
+ - [Recovery](../guides/recovery.md)
@@ -0,0 +1,77 @@
1
+ # Supervision
2
+
3
+ [Documentation index](../README.md) · [Supervision reference](../reference/supervision.md)
4
+
5
+ Pi Herdsman supervision lets one chief observe and communicate with independent
6
+ lead sessions. Each lead owns one herd: itself and its complete worker tree.
7
+ The chief supervises leads but never takes ownership of their workers.
8
+
9
+ ## Authority and lead state
10
+
11
+ Herdr proves live process, pane, workspace, and native Pi session identity.
12
+ Pi Herdsman's validated worker snapshots prove managed-worker identity and
13
+ ownership. A supervised lead must be one exact live Pi agent with a matching
14
+ private lead-coordination record; it must not be the chief or a managed worker.
15
+ Missing, stale, duplicate, or ambiguous evidence fails closed.
16
+
17
+ Each lead has one private atomic record under the supervision runtime, keyed by
18
+ the SHA-256 hash of its exact Pi session ID. The latest matching
19
+ `pi-herdsman-lead-state` session entry supplies its persisted coordination
20
+ state. A fresh `instanceId` on initialization protects against stale writers
21
+ and publication races. The record is bounded to 2 KiB; its optional pending
22
+ question is limited to 1,024 characters and 1,024 UTF-8 bytes.
23
+
24
+ The record does not represent scheduling, capacity, permission, or message
25
+ readiness. Herdr lifecycle observation is normalized to
26
+ `idle|working|blocked|done|unknown`. A pending ask is separate attention state
27
+ and gives the lead `needs_you` plus a correlated `reply` action.
28
+
29
+ Metadata is presentation-only. It never grants lead eligibility, chief
30
+ authority, or message authority.
31
+
32
+ ## Chief mode
33
+
34
+ Chief is a mode of an ordinary lead session, not a separate worker identity.
35
+ The persisted `pi-herdsman-role` entry contains either `role: "lead"` or
36
+ `role: "chief"`. Chief mode is workspace-neutral and supervision-only. Its
37
+ model exposes exactly the `staff` tool and excludes project/workspace context
38
+ files and skills. Leaving chief restores the session's ordinary tool set.
39
+
40
+ There is at most one active chief for an exact `HERDR_SOCKET_PATH`. The chief
41
+ lease and descriptor identify the same process-lock generation. A resumed
42
+ Chief session whose lease is occupied becomes suspended; an ordinary lead that
43
+ loses an activation race remains an ordinary lead.
44
+
45
+ ## Communication
46
+
47
+ Chief transport records are bounded, atomic inbox messages bound to exact
48
+ sender, target lead session, and chief lease. Chief messages use Pi follow-up
49
+ delivery and may remain queued while a lead is working. Records are ordered by
50
+ `createdAt` and ID, survive same-session restart, and are retried after
51
+ transient delivery failures. An individual quarantined record is excluded from
52
+ delivery but does not block a new message to that lead.
53
+
54
+ The `chief` tool sends reports, events, results, and genuine decision questions
55
+ from an ordinary lead to the active chief. The `staff` tool lets the active
56
+ chief list, inspect, message, and reply to supervised leads. A lead's message
57
+ does not require an automatic chief reply. A `lead_ask` requires the exact
58
+ correlated `staff reply`; a reply clears the pending ask only after accepted
59
+ follow-up delivery. A replacement chief can answer an existing ask using its
60
+ current lease and unchanged ask ID.
61
+
62
+ ## Supervision state
63
+
64
+ The automatic `<supervision_state>` provider context is ephemeral, bounded, and
65
+ state-only. It contains `leads`, with each lead's exact session ID,
66
+ presentation `display_name`, runtime observation, `worker_counts`, `workers`,
67
+ and available actions. The `staff list` result uses the same presentation field,
68
+ `display_name`. The `workers` collection represents all validated descendants
69
+ assigned to that lead, not only direct workers. Its values and metadata are
70
+ untrusted observations and cannot authorize an action.
71
+
72
+ Use the exact full session ID in a lead's `lead` field when calling `staff`.
73
+ Never target a lead by its display label. `staff` revalidates identity,
74
+ ownership, lifecycle, and the current chief lease before mutation.
75
+
76
+ See the [Supervision reference](../reference/supervision.md) for the complete
77
+ current contract.
@@ -0,0 +1,124 @@
1
+ # Workers and identity
2
+
3
+ [Documentation index](../README.md)
4
+
5
+ A managed worker is a Pi session whose physical lifecycle is owned by herdr and
6
+ whose assignment lifecycle is coordinated through the extension mailbox.
7
+
8
+ ## The identities are intentionally different
9
+
10
+ ### Agent definition
11
+
12
+ The **agent definition** selects the worker's model, reasoning policy, tools,
13
+ skills, extensions, prompt body, context inheritance, and allowed direct
14
+ workers.
15
+
16
+ Example: `reviewer`.
17
+
18
+ Definitions are configuration, not live worker identity.
19
+
20
+ ### Logical worker identity
21
+
22
+ The internal label is projected publicly as the `worker` identity for a live
23
+ worker.
24
+
25
+ Examples:
26
+
27
+ ```text
28
+ reviewer
29
+ reviewer-2
30
+ my-review
31
+ ```
32
+
33
+ Use the exact `worker` value from `worker list` only for
34
+ `steer.worker`, `reply.worker`, or `close.worker` while those actions are listed
35
+ in `available_actions`. A worker label is the live execution identity for one
36
+ assignment, not a continuation handle.
37
+
38
+ Labels must begin with a lowercase letter, contain only lowercase letters,
39
+ digits, `_`, or `-`, and be at most 32 characters.
40
+
41
+ ### Pi session identity
42
+
43
+ Every managed worker has an exact Pi session. The list may expose the session
44
+ ID and path for correlation.
45
+
46
+ A session path or full UUID can be supplied as `delegate.session` to continue
47
+ historical work. It is the continuation identity, not a live-control identity.
48
+ Session delegation creates a new worker generation for one new assignment and
49
+ uses the saved session's cwd and historical context. An exact active or
50
+ unresolved managed representation blocks concurrent activation of that session.
51
+
52
+ ### herdr identities
53
+
54
+ Workspace, tab, pane, generated herdr-agent alias, run ID, and process evidence
55
+ exist to prove physical ownership and safe cleanup.
56
+
57
+ They are not public alternatives to the `worker` identity.
58
+
59
+ ## Ownership
60
+
61
+ Each worker has one exact direct owner Pi session.
62
+
63
+ A lead Pi session owns its direct workers.
64
+
65
+ A delegating worker may own direct workers when its effective definition has
66
+ allowed `workers`.
67
+
68
+ Public list visibility follows this ownership boundary. Lead recovery may expose
69
+ a proven orphan descendant only when durable ownership and exact absence of its
70
+ former delegating worker are established.
71
+
72
+ ## Authority boundaries
73
+
74
+ Different systems answer different questions:
75
+
76
+ | Authority | Owns |
77
+ | ------------- | ---------------------------------------------------------------------------------------- |
78
+ | herdr | Physical process/pane lifecycle, placement, live agent observations |
79
+ | Mailbox | Assignment acknowledgement, active/completed request identity, pending ask, final result |
80
+ | Pi | Session history, turns, messages, model interaction |
81
+ | Logical label | Internal durable worker identity, projected publicly as `worker` |
82
+
83
+ The mailbox `ResultRecord` is the persisted completion record and carries the
84
+ identity needed to match its worker state. The owner-session delivery entry is
85
+ a separate, wider record: it also carries delivery metadata such as `cwd` and
86
+ the Pi session file. Those records are checked against their respective
87
+ identity requirements; `ResultRecord` is not intended to mirror the complete
88
+ delivery-entry shape.
89
+
90
+ If a result cannot be persisted after bounded retries, the worker state carries
91
+ a correlated `result_error` recovery condition instead of becoming assignable.
92
+
93
+ A safe control operation requires these sources to agree. Missing or conflicting
94
+ evidence fails closed rather than guessing.
95
+
96
+ ## Worker generations and continuation
97
+
98
+ Every managed worker generation executes exactly one delegated assignment. Its
99
+ terminal result is delivered once, then the worker's pane, process, mailbox,
100
+ and runtime state are cleaned up. Failed assignments follow the same terminal
101
+ cleanup path.
102
+
103
+ The Pi session remains available after worker cleanup. To continue the same
104
+ conversational context, delegate a new assignment with the exact session ID or
105
+ session path returned with the result. This creates a new worker generation,
106
+ which uses the current effective authorized configuration for the saved agent
107
+ definition. To derive a separate context instead, use `fork` on a definition
108
+ delegation.
109
+
110
+ The identities are therefore:
111
+
112
+ ```text
113
+ agent definition → configuration for new work
114
+ Pi session → durable conversational context and continuation identity
115
+ worker label → live control identity for one assignment
116
+ ```
117
+
118
+ ## See also
119
+
120
+ - [Pi Herdsman](supervision.md) for the separate supervision model.
121
+ - [Lifecycle](lifecycle.md)
122
+ - [Delegation](delegation.md)
123
+ - [Worker states](../reference/worker-states.md)
124
+ - [`worker` API](../reference/worker.md)