@cluesmith/codev 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dashboard-dist/assets/index-BZ1x7x1X.js.map +1 -1
  2. package/dist/agent-farm/cli.d.ts.map +1 -1
  3. package/dist/agent-farm/cli.js +31 -0
  4. package/dist/agent-farm/cli.js.map +1 -1
  5. package/dist/agent-farm/commands/attach.js +2 -2
  6. package/dist/agent-farm/commands/attach.js.map +1 -1
  7. package/dist/agent-farm/commands/send.d.ts +2 -2
  8. package/dist/agent-farm/commands/send.js +3 -3
  9. package/dist/agent-farm/commands/send.js.map +1 -1
  10. package/dist/agent-farm/commands/setup.d.ts +4 -1
  11. package/dist/agent-farm/commands/setup.d.ts.map +1 -1
  12. package/dist/agent-farm/commands/setup.js +8 -4
  13. package/dist/agent-farm/commands/setup.js.map +1 -1
  14. package/dist/agent-farm/commands/spawn-worktree.d.ts +11 -0
  15. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  16. package/dist/agent-farm/commands/spawn-worktree.js +64 -16
  17. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  18. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  19. package/dist/agent-farm/commands/status.js +26 -2
  20. package/dist/agent-farm/commands/status.js.map +1 -1
  21. package/dist/agent-farm/commands/tower-sweep-husks.d.ts +6 -0
  22. package/dist/agent-farm/commands/tower-sweep-husks.d.ts.map +1 -0
  23. package/dist/agent-farm/commands/tower-sweep-husks.js +77 -0
  24. package/dist/agent-farm/commands/tower-sweep-husks.js.map +1 -0
  25. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  26. package/dist/agent-farm/commands/tower.js +34 -0
  27. package/dist/agent-farm/commands/tower.js.map +1 -1
  28. package/dist/agent-farm/commands/whoami.d.ts +65 -0
  29. package/dist/agent-farm/commands/whoami.d.ts.map +1 -0
  30. package/dist/agent-farm/commands/whoami.js +196 -0
  31. package/dist/agent-farm/commands/whoami.js.map +1 -0
  32. package/dist/agent-farm/commands/workspace-recover.d.ts +31 -0
  33. package/dist/agent-farm/commands/workspace-recover.d.ts.map +1 -1
  34. package/dist/agent-farm/commands/workspace-recover.js +70 -30
  35. package/dist/agent-farm/commands/workspace-recover.js.map +1 -1
  36. package/dist/agent-farm/db/index.d.ts.map +1 -1
  37. package/dist/agent-farm/db/index.js +8 -2
  38. package/dist/agent-farm/db/index.js.map +1 -1
  39. package/dist/agent-farm/lib/tower-client.d.ts +1 -1
  40. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  41. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  42. package/dist/agent-farm/servers/architect-session-holder.d.ts +133 -0
  43. package/dist/agent-farm/servers/architect-session-holder.d.ts.map +1 -0
  44. package/dist/agent-farm/servers/architect-session-holder.js +268 -0
  45. package/dist/agent-farm/servers/architect-session-holder.js.map +1 -0
  46. package/dist/agent-farm/servers/process-census.d.ts +41 -0
  47. package/dist/agent-farm/servers/process-census.d.ts.map +1 -0
  48. package/dist/agent-farm/servers/process-census.js +62 -0
  49. package/dist/agent-farm/servers/process-census.js.map +1 -0
  50. package/dist/agent-farm/servers/send-buffer.d.ts.map +1 -1
  51. package/dist/agent-farm/servers/send-buffer.js +13 -0
  52. package/dist/agent-farm/servers/send-buffer.js.map +1 -1
  53. package/dist/agent-farm/servers/session-log-sweep.d.ts +93 -0
  54. package/dist/agent-farm/servers/session-log-sweep.d.ts.map +1 -0
  55. package/dist/agent-farm/servers/session-log-sweep.js +165 -0
  56. package/dist/agent-farm/servers/session-log-sweep.js.map +1 -0
  57. package/dist/agent-farm/servers/shellper-husk-sweep.d.ts +87 -0
  58. package/dist/agent-farm/servers/shellper-husk-sweep.d.ts.map +1 -0
  59. package/dist/agent-farm/servers/shellper-husk-sweep.js +129 -0
  60. package/dist/agent-farm/servers/shellper-husk-sweep.js.map +1 -0
  61. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  62. package/dist/agent-farm/servers/tower-instances.js +203 -36
  63. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  64. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  65. package/dist/agent-farm/servers/tower-routes.js +147 -4
  66. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  67. package/dist/agent-farm/servers/tower-server.js +95 -1
  68. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  69. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  70. package/dist/agent-farm/servers/tower-terminals.js +66 -8
  71. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  72. package/dist/agent-farm/servers/tower-utils.d.ts +106 -4
  73. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  74. package/dist/agent-farm/servers/tower-utils.js +155 -19
  75. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  76. package/dist/agent-farm/state.d.ts +13 -1
  77. package/dist/agent-farm/state.d.ts.map +1 -1
  78. package/dist/agent-farm/state.js +17 -2
  79. package/dist/agent-farm/state.js.map +1 -1
  80. package/dist/agent-farm/utils/claude-session-discovery.d.ts +12 -0
  81. package/dist/agent-farm/utils/claude-session-discovery.d.ts.map +1 -1
  82. package/dist/agent-farm/utils/claude-session-discovery.js +42 -4
  83. package/dist/agent-farm/utils/claude-session-discovery.js.map +1 -1
  84. package/dist/agent-farm/utils/harness.d.ts +15 -3
  85. package/dist/agent-farm/utils/harness.d.ts.map +1 -1
  86. package/dist/agent-farm/utils/harness.js +4 -1
  87. package/dist/agent-farm/utils/harness.js.map +1 -1
  88. package/dist/commands/adopt.d.ts +3 -2
  89. package/dist/commands/adopt.d.ts.map +1 -1
  90. package/dist/commands/adopt.js +7 -6
  91. package/dist/commands/adopt.js.map +1 -1
  92. package/dist/commands/consult/agy-auth-cache.d.ts +97 -0
  93. package/dist/commands/consult/agy-auth-cache.d.ts.map +1 -0
  94. package/dist/commands/consult/agy-auth-cache.js +320 -0
  95. package/dist/commands/consult/agy-auth-cache.js.map +1 -0
  96. package/dist/commands/consult/index.d.ts.map +1 -1
  97. package/dist/commands/consult/index.js +59 -0
  98. package/dist/commands/consult/index.js.map +1 -1
  99. package/dist/commands/doctor.d.ts +28 -0
  100. package/dist/commands/doctor.d.ts.map +1 -1
  101. package/dist/commands/doctor.js +187 -3
  102. package/dist/commands/doctor.js.map +1 -1
  103. package/dist/commands/init.d.ts +3 -2
  104. package/dist/commands/init.d.ts.map +1 -1
  105. package/dist/commands/init.js +7 -6
  106. package/dist/commands/init.js.map +1 -1
  107. package/dist/commands/porch/index.d.ts.map +1 -1
  108. package/dist/commands/porch/index.js +11 -8
  109. package/dist/commands/porch/index.js.map +1 -1
  110. package/dist/commands/update.d.ts +4 -4
  111. package/dist/commands/update.d.ts.map +1 -1
  112. package/dist/commands/update.js +9 -11
  113. package/dist/commands/update.js.map +1 -1
  114. package/dist/lib/config.d.ts +1 -0
  115. package/dist/lib/config.d.ts.map +1 -1
  116. package/dist/lib/config.js.map +1 -1
  117. package/dist/lib/default-branch.d.ts +1 -1
  118. package/dist/lib/default-branch.js +1 -1
  119. package/dist/lib/gitignore.d.ts +25 -2
  120. package/dist/lib/gitignore.d.ts.map +1 -1
  121. package/dist/lib/gitignore.js +70 -0
  122. package/dist/lib/gitignore.js.map +1 -1
  123. package/dist/lib/migration-backup-audit.d.ts +64 -0
  124. package/dist/lib/migration-backup-audit.d.ts.map +1 -0
  125. package/dist/lib/migration-backup-audit.js +145 -0
  126. package/dist/lib/migration-backup-audit.js.map +1 -0
  127. package/dist/lib/protocol-drift-audit.d.ts +118 -0
  128. package/dist/lib/protocol-drift-audit.d.ts.map +1 -0
  129. package/dist/lib/protocol-drift-audit.js +217 -0
  130. package/dist/lib/protocol-drift-audit.js.map +1 -0
  131. package/dist/lib/scaffold.d.ts +10 -3
  132. package/dist/lib/scaffold.d.ts.map +1 -1
  133. package/dist/lib/scaffold.js +29 -26
  134. package/dist/lib/scaffold.js.map +1 -1
  135. package/dist/terminal/pty-manager.d.ts +7 -0
  136. package/dist/terminal/pty-manager.d.ts.map +1 -1
  137. package/dist/terminal/pty-manager.js +16 -0
  138. package/dist/terminal/pty-manager.js.map +1 -1
  139. package/dist/terminal/pty-session.d.ts +25 -4
  140. package/dist/terminal/pty-session.d.ts.map +1 -1
  141. package/dist/terminal/pty-session.js +83 -11
  142. package/dist/terminal/pty-session.js.map +1 -1
  143. package/dist/terminal/session-manager.d.ts +109 -0
  144. package/dist/terminal/session-manager.d.ts.map +1 -1
  145. package/dist/terminal/session-manager.js +314 -45
  146. package/dist/terminal/session-manager.js.map +1 -1
  147. package/dist/terminal/shellper-client.d.ts +19 -4
  148. package/dist/terminal/shellper-client.d.ts.map +1 -1
  149. package/dist/terminal/shellper-client.js +70 -8
  150. package/dist/terminal/shellper-client.js.map +1 -1
  151. package/dist/terminal/shellper-process.d.ts.map +1 -1
  152. package/dist/terminal/shellper-process.js +20 -5
  153. package/dist/terminal/shellper-process.js.map +1 -1
  154. package/dist/terminal/shellper-protocol.d.ts +40 -2
  155. package/dist/terminal/shellper-protocol.d.ts.map +1 -1
  156. package/dist/terminal/shellper-protocol.js +72 -5
  157. package/dist/terminal/shellper-protocol.js.map +1 -1
  158. package/package.json +8 -8
  159. package/skeleton/.claude/skills/afx/SKILL.md +13 -0
  160. package/skeleton/.claude/skills/arch-init/SKILL.md +122 -0
  161. package/skeleton/.claude/skills/codev/SKILL.md +2 -2
  162. package/skeleton/.codex/skills/afx/SKILL.md +157 -0
  163. package/skeleton/.codex/skills/arch-init/SKILL.md +122 -0
  164. package/skeleton/.codex/skills/codev/SKILL.md +59 -0
  165. package/skeleton/.codex/skills/consult/SKILL.md +96 -0
  166. package/skeleton/.codex/skills/generate-image/SKILL.md +45 -0
  167. package/skeleton/.codex/skills/porch/SKILL.md +60 -0
  168. package/skeleton/.codex/skills/update-arch-docs/SKILL.md +132 -0
  169. package/skeleton/protocols/pir/prompts/implement.md +1 -1
  170. package/skeleton/protocols/pir/prompts/review.md +1 -1
  171. package/skeleton/protocols/pir/protocol.md +3 -3
  172. package/skeleton/resources/commands/agent-farm.md +89 -0
  173. package/skeleton/resources/commands/codev.md +5 -0
  174. package/skeleton/resources/commands/consult.md +26 -0
  175. package/skeleton/roles/architect.md +11 -0
@@ -99,6 +99,19 @@ afx status # Show all builders and workspace status
99
99
 
100
100
  No flags needed. Shows Tower status, workspace, and all active builders.
101
101
 
102
+ ## afx whoami
103
+
104
+ ```bash
105
+ afx whoami # Report this terminal's identity (workspace, type, name)
106
+ afx whoami --json # Same, as a single JSON object
107
+ ```
108
+
109
+ Resolves identity from Tower/global.db's perspective: builder-worktree cwd
110
+ match first, then the Tower-injected `CODEV_ARCHITECT_NAME` env var. Exits 1
111
+ with an explanation when identity cannot be determined — it never guesses and
112
+ never defaults to `main` (issue #1094). Builders also get an `architect:`
113
+ field naming their spawning architect when recorded. Works without Tower.
114
+
102
115
  ## afx tower
103
116
 
104
117
  ```bash
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: arch-init
3
+ 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.
4
+ argument-hint: "[name] (e.g. main; omit to auto-detect via afx whoami)"
5
+ ---
6
+
7
+ # /arch-init — become architect `<name>` and recover state
8
+
9
+ You are an **architect agent** in a codev workspace. This command tells you
10
+ which architect you are and where your durable state lives, so you can resume
11
+ mid-stream.
12
+
13
+ `$ARGUMENTS` is the architect name (e.g. `main`, or a sibling architect's
14
+ name in a multi-architect workspace).
15
+
16
+ ## What to do
17
+
18
+ 1. **Resolve your name.**
19
+ - If `$ARGUMENTS` is non-empty, that is your name — the human named you
20
+ explicitly, which removes all identity-resolution risk. **Validate it
21
+ first**: an architect name must match `[a-z][a-z0-9-]*` and be at most
22
+ 64 characters (lowercase letters, digits, hyphens; starts with a
23
+ letter). Reject anything else — slashes, `..`, uppercase, spaces — and
24
+ tell the human the rule. Never build a file path from an unvalidated
25
+ name (path-traversal guard).
26
+ - If `$ARGUMENTS` is empty, run `afx whoami` and read its output:
27
+ - `type: architect` → adopt the reported `name`.
28
+ - `type: builder` → STOP. This terminal is a builder, not an architect;
29
+ report the mismatch to the human and do not adopt an architect
30
+ identity.
31
+ - Non-zero exit (identity unknown) → STOP and ask the human which
32
+ architect you are. Do NOT guess, and do NOT default to `main` —
33
+ adopting the wrong identity and writing to another architect's state
34
+ file is the exact failure this command exists to prevent.
35
+
36
+ 2. **Read your state file: `codev/state/<name>.md`** (relative to the
37
+ workspace root).
38
+ - If it does not exist: list the architect state files in `codev/state/`
39
+ — **excluding `*_thread.md` files**, which are builder thread logs that
40
+ share the directory — tell the human the file is missing, and ask
41
+ whether to start a fresh state file for `<name>`. Do not fabricate
42
+ state.
43
+ - The state file is authoritative free text. It typically opens with a
44
+ role banner and may carry resume instructions; follow whatever it says.
45
+ - Architect state files are per-person and gitignored
46
+ (`codev/state/*.md`); never commit them. Builder `*_thread.md` files
47
+ are the opposite: versioned, shipping with each builder PR.
48
+
49
+ 3. **Confirm identity + orient, then follow the state file.** In one tight
50
+ block, report: who you now are (name + one-line role from the banner, if
51
+ present), the file you read, and the current-state / open-loops summary
52
+ from the most recent dated section (or the file's leading content if it
53
+ has no dated sections). Then carry out whatever the state file says to do
54
+ on resume. Do not invent a new agenda — resume the one the state file
55
+ describes.
56
+
57
+ ## Saving your state (and knowing when to `/clear`)
58
+
59
+ Recovery is only half the loop. `/arch-init` reads state; **you** write it. The
60
+ state file is not crash insurance — it is your deliberate memory-management
61
+ mechanism. Auto-compaction happens at an arbitrary moment with content you did
62
+ not choose; a state save happens at a boundary **you** pick, with a summary
63
+ **you** curate. That is strictly better, so use it:
64
+
65
+ ```
66
+ /arch-init (recover) → work → save at a checkpoint → suggest /clear → human /clears → /arch-init → …
67
+ ```
68
+
69
+ **When to save.** Save at a *resumable boundary* — a point a fresh session
70
+ could pick up cleanly from. Good moments, judged by you: a gate approval, a PR
71
+ merge, a completed investigation, the end of a long tool-heavy stretch.
72
+ **Never save mid-task.** The state file must describe a point you can resume
73
+ *from*, not a half-finished action; a mid-task snapshot resumes into confusion.
74
+
75
+ **How to save (write format = read format).** Recovery reads *the role banner
76
+ plus the most recent dated section*, so a save must leave exactly that behind:
77
+
78
+ 1. **Rewrite the current-state / open-loops section in place** — overwrite it
79
+ with where things actually stand now (current focus + open loops + how to
80
+ resume). Do not accumulate stale "current state" blocks, and never leave two
81
+ sections with the same heading (a duplicated "How to resume" or "Open loops"
82
+ means you appended where you should have overwritten). **Delete resolved
83
+ loops entirely** — a closed item's record is the log entry, not a lingering
84
+ line in current state.
85
+ 2. **Append one short dated log entry** capturing what changed this stretch.
86
+ 3. **Compact — this is part of the save, not optional polish.** Every save
87
+ both adds AND removes: after writing, keep the recent dated log entries in
88
+ full and collapse older ones into a single one-line summary that names
89
+ where the detail lives (the closed PRs, issues, and reviews it covered).
90
+ Remember these state files are gitignored — there is no git history to
91
+ fall back on, so pruned prose is gone for good. Prune by replacing detail
92
+ with pointers to durable artifacts, never by deleting the only record of
93
+ something. The file is a summary a fresh session reads at a glance —
94
+ one screen is the right order of magnitude, judged by you. If a save has
95
+ grown it past easy readability, prune as part of that save rather than
96
+ leaving it for next time.
97
+
98
+ **Content guardrails.** No secrets (tokens, keys, credentials). No transcript
99
+ dumps or raw tool output. Include only: current focus, open loops, and the
100
+ instructions a fresh session needs to resume.
101
+
102
+ **Then — and only then — suggest `/clear`.** Save first, *then* tell the human
103
+ it is a good time to clear. You cannot clear your own context and must never
104
+ decide unilaterally to lose it; keeping the irreversible step behind a human
105
+ keystroke means accepting the suggestion can never lose anything, because the
106
+ save already happened. Make the suggestion **advisory, never nagging**, and
107
+ only right after a save — e.g.:
108
+
109
+ > State saved to `codev/state/<name>.md` — good time to `/clear` if this
110
+ > session is feeling heavy.
111
+
112
+ Do not repeat it, and do not prompt to `/clear` at any other time.
113
+
114
+ ## Guardrails (architect-wide; the state file may add more)
115
+
116
+ - **Never auto-approve porch gates.** A gate notification is for the human,
117
+ not you.
118
+ - **Touch only your own builders / spawns / filings.** Sibling architects own
119
+ theirs.
120
+ - **Never `cd` into a builder worktree**; use `git -C` + absolute paths.
121
+ - **Stay on the default branch at the workspace root**; verify with
122
+ `git branch` if unsure.
@@ -16,7 +16,7 @@ codev doctor Check system dependencies
16
16
 
17
17
  ## codev init
18
18
 
19
- Creates a **new directory** with the full codev structure: specs/, plans/, reviews/, protocols, CLAUDE.md, AGENTS.md, .claude/skills/, .codev/config.json, .gitignore.
19
+ Creates a **new directory** with the full codev structure: specs/, plans/, reviews/, protocols, CLAUDE.md, AGENTS.md, `.claude/skills/`, `.codex/skills/`, .codev/config.json, and .gitignore.
20
20
 
21
21
  ```bash
22
22
  codev init my-app # Interactive setup
@@ -34,7 +34,7 @@ codev adopt -y # Skip conflict prompts
34
34
 
35
35
  ## codev update
36
36
 
37
- Updates framework files (protocols, roles, skills) from the installed `@cluesmith/codev` package. **Never touches user data** (specs, plans, reviews). Creates `.codev-new` versions for customized files.
37
+ Updates framework files (protocols, roles, skills) from the installed `@cluesmith/codev` package. **Never touches user data** (specs, plans, reviews). Creates `.codev-new` versions for customized files. Missing Claude and Codex skills are added, while existing skill directories are preserved.
38
38
 
39
39
  ```bash
40
40
  codev update # Interactive update
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: afx
3
+ description: Agent Farm CLI — the tool for spawning builders, managing Tower, workspaces, and cron tasks. ALWAYS consult this skill BEFORE running any `afx` command to get the exact syntax. This prevents wasting time guessing flags that don't exist. Use this whenever you need to spawn a builder, check status, send messages, clean up worktrees, manage Tower, or run cron tasks. If you're about to type `afx` followed by anything, check here first.
4
+ ---
5
+
6
+ # Agent Farm CLI
7
+
8
+ ## afx spawn
9
+
10
+ Spawns a new builder in an isolated git worktree.
11
+
12
+ ```
13
+ afx spawn [number] [options]
14
+ ```
15
+
16
+ **The ONLY flags that exist:**
17
+
18
+ | Flag | Description |
19
+ |------|-------------|
20
+ | `--protocol <name>` | Protocol: spir, aspir, air, bugfix, maintain, experiment. **Required for numbered spawns.** |
21
+ | `--task <text>` | Ad-hoc task (no issue number needed) |
22
+ | `--shell` | Bare Claude session |
23
+ | `--worktree` | Bare worktree session |
24
+ | `--files <files>` | Context files, comma-separated. **Requires `--task`.** |
25
+ | `--no-comment` | Skip commenting on the GitHub issue |
26
+ | `--force` | Skip dirty-worktree and collision checks |
27
+ | `--soft` | Soft mode (AI follows protocol, you verify) |
28
+ | `--strict` | Strict mode (porch orchestrates) — this is the default |
29
+ | `--resume` | Resume builder in existing worktree |
30
+ | `--no-role` | Skip loading role prompt |
31
+
32
+ **There is NO `-t`, `--title`, `--name`, or `--branch` flag.** The branch name is auto-generated from the issue title.
33
+
34
+ **Examples:**
35
+ ```bash
36
+ afx spawn 42 --protocol spir # SPIR builder for issue #42
37
+ afx spawn 42 --protocol aspir # ASPIR (autonomous, no human gates)
38
+ afx spawn 42 --protocol air # AIR (small features)
39
+ afx spawn 42 --protocol bugfix # Bugfix
40
+ afx spawn 42 --protocol spir --soft # Soft mode
41
+ afx spawn 42 --resume # Resume existing builder
42
+ afx spawn --task "fix the flaky test" # Ad-hoc task (no issue)
43
+ afx spawn 42 --protocol spir --force # Skip dirty-worktree check
44
+ ```
45
+
46
+ **Pre-spawn checklist:**
47
+ 1. `git status` — worktree must be clean (or use `--force`)
48
+ 2. Commit specs/plans first — builders branch from HEAD and can't see uncommitted files
49
+ 3. `--protocol` is required for numbered spawns
50
+
51
+ ## afx send
52
+
53
+ Sends a message to a running builder.
54
+
55
+ ```
56
+ afx send [builder] [message]
57
+ ```
58
+
59
+ | Flag | Description |
60
+ |------|-------------|
61
+ | `--all` | Send to all builders |
62
+ | `--file <path>` | Include file content |
63
+ | `--interrupt` | Send Ctrl+C first |
64
+ | `--raw` | Skip structured formatting |
65
+ | `--no-enter` | Don't press Enter after message |
66
+
67
+ ```bash
68
+ afx send 0042 "PR approved, please merge"
69
+ afx send 0585 "check the test output" --file /tmp/test-results.txt
70
+ ```
71
+
72
+ ## afx cleanup
73
+
74
+ Removes a builder's worktree and branch after work is done.
75
+
76
+ ```
77
+ afx cleanup [options]
78
+ ```
79
+
80
+ | Flag | Description |
81
+ |------|-------------|
82
+ | `-p, --project <id>` | Builder project ID (no leading zeros: `585` not `0585`) |
83
+ | `-i, --issue <number>` | Cleanup bugfix builder by issue number |
84
+ | `-t, --task <id>` | Cleanup task builder (e.g., `task-bEPd`) |
85
+ | `-f, --force` | Force cleanup even if branch not merged |
86
+
87
+ ```bash
88
+ afx cleanup -p 585 # Clean up project 585
89
+ afx cleanup -p 585 -f # Force (unmerged branch)
90
+ ```
91
+
92
+ **Note:** `afx cleanup` uses plain numbers (`585`), not zero-padded (`0585`). But `afx send` uses zero-padded IDs (`0585`).
93
+
94
+ ## afx status
95
+
96
+ ```bash
97
+ afx status # Show all builders and workspace status
98
+ ```
99
+
100
+ No flags needed. Shows Tower status, workspace, and all active builders.
101
+
102
+ ## afx whoami
103
+
104
+ ```bash
105
+ afx whoami # Report this terminal's identity (workspace, type, name)
106
+ afx whoami --json # Same, as a single JSON object
107
+ ```
108
+
109
+ Resolves identity from Tower/global.db's perspective: builder-worktree cwd
110
+ match first, then the Tower-injected `CODEV_ARCHITECT_NAME` env var. Exits 1
111
+ with an explanation when identity cannot be determined — it never guesses and
112
+ never defaults to `main` (issue #1094). Builders also get an `architect:`
113
+ field naming their spawning architect when recorded. Works without Tower.
114
+
115
+ ## afx tower
116
+
117
+ ```bash
118
+ afx tower start # Start Tower on port 4100
119
+ afx tower stop # Stop Tower
120
+ afx tower log # Tail Tower logs
121
+ afx tower status # Check daemon and cloud connection status
122
+ afx tower connect # Connect to Codev Cloud
123
+ afx tower disconnect # Disconnect from Codev Cloud
124
+ ```
125
+
126
+ There is NO `afx tower restart` — use `afx tower stop && afx tower start`.
127
+
128
+ ## afx workspace
129
+
130
+ ```bash
131
+ afx workspace start # Start workspace for current project
132
+ afx workspace stop # Stop workspace processes
133
+ ```
134
+
135
+ `afx dash` is a deprecated alias — use `afx workspace` instead.
136
+
137
+ ## afx cron
138
+
139
+ ```bash
140
+ afx cron list # List all cron tasks
141
+ afx cron status <name> # Check task status
142
+ afx cron run <name> # Run immediately
143
+ afx cron enable <name> # Enable
144
+ afx cron disable <name> # Disable
145
+ ```
146
+
147
+ There is NO `afx cron add` — create YAML files in `.af-cron/` directly.
148
+
149
+ ## Other commands
150
+
151
+ ```bash
152
+ afx open <file> # Open file in annotation viewer (NOT system open)
153
+ afx shell # Spawn utility shell
154
+ afx attach # Attach to running builder terminal
155
+ afx rename <name> # Rename current shell session
156
+ afx architect # Start architect session in current terminal
157
+ ```
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: arch-init
3
+ 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.
4
+ argument-hint: "[name] (e.g. main; omit to auto-detect via afx whoami)"
5
+ ---
6
+
7
+ # /arch-init — become architect `<name>` and recover state
8
+
9
+ You are an **architect agent** in a codev workspace. This command tells you
10
+ which architect you are and where your durable state lives, so you can resume
11
+ mid-stream.
12
+
13
+ `$ARGUMENTS` is the architect name (e.g. `main`, or a sibling architect's
14
+ name in a multi-architect workspace).
15
+
16
+ ## What to do
17
+
18
+ 1. **Resolve your name.**
19
+ - If `$ARGUMENTS` is non-empty, that is your name — the human named you
20
+ explicitly, which removes all identity-resolution risk. **Validate it
21
+ first**: an architect name must match `[a-z][a-z0-9-]*` and be at most
22
+ 64 characters (lowercase letters, digits, hyphens; starts with a
23
+ letter). Reject anything else — slashes, `..`, uppercase, spaces — and
24
+ tell the human the rule. Never build a file path from an unvalidated
25
+ name (path-traversal guard).
26
+ - If `$ARGUMENTS` is empty, run `afx whoami` and read its output:
27
+ - `type: architect` → adopt the reported `name`.
28
+ - `type: builder` → STOP. This terminal is a builder, not an architect;
29
+ report the mismatch to the human and do not adopt an architect
30
+ identity.
31
+ - Non-zero exit (identity unknown) → STOP and ask the human which
32
+ architect you are. Do NOT guess, and do NOT default to `main` —
33
+ adopting the wrong identity and writing to another architect's state
34
+ file is the exact failure this command exists to prevent.
35
+
36
+ 2. **Read your state file: `codev/state/<name>.md`** (relative to the
37
+ workspace root).
38
+ - If it does not exist: list the architect state files in `codev/state/`
39
+ — **excluding `*_thread.md` files**, which are builder thread logs that
40
+ share the directory — tell the human the file is missing, and ask
41
+ whether to start a fresh state file for `<name>`. Do not fabricate
42
+ state.
43
+ - The state file is authoritative free text. It typically opens with a
44
+ role banner and may carry resume instructions; follow whatever it says.
45
+ - Architect state files are per-person and gitignored
46
+ (`codev/state/*.md`); never commit them. Builder `*_thread.md` files
47
+ are the opposite: versioned, shipping with each builder PR.
48
+
49
+ 3. **Confirm identity + orient, then follow the state file.** In one tight
50
+ block, report: who you now are (name + one-line role from the banner, if
51
+ present), the file you read, and the current-state / open-loops summary
52
+ from the most recent dated section (or the file's leading content if it
53
+ has no dated sections). Then carry out whatever the state file says to do
54
+ on resume. Do not invent a new agenda — resume the one the state file
55
+ describes.
56
+
57
+ ## Saving your state (and knowing when to `/clear`)
58
+
59
+ Recovery is only half the loop. `/arch-init` reads state; **you** write it. The
60
+ state file is not crash insurance — it is your deliberate memory-management
61
+ mechanism. Auto-compaction happens at an arbitrary moment with content you did
62
+ not choose; a state save happens at a boundary **you** pick, with a summary
63
+ **you** curate. That is strictly better, so use it:
64
+
65
+ ```
66
+ /arch-init (recover) → work → save at a checkpoint → suggest /clear → human /clears → /arch-init → …
67
+ ```
68
+
69
+ **When to save.** Save at a *resumable boundary* — a point a fresh session
70
+ could pick up cleanly from. Good moments, judged by you: a gate approval, a PR
71
+ merge, a completed investigation, the end of a long tool-heavy stretch.
72
+ **Never save mid-task.** The state file must describe a point you can resume
73
+ *from*, not a half-finished action; a mid-task snapshot resumes into confusion.
74
+
75
+ **How to save (write format = read format).** Recovery reads *the role banner
76
+ plus the most recent dated section*, so a save must leave exactly that behind:
77
+
78
+ 1. **Rewrite the current-state / open-loops section in place** — overwrite it
79
+ with where things actually stand now (current focus + open loops + how to
80
+ resume). Do not accumulate stale "current state" blocks, and never leave two
81
+ sections with the same heading (a duplicated "How to resume" or "Open loops"
82
+ means you appended where you should have overwritten). **Delete resolved
83
+ loops entirely** — a closed item's record is the log entry, not a lingering
84
+ line in current state.
85
+ 2. **Append one short dated log entry** capturing what changed this stretch.
86
+ 3. **Compact — this is part of the save, not optional polish.** Every save
87
+ both adds AND removes: after writing, keep the recent dated log entries in
88
+ full and collapse older ones into a single one-line summary that names
89
+ where the detail lives (the closed PRs, issues, and reviews it covered).
90
+ Remember these state files are gitignored — there is no git history to
91
+ fall back on, so pruned prose is gone for good. Prune by replacing detail
92
+ with pointers to durable artifacts, never by deleting the only record of
93
+ something. The file is a summary a fresh session reads at a glance —
94
+ one screen is the right order of magnitude, judged by you. If a save has
95
+ grown it past easy readability, prune as part of that save rather than
96
+ leaving it for next time.
97
+
98
+ **Content guardrails.** No secrets (tokens, keys, credentials). No transcript
99
+ dumps or raw tool output. Include only: current focus, open loops, and the
100
+ instructions a fresh session needs to resume.
101
+
102
+ **Then — and only then — suggest `/clear`.** Save first, *then* tell the human
103
+ it is a good time to clear. You cannot clear your own context and must never
104
+ decide unilaterally to lose it; keeping the irreversible step behind a human
105
+ keystroke means accepting the suggestion can never lose anything, because the
106
+ save already happened. Make the suggestion **advisory, never nagging**, and
107
+ only right after a save — e.g.:
108
+
109
+ > State saved to `codev/state/<name>.md` — good time to `/clear` if this
110
+ > session is feeling heavy.
111
+
112
+ Do not repeat it, and do not prompt to `/clear` at any other time.
113
+
114
+ ## Guardrails (architect-wide; the state file may add more)
115
+
116
+ - **Never auto-approve porch gates.** A gate notification is for the human,
117
+ not you.
118
+ - **Touch only your own builders / spawns / filings.** Sibling architects own
119
+ theirs.
120
+ - **Never `cd` into a builder worktree**; use `git -C` + absolute paths.
121
+ - **Stay on the default branch at the workspace root**; verify with
122
+ `git branch` if unsure.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: codev
3
+ description: Codev project management CLI — init, adopt, update, and doctor commands. Check this skill before running any `codev` command (except `consult`, `porch`, or `afx` which have their own skills). Use when setting up new projects, adding codev to existing repos, updating framework files, or diagnosing missing dependencies.
4
+ ---
5
+
6
+ # codev - Project Management CLI
7
+
8
+ ## Commands
9
+
10
+ ```
11
+ codev init [project-name] Create a new codev project directory
12
+ codev adopt Add codev to the current directory
13
+ codev update Update protocols, roles, skills from package
14
+ codev doctor Check system dependencies
15
+ ```
16
+
17
+ ## codev init
18
+
19
+ Creates a **new directory** with the full codev structure: specs/, plans/, reviews/, protocols, CLAUDE.md, AGENTS.md, `.claude/skills/`, `.codex/skills/`, .codev/config.json, and .gitignore.
20
+
21
+ ```bash
22
+ codev init my-app # Interactive setup
23
+ codev init my-app -y # Non-interactive with defaults
24
+ ```
25
+
26
+ ## codev adopt
27
+
28
+ Adds codev to the **current directory** (existing project). Run from the project root. If CLAUDE.md or AGENTS.md already exists, creates `.codev-new` versions and spawns Claude to merge.
29
+
30
+ ```bash
31
+ codev adopt # Interactive
32
+ codev adopt -y # Skip conflict prompts
33
+ ```
34
+
35
+ ## codev update
36
+
37
+ Updates framework files (protocols, roles, skills) from the installed `@cluesmith/codev` package. **Never touches user data** (specs, plans, reviews). Creates `.codev-new` versions for customized files. Missing Claude and Codex skills are added, while existing skill directories are preserved.
38
+
39
+ ```bash
40
+ codev update # Interactive update
41
+ codev update --dry-run # Preview changes
42
+ codev update --force # Overwrite all framework files
43
+ codev update --agent # Agent mode: JSON stdout, no interactive merge
44
+ ```
45
+
46
+ ## codev doctor
47
+
48
+ Checks all required dependencies: Node.js (>=18), git (>=2.5), gh (authenticated), and at least one AI CLI (Claude, Gemini, or Codex).
49
+
50
+ ```bash
51
+ codev doctor
52
+ ```
53
+
54
+ ## Common mistakes
55
+
56
+ - There is NO `codev tower` command — use `afx tower start/stop`
57
+ - `codev init` creates a new directory — use `codev adopt` for existing projects
58
+ - Always run `codev adopt` and `codev update` from the project root
59
+ - `codev update` only updates framework files — it never touches specs/plans/reviews
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: consult
3
+ description: AI consultation CLI — query Gemini, Codex, or Claude for reviews and analysis. ALWAYS check this skill before running any `consult` command. Use when reviewing specs, plans, implementations, or PRs with external models, running parallel 3-way reviews (cmap), or checking consultation stats. The `-m` model flag is always required except for `consult stats`.
4
+ ---
5
+
6
+ # consult - AI Consultation CLI
7
+
8
+ Query external AI models for reviews and analysis. Supports Gemini, Codex, and Claude.
9
+
10
+ ## Synopsis
11
+
12
+ ```
13
+ consult -m <model> [options]
14
+ consult stats [options]
15
+ ```
16
+
17
+ The `-m` / `--model` flag is **always required** except for `consult stats`.
18
+
19
+ ## Models
20
+
21
+ | Flag value | Alias | Notes |
22
+ |------------|-------|-------|
23
+ | `gemini` | `pro` | Antigravity CLI (`agy`); agentic file access (`--sandbox`), OAuth login; skips non-blockingly if unavailable |
24
+ | `codex` | `gpt` | Thorough (~200-250s), shell exploration |
25
+ | `claude` | `opus` | Agent SDK with tool use (~60-120s) |
26
+
27
+ ## All flags
28
+
29
+ ```
30
+ -m, --model <model> Model to use (required except stats)
31
+ --prompt <text> Inline prompt (general mode)
32
+ --prompt-file <path> Prompt file path (general mode)
33
+ --protocol <name> Protocol: spir, aspir, air, bugfix, maintain
34
+ -t, --type <type> Review type (see below)
35
+ --issue <number> Issue number (required in architect context)
36
+ --output <path> Save result to file
37
+ --plan-phase <phase> Scope review to a plan phase (porch use)
38
+ --context <path> Context file with feedback (porch use)
39
+ --project-id <id> Project ID for metrics (porch use)
40
+ --days <n> Stats: limit to last N days (default: 30)
41
+ --project <id> Stats: filter by project ID
42
+ --last <n> Stats: show last N invocations
43
+ --json Stats: output as JSON
44
+ ```
45
+
46
+ ## Review types (`--type`)
47
+
48
+ | Type | When to use |
49
+ |------|-------------|
50
+ | `spec` | Review a specification for completeness |
51
+ | `plan` | Review an implementation plan |
52
+ | `impl` | Review code implementation |
53
+ | `pr` | Review a pull request before merge |
54
+ | `phase` | Phase-scoped review (builder context only) |
55
+ | `integration` | Architect's integration review of a PR |
56
+
57
+ ## Usage patterns
58
+
59
+ **General query:**
60
+ ```bash
61
+ consult -m gemini --prompt "What's the best way to structure auth?"
62
+ consult -m codex --prompt-file review-checklist.md
63
+ ```
64
+
65
+ **Protocol review:**
66
+ ```bash
67
+ consult -m gemini --type spec --issue 42
68
+ consult -m codex --type plan --issue 42
69
+ consult -m claude --type integration --issue 42
70
+ ```
71
+
72
+ **3-way parallel review (cmap):**
73
+ Always use `--output` for background runs — without it, results go to a temp file that may be garbage-collected.
74
+
75
+ ```bash
76
+ consult -m gemini --type integration --issue 42 --output /tmp/cmap-gemini-42.md &
77
+ consult -m codex --type integration --issue 42 --output /tmp/cmap-codex-42.md &
78
+ consult -m claude --type integration --issue 42 --output /tmp/cmap-claude-42.md &
79
+ wait
80
+ ```
81
+
82
+ **Stats:**
83
+ ```bash
84
+ consult stats # 30-day summary
85
+ consult stats --days 7 --json # Last 7 days as JSON
86
+ consult stats --project 42 # Filter by project
87
+ ```
88
+
89
+ ## Rules
90
+
91
+ - `-m` is required for all non-stats commands
92
+ - `--prompt` and `--type` are mutually exclusive (different modes)
93
+ - `--prompt` and `--prompt-file` are mutually exclusive
94
+ - `--protocol` requires `--type`
95
+ - From architect context (outside `.builders/`), `--issue` is required for protocol reviews
96
+ - From builder context (inside `.builders/`), project auto-detects from porch state
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: generate-image
3
+ description: AI image generation via Gemini. Use when the user wants to generate, create, or make an image, or when you need to create visual assets like logos, diagrams, or illustrations. Requires GEMINI_API_KEY or GOOGLE_API_KEY.
4
+ ---
5
+
6
+ # generate-image - AI Image Generation
7
+
8
+ Uses Google Gemini to generate images from text prompts.
9
+
10
+ ## Synopsis
11
+
12
+ ```
13
+ codev generate-image "<prompt>" [options]
14
+ ```
15
+
16
+ Note: this is a `codev` subcommand, not standalone.
17
+
18
+ ## All flags
19
+
20
+ ```
21
+ -o, --output <file> Output file path (default: output.png)
22
+ -r, --resolution <res> Resolution: 1K, 2K, 4K (default: 1K)
23
+ -a, --aspect <ratio> Aspect ratio (default: 1:1)
24
+ --ref <image> Reference image (repeatable, max 14)
25
+ ```
26
+
27
+ ## Aspect ratios
28
+
29
+ `1:1` | `16:9` | `9:16` | `3:4` | `4:3` | `3:2` | `2:3`
30
+
31
+ ## Examples
32
+
33
+ ```bash
34
+ codev generate-image "A sunset over mountains"
35
+ codev generate-image "A futuristic city" -r 4K -a 16:9 -o city.png
36
+ codev generate-image "Same style but with cats" --ref style.png --ref layout.png
37
+ codev generate-image prompt.txt -o result.png # Prompt from .txt file
38
+ ```
39
+
40
+ ## Notes
41
+
42
+ - Prompt must be quoted if it contains spaces
43
+ - Prompt can be a `.txt` file path (auto-detected by extension)
44
+ - Reference images must exist on disk
45
+ - Requires `GEMINI_API_KEY` or `GOOGLE_API_KEY` environment variable