daemon: report the directory a session was spawned in #178

Closed
opened 2026-10-18 23:37:02 +09:00 by natsukium · 0 comments
Owner

SessionInfo.cwd is the directory a session's program last announced with OSC 7. A session whose program never sends OSC 7 (Claude Code, or a command spawned without a shell) lists no directory at all, though the daemon chose the directory the child started in.

adroit keeps every session in a felis daemon and groups sessions by the directory each one works in. After adroit restarts, the daemon is the only place that still knows that directory, so adroit records it in the session's tags at spawn. A tag holds 128 bytes, and a path under .claude/worktrees/ in a deep checkout runs longer, so adroit splits the path across numbered tags and joins them back when listing. Tags are opaque labels; carrying a path the daemon already holds spends that budget on duplicated state (principle 3: the daemon owns state).

GitHub mirror: https://github.com/felis-terminal/felis/issues/7

Direction

  • Add SessionInfo.spawn_cwd: Option<String>: the absolute directory the child was actually started in. None only where the daemon does not know it.
  • Report the directory the spawn resolved to, not SpawnArgs.cwd as sent: an empty cwd means the daemon's own cwd, and an unusable cwd on a bare shell launch falls back to it (spawn_cwd and the fallback in serve.rs).
  • Carry it through the in-place upgrade dump (upgrade/dump.rs), so a restored session keeps it. A session adopted from a PTY the daemon did not spawn reports None.
  • New field: minor-ledger entry, docs/reference/ipc.md next to cwd, --format json of felis sessions list / info, CHANGELOG.md.
  • Undecided: whether felis sessions info prints it in its human-readable output, or whether the field stays a scripting surface only.

Principle check

  • P1: a real consumer (adroit), and nothing outside the daemon can know the directory once the spawner has restarted.
  • P4: a fact the daemon itself did, not something read from shell output.
`SessionInfo.cwd` is the directory a session's program last announced with OSC 7. A session whose program never sends OSC 7 (Claude Code, or a command spawned without a shell) lists no directory at all, though the daemon chose the directory the child started in. adroit keeps every session in a felis daemon and groups sessions by the directory each one works in. After adroit restarts, the daemon is the only place that still knows that directory, so adroit records it in the session's tags at spawn. A tag holds 128 bytes, and a path under `.claude/worktrees/` in a deep checkout runs longer, so adroit splits the path across numbered tags and joins them back when listing. Tags are opaque labels; carrying a path the daemon already holds spends that budget on duplicated state (principle 3: the daemon owns state). GitHub mirror: https://github.com/felis-terminal/felis/issues/7 ## Direction - Add `SessionInfo.spawn_cwd: Option<String>`: the absolute directory the child was actually started in. `None` only where the daemon does not know it. - Report the directory the spawn resolved to, not `SpawnArgs.cwd` as sent: an empty `cwd` means the daemon's own cwd, and an unusable `cwd` on a bare shell launch falls back to it (`spawn_cwd` and the fallback in `serve.rs`). - Carry it through the in-place upgrade dump (`upgrade/dump.rs`), so a restored session keeps it. A session adopted from a PTY the daemon did not spawn reports `None`. - New field: minor-ledger entry, `docs/reference/ipc.md` next to `cwd`, `--format json` of `felis sessions list` / `info`, `CHANGELOG.md`. - Undecided: whether `felis sessions info` prints it in its human-readable output, or whether the field stays a scripting surface only. ## Principle check - P1: a real consumer (adroit), and nothing outside the daemon can know the directory once the spawner has restarted. - P4: a fact the daemon itself did, not something read from shell output.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
felis-terminal/felis#178
No description provided.