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