Skip to content

afx whoami + ship /arch-init command in codev (multi-architect identity) #1134

Description

@waleedkadous

Summary

Two related improvements to support multi-architect workspaces:

  1. New afx whoami command — reports, from Tower/global.db's perspective, who the current terminal's agent is:

    workspace: codev
    type: architect
    name: main
    

    For builders:

    workspace: codev
    type: builder
    name: builder-spir-984
    architect: main        # spawnedByArchitect, when known
    

    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).

  2. 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

Design notes / constraints

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cuttingTouches multiple areas — needs coordinated handling

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions