refactor(agents): rename architect agent type → foreman #217

Closed
opened 2026-04-21 11:21:33 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As an operator, I want the architect agent type renamed to foreman across config, code, database, Forgejo identity, and docs, so that the name matches the mental model I already have (the foreman runs the site, delegates work to boss/dev/reviewer, doesn't swing a hammer) and fits cleanly alongside boss / dev / reviewer / designer / design-reviewer as a labor-hierarchy.

Acceptance criteria

Config + DB

  • config/agents.json — rename types.architecttypes.foreman. Update forgejo_user + git_name + git_email + branch_prefix + token_file (rename the token file on disk too). default_system_prompt updated to reference "Foreman" instead of "Architect".
  • HOST_MODE_TYPES allowlist in webhook-config.ts updated from ["architect"] to ["foreman"].
  • NON_DISPATCHABLE_TYPES in webhook-routing.ts updated.
  • One-shot SQLite migration in db.ts::ensureDefaultForTypes (or a sibling migration helper) that runs on boot: UPDATE agents SET type='foreman' WHERE type='architect'; UPDATE agents SET name=REPLACE(name, 'architect-', 'foreman-') WHERE name LIKE 'architect-%'. Idempotent — skip if no architect rows remain.
  • Same migration renames any session rows keyed by architect:…foreman:… (sessions.ts — check <type>:<repo>:<issueOrPr> key prefix).

Source code sweep

  • apps/server/src/architect.tsapps/server/src/foreman.ts (git mv). All imports updated.
  • All architect* identifiers in code: buildArchitectSdkOptions, getArchitectWorker, registerArchitectWorker, resolveArchitectCapture, ArchitectSessionView, ArchitectSessionListEntry, ArchitectFileEntry, etc. — renamed to the Foreman* prefix. Keep the SDK security rails (canUseTool denies on git push origin main/master + mcp__forgejo__merge_pull_request) — those rails must apply to foreman identically.
  • URL paths: keep the /architect/* endpoints as deprecated aliases for 1 release, add matching /foreman/* endpoints. Both hit the same handlers. Delete the aliases in a follow-up ticket once the SPA has shipped with the new paths for a release.
  • packages/shared/src/*.tsArchitect* types renamed to Foreman*.
  • apps/web/src/**routes/planner.*.tsx, components/planner/**, lib/architect.ts, stores/planner-store.ts — rename identifiers + API call sites to /foreman/*. Keep the /app/planner URL — the page name can stay, only the role underneath it changes.

Forgejo identity

  • Decision required: rename the existing architect Forgejo user or create a new foreman user + rotate the token.
    • Rename is destructive (breaks existing PRs/commits attributed to architect), but cleaner long-term.
    • Create-new keeps history intact, forces a token rotation + re-auth.
    • Default to rename unless the operator pushes back. Update token_file path accordingly.
  • Smoke-test: spawn a foreman chat turn post-migration, confirm Forgejo-MCP ops appear as the renamed identity.

Bind dir + credentials

  • Rename ~/.config/claude-hooks/agent-env/architect/…/foreman/. Update container.credentials_host_dir in agents.json.
  • Foreman is host-mode (container.enabled: false) — no container to recreate.

Docs + skills + UI copy

  • CLAUDE.md## Roles, "Host-mode architect" section, every architect reference → foreman. Keep the "why host-mode" / "why singleton" sections verbatim (still true).
  • Memory file pointers in MEMORY.md — anything that references the architect rename scope gets a note.
  • skills/* — any slash-command prompt template that mentions "architect" updated.
  • apps/web/src/components/planner/* — copy: "Foreman worker is not registered" banner, "foreman" chip label, role-color wired to a new --color-role-foreman token.
  • design/tokens.json — add --color-role-foreman (suggest reusing the architect color — not a visual rebrand, just a name change).

Cleanup

  • Delete the orphan agent-default row (type "agent" — no matching entry in agents.json::types). Either via a one-off migration in the same boot step, or via a DELETE /agents/agent-default call from the dashboard after auth.

Verification

  • bun run build + bun run qa clean.
  • just agents-sync reports no changes (container reconcile is a no-op — foreman is host-mode).
  • POST /foreman/chat + GET /foreman/sessions + GET /foreman/stream/:task_id end-to-end with a single test turn that delegates a /breakdown to the boss pool.
  • Existing architect session transcripts are preserved (renamed, not dropped) and render in the Planner's session list under their new foreman- key.

Out of scope

  • Deleting the legacy /architect/* endpoint aliases — follow-up ticket after one release.
  • Any behavioural change to the foreman's capabilities (same SDK options, same security rails, same delegation surface).
  • Renaming the /app/planner URL — the page name is fine; the agent underneath is what changes.

References

  • apps/server/src/architect.ts — core SDK setup + security rails.
  • apps/server/src/webhook-config.ts::HOST_MODE_TYPES — host-mode allowlist (architect-only today).
  • apps/server/src/webhook-routing.ts::NON_DISPATCHABLE_TYPES — webhook dispatch gate.
  • apps/server/src/db.ts::ensureDefaultForTypes — singleton seeding logic; add the rename migration next to it.
  • config/agents.jsontypes.architect block.
  • CLAUDE.md — "Host-mode architect (M18-4 / #165)" section, "Agent types vs. instances" block, modules table.
  • apps/web/src/routes/planner.index.tsx — the "worker not registered" banner.
## User story As an operator, I want the `architect` agent type renamed to `foreman` across config, code, database, Forgejo identity, and docs, so that the name matches the mental model I already have (the foreman runs the site, delegates work to boss/dev/reviewer, doesn't swing a hammer) and fits cleanly alongside `boss` / `dev` / `reviewer` / `designer` / `design-reviewer` as a labor-hierarchy. ## Acceptance criteria ### Config + DB - [ ] `config/agents.json` — rename `types.architect` → `types.foreman`. Update `forgejo_user` + `git_name` + `git_email` + `branch_prefix` + `token_file` (rename the token file on disk too). `default_system_prompt` updated to reference "Foreman" instead of "Architect". - [ ] `HOST_MODE_TYPES` allowlist in `webhook-config.ts` updated from `["architect"]` to `["foreman"]`. - [ ] `NON_DISPATCHABLE_TYPES` in `webhook-routing.ts` updated. - [ ] One-shot SQLite migration in `db.ts::ensureDefaultForTypes` (or a sibling migration helper) that runs on boot: `UPDATE agents SET type='foreman' WHERE type='architect'; UPDATE agents SET name=REPLACE(name, 'architect-', 'foreman-') WHERE name LIKE 'architect-%'`. Idempotent — skip if no `architect` rows remain. - [ ] Same migration renames any session rows keyed by `architect:…` → `foreman:…` (`sessions.ts` — check `<type>:<repo>:<issueOrPr>` key prefix). ### Source code sweep - [ ] `apps/server/src/architect.ts` → `apps/server/src/foreman.ts` (`git mv`). All imports updated. - [ ] All `architect*` identifiers in code: `buildArchitectSdkOptions`, `getArchitectWorker`, `registerArchitectWorker`, `resolveArchitectCapture`, `ArchitectSessionView`, `ArchitectSessionListEntry`, `ArchitectFileEntry`, etc. — renamed to the `Foreman*` prefix. Keep the SDK security rails (`canUseTool` denies on `git push origin main/master` + `mcp__forgejo__merge_pull_request`) — those rails must apply to `foreman` identically. - [ ] URL paths: **keep** the `/architect/*` endpoints as deprecated aliases for 1 release, add matching `/foreman/*` endpoints. Both hit the same handlers. Delete the aliases in a follow-up ticket once the SPA has shipped with the new paths for a release. - [ ] `packages/shared/src/*.ts` — `Architect*` types renamed to `Foreman*`. - [ ] `apps/web/src/**` — `routes/planner.*.tsx`, `components/planner/**`, `lib/architect.ts`, `stores/planner-store.ts` — rename identifiers + API call sites to `/foreman/*`. Keep the `/app/planner` URL — the page name can stay, only the role underneath it changes. ### Forgejo identity - [ ] Decision required: **rename** the existing `architect` Forgejo user or **create** a new `foreman` user + rotate the token. - Rename is destructive (breaks existing PRs/commits attributed to `architect`), but cleaner long-term. - Create-new keeps history intact, forces a token rotation + re-auth. - Default to **rename** unless the operator pushes back. Update `token_file` path accordingly. - [ ] Smoke-test: spawn a foreman chat turn post-migration, confirm Forgejo-MCP ops appear as the renamed identity. ### Bind dir + credentials - [ ] Rename `~/.config/claude-hooks/agent-env/architect/` → `…/foreman/`. Update `container.credentials_host_dir` in `agents.json`. - [ ] Foreman is host-mode (`container.enabled: false`) — no container to recreate. ### Docs + skills + UI copy - [ ] `CLAUDE.md` — `## Roles`, "Host-mode architect" section, every `architect` reference → `foreman`. Keep the "why host-mode" / "why singleton" sections verbatim (still true). - [ ] Memory file pointers in `MEMORY.md` — anything that references the architect rename scope gets a note. - [ ] `skills/*` — any slash-command prompt template that mentions "architect" updated. - [ ] `apps/web/src/components/planner/*` — copy: "Foreman worker is not registered" banner, "foreman" chip label, role-color wired to a new `--color-role-foreman` token. - [ ] `design/tokens.json` — add `--color-role-foreman` (suggest reusing the architect color — not a visual rebrand, just a name change). ### Cleanup - [ ] Delete the orphan `agent-default` row (type `"agent"` — no matching entry in `agents.json::types`). Either via a one-off migration in the same boot step, or via a DELETE /agents/agent-default call from the dashboard after auth. ### Verification - [ ] `bun run build` + `bun run qa` clean. - [ ] `just agents-sync` reports no changes (container reconcile is a no-op — foreman is host-mode). - [ ] POST /foreman/chat + GET /foreman/sessions + GET /foreman/stream/:task_id end-to-end with a single test turn that delegates a `/breakdown` to the boss pool. - [ ] Existing architect session transcripts are preserved (renamed, not dropped) and render in the Planner's session list under their new `foreman-` key. ## Out of scope - Deleting the legacy `/architect/*` endpoint aliases — follow-up ticket after one release. - Any behavioural change to the foreman's capabilities (same SDK options, same security rails, same delegation surface). - Renaming the `/app/planner` URL — the page name is fine; the agent underneath is what changes. ## References - `apps/server/src/architect.ts` — core SDK setup + security rails. - `apps/server/src/webhook-config.ts::HOST_MODE_TYPES` — host-mode allowlist (architect-only today). - `apps/server/src/webhook-routing.ts::NON_DISPATCHABLE_TYPES` — webhook dispatch gate. - `apps/server/src/db.ts::ensureDefaultForTypes` — singleton seeding logic; add the rename migration next to it. - `config/agents.json` — `types.architect` block. - `CLAUDE.md` — "Host-mode architect (M18-4 / #165)" section, "Agent types vs. instances" block, modules table. - `apps/web/src/routes/planner.index.tsx` — the "worker not registered" banner.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#217
No description provided.