garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-28T12:28:41Z

feat(tree): several directions at once, across projects, under one budget

The person asked for direction over goals across projects: Pinnacle,
Cartopolis and midas each heading somewhere at once, rather than one
direction for the whole tree that a second one replaced.

- `direction` becomes `directions`, in the person's order; a tree from
  before reads its one direction as the first (`d0`, `migrate`), so the
  live Pinnacle direction carries on. Heading for a goal already headed
  for changes that one's limits instead of adding a second.
- One budget over all of them (3 at once, 10 a day, 1 per project unless
  said). The watch looks at each direction in order and starts at most one
  research a look: the first that may, whose next tech's project has room.
  Directions that reach one project take turns there, so two sessions do
  not change one project at once, and a direction waiting on a busy
  project does not hold up another's. `next` says `budget` or `project`
  when that is the wait.
- A tech whose change spans projects carries `lands_in` (the scout's, in
  landing order, or the person's): one session per project in that order,
  each landing on its own as the workspace requires, the tech built once
  the last lands. Before, a tech had one project and the brief for one in
  mithril and pinnacle sent the session to the first project only.
- Goals ▸ Directions draws them as docs/screens/directions.html designed:
  the budget with its slots, each direction with its projects and ↑ ↓; the
  voice reads every direction and the budget and changes them by id.

A replacement string in a scripted edit turned "$${" into "${" (String
replace reads $$ as one $), which dropped the dollar of the week's cost;
caught in the capture, fixed by hand.
docs/hub.md                     |  22 ++-
 docs/screens/directions.html    |   2 +-
 src/discuss.rs                  |  14 +-
 src/tests.rs                    | 106 +++++++++--
 src/tree.rs                     | 376 ++++++++++++++++++++++++++++++++--------
 web/src/app.css                 |  30 ++++
 web/src/components/research.tsx | 203 +++++++++++++++++++---
 web/src/lib/api.ts              |  28 ++-
 web/src/lib/discuss.ts          |   8 +-
 web/src/lib/treetalk.test.ts    |   6 +-
 web/src/lib/treetalk.ts         |  18 +-
 11 files changed, 686 insertions(+), 127 deletions(-)

diff --git a/docs/hub.md b/docs/hub.md
index f0fa476..459ad47 100644
--- a/docs/hub.md
+++ b/docs/hub.md
@@ -833,8 +833,26 @@ is the goal's history: techs built a week by a session beside those the scout
 found built already, and its research sessions newest first, with when each
 started, how long it took, how it ended and what it cost (`sessions` on each
 tech: `at`, `ended`, `cost`; the cost read once from the session's usage lines
-when it ends and kept in `costs`). The design for several directions at
-once, across projects, is `docs/screens/directions.html` (not built). It is
+when it ends and kept in `costs`).
+
+**Directions** (Goals ▸ Directions, `research/directions`, designed in
+`docs/screens/directions.html`): several go at once, each toward its own goal
+in any project, in the person's order (↑ ↓, `direction_order`); heading for a
+goal already headed for changes that one's limits, and a tree from before is
+read with its one direction as the first (`d0`, `migrate`). Above their own
+limits stands one **budget** for all of them (`budget_set`): at once (three
+unless said), started a day (ten) and at once in one project (one). The watch
+looks at each direction in order (`directions_step`) and starts at most one
+research a look: the first that may, whose next tech's project has room — so
+directions that reach one project take turns there, and one waiting on a busy
+project does not hold up another's — and `next` says `budget` or `project`
+when that is what it waits on, with the `project` each works in. A tech whose
+change spans projects says so in **`lands_in`** (the scout's, in the order
+they land, the one depended on first; or the person's, `tech_edit`): it is
+researched one session per project in that order, each landing on its own,
+its brief naming its part (`landed_in` keeps what landed), and it is built
+once the last lands. The goal's page shows the direction toward it, and the
+goal bar links to Directions with how many go. It is
 one file, `hosted/tree.json`: `GET
 /v1/hosted/tree`, `POST /v1/hosted/tree` (by `op`, role `steer`), and the
 runner's `POST /v1/hosted/runner/scouted`. A round can carry a **focus**:
diff --git a/docs/screens/directions.html b/docs/screens/directions.html
index 5f38f60..44032c6 100644
--- a/docs/screens/directions.html
+++ b/docs/screens/directions.html
@@ -1,5 +1,5 @@
 <!doctype html><meta charset="utf-8"><link rel="stylesheet" href="style.css">
-<!-- A design, not a capture: Goals ▸ Directions, several directions over every project at once (not built). -->
+<!-- The design Goals ▸ Directions was built from (tree.rs directions_step, research.tsx directionsPage): drawn before it existed. -->
 <style>
   body { width:2240px; }
   .app { width:1300px; flex:none; border-radius:12px; overflow:hidden; background:#f3f6f6; color:#1d2a2c; box-shadow:0 0 0 1px #2a3236, 0 30px 70px rgba(0,0,0,.55); font-size:14px; }
diff --git a/src/discuss.rs b/src/discuss.rs
index 8b3b612..7da0717 100644
--- a/src/discuss.rs
+++ b/src/discuss.rs
@@ -624,9 +624,17 @@ fn tree_tools() -> Vec<Value> {
             "parameters": {
                 "type": "object",
                 "properties": {
-                    "op": {"type": "string", "enum": ["goal_save", "goal_delete", "idea", "insight_drop", "tech_confirm", "tech_drop", "tech_restore", "tech_built", "tech_edit", "remark", "remark_drop", "proposal_accept", "proposal_drop", "research", "direction_set", "direction_pause", "direction_clear"],
-                        "description": "goal_save: a new goal (no id) or a changed one (its id), name and statement required; goal_delete: a goal (id); idea: the person's idea as an insight on a goal (goal, text, about: a tech's id when it is about one); insight_drop: an insight (id, why); tech_confirm: Keep it, a tech out of the fog (id); tech_drop: Not this (id, why); tech_restore: a dropped tech back (id); tech_built: built or not after all (id, built); tech_edit: a tech's description changed (id, and only the fields that change: name, what, who, differently, exists, size), said back first; remark: a remark on a tech's mockup for its next drawing, in their words (id, text); remark_drop: one taken back (id, remark); proposal_accept: a theme the scout proposed made a goal (id, name to rename it); proposal_drop: (id); research: start a session researching a tech (id); direction_set: head this way, to a goal, a theme or a far tech (target); direction_pause: pause (paused true) or resume (paused false); direction_clear: stop heading anywhere."},
-                    "id": {"type": "string", "description": "The goal, tech, insight or proposal it acts on, by id (g3, k12, i4, p2)."},
+                    "op": {"type": "string", "enum": ["goal_save", "goal_delete", "idea", "insight_drop", "tech_confirm", "tech_drop", "tech_restore", "tech_built", "tech_edit", "remark", "remark_drop", "proposal_accept", "proposal_drop", "research", "direction_set", "direction_limits", "direction_pause", "direction_clear", "direction_order", "budget_set"],
+                        "description": "goal_save: a new goal (no id) or a changed one (its id), name and statement required; goal_delete: a goal (id); idea: the person's idea as an insight on a goal (goal, text, about: a tech's id when it is about one); insight_drop: an insight (id, why); tech_confirm: Keep it, a tech out of the fog (id); tech_drop: Not this (id, why); tech_restore: a dropped tech back (id); tech_built: built or not after all (id, built); tech_edit: a tech's description changed (id, and only the fields that change: name, what, who, differently, exists, done, size, lands_in), said back first; remark: a remark on a tech's mockup for its next drawing, in their words (id, text); remark_drop: one taken back (id, remark); proposal_accept: a theme the scout proposed made a goal (id, name to rename it); proposal_drop: (id); research: start a session researching a tech (id); direction_set: head this way, to a goal, a theme or a far tech (target, and at_once, per_day, scout, scout_every when they said them); it goes beside the directions going, or changes the one already heading there; direction_limits: a direction's limits (id, at_once, per_day, scout, scout_every); direction_pause: pause (paused true) or resume (paused false) a direction (id); direction_clear: stop a direction (id); direction_order: the directions in the order they come first when the budget is short (ids); budget_set: what every direction together may start (at_once, per_day, per_project)."},
+                    "id": {"type": "string", "description": "The goal, tech, insight, proposal or direction it acts on, by id (g3, k12, i4, p2, d5)."},
+                    "ids": {"type": "array", "items": {"type": "string"}, "description": "For direction_order: the directions' ids, the first first."},
+                    "at_once": {"type": "integer", "description": "For direction_set and direction_limits: research sessions at once (1-3). For budget_set: for all directions together (1-6)."},
+                    "per_day": {"type": "integer", "description": "For direction_set and direction_limits: started a day (1-12). For budget_set: for all together (1-30)."},
+                    "per_project": {"type": "integer", "description": "For budget_set: at once in one project (1-3)."},
+                    "scout": {"type": "boolean", "description": "For direction_set and direction_limits: send the scout when the way runs out."},
+                    "scout_every": {"type": "integer", "description": "For direction_set and direction_limits: and after this many landings (0: only when it runs out)."},
+                    "done": {"type": "string", "description": "For tech_edit: when it is done, one to three checks someone could make."},
+                    "lands_in": {"type": "array", "items": {"type": "string"}, "description": "For tech_edit: the projects its change lands in, the one the others depend on first (owner/name); empty for one."},
                     "goal": {"type": "string", "description": "For idea: the goal it is about."},
                     "target": {"type": "string", "description": "For direction_set: a goal's or tech's id."},
                     "text": {"type": "string", "description": "For idea: the idea, in a sentence or two, in the person's words. For remark: what the next drawing must change, and where on the screen when they said where."},
diff --git a/src/tests.rs b/src/tests.rs
index 7ab4b27..7a6d617 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -2513,7 +2513,7 @@ fn a_direction_researches_the_techs_on_the_way_one_after_another() {
     std::fs::write(&path, tree.to_string()).unwrap();
     // Toward k3: k2, then k3; k4 is off the way.
     crate::tree::op(&json!({"op": "direction_set", "target": "k3"}), "ana").unwrap();
-    assert_eq!(crate::tree::all()["direction"]["next"], json!({"tech": "k2", "why": "soon"}), "ready: it starts at the next look");
+    assert_eq!(crate::tree::all()["directions"][0]["next"], json!({"tech": "k2", "why": "soon", "project": "acme/cartopolis"}), "ready: it starts at the next look");
     crate::tree::tick();
     let all = crate::tree::all();
     let k2 = &all["techs"][1];
@@ -2529,9 +2529,9 @@ fn a_direction_researches_the_techs_on_the_way_one_after_another() {
     assert_eq!(k2["sessions"][0]["outcome"], Value::Null);
     assert!(k2["sessions"][0]["at"].as_i64().is_some(), "when it started, for the progress: {}", k2["sessions"]);
     // k3 needs k2, which is at work: next, after it.
-    assert_eq!(all["direction"]["next"], json!({"tech": "k3", "why": "after", "after": "k2"}));
+    assert_eq!(all["directions"][0]["next"], json!({"tech": "k3", "why": "after", "after": "k2", "project": "acme/cartopolis"}));
     crate::tree::tick();
-    assert_eq!(crate::tree::all()["direction"]["runs"].as_array().unwrap().len(), 1, "one at a time");
+    assert_eq!(crate::tree::all()["directions"][0]["runs"].as_array().unwrap().len(), 1, "one at a time");
     // Its session lands: k2 is built, and k3 — a guess, on the way the person chose — is next.
     let sha = "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678";
     sessions::poll("runner@x", &json!({}), true).unwrap();
@@ -2551,7 +2551,7 @@ fn a_direction_researches_the_techs_on_the_way_one_after_another() {
         crate::tree::tick();
     }
     let all = crate::tree::all();
-    let d = all["direction"].clone();
+    let d = all["directions"][0].clone();
     assert!(d["paused"].as_str().unwrap().contains("landed nothing"), "{d}");
     assert_eq!(d["next"]["why"], "paused");
     assert_eq!(all["techs"][1]["sessions"][0]["outcome"], "landed");
@@ -2585,10 +2585,10 @@ fn a_direction_sends_the_scout_when_its_way_runs_out_and_is_reached_when_it_find
     std::fs::create_dir_all(path.parent().unwrap()).unwrap();
     std::fs::write(&path, tree.to_string()).unwrap();
     crate::tree::op(&json!({"op": "direction_set", "target": "g1", "at_once": 9, "per_day": 0}), "ana").unwrap();
-    let d = crate::tree::all()["direction"].clone();
+    let d = crate::tree::all()["directions"][0].clone();
     assert_eq!((d["at_once"].as_u64(), d["per_day"].as_u64(), d["scout"].as_bool()), (Some(3), Some(1), Some(true)), "limits within bounds: {d}");
     crate::tree::op(&json!({"op": "direction_limits", "at_once": 2, "per_day": 6, "scout_every": 0}), "ana").unwrap();
-    let d = crate::tree::all()["direction"].clone();
+    let d = crate::tree::all()["directions"][0].clone();
     assert_eq!((d["at_once"].as_u64(), d["per_day"].as_u64(), d["scout_every"].as_u64()), (Some(2), Some(6), Some(0)), "changed in place: {d}");
     assert!(d["reached"].is_null() && d["runs"].as_array().unwrap().is_empty());
     // The way has run out: the scout is sent along it, a whole look, and nothing is reached while it looks.
@@ -2597,9 +2597,9 @@ fn a_direction_sends_the_scout_when_its_way_runs_out_and_is_reached_when_it_find
     let rounds: Vec<&str> = all["rounds"].as_array().unwrap().iter().map(|r| r["move"].as_str().unwrap()).collect();
     assert_eq!(rounds, ["map", "harvest", "group", "sketch"]);
     assert!(all["rounds"].as_array().unwrap().iter().all(|r| r["via"] == "direction" && r["goal"] == "g1"));
-    assert_eq!(all["direction"]["scouted"]["why"], "out");
-    assert_eq!(all["direction"]["next"]["why"], "scouting");
-    assert!(all["direction"]["reached"].is_null());
+    assert_eq!(all["directions"][0]["scouted"]["why"], "out");
+    assert_eq!(all["directions"][0]["next"]["why"], "scouting");
+    assert!(all["directions"][0]["reached"].is_null());
     crate::tree::tick();
     assert_eq!(crate::tree::all()["rounds"].as_array().unwrap().len(), 4, "one look for one running out");
     // The look comes back with nothing new: then, and only then, the goal is reached.
@@ -2609,11 +2609,97 @@ fn a_direction_sends_the_scout_when_its_way_runs_out_and_is_reached_when_it_find
     }
     std::fs::write(&path, v.to_string()).unwrap();
     crate::tree::tick();
-    let d = crate::tree::all()["direction"].clone();
+    let d = crate::tree::all()["directions"][0].clone();
     assert!(d["reached"].as_i64().is_some(), "{d}");
     assert_eq!(crate::tree::all()["rounds"].as_array().unwrap().len(), 4, "no second look for the same running out");
 }
 
+#[test]
+fn directions_go_side_by_side_within_one_budget_taking_turns_in_a_project() {
+    use crate::sessions;
+    let _g = SERIAL.lock().unwrap();
+    scratch("tree-directions");
+    struct Conf;
+    impl Drop for Conf {
+        fn drop(&mut self) {
+            // SAFETY: tests hold SERIAL.
+            unsafe { std::env::remove_var("MIDAS_HUB_CONF") };
+        }
+    }
+    let conf = std::env::temp_dir().join(format!("midas-test-tree-directions-{}.conf", std::process::id()));
+    let repos = vec!["acme/cartopolis".into(), "acme/pinnacle".into(), "acme/mithril".into()];
+    std::fs::write(&conf, serde_json::to_string(&crate::conf::HubConf {repos, ..Default::default()}).unwrap()).unwrap();
+    // SAFETY: tests hold SERIAL, so no other thread reads the environment meanwhile.
+    unsafe { std::env::set_var("MIDAS_HUB_CONF", &conf) };
+    let _conf = Conf;
+    let tech = |id: &str, goal: &str, repo: &str, size: &str| json!({"id": id, "key": id, "name": format!("Tech {id}"), "goals": [goal],
+        "needs": [], "built": false, "by": "person", "moves": ["map"], "size": size, "repos": [repo]});
+    let mut k3 = tech("k3", "g2", "acme/pinnacle", "S");
+    k3["lands_in"] = json!(["acme/mithril", "acme/pinnacle"]);
+    // A tree from before there were several directions: its one direction, toward g1.
+    let tree = json!({"seq": 9, "goals": [{"id": "g1", "name": "communities", "repos": ["acme/cartopolis"]},
+                                          {"id": "g2", "name": "an os", "repos": ["acme/pinnacle", "acme/mithril"]}],
+        "techs": [tech("k1", "g1", "acme/cartopolis", "S"), tech("k2", "g1", "acme/cartopolis", "M"), k3, tech("k4", "g2", "acme/pinnacle", "M")],
+        "insights": [], "rounds": [],
+        "direction": {"target": "g1", "name": "communities", "by": "ana", "at": 1, "at_once": 2, "per_day": 4, "scout": false,
+                      "paused": null, "reached": null, "resumed_at": 1, "runs": []}});
+    let path = crate::registry::root().join("hosted").join("tree.json");
+    std::fs::create_dir_all(path.parent().unwrap()).unwrap();
+    std::fs::write(&path, tree.to_string()).unwrap();
+    let all = crate::tree::all();
+    assert_eq!(all["directions"][0]["id"], "d0", "the old direction is the first of the list");
+    assert!(all["direction"].is_null());
+    assert_eq!((all["budget"]["at_once"].as_u64(), all["budget"]["per_project"].as_u64()), (Some(3), Some(1)));
+    let research = |all: &Value, id: &str| all["techs"].as_array().unwrap().iter().find(|t| t["id"] == id).unwrap()["research"]["session"].as_str().map(str::to_string);
+    // The first goes: k1 in cartopolis.
+    crate::tree::tick();
+    let all = crate::tree::all();
+    assert!(research(&all, "k1").is_some());
+    // A second direction, beside it, not in its place.
+    crate::tree::op(&json!({"op": "direction_set", "target": "g2", "at_once": 2, "scout": false}), "ana").unwrap();
+    let all = crate::tree::all();
+    let d2 = all["directions"][1]["id"].as_str().unwrap().to_string();
+    assert!(all["directions"][0]["cleared"].is_null(), "both go");
+    // k2 waits for cartopolis, where k1 is at work; g2's k3 starts in mithril, the project it lands in first.
+    crate::tree::tick();
+    let all = crate::tree::all();
+    assert!(research(&all, "k2").is_none(), "one session per project");
+    assert_eq!(all["directions"][0]["next"]["why"], "project");
+    assert_eq!(all["directions"][0]["next"]["project"], "acme/cartopolis");
+    let s3 = research(&all, "k3").expect("k3 started");
+    let m3 = sessions::meta(&s3).unwrap();
+    assert_eq!(m3["repo"], "acme/mithril");
+    assert!(m3["prompt"].as_str().unwrap().contains("acme/mithril, then acme/pinnacle"), "{}", m3["prompt"]);
+    // k4 in pinnacle: the third at once, which is all the budget allows.
+    crate::tree::tick();
+    let all = crate::tree::all();
+    assert!(research(&all, "k4").is_some());
+    assert_eq!(all["budget"]["going"], 3);
+    crate::tree::op(&json!({"op": "budget_set", "at_once": 9, "per_project": 0}), "ana").unwrap();
+    assert_eq!((crate::tree::all()["budget"]["at_once"].as_u64(), crate::tree::all()["budget"]["per_project"].as_u64()), (Some(6), Some(1)));
+    crate::tree::op(&json!({"op": "budget_set", "at_once": 3}), "ana").unwrap();
+    // k3's part in mithril lands: not built yet, its part in pinnacle is next.
+    let sha = "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678";
+    sessions::poll("runner@x", &json!({}), true).unwrap();
+    sessions::push(&s3, &[], Some("working"), "runner@x", Some("conv-3"), None).unwrap();
+    sessions::finish(&s3, "session-x", Some(sha), None, false).unwrap();
+    sessions::push(&s3, &[], Some("waiting"), "runner@x", None, None).unwrap();
+    sessions::finish_sweep();
+    crate::tree::tick();
+    let all = crate::tree::all();
+    let t3 = all["techs"].as_array().unwrap().iter().find(|t| t["id"] == "k3").unwrap().clone();
+    assert_eq!(t3["built"], false, "{t3}");
+    assert_eq!(t3["landed_in"], json!(["acme/mithril"]));
+    assert_eq!(all["directions"][1]["next"]["project"], "acme/pinnacle", "{}", all["directions"][1]["next"]);
+    // The order is the person's: g2 first.
+    crate::tree::op(&json!({"op": "direction_order", "ids": [d2, "d0"]}), "ana").unwrap();
+    assert_eq!(crate::tree::all()["directions"][0]["id"], json!(d2));
+    // Stopping one by id leaves the other going.
+    crate::tree::op(&json!({"op": "direction_clear", "id": "d0"}), "ana").unwrap();
+    let all = crate::tree::all();
+    assert!(all["directions"][1]["cleared"].is_object() && all["directions"][0]["cleared"].is_null());
+}
+
 #[test]
 fn a_research_brief_says_when_it_is_done_and_how_to_work() {
     let _g = SERIAL.lock().unwrap();
diff --git a/src/tree.rs b/src/tree.rs
index f0370d3..0e439da 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -105,6 +105,13 @@ const DIRECTION_PAUSE_AFTER: usize = 2;
 const DIRECTION_SCOUT_EVERY: u64 = 3;
 /// At most this many looks the direction asks for itself in a day, however often the way runs out.
 const DIRECTION_SCOUTS_PER_DAY: usize = 2;
+/// At most this many directions go at once, and this many are kept, stopped ones included.
+const DIRECTIONS_LIVE: usize = 8;
+const DIRECTIONS_KEPT: usize = 20;
+/// What every direction together may start unless the person says: at once, a day, and at once in one project.
+const BUDGET_AT_ONCE: u64 = 3;
+const BUDGET_PER_DAY: u64 = 10;
+const BUDGET_PER_PROJECT: u64 = 1;
 /// A direction's runs kept, newest last.
 const DIRECTION_RUNS_KEPT: usize = 40;
 /// The researches a tech keeps, newest last.
@@ -126,9 +133,27 @@ fn path() -> PathBuf {
 }
 
 fn load() -> Value {
-    crate::store::read::<Value>(&path()).filter(|v| v["goals"].is_array()).unwrap_or_else(|| {
+    migrate(crate::store::read::<Value>(&path()).filter(|v| v["goals"].is_array()).unwrap_or_else(|| {
         json!({"seq": 0, "goals": [], "techs": [], "insights": [], "rounds": []})
-    })
+    }))
+}
+
+/// The one `direction` a tree had before there could be several becomes the first of `directions`, with
+/// the id `d0`; the next write keeps it so.
+fn migrate(mut v: Value) -> Value {
+    if !v["directions"].is_array() {
+        let old = v["direction"].take();
+        v["directions"] = json!([]);
+        if old.is_object() {
+            let mut d = old;
+            d["id"] = json!("d0");
+            v["directions"].as_array_mut().expect("an array").push(d);
+        }
+    }
+    if let Some(o) = v.as_object_mut() {
+        o.remove("direction");
+    }
+    v
 }
 
 fn save(v: &Value) -> Result<()> {
@@ -216,7 +241,7 @@ fn researching(t: &Value) -> bool {
 /// `all` on a tree already read, under the lock.
 fn all_unlocked(mut v: Value) -> Value {
     let techs = v["techs"].as_array().cloned().unwrap_or_default();
-    let runs: Vec<Value> = v["direction"]["runs"].as_array().cloned().unwrap_or_default();
+    let runs = all_runs(&v);
     let costs = v["costs"].take();
     for t in v["techs"].as_array_mut().into_iter().flatten() {
         let s = state_of(t, &techs);
@@ -225,9 +250,17 @@ fn all_unlocked(mut v: Value) -> Value {
         t["sessions"] = json!(sessions_of(t, &runs, &costs));
         t["photographing"] = json!(photographing(t));
     }
-    if v["direction"].is_object() {
-        v["direction"]["next"] = next_of(&v);
+    // Each direction going with what it starts next and in which project; the budget, with what it holds now.
+    let nexts: Vec<(usize, Value)> = live(&v).into_iter().map(|i| (i, next_of(&v, i))).collect();
+    for (i, n) in nexts {
+        v["directions"][i]["next"] = n;
     }
+    let b = budget_of(&v);
+    let t0 = now();
+    v["budget"] = json!({"at_once": b.at_once, "per_day": b.per_day, "per_project": b.per_project,
+        "going": runs.iter().filter(|r| r["outcome"].is_null()).count(),
+        "today": runs.iter().filter(|r| r["at"].as_i64().unwrap_or(0) > t0 - 86400).count(),
+        "week_cost": (runs.iter().filter(|r| r["at"].as_i64().unwrap_or(0) > t0 - 7 * 86400).filter_map(|r| r["cost"].as_f64()).sum::<f64>() * 100.0).round() / 100.0});
     if !v["proposals"].is_array() {
         v["proposals"] = json!([]);
     }
@@ -240,6 +273,20 @@ fn all_unlocked(mut v: Value) -> Value {
     v
 }
 
+/// The projects a tech lands in, in order, as the scout or the person said: only the goal's own projects, each
+/// once, and only when there are two or more (one is the tech's own project, as before).
+fn lands_in(repos: &[String], said: &Value) -> Vec<String> {
+    let mut out: Vec<String> = Vec::new();
+    for r in strings(said, 6, 200) {
+        // The scout may name a project by its short name (`mithril` for `jeroen/mithril`).
+        let full = repos.iter().find(|x| **x == r || x.rsplit('/').next() == Some(r.as_str())).cloned();
+        if let Some(full) = full.filter(|f| !out.contains(f)) {
+            out.push(full);
+        }
+    }
+    if out.len() > 1 { out } else { Vec::new() }
+}
+
 /// The projects asked for, each one of the workspace's.
 fn repos_ok(v: &Value) -> Result<Vec<String>> {
     let known: Vec<String> = crate::sessions::projects().as_array().into_iter().flatten()
@@ -406,6 +453,16 @@ pub fn op(body: &Value, by: &str) -> Result<Value> {
                 }
                 changed += 1;
             }
+            // The projects it lands in, in order: two or more of the workspace's, or none to make it one project's again.
+            if body["lands_in"].is_array() {
+                let said = repos_ok(&body["lands_in"])?;
+                let spans = if said.len() > 1 { said } else { Vec::new() };
+                if t["lands_in"] != json!(spans) {
+                    t["edited"]["lands_in"] = json!({"was": t["lands_in"].clone(), "by": by, "at": now()});
+                    t["lands_in"] = json!(spans);
+                    changed += 1;
+                }
+            }
             if changed == 0 {
                 bail!("nothing to change: give a field with its new text");
             }
@@ -482,45 +539,75 @@ pub fn op(body: &Value, by: &str) -> Result<Value> {
             crate::events::emit("tree_research", json!({"actor": by, "tech": id, "session": sid}));
         }
         // A direction on the tree: a goal (a theme is one) or a far tech, the techs on the way to it
-        // then researched one after another by `tick`, on autopilot, within its limits.
+        // then researched one after another by `tick`, on autopilot, within its limits and the budget.
+        // Several go at once; one to a target already headed for changes that one's limits instead.
         "direction_set" => change(|v| {
             let target = body["target"].as_str().unwrap_or("");
             let name = v["goals"].as_array().into_iter().flatten().chain(v["techs"].as_array().into_iter().flatten())
                 .find(|x| x["id"] == target).and_then(|x| x["name"].as_str()).map(str::to_string).with_context(|| format!("no {target}"))?;
-            // A new direction keeps what the old one started, so a run going on is still read back when it ends.
-            let runs = v["direction"]["runs"].clone();
-            v["direction"] = json!({"target": target, "name": name, "by": by, "at": now(), "at_once": DIRECTION_AT_ONCE, "per_day": DIRECTION_PER_DAY,
-                "scout": true, "scout_every": DIRECTION_SCOUT_EVERY,
-                "paused": null, "reached": null, "resumed_at": now(), "runs": if runs.is_array() { runs } else { json!([]) }});
-            set_limits(&mut v["direction"], body);
-            crate::events::emit("tree_direction", json!({"actor": by, "target": target}));
+            if let Some(i) = live(v).into_iter().find(|&i| v["directions"][i]["target"] == target) {
+                let d = &mut v["directions"][i];
+                set_limits(d, body);
+                if d["paused"].is_string() {
+                    d["paused"] = Value::Null;
+                    d["resumed_at"] = json!(now());
+                }
+                return Ok(());
+            }
+            if live(v).len() >= DIRECTIONS_LIVE {
+                bail!("{DIRECTIONS_LIVE} directions go already: stop one first");
+            }
+            let id = next_id(v, "d");
+            let mut d = json!({"id": id, "target": target, "name": name, "by": by, "at": now(), "at_once": DIRECTION_AT_ONCE,
+                "per_day": DIRECTION_PER_DAY, "scout": true, "scout_every": DIRECTION_SCOUT_EVERY,
+                "paused": null, "reached": null, "resumed_at": now(), "runs": []});
+            set_limits(&mut d, body);
+            let list = v["directions"].as_array_mut().context("directions")?;
+            list.push(d);
+            // Stopped ones beyond the cap go, the oldest first: their runs live on in their techs' researches.
+            while list.len() > DIRECTIONS_KEPT {
+                let Some(i) = list.iter().position(|d| d["cleared"].is_object()) else { break };
+                list.remove(i);
+            }
+            crate::events::emit("tree_direction", json!({"actor": by, "target": target, "direction": id}));
             Ok(())
         })?,
-        // The direction's limits changed, without starting it over: how many at once and a day, and whether the
+        // A direction's limits changed, without starting it over: how many at once and a day, and whether the
         // scout is sent when the way runs out and after how many landings.
         "direction_limits" => change(|v| {
-            if !v["direction"].is_object() || v["direction"]["cleared"].is_object() {
-                bail!("no direction is set");
-            }
-            set_limits(&mut v["direction"], body);
+            let i = direction_at(v, body)?;
+            set_limits(&mut v["directions"][i], body);
             crate::events::emit("tree_direction_limits", json!({"actor": by}));
             Ok(())
         })?,
         "direction_pause" => change(|v| {
-            if !v["direction"].is_object() {
-                bail!("no direction is set");
-            }
+            let i = direction_at(v, body)?;
             let pause = body["paused"] != false;
-            v["direction"]["paused"] = if pause { json!(format!("paused by {by}")) } else { Value::Null };
+            let d = &mut v["directions"][i];
+            d["paused"] = if pause { json!(format!("paused by {by}")) } else { Value::Null };
             if !pause {
-                v["direction"]["resumed_at"] = json!(now());
+                d["resumed_at"] = json!(now());
             }
             Ok(())
         })?,
         "direction_clear" => change(|v| {
-            if let Some(d) = v["direction"].as_object_mut() {
-                d.insert("cleared".into(), json!({"by": by, "at": now()}));
-            }
+            let i = direction_at(v, body)?;
+            v["directions"][i]["cleared"] = json!({"by": by, "at": now()});
+            Ok(())
+        })?,
+        // The directions' order, the first first: when the budget is short, the higher one starts next.
+        "direction_order" => change(|v| {
+            let ids = strings(&body["ids"], 40, 20);
+            let list = v["directions"].as_array_mut().context("directions")?;
+            list.sort_by_key(|d| ids.iter().position(|x| d["id"] == x.as_str()).unwrap_or(usize::MAX));
+            Ok(())
+        })?,
+        // What every direction together may start: at once, a day, and at once in one project.
+        "budget_set" => change(|v| {
+            let b = budget_of(v);
+            let n = |k: &str, was: u64, max: u64| body[k].as_u64().map_or(was, |n| n.clamp(1, max));
+            v["budget"] = json!({"at_once": n("at_once", b.at_once, 6), "per_day": n("per_day", b.per_day, 30), "per_project": n("per_project", b.per_project, 3)});
+            crate::events::emit("tree_budget", json!({"actor": by}));
             Ok(())
         })?,
         // A round of the scout: one move on one goal, for a runner to take.
@@ -671,11 +758,18 @@ fn research_brief(v: &Value, id: &str) -> Result<(String, String)> {
         _ => {}
     }
     let goals: Vec<&Value> = v["goals"].as_array().into_iter().flatten().filter(|g| t["goals"].as_array().into_iter().flatten().any(|x| x == &g["id"])).collect();
-    let repo = strings(&t["repos"], 1, 200).into_iter().next()
-        .or_else(|| goals.iter().find_map(|g| strings(&g["repos"], 1, 200).into_iter().next()))
-        .context("say which project the tech's goal is about first")?;
+    let repo = next_repo(v, t).context("say which project the tech's goal is about first")?;
     let name = |nid: &str| techs.iter().find(|x| x["id"] == nid).map(|x| format!("{} ({})", x["name"].as_str().unwrap_or(""), x["state"].as_str().unwrap_or(""))).unwrap_or_default();
     let mut b = format!("Research a tech of the research tree (More ▸ Research): \"{}\".\n\n{}\n", t["name"].as_str().unwrap_or(""), t["what"].as_str().unwrap_or(""));
+    // A tech in several projects is one session each, the one the others depend on first, each landing on its own.
+    let lands_in = strings(&t["lands_in"], 6, 200);
+    if lands_in.len() > 1 {
+        let done = strings(&t["landed_in"], 6, 200);
+        b.push_str(&format!("\nIt lands in {} projects, in this order: {}. This session does its part in {repo} only{}; the part in each \
+other project is a session of its own, after this one has landed, and what lands here must stand on its own on main.\n",
+            lands_in.len(), lands_in.join(", then "),
+            if done.is_empty() { String::new() } else { format!(" ({} has landed already)", done.join(", ")) }));
+    }
     for (label, k) in [("Who notices", "who"), ("What they do differently once it exists", "differently"), ("What exists already toward it", "exists")] {
         if let Some(s) = t[k].as_str().filter(|s| !s.is_empty()) {
             b.push_str(&format!("\n{label}: {s}"));
@@ -790,59 +884,165 @@ pub fn tick() {
         Ok(None) => {}
         Err(e) => crate::events::emit("error", json!({"what": format!("the research tree's pictures: {e:#}")})),
     }
-    let next = match change_quiet(direction_step) {
+    let next = match change_quiet(directions_step) {
         Ok(n) => n,
         Err(e) => {
-            crate::events::emit("error", json!({"what": format!("the research tree's direction: {e:#}")}));
+            crate::events::emit("error", json!({"what": format!("the research tree's directions: {e:#}")}));
             return;
         }
     };
-    let Some((tid, by)) = next else { return };
-    if let Err(e) = start_research(&tid, &by) {
+    let Some((did, tid, by)) = next else { return };
+    if let Err(e) = start_research(&did, &tid, &by) {
         // Paused with why, rather than tried again every half minute.
         let _ = change(|v| {
-            v["direction"]["paused"] = json!(crate::util::short(&format!("could not start {tid}: {e:#}"), 300));
+            if let Some(i) = index_of(v, &did) {
+                v["directions"][i]["paused"] = json!(crate::util::short(&format!("could not start {tid}: {e:#}"), 300));
+            }
             Ok(())
         });
     }
 }
 
-/// A research landed is its tech built, whether the direction started it or the person did (Start now):
+/// A research landed is its tech built, whether a direction started it or the person did (Start now):
 /// read from the tech's own researches, so a research outside any direction is not left offered again.
 /// Only a landing after the person last said "not built" counts, or that word would be undone at the next look.
+/// A tech that lands in several projects (`lands_in`) is built once each of them has a landing (`landed_in`).
 fn built_by_landing(v: &mut Value) -> Result<()> {
     let t0 = now();
     for t in v["techs"].as_array_mut().into_iter().flatten().filter(|t| t["built"] != true && !t["dropped"].is_object()) {
         let since = t["unbuilt_at"].as_i64().unwrap_or(0);
-        let landed = t["researches"].as_array().into_iter().flatten().chain(t["research"].is_object().then_some(&t["research"]))
+        let landed: Vec<Value> = t["researches"].as_array().into_iter().flatten().chain(t["research"].is_object().then_some(&t["research"]))
             .filter_map(|r| r["session"].as_str())
-            .any(|sid| crate::sessions::meta(sid).is_ok_and(|m| m["finished"]["outcome"] == "landed" && m["finished"]["at"].as_i64().unwrap_or(0) > since));
-        if landed {
-            t["built"] = json!(true);
-            t["built_at"] = json!(t0);
-            t["built_by"] = json!("research");
-            crate::events::emit("tree_built", json!({"actor": "midas", "tech": t["id"]}));
+            .filter_map(|sid| crate::sessions::meta(sid).ok())
+            .filter(|m| m["finished"]["outcome"] == "landed" && m["finished"]["at"].as_i64().unwrap_or(0) > since)
+            .collect();
+        if landed.is_empty() {
+            continue;
+        }
+        let lands_in = strings(&t["lands_in"], 6, 200);
+        if lands_in.len() > 1 {
+            let mut done = strings(&t["landed_in"], 6, 200);
+            for r in landed.iter().filter_map(|m| m["repo"].as_str()) {
+                if lands_in.iter().any(|x| x == r) && !done.iter().any(|x| x == r) {
+                    done.push(r.to_string());
+                }
+            }
+            if t["landed_in"] != json!(done) {
+                t["landed_in"] = json!(done);
+            }
+            if !lands_in.iter().all(|x| done.contains(x)) {
+                continue;
+            }
         }
+        t["built"] = json!(true);
+        t["built_at"] = json!(t0);
+        t["built_by"] = json!("research");
+        crate::events::emit("tree_built", json!({"actor": "midas", "tech": t["id"]}));
     }
     Ok(())
 }
 
-/// One look at the direction, under the lock: outcomes, the pause, whether it is reached, and the tech to
-/// research next with whose direction it is, when one may start now.
-fn direction_step(v: &mut Value) -> Result<Option<(String, String)>> {
-    if !v["direction"].is_object() || v["direction"]["cleared"].is_object() {
-        return Ok(None);
+/// What every direction together may start: at once, started a day, and at once in one project.
+#[derive(Clone, Copy)]
+struct Budget {
+    at_once: u64,
+    per_day: u64,
+    per_project: u64,
+}
+
+fn budget_of(v: &Value) -> Budget {
+    let b = &v["budget"];
+    Budget {
+        at_once: b["at_once"].as_u64().unwrap_or(BUDGET_AT_ONCE),
+        per_day: b["per_day"].as_u64().unwrap_or(BUDGET_PER_DAY),
+        per_project: b["per_project"].as_u64().unwrap_or(BUDGET_PER_PROJECT),
+    }
+}
+
+/// The directions going (not stopped), by index, in their order.
+fn live(v: &Value) -> Vec<usize> {
+    v["directions"].as_array().into_iter().flatten().enumerate().filter(|(_, d)| !d["cleared"].is_object()).map(|(i, _)| i).collect()
+}
+
+fn index_of(v: &Value, id: &str) -> Option<usize> {
+    v["directions"].as_array()?.iter().position(|d| d["id"] == id)
+}
+
+/// The direction a request names by `id`, or, naming none (a voice conversation from before there were
+/// several), the first going.
+fn direction_at(v: &Value, body: &Value) -> Result<usize> {
+    match body["id"].as_str().filter(|s| !s.is_empty()) {
+        Some(id) => index_of(v, id).filter(|&i| !v["directions"][i]["cleared"].is_object()).with_context(|| format!("no direction {id}")),
+        None => live(v).first().copied().context("no direction is set"),
     }
+}
+
+/// Every direction's runs, of those going and stopped.
+fn all_runs(v: &Value) -> Vec<Value> {
+    v["directions"].as_array().into_iter().flatten().flat_map(|d| d["runs"].as_array().cloned().unwrap_or_default()).collect()
+}
+
+/// The project a tech's next research works in: the first of `lands_in` without a landing yet, else its own
+/// project, else its goal's first.
+fn next_repo(v: &Value, t: &Value) -> Option<String> {
+    let done = strings(&t["landed_in"], 6, 200);
+    if let Some(r) = strings(&t["lands_in"], 6, 200).into_iter().find(|r| !done.contains(r)) {
+        return Some(r);
+    }
+    strings(&t["repos"], 1, 200).into_iter().next().or_else(|| {
+        let goals = strings(&t["goals"], 20, 20);
+        v["goals"].as_array().into_iter().flatten().filter(|g| goals.iter().any(|x| g["id"] == x.as_str()))
+            .find_map(|g| strings(&g["repos"], 1, 200).into_iter().next())
+    })
+}
+
+/// How many research sessions work in each project now, whoever started them.
+fn at_work_by_project(v: &Value) -> std::collections::HashMap<String, u64> {
+    let mut n = std::collections::HashMap::new();
+    for t in v["techs"].as_array().into_iter().flatten().filter(|t| researching(t)) {
+        let repo = t["research"]["session"].as_str().and_then(|s| crate::sessions::meta(s).ok()).and_then(|m| m["repo"].as_str().map(str::to_string));
+        if let Some(r) = repo {
+            *n.entry(r).or_insert(0) += 1;
+        }
+    }
+    n
+}
+
+/// One look at every direction, under the lock, in their order: each one's outcomes, pause, scout and whether
+/// it is reached; then the first that may start a research within its limits, the budget and its project's
+/// room, with the tech and whose direction it is. One start a look: the next goes half a minute later.
+fn directions_step(v: &mut Value) -> Result<Option<(String, String, String)>> {
+    let t0 = now();
+    let b = budget_of(v);
+    let runs = all_runs(v);
+    let going = runs.iter().filter(|r| r["outcome"].is_null()).count() as u64;
+    let today = runs.iter().filter(|r| r["at"].as_i64().unwrap_or(0) > t0 - 86400).count() as u64;
+    let room = going < b.at_once && today < b.per_day;
+    let mut busy = at_work_by_project(v);
+    let mut start = None;
+    for i in live(v) {
+        let found = direction_step(v, i, room && start.is_none(), &|repo: &str| busy.get(repo).copied().unwrap_or(0) < b.per_project)?;
+        if let Some((tid, repo)) = found {
+            *busy.entry(repo).or_insert(0) += 1;
+            start = Some((v["directions"][i]["id"].as_str().unwrap_or("").to_string(), tid, v["directions"][i]["by"].as_str().unwrap_or("").to_string()));
+        }
+    }
+    Ok(start)
+}
+
+/// One look at direction `i`: outcomes, the pause, the scout, whether it is reached, and — when `may` and
+/// within its own limits — the tech to research next whose project has room, with that project.
+fn direction_step(v: &mut Value, i: usize, may: bool, room: &dyn Fn(&str) -> bool) -> Result<Option<(String, String)>> {
     let t0 = now();
     // Outcomes, as their sessions finish (`built_by_landing` has made a landed one's tech built).
-    for run in v["direction"]["runs"].as_array_mut().into_iter().flatten().filter(|r| r["outcome"].is_null()) {
+    for run in v["directions"][i]["runs"].as_array_mut().into_iter().flatten().filter(|r| r["outcome"].is_null()) {
         if let Some(o) = run["session"].as_str().and_then(outcome_of) {
             run["outcome"] = json!(o);
             run["ended"] = json!(t0);
             run["cost"] = run["session"].as_str().and_then(crate::sessions::cost_of).map_or(Value::Null, |c| json!((c * 100.0).round() / 100.0));
         }
     }
-    let d = v["direction"].clone();
+    let d = v["directions"][i].clone();
     let runs: Vec<Value> = d["runs"].as_array().cloned().unwrap_or_default();
     // Researches in a row since it was last resumed, ended and landing nothing: paused.
     let since = d["resumed_at"].as_i64().unwrap_or(0);
@@ -850,8 +1050,8 @@ fn direction_step(v: &mut Value) -> Result<Option<(String, String)>> {
     ended.sort_by_key(|r| r["ended"].as_i64().unwrap_or(0));
     let last: Vec<&&Value> = ended.iter().rev().take(DIRECTION_PAUSE_AFTER).collect();
     if d["paused"].is_null() && last.len() == DIRECTION_PAUSE_AFTER && last.iter().all(|r| r["outcome"] != "landed") {
-        v["direction"]["paused"] = json!(format!("{DIRECTION_PAUSE_AFTER} researches in a row landed nothing"));
-        crate::events::emit("tree_direction_paused", json!({"actor": "midas"}));
+        v["directions"][i]["paused"] = json!(format!("{DIRECTION_PAUSE_AFTER} researches in a row landed nothing"));
+        crate::events::emit("tree_direction_paused", json!({"actor": "midas", "direction": d["id"]}));
         return Ok(None);
     }
     if !d["reached"].is_null() || !d["paused"].is_null() {
@@ -890,34 +1090,35 @@ leave open, and what comes next on the way?", d["name"].as_str().unwrap_or("")),
             scouts.push(json!(t0));
             let extra = scouts.len().saturating_sub(DIRECTION_RUNS_KEPT);
             scouts.drain(..extra);
-            v["direction"]["scouts"] = json!(scouts);
-            v["direction"]["scouted"] = json!({"at": t0, "why": why, "look": look});
+            v["directions"][i]["scouts"] = json!(scouts);
+            v["directions"][i]["scouted"] = json!({"at": t0, "why": why, "look": look});
             crate::events::emit("tree_direction_scout", json!({"actor": "midas", "goal": g, "why": why}));
             return Ok(None);
         }
     }
     if remaining.is_empty() && !path.is_empty() {
-        v["direction"]["reached"] = json!(t0);
+        v["directions"][i]["reached"] = json!(t0);
         crate::events::emit("tree_direction_reached", json!({"actor": "midas", "target": target}));
         return Ok(None);
     }
     if out && !remaining.is_empty() {
         // What is left needs something nobody can start: said, rather than waited on for ever.
-        v["direction"]["paused"] = json!("the way is stuck: what is left needs something that is not on it, or was said not this to");
-        crate::events::emit("tree_direction_paused", json!({"actor": "midas"}));
+        v["directions"][i]["paused"] = json!("the way is stuck: what is left needs something that is not on it, or was said not this to");
+        crate::events::emit("tree_direction_paused", json!({"actor": "midas", "direction": d["id"]}));
         return Ok(None);
     }
     let today = runs.iter().filter(|r| r["at"].as_i64().unwrap_or(0) > t0 - 86400).count() as u64;
-    if running >= d["at_once"].as_u64().unwrap_or(DIRECTION_AT_ONCE) || today >= d["per_day"].as_u64().unwrap_or(DIRECTION_PER_DAY) || crate::focus::at_cap(&by) {
+    if !may || running >= d["at_once"].as_u64().unwrap_or(DIRECTION_AT_ONCE) || today >= d["per_day"].as_u64().unwrap_or(DIRECTION_PER_DAY) || crate::focus::at_cap(&by) {
         return Ok(None);
     }
-    let Some(next) = ready.first() else { return Ok(None) };
+    // The first ready one whose project has room: one waiting on a busy project does not hold up another's.
+    let Some((next, repo)) = ready.iter().find_map(|t| next_repo(v, t).filter(|r| room(r)).map(|r| (*t, r))) else { return Ok(None) };
     let tid = next["id"].as_str().unwrap_or("").to_string();
     // A guess on the way is out of the fog by the direction chosen: that choice was the person's.
     if state_of(next, &techs) == "fog" {
         find(&mut v["techs"], &tid)?["confirmed_by"] = json!(format!("direction of {by}"));
     }
-    Ok(Some((tid, by)))
+    Ok(Some((tid, repo)))
 }
 
 /// The moves of a look over a whole goal; one with `true` only runs when there is something for it (`wanted`).
@@ -1006,13 +1207,14 @@ fn set_limits(d: &mut Value, body: &Value) {
     }
 }
 
-/// A research the direction starts: the tech's brief, its session on autopilot, noted on the tech and the direction.
-fn start_research(tid: &str, by: &str) -> Result<()> {
+/// A research a direction starts: the tech's brief, its session on autopilot, noted on the tech and the direction.
+fn start_research(did: &str, tid: &str, by: &str) -> Result<()> {
     let (brief, repo, toward) = {
         let _l = LOCK.lock().unwrap_or_else(|p| p.into_inner());
         let v = all_unlocked(load());
         let (b, r) = research_brief(&v, tid)?;
-        (b, r, v["direction"]["name"].as_str().unwrap_or("").to_string())
+        let name = index_of(&v, did).and_then(|i| v["directions"][i]["name"].as_str().map(str::to_string)).unwrap_or_default();
+        (b, r, name)
     };
     let brief = format!("{brief}\n\nThe research tree's direction toward \"{toward}\" started this session, on autopilot: the person chose \
 the direction and is not following along. Keep to this one tech.");
@@ -1020,14 +1222,14 @@ the direction and is not following along. Keep to this one tech.");
     crate::sessions::tell(&sid, "autopilot", &json!({"on": true}), by)?;
     change(|v| {
         mark_research(v, tid, &sid, by, true)?;
-        if let Some(runs) = v["direction"]["runs"].as_array_mut() {
-            runs.push(json!({"tech": tid, "session": sid, "at": now(), "outcome": null}));
+        if let Some(runs) = index_of(v, did).and_then(|i| v["directions"][i]["runs"].as_array_mut()) {
+            runs.push(json!({"tech": tid, "session": sid, "repo": repo, "at": now(), "outcome": null}));
             let extra = runs.len().saturating_sub(DIRECTION_RUNS_KEPT);
             runs.drain(..extra);
         }
         Ok(())
     })?;
-    crate::events::emit("tree_research", json!({"actor": "midas", "tech": tid, "session": sid, "direction": true}));
+    crate::events::emit("tree_research", json!({"actor": "midas", "tech": tid, "session": sid, "direction": did}));
     Ok(())
 }
 
@@ -1261,7 +1463,7 @@ fn sessions_of(t: &Value, runs: &[Value], costs: &Value) -> Vec<Value> {
 
 /// What each ended research session cost, kept once in `costs` by session id: a log is read only once.
 fn fill_costs(v: &mut Value) -> Result<()> {
-    let runs: Vec<Value> = v["direction"]["runs"].as_array().cloned().unwrap_or_default();
+    let runs = all_runs(v);
     let ids: Vec<String> = v["techs"].as_array().into_iter().flatten().flat_map(|t| session_ids(t, &runs)).map(|(_, s)| s).collect();
     if !v["costs"].is_object() {
         v["costs"] = json!({});
@@ -1307,9 +1509,36 @@ fn next_key(t: &Value, techs: &[Value]) -> (bool, u8, u64) {
 /// What the direction starts next, and why it has not yet, for the page: `{tech, why}`, `why` one of
 /// `soon` (at its next look), `after` (a tech on the way it needs, named in `after`, is not built yet),
 /// `at_once` (as many go on as it may: `after` is the one going), `per_day` (today's are used, `at` when
-/// one frees), `focus` (the person's attention is at its cap) or `paused`. None once there is nothing next.
-fn next_of(v: &Value) -> Value {
-    let d = &v["direction"];
+/// one frees), `focus` (the person's attention is at its cap), `paused`, `scouting` (the scout looks along the
+/// way), `budget` (every direction together has started all the budget allows) or `project` (its project,
+/// named in `project`, has as many at work as the budget allows). Each with the `project` it works in.
+/// None once there is nothing next.
+fn next_of(v: &Value, i: usize) -> Value {
+    let n = next_why(v, i);
+    if n.is_null() || n["tech"].is_null() {
+        return n;
+    }
+    let mut n = n;
+    let project = v["techs"].as_array().into_iter().flatten().find(|t| t["id"] == n["tech"]).and_then(|t| next_repo(v, t));
+    n["project"] = json!(project);
+    if n["why"] == "soon" {
+        let b = budget_of(v);
+        let runs = all_runs(v);
+        let t0 = now();
+        if runs.iter().filter(|r| r["outcome"].is_null()).count() as u64 >= b.at_once
+            || runs.iter().filter(|r| r["at"].as_i64().unwrap_or(0) > t0 - 86400).count() as u64 >= b.per_day {
+            n["why"] = json!("budget");
+        } else if let Some(p) = project.as_deref().filter(|p| at_work_by_project(v).get(*p).copied().unwrap_or(0) >= b.per_project) {
+            n["why"] = json!("project");
+            n["project"] = json!(p);
+        }
+    }
+    n
+}
+
+/// `next_of` within the direction alone, before the budget and the projects are asked.
+fn next_why(v: &Value, i: usize) -> Value {
+    let d = &v["directions"][i];
     if !d.is_object() || d["cleared"].is_object() || !d["reached"].is_null() {
         return Value::Null;
     }
@@ -1577,7 +1806,8 @@ Answer with one JSON object and nothing else:\n\
 in this answer or the known list>\"], \"evidence\": [\"<path, commit, session id with words, or URL>\"], \"exists\": \"<for a missing \
 one: what already exists toward it>\", \"done\": \"<for a missing one: when it is done, one to three checks a person could make in the \
 product themselves, such as 'on the phone, an invite link opens the community for someone without an account'>\", \"size\": \"S\", \
-\"M\" or \"L\", \"icon\": \"<svg …>\"}], \
+\"M\" or \"L\", \"lands_in\": [\"<only for a missing one whose change must be made in more than one of the projects \
+you were given: those projects, the one the others depend on first>\"], \"icon\": \"<svg …>\"}], \
 \"insights\": [{\"text\": \"<an observation that is not a capability yet, one or two sentences>\", \"evidence\": [\"…\"], \"about\": \
 \"<a tech's name, or empty>\"}], \"summary\": \"<one plain sentence: what this round found>\"}\n\
 At most 15 techs and 8 insights. Use a known tech's exact name when you mean it, to add evidence rather than a duplicate. Never \
@@ -1829,6 +2059,7 @@ pub fn scouted(body: &Value) -> Result<()> {
         };
         // First every tech, so the needs of one can name another of the same answer.
         let mut ids: Vec<(String, Vec<String>)> = Vec::new();
+        let v_repos = repos_of(&v["goals"], &goal);
         for f in &found {
             // A Sketch's picture, kept beside the tree under the tech's id (by name when the id is missing).
             if let Some(png) = f["png"].as_str() {
@@ -1893,6 +2124,10 @@ pub fn scouted(body: &Value) -> Result<()> {
                     if !done.is_empty() && t["built"] != true && t["done"].as_str().is_none_or(str::is_empty) {
                         t["done"] = json!(done);
                     }
+                    let spans = lands_in(&v_repos, &f["lands_in"]);
+                    if spans.len() > 1 && t["built"] != true && t["lands_in"].as_array().is_none_or(|l| l.is_empty()) {
+                        t["lands_in"] = json!(spans);
+                    }
                     // A mockup comes once, for what is not built, unless a Sketch draws it again.
                     if let Some(m) = f["mockup"].as_str().and_then(mockup) {
                         if mv == "sketch" || (t["mockup"].is_null() && t["built"] != true) {
@@ -1931,6 +2166,7 @@ pub fn scouted(body: &Value) -> Result<()> {
                         "id": tid, "key": k, "name": name, "what": text(f, "what", TEXT_MAX), "who": text(f, "who", 300),
                         "differently": text(f, "differently", 600), "exists": text(f, "exists", 1000), "size": size,
                         "done": if is_built { Value::Null } else { json!(text(f, "done", 600)) },
+                        "lands_in": if is_built { json!([]) } else { json!(lands_in(&v_repos, &f["lands_in"])) },
                         "evidence": evidence, "needs": [], "goals": [goal], "repos": if repo.is_empty() { json!([]) } else { json!([repo]) },
                         "moves": [mv], "built": is_built, "built_at": if is_built { json!(now()) } else { Value::Null },
                         "built_by": if is_built { json!("scout") } else { Value::Null },
diff --git a/web/src/app.css b/web/src/app.css
index d7cb440..c160410 100644
--- a/web/src/app.css
+++ b/web/src/app.css
@@ -9586,6 +9586,36 @@ button.tree-lane__name:hover {
     display: block;
     margin-top: var(--m-space-2);
 }
+/* On Directions, the project a stop works in. */
+.tree-direction__project {
+    display: block;
+    font-size: var(--m-font-size-xs);
+    color: var(--m-text-dim);
+}
+/* Directions' budget: what every direction together may start, and what it holds now as slots. */
+.tree-budget__row {
+    display: flex;
+    flex-wrap: wrap;
+    align-items: center;
+    gap: var(--m-space-3);
+}
+.tree-budget__row > :last-child {
+    margin-left: auto;
+}
+.tree-budget__slots {
+    display: flex;
+    gap: 6px;
+}
+.tree-budget__slots i {
+    display: block;
+    width: 26px;
+    height: 10px;
+    border-radius: 5px;
+    background: var(--m-border);
+}
+.tree-budget__slots i.on {
+    background: var(--m-accent);
+}
 .tree-fold-card--open {
     flex-basis: 100%;
     order: 2;
diff --git a/web/src/components/research.tsx b/web/src/components/research.tsx
index 76b7c1e..275394f 100644
--- a/web/src/components/research.tsx
+++ b/web/src/components/research.tsx
@@ -1,5 +1,5 @@
 import m, {MithrilComponent} from '@garage44/mithril'
-import {Button, Card, Dialog, Table, FieldNumber, FieldSwitch, FieldTags, FieldText, FieldTextarea} from '@garage44/mithril/components'
+import {Button, Card, Dialog, Table, FieldNumber, FieldSelect, FieldSwitch, FieldTags, FieldText, FieldTextarea} from '@garage44/mithril/components'
 
 import {seg} from '@/components/autopilot'
 import {Bars, SERIES} from '@/components/charts'
@@ -39,7 +39,7 @@ const state = local({
     allBuilt: false, notesBy: 'all' as 'all' | 'person' | 'scout', allNotes: false, openNote: '',
     // The goal's menu open; what to send the scout to look at; the tech whose popover is open and the question typed in it;
     // which of a look's finds is walked to (-1: none yet); the look whose finds the log lights; What next unfolded.
-    menu: false, ask: '', pop: '', popAsk: '', walk: -1, lookShown: '', allLooks: false, nextOpen: false, notesOpen: false, historyOpen: false,
+    menu: false, ask: '', pop: '', popAsk: '', walk: -1, lookShown: '', allLooks: false, nextOpen: false, notesOpen: false, historyOpen: false, headGoal: '',
     // The height the screen has for the tree, so a short tree is spread over it (`fill`).
     fill: 0,
     // When the open tech's dialog opened, so what was changed since shows old beside new; and whether a voice conversation opened it.
@@ -96,7 +96,7 @@ function load() {
             if (timer) clearTimeout(timer)
             if (state.data?.rounds.some((r) => r.state === 'queued' || r.state === 'asked')) timer = setTimeout(load, 8000)
             // While the tree heads somewhere, its researches start and land on their own: look now and then.
-            else if (state.data?.direction && !state.data.direction.cleared && !state.data.direction.reached) timer = setTimeout(load, 30000)
+            else if (directionsOf(state.data).some((x) => !x.reached)) timer = setTimeout(load, 30000)
         })
 }
 
@@ -152,7 +152,7 @@ const STATUS_TITLE: Record<TechState, string> = {
 }
 
 function statusText(d: TreeState, t: Tech, link: (id: string) => m.Vnode): m.Children {
-    const heading = directionOf(d)?.target === t.id ? ' The tree heads this way: it starts by itself when its turn comes.' : ''
+    const heading = headingFor(d, t.id) ? ' The tree heads this way: it starts by itself when its turn comes.' : ''
     switch (t.state) {
         case 'researching':
             return t.research
@@ -347,6 +347,7 @@ function goalBar(d: TreeState, g: Goal): m.Children {
         <nav class="tree-bar" aria-label="Goals and themes">
             <div class="tree-bar__row">
                 {goalProjects(d)}
+                {directionsLink(d)}
                 <div class={`tree-goalpick${g.id === root.id ? ' tree-goalpick--on' : ''}`}>
                     <button type="button" class="tree-goalpick__main" title={root.statement || root.name} onclick={() => show(root.id)}>
                         <span class="tree-head__flag">{GOAL_FLAG}</span>
@@ -1035,7 +1036,7 @@ function nowTag(t: Tech): string {
 function whatNext(d: TreeState, g: Goal, techs: Tech[]): m.Children {
     // Nothing on the tree: the scout's block in it is the one way on, and a second card saying so only repeats it.
     if (!techs.length) return null
-    const dir = directionOf(d)
+    const dir = directionOf(d, g)
     const ids = new Set(techs.map((t) => t.id))
     const byId = (id: string) => d.techs.find((t) => t.id === id)
     const of = themes(techs, d.goals, colourGoal(d, g)).of
@@ -1257,9 +1258,103 @@ function historyCard(techs: Tech[]): m.Children {
     )
 }
 
-/** The direction, live: true until it is cleared. */
-function directionOf(d: TreeState): Direction | null {
-    return d.direction && !d.direction.cleared ? d.direction : null
+/** To Directions, from the goal bar: how many go. */
+function directionsLink(d: TreeState): m.Children {
+    const n = directionsOf(d).length
+    return (
+        <Button variant="ghost" onclick={() => go('research/directions')}>
+            {n ? `Directions · ${n}` : 'Directions'}
+        </Button>
+    )
+}
+
+/**
+ * Directions (docs/screens/directions.html): every direction going, over every project, in the person's
+ * order, under one budget for all of them. ↑ ↓ move one; when the budget is short the first starts first,
+ * and directions that reach one project take turns there (tree.rs `directions_step`).
+ */
+function directionsPage(d: TreeState): m.Children {
+    const list = directionsOf(d)
+    const b = d.budget ?? {at_once: 3, per_day: 10, per_project: 1, going: 0, today: 0, week_cost: 0}
+    const move = (i: number, by: number) => () => {
+        const ids = list.map((x) => x.id)
+        ;[ids[i], ids[i + by]] = [ids[i + by]!, ids[i]!]
+        void treeOp('order saved', 'direction_order', {ids})
+    }
+    // A goal at the top of its line, not headed for yet: a theme is reached from its goal's tree.
+    const free = d.goals.filter((g) => !g.parent && !headingFor(d, g.id) && g.repos.length)
+    return (
+        <div class="stack">
+            <div class="tree-bar__row">
+                <Button variant="ghost" onclick={() => go('research')}>
+                    ← The tree
+                </Button>
+                <b class="tree-board__title">Directions</b>
+                <span class="hint">{list.length ? `${list.length} going, over every project` : 'none going'}</span>
+            </div>
+            <Card class="tree-budget">
+                <div class="tree-budget__row">
+                    <div>
+                        <b>Across all directions</b>
+                        <div class="hint">
+                            at most {b.at_once} at once · {b.per_day} started a day · {b.per_project === 1 ? 'one session' : `${b.per_project} sessions`} per project at a time
+                        </div>
+                    </div>
+                    <span class="tree-budget__slots" aria-label={`${b.going} of ${b.at_once} at work`}>
+                        {Array.from({length: b.at_once}, (_, i) => (
+                            <i class={i < b.going ? 'on' : ''} />
+                        ))}
+                    </span>
+                    <span class="hint">
+                        {b.going} of {b.at_once} at work · {b.today} of {b.per_day} today{b.week_cost ? ` · $${b.week_cost.toFixed(0)} this week` : ''}
+                    </span>
+                    <Button variant="ghost" disabled={!steers()} onclick={() => changeBudget(d)}>
+                        Budget
+                    </Button>
+                </div>
+            </Card>
+            {list.map((x, i) => directionCard(d, x, {up: i > 0 ? move(i, -1) : undefined, down: i < list.length - 1 ? move(i, 1) : undefined}))}
+            {list.length ? null : <p class="hint">Nothing is researched by itself. Head for a goal: its techs are then built one after another, on autopilot.</p>}
+            {free.length ? (
+                <div class="tree-bar__row">
+                    <FieldSelect model={bind(state, 'headGoal')} placeholder="Head for another goal…" options={free.map((g) => ({value: g.id, label: g.name}))} />
+                    <Button
+                        variant="primary"
+                        disabled={!steers() || !state.headGoal}
+                        onclick={() => {
+                            const g = free.find((x) => x.id === state.headGoal)
+                            if (g) headFor(d, g.id, g.name)
+                        }}
+                    >
+                        Head this way
+                    </Button>
+                </div>
+            ) : null}
+            {formDialog()}
+        </div>
+    )
+}
+
+/** The directions going (until stopped), in the person's order. */
+function directionsOf(d: TreeState | null): Direction[] {
+    return (d?.directions ?? []).filter((x) => !x.cleared)
+}
+
+/**
+ * The direction a goal's page shows: the first going whose target is this goal, a goal under it or one of its
+ * techs; else, with none given, the first going. Several can go at once (Directions shows them all).
+ */
+function directionOf(d: TreeState, g?: Goal | null): Direction | null {
+    const going = directionsOf(d)
+    if (!g) return going[0] ?? null
+    const under = new Set(goalsUnder(d.goals, g.id))
+    const ofGoal = (target: string) => under.has(target) || d.techs.some((t) => t.id === target && t.goals.some((x) => under.has(x)))
+    return going.find((x) => ofGoal(x.target)) ?? null
+}
+
+/** The direction heading for a goal or tech already, if one is. */
+function headingFor(d: TreeState, id: string): Direction | null {
+    return directionsOf(d).find((x) => x.target === id) ?? null
 }
 
 interface Limits {
@@ -1287,7 +1382,7 @@ function limitsLine(dir: Direction): string {
  * limits of the direction going, or when a tech is done.
  */
 const form = local({
-    open: '' as '' | 'head' | 'limits' | 'done',
+    open: '' as '' | 'head' | 'limits' | 'done' | 'budget',
     target: '',
     name: '',
     replaces: '',
@@ -1296,21 +1391,32 @@ const form = local({
     scout: true,
     scout_every: 3,
     done: '',
+    b_at_once: 3,
+    b_per_day: 10,
+    b_per_project: 1,
 })
 /** What to do once the form is sent (the tech's dialog closes): never in `form`, as reactive state calls a function put in it. */
 let afterForm: null | (() => void) = null
 
 /** Head for a goal or a tech: from then on the techs on the way are researched one after another, on autopilot. */
 function headFor(d: TreeState, id: string, name: string, after?: () => void) {
-    const now = directionOf(d)
-    // A new direction starts from the limits of the one it replaces, so a choice made once is not made again.
-    Object.assign(form, limitsOf(now), {open: 'head', target: id, name, replaces: now?.name ?? ''})
+    // One heading there already has its limits changed; a new one starts from the hub's defaults.
+    const there = headingFor(d, id)
+    const others = directionsOf(d).filter((x) => x !== there).length
+    Object.assign(form, limitsOf(there), {open: 'head', target: id, name, replaces: there ? 'there' : others ? String(others) : ''})
     afterForm = after ?? null
 }
 
 /** The direction's limits changed in place: what it started goes on. */
 function changeLimits(dir: Direction) {
-    Object.assign(form, limitsOf(dir), {open: 'limits', name: dir.name})
+    Object.assign(form, limitsOf(dir), {open: 'limits', target: dir.id, name: dir.name})
+    afterForm = null
+}
+
+/** What every direction together may start. */
+function changeBudget(d: TreeState) {
+    const b = d.budget
+    Object.assign(form, {open: 'budget', b_at_once: b?.at_once ?? 3, b_per_day: b?.per_day ?? 10, b_per_project: b?.per_project ?? 1})
     afterForm = null
 }
 
@@ -1327,7 +1433,8 @@ async function submitForm() {
     afterForm = null
     form.open = ''
     if (open === 'head') await treeOp(`heading for ${name}`, 'direction_set', {target, ...limits})
-    if (open === 'limits') await treeOp('limits saved', 'direction_limits', limits)
+    if (open === 'limits') await treeOp('limits saved', 'direction_limits', {id: target, ...limits})
+    if (open === 'budget') await treeOp('budget saved', 'budget_set', {at_once: form.b_at_once, per_day: form.b_per_day, per_project: form.b_per_project})
     if (open === 'done') await treeOp('saved', 'tech_edit', {id: target, done})
     after?.()
 }
@@ -1341,7 +1448,7 @@ function formDialog(): m.Children {
             if (!v) form.open = ''
         },
     }
-    const title = {'': '', head: `Head for “${form.name}”?`, limits: `How it heads for “${form.name}”`, done: `When is “${form.name}” done?`}[form.open]
+    const title = {'': '', head: `Head for “${form.name}”?`, limits: `How it heads for “${form.name}”`, done: `When is “${form.name}” done?`, budget: 'What all directions may start together'}[form.open]
     const yes = form.open === 'head' ? 'Head this way' : 'Save'
     const limits = [
         <div class="focus-row">
@@ -1382,10 +1489,25 @@ function formDialog(): m.Children {
                     <p>
                         Midas then researches the techs on the way to it by itself, one after another: each a session on autopilot, landed when it is done, the
                         tech built once it is on main. A guess on the way is kept when its turn comes. It pauses after two that land nothing; you can pause or
-                        stop it at any time.{form.replaces ? ` It replaces the way to “${form.replaces}”.` : ''}
+                        stop it at any time.
+                        {form.replaces === 'there' ? ' It heads there already: this changes its limits.' : form.replaces ? ` It goes beside the ${form.replaces === '1' ? 'direction' : `${form.replaces} directions`} going, within the budget on Directions.` : ''}
                     </p>
                 ) : null}
                 {form.open === 'head' || form.open === 'limits' ? limits : null}
+                {form.open === 'budget' ? [
+                    <div class="focus-row">
+                        <FieldNumber label="Sessions at once" model={bind(form, 'b_at_once')} min={1} max={6} />
+                        <FieldNumber label="Started a day" model={bind(form, 'b_per_day')} min={1} max={30} />
+                    </div>,
+                    <FieldNumber
+                        label="At once in one project"
+                        model={bind(form, 'b_per_project')}
+                        min={1}
+                        max={3}
+                        help="Directions that reach the same project take turns there; more than one can collide."
+                    />,
+                    <p class="hint">Each direction keeps its own limits within these. When they are used up, the direction highest in the list starts next.</p>,
+                ] : null}
                 {form.open === 'done' ? (
                     <FieldTextarea
                         model={bind(form, 'done')}
@@ -1421,6 +1543,10 @@ function nextWord(d: TreeState, n: DirectionNext): string {
             return 'paused'
         case 'scouting':
             return 'after the scout’s look'
+        case 'budget':
+            return 'when the budget has room'
+        case 'project':
+            return `when ${projectName(n.project ?? '') ?? n.project} is free`
     }
 }
 
@@ -1432,9 +1558,9 @@ function openResearch(t: Tech) {
 /**
  * Where the tree is heading, as a line of stops: the tech landed last, what is at work now and for how
  * long, what starts next and when, and the goal. A stop opens its tech; the one at work its session.
+ * On Directions, `order` moves it up or down the list, and each stop says which project it works in.
  */
-function directionCard(d: TreeState): m.Children {
-    const dir = directionOf(d)
+function directionCard(d: TreeState, dir: Direction | null, order?: {up?: () => void; down?: () => void}): m.Children {
     if (!dir) return null
     const way = pathOf(d, dir.target)
     const on = d.techs.filter((t) => way.has(t.id))
@@ -1445,6 +1571,10 @@ function directionCard(d: TreeState): m.Children {
     const lastLanded = byId(dir.runs.findLast((r) => r.outcome === 'landed' && byId(r.tech)?.state === 'built')?.tech)
     const next = dir.next && !going.some((t) => t.id === dir.next!.tech) ? byId(dir.next.tech) : undefined
     const share = on.length ? built / on.length : 0
+    // Which project each stop works in, once there is more than one to tell apart.
+    const where = (p?: string | null) => (order && p ? <span class="tree-direction__project">{projectName(p) ?? p}</span> : null)
+    const repoOf = (t: Tech) => dir.runs.findLast((r) => r.tech === t.id)?.repo ?? t.lands_in?.find((r) => !t.landed_in?.includes(r)) ?? t.repos[0]
+    const projects = [...new Set(on.flatMap((t) => (t.lands_in?.length ? t.lands_in : t.repos)))]
     const stop = (kind: string, t: Tech, sub: m.Children, onclick: () => void) => (
         <button type="button" class={`way-stop way-stop--${kind} ${themeClass(themes(d.techs, d.goals, colourGoal(d, pickedGoal(d))).of, t.id)}`} onclick={onclick}>
             <span class="way-stop__node">{kind === 'done' ? CHECK : iconOf(t, 'way-stop__icon')}</span>
@@ -1464,17 +1594,27 @@ function directionCard(d: TreeState): m.Children {
                     {built} / {on.length}
                 </span>
                 <span class="tree-direction__tools">
+                    {order ? (
+                        <Button variant="ghost" disabled={!steers() || !order.up} title="Earlier: it starts first when the budget is short" onclick={() => order.up?.()}>
+                            ↑
+                        </Button>
+                    ) : null}
+                    {order ? (
+                        <Button variant="ghost" disabled={!steers() || !order.down} title="Later" onclick={() => order.down?.()}>
+                            ↓
+                        </Button>
+                    ) : null}
                     {dir.reached ? null : (
                         <Button variant="ghost" disabled={!steers()} onclick={() => changeLimits(dir)}>
                             Limits
                         </Button>
                     )}
                     {dir.reached ? null : (
-                        <Button variant="ghost" disabled={!steers()} onclick={() => void treeOp(dir.paused ? 'resumed' : 'paused', 'direction_pause', {paused: !dir.paused})}>
+                        <Button variant="ghost" disabled={!steers()} onclick={() => void treeOp(dir.paused ? 'resumed' : 'paused', 'direction_pause', {id: dir.id, paused: !dir.paused})}>
                             {dir.paused ? 'Resume' : 'Pause'}
                         </Button>
                     )}
-                    <Button variant="ghost" disabled={!steers()} onclick={() => void treeOp('direction cleared', 'direction_clear', {})}>
+                    <Button variant="ghost" disabled={!steers()} onclick={() => void treeOp('direction cleared', 'direction_clear', {id: dir.id})}>
                         {dir.reached ? 'Done' : 'Stop'}
                     </Button>
                 </span>
@@ -1485,7 +1625,7 @@ function directionCard(d: TreeState): m.Children {
                     stop(
                         'now',
                         t,
-                        [<span class="way-tag way-tag--now">{nowTag(t)}</span>, techPips(t)],
+                        [<span class="way-tag way-tag--now">{nowTag(t)}</span>, techPips(t), where(repoOf(t))],
                         () => openResearch(t),
                     ),
                 )}
@@ -1496,7 +1636,7 @@ function directionCard(d: TreeState): m.Children {
                         <span class="way-stop__sub">{dir.scouted?.why === 'every' ? `after ${dir.scout_every} landings` : 'the way ran out'} · nothing starts meanwhile</span>
                     </div>
                 ) : null}
-                {next && dir.next ? stop('next', next, [<span class="way-tag way-tag--next">next</span>, nextWord(d, dir.next)], () => pick(next.id)) : null}
+                {next && dir.next ? stop('next', next, [<span class="way-tag way-tag--next">next</span>, nextWord(d, dir.next), where(dir.next.project)], () => pick(next.id)) : null}
                 <div class={`way-stop way-stop--goal`}>
                     <span class="way-stop__node">{GOAL_FLAG}</span>
                     <span class="way-stop__name">{dir.reached ? 'Reached' : 'The goal'}</span>
@@ -1504,7 +1644,12 @@ function directionCard(d: TreeState): m.Children {
                 </div>
             </div>
             {dir.paused ? <span class="tree-caveat">{dir.paused}</span> : null}
-            {dir.reached ? null : <span class="hint tree-direction__limits">{limitsLine(dir)}</span>}
+            {dir.reached ? null : (
+                <span class="hint tree-direction__limits">
+                    {order && projects.length ? `${projects.map((p) => projectName(p) ?? p).join(', ')} · ` : ''}
+                    {limitsLine(dir)}
+                </span>
+            )}
         </div>
     )
 }
@@ -1618,7 +1763,7 @@ function treeView(d: TreeState, g: Goal, all: Tech[]): m.Children {
     const l = layout(techs, laned ? (t) => th.band.get(t.id) ?? -1 : undefined, state.fill)
     const focus = [state.hover, state.focus].find((id) => id && techs.some((t) => t.id === id)) ?? ''
     // Nothing tapped: the way the tree is heading, lit.
-    const dir = directionOf(d)
+    const dir = directionOf(d, g)
     const lit = focus ? lineOf(techs, focus) : dir && !dir.reached ? pathOf(d, dir.target) : null
     const nextId = dir && !dir.reached ? (dir.next?.tech ?? '') : ''
     const counts = (s: TechState) => all.filter((t) => t.state === s).length
@@ -1959,7 +2104,7 @@ function techDialog(d: TreeState): m.Children {
     } else {
         // No "Not this" or "It is built" to decide: a tech is built when its session lands or the scout finds it on
         // main, and a guess nobody starts fades by itself (tree.rs `guess_faded`). Saying so in a conversation still can.
-        if (going && directionOf(d)?.target !== t.id) {
+        if (going && !headingFor(d, t.id)) {
             buttons.push(
                 <Button variant="secondary" disabled={!steers()} onclick={() => headFor(d, t.id, t.name, close)}>
                     Head this way
@@ -2331,6 +2476,7 @@ export class ResearchPage extends MithrilComponent {
         const d = state.data
         if (!d) return <p class="hint">{state.error || 'Loading the research tree…'}</p>
         const h = here()
+        if (h === 'research/directions') return directionsPage(d)
         const edit = h.match(/^research\/g\/(g\d+|new)(?:\/(g\d+))?$/)
         if (edit) return editPage(d, edit[1] === 'new' ? '' : edit[1]!, edit[2] ?? '')
         const g = pickedGoal(d)
@@ -2338,7 +2484,10 @@ export class ResearchPage extends MithrilComponent {
             const p = projectName(shown())
             return (
                 <div class="stack">
-                    <div class="tree-bar__row">{goalProjects(d)}</div>
+                    <div class="tree-bar__row">
+                        {goalProjects(d)}
+                        {directionsLink(d)}
+                    </div>
                     <Card
                         title={p ? `Research · ${p}` : 'Research'}
                         subtitle={p ? `${p} has no goal yet.` : 'A tree of what the work is for, as in Civilization: your goals at the end, the techs on the way, built at the top.'}
@@ -2359,7 +2508,7 @@ export class ResearchPage extends MithrilComponent {
         return (
             <div class="stack">
                 {goalBar(d, g)}
-                {directionOf(d)?.reached ? null : directionCard(d)}
+                {directionOf(d, g)?.reached ? null : directionCard(d, directionOf(d, g))}
                 {treeView(d, g, techs)}
                 <div class="tree-folds">
                     {whatNext(d, g, techs)}
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index ec8c884..6a04a75 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -245,6 +245,9 @@ export interface Tech {
     exists: string
     /** When it is done: one to three checks a person could make, written by the scout or the person; the research brief carries it. */
     done?: string | null
+    /** The projects its change lands in, in order, one session each (tree.rs `lands_in`); and those that have landed. */
+    lands_in?: string[]
+    landed_in?: string[]
     size: 'S' | 'M' | 'L'
     evidence: string[]
     needs: string[]
@@ -275,7 +278,7 @@ export interface Tech {
     /** The person's remarks on its mockup, waiting for its next drawing, which takes them away. */
     remarks?: {id: string; text: string; by: string; at: number}[]
     /** Fields changed on the person's word (`tech_edit`): each one's value before, by whom and when. */
-    edited?: Partial<Record<'name' | 'what' | 'who' | 'differently' | 'exists' | 'done' | 'size', {was: string; by: string; at: number}>>
+    edited?: Partial<Record<'name' | 'what' | 'who' | 'differently' | 'exists' | 'done' | 'size' | 'lands_in', {was: string; by: string; at: number}>>
     /** The session researching it, started from the tree. */
     research?: {session: string; by: string; at: number} | null
     /** Every session that researched it, oldest first, and how each ended (`landed`, `dropped`, `done`, `ended`); none while it goes on. */
@@ -346,8 +349,10 @@ export interface TreeState {
     techs: Tech[]
     insights: Insight[]
     rounds: Round[]
-    /** The direction chosen on the tree: the techs on the way to `target` researched one after another (tree.rs `tick`). */
-    direction?: Direction | null
+    /** The directions chosen on the tree, in the person's order: each researches the techs on the way to its `target` one after another (tree.rs `tick`). */
+    directions?: Direction[]
+    /** What every direction together may start, and what it holds now (tree.rs `budget_of`). */
+    budget?: TreeBudget
     /** The built techs waiting to be photographed, one session after another (tree.rs `photo_step`). */
     photos?: {queue: string[]; by: string; at: number} | null
     /** Themes the scout's Group proposed: goals under `goal`, each with its techs, until kept or dropped. */
@@ -356,7 +361,18 @@ export interface TreeState {
     last_goal?: string
 }
 
+/** At once, a day and at once in one project, for all directions together; what goes now, started today, and cost this week. */
+export interface TreeBudget {
+    at_once: number
+    per_day: number
+    per_project: number
+    going: number
+    today: number
+    week_cost: number
+}
+
 export interface Direction {
+    id: string
     target: string
     name: string
     by: string
@@ -373,7 +389,7 @@ export interface Direction {
     paused: string | null
     reached: number | null
     cleared?: {by: string; at: number} | null
-    runs: {tech: string; session: string; at: number; outcome: string | null; ended?: number; cost?: number | null}[]
+    runs: {tech: string; session: string; repo?: string; at: number; outcome: string | null; ended?: number; cost?: number | null}[]
     /** What it starts next, and why not yet (tree.rs `next_of`). */
     next?: DirectionNext | null
 }
@@ -385,9 +401,11 @@ export interface Direction {
  */
 export interface DirectionNext {
     tech: string | null
-    why: 'soon' | 'after' | 'at_once' | 'per_day' | 'focus' | 'paused' | 'scouting'
+    why: 'soon' | 'after' | 'at_once' | 'per_day' | 'focus' | 'paused' | 'scouting' | 'budget' | 'project'
     after?: string | null
     at?: number | null
+    /** The project it works in; for `project`, the one that has no room. */
+    project?: string | null
 }
 
 
diff --git a/web/src/lib/discuss.ts b/web/src/lib/discuss.ts
index cfa107c..13647a3 100644
--- a/web/src/lib/discuss.ts
+++ b/web/src/lib/discuss.ts
@@ -707,7 +707,7 @@ export function treeDone(op: string, a: Record<string, unknown>, d: TreeState):
         case 'tech_drop':
             return `not this: ${name(id)}`
         case 'tech_edit':
-            return `${name(id)} changed: ${['name', 'what', 'who', 'differently', 'exists', 'size'].filter((k) => k in a).join(', ')}`
+            return `${name(id)} changed: ${['name', 'what', 'who', 'differently', 'exists', 'done', 'size', 'lands_in'].filter((k) => k in a).join(', ')}`
         case 'remark':
             return `remark on the mockup of ${name(id)}`
         case 'remark_drop':
@@ -718,6 +718,12 @@ export function treeDone(op: string, a: Record<string, unknown>, d: TreeState):
             return a.paused === false ? 'direction resumed' : 'direction paused'
         case 'direction_clear':
             return 'direction stopped'
+        case 'direction_limits':
+            return 'direction limits changed'
+        case 'direction_order':
+            return 'directions put in a new order'
+        case 'budget_set':
+            return 'budget for all directions changed'
         case 'research':
             return `research on ${name(id)} started${d.techs.find((t) => t.id === id)?.research ? ` in ${d.techs.find((t) => t.id === id)!.research!.session}` : ''}`
         default:
diff --git a/web/src/lib/treetalk.test.ts b/web/src/lib/treetalk.test.ts
index c30eb9b..813ea78 100644
--- a/web/src/lib/treetalk.test.ts
+++ b/web/src/lib/treetalk.test.ts
@@ -16,7 +16,8 @@ test('the tree reads as its goal, its techs by state with ids, and where it head
         techs: [tech('k1', {state: 'built', built: true}), tech('k2', {needs: ['k1']}), tech('k3', {state: 'fog'}), tech('k4', {state: 'dropped', dropped: {by: 'p', at: 0, why: 'not for us'}})],
         insights: [{id: 'i1', goal: 'g1', text: 'organisers plan on phones', about: null, evidence: [], move: 'person', by: 'p', at: 0, faded: false}],
         rounds: [round({focus: 'the phone'})],
-        direction: {target: 'g1', name: 'goal g1', by: 'p', at: 0, at_once: 1, per_day: 4, paused: null, reached: null, runs: [], next: {tech: 'k2', why: 'soon'}},
+        directions: [{id: 'd1', target: 'g1', name: 'goal g1', by: 'p', at: 0, at_once: 1, per_day: 4, paused: null, reached: null, runs: [], next: {tech: 'k2', why: 'soon', project: 'acme/app'}}],
+        budget: {at_once: 3, per_day: 10, per_project: 1, going: 0, today: 0, week_cost: 0},
         moves: ['map'],
     }
     const t = treeText(d, 'g1')
@@ -28,7 +29,8 @@ test('the tree reads as its goal, its techs by state with ids, and where it head
     expect(t).toContain('In the fog (a guess: Keep it or Not this) (1):\n- k3')
     expect(t).toContain('Not this: not for us')
     expect(t).toContain("- i1: organisers plan on phones (the person's own)")
-    expect(t).toContain('heading to "goal g1" (g1), on; at most 1 at once and 4 a day, the scout sent when the way runs out. Next: k2 (soon).')
+    expect(t).toContain('1 going, in this order (the first starts first when the budget is short); together at most 3 at once, 10 a day and 1 at once in one project')
+    expect(t).toContain('- d1: heading to "goal g1" (g1), on; at most 1 at once and 4 a day, the scout sent when the way runs out. Next: k2 (soon, in acme/app).')
     expect(t).toContain('(looking at: the phone)')
 })
 
diff --git a/web/src/lib/treetalk.ts b/web/src/lib/treetalk.ts
index 2f4c3c0..e725d58 100644
--- a/web/src/lib/treetalk.ts
+++ b/web/src/lib/treetalk.ts
@@ -1,4 +1,4 @@
-import type {Round, Tech, TreeState} from '@/lib/api'
+import type {Direction, Round, Tech, TreeState} from '@/lib/api'
 import {goalsUnder, techsOf, wayOf} from '@/lib/tree'
 
 /**
@@ -33,7 +33,14 @@ export function treeText(d: TreeState, goal: string): string {
     const under = goalsUnder(d.goals, g.id)
     const insights = d.insights.filter((i) => under.includes(i.goal) && !i.dropped && !i.faded).map((i) => `- ${i.id}${i.about ? ` (on ${name(i.about)})` : ''}: ${i.text}${i.move === 'person' ? ' (the person\'s own)' : ''}`)
     const proposals = (d.proposals ?? []).filter((p) => under.includes(p.goal)).map((p) => `- ${p.id} "${p.name}": ${p.statement} (${p.techs.length} techs)`)
-    const dir = d.direction && !d.direction.cleared ? directionText(d) : 'No direction is set: nothing is researched by itself.'
+    const going = (d.directions ?? []).filter((x) => !x.cleared)
+    const b = d.budget
+    const dir = going.length
+        ? [
+              `${going.length} going, in this order (the first starts first when the budget is short)${b ? `; together at most ${b.at_once} at once, ${b.per_day} a day and ${b.per_project} at once in one project, ${b.going} at work now and ${b.today} started today` : ''}:`,
+              ...going.map((x) => `- ${directionText(d, x)}`),
+          ].join('\n')
+        : 'No direction is set: nothing is researched by itself.'
     const rounds = d.rounds.filter((r) => under.includes(r.goal)).slice(-5).map(roundLine)
     const part = (title: string, rows: string[]) => (rows.length ? `${title}:\n${rows.join('\n')}` : `${title}: none.`)
     return [
@@ -84,15 +91,14 @@ export function techText(d: TreeState, id: string): string {
         .join('\n')
 }
 
-function directionText(d: TreeState): string {
-    const x = d.direction!
+function directionText(d: TreeState, x: Direction): string {
     const name = (id: string | null) => (id ? (d.techs.find((t) => t.id === id)?.name ?? id) : 'nothing yet')
     const state = x.reached ? 'reached' : x.paused ? `paused (${x.paused})` : 'on'
-    const next = x.next ? ` Next: ${name(x.next.tech)} (${x.next.why}${x.next.after ? `, after ${name(x.next.after)}` : ''}).` : ''
+    const next = x.next ? ` Next: ${name(x.next.tech)} (${x.next.why}${x.next.after ? `, after ${name(x.next.after)}` : ''}${x.next.project ? `, in ${x.next.project}` : ''}).` : ''
     const last = x.runs.at(-1)
     const ran = last ? ` Last started: ${name(last.tech)} in ${last.session}${last.outcome ? `, ${last.outcome}` : ', at work'}.` : ''
     const scout = x.scout === false ? 'no scout' : `the scout sent when the way runs out${x.scout_every ? ` and every ${x.scout_every} landings` : ''}`
-    return `heading to "${x.name}" (${x.target}), ${state}; at most ${x.at_once} at once and ${x.per_day} a day, ${scout}.${next}${ran}`
+    return `${x.id}: heading to "${x.name}" (${x.target}), ${state}; at most ${x.at_once} at once and ${x.per_day} a day, ${scout}.${next}${ran}`
 }
 
 export function roundLine(r: Round): string {