소스 검색

rewrite subtask documentation

alvinreal 2 달 전
부모
커밋
f6f7aec31b
3개의 변경된 파일100개의 추가작업 그리고 50개의 파일을 삭제
  1. 1 1
      README.md
  2. 88 39
      docs/subtask.md
  3. 11 10
      docs/tools.md

+ 1 - 1
README.md

@@ -490,7 +490,7 @@ Use this section as a map: start with installation, then jump to features, confi
 | **[Session Management](docs/session-management.md)** | Reuse recent child-agent sessions with short aliases instead of starting over |
 | **[Todo Continuation](docs/todo-continuation.md)** | Auto-continue orchestrator sessions with cooldowns and safety checks |
 | **[Preset Switching](docs/preset-switching.md)** | Switch agent model presets at runtime with `/preset` |
-| **[Subtask](docs/subtask.md)** | Spawn a child orchestrator with `/subtask`, do the requested work, and return a summary to the main session |
+| **[Subtask](docs/subtask.md)** | Run a bounded child worker with `/subtask` and return a structured summary to the main session |
 | **[Codemap](docs/codemap.md)** | Generate hierarchical codemaps to understand large codebases faster |
 | **[Interview](docs/interview.md)** | Turn rough ideas into a structured markdown spec through a browser-based Q&A flow |
 | **[Divoom Display](docs/divoom.md)** | Mirror orchestrator and specialist-agent activity to a Divoom MiniToo Bluetooth display |

+ 88 - 39
docs/subtask.md

@@ -1,59 +1,108 @@
 # Subtask
 
-`/subtask` starts a boomerang-style worker session for the user’s requested
-goal, then returns a compact completion summary to the original session.
+`/subtask` lets the current agent spin up a separate, bounded worker session for
+one specific piece of work. The worker runs as an orchestrator in a real child
+session, completes the requested task, and sends a structured summary back to
+the original conversation.
+
+Use it when you want to offload a focused task without losing the main thread.
 
 ## Usage
 
 ```text
-/subtask <what the worker should do>
+/subtask <focused task for the worker>
 ```
 
-The command asks the current orchestrator to call `subtask` with the
-worker prompt and any clearly relevant files.
+Examples:
+
+```text
+/subtask update the subtask docs and run the relevant checks
+/subtask investigate why the auth retry test is flaky and report findings
+/subtask implement the small button spacing polish in the settings panel
+```
 
-## Flow
+Keep the request narrow. A good subtask has a clear finish line.
 
-1. The main session calls `subtask`.
-2. Slim creates a real child session with `parentID` set to the main session.
-3. The child runs as `orchestrator`, so it can use the normal specialist-agent
-   workflow and delegate through `task` when useful.
-4. Referenced files are loaded into the child as synthetic Read-tool context.
-5. When the child finishes, Slim extracts its assistant output and returns it to
-   the main session inside `<subtask_summary>`.
-6. The child session is aborted for cleanup after the summary is extracted.
+## What happens
 
-In tmux or zellij, the child appears like other delegated work because it is a
-real child session. Existing session-depth and pane cleanup handling apply.
+1. The `/subtask` command asks the current agent to prepare a self-contained
+   worker prompt.
+2. The agent calls the `subtask` tool with that prompt and any clearly relevant
+   files.
+3. Slim creates a real child session with `parentID` pointing at the current
+   session.
+4. The child session runs as `orchestrator`, so it can use normal tools and
+   specialist delegation when useful.
+5. Referenced files are injected as synthetic Read-tool context before the
+   worker starts.
+6. If the worker needs missing conversation details, it can call `read_session`
+   to inspect only the source session that spawned it.
+7. When finished, the worker returns a `<subtask_summary>` with status, changes,
+   files touched, validation, and follow-up notes.
+8. Slim extracts the summary, returns it to the original session, and aborts the
+   child session for cleanup.
 
-## What to put in the prompt
+In tmux or zellij, the subtask appears like other child-agent work because it is
+a real child session. Existing depth limits and pane cleanup handling apply.
 
-The user prompt controls scope. Keep it direct:
+## Worker scope
 
-```text
-/subtask finish the docs for subtask and run the relevant checks
-/subtask investigate the flaky auth test and report what changed
-/subtask implement the small UI polish we discussed
-```
+The worker prompt is intentionally bounded:
 
-The subtask prompt intentionally avoids prescribing extra actions. It should do
-what the user asks, then summarize what happened, files changed, validation run,
-and any remaining risks or follow-up.
+- complete only the requested task,
+- do not broaden scope,
+- do not spawn another subtask,
+- use `read_session` only when needed context is missing,
+- run the most relevant validation checks when practical,
+- stop when the requested task is done.
+
+This keeps subtasks useful for focused execution rather than turning them into a
+second open-ended conversation.
 
 ## Tools
 
 | Tool | Purpose |
 |------|---------|
-| `subtask` | Creates the child worker session and returns its summary |
-| `read_session` | Lets a subtask worker read details from the parent/source session |
-
-## Safety
-
-- Nested subtasks are blocked: a subtask worker should finish its current task
-  and return a summary instead of spawning another subtask worker.
-- File context is restricted to the workspace real path, including symlink
-  checks.
-- Binary files are skipped.
-- Large files are capped before being injected as context.
-- Child sessions use normal OpenCode session lifecycle events, so multiplexer
-  cleanup remains consistent with other delegated agents.
+| `subtask` | Creates a child worker session and returns its summary |
+| `read_session` | Lets a subtask worker read the source session that spawned it |
+
+`read_session` is restricted to subtask workers and only allows reading the
+source session. It is not a general transcript-reading tool.
+
+## File context
+
+Files can be passed explicitly with the `files` argument or referenced in the
+worker prompt with `@path` syntax. Slim resolves those paths inside the current
+workspace and injects readable text files as synthetic context.
+
+Safety rules:
+
+- paths must stay inside the workspace real path,
+- symlinks that resolve outside the workspace are skipped,
+- binary files are skipped,
+- large files are capped before injection,
+- unreadable or missing files are skipped.
+
+## Summary format
+
+The worker is instructed to finish with:
+
+```text
+<subtask_summary>
+Status: completed | blocked | partial
+
+What changed:
+- ...
+
+Files touched:
+- ...
+
+Validation:
+- ...
+
+Risks / follow-up:
+- ...
+</subtask_summary>
+```
+
+The parent session receives that summary as normal tool output.

+ 11 - 10
docs/tools.md

@@ -36,19 +36,20 @@ Fast, structural code search and refactoring — more powerful than plain text g
 
 ## Session Subtask
 
-Run a boomerang-style worker session and return its summary to the caller.
+Run a focused child worker session for a bounded task and return its summary to
+the caller.
 
 | Command / Tool | Description |
 |----------------|-------------|
-| `/subtask <goal>` | Ask the current agent to run a focused child worker for the requested goal |
-| `subtask` | Runs a child subtask worker session and returns its summary to the caller |
-| `read_session` | Reads transcript details from the source session when the subtask summary is missing specifics |
-
-Subtask prompts include `@file` references. Slim creates a real child session
-with the current session as `parentID`, lets the subtask worker read the provided
-context and files, then returns the worker's `<subtask_summary>` back to the
-main session as normal tool output. In tmux/zellij this appears like other child
-agent work: a pane can open for the worker and close when the summary returns.
+| `/subtask <goal>` | Ask the current agent to prepare and start a bounded worker for the requested task |
+| `subtask` | Creates a child orchestrator session and returns its structured summary |
+| `read_session` | Lets a subtask worker inspect the source session when needed context is missing |
+
+Slim creates a real child session with the current session as `parentID`, injects
+relevant file context, and asks the worker to complete only the requested task.
+The worker returns a `<subtask_summary>` with status, changes, files touched,
+validation, and follow-up notes. In tmux/zellij this appears like other child
+agent work: a pane can open for the worker and close after cleanup.
 
 See [Subtask](subtask.md) for the full workflow.