[Air #1709] feat: /arch-save takes a next task, /arch-init starts on it - #1710
Open
waleedkadous wants to merge 6 commits into
Open
waleedkadous wants to merge 6 commits into
waleedkadous wants to merge 6 commits into
Conversation
An owner who already knows what the refreshed session should do first had nowhere to put that instruction: /arch-save saved, cleared and re-inited, and the architect came back oriented but idle, waiting to be told again. /arch-save now takes the next task as free text. Argument resolution runs `afx whoami` first (unconditionally now — the split compares the first token against the resolved name), then: empty $ARGUMENTS means no next task; a first token matching the whoami name is the name, with the remainder as the task; any other leading token makes the whole of $ARGUMENTS the task. /arch-save and /arch-save <name> are unchanged. The task is written verbatim into the state file's banner as a NEXT TASK line, directly after the intentional-clear line. New text replaces an existing line; no text preserves one, since a surviving line means the previous cycle never resumed to pick it up. /arch-init reports it in the orient block and starts on it as the first action of the resumed session, then deletes the line and logs the pickup so a second re-init cannot re-run it. The standard limits are unchanged: a next task naming a gate, merge, release or Tower restart produces a prepared request for the word, not the act — a saved instruction is an instruction, not a pre-spent approval. All four copies of each skill stay byte-identical; the new test guards that for arch-init too, which spec-1134 does not (it compares only .claude). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Author
|
Thank you — this is a clean, careful implementation of #1709, and the thread's two recorded decisions (whoami runs unconditionally; the line lives in the banner, not the log) are exactly the right calls. Architect check against the issue's prescribed design, item by item:
No changes requested from my side. Waiting on the CMAP verdicts and CI, then I'll take it to the owner for the merge word. |
All three reviewers approved; claude raised four points, three of which are cheap and additive. - The next task survives the "which architect are you?" stop. whoami down plus multi-token arguments falls through both split rules to STOP, which was the right outcome but left it unsaid that the task text is still in hand — an implementer could reasonably make the owner retype it. - /arch-save and /arch-init now resolve a name by different rules, and /arch-save says so. /arch-init takes no next task, so any argument there is unambiguously a name and overrides whoami outright; here the first token is weighed against whoami instead. Notes that a whoami reporting the wrong architect cannot be overridden by argument alone, and to stop rather than save into an unverified name. - Test nit: one regex pinned a hard line wrap and would have failed on a pure reflow with no semantic change. - Recorded that spec-1307 already covers four-copy parity for arch-save; the duplicate stays so both skills of one feature fail together. Claude's remaining finding — that the explicit-name override is narrower than before — is the issue's prescribed rules 3 and 4, so it goes to the architect rather than into this commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tect Architect's ruling on the CMAP finding that the explicit-name override had narrowed: add the guard rather than leave the rules as prescribed. In arch-save step 1, after the split — if the first token validates as a name, differs from the name whoami reported, and codev/state/<token>.md exists, STOP and ask which architect you are, writing nothing. whoami can be wrong (#1094), and without this rule 3 buries a real name-override inside next-task text and saves to whoami's file. The existence check keeps it narrow: a task that merely opens with a word shaped like a name passes through untouched unless a state file for that name actually exists, so the only cost is one clarification when the first word is a live sibling's name. Rewriting the paragraph's closing sentence invalidated an assertion from the previous commit; re-pinned to the new wording, which now points at the guard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/arch-savenow accepts a free-text next task, persists it in the state file's banner, and/arch-initstarts on it as the first action of the resumed session — so an owner who already knows what the refreshed architect should do first says it once, at the moment they direct the refresh, instead of watching for the re-init to land and typing it again.Closes #1709
What Changed
Docs-only feature — both halves are skill documents, so the shipped
SKILL.mdtext is the implementation.arch-save/SKILL.mdargument-hintadvertises the next task; the intro shows all three invocation forms.afx whoamifirst, then the three-rule split (empty → no task; first token == whoami name → name + remainder; otherwise → whole string is the task).# ⏭ NEXT TASK (owner-directed at save, <ISO>): <text>directly after the⭐ THIS /clear IS INTENTIONALline, verbatim; new text replaces an existing line, no text preserves one.arch-init/SKILL.mdNext task from the owner at save time: <text>), 4 (start on it, delete the line, log the pickup), 5 (then follow the state file).All four copies of each skill (
.claude/.codex× instance / skeleton) are byte-identical.Key Decisions
afx whoaminow runs unconditionally, where it previously ran only when$ARGUMENTSwas empty. Rule 2 of the split compares the first token against the whoami name, so the name must be known before the arguments can be parsed. Consequence: the non-zero-exit branch could no longer be an unconditional STOP, or/arch-save mainwould break whenever whoami was down. Written as: no name yet → a single validating token is still accepted as one, anything else stops and asks. That preserves both the back-compat path and the never-default-to-mainguard (afx send: detectCurrentBuilderId silently falls back to bare worktree name on state.db read failure → builder messages misroute to main #1094).The line lives in the banner, not in a dated log entry.
/arch-initreads the banner plus the most recent dated section; the banner is the half unambiguously read first, and it already holds the⭐ THIS /clear IS INTENTIONALresume instructions.A next task is an instruction, not a pre-spent approval. It carries the owner's authority the way any owner message does, with the standard limits unchanged — it never by itself approves a porch gate, merges, releases, or restarts Tower. If the next task is such an act,
/arch-initprepares it and asks for the word live.Verbatim, with the reason attached. The context writing the line down is the one about to be destroyed, so a paraphrase is unrecoverable — that "why" travels with the rule in the doc.
No text preserves an existing line rather than clearing it: a surviving
NEXT TASKmeans the previous cycle never came back to pick it up, so dropping it silently would lose an owner instruction nothing else is holding.Scope note: the issue named
codev/roles/architect.mdas a candidate for consistency edits. Grepping both trees found it does not mention/arch-saveat all, so it needed no change. The other hits (builder-refreshfrontmatter,agent-farm.md:514,tower-client.ts:797,reset/{constants,self}.ts) are all about the delayed send and clear/re-entry ordering, not the argument contract — left alone. The1307-*spec/plan/review are historical artifacts, not living docs.Test Plan
packages/codev/src/agent-farm/__tests__/air-1709-next-task.test.ts(18 assertions)pnpm --filter @cluesmith/codev buildbuild+testschecks greenThe new test pins every acceptance criterion in the issue: the three invocation forms, the three split rules, back-compat, the verbatim rule, replace-vs-preserve, the template line, the orient label, orient→next-task→state-file ordering, the not-a-pre-spent-approval limits, and delete-plus-log-the-pickup.
CMAP Review
gemini=APPROVE, codex=APPROVE, claude=APPROVE — all HIGH confidence.
Gemini and codex found nothing. Claude approved with four observations; each was verified against the files before acting. Three are applied in the follow-up commit:
$ARGUMENTSalready supplied the task/arch-initfrontmatter still says "an explicit name argument overrides"; the pair now resolves identity by different rules, unacknowledged in/arch-save/arch-savenow states the asymmetry and why (/arch-inittakes no next task, so any argument there is unambiguously a name)/\*\*first\n\s+action…/) and would fail on a pure reflow\s+arch-saveduplicatesspec-1307-arch-save-skill.test.ts:41The fourth finding went to the architect, who ruled: add the guard. The explicit-name override had narrowed — previously any non-empty
$ARGUMENTSwas the name, now only a first token equal to whoami's (or a lone validating token when whoami fails). The uncovered case was whoami answering with the wrong architect:/arch-save towerfrom a session whoami callsmainwould write tomain's state file with no argument-level override. That is the #1094 failure class.arch-savestep 1 now carries, after the split: first token validates as a name, differs from whoami's, andcodev/state/<token>.mdexists → STOP and ask which architect you are, write nothing.The existence check is what keeps it narrow.
merge 1660andreview Amr's PRpass straight through; only a first word that is a live sibling's name stops, and it costs one clarification.(Aside: the agy/gemini lane returned a clean VERDICT block on a
--type prreview here — the known "agy consult broken for--type" issue did not reproduce.)Review Notes
Two things worth a look:
arch-initon purpose.spec-1134-arch-init-skill.test.tscompares onlyinstance/.claudeagainstskeleton/.claude, so a stale.codexcopy would pass it silently. The new test checks all four copies of both skills.afx whoami) is the one behavioral change to existing resolution. Worth confirming the wording keeps the afx send: detectCurrentBuilderId silently falls back to bare worktree name on state.db read failure → builder messages misroute to main #1094 guard intact: the skill still refuses to guess or default tomain, and only accepts a name from$ARGUMENTSwhen it is a single token that validates.packages/codev/skeleton/is build-generated fromcodev-skeleton/and gitignored — not touched.🤖 Generated with Claude Code