worker: split session capture observation features

This commit is contained in:
2026-08-07 16:31:15 +09:00
parent a9bb806387
commit ff50baec99
22 changed files with 2102 additions and 879 deletions
@@ -0,0 +1,11 @@
## Worker session observation
Worker-session tools are a read-only exploration surface over host-granted active Worker sessions.
- Use `ListWorkerSessions` to discover only the sessions already granted to you. Reuse the returned structured `subject` exactly: Runtime peers use `{ kind: "runtime_worker", runtime_id, worker_id }`, while parent-owned children use `{ kind: "sub_worker", name }`. Do not guess subject identifiers.
- Use `ViewSessionOverview` for sparse orientation, `SearchSessionEntries` for bounded range/filter queries, and `ReadSessionEntry` for one bounded entry.
- `SessionEntryRef` is the common entry identity across overview, search, reads, and evidence conversion. Reuse returned `E...` values; never invent them.
- Every operation rereads the latest committed capture. Existing references remain stable when entries append.
- Reasoning and raw system prompts are not exposed. Do not ask another tool or filesystem path to bypass this projection.
- A missing subject and an unauthorized subject intentionally produce the same result. Treat either as inaccessible.
- Observation is not mutation authority and does not prove approval, completion, or Ticket state. Reread the relevant domain authority before acting.
@@ -5,8 +5,8 @@ When SubWorker-management tools are available, SubWorker notifications are backg
The parent Worker does not need to keep a turn open or call tools solely to wait for a notification. Do not use `sleep` or polling loops just to wait for SubWorker output; if there is no useful immediate work, return control and handle the SubWorker when notified or when the user next asks.
Before treating delegated SubWorker work as complete, read the SubWorker output and inspect concrete evidence such as worktree state, diff, and test results. Notifications are hints, not proof of completion.
Before treating delegated SubWorker work as complete, inspect its committed session through worker-observation and verify concrete evidence such as worktree state, diff, and test results. Notifications are hints, not proof of completion.
Peer Workers made visible by reciprocal metadata registration are not spawned children. Use peer messaging only as explicit communication; it does not grant scope, produce a child output cursor, imply parent ownership, or create child completion notifications. Peer sends require a live peer and do not auto-restore stopped peers.
Peer Workers made visible by reciprocal metadata registration are not spawned children. Use peer messaging only as explicit communication; it does not grant session-observation authority, imply parent ownership, or create child completion notifications. Peer sends require a live peer and do not auto-restore stopped peers.
This guidance is not scheduler or auto-maintain authorization. Do not start work, merge or clean up work, close tickets, or bypass user/Ticket authorization solely because Worker tools or notifications exist.
@@ -11,16 +11,17 @@ Your job is to inspect the supplied host-created session reference view and stag
## Tools
Use the session-explore tools only:
Use the co-installed `session-explore` and `memory-extract` tools only:
- `search_evidence`: find bounded evidence ids in the host-created session index. Optional `kind` accepts `user`, `assistant`/`agent`, `system`, or `tool`.
- `read_evidence`: inspect a bounded evidence id or entry range before staging when the overview/index is not enough.
- `stage_candidate`: write one flat staging record for one memory candidate.
- `finish_extraction`: finish the run after all useful candidates are staged, or after deciding there are no useful candidates.
- `ShowOverview`: inspect sparse real user/assistant anchors and intervening-entry counts.
- `SearchEntries`: find bounded `SessionEntryRef` values in the host-created session capture. Optional `kind` accepts `user`, `assistant`/`agent`, or `tool`.
- `ReadEntry`: inspect one bounded `SessionEntryRef` before staging when the overview/index is not enough.
- `StageMemoryCandidate`: write one flat staging record for one memory candidate.
- `FinishMemoryExtraction`: finish the run after all useful candidates are staged, or after deciding there are no useful candidates.
Do not invent evidence ids. Stage candidates only with `M...` or `T...` ids returned by `search_evidence` / `read_evidence` or shown in the initial evidence index. Overview `O...` ids are orientation labels, not source evidence ids.
Do not invent `SessionEntryRef` values. Stage candidates only with `E...` references returned by `ShowOverview`, `SearchEntries`, or `ReadEntry`. The same `SessionEntryRef` identifies an entry across overview, search, reads, and Memory evidence conversion.
Call `stage_candidate` once per useful candidate with this shape:
Call `StageMemoryCandidate` once per useful candidate with this shape:
```json
{
@@ -28,11 +29,11 @@ Call `stage_candidate` once per useful candidate with this shape:
"claim": "...",
"why_useful": "...",
"staleness": "...",
"evidence_ids": ["M0001"]
"entry_refs": ["E00000001"]
}
```
Then call `finish_extraction` exactly once:
Then call `FinishMemoryExtraction` exactly once:
```json
{
@@ -40,7 +41,7 @@ Then call `finish_extraction` exactly once:
}
```
If nothing is worth staging, do not call `stage_candidate`; call `finish_extraction` with `{"staged_count": 0, "no_candidates_reason": "..."}`.
If nothing is worth staging, do not call `StageMemoryCandidate`; call `FinishMemoryExtraction` with `{"staged_count": 0, "no_candidates_reason": "..."}`.
Allowed candidate kinds:
@@ -56,7 +57,7 @@ Required fields per candidate:
- `kind`: one of the allowed candidate kinds.
- `claim`: concise statement of the candidate.
- `why_useful`: why this candidate may be useful for future consolidation.
- `evidence_ids`: one or more host-issued source evidence ids.
- `entry_refs`: one or more host-issued `SessionEntryRef` values.
Optional fields: