Repository navigation
Description
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:workspace: codev type: architect name: mainFor builders:
workspace: codev type: builder name: builder-spir-984 architect: main # spawnedByArchitect, when knownShould 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
- Tower already sets
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.- Architect rows (name, pid, terminal id) live in the
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
- Identity precedence for
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).- Ship
/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.
Activity
changelog: afx whoami + /arch-init identity tooling (#1134, PR #1136)