From 89bb93520065a6938e3bb46d41667d80789bb180 Mon Sep 17 00:00:00 2001 From: GiovaneLaurencio <210858529+GiovaneLaurencio@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:50:14 -0300 Subject: [PATCH 1/2] fix: standardize greenfield guard across claude-code-mastery squad agents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The squad's 8 agents carried the same GREENFIELD GUARD as the core agents, with the same two defects plus a consistency problem of their own. Agent Authority (Constitution Article II): 4 of the 8 recommended `*environment-bootstrap`, a @devops-exclusive command none of them owns (hooks-architect, mcp-integrator, skill-craftsman, swarm-orchestrator). They now delegate: `@devops *environment-bootstrap`. The 3 agents that recommend a command they actually own keep it unchanged — `*configure` (config-engineer), `*integrate-project` (project-integrator), `*check-updates` (roadmap-sentinel); each was verified to exist in its own `commands` block. False positive in non-project directories: the guard fired wherever there was no git repo, including a user home directory, and labelled it a "Greenfield project". It now decides from the working directory path already present in the system prompt (zero extra I/O): a home or non-project directory gets a tip to activate from inside the project instead of a command recommendation. claude-mastery-chief, which never recommended anything, gets the tip branch only. Typographic consistency: the three guard lines existed in 4 different variants across the 8 files (`--` vs `—`, with and without bold, with and without emoji). All 8 now carry byte-identical lines, matching the core agents. Note: `npm run validate:agents` covers only the 12 core agents, not squads. A manual YAML parse of all 8 found swarm-orchestrator.md invalid at its `lexicon:` block — pre-existing (fails identically at HEAD, before this change) and left untouched here. Co-Authored-By: Claude Opus 5 (1M context) --- squads/claude-code-mastery/agents/claude-mastery-chief.md | 5 +++-- squads/claude-code-mastery/agents/config-engineer.md | 8 +++++--- squads/claude-code-mastery/agents/hooks-architect.md | 8 +++++--- squads/claude-code-mastery/agents/mcp-integrator.md | 8 +++++--- squads/claude-code-mastery/agents/project-integrator.md | 8 +++++--- squads/claude-code-mastery/agents/roadmap-sentinel.md | 8 +++++--- squads/claude-code-mastery/agents/skill-craftsman.md | 8 +++++--- squads/claude-code-mastery/agents/swarm-orchestrator.md | 6 ++++-- 8 files changed, 37 insertions(+), 22 deletions(-) diff --git a/squads/claude-code-mastery/agents/claude-mastery-chief.md b/squads/claude-code-mastery/agents/claude-mastery-chief.md index 66bfa8fbd7..64b35e7189 100644 --- a/squads/claude-code-mastery/agents/claude-mastery-chief.md +++ b/squads/claude-code-mastery/agents/claude-mastery-chief.md @@ -20,8 +20,9 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "Project Status: Greenfield project — no git repository detected" instead of git narrative - - Do NOT run any git commands during activation + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, if the working directory is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory — decided from the path already in the system prompt, zero I/O: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch}`" if not main/master diff --git a/squads/claude-code-mastery/agents/config-engineer.md b/squads/claude-code-mastery/agents/config-engineer.md index 86e52b9e5d..a36839ed0a 100644 --- a/squads/claude-code-mastery/agents/config-engineer.md +++ b/squads/claude-code-mastery/agents/config-engineer.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "**Project Status:** Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "**Recommended:** Run `*configure` to bootstrap Claude Code settings for this project" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `*configure` to bootstrap Claude Code settings for this project" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/hooks-architect.md b/squads/claude-code-mastery/agents/hooks-architect.md index b715e5bf03..932df5b98c 100644 --- a/squads/claude-code-mastery/agents/hooks-architect.md +++ b/squads/claude-code-mastery/agents/hooks-architect.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "**Project Status:** Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "**Recommended:** Run `*environment-bootstrap` to initialize git, GitHub remote, and CI/CD" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `@devops *environment-bootstrap` to initialize git, GitHub remote, and CI/CD" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/mcp-integrator.md b/squads/claude-code-mastery/agents/mcp-integrator.md index 7ce483d90e..8416f4f5f4 100644 --- a/squads/claude-code-mastery/agents/mcp-integrator.md +++ b/squads/claude-code-mastery/agents/mcp-integrator.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "Project Status: Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "Recommended: Run `*environment-bootstrap` to initialize git, GitHub remote, and CI/CD" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `@devops *environment-bootstrap` to initialize git, GitHub remote, and CI/CD" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/project-integrator.md b/squads/claude-code-mastery/agents/project-integrator.md index 9e320321cc..55c1826bc7 100644 --- a/squads/claude-code-mastery/agents/project-integrator.md +++ b/squads/claude-code-mastery/agents/project-integrator.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "Project Status: Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "Recommended: Run `*integrate-project` to scaffold the full AI-assisted development infrastructure" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `*integrate-project` to scaffold the full AI-assisted development infrastructure" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/roadmap-sentinel.md b/squads/claude-code-mastery/agents/roadmap-sentinel.md index 28296e3907..c4c310d952 100644 --- a/squads/claude-code-mastery/agents/roadmap-sentinel.md +++ b/squads/claude-code-mastery/agents/roadmap-sentinel.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "**Project Status:** Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "**Recommended:** Run `*check-updates` to assess your Claude Code version and feature readiness" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `*check-updates` to assess your Claude Code version and feature readiness" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/skill-craftsman.md b/squads/claude-code-mastery/agents/skill-craftsman.md index d20636686b..043e7ddc80 100644 --- a/squads/claude-code-mastery/agents/skill-craftsman.md +++ b/squads/claude-code-mastery/agents/skill-craftsman.md @@ -21,9 +21,11 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "Project Status: Greenfield project -- no git repository detected" instead of git narrative - - After substep 6: show "Recommended: Run `*environment-bootstrap` to initialize git, GitHub remote, and CI/CD" - - Do NOT run any git commands during activation -- they will fail and produce errors + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `@devops *environment-bootstrap` to initialize git, GitHub remote, and CI/CD" + - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [Ask], [Auto], [Explore]) 2. Show: "**Role:** {persona.role}" - Append: "Story: {active story from docs/stories/}" if detected + "Branch: `{branch from gitStatus}`" if not main/master diff --git a/squads/claude-code-mastery/agents/swarm-orchestrator.md b/squads/claude-code-mastery/agents/swarm-orchestrator.md index 59bffd1da8..89f913dcd8 100644 --- a/squads/claude-code-mastery/agents/swarm-orchestrator.md +++ b/squads/claude-code-mastery/agents/swarm-orchestrator.md @@ -21,8 +21,10 @@ activation-instructions: Display greeting using native context (zero JS execution): 0. GREENFIELD GUARD: If gitStatus in system prompt says "Is a git repository: false" OR git commands return "not a git repository": - For substep 2: skip the "Branch:" append - - For substep 3: show "📊 **Project Status:** Greenfield project — no git repository detected" instead of git narrative - - After substep 6: show "💡 **Recommended:** Run `*environment-bootstrap` to initialize git, GitHub remote, and CI/CD" + - For substep 3: show "📊 **Project Status:** No git repository detected in the working directory" instead of git narrative + - After substep 6, decide from the working directory path already in the system prompt (zero I/O): + - If it is a user home directory (e.g. `C:\Users\{name}`, `/home/{name}`, `/Users/{name}`) or any other non-project directory: show "💡 **Tip:** Activate agents from inside the project directory — never run `git init` in a home directory." and do NOT recommend a project command + - Otherwise (an actual project directory): show "💡 **Recommended:** Run `@devops *environment-bootstrap` to initialize git, GitHub remote, and CI/CD" - Do NOT run any git commands during activation — they will fail and produce errors 1. Show: "{icon} {persona_profile.communication.greeting_levels.archetypal}" + permission badge from current permission mode (e.g., [⚠️ Ask], [🟢 Auto], [🔍 Explore]) 2. Show: "**Role:** {persona.role}" From b349e97a1a58225660395c6bff26e373816585fa Mon Sep 17 00:00:00 2001 From: GiovaneLaurencio <210858529+GiovaneLaurencio@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:56:13 -0300 Subject: [PATCH 2/2] fix: repair invalid YAML sequence entries in swarm-orchestrator lexicon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 8 entries under `voice_dna.lexicon` had the shape: - "topology" (preferred over "structure" for agent arrangements) YAML closes the scalar at the second quote, leaving ` (preferred ...)` as a stray token — js-yaml rejected the whole embedded block with "bad indentation of a sequence entry", so the agent definition was unparseable by any tooling. Each entry is now wrapped in single quotes, which keeps the inner double quotes verbatim and keeps the parenthetical part of the value rather than turning it into a comment: - '"topology" (preferred over "structure" for agent arrangements)' Verified: all 8 squad agents now parse, and lexicon still yields 8 entries with their text unchanged. Entries elsewhere in the squad of the form `- "text" # comment` were left alone — the `#` makes those valid already. Co-Authored-By: Claude Opus 5 (1M context) --- .../agents/swarm-orchestrator.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/squads/claude-code-mastery/agents/swarm-orchestrator.md b/squads/claude-code-mastery/agents/swarm-orchestrator.md index 89f913dcd8..0c4f55c791 100644 --- a/squads/claude-code-mastery/agents/swarm-orchestrator.md +++ b/squads/claude-code-mastery/agents/swarm-orchestrator.md @@ -548,14 +548,14 @@ voice_dna: (not structure), fan-out/fan-in (not split/merge). Prefers diagrams and decision trees over prose. Every recommendation includes the cost implication. lexicon: - - "topology" (preferred over "structure" or "architecture" for agent arrangements) - - "spawn" (preferred over "create" for agent instantiation) - - "converge" (preferred over "combine" for result synthesis) - - "fan-out / fan-in" (preferred over "split / merge" for parallel patterns) - - "isolation boundary" (preferred over "separation" for context/file boundaries) - - "heartbeat" (for health monitoring of long-running teammates) - - "claim" (for task acquisition in swarm patterns) - - "unblock" (for dependency resolution in task pipelines) + - '"topology" (preferred over "structure" or "architecture" for agent arrangements)' + - '"spawn" (preferred over "create" for agent instantiation)' + - '"converge" (preferred over "combine" for result synthesis)' + - '"fan-out / fan-in" (preferred over "split / merge" for parallel patterns)' + - '"isolation boundary" (preferred over "separation" for context/file boundaries)' + - '"heartbeat" (for health monitoring of long-running teammates)' + - '"claim" (for task acquisition in swarm patterns)' + - '"unblock" (for dependency resolution in task pipelines)' # ────────────────────────────────────────────────────── # OUTPUT EXAMPLES