[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C2MZN3MW433WNPEDCZ8HMH":3,"skill-same:01M6C2MZN3MW433WNPEDCZ8HMH":81},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":62,"ownerHtmlUrl":63,"ownerBlogUrl":64,"ownerDescription":65,"updatedAt":66,"install":67,"resources":80},"01M6C2MZN3MW433WNPEDCZ8HMH","aiwg-update-claude",null,"Update existing project CLAUDE.md with latest AIWG orchestration guidance","jmagly\u002Faiwg","jmagly","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1159087?v=4","01M6C10AK8N2WCSQN11FYGTJWN","Joseph Magly","01M6C10AQ8A2RMED1Y1BSVY7NF",229,"MIT","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fcodex-sdlc\u002Fskills\u002Faiwg-update-claude\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"update","aiwg update claude","edit","Existing","latest","with","project","efficiency","guidance","sdlc","interactive","directory","write","read","haiku","text","Bash","setup","orchestration","2026-11-10 10:12:30",false,"---\nnamespace: aiwg\nname: aiwg-update-claude\nplatforms: [all]\ndescription: Update existing project CLAUDE.md with latest AIWG orchestration guidance\ncommandHint:\n  argumentHint: [project-directory --interactive --guidance \"text\"]\n  allowedTools: Read, Write, Edit, Bash\n  model: haiku\n  category: sdlc-setup\n  modelRole: efficiency\n  modelTier: economy\n---\n\n\u003C!-- AIWG-SKILL-CALLOUT -->\n> **Skill access pattern (post-kernel-pivot, 2026.5+)**\n>\n> Skill names referenced in this document are AIWG skills, **not slash commands**. Most are not kernel-listed and cannot be invoked as `\u002Fskill-name` by the platform. Reach them via:\n>\n> ```bash\n> aiwg discover \"\u003Ccapability>\"\n> aiwg show skill \u003Cname> --body\n> ```\n>\n> Only kernel-listed skills (`aiwg-doctor`, `aiwg-refresh`, `aiwg-status`, `aiwg-help`, `use`, `steward`) are directly invokable as slash commands. See [skill-discovery rule](https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fskill-discovery.md).\n\n\n# AIWG Update CLAUDE.md\n\nYou are an SDLC Configuration Specialist responsible for updating existing project CLAUDE.md files with the latest AIWG orchestration guidance while preserving all user-specific content.\n\n## Your Task\n\nWhen invoked with `\u002Faiwg-update-claude [project-directory]`:\n\n1. **Read** existing project CLAUDE.md\n2. **Preserve** all user-specific notes, rules, and configuration\n3. **Extract or update** AIWG framework section with latest orchestration guidance\n4. **Merge intelligently** without losing any project knowledge\n5. **Report** what changed\n\n## Execution Steps\n\n### Step 1: Detect Project CLAUDE.md\n\n```bash\nPROJECT_DIR=\"${1:-.}\"\nCLAUDE_MD=\"$PROJECT_DIR\u002FCLAUDE.md\"\n\nif [ ! -f \"$CLAUDE_MD\" ]; then\n  echo \"❌ Error: No CLAUDE.md found at $CLAUDE_MD\"\n  echo \"\"\n  echo \"For new projects, use: \u002Faiwg-setup-project\"\n  exit 1\nfi\n\necho \"✓ Found existing CLAUDE.md: $CLAUDE_MD\"\n```\n\n### Step 2: Resolve AIWG Installation Path\n\nUse path resolution from `aiwg-config-template.md`:\n\n```bash\n# Function: Resolve AIWG installation path\nresolve_aiwg_root() {\n  # 1. Check environment variable\n  if [ -n \"$AIWG_ROOT\" ] && [ -d \"$AIWG_ROOT\" ]; then\n    echo \"$AIWG_ROOT\"\n    return 0\n  fi\n\n  # 2. Check installer location (user)\n  if [ -d ~\u002F.local\u002Fshare\u002Fai-writing-guide ]; then\n    echo ~\u002F.local\u002Fshare\u002Fai-writing-guide\n    return 0\n  fi\n\n  # 3. Check system location\n  if [ -d \u002Fusr\u002Flocal\u002Fshare\u002Fai-writing-guide ]; then\n    echo \u002Fusr\u002Flocal\u002Fshare\u002Fai-writing-guide\n    return 0\n  fi\n\n  # 4. Check git repository root (development)\n  if git rev-parse --show-toplevel &>\u002Fdev\u002Fnull; then\n    echo \"$(git rev-parse --show-toplevel)\"\n    return 0\n  fi\n\n  # 5. Fallback to current directory\n  echo \".\"\n  return 1\n}\n\nAIWG_ROOT=$(resolve_aiwg_root)\n\nif [ ! -d \"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\" ]; then\n  echo \"❌ Error: AIWG installation not found at $AIWG_ROOT\"\n  exit 1\nfi\n\necho \"✓ AIWG installation found: $AIWG_ROOT\"\n```\n\n### Step 3: Read AIWG CLAUDE.md Template\n\n```bash\nCLAUDE_TEMPLATE=\"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Fproject\u002FCLAUDE.md\"\n\nif [ ! -f \"$CLAUDE_TEMPLATE\" ]; then\n  echo \"❌ Error: CLAUDE.md template not found at $CLAUDE_TEMPLATE\"\n  exit 1\nfi\n\necho \"✓ Loaded CLAUDE.md template with latest orchestration guidance\"\n```\n\n### Step 4: Intelligent Merging Strategy\n\n**Read existing CLAUDE.md** and identify sections:\n\n```python\n# Pseudo-code for section identification\nexisting_content = read_file(CLAUDE_MD)\n\nsections = {\n    \"user_header\": extract_until(\"## AIWG\"),  # Everything before AIWG section\n    \"aiwg_section\": extract_between(\"## AIWG\", next_major_heading),\n    \"user_footer\": extract_after(aiwg_section)  # Everything after AIWG section\n}\n\n# If no AIWG section exists\nif not sections[\"aiwg_section\"]:\n    sections[\"user_header\"] = entire_file\n    sections[\"user_footer\"] = \"\"\n```\n\n**Merge logic**:\n\n1. **Preserve user header** (everything before `## AIWG`)\n2. **Replace AIWG section** with latest template\n3. **Preserve user footer** (everything after AIWG section, if any)\n\n### Step 5: Extract User Content\n\nUse Read and Edit tools to identify and preserve user sections:\n\n```markdown\n# What to PRESERVE:\n- Custom ## Repository Purpose content\n- Project-specific rules and guidelines\n- Custom tool configurations\n- Team conventions\n- Any sections NOT starting with \"## AIWG\"\n\n# What to REPLACE:\n- Entire ## AIWG SDLC Framework section\n- All subsections under ## AIWG\n\n# What to ADD if missing:\n- ## AIWG section from template (after Repository Purpose, before user footer)\n```\n\n### Step 6: Execute Merge\n\n**Strategy A: AIWG Section Exists**\n\nUse Edit tool to replace AIWG section:\n\n```python\n# Find section boundaries\naiwg_start = find_heading(\"## AIWG\")\naiwg_end = find_next_major_heading_after(aiwg_start) or end_of_file\n\n# Read template and substitute AIWG_ROOT\nnew_aiwg_section = read_template()\nnew_aiwg_section = substitute(\"{AIWG_ROOT}\", AIWG_ROOT)\n\n# Replace old AIWG section with new\nold_section = extract(aiwg_start, aiwg_end)\nEdit(\n    file_path=CLAUDE_MD,\n    old_string=old_section,\n    new_string=new_aiwg_section\n)\n```\n\n**Strategy B: No AIWG Section**\n\nUse Edit tool to append AIWG section:\n\n```python\n# Find insertion point (after Repository Purpose, before any footer content)\ninsertion_point = find_heading(\"## Repository Purpose\")\nnext_heading = find_next_major_heading_after(insertion_point)\n\n# Read template and substitute\nnew_aiwg_section = read_template()\nnew_aiwg_section = substitute(\"{AIWG_ROOT}\", AIWG_ROOT)\n\n# Insert AIWG section\nif next_heading:\n    # Insert before next heading\n    old_string = extract(insertion_point, next_heading)\n    new_string = old_string + \"\\n\\n---\\n\\n\" + new_aiwg_section + \"\\n\\n---\\n\\n\"\nelse:\n    # Append to end\n    old_string = extract(insertion_point, end_of_file)\n    new_string = old_string + \"\\n\\n---\\n\\n\" + new_aiwg_section\n```\n\n### Step 7: Validate Merge\n\nRun validation checks:\n\n```bash\necho \"\"\necho \"=======================================================================\"\necho \"CLAUDE.md Update Validation\"\necho \"=======================================================================\"\necho \"\"\n\n# Check 1: AIWG section updated\nif grep -q \"## AIWG SDLC Framework\" \"$CLAUDE_MD\"; then\n  echo \"✓ AIWG section updated\"\nelse\n  echo \"❌ AIWG section not found after update\"\nfi\n\n# Check 2: Orchestrator role present\nif grep -q \"Core Platform Orchestrator Role\" \"$CLAUDE_MD\"; then\n  echo \"✓ Orchestrator role documentation present\"\nelse\n  echo \"❌ Orchestrator role documentation missing\"\nfi\n\n# Check 3: Natural language translations present\nif grep -q \"Natural Language Command Translation\" \"$CLAUDE_MD\"; then\n  echo \"✓ Natural language translation guide present\"\nelse\n  echo \"❌ Natural language translation guide missing\"\nfi\n\n# Check 4: Multi-agent pattern present\nif grep -q \"Primary Author → Parallel Reviewers → Synthesizer\" \"$CLAUDE_MD\"; then\n  echo \"✓ Multi-agent orchestration pattern present\"\nelse\n  echo \"❌ Multi-agent orchestration pattern missing\"\nfi\n\n# Check 5: AIWG_ROOT substituted\nif grep -q \"{AIWG_ROOT}\" \"$CLAUDE_MD\"; then\n  echo \"⚠️  Warning: {AIWG_ROOT} placeholder not substituted\"\nelse\n  echo \"✓ AIWG_ROOT properly substituted\"\nfi\n\necho \"\"\necho \"=======================================================================\"\n```\n\n### Step 8: Detect and Configure Factory AI (If Present)\n\nCheck if Factory AI is also being used and update AGENTS.md accordingly:\n\n```bash\n# Detect Factory AI deployment\nif [ -d \"$PROJECT_DIR\u002F.factory\u002Fdroids\" ]; then\n  echo \"\"\n  echo \"=======================================================================\"\n  echo \"Factory AI Detected - AGENTS.md Update Recommended\"\n  echo \"=======================================================================\"\n  echo \"\"\n\n  # Check if aiwg-update-agents-md command exists\n  if [ -f \"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fcommands\u002Faiwg-update-agents-md.md\" ]; then\n    echo \"✓ Factory AI droids detected in .factory\u002Fdroids\u002F\"\n    echo \"ℹ️  AGENTS.md should also be updated for Factory AI users\"\n    echo \"\"\n    echo \"Recommended next step:\"\n    echo \"  \u002Faiwg-update-agents-md\"\n    echo \"\"\n  else\n    echo \"⚠️  Factory AI droids detected but aiwg-update-agents-md command not found\"\n    echo \"   Install latest AIWG version for Factory AI support\"\n  fi\n\n  echo \"=======================================================================\"\nfi\n```\n\n**Cross-Platform Integration**:\n- **Claude Code only**: Updates CLAUDE.md\n- **Claude Code + Factory AI**: Updates CLAUDE.md, recommends updating AGENTS.md\n- **Multi-platform**: User should run platform-specific commands for each platform\n\nUse Bash tool for Factory AI detection.\n\n## Intelligent Content Preservation\n\n### User Content Indicators\n\n**These sections are ALWAYS preserved**:\n\n- `# CLAUDE.md` (header)\n- `## Repository Purpose` (and its content)\n- Any custom `##` headings (not \"## AIWG\")\n- `## Project-Specific Notes` (footer section)\n- Custom tool configurations\n- Team-specific rules\n\n**Example existing CLAUDE.md**:\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\nThis is a financial trading platform built with Python and FastAPI.\n\n## Team Rules\n\n- All commits must be signed\n- Use black for formatting\n- Run tests before pushing\n\n## AIWG SDLC Framework\n\n{...old AIWG section...}\n\n## Deployment Notes\n\n- Production deploys require approval\n- Staging auto-deploys from main\n```\n\n**After update**:\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\nThis is a financial trading platform built with Python and FastAPI.\n\n## Team Rules\n\n- All commits must be signed\n- Use black for formatting\n- Run tests before pushing\n\n---\n\n## AIWG SDLC Framework\n\n{...NEW orchestration guidance from template...}\n\n---\n\n## Deployment Notes\n\n- Production deploys require approval\n- Staging auto-deploys from main\n```\n\n### Edge Cases\n\n**Case 1: AIWG section at end of file**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## AIWG SDLC Framework\n\n{...old section...}\n```\n\n**Action**: Replace AIWG section through EOF\n\n**Case 2: Multiple user sections after AIWG**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## AIWG SDLC Framework\n\n{...old section...}\n\n## Deployment Notes\n\n...\n\n## Security Rules\n\n...\n```\n\n**Action**: Replace AIWG section, preserve all user sections after\n\n**Case 3: No AIWG section (first time setup)**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## Team Rules\n\n...\n```\n\n**Action**: Insert AIWG section after Repository Purpose, before Team Rules\n\n## Output Format\n\nProvide clear status report:\n\n```markdown\n# CLAUDE.md Update Complete\n\n**Project**: {project-directory}\n**AIWG Installation**: {AIWG_ROOT}\n**Operation**: {UPDATED | INSERTED}\n\n## Changes Made\n\n### AIWG Section\n- {UPDATED | INSERTED} AIWG framework documentation\n- ✓ Added Core Platform Orchestrator Role guidance\n- ✓ Added Natural Language Command Translation map\n- ✓ Added Multi-Agent Orchestration Pattern\n- ✓ Updated command reference to latest flows\n- ✓ Substituted AIWG_ROOT: {actual-path}\n\n### User Content Preserved\n- ✓ Repository Purpose section preserved\n- ✓ Custom team rules preserved\n- ✓ {N} custom sections preserved\n- {List any custom sections found}\n\n## Validation Results\n\n{validation checklist from Step 7}\n\n## What's New in This Update\n\n**Orchestration Architecture**:\n- Core platform (Claude Code) is now the orchestrator, not command executor\n- Flow commands are templates, not bash scripts to run\n- Multi-agent coordination pattern documented\n\n**Natural Language Support**:\n- Users can use natural language instead of slash commands\n- Translation map for common phrases (\"transition to Elaboration\", etc.)\n- Intent recognition patterns documented\n\n**Multi-Agent Workflow**:\n- Primary Author → Parallel Reviewers → Synthesizer → Archive pattern\n- Parallel execution guidance (single message, multiple Task calls)\n- Progress tracking with ✓ ⏳ ❌ symbols\n\n**Enhanced Guidance**:\n- --guidance and --interactive parameter support\n- Phase-specific workflow patterns\n- Troubleshooting and common patterns\n\n## Next Steps\n\n1. **Review Updated Sections**: Read through the new AIWG orchestration guidance\n2. **Test Natural Language**: Try \"Let's transition to Elaboration\" instead of slash commands\n3. **Deploy Latest Agents**: Run `aiwg -deploy-agents --mode sdlc` if needed\n4. **Check Flow Commands**: Ensure `.claude\u002Fcommands\u002Fflow-*.md` are deployed\n\n{if Factory AI detected}\n5. **Update Factory AI Configuration**: Run `aiwg-update-agents-md` to update AGENTS.md with project-specific content for Factory AI users\n\n## Backup\n\nA backup of your previous CLAUDE.md has been saved to:\n  {CLAUDE_MD}.backup-{timestamp}\n\nTo restore: `cp {CLAUDE_MD}.backup-{timestamp} {CLAUDE_MD}`\n```\n\n## Error Handling\n\n**CLAUDE.md Not Found**:\n\n```markdown\n❌ Error: No CLAUDE.md found at {path}\n\nFor new projects, use:\n  \u002Faiwg-setup-project\n\nFor projects that never had CLAUDE.md, create one first or use aiwg-setup-project.\n```\n\n**AIWG Template Not Found**:\n\n```markdown\n❌ Error: AIWG template not found at {CLAUDE_TEMPLATE}\n\nPlease update AIWG installation:\n  aiwg -update\n\nOr reinstall:\n  aiwg -reinstall\n```\n\n**Merge Conflict**:\n\n```markdown\n⚠️  Warning: Could not automatically merge AIWG section\n\nManual review required. The file structure is unexpected.\n\nPlease review:\n  {CLAUDE_MD}\n\nBackup saved to:\n  {CLAUDE_MD}.backup-{timestamp}\n```\n\n## Success Criteria\n\nThis command succeeds when:\n\n- [ ] Existing CLAUDE.md read successfully\n- [ ] AIWG template loaded and AIWG_ROOT substituted\n- [ ] All user content identified and preserved\n- [ ] AIWG section updated with latest orchestration guidance\n- [ ] Backup created before modifications\n- [ ] Validation checks pass\n- [ ] Clear summary provided to user\n\n## Implementation Notes\n\n**Use Read tool** to:\n\n- Read existing CLAUDE.md\n- Read AIWG template\n- Identify section boundaries\n\n**Use Edit tool** to:\n\n- Replace existing AIWG section\n- Insert AIWG section if missing\n- Preserve all user content\n\n**Use Bash tool** to:\n\n- Create backup with timestamp\n- Validate AIWG installation\n- Check file permissions\n\n**DO NOT**:\n\n- Delete or overwrite user content\n- Lose custom sections\n- Remove project-specific rules\n- Skip backup creation\n\n## Key Differences from aiwg-setup-project\n\n| Feature | aiwg-setup-project | aiwg-update-claude |\n|---------|-------------------|-------------------|\n| Target | New projects or first-time setup | Existing projects with CLAUDE.md |\n| Operation | Create or append AIWG section | Intelligently replace AIWG section |\n| User Content | May not exist yet | MUST be preserved |\n| Backup | Optional | ALWAYS created |\n| Validation | Basic checks | Comprehensive validation |\n| Use Case | Initial setup | Update to latest guidance |\n\n## References\n\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fhuman-authorization.md — Always create a backup before modifying CLAUDE.md; never silently overwrite user content\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fagent-deployment.md — Rules for working with agent definitions and multi-provider deployment\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fresearch-before-decision.md — Read existing CLAUDE.md and identify section boundaries before acting\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-setup-project\u002FSKILL.md — Initial setup skill; use this skill for subsequent updates\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-agents-md\u002FSKILL.md — Companion skill to invoke when Factory AI is also detected\n","\u003C!-- AIWG-SKILL-CALLOUT -->\n> **Skill access pattern (post-kernel-pivot, 2026.5+)**\n>\n> Skill names referenced in this document are AIWG skills, **not slash commands**. Most are not kernel-listed and cannot be invoked as `\u002Fskill-name` by the platform. Reach them via:\n>\n> ```bash\n> aiwg discover \"\u003Ccapability>\"\n> aiwg show skill \u003Cname> --body\n> ```\n>\n> Only kernel-listed skills (`aiwg-doctor`, `aiwg-refresh`, `aiwg-status`, `aiwg-help`, `use`, `steward`) are directly invokable as slash commands. See [skill-discovery rule](https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fskill-discovery.md).\n\n\n# AIWG Update CLAUDE.md\n\nYou are an SDLC Configuration Specialist responsible for updating existing project CLAUDE.md files with the latest AIWG orchestration guidance while preserving all user-specific content.\n\n## Your Task\n\nWhen invoked with `\u002Faiwg-update-claude [project-directory]`:\n\n1. **Read** existing project CLAUDE.md\n2. **Preserve** all user-specific notes, rules, and configuration\n3. **Extract or update** AIWG framework section with latest orchestration guidance\n4. **Merge intelligently** without losing any project knowledge\n5. **Report** what changed\n\n## Execution Steps\n\n### Step 1: Detect Project CLAUDE.md\n\n```bash\nPROJECT_DIR=\"${1:-.}\"\nCLAUDE_MD=\"$PROJECT_DIR\u002FCLAUDE.md\"\n\nif [ ! -f \"$CLAUDE_MD\" ]; then\n  echo \"❌ Error: No CLAUDE.md found at $CLAUDE_MD\"\n  echo \"\"\n  echo \"For new projects, use: \u002Faiwg-setup-project\"\n  exit 1\nfi\n\necho \"✓ Found existing CLAUDE.md: $CLAUDE_MD\"\n```\n\n### Step 2: Resolve AIWG Installation Path\n\nUse path resolution from `aiwg-config-template.md`:\n\n```bash\n# Function: Resolve AIWG installation path\nresolve_aiwg_root() {\n  # 1. Check environment variable\n  if [ -n \"$AIWG_ROOT\" ] && [ -d \"$AIWG_ROOT\" ]; then\n    echo \"$AIWG_ROOT\"\n    return 0\n  fi\n\n  # 2. Check installer location (user)\n  if [ -d ~\u002F.local\u002Fshare\u002Fai-writing-guide ]; then\n    echo ~\u002F.local\u002Fshare\u002Fai-writing-guide\n    return 0\n  fi\n\n  # 3. Check system location\n  if [ -d \u002Fusr\u002Flocal\u002Fshare\u002Fai-writing-guide ]; then\n    echo \u002Fusr\u002Flocal\u002Fshare\u002Fai-writing-guide\n    return 0\n  fi\n\n  # 4. Check git repository root (development)\n  if git rev-parse --show-toplevel &>\u002Fdev\u002Fnull; then\n    echo \"$(git rev-parse --show-toplevel)\"\n    return 0\n  fi\n\n  # 5. Fallback to current directory\n  echo \".\"\n  return 1\n}\n\nAIWG_ROOT=$(resolve_aiwg_root)\n\nif [ ! -d \"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\" ]; then\n  echo \"❌ Error: AIWG installation not found at $AIWG_ROOT\"\n  exit 1\nfi\n\necho \"✓ AIWG installation found: $AIWG_ROOT\"\n```\n\n### Step 3: Read AIWG CLAUDE.md Template\n\n```bash\nCLAUDE_TEMPLATE=\"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Fproject\u002FCLAUDE.md\"\n\nif [ ! -f \"$CLAUDE_TEMPLATE\" ]; then\n  echo \"❌ Error: CLAUDE.md template not found at $CLAUDE_TEMPLATE\"\n  exit 1\nfi\n\necho \"✓ Loaded CLAUDE.md template with latest orchestration guidance\"\n```\n\n### Step 4: Intelligent Merging Strategy\n\n**Read existing CLAUDE.md** and identify sections:\n\n```python\n# Pseudo-code for section identification\nexisting_content = read_file(CLAUDE_MD)\n\nsections = {\n    \"user_header\": extract_until(\"## AIWG\"),  # Everything before AIWG section\n    \"aiwg_section\": extract_between(\"## AIWG\", next_major_heading),\n    \"user_footer\": extract_after(aiwg_section)  # Everything after AIWG section\n}\n\n# If no AIWG section exists\nif not sections[\"aiwg_section\"]:\n    sections[\"user_header\"] = entire_file\n    sections[\"user_footer\"] = \"\"\n```\n\n**Merge logic**:\n\n1. **Preserve user header** (everything before `## AIWG`)\n2. **Replace AIWG section** with latest template\n3. **Preserve user footer** (everything after AIWG section, if any)\n\n### Step 5: Extract User Content\n\nUse Read and Edit tools to identify and preserve user sections:\n\n```markdown\n# What to PRESERVE:\n- Custom ## Repository Purpose content\n- Project-specific rules and guidelines\n- Custom tool configurations\n- Team conventions\n- Any sections NOT starting with \"## AIWG\"\n\n# What to REPLACE:\n- Entire ## AIWG SDLC Framework section\n- All subsections under ## AIWG\n\n# What to ADD if missing:\n- ## AIWG section from template (after Repository Purpose, before user footer)\n```\n\n### Step 6: Execute Merge\n\n**Strategy A: AIWG Section Exists**\n\nUse Edit tool to replace AIWG section:\n\n```python\n# Find section boundaries\naiwg_start = find_heading(\"## AIWG\")\naiwg_end = find_next_major_heading_after(aiwg_start) or end_of_file\n\n# Read template and substitute AIWG_ROOT\nnew_aiwg_section = read_template()\nnew_aiwg_section = substitute(\"{AIWG_ROOT}\", AIWG_ROOT)\n\n# Replace old AIWG section with new\nold_section = extract(aiwg_start, aiwg_end)\nEdit(\n    file_path=CLAUDE_MD,\n    old_string=old_section,\n    new_string=new_aiwg_section\n)\n```\n\n**Strategy B: No AIWG Section**\n\nUse Edit tool to append AIWG section:\n\n```python\n# Find insertion point (after Repository Purpose, before any footer content)\ninsertion_point = find_heading(\"## Repository Purpose\")\nnext_heading = find_next_major_heading_after(insertion_point)\n\n# Read template and substitute\nnew_aiwg_section = read_template()\nnew_aiwg_section = substitute(\"{AIWG_ROOT}\", AIWG_ROOT)\n\n# Insert AIWG section\nif next_heading:\n    # Insert before next heading\n    old_string = extract(insertion_point, next_heading)\n    new_string = old_string + \"\\n\\n---\\n\\n\" + new_aiwg_section + \"\\n\\n---\\n\\n\"\nelse:\n    # Append to end\n    old_string = extract(insertion_point, end_of_file)\n    new_string = old_string + \"\\n\\n---\\n\\n\" + new_aiwg_section\n```\n\n### Step 7: Validate Merge\n\nRun validation checks:\n\n```bash\necho \"\"\necho \"=======================================================================\"\necho \"CLAUDE.md Update Validation\"\necho \"=======================================================================\"\necho \"\"\n\n# Check 1: AIWG section updated\nif grep -q \"## AIWG SDLC Framework\" \"$CLAUDE_MD\"; then\n  echo \"✓ AIWG section updated\"\nelse\n  echo \"❌ AIWG section not found after update\"\nfi\n\n# Check 2: Orchestrator role present\nif grep -q \"Core Platform Orchestrator Role\" \"$CLAUDE_MD\"; then\n  echo \"✓ Orchestrator role documentation present\"\nelse\n  echo \"❌ Orchestrator role documentation missing\"\nfi\n\n# Check 3: Natural language translations present\nif grep -q \"Natural Language Command Translation\" \"$CLAUDE_MD\"; then\n  echo \"✓ Natural language translation guide present\"\nelse\n  echo \"❌ Natural language translation guide missing\"\nfi\n\n# Check 4: Multi-agent pattern present\nif grep -q \"Primary Author → Parallel Reviewers → Synthesizer\" \"$CLAUDE_MD\"; then\n  echo \"✓ Multi-agent orchestration pattern present\"\nelse\n  echo \"❌ Multi-agent orchestration pattern missing\"\nfi\n\n# Check 5: AIWG_ROOT substituted\nif grep -q \"{AIWG_ROOT}\" \"$CLAUDE_MD\"; then\n  echo \"⚠️  Warning: {AIWG_ROOT} placeholder not substituted\"\nelse\n  echo \"✓ AIWG_ROOT properly substituted\"\nfi\n\necho \"\"\necho \"=======================================================================\"\n```\n\n### Step 8: Detect and Configure Factory AI (If Present)\n\nCheck if Factory AI is also being used and update AGENTS.md accordingly:\n\n```bash\n# Detect Factory AI deployment\nif [ -d \"$PROJECT_DIR\u002F.factory\u002Fdroids\" ]; then\n  echo \"\"\n  echo \"=======================================================================\"\n  echo \"Factory AI Detected - AGENTS.md Update Recommended\"\n  echo \"=======================================================================\"\n  echo \"\"\n\n  # Check if aiwg-update-agents-md command exists\n  if [ -f \"$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fcommands\u002Faiwg-update-agents-md.md\" ]; then\n    echo \"✓ Factory AI droids detected in .factory\u002Fdroids\u002F\"\n    echo \"ℹ️  AGENTS.md should also be updated for Factory AI users\"\n    echo \"\"\n    echo \"Recommended next step:\"\n    echo \"  \u002Faiwg-update-agents-md\"\n    echo \"\"\n  else\n    echo \"⚠️  Factory AI droids detected but aiwg-update-agents-md command not found\"\n    echo \"   Install latest AIWG version for Factory AI support\"\n  fi\n\n  echo \"=======================================================================\"\nfi\n```\n\n**Cross-Platform Integration**:\n- **Claude Code only**: Updates CLAUDE.md\n- **Claude Code + Factory AI**: Updates CLAUDE.md, recommends updating AGENTS.md\n- **Multi-platform**: User should run platform-specific commands for each platform\n\nUse Bash tool for Factory AI detection.\n\n## Intelligent Content Preservation\n\n### User Content Indicators\n\n**These sections are ALWAYS preserved**:\n\n- `# CLAUDE.md` (header)\n- `## Repository Purpose` (and its content)\n- Any custom `##` headings (not \"## AIWG\")\n- `## Project-Specific Notes` (footer section)\n- Custom tool configurations\n- Team-specific rules\n\n**Example existing CLAUDE.md**:\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\nThis is a financial trading platform built with Python and FastAPI.\n\n## Team Rules\n\n- All commits must be signed\n- Use black for formatting\n- Run tests before pushing\n\n## AIWG SDLC Framework\n\n{...old AIWG section...}\n\n## Deployment Notes\n\n- Production deploys require approval\n- Staging auto-deploys from main\n```\n\n**After update**:\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\nThis is a financial trading platform built with Python and FastAPI.\n\n## Team Rules\n\n- All commits must be signed\n- Use black for formatting\n- Run tests before pushing\n\n---\n\n## AIWG SDLC Framework\n\n{...NEW orchestration guidance from template...}\n\n---\n\n## Deployment Notes\n\n- Production deploys require approval\n- Staging auto-deploys from main\n```\n\n### Edge Cases\n\n**Case 1: AIWG section at end of file**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## AIWG SDLC Framework\n\n{...old section...}\n```\n\n**Action**: Replace AIWG section through EOF\n\n**Case 2: Multiple user sections after AIWG**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## AIWG SDLC Framework\n\n{...old section...}\n\n## Deployment Notes\n\n...\n\n## Security Rules\n\n...\n```\n\n**Action**: Replace AIWG section, preserve all user sections after\n\n**Case 3: No AIWG section (first time setup)**\n\n```markdown\n# CLAUDE.md\n\n## Repository Purpose\n\n...\n\n## Team Rules\n\n...\n```\n\n**Action**: Insert AIWG section after Repository Purpose, before Team Rules\n\n## Output Format\n\nProvide clear status report:\n\n```markdown\n# CLAUDE.md Update Complete\n\n**Project**: {project-directory}\n**AIWG Installation**: {AIWG_ROOT}\n**Operation**: {UPDATED | INSERTED}\n\n## Changes Made\n\n### AIWG Section\n- {UPDATED | INSERTED} AIWG framework documentation\n- ✓ Added Core Platform Orchestrator Role guidance\n- ✓ Added Natural Language Command Translation map\n- ✓ Added Multi-Agent Orchestration Pattern\n- ✓ Updated command reference to latest flows\n- ✓ Substituted AIWG_ROOT: {actual-path}\n\n### User Content Preserved\n- ✓ Repository Purpose section preserved\n- ✓ Custom team rules preserved\n- ✓ {N} custom sections preserved\n- {List any custom sections found}\n\n## Validation Results\n\n{validation checklist from Step 7}\n\n## What's New in This Update\n\n**Orchestration Architecture**:\n- Core platform (Claude Code) is now the orchestrator, not command executor\n- Flow commands are templates, not bash scripts to run\n- Multi-agent coordination pattern documented\n\n**Natural Language Support**:\n- Users can use natural language instead of slash commands\n- Translation map for common phrases (\"transition to Elaboration\", etc.)\n- Intent recognition patterns documented\n\n**Multi-Agent Workflow**:\n- Primary Author → Parallel Reviewers → Synthesizer → Archive pattern\n- Parallel execution guidance (single message, multiple Task calls)\n- Progress tracking with ✓ ⏳ ❌ symbols\n\n**Enhanced Guidance**:\n- --guidance and --interactive parameter support\n- Phase-specific workflow patterns\n- Troubleshooting and common patterns\n\n## Next Steps\n\n1. **Review Updated Sections**: Read through the new AIWG orchestration guidance\n2. **Test Natural Language**: Try \"Let's transition to Elaboration\" instead of slash commands\n3. **Deploy Latest Agents**: Run `aiwg -deploy-agents --mode sdlc` if needed\n4. **Check Flow Commands**: Ensure `.claude\u002Fcommands\u002Fflow-*.md` are deployed\n\n{if Factory AI detected}\n5. **Update Factory AI Configuration**: Run `aiwg-update-agents-md` to update AGENTS.md with project-specific content for Factory AI users\n\n## Backup\n\nA backup of your previous CLAUDE.md has been saved to:\n  {CLAUDE_MD}.backup-{timestamp}\n\nTo restore: `cp {CLAUDE_MD}.backup-{timestamp} {CLAUDE_MD}`\n```\n\n## Error Handling\n\n**CLAUDE.md Not Found**:\n\n```markdown\n❌ Error: No CLAUDE.md found at {path}\n\nFor new projects, use:\n  \u002Faiwg-setup-project\n\nFor projects that never had CLAUDE.md, create one first or use aiwg-setup-project.\n```\n\n**AIWG Template Not Found**:\n\n```markdown\n❌ Error: AIWG template not found at {CLAUDE_TEMPLATE}\n\nPlease update AIWG installation:\n  aiwg -update\n\nOr reinstall:\n  aiwg -reinstall\n```\n\n**Merge Conflict**:\n\n```markdown\n⚠️  Warning: Could not automatically merge AIWG section\n\nManual review required. The file structure is unexpected.\n\nPlease review:\n  {CLAUDE_MD}\n\nBackup saved to:\n  {CLAUDE_MD}.backup-{timestamp}\n```\n\n## Success Criteria\n\nThis command succeeds when:\n\n- [ ] Existing CLAUDE.md read successfully\n- [ ] AIWG template loaded and AIWG_ROOT substituted\n- [ ] All user content identified and preserved\n- [ ] AIWG section updated with latest orchestration guidance\n- [ ] Backup created before modifications\n- [ ] Validation checks pass\n- [ ] Clear summary provided to user\n\n## Implementation Notes\n\n**Use Read tool** to:\n\n- Read existing CLAUDE.md\n- Read AIWG template\n- Identify section boundaries\n\n**Use Edit tool** to:\n\n- Replace existing AIWG section\n- Insert AIWG section if missing\n- Preserve all user content\n\n**Use Bash tool** to:\n\n- Create backup with timestamp\n- Validate AIWG installation\n- Check file permissions\n\n**DO NOT**:\n\n- Delete or overwrite user content\n- Lose custom sections\n- Remove project-specific rules\n- Skip backup creation\n\n## Key Differences from aiwg-setup-project\n\n| Feature | aiwg-setup-project | aiwg-update-claude |\n|---------|-------------------|-------------------|\n| Target | New projects or first-time setup | Existing projects with CLAUDE.md |\n| Operation | Create or append AIWG section | Intelligently replace AIWG section |\n| User Content | May not exist yet | MUST be preserved |\n| Backup | Optional | ALWAYS created |\n| Validation | Basic checks | Comprehensive validation |\n| Use Case | Initial setup | Update to latest guidance |\n\n## References\n\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fhuman-authorization.md — Always create a backup before modifying CLAUDE.md; never silently overwrite user content\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fagent-deployment.md — Rules for working with agent definitions and multi-provider deployment\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fresearch-before-decision.md — Read existing CLAUDE.md and identify section boundaries before acting\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-setup-project\u002FSKILL.md — Initial setup skill; use this skill for subsequent updates\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-agents-md\u002FSKILL.md — Companion skill to invoke when Factory AI is also detected\n",{"name":5,"namespace":48,"platforms":49,"commandHint":51,"description":7},"aiwg",[50],"all",{"model":38,"category":52,"modelRole":31,"modelTier":53,"allowedTools":54,"argumentHint":55},"sdlc-setup","economy","Read, Write, Edit, Bash",[56],"project-directory --interactive --guidance \"text\"","main","6754967c344ccb087a8de06972f55a41067b291b","agentic\u002Fcode\u002Fplugins\u002Fcodex-sdlc\u002Fskills\u002Faiwg-update-claude",36,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg","https:\u002F\u002Faiwg.io","https:\u002F\u002Fgithub.com\u002Fjmagly","https:\u002F\u002Fintegrolabs.io","ml\u002Fai, industrial automation, safety\u002Fsecurity, ssi\r\n\r\nmagly.net\r\nintegrolabs.io\r\naiwg.io\r\nfortemi.com\r\npagenary.com\r\nbytecask.com","2026-11-14 10:46:34",{"source":8,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add jmagly\u002Faiwg --skill aiwg-update-claude",{"tool":73,"command":74},"bunx","bunx skills add jmagly\u002Faiwg --skill aiwg-update-claude",{"tool":76,"command":77},"pnpm","pnpm dlx skills add jmagly\u002Faiwg --skill aiwg-update-claude","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fcodex-sdlc\u002Fskills\u002Faiwg-update-claude\u002FSKILL.md",true,[],[82,108,131,137,144,158],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":89,"publishedAt":43},"01M70QA0BSYJ49EES9V4RE8QH1","host-hardening","Read-only system hardening baseline and plan-first host hardening recommendations for SSH, Docker bind addresses, firewall persistence, datastores, exporters and audit retention.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[88],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[90,91,92,37,93,94,95,96,97,98,40,99,100,101,102,103,104,105,106,107],"host","host hardening","hardening","re","recommendations","remediation","plan","port","verification","access","only","retention","audit","never","firewall","bind","secrets","request",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":118,"publishedAt":43},"01M70PNT2Z4HMZPRBTAF6073NN","exposure-analysis","Read-only firewall analysis and effective host exposure reconstruction for Docker published ports, UFW bypass, stale rules, CDN scope, IPv6 asymmetry and external probe allowlists.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fforensics\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[114,117],{"categoryNo":115,"categoryName":116,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[119,120,121,37,122,97,123,124,40,125,90,126,100,127,128,103,104,129,130,36],"exposure analysis","analysis","unknown","credentials","collection","ufw","ports","internet","local","scope","reconstruction","operator",{"skillNo":132,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":136,"publishedAt":43},"01M70P8QATMPKA78E4FT5D2TNA","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[135],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[92,90,91,99,37,107,95,94,102,96,97,98,40,106,100,101,93,103,104,105],{"skillNo":138,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":143,"publishedAt":43},"01M70NMPVJ5H0JH131P60FW4R8","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fforensics-complete\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[141,142],{"categoryNo":115,"categoryName":116,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[120,119,103,122,97,123,40,121,90,126,100,127,128,37,104,125,124,129,130,36],{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":151,"publishedAt":43},"01M6CB4DDR0B4NNCFK7ZK7449H","fixture-skill","Exercise rule delivery.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frule-delivery\u002Fskills\u002Ffixture-skill\u002FSKILL.md",[150],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[152,153,154,155,156,157],"fixture skill","fixture","rule","delivery","true","exercise",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":165,"publishedAt":43},"01M6CB4AVK1W76MFMPP0JP32CJ","pi-local","Pi-local duplicate-precedence fixture.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fproviders\u002Fpi\u002Fproject\u002F.pi\u002Fskills\u002Fpi-local\u002FSKILL.md",[164],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[166,167,127,168,153],"pi","pi local","duplicate"]