docs/ECC-2.0-SESSION-ADAPTER-DISCOVERY.md
This document turns the March 11 ECC 2.0 control-plane direction into a concrete adapter and snapshot design grounded in the orchestration code that already exists in this repo.
The repo already has a real first-pass orchestration substrate:
scripts/lib/tmux-worktree-orchestrator.js
provisions tmux panes plus isolated git worktreesscripts/orchestrate-worktrees.js
is the current session launcherscripts/lib/orchestration-session.js
collects machine-readable session snapshotsscripts/orchestration-status.js
exports those snapshots from a session name or plan filecommands/sessions.md
already exposes adjacent session-history concepts from Claude's local storescripts/lib/session-adapters/canonical-session.js
defines the canonical ecc.session.v1 normalization layerscripts/lib/session-adapters/dmux-tmux.js
wraps the current orchestration snapshot collector as adapter dmux-tmuxscripts/lib/session-adapters/claude-history.js
normalizes Claude local session history as a second adapterscripts/lib/session-adapters/registry.js
selects adapters from explicit targets and target typesscripts/session-inspect.js
emits canonical read-only session snapshots through the adapter registryIn practice, ECC can already answer:
That is enough to prove the substrate. It is not yet enough to qualify as a general ECC 2.0 control plane.
The current snapshot model coming out of scripts/lib/orchestration-session.js
has these effective fields:
{
"sessionName": "workflow-visual-proof",
"coordinationDir": ".../.claude/orchestration/workflow-visual-proof",
"repoRoot": "...",
"targetType": "plan",
"sessionActive": true,
"paneCount": 2,
"workerCount": 2,
"workerStates": {
"running": 1,
"completed": 1
},
"panes": [
{
"paneId": "%95",
"windowIndex": 1,
"paneIndex": 0,
"title": "seed-check",
"currentCommand": "codex",
"currentPath": "/tmp/worktree",
"active": false,
"dead": false,
"pid": 1234
}
],
"workers": [
{
"workerSlug": "seed-check",
"workerDir": ".../seed-check",
"status": {
"state": "running",
"updated": "...",
"branch": "...",
"worktree": "...",
"taskFile": "...",
"handoffFile": "..."
},
"task": {
"objective": "...",
"seedPaths": ["scripts/orchestrate-worktrees.js"]
},
"handoff": {
"summary": [],
"validation": [],
"remainingRisks": []
},
"files": {
"status": ".../status.md",
"task": ".../task.md",
"handoff": ".../handoff.md"
},
"pane": {
"paneId": "%95",
"title": "seed-check"
}
}
]
}
This is already a useful operator payload. The main limitation is that it is implicitly tied to one execution style:
ECC 1.x currently has two different "session" surfaces:
Those surfaces are adjacent but not unified.
The missing ECC 2.0 layer is a harness-neutral session adapter boundary that can normalize:
Without that adapter layer, any future operator UI would be forced to read tmux-specific details and coordination markdown directly.
ECC 2.0 should introduce a canonical session adapter contract.
Suggested minimal interface:
type SessionAdapter = {
id: string;
canOpen(target: SessionTarget): boolean;
open(target: SessionTarget): Promise<AdapterHandle>;
};
type AdapterHandle = {
getSnapshot(): Promise<CanonicalSessionSnapshot>;
streamEvents?(onEvent: (event: SessionEvent) => void): Promise<() => void>;
runAction?(action: SessionAction): Promise<ActionResult>;
};
Suggested first-pass canonical payload:
{
"schemaVersion": "ecc.session.v1",
"adapterId": "dmux-tmux",
"session": {
"id": "workflow-visual-proof",
"kind": "orchestrated",
"state": "active",
"repoRoot": "...",
"sourceTarget": {
"type": "plan",
"value": ".claude/plan/workflow-visual-proof.json"
}
},
"workers": [
{
"id": "seed-check",
"label": "seed-check",
"state": "running",
"branch": "...",
"worktree": "...",
"runtime": {
"kind": "tmux-pane",
"command": "codex",
"pid": 1234,
"active": false,
"dead": false
},
"intent": {
"objective": "...",
"seedPaths": ["scripts/orchestrate-worktrees.js"]
},
"outputs": {
"summary": [],
"validation": [],
"remainingRisks": []
},
"artifacts": {
"statusFile": "...",
"taskFile": "...",
"handoffFile": "..."
}
}
],
"aggregates": {
"workerCount": 2,
"states": {
"running": 1,
"completed": 1
}
}
}
This preserves the useful signal already present while removing tmux-specific details from the control-plane contract.
dmux-tmuxWrap the logic already living in
scripts/lib/orchestration-session.js.
This is the easiest first adapter because the substrate is already real.
claude-historyNormalize the data that
commands/sessions.md
and the existing session-manager utilities already expose:
This provides a non-orchestrated baseline for ECC 2.0.
codex-worktreeUse the same canonical shape, but back it with Codex-native execution metadata instead of tmux assumptions where available.
opencodeUse the same adapter boundary once OpenCode session metadata is stable enough to normalize.
The adapter layer should not own:
Its job is narrower:
The adapter layer now lives in:
scripts/lib/session-adapters/
canonical-session.js
dmux-tmux.js
claude-history.js
registry.js
scripts/session-inspect.js
tests/lib/session-adapters.test.js
tests/scripts/session-inspect.test.js
The current orchestration snapshot parser is now being consumed as an adapter implementation rather than remaining the only product contract.
codex-worktree, so the abstraction moves
beyond tmux plus Claude-history.state and health
fields before UI work starts.state and health fields at the canonical layer?Treat the current tmux/worktree implementation as adapter 0, not as the final
product surface.
The shortest path to ECC 2.0 is: