agentleFS
dylanroscoverdylanroscover/Embody/.claude/skills/multi-session-etiquette/SKILL.md

multi-session-etiquette

Skill213 starsChanged 2 months agoMITView on GitHub

MUST READ when a _peers advisory appears or multiple AI sessions are active in the same TouchDesigner project: advisory contract, claim leases, destructive gates, raw-file-edit visibility, division of labor.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call get_sessions once early.

    line 17
  2. Very specific:

    STOP. Do not keep mutating that scope.

    line 29
  3. Very specific:

    Before a large build, a refactor of a COMP subtree, or editing an externalized file, call claim_scope with the NARROWEST scope that covers …

    line 37
  4. Distinctive:

    If a claim is refused, the response names the holder, their note, and the expiry.

    line 45
  5. Distinctive:

    Never override silently: state in your reply that you overrode and why.

    line 77
  6. Very specific:

    Run preflight_landing(worktree_path) FIRST -- it intersects the landing's files with main-tree dirt, peer file territory, and unsaved live …

    line 106

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated by Embody/Envoy - Do not remove this comment - sha:2217d5117c2491f7 -->

Multi-Session Etiquette

Multiple AI sessions (several client windows, different MCP clients) often work on the same TouchDesigner project at once -- same live network, same externalized files, same git tree. Envoy coordinates them; this rule is how you cooperate.

At session start

Call get_sessions once early. It lists every connected session (label, idle time, recent_scopes it modified, claims it holds, you = your own session id). If peers are active, prefer working in a subtree none of them touched recently.

Read the advisories -- they come to you

  • Any tool response may carry _peers: another session touched territory overlapping your request (op path or externalized file) within ~10 min.
  • conflict: false -- informational. Note it, re-read files before editing them, and avoid building on top of a peer's in-flight work.
  • conflict: true (a peer WROTE there within the last minute) is a HARD STOP. Do not keep mutating that scope. Check get_sessions, tell the user who is working there, and either divide the work (different subtrees) or get explicit user direction before proceeding.
  • A CONFLICT WARNING or MULTI-SESSION GATE line in _logs follows the same contract as a LAYOUT WARNING: never end a turn without addressing it.

Claim before big or destructive work

  • Before a large build, a refactor of a COMP subtree, or editing an externalized file, call claim_scope with the NARROWEST scope that covers the work and a short note ("rebuilding camera rig"): an op-path prefix (/project1/scene), a file (file:scripts/tools.py), or a special scope (project:tests before a test run).
  • Your own tool calls touching the scope renew the lease automatically; it expires on its TTL or when your session goes silent. release_scope when done is polite but never required for others to make progress.
  • If a claim is refused, the response names the holder, their note, and the expiry. Coordinate or work elsewhere -- do NOT retry in a loop.

The task ledger -- state, not just presence

Claims say who is touching what right now; the ledger (.embody/tasks.json, via announce_task / update_task) says what state the WORK is in. It exists because a dirty tree plus recency signals cannot distinguish in-flight work from FINISHED work awaiting a commit -- and misreading that costs real coordination time.

  • Starting substantive work (a feature, fix, refactor -- not single-tool edits): announce_task with a short title and the scopes it will touch. Worktree tasks announce IN ADDITION to their durable worktree claim.
  • Finishing: flip to done_uncommitted the moment the work is complete but sitting uncommitted in the tree. This is the load-bearing state -- it is what stops a peer from reading your finished feature as in-flight work, and preflight_landing reports ledger tasks overlapping a landing.
  • Committing: update_task(task_id, commit='<sha>') -- a sha alone implies the committed transition.
  • Reading: get_sessions carries every session's active entries; check them at session start and before working in files another task names.
  • Hygiene: any session may mark a dead session's stale task abandoned (the ledger records updated_by for non-owner writes).

Destructive operations are gated

  • delete_op, import_network with clear_first=True, run_tests, and batches containing them are REFUSED while a live peer holds a claim on the scope or wrote it within the last minute.
  • override=True exists for when you are CERTAIN -- e.g. the "peer" is the same user's stale session, or the user explicitly told you to proceed. Never override silently: state in your reply that you overrode and why.

Raw file edits are invisible to Envoy

  • Envoy only sees MCP traffic. Editing an externalized file with your own file tools (Edit/Write) leaves no touch record -- so before editing one, check get_sessions (does a peer claim it or list it in recent_scopes?) and claim it yourself (file:<repo-relative-path>) for the duration.
  • Re-read a file before editing whenever a peer's recent_scopes mentions it: your cached copy may be stale.

Worktrees are scoped territory too

Isolated-worktree work (../<repo>-wt-<task>, see rules/worktree-td-safety.md) is doubly invisible: the edits are raw file edits AND they happen outside the repo Envoy watches. Peers cannot see any of it until the diff lands. So coordinate by intent, not by touch records:

  • On starting a worktree task: claim project:worktree-<task> (e.g. project:worktree-watchdog) with a note naming the files/subsystem the diff will land on. This is how peers learn a worktree task is in flight. Worktree claims are DURABLE -- they survive session death and Envoy restarts, expiring only when the worktree directory is removed (7-day backstop); get_sessions lists them under worktrees.
  • Before landing the diff: claim file:<repo-relative-path> for each externalized file the diff touches (or the narrowest shared parent scope). If a peer holds one, reconcile first -- landing over a peer's in-flight edit is the worktree version of a blind overwrite. Run preflight_landing(worktree_path) FIRST -- it intersects the landing's files with main-tree dirt, peer file territory, and unsaved live TDXN state in one call; a conflicts verdict means reconcile before any file moves.
  • Two sessions must never share one worktree -- one writer per checkout, always. A second session starts its own ../<repo>-wt-<other-task>.
  • Access is pre-authorized: Envoy's generated settings allow Read/Edit in sibling <repo>-wt-* folders, so worktree work never needs permission prompts (keep the -wt- naming for this to apply).

Division of labor

The cheapest coordination is spatial: agree (via the user) on separate COMP subtrees or file areas per session. Claims make that agreement visible and enforceable.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.