You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move the /architect slash command into codev itself, renamed /arch-init — today it lives only in the architect's personal ~/.claude/commands/architect.md. It should ship with codev (skeleton → all adopting projects) so any architect terminal in any codev workspace can run /arch-init to adopt its identity and recover state from codev/state/<name>.md.
/arch-init must use afx whoami for identity resolution — replacing the current fragile ps -p $PPID process-ancestry matching against afx status output. If whoami resolves the identity, use it; an explicit [name] argument still overrides; if neither, stop and ask the human (never guess).
Existing plumbing to build on
Tower already sets CODEV_ARCHITECT_NAME in architect PTY env (packages/codev/src/agent-farm/servers/tower-terminals.ts:654 and :897) — the natural signal for architect identity.
Identity precedence for whoami: builder-worktree cwd match → CODEV_ARCHITECT_NAME env → unknown (exit non-zero with a clear message). Do not fall back to "main" implicitly.
/arch-init content should be generalized (the current ~/.claude/commands/architect.md is Shannon-workspace-flavored) — workspace-agnostic wording, same guardrails (never auto-approve gates, only touch your own builders, never cd into worktrees, stay on default branch at root).
Ship /arch-init via codev-skeleton/ so codev init / codev update installs it; mirror in our own instance. Remember the two-tree rule: change BOTH codev/ and codev-skeleton/ where applicable.
whoami must work from both the main workspace root (architect) and inside a .builders/<id>/ worktree (builder).
Acceptance criteria
afx whoami from an architect terminal prints workspace/type/name matching Tower's records.
afx whoami from a builder worktree prints the canonical builder id (+ spawning architect when recorded).
afx whoami in an unrecognized context exits non-zero with a helpful message.
/arch-init [name] resolves identity via afx whoami (arg overrides), reads codev/state/<name>.md, and reports the resume summary.
/arch-init ships in the skeleton and resolves in fresh installs.
Summary
Two related improvements to support multi-architect workspaces:
New
afx whoamicommand — reports, from Tower/global.db's perspective, who the current terminal's agent is:For builders:
Should support
--json. When identity cannot be determined (plain shell, unregistered terminal), say so clearly — fail loud, no guessing (see afx send: detectCurrentBuilderId silently falls back to bare worktree name on state.db read failure → builder messages misroute to main #1094 for why silent identity fallbacks are dangerous).Move the
/architectslash command into codev itself, renamed/arch-init— today it lives only in the architect's personal~/.claude/commands/architect.md. It should ship with codev (skeleton → all adopting projects) so any architect terminal in any codev workspace can run/arch-initto adopt its identity and recover state fromcodev/state/<name>.md./arch-initmust useafx whoamifor identity resolution — replacing the current fragileps -p $PPIDprocess-ancestry matching againstafx statusoutput. Ifwhoamiresolves the identity, use it; an explicit[name]argument still overrides; if neither, stop and ask the human (never guess).Existing plumbing to build on
CODEV_ARCHITECT_NAMEin architect PTY env (packages/codev/src/agent-farm/servers/tower-terminals.ts:654and:897) — the natural signal for architect identity.detectCurrentBuilderId()inpackages/codev/src/agent-farm/commands/send.ts:111resolves builder identity from cwd + global.db, scoped byworkspace_path, failing loud (BuilderIdResolutionError) per afx send: detectCurrentBuilderId silently falls back to bare worktree name on state.db read failure → builder messages misroute to main #1094.whoamishould reuse/share this, not duplicate it.architecttable in~/.agent-farm/global.db(Consolidate state.db tables into global.db (single user-global database) to eliminate the cwd-dependent fragmentation that causes "missing architect state after restart" #1118).Design notes / constraints
whoami: builder-worktree cwd match →CODEV_ARCHITECT_NAMEenv → unknown (exit non-zero with a clear message). Do not fall back to "main" implicitly./arch-initcontent should be generalized (the current~/.claude/commands/architect.mdis Shannon-workspace-flavored) — workspace-agnostic wording, same guardrails (never auto-approve gates, only touch your own builders, never cd into worktrees, stay on default branch at root)./arch-initviacodev-skeleton/socodev init/codev updateinstalls it; mirror in our own instance. Remember the two-tree rule: change BOTHcodev/andcodev-skeleton/where applicable.whoamimust work from both the main workspace root (architect) and inside a.builders/<id>/worktree (builder).Acceptance criteria
afx whoamifrom an architect terminal prints workspace/type/name matching Tower's records.afx whoamifrom a builder worktree prints the canonical builder id (+ spawning architect when recorded).afx whoamiin an unrecognized context exits non-zero with a helpful message./arch-init [name]resolves identity viaafx whoami(arg overrides), readscodev/state/<name>.md, and reports the resume summary./arch-initships in the skeleton and resolves in fresh installs.