この bridge doc はすぐに混ざる次の点をほどくためのものです。
work graph 上の task と、いま実行中の task は同じものではありません。
次の順で読むのが最も分かりやすいです。
- まず
s12-task-system.mdを読み、durable な work graph を固める - 次に
s13-background-tasks.mdを読み、background execution を見る - 用語が混ざり始めたら
glossary.mdを見直す - field を正確に合わせたいなら
data-structures.mdとentity-map.mdを見直す
主線自体は正しいです。
s12は task systems13は background tasks
ただし bridge layer を一枚挟まないと、読者は二種類の「task」をすぐに同じ箱へ入れてしまいます。
例えば:
- 「auth module を実装する」という work-graph task
- 「pytest を走らせる」という background execution
- 「alice がコード修正をしている」という teammate execution
どれも日常語では task と呼べますが、同じ層にはありません。
これは s12 の durable node です。
答えるものは:
- 何をやるか
- どの仕事がどの仕事に依存するか
- 誰が owner か
- 進捗はどうか
つまり:
目標として管理される durable work unit
です。
こちらが答えるものは:
- 今どの execution unit が生きているか
- それが何の type か
- running / completed / failed / killed のどれか
- 出力がどこにあるか
つまり:
runtime の中で生きている execution slot
です。
まず二つの表として分けて考えてください。
work-graph task
- durable
- goal / dependency oriented
- 寿命が長い
runtime task
- execution oriented
- output / status oriented
- 寿命が短い
両者の関係は「どちらか一方」ではありません。
1 つの work-graph task
から
1 個以上の runtime task が派生しうる
例えば:
work-graph task:
"Implement auth module"
runtime tasks:
1. background で test を走らせる
2. coder teammate を起動する
3. 外部 service を monitor する
この境界が崩れると、後続章がすぐに絡み始めます。
s13の background execution がs12の task board と混ざるs15-s17の teammate work がどこにぶら下がるか不明になるs18の worktree が何に紐づくのか曖昧になる
最短の正しい要約はこれです。
work-graph task は目標を管理し、runtime task は実行を管理する
これは s12 の durable task です。
task = {
"id": 12,
"subject": "Implement auth module",
"status": "in_progress",
"blockedBy": [],
"blocks": [13],
"owner": "alice",
"worktree": "auth-refactor",
}教材版の最小形は次の程度で十分です。
runtime_task = {
"id": "b8k2m1qz",
"type": "local_bash",
"status": "running",
"description": "Run pytest",
"start_time": 1710000000.0,
"end_time": None,
"output_file": ".task_outputs/b8k2m1qz.txt",
"notified": False,
}重要 field は:
type: どの execution unit かstatus: active か terminal かoutput_file: 結果がどこにあるかnotified: 結果を system がもう表に出したか
教材 repo ですべての type を即実装する必要はありません。
ただし runtime task は単なる shell 1 種ではなく、型族だと読者に見せるべきです。
最小表は:
local_bash
local_agent
remote_agent
in_process_teammate
monitor
workflow
ここへ runtime state を混ぜないでください。
class RuntimeTaskManager:
def __init__(self):
self.tasks = {}def spawn_bash_task(command: str):
task_id = new_runtime_id()
runtime_tasks[task_id] = {
"id": task_id,
"type": "local_bash",
"status": "running",
"description": command,
}runtime_tasks[task_id]["work_graph_task_id"] = 12初日から必須ではありませんが、teams や worktrees へ進むほど重要になります。
Work Graph
task #12: Implement auth module
|
+-- runtime task A: local_bash (pytest)
+-- runtime task B: local_agent (coder worker)
+-- runtime task C: monitor (watch service status)
Runtime Task Layer
A/B/C each have:
- own runtime ID
- own status
- own output
- own lifecycle
この層が明確になると、後続章がかなり読みやすくなります。
s13の background command は runtime tasks15-s17の teammate も runtime task の一種として見られるs18の worktree は主に durable work に紐づくが runtime execution にも影響するs19の monitor や async external work も runtime layer に落ちうる
「裏で生きていて仕事を進めているもの」を見たら、まず二つ問います。
- これは work graph 上の durable goal か
- それとも runtime 上の live execution slot か
durable task state と runtime execution state が混ざります。
現実の system では、1 つの goal から複数 execution unit が派生することは普通です。
例えば:
- durable tasks:
pending / in_progress / completed - runtime tasks:
running / completed / failed / killed
可能な限り分けた方が安全です。
durable task board はそこまで気にしませんが、runtime layer は強く依存します。