Module 4 · Planning, Context & Multi-agent Systems · scripted
The Task Is a Directory
Overview
A decomposition tree is a diagram; make it physical, with the most load- bearing pattern in serious agent work: give every task a directory. The brief, the bar, the work, the evidence — each a file in the right room; subtasks as subdirectories, the same shape recursively. And the deep move: the filesystem becomes the medium between conversations — any agent dropped anywhere in the tree self-briefs by reading, every wall is reconstructible from files, and the amnesia stops mattering because the conversation's world, for once, is durable. The task stops living in any transcript, and starts living in the world.
Task decomposition
Start with the idea this whole pattern builds on. Task decomposition is breaking one large task into smaller subtasks that can be worked on separately, and then composing the pieces back into the whole. Nothing about it is special to computing — it is how humans have always organized work. Three co-authors do not write a paper by holding one pen:
Decomposing a paper
Each author works alone on a piece; the pieces have to fit back together at the end. That is the whole idea:
Task decomposition
Break one large task into subtasks that can be worked on separately. Compose the finished pieces back into the whole.
For agents, we decompose for two specific reasons:
Why agents decompose
And the moment the work is divided, the co-authors' problem appears: coordination. Where does each worker learn its assignment and its constraints? How does it hand its finished piece back? How does it see the parts of the others' work it depends on — the section it must not contradict, the interface it must deliver to? For human co-authors, the answer is shared documents in a shared folder. For agents, the answer is exactly the same, and it is this lesson's pattern:
The pattern
Represent the task — and its decomposition — as a tree of directories in a file system, and let the files be how the agents coordinate.
From tree to filesystem
The decomposition tree we just built was a diagram. Here is how real systems make it physical — a pattern so natural it feels obvious the moment you see it:
The mapping
the task → a directory
its brief → a file of rich context (TASK.md)
its bar → a file of what must be true (CHECK.md,
plus check.sh when the bar is executable)
the work → files created inside, as it happens
its completion → a result file, written at the end
(RESULT.md)
its subtasks → subdirectories — same shape, recursively
The tree of tasks becomes a tree of folders.
Everything about the work becomes a document in the right room.Anatomy of one task directory
A leaf, opened up
Three documents define the task: what it is, what true means, and — when it exists — what happened. The work directory is scratch; the three documents are the contract.
Notice what the two top files really are. TASK.md is the brief
from the seam contract — rich context, self-contained, the child
asks no questions. CHECK.md is the evidence bar — and giving
it an executable form, check.sh, is the hard-evidence principle
made into a file you can run. The directory is the seam
contract, written down where the work will happen.
An agent is spawned into a room
Now the coordination move: to work on a task, spawn an agent whose world is that directory. Its first act is always the same — read the room:
You have the following tools available for use:
- read_file
- write_file
- run_command — scoped to this directory (plus read access to ../schema/)
Task: You are working in portal/ingestion/ntnu-adapter/. Read your task, do it, verify it, and write your result.
read_file(path = "TASK.md")[the brief: format quirks, the A2-v1 interface pointer, scope]read_file(path = "CHECK.md")[the bar: conformance on 3 samples, UTC/meters, no silent drops]write_file(path = "work/parse.py", content = "[the adapter]")OK. work/parse.py written.run_command(cmd = "./check.sh")FAIL: sample-3: 2 rows dropped without log entries (trailing
summary rows discarded silently).write_file(path = "work/parse.py", content = "[logs rejected
rows explicitly]")OK. work/parse.py updated.run_command(cmd = "./check.sh")PASS: 3/3 samples · 4,112 rows · UTC/meters confirmed ·
rejects logged (2). Log: work/sample-runs/run-9.logwrite_file(path = "RESULT.md", content = "Adapter complete at
work/parse.py. Evidence: check.sh PASS 3/3 (run-9.log).
Note for parent: NTNU's summary rows are data-like — flagged
as rejects, worth a rule upstream.")The hierarchy is the visibility
Climb up a level and see what the folder tree is really doing:
The tree, as a coordination structure
This is the placement discipline, implemented by a filesystem.
Scope-by-subtree is carry/fork/file with mkdir: the child's
wall holds its room; the parent's wall holds result files, one
line and a handle each. And the coordinator's completion sweep is
almost embarrassingly simple:
Completion, as a directory walk
"Which subtrees are done?" is not a judgment call —
it is a find command:
done = RESULT.md present AND its evidence green
open = TASK.md without RESULT.md
suspect = RESULT.md present, check now failing
(the world moved — reopen the room)
The project's status dashboard is the tree itself.Why files
Step back and ask why this pattern keeps winning, and the answer is the course's oldest thesis wearing work clothes: everything is a document — so let the work be documents.
What the filesystem buys
Methodologies ride on the chassis
One more reason this pattern matters: it is a chassis, not a methodology. The structure — a room with a brief, a bar, work, and a result, nested — doesn't care how your domain likes to decompose. Your discipline's own scheme drops straight in:
Three methodologies, one chassis
Different fields, different names for the rooms, different bars on the walls. Same chassis: brief, bar, work, result, nested. The methodology chooses WHAT the tasks are; the pattern handles HOW work lives, closes, and composes.
- In Example 1, the agent passed a note upward inside RESULT.md. Trace where that note should go next — whose TASK.md or CHECK.md does it want to change, and who decides?
- What belongs in TASK.md versus the spawned agent's system message? Something must — and something must not — be in each. Draw the line and defend it.
Take the decomposition tree you built in the earlier fork and
make it physical. (1) Lay out the directories; write TASK.md and
CHECK.md for the root and two leaves — the bars as runnable
checks where the world can testify, critic prompts where it
can't. (2) Write the RESULT.md a finished leaf should produce,
evidence included. (3) Map your field's own methodology onto the
chassis: what are the rooms called, and what is the bar on each
wall? (4) Then the test of the pattern: hand your tree, cold, to
a colleague — can they tell you what's done, what's open, and
what's blocked, using nothing but ls and the documents?