arch-init
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.
适合你,如果需要在重启或会话切换后快速恢复架构师身份
npx oh-my-skill add cluesmith/codev/arch-initcurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- cluesmith/codev/arch-initnpx oh-my-skill verify cluesmith/codev/arch-init怎么用
商店整理自技能原文 · 版本 12d42bb · 表述以原文为准装上后,Claude会变成一位建筑师(architect),从指定状态文件(codev/state/名称.md)读取当前位置和未完成任务,并继续执行状态文件中的恢复指令。它会汇报身份和状态摘要,然后按计划推进。
在重启、上下文丢失或会话交接后,或当你说出“/arch-init”、“你是XX建筑师”、“recover your architect state”等关键词时触发。
技能原文 SKILL.md
/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
- Resolve your name.
- If
$ARGUMENTSis 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
$ARGUMENTSis empty, runafx whoamiand read its output: type: architect→ adopt the reportedname.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.
- 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.mdfiles, 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.
- Architect state files are per-person and gitignored (
codev/state/*.md); never commit them. Builder*_thread.mdfiles are the opposite: versioned, shipping with each builder PR.
- 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.
Saving your state (and knowing when to /clear)
Recovery is only half the loop. /arch-init reads state; you write it. The state file is not crash insurance — it is your deliberate memory-management mechanism. Auto-compaction happens at an arbitrary moment with content you did not choose; a state save happens at a boundary you pick, with a summary you curate. That is strictly better, so use it:
/arch-init (recover) → work → save at a checkpoint → suggest /clear → human /clears → /arch-init → …
When to save. Save at a resumable boundary — a point a fresh session could pick up cleanly from. Good moments, judged by you: a gate approval, a PR merge, a completed investigation, the end of a long tool-heavy stretch. Never save mid-task. The state file must describe a point you can resume from, not a half-finished action; a mid-task snapshot resumes into confusion.
How to save (write format = read format). Recovery reads the role banner plus the most recent dated section, so a save must leave exactly that behind:
- Rewrite the current-state / open-loops section in place — overwrite it with where things actually stand now (current focus + open loops + how to resume). Do not accumulate stale "current state" blocks.
- Append one short dated log entry capturing what changed this stretch.
- Keep it to one screen (compaction discipline). The state file is a summary, not a transcript. When you append, prune stale dated sections so the file stays readable at a glance.
Content guardrails. No secrets (tokens, keys, credentials). No transcript dumps or raw tool output. Include only: current focus, open loops, and the instructions a fresh session needs to resume.
Then — and only then — suggest /clear. Save first, then tell the human it is a good time to clear. You cannot clear your own context and must never decide unilaterally to lose it; keeping the irreversible step behind a human keystroke means accepting the suggestion can never lose anything, because the save already happened. Make the suggestion advisory, never nagging, and only right after a save — e.g.:
State saved tocodev/state/<name>.md— good time to/clearif this session is feeling heavy.
Do not repeat it, and do not prompt to /clear at any other time.
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
cdinto a builder worktree; usegit -C+ absolute paths. - Stay on the default branch at the workspace root; verify with
git branchif unsure.