Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a79cb81
chore(porch): 1134 init spir
waleedkadous Jul 3, 2026
eb8ad0f
[Spec 1134] Initial specification draft
waleedkadous Jul 3, 2026
57c022d
chore(porch): 1134 specify build-complete
waleedkadous Jul 3, 2026
52963f0
[Spec 1134] Specification with multi-agent review
waleedkadous Jul 3, 2026
1e154d9
chore(porch): 1134 spec-approval gate-requested
waleedkadous Jul 3, 2026
b9d12c1
[Spec 1134] Update builder thread: spec-approval gate reached
waleedkadous Jul 3, 2026
4c74d4c
chore(porch): 1134 spec-approval gate-approved
waleedkadous Jul 3, 2026
5a57ad5
chore(porch): 1134 plan phase-transition
waleedkadous Jul 3, 2026
87a8740
[Spec 1134] Initial implementation plan
waleedkadous Jul 3, 2026
f063ae6
chore(porch): 1134 plan build-complete
waleedkadous Jul 3, 2026
a3c326a
[Spec 1134] Plan with multi-agent review
waleedkadous Jul 3, 2026
9b7cc5a
chore(porch): 1134 plan-approval gate-requested
waleedkadous Jul 3, 2026
f6f5834
[Spec 1134] Update builder thread: plan-approval gate reached
waleedkadous Jul 3, 2026
169845a
chore(porch): 1134 plan-approval gate-approved
waleedkadous Jul 3, 2026
cc23432
chore(porch): 1134 implement phase-transition
waleedkadous Jul 3, 2026
2946420
[Spec 1134][Phase: whoami-command] feat: Add afx whoami identity diag…
waleedkadous Jul 3, 2026
883cf71
chore(porch): 1134 implement build-complete
waleedkadous Jul 3, 2026
55909bb
chore(porch): 1134 advance plan phase → phase_2
waleedkadous Jul 3, 2026
27ea712
[Spec 1134][Phase: arch-init-skill] feat: Ship /arch-init skill in bo…
waleedkadous Jul 3, 2026
b300539
chore(porch): 1134 implement build-complete
waleedkadous Jul 3, 2026
8ef6910
chore(porch): 1134 advance plan phase → phase_3
waleedkadous Jul 3, 2026
daf703f
[Spec 1134][Phase: docs-sync] docs: Document afx whoami in CLI refere…
waleedkadous Jul 3, 2026
cfb016a
chore(porch): 1134 implement build-complete
waleedkadous Jul 3, 2026
5ab9f74
chore(porch): 1134 all plan phases complete → review
waleedkadous Jul 3, 2026
82c59ed
[Spec 1134] Review: lessons learned, consultation ledger, governance-…
waleedkadous Jul 3, 2026
5b18005
chore(porch): 1134 review build-complete
waleedkadous Jul 3, 2026
fae6d18
chore(porch): 1134 pr gate-requested
waleedkadous Jul 3, 2026
51edd3e
[Spec 1134] Update builder thread: pr gate reached
waleedkadous Jul 3, 2026
f2e6c21
[Spec 1134] Thread: hold at pr gate pending amrmelsayed review
waleedkadous Jul 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .claude/skills/afx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ afx status # Show all builders and workspace status

No flags needed. Shows Tower status, workspace, and all active builders.

## afx whoami

```bash
afx whoami # Report this terminal's identity (workspace, type, name)
afx whoami --json # Same, as a single JSON object
```

Resolves identity from Tower/global.db's perspective: builder-worktree cwd
match first, then the Tower-injected `CODEV_ARCHITECT_NAME` env var. Exits 1
with an explanation when identity cannot be determined — it never guesses and
never defaults to `main` (issue #1094). Builders also get an `architect:`
field naming their spawning architect when recorded. Works without Tower.

## afx tower

```bash
Expand Down
62 changes: 62 additions & 0 deletions .claude/skills/arch-init/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: arch-init
description: Adopt an architect identity and recover its state from codev/state/<name>.md. Use when an architect terminal needs to (re)establish which architect it is — after a restart, context loss, or session handoff — or when the user says "/arch-init", "you are the X architect", or "recover your architect state". Identity resolves via `afx whoami` (an explicit name argument overrides); if neither resolves, ask the human — never guess.
argument-hint: "[name] (e.g. main; omit to auto-detect via afx whoami)"
---

# /arch-init — become architect `<name>` and recover state

You are an **architect agent** in a codev workspace. This command tells you
which architect you are and where your durable state lives, so you can resume
mid-stream.

`$ARGUMENTS` is the architect name (e.g. `main`, or a sibling architect's
name in a multi-architect workspace).

## What to do

1. **Resolve your name.**
- If `$ARGUMENTS` is non-empty, that is your name — the human named you
explicitly, which removes all identity-resolution risk. **Validate it
first**: an architect name must match `[a-z][a-z0-9-]*` and be at most
64 characters (lowercase letters, digits, hyphens; starts with a
letter). Reject anything else — slashes, `..`, uppercase, spaces — and
tell the human the rule. Never build a file path from an unvalidated
name (path-traversal guard).
- If `$ARGUMENTS` is empty, run `afx whoami` and read its output:
- `type: architect` → adopt the reported `name`.
- `type: builder` → STOP. This terminal is a builder, not an architect;
report the mismatch to the human and do not adopt an architect
identity.
- Non-zero exit (identity unknown) → STOP and ask the human which
architect you are. Do NOT guess, and do NOT default to `main` —
adopting the wrong identity and writing to another architect's state
file is the exact failure this command exists to prevent.

2. **Read your state file: `codev/state/<name>.md`** (relative to the
workspace root).
- If it does not exist: list the architect state files in `codev/state/`
— **excluding `*_thread.md` files**, which are builder thread logs that
share the directory — tell the human the file is missing, and ask
whether to start a fresh state file for `<name>`. Do not fabricate
state.
- The state file is authoritative free text. It typically opens with a
role banner and may carry resume instructions; follow whatever it says.

3. **Confirm identity + orient, then follow the state file.** In one tight
block, report: who you now are (name + one-line role from the banner, if
present), the file you read, and the current-state / open-loops summary
from the most recent dated section (or the file's leading content if it
has no dated sections). Then carry out whatever the state file says to do
on resume. Do not invent a new agenda — resume the one the state file
describes.

## Guardrails (architect-wide; the state file may add more)

- **Never auto-approve porch gates.** A gate notification is for the human,
not you.
- **Touch only your own builders / spawns / filings.** Sibling architects own
theirs.
- **Never `cd` into a builder worktree**; use `git -C` + absolute paths.
- **Stay on the default branch at the workspace root**; verify with
`git branch` if unsure.
13 changes: 13 additions & 0 deletions codev-skeleton/.claude/skills/afx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ afx status # Show all builders and workspace status

No flags needed. Shows Tower status, workspace, and all active builders.

## afx whoami

```bash
afx whoami # Report this terminal's identity (workspace, type, name)
afx whoami --json # Same, as a single JSON object
```

Resolves identity from Tower/global.db's perspective: builder-worktree cwd
match first, then the Tower-injected `CODEV_ARCHITECT_NAME` env var. Exits 1
with an explanation when identity cannot be determined — it never guesses and
never defaults to `main` (issue #1094). Builders also get an `architect:`
field naming their spawning architect when recorded. Works without Tower.

## afx tower

```bash
Expand Down
62 changes: 62 additions & 0 deletions codev-skeleton/.claude/skills/arch-init/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: arch-init
description: Adopt an architect identity and recover its state from codev/state/<name>.md. Use when an architect terminal needs to (re)establish which architect it is — after a restart, context loss, or session handoff — or when the user says "/arch-init", "you are the X architect", or "recover your architect state". Identity resolves via `afx whoami` (an explicit name argument overrides); if neither resolves, ask the human — never guess.
argument-hint: "[name] (e.g. main; omit to auto-detect via afx whoami)"
---

# /arch-init — become architect `<name>` and recover state

You are an **architect agent** in a codev workspace. This command tells you
which architect you are and where your durable state lives, so you can resume
mid-stream.

`$ARGUMENTS` is the architect name (e.g. `main`, or a sibling architect's
name in a multi-architect workspace).

## What to do

1. **Resolve your name.**
- If `$ARGUMENTS` is non-empty, that is your name — the human named you
explicitly, which removes all identity-resolution risk. **Validate it
first**: an architect name must match `[a-z][a-z0-9-]*` and be at most
64 characters (lowercase letters, digits, hyphens; starts with a
letter). Reject anything else — slashes, `..`, uppercase, spaces — and
tell the human the rule. Never build a file path from an unvalidated
name (path-traversal guard).
- If `$ARGUMENTS` is empty, run `afx whoami` and read its output:
- `type: architect` → adopt the reported `name`.
- `type: builder` → STOP. This terminal is a builder, not an architect;
report the mismatch to the human and do not adopt an architect
identity.
- Non-zero exit (identity unknown) → STOP and ask the human which
architect you are. Do NOT guess, and do NOT default to `main` —
adopting the wrong identity and writing to another architect's state
file is the exact failure this command exists to prevent.

2. **Read your state file: `codev/state/<name>.md`** (relative to the
workspace root).
- If it does not exist: list the architect state files in `codev/state/`
— **excluding `*_thread.md` files**, which are builder thread logs that
share the directory — tell the human the file is missing, and ask
whether to start a fresh state file for `<name>`. Do not fabricate
state.
- The state file is authoritative free text. It typically opens with a
role banner and may carry resume instructions; follow whatever it says.

3. **Confirm identity + orient, then follow the state file.** In one tight
block, report: who you now are (name + one-line role from the banner, if
present), the file you read, and the current-state / open-loops summary
from the most recent dated section (or the file's leading content if it
has no dated sections). Then carry out whatever the state file says to do
on resume. Do not invent a new agenda — resume the one the state file
describes.

## Guardrails (architect-wide; the state file may add more)

- **Never auto-approve porch gates.** A gate notification is for the human,
not you.
- **Touch only your own builders / spawns / filings.** Sibling architects own
theirs.
- **Never `cd` into a builder worktree**; use `git -C` + absolute paths.
- **Stay on the default branch at the workspace root**; verify with
`git branch` if unsure.
59 changes: 59 additions & 0 deletions codev-skeleton/resources/commands/agent-farm.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,65 @@ Status values:

---

### afx whoami

Report this terminal's agent identity — workspace, type, and name — from
Tower/global.db's perspective.

```bash
afx whoami
afx whoami --json
```

**Description:**

Resolves who the current terminal's agent is. Identity precedence:

1. **Builder worktree** — when CWD is inside `.builders/<id>/`, the canonical
builder id is verified against `global.db` (the same resolution `afx send`
uses). An unverifiable worktree identity is an error, never a fallthrough
to the next signal.
2. **`CODEV_ARCHITECT_NAME`** — the env var Tower injects into architect
terminals.
3. **Unknown** — exits non-zero with an explanation. There is no implicit
fallback to `main` (issue #1094: unverified identities misroute messages).

Works without Tower running (reads `global.db` read-only).

**Example output (architect terminal):**

```
workspace: codev
type: architect
name: main
```

**Example output (builder worktree):**

```
workspace: codev
type: builder
name: builder-spir-984
architect: main
```

The `architect:` line is the builder's spawning architect; it is omitted when
not recorded (legacy rows).

**JSON output:**

```bash
afx whoami --json
# {"workspace":"codev","type":"builder","name":"builder-spir-984","architect":"main"}
```

On failure, `--json` prints `{"error":"..."}` to stdout (the human-readable
explanation still goes to stderr) and exits 1.

**Exit codes:** `0` identity resolved; `1` identity unknown or unverifiable.

---

### afx cleanup

Clean up a builder worktree and branch.
Expand Down
Loading
Loading