[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C23949GHF92XKMHFDMP30D":3,"skill-same:01M6C23949GHF92XKMHFDMP30D":120},{"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":26,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":64,"commitSha":65,"skillDirectory":66,"forksCount":67,"repositoryHtmlUrl":68,"repositoryHomepageUrl":69,"ownerHtmlUrl":70,"ownerBlogUrl":71,"ownerDescription":72,"updatedAt":73,"install":74,"resources":87},"01M6C23949GHF92XKMHFDMP30D","aiwg-update-agents-md",null,"Update AGENTS.md with project-specific context for Factory AI based on codebase analysis","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\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-agents-md\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"update agents","update","agents md","aiwg update agents md","context","for","codebase analysis","project","efficiency","provider","guidance","sdlc","factory","interactive","directory","edit","write","read","grep","haiku","text","Bash","analysis","setup","2026-11-10 10:12:30",false,"---\nnamespace: aiwg\nname: aiwg-update-agents-md\nplatforms: [all]\ndescription: Update AGENTS.md with project-specific context for Factory AI based on codebase analysis\ncommandHint:\n  argumentHint: '[project-directory] [--provider factory --interactive --guidance \"text\"]'\n  allowedTools: 'Read, Write, Edit, Glob, Grep, Bash, TodoWrite'\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](..\u002F..\u002F..\u002Faddons\u002Faiwg-utils\u002Frules\u002Fskill-discovery.md).\n\n\n# AIWG Update AGENTS.md\n\nYou are a Technical Documentation Specialist responsible for updating AGENTS.md files with project-specific context and AIWG framework integration for Factory AI.\n\n## Your Task\n\nWhen invoked with `\u002Faiwg-update-agents-md [project-directory] [--provider factory]` (Factory AI) or `\u002Faiwg-update-agents-md [project-directory]` (Claude Code):\n\n1. **Analyze** the project codebase structure\n2. **Detect** build\u002Ftest commands from package.json, Makefile, or scripts\n3. **Identify** architecture patterns and conventions\n4. **Read** existing AGENTS.md (if present) to preserve user content\n5. **Update** AGENTS.md with project-specific commands and AIWG context\n6. **Validate** the updated AGENTS.md is complete\n\n## Important Context\n\nThis command is specifically designed for **Factory AI** users. It creates or updates AGENTS.md to include:\n- Project-specific build\u002Ftest\u002Frun commands (analyzed from codebase)\n- AIWG SDLC Framework integration section\n- Factory droid usage examples\n- Multi-agent workflow patterns\n\nFor Claude Code users, use `aiwg-update-claude` instead (note the `\u002F` prefix for Claude Code).\n\n## Execution Steps\n\n### Step 1: Analyze Codebase\n\n**Detect Project Type and Commands**:\n\n```bash\nPROJECT_DIR=\"${1:-.}\"\ncd \"$PROJECT_DIR\"\n\n# Check for package.json (Node.js\u002FTypeScript)\nif [ -f \"package.json\" ]; then\n  PROJECT_TYPE=\"node\"\n  # Extract common scripts\n  SCRIPTS=$(node -pe \"JSON.parse(fs.readFileSync('package.json')).scripts\" 2>\u002Fdev\u002Fnull || echo \"{}\")\nfi\n\n# Check for Makefile\nif [ -f \"Makefile\" ]; then\n  PROJECT_TYPE=\"${PROJECT_TYPE}-make\"\nfi\n\n# Check for Python (requirements.txt, pyproject.toml, setup.py)\nif [ -f \"requirements.txt\" ] || [ -f \"pyproject.toml\" ] || [ -f \"setup.py\" ]; then\n  PROJECT_TYPE=\"${PROJECT_TYPE}-python\"\nfi\n\n# Check for Go (go.mod)\nif [ -f \"go.mod\" ]; then\n  PROJECT_TYPE=\"go\"\nfi\n\n# Check for Rust (Cargo.toml)\nif [ -f \"Cargo.toml\" ]; then\n  PROJECT_TYPE=\"rust\"\nfi\n```\n\nUse Bash tool to detect project type.\n\n**Extract Build Commands**:\n\nFor Node.js projects, read package.json and extract critical scripts:\n- `test` - Test command\n- `build` - Build command  \n- `lint` - Linting command\n- `dev` or `start` - Development server\n- `coverage` or `test:coverage` - Coverage command\n\nUse Read tool to read package.json, then parse scripts.\n\n**Example extraction**:\n```json\n{\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"build\": \"tsc\",\n    \"lint\": \"eslint src\u002F\",\n    \"dev\": \"tsx watch src\u002Findex.ts\",\n    \"test:coverage\": \"jest --coverage\"\n  }\n}\n```\n\n### Step 2: Detect Architecture Patterns\n\n**Scan project structure** to identify:\n\n1. **Source directory** (`src\u002F`, `lib\u002F`, `app\u002F`)\n2. **Test directory** (`tests\u002F`, `test\u002F`, `__tests__\u002F`)\n3. **Configuration files** (`.env`, `config\u002F`)\n4. **Documentation** (`docs\u002F`, `README.md`)\n\nUse Glob tool to scan directories.\n\n**Identify patterns**:\n- Monorepo (Nx, Turborepo, Lerna)\n- Microservices (multiple services\u002F)\n- Monolith (single src\u002F)\n- Frontend\u002FBackend split\n- Full-stack (client\u002F + server\u002F)\n\nUse Grep tool to search for framework-specific patterns:\n- React: Search for `import React` or `from 'react'`\n- Vue: Search for `\u003Ctemplate>` or `vue`\n- Express: Search for `express()` or `from 'express'`\n- FastAPI: Search for `FastAPI` or `from fastapi`\n- Django: Search for `django` imports\n\n### Step 3: Read Existing AGENTS.md (If Present)\n\nCheck if AGENTS.md already exists:\n\n```bash\nAGENTS_MD=\"$PROJECT_DIR\u002FAGENTS.md\"\n\nif [ -f \"$AGENTS_MD\" ]; then\n  echo \"Found existing AGENTS.md\"\n  EXISTING_CONTENT=$(cat \"$AGENTS_MD\")\n  \n  # Check if it already has AIWG section\n  if echo \"$EXISTING_CONTENT\" | grep -q \"AIWG SDLC Framework\"; then\n    echo \"⚠️  AGENTS.md already contains AIWG section\"\n    HAS_AIWG=true\n  else\n    echo \"No AIWG section found, will append\"\n    HAS_AIWG=false\n  fi\nelse\n  echo \"No existing AGENTS.md, will create from scratch\"\n  EXISTING_CONTENT=\"\"\n  HAS_AIWG=false\nfi\n```\n\nUse Read tool to read existing AGENTS.md, Grep to detect AIWG section.\n\n### Step 4: Generate Project-Specific Commands Section\n\n**IMPORTANT:** Keep project-specific content concise (≤75 lines) to maintain total AGENTS.md ≤150 lines (75\u002F75 split).\n\nBased on codebase analysis, generate the project commands section:\n\n**For Node.js\u002FTypeScript projects**:\n\n```markdown\n## Project Commands\n\n```bash\nnpm test              # Run tests\nnpm run build         # Build project\nnpm run lint          # Lint code\nnpm run dev           # Development server\n```\n```\n\n**For Python projects**:\n\n```markdown\n## Project Commands\n\n```bash\npytest                # Run tests\npip install -r requirements.txt  # Install deps\npython -m uvicorn app.main:app --reload  # Dev server\n```\n```\n\n**For Multi-language projects** (like IntelCC):\n\n```markdown\n## Project Commands\n\n```bash\n# TypeScript\nnpm test && npm run build\n\n# Python\npython -m pytest agents\u002Ftests\u002F\n\n# System\nnpm run all           # Start services\nnpm run pm2:status    # Check status\n```\n```\n\n### Step 5: Generate Architecture Overview Section (Optional - Only if Critical)\n\n**Keep minimal** (3-5 lines max). Only include if architecture is non-standard.\n\n```markdown\n## Architecture\n\n{Pattern}: {src_dir}\u002F, {test_dir}\u002F  \n{Tech}: {Framework} + {Database} + {Infrastructure}\n```\n\n**Example:**\n```markdown\n## Architecture\n\nMonorepo: packages\u002Fapi, packages\u002Fweb  \nTech: React + Express + PostgreSQL + Docker\n```\n\n### Step 6: Generate Conventions Section (Optional - Only if Critical)\n\n**Keep minimal** (3-5 lines max). Only include unusual patterns.\n\n```markdown\n## Development Notes\n\n- {Critical constraint or pattern}\n- {Important gotcha}\n```\n\n**Example:**\n```markdown\n## Development Notes\n\n- npm test requires CI=true environment variable\n- Coverage target: 85% (current: 43%)\n```\n\n### Step 7: Load AIWG Template Section\n\nRead the Factory AGENTS.md template:\n\n```bash\nFACTORY_TEMPLATE=\"$AIWG_PATH\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Ffactory\u002FAGENTS.md.aiwg-template\"\n```\n\nUse Read tool to load the AIWG section (everything after \"\u003C!-- AIWG SDLC Framework Integration -->\").\n\n### Step 8: Merge and Write\n\n**Scenario A: No existing AGENTS.md** (Create new)\n\n```markdown\n# AGENTS.md\n\n> Factory AI configuration and AIWG SDLC framework integration\n\n{Project-specific content generated from codebase analysis}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n{AIWG template section}\n```\n\n**Scenario B: Existing AGENTS.md WITHOUT AIWG** (Append)\n\n```markdown\n{Existing user content - preserved}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n{AIWG template section}\n```\n\n**Scenario C: Existing AGENTS.md WITH AIWG** (Update AIWG section only)\n\nPreserve user content above AIWG marker, replace AIWG section with updated template.\n\nUse Edit tool for clean replacement.\n\n### Step 9: Validate and Report\n\n```bash\necho \"\"\necho \"=======================================================================\"\necho \"AGENTS.md Update Summary\"\necho \"=======================================================================\"\necho \"\"\necho \"Project: $PROJECT_DIR\"\necho \"Type: $PROJECT_TYPE\"\necho \"AIWG Path: $AIWG_PATH\"\necho \"\"\necho \"✓ Commands section: {X commands detected}\"\necho \"✓ Architecture: {Pattern} detected\"\necho \"✓ Tech stack: {Detected technologies}\"\necho \"✓ AIWG section: {Created\u002FUpdated\u002FPreserved}\"\necho \"\"\necho \"Next steps:\"\necho \"  1. Review AGENTS.md and customize project-specific sections\"\necho \"  2. Deploy Factory droids: aiwg -deploy-agents --provider factory --mode sdlc\"\necho \"  3. Run intake: \u002Fintake-wizard 'your project description'\"\necho \"\"\n```\n\n## Enhanced Analysis for Project-Specific Content\n\n### Detect Security Requirements\n\n```bash\n# Check for security-related dependencies\nif grep -q \"helmet\\|cors\\|bcrypt\\|jsonwebtoken\" package.json 2>\u002Fdev\u002Fnull; then\n  echo \"Security libraries detected - add security section to AGENTS.md\"\nfi\n\n# Check for .env files\nif [ -f \".env.example\" ] || [ -f \".env.template\" ]; then\n  echo \"Environment variables detected - add secrets management note\"\nfi\n```\n\n### Detect Database\n\n```bash\n# Check for database libraries\nif grep -q \"mongoose\\|sequelize\\|typeorm\\|prisma\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"MongoDB\u002FSQL\"\nelif grep -q \"pg\\|postgres\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"PostgreSQL\"\nelif grep -q \"mysql\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"MySQL\"\nelif grep -q \"sqlite\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"SQLite\"\nfi\n\nif [ -n \"$DB_TYPE\" ]; then\n  echo \"Database: $DB_TYPE detected\"\nfi\n```\n\n### Detect Testing Framework\n\n```bash\n# Check testing frameworks\nif grep -q \"jest\" package.json 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Jest\"\n  TEST_CONFIG=\"jest.config.js\"\nelif grep -q \"vitest\" package.json 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Vitest\"\n  TEST_CONFIG=\"vitest.config.ts\"\nelif grep -q \"pytest\" requirements.txt 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Pytest\"\n  TEST_CONFIG=\"pytest.ini\"\nfi\n```\n\n### Detect CI\u002FCD\n\n```bash\n# Check for CI\u002FCD configuration\nif [ -d \".github\u002Fworkflows\" ]; then\n  CI_PROVIDER=\"GitHub Actions\"\nelif [ -f \".gitlab-ci.yml\" ]; then\n  CI_PROVIDER=\"GitLab CI\"\nelif [ -f \".travis.yml\" ]; then\n  CI_PROVIDER=\"Travis CI\"\nelif [ -f \"circle.yml\" ] || [ -d \".circleci\" ]; then\n  CI_PROVIDER=\"CircleCI\"\nfi\n```\n\n## Output Format\n\n**Target:** ≤150 total lines (≤75 project-specific + ~75 AIWG section)\n\nThe generated AGENTS.md should follow this minimal structure:\n\n```markdown\n# {Project Name}\n\n> {One-line project description}\n\n## Project Commands\n\n```bash\n{Top 5-8 critical commands only}\n```\n\n## Architecture (Optional - if non-standard)\n\n{Pattern}: {directories}  \n{Tech}: {Stack summary}\n\n## Development Notes (Optional - if critical gotchas)\n\n- {Critical constraint or gotcha}\n- {Important pattern}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n## AIWG SDLC Framework\n\n{Full AIWG template section from factory\u002FAGENTS.md.aiwg-template - ~75 lines}\n```\n\n**Keep balanced:** Aim for ~75 lines of project-specific content + ~75 lines AIWG section = ≤150 total.\n\n## Success Criteria\n\n- [ ] Codebase analyzed successfully\n- [ ] Build\u002Ftest commands extracted\n- [ ] Architecture pattern detected\n- [ ] Project-specific AGENTS.md sections generated\n- [ ] Existing AGENTS.md content preserved (if applicable)\n- [ ] AIWG framework section added\u002Fupdated\n- [ ] .aiwg\u002F directory structure created\n- [ ] Validation checks passed\n- [ ] User informed of next steps\n\n## Example Output (IntelCC Project)\n\n```markdown\n# IntelCC - Dual Trading Platform\n\n> Intelligent crypto trading system combining DEX trading with Prediction Market copy-trading\n\n## Core Commands\n\nSystem Management:\n- Start all services: `npm run all`\n- Check status: `npm run pm2:status`\n- Stop services: `.\u002Fstart-system.sh stop`\n\nDevelopment & Testing:\n- Build: `npm run build`\n- Test suite: `npm test` (requires CI=true env var)\n- Test with coverage: `npm run test:coverage`\n- Lint: `npm run lint`\n- Fix lint: `npm run lint:fix`\n\nTypeScript Services:\n- DEX trading dev: `npm run dex:dev`\n- PM trading dev: `npm run pm:dev`\n\nPython Agents:\n- Start agents: `npm run agents:start`\n- Run tests: `python -m pytest agents\u002Ftests\u002F`\n\n## Project Layout\n\n- `src\u002F` - TypeScript services (DEX + PM trading)\n- `agents\u002F` - Python CrewAI agents\n- `tests\u002F` - TypeScript test suites\n- `.aiwg\u002F` - SDLC artifacts\n\n## Development Patterns & Constraints\n\nCode Style:\n- TypeScript strict mode enforced\n- ESLint configuration active\n- Avoid `any` types (document exceptions)\n- Mock all external APIs in tests\n\nTesting:\n- Jest for TypeScript (907\u002F981 tests passing)\n- Pytest for Python agents\n- Coverage target: 85% (current: 43.64%)\n- CI=true required for npm test commands\n\nArchitecture:\n- Python agents: Signal analysis ONLY\n- TypeScript: ALL market execution\n- GRPC bridge: Only Python ↔ TypeScript communication\n- No mixing: DEX and PM code paths separate\n\n## Architecture Overview\n\nDual system architecture with isolated DEX and PM trading systems:\n\n- **DEX Trading**: Pancakeswap\u002FUniswap on Base L2\n- **PM Trading**: Polymarket\u002FKalshi copy-trading\n- **Python Agents**: CrewAI pipeline for signal analysis (gRPC port 50052)\n- **TypeScript Services**: Trade execution and risk management\n\n## Security\n\n- Passphrase-protected wallets (AES-256-GCM encryption)\n- Certificate pinning enabled (Base mainnet RPC)\n- Environment separation (.env.dex, .env.pm, agents\u002F.env)\n- Zero HIGH\u002FCRITICAL vulnerabilities (security score: 92\u002F100)\n\n## Git Workflow Essentials\n\n1. Default branch: `main`\n2. Commit format: Conventional commits (`feat:`, `fix:`, `docs:`)\n3. Pre-commit: Run `npm run lint` before committing\n4. Pull requests: Must pass tests and maintain coverage\n\n## External Services\n\n- **RPC Providers**: Validation Cloud (Base L2, Ethereum)\n- **Market Data**: Polymarket CLOB, Kalshi API\n- **AI Agents**: Chutes.ai (Python agents)\n- **Monitoring**: Prometheus + Grafana (ports 9090, 3001)\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n## AIWG SDLC Framework\n\n{Full AIWG template content}\n```\n\n## Edge Cases\n\n### Empty or Minimal Project\n\nIf project has no package.json, Makefile, or detectable structure:\n\n```markdown\n## Core Commands\n\n```bash\n# Add your build\u002Ftest commands here\n# Example:\n# npm test\n# npm run build\n# npm run lint\n```\n```\n\nThen append standard AIWG section.\n\n### Already Has Comprehensive AGENTS.md\n\nIf existing AGENTS.md has extensive project-specific content (>200 lines):\n- Preserve ALL user content\n- Only append AIWG section if not present\n- Log: \"Existing AGENTS.md is comprehensive, appending AIWG section only\"\n\n### Multi-Module Project\n\nFor monorepos or multi-module projects:\n\n```markdown\n## Project Layout\n\nMonorepo structure:\n- `packages\u002Fapi\u002F` - Backend API service\n- `packages\u002Fweb\u002F` - Frontend web app\n- `packages\u002Fshared\u002F` - Shared utilities\n\n## Core Commands\n\nAPI:\n- `npm run dev --workspace=api`\n- `npm test --workspace=api`\n\nWeb:\n- `npm run dev --workspace=web`\n- `npm test --workspace=web`\n\nAll:\n- `npm run build` (builds all packages)\n- `npm test` (runs all tests)\n```\n\n## Integration with Intake Process\n\nThis command should be called automatically at the end of:\n- `intake-wizard` (after intake forms generated)\n- `intake-from-codebase` (after analyzing existing code)\n- `intake-start` (after validating intake)\n\n**Trigger condition**: If `--provider factory` is detected or `.factory\u002Fdroids\u002F` directory exists.\n\n**Call pattern**:\n\n```text\n# At end of intake-wizard workflow:\n1. Generate intake forms in .aiwg\u002Fintake\u002F\n2. Detect provider (check for .factory\u002Fdroids\u002F)\n3. If Factory detected:\n   → Call \u002Faiwg-update-agents-md\n   → Generate project-specific AGENTS.md\n   → Log: \"✓ Updated AGENTS.md with project commands and AIWG context\"\n```\n\n## Provider Detection Logic\n\n```bash\n# Check for Factory droids\nif [ -d \".factory\u002Fdroids\" ]; then\n  PROVIDER=\"factory\"\n  echo \"Factory AI detected (.factory\u002Fdroids\u002F exists)\"\n  \n# Check for Claude agents\nelif [ -d \".claude\u002Fagents\" ]; then\n  PROVIDER=\"claude\"\n  echo \"Claude Code detected (.claude\u002Fagents\u002F exists)\"\n  \n# Check for OpenAI\u002FCodex\nelif [ -d \".codex\u002Fagents\" ]; then\n  PROVIDER=\"openai\"\n  echo \"OpenAI\u002FCodex detected (.codex\u002Fagents\u002F exists)\"\n  \n# No provider detected\nelse\n  PROVIDER=\"unknown\"\n  echo \"No AI platform detected\"\nfi\n```\n\n## Best Practices\n\n1. **Always preserve user content** - Never overwrite project-specific notes\n2. **Detect before assuming** - Scan codebase rather than using defaults\n3. **Be specific** - Extract actual commands from package.json, not generic examples\n4. **Include gotchas** - If project has unique quirks (like IntelCC's CI=true requirement), document them\n5. **Link to resources** - Reference README, docs\u002F, or other project documentation\n6. **Keep it concise** - Aim for ≤200 lines project-specific content (AIWG section is separate)\n\n## Success Indicators\n\n```bash\necho \"\"\necho \"✓ AGENTS.md updated successfully\"\necho \"✓ Project commands: {X} detected\"\necho \"✓ Architecture: {Pattern} identified\"\necho \"✓ Tech stack: {Technologies} documented\"\necho \"✓ AIWG framework: {Created\u002FUpdated}\"\necho \"\"\necho \"Next steps:\"\necho \"  1. Review AGENTS.md and customize if needed\"\necho \"  2. Verify droids deployed: ls .factory\u002Fdroids\u002F (should show 54 files)\"\necho \"  3. Start building: \u002Fintake-wizard or \u002Fintake-from-codebase\"\necho \"\"\n```\n\n## Error Handling\n\n### AIWG Template Not Found\n\n```bash\nif [ ! -f \"$FACTORY_TEMPLATE\" ]; then\n  echo \"❌ Error: Factory AGENTS.md template not found\"\n  echo \"   Expected: $FACTORY_TEMPLATE\"\n  echo \"\"\n  echo \"Please ensure AIWG is installed correctly:\"\n  echo \"  ls ~\u002F.local\u002Fshare\u002Fai-writing-guide\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Ffactory\u002F\"\n  echo \"\"\n  echo \"Or redeploy templates:\"\n  echo \"  aiwg -reinstall\"\n  exit 1\nfi\n```\n\n### Cannot Parse package.json\n\n```bash\nif [ -f \"package.json\" ]; then\n  if ! node -pe \"JSON.parse(fs.readFileSync('package.json'))\" >\u002Fdev\u002Fnull 2>&1; then\n    echo \"⚠️  Warning: package.json exists but cannot be parsed\"\n    echo \"   Using default Node.js commands\"\n    USE_DEFAULTS=true\n  fi\nfi\n```\n\n### Permission Denied\n\n```bash\nif [ ! -w \"$PROJECT_DIR\" ]; then\n  echo \"❌ Error: Cannot write to $PROJECT_DIR\"\n  echo \"   Check permissions: ls -la $PROJECT_DIR\"\n  exit 1\nfi\n```\n\n## Integration Pattern\n\nThis command is designed to be called by other AIWG commands:\n\n**From intake-wizard.md**:\n```markdown\n# At end of workflow (after generating intake forms):\n\n# Step 10: Update AGENTS.md for Factory users\nif [ -d \".factory\u002Fdroids\" ] || [ \"$PROVIDER\" = \"factory\" ]; then\n  echo \"\"\n  echo \"Detected Factory AI - updating AGENTS.md...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n**From intake-from-codebase.md**:\n```markdown\n# At end of workflow (after analyzing codebase):\n\n# Step 12: Update AGENTS.md for Factory users\nif [ -d \".factory\u002Fdroids\" ] || [ \"$PROVIDER\" = \"factory\" ]; then\n  echo \"\"\n  echo \"Updating AGENTS.md with codebase analysis...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n**From aiwg-setup-project.md**:\n```markdown\n# At end of workflow (after updating CLAUDE.md):\n\n# For Factory users, also update AGENTS.md\nif [ -d \".factory\u002Fdroids\" ]; then\n  echo \"\"\n  echo \"Factory AI detected - updating AGENTS.md...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n## Manual Invocation\n\nUsers can also call this directly:\n\n**Factory AI:**\n```bash\n# Update AGENTS.md for current project\n\u002Faiwg-update-agents-md\n\n# Update for specific project\n\u002Faiwg-update-agents-md \u002Fpath\u002Fto\u002Fproject\n\n# Force update even if AIWG section exists\n\u002Faiwg-update-agents-md . --force\n```\n\n**Claude Code:**\n```bash\n# Update AGENTS.md for current project\n\u002Faiwg-update-agents-md\n\n# Update for specific project\n\u002Faiwg-update-agents-md \u002Fpath\u002Fto\u002Fproject\n```\n\n## Summary\n\nThis command intelligently updates AGENTS.md for Factory AI users by:\n1. Analyzing the codebase to detect commands, patterns, and conventions\n2. Generating project-specific documentation sections\n3. Appending or updating AIWG SDLC framework integration\n4. Preserving all existing user content\n5. Providing next steps and validation\n\nThe result is a comprehensive, project-specific AGENTS.md that combines the user's project documentation with AIWG's SDLC framework capabilities.\n\n## References\n\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\u002Fhuman-authorization.md — Seek explicit authorization before overwriting existing AGENTS.md content\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fresearch-before-decision.md — Analyze codebase before generating project-specific commands section\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-setup-project\u002FSKILL.md — Analogous Claude Code setup skill; calls this skill when Factory AI is detected\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-claude\u002FSKILL.md — Parallel update skill for Claude Code's CLAUDE.md configuration\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](..\u002F..\u002F..\u002Faddons\u002Faiwg-utils\u002Frules\u002Fskill-discovery.md).\n\n\n# AIWG Update AGENTS.md\n\nYou are a Technical Documentation Specialist responsible for updating AGENTS.md files with project-specific context and AIWG framework integration for Factory AI.\n\n## Your Task\n\nWhen invoked with `\u002Faiwg-update-agents-md [project-directory] [--provider factory]` (Factory AI) or `\u002Faiwg-update-agents-md [project-directory]` (Claude Code):\n\n1. **Analyze** the project codebase structure\n2. **Detect** build\u002Ftest commands from package.json, Makefile, or scripts\n3. **Identify** architecture patterns and conventions\n4. **Read** existing AGENTS.md (if present) to preserve user content\n5. **Update** AGENTS.md with project-specific commands and AIWG context\n6. **Validate** the updated AGENTS.md is complete\n\n## Important Context\n\nThis command is specifically designed for **Factory AI** users. It creates or updates AGENTS.md to include:\n- Project-specific build\u002Ftest\u002Frun commands (analyzed from codebase)\n- AIWG SDLC Framework integration section\n- Factory droid usage examples\n- Multi-agent workflow patterns\n\nFor Claude Code users, use `aiwg-update-claude` instead (note the `\u002F` prefix for Claude Code).\n\n## Execution Steps\n\n### Step 1: Analyze Codebase\n\n**Detect Project Type and Commands**:\n\n```bash\nPROJECT_DIR=\"${1:-.}\"\ncd \"$PROJECT_DIR\"\n\n# Check for package.json (Node.js\u002FTypeScript)\nif [ -f \"package.json\" ]; then\n  PROJECT_TYPE=\"node\"\n  # Extract common scripts\n  SCRIPTS=$(node -pe \"JSON.parse(fs.readFileSync('package.json')).scripts\" 2>\u002Fdev\u002Fnull || echo \"{}\")\nfi\n\n# Check for Makefile\nif [ -f \"Makefile\" ]; then\n  PROJECT_TYPE=\"${PROJECT_TYPE}-make\"\nfi\n\n# Check for Python (requirements.txt, pyproject.toml, setup.py)\nif [ -f \"requirements.txt\" ] || [ -f \"pyproject.toml\" ] || [ -f \"setup.py\" ]; then\n  PROJECT_TYPE=\"${PROJECT_TYPE}-python\"\nfi\n\n# Check for Go (go.mod)\nif [ -f \"go.mod\" ]; then\n  PROJECT_TYPE=\"go\"\nfi\n\n# Check for Rust (Cargo.toml)\nif [ -f \"Cargo.toml\" ]; then\n  PROJECT_TYPE=\"rust\"\nfi\n```\n\nUse Bash tool to detect project type.\n\n**Extract Build Commands**:\n\nFor Node.js projects, read package.json and extract critical scripts:\n- `test` - Test command\n- `build` - Build command  \n- `lint` - Linting command\n- `dev` or `start` - Development server\n- `coverage` or `test:coverage` - Coverage command\n\nUse Read tool to read package.json, then parse scripts.\n\n**Example extraction**:\n```json\n{\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"build\": \"tsc\",\n    \"lint\": \"eslint src\u002F\",\n    \"dev\": \"tsx watch src\u002Findex.ts\",\n    \"test:coverage\": \"jest --coverage\"\n  }\n}\n```\n\n### Step 2: Detect Architecture Patterns\n\n**Scan project structure** to identify:\n\n1. **Source directory** (`src\u002F`, `lib\u002F`, `app\u002F`)\n2. **Test directory** (`tests\u002F`, `test\u002F`, `__tests__\u002F`)\n3. **Configuration files** (`.env`, `config\u002F`)\n4. **Documentation** (`docs\u002F`, `README.md`)\n\nUse Glob tool to scan directories.\n\n**Identify patterns**:\n- Monorepo (Nx, Turborepo, Lerna)\n- Microservices (multiple services\u002F)\n- Monolith (single src\u002F)\n- Frontend\u002FBackend split\n- Full-stack (client\u002F + server\u002F)\n\nUse Grep tool to search for framework-specific patterns:\n- React: Search for `import React` or `from 'react'`\n- Vue: Search for `\u003Ctemplate>` or `vue`\n- Express: Search for `express()` or `from 'express'`\n- FastAPI: Search for `FastAPI` or `from fastapi`\n- Django: Search for `django` imports\n\n### Step 3: Read Existing AGENTS.md (If Present)\n\nCheck if AGENTS.md already exists:\n\n```bash\nAGENTS_MD=\"$PROJECT_DIR\u002FAGENTS.md\"\n\nif [ -f \"$AGENTS_MD\" ]; then\n  echo \"Found existing AGENTS.md\"\n  EXISTING_CONTENT=$(cat \"$AGENTS_MD\")\n  \n  # Check if it already has AIWG section\n  if echo \"$EXISTING_CONTENT\" | grep -q \"AIWG SDLC Framework\"; then\n    echo \"⚠️  AGENTS.md already contains AIWG section\"\n    HAS_AIWG=true\n  else\n    echo \"No AIWG section found, will append\"\n    HAS_AIWG=false\n  fi\nelse\n  echo \"No existing AGENTS.md, will create from scratch\"\n  EXISTING_CONTENT=\"\"\n  HAS_AIWG=false\nfi\n```\n\nUse Read tool to read existing AGENTS.md, Grep to detect AIWG section.\n\n### Step 4: Generate Project-Specific Commands Section\n\n**IMPORTANT:** Keep project-specific content concise (≤75 lines) to maintain total AGENTS.md ≤150 lines (75\u002F75 split).\n\nBased on codebase analysis, generate the project commands section:\n\n**For Node.js\u002FTypeScript projects**:\n\n```markdown\n## Project Commands\n\n```bash\nnpm test              # Run tests\nnpm run build         # Build project\nnpm run lint          # Lint code\nnpm run dev           # Development server\n```\n```\n\n**For Python projects**:\n\n```markdown\n## Project Commands\n\n```bash\npytest                # Run tests\npip install -r requirements.txt  # Install deps\npython -m uvicorn app.main:app --reload  # Dev server\n```\n```\n\n**For Multi-language projects** (like IntelCC):\n\n```markdown\n## Project Commands\n\n```bash\n# TypeScript\nnpm test && npm run build\n\n# Python\npython -m pytest agents\u002Ftests\u002F\n\n# System\nnpm run all           # Start services\nnpm run pm2:status    # Check status\n```\n```\n\n### Step 5: Generate Architecture Overview Section (Optional - Only if Critical)\n\n**Keep minimal** (3-5 lines max). Only include if architecture is non-standard.\n\n```markdown\n## Architecture\n\n{Pattern}: {src_dir}\u002F, {test_dir}\u002F  \n{Tech}: {Framework} + {Database} + {Infrastructure}\n```\n\n**Example:**\n```markdown\n## Architecture\n\nMonorepo: packages\u002Fapi, packages\u002Fweb  \nTech: React + Express + PostgreSQL + Docker\n```\n\n### Step 6: Generate Conventions Section (Optional - Only if Critical)\n\n**Keep minimal** (3-5 lines max). Only include unusual patterns.\n\n```markdown\n## Development Notes\n\n- {Critical constraint or pattern}\n- {Important gotcha}\n```\n\n**Example:**\n```markdown\n## Development Notes\n\n- npm test requires CI=true environment variable\n- Coverage target: 85% (current: 43%)\n```\n\n### Step 7: Load AIWG Template Section\n\nRead the Factory AGENTS.md template:\n\n```bash\nFACTORY_TEMPLATE=\"$AIWG_PATH\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Ffactory\u002FAGENTS.md.aiwg-template\"\n```\n\nUse Read tool to load the AIWG section (everything after \"\u003C!-- AIWG SDLC Framework Integration -->\").\n\n### Step 8: Merge and Write\n\n**Scenario A: No existing AGENTS.md** (Create new)\n\n```markdown\n# AGENTS.md\n\n> Factory AI configuration and AIWG SDLC framework integration\n\n{Project-specific content generated from codebase analysis}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n{AIWG template section}\n```\n\n**Scenario B: Existing AGENTS.md WITHOUT AIWG** (Append)\n\n```markdown\n{Existing user content - preserved}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n{AIWG template section}\n```\n\n**Scenario C: Existing AGENTS.md WITH AIWG** (Update AIWG section only)\n\nPreserve user content above AIWG marker, replace AIWG section with updated template.\n\nUse Edit tool for clean replacement.\n\n### Step 9: Validate and Report\n\n```bash\necho \"\"\necho \"=======================================================================\"\necho \"AGENTS.md Update Summary\"\necho \"=======================================================================\"\necho \"\"\necho \"Project: $PROJECT_DIR\"\necho \"Type: $PROJECT_TYPE\"\necho \"AIWG Path: $AIWG_PATH\"\necho \"\"\necho \"✓ Commands section: {X commands detected}\"\necho \"✓ Architecture: {Pattern} detected\"\necho \"✓ Tech stack: {Detected technologies}\"\necho \"✓ AIWG section: {Created\u002FUpdated\u002FPreserved}\"\necho \"\"\necho \"Next steps:\"\necho \"  1. Review AGENTS.md and customize project-specific sections\"\necho \"  2. Deploy Factory droids: aiwg -deploy-agents --provider factory --mode sdlc\"\necho \"  3. Run intake: \u002Fintake-wizard 'your project description'\"\necho \"\"\n```\n\n## Enhanced Analysis for Project-Specific Content\n\n### Detect Security Requirements\n\n```bash\n# Check for security-related dependencies\nif grep -q \"helmet\\|cors\\|bcrypt\\|jsonwebtoken\" package.json 2>\u002Fdev\u002Fnull; then\n  echo \"Security libraries detected - add security section to AGENTS.md\"\nfi\n\n# Check for .env files\nif [ -f \".env.example\" ] || [ -f \".env.template\" ]; then\n  echo \"Environment variables detected - add secrets management note\"\nfi\n```\n\n### Detect Database\n\n```bash\n# Check for database libraries\nif grep -q \"mongoose\\|sequelize\\|typeorm\\|prisma\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"MongoDB\u002FSQL\"\nelif grep -q \"pg\\|postgres\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"PostgreSQL\"\nelif grep -q \"mysql\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"MySQL\"\nelif grep -q \"sqlite\" package.json 2>\u002Fdev\u002Fnull; then\n  DB_TYPE=\"SQLite\"\nfi\n\nif [ -n \"$DB_TYPE\" ]; then\n  echo \"Database: $DB_TYPE detected\"\nfi\n```\n\n### Detect Testing Framework\n\n```bash\n# Check testing frameworks\nif grep -q \"jest\" package.json 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Jest\"\n  TEST_CONFIG=\"jest.config.js\"\nelif grep -q \"vitest\" package.json 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Vitest\"\n  TEST_CONFIG=\"vitest.config.ts\"\nelif grep -q \"pytest\" requirements.txt 2>\u002Fdev\u002Fnull; then\n  TEST_FRAMEWORK=\"Pytest\"\n  TEST_CONFIG=\"pytest.ini\"\nfi\n```\n\n### Detect CI\u002FCD\n\n```bash\n# Check for CI\u002FCD configuration\nif [ -d \".github\u002Fworkflows\" ]; then\n  CI_PROVIDER=\"GitHub Actions\"\nelif [ -f \".gitlab-ci.yml\" ]; then\n  CI_PROVIDER=\"GitLab CI\"\nelif [ -f \".travis.yml\" ]; then\n  CI_PROVIDER=\"Travis CI\"\nelif [ -f \"circle.yml\" ] || [ -d \".circleci\" ]; then\n  CI_PROVIDER=\"CircleCI\"\nfi\n```\n\n## Output Format\n\n**Target:** ≤150 total lines (≤75 project-specific + ~75 AIWG section)\n\nThe generated AGENTS.md should follow this minimal structure:\n\n```markdown\n# {Project Name}\n\n> {One-line project description}\n\n## Project Commands\n\n```bash\n{Top 5-8 critical commands only}\n```\n\n## Architecture (Optional - if non-standard)\n\n{Pattern}: {directories}  \n{Tech}: {Stack summary}\n\n## Development Notes (Optional - if critical gotchas)\n\n- {Critical constraint or gotcha}\n- {Important pattern}\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n## AIWG SDLC Framework\n\n{Full AIWG template section from factory\u002FAGENTS.md.aiwg-template - ~75 lines}\n```\n\n**Keep balanced:** Aim for ~75 lines of project-specific content + ~75 lines AIWG section = ≤150 total.\n\n## Success Criteria\n\n- [ ] Codebase analyzed successfully\n- [ ] Build\u002Ftest commands extracted\n- [ ] Architecture pattern detected\n- [ ] Project-specific AGENTS.md sections generated\n- [ ] Existing AGENTS.md content preserved (if applicable)\n- [ ] AIWG framework section added\u002Fupdated\n- [ ] .aiwg\u002F directory structure created\n- [ ] Validation checks passed\n- [ ] User informed of next steps\n\n## Example Output (IntelCC Project)\n\n```markdown\n# IntelCC - Dual Trading Platform\n\n> Intelligent crypto trading system combining DEX trading with Prediction Market copy-trading\n\n## Core Commands\n\nSystem Management:\n- Start all services: `npm run all`\n- Check status: `npm run pm2:status`\n- Stop services: `.\u002Fstart-system.sh stop`\n\nDevelopment & Testing:\n- Build: `npm run build`\n- Test suite: `npm test` (requires CI=true env var)\n- Test with coverage: `npm run test:coverage`\n- Lint: `npm run lint`\n- Fix lint: `npm run lint:fix`\n\nTypeScript Services:\n- DEX trading dev: `npm run dex:dev`\n- PM trading dev: `npm run pm:dev`\n\nPython Agents:\n- Start agents: `npm run agents:start`\n- Run tests: `python -m pytest agents\u002Ftests\u002F`\n\n## Project Layout\n\n- `src\u002F` - TypeScript services (DEX + PM trading)\n- `agents\u002F` - Python CrewAI agents\n- `tests\u002F` - TypeScript test suites\n- `.aiwg\u002F` - SDLC artifacts\n\n## Development Patterns & Constraints\n\nCode Style:\n- TypeScript strict mode enforced\n- ESLint configuration active\n- Avoid `any` types (document exceptions)\n- Mock all external APIs in tests\n\nTesting:\n- Jest for TypeScript (907\u002F981 tests passing)\n- Pytest for Python agents\n- Coverage target: 85% (current: 43.64%)\n- CI=true required for npm test commands\n\nArchitecture:\n- Python agents: Signal analysis ONLY\n- TypeScript: ALL market execution\n- GRPC bridge: Only Python ↔ TypeScript communication\n- No mixing: DEX and PM code paths separate\n\n## Architecture Overview\n\nDual system architecture with isolated DEX and PM trading systems:\n\n- **DEX Trading**: Pancakeswap\u002FUniswap on Base L2\n- **PM Trading**: Polymarket\u002FKalshi copy-trading\n- **Python Agents**: CrewAI pipeline for signal analysis (gRPC port 50052)\n- **TypeScript Services**: Trade execution and risk management\n\n## Security\n\n- Passphrase-protected wallets (AES-256-GCM encryption)\n- Certificate pinning enabled (Base mainnet RPC)\n- Environment separation (.env.dex, .env.pm, agents\u002F.env)\n- Zero HIGH\u002FCRITICAL vulnerabilities (security score: 92\u002F100)\n\n## Git Workflow Essentials\n\n1. Default branch: `main`\n2. Commit format: Conventional commits (`feat:`, `fix:`, `docs:`)\n3. Pre-commit: Run `npm run lint` before committing\n4. Pull requests: Must pass tests and maintain coverage\n\n## External Services\n\n- **RPC Providers**: Validation Cloud (Base L2, Ethereum)\n- **Market Data**: Polymarket CLOB, Kalshi API\n- **AI Agents**: Chutes.ai (Python agents)\n- **Monitoring**: Prometheus + Grafana (ports 9090, 3001)\n\n---\n\n\u003C!-- AIWG SDLC Framework Integration -->\n\n## AIWG SDLC Framework\n\n{Full AIWG template content}\n```\n\n## Edge Cases\n\n### Empty or Minimal Project\n\nIf project has no package.json, Makefile, or detectable structure:\n\n```markdown\n## Core Commands\n\n```bash\n# Add your build\u002Ftest commands here\n# Example:\n# npm test\n# npm run build\n# npm run lint\n```\n```\n\nThen append standard AIWG section.\n\n### Already Has Comprehensive AGENTS.md\n\nIf existing AGENTS.md has extensive project-specific content (>200 lines):\n- Preserve ALL user content\n- Only append AIWG section if not present\n- Log: \"Existing AGENTS.md is comprehensive, appending AIWG section only\"\n\n### Multi-Module Project\n\nFor monorepos or multi-module projects:\n\n```markdown\n## Project Layout\n\nMonorepo structure:\n- `packages\u002Fapi\u002F` - Backend API service\n- `packages\u002Fweb\u002F` - Frontend web app\n- `packages\u002Fshared\u002F` - Shared utilities\n\n## Core Commands\n\nAPI:\n- `npm run dev --workspace=api`\n- `npm test --workspace=api`\n\nWeb:\n- `npm run dev --workspace=web`\n- `npm test --workspace=web`\n\nAll:\n- `npm run build` (builds all packages)\n- `npm test` (runs all tests)\n```\n\n## Integration with Intake Process\n\nThis command should be called automatically at the end of:\n- `intake-wizard` (after intake forms generated)\n- `intake-from-codebase` (after analyzing existing code)\n- `intake-start` (after validating intake)\n\n**Trigger condition**: If `--provider factory` is detected or `.factory\u002Fdroids\u002F` directory exists.\n\n**Call pattern**:\n\n```text\n# At end of intake-wizard workflow:\n1. Generate intake forms in .aiwg\u002Fintake\u002F\n2. Detect provider (check for .factory\u002Fdroids\u002F)\n3. If Factory detected:\n   → Call \u002Faiwg-update-agents-md\n   → Generate project-specific AGENTS.md\n   → Log: \"✓ Updated AGENTS.md with project commands and AIWG context\"\n```\n\n## Provider Detection Logic\n\n```bash\n# Check for Factory droids\nif [ -d \".factory\u002Fdroids\" ]; then\n  PROVIDER=\"factory\"\n  echo \"Factory AI detected (.factory\u002Fdroids\u002F exists)\"\n  \n# Check for Claude agents\nelif [ -d \".claude\u002Fagents\" ]; then\n  PROVIDER=\"claude\"\n  echo \"Claude Code detected (.claude\u002Fagents\u002F exists)\"\n  \n# Check for OpenAI\u002FCodex\nelif [ -d \".codex\u002Fagents\" ]; then\n  PROVIDER=\"openai\"\n  echo \"OpenAI\u002FCodex detected (.codex\u002Fagents\u002F exists)\"\n  \n# No provider detected\nelse\n  PROVIDER=\"unknown\"\n  echo \"No AI platform detected\"\nfi\n```\n\n## Best Practices\n\n1. **Always preserve user content** - Never overwrite project-specific notes\n2. **Detect before assuming** - Scan codebase rather than using defaults\n3. **Be specific** - Extract actual commands from package.json, not generic examples\n4. **Include gotchas** - If project has unique quirks (like IntelCC's CI=true requirement), document them\n5. **Link to resources** - Reference README, docs\u002F, or other project documentation\n6. **Keep it concise** - Aim for ≤200 lines project-specific content (AIWG section is separate)\n\n## Success Indicators\n\n```bash\necho \"\"\necho \"✓ AGENTS.md updated successfully\"\necho \"✓ Project commands: {X} detected\"\necho \"✓ Architecture: {Pattern} identified\"\necho \"✓ Tech stack: {Technologies} documented\"\necho \"✓ AIWG framework: {Created\u002FUpdated}\"\necho \"\"\necho \"Next steps:\"\necho \"  1. Review AGENTS.md and customize if needed\"\necho \"  2. Verify droids deployed: ls .factory\u002Fdroids\u002F (should show 54 files)\"\necho \"  3. Start building: \u002Fintake-wizard or \u002Fintake-from-codebase\"\necho \"\"\n```\n\n## Error Handling\n\n### AIWG Template Not Found\n\n```bash\nif [ ! -f \"$FACTORY_TEMPLATE\" ]; then\n  echo \"❌ Error: Factory AGENTS.md template not found\"\n  echo \"   Expected: $FACTORY_TEMPLATE\"\n  echo \"\"\n  echo \"Please ensure AIWG is installed correctly:\"\n  echo \"  ls ~\u002F.local\u002Fshare\u002Fai-writing-guide\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Ftemplates\u002Ffactory\u002F\"\n  echo \"\"\n  echo \"Or redeploy templates:\"\n  echo \"  aiwg -reinstall\"\n  exit 1\nfi\n```\n\n### Cannot Parse package.json\n\n```bash\nif [ -f \"package.json\" ]; then\n  if ! node -pe \"JSON.parse(fs.readFileSync('package.json'))\" >\u002Fdev\u002Fnull 2>&1; then\n    echo \"⚠️  Warning: package.json exists but cannot be parsed\"\n    echo \"   Using default Node.js commands\"\n    USE_DEFAULTS=true\n  fi\nfi\n```\n\n### Permission Denied\n\n```bash\nif [ ! -w \"$PROJECT_DIR\" ]; then\n  echo \"❌ Error: Cannot write to $PROJECT_DIR\"\n  echo \"   Check permissions: ls -la $PROJECT_DIR\"\n  exit 1\nfi\n```\n\n## Integration Pattern\n\nThis command is designed to be called by other AIWG commands:\n\n**From intake-wizard.md**:\n```markdown\n# At end of workflow (after generating intake forms):\n\n# Step 10: Update AGENTS.md for Factory users\nif [ -d \".factory\u002Fdroids\" ] || [ \"$PROVIDER\" = \"factory\" ]; then\n  echo \"\"\n  echo \"Detected Factory AI - updating AGENTS.md...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n**From intake-from-codebase.md**:\n```markdown\n# At end of workflow (after analyzing codebase):\n\n# Step 12: Update AGENTS.md for Factory users\nif [ -d \".factory\u002Fdroids\" ] || [ \"$PROVIDER\" = \"factory\" ]; then\n  echo \"\"\n  echo \"Updating AGENTS.md with codebase analysis...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n**From aiwg-setup-project.md**:\n```markdown\n# At end of workflow (after updating CLAUDE.md):\n\n# For Factory users, also update AGENTS.md\nif [ -d \".factory\u002Fdroids\" ]; then\n  echo \"\"\n  echo \"Factory AI detected - updating AGENTS.md...\"\n  \u002Faiwg-update-agents-md .\nfi\n```\n\n## Manual Invocation\n\nUsers can also call this directly:\n\n**Factory AI:**\n```bash\n# Update AGENTS.md for current project\n\u002Faiwg-update-agents-md\n\n# Update for specific project\n\u002Faiwg-update-agents-md \u002Fpath\u002Fto\u002Fproject\n\n# Force update even if AIWG section exists\n\u002Faiwg-update-agents-md . --force\n```\n\n**Claude Code:**\n```bash\n# Update AGENTS.md for current project\n\u002Faiwg-update-agents-md\n\n# Update for specific project\n\u002Faiwg-update-agents-md \u002Fpath\u002Fto\u002Fproject\n```\n\n## Summary\n\nThis command intelligently updates AGENTS.md for Factory AI users by:\n1. Analyzing the codebase to detect commands, patterns, and conventions\n2. Generating project-specific documentation sections\n3. Appending or updating AIWG SDLC framework integration\n4. Preserving all existing user content\n5. Providing next steps and validation\n\nThe result is a comprehensive, project-specific AGENTS.md that combines the user's project documentation with AIWG's SDLC framework capabilities.\n\n## References\n\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\u002Fhuman-authorization.md — Seek explicit authorization before overwriting existing AGENTS.md content\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Frules\u002Fresearch-before-decision.md — Analyze codebase before generating project-specific commands section\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-setup-project\u002FSKILL.md — Analogous Claude Code setup skill; calls this skill when Factory AI is detected\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-claude\u002FSKILL.md — Parallel update skill for Claude Code's CLAUDE.md configuration\n\n",{"name":5,"namespace":56,"platforms":57,"commandHint":59,"description":7},"aiwg",[58],"all",{"model":46,"category":60,"modelRole":35,"modelTier":61,"allowedTools":62,"argumentHint":63},"sdlc-setup","economy","Read, Write, Edit, Glob, Grep, Bash, TodoWrite","[project-directory] [--provider factory --interactive --guidance \"text\"]","main","6754967c344ccb087a8de06972f55a41067b291b","agentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-agents-md",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-12 00:33:10",{"source":8,"skillName":5,"commands":75,"prompt":85,"zipAvailable":86},[76,79,82],{"tool":77,"command":78},"npx","npx skills add jmagly\u002Faiwg --skill aiwg-update-agents-md",{"tool":80,"command":81},"bunx","bunx skills add jmagly\u002Faiwg --skill aiwg-update-agents-md",{"tool":83,"command":84},"pnpm","pnpm dlx skills add jmagly\u002Faiwg --skill aiwg-update-agents-md","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsdlc-complete\u002Fskills\u002Faiwg-update-agents-md\u002FSKILL.md",true,[88,94,98,104,108,112,116],{"path":89,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fbaseline_hf_api.py","SCRIPT","脚本",1411,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fbaseline_hf_api.py",{"path":95,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fbaseline_hf_api.sh",744,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fbaseline_hf_api.sh",{"path":99,"resourceType":100,"resourceTypeDesc":101,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fbaseline_hf_api.tsx","REFERENCE","参考文档",1418,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fbaseline_hf_api.tsx",{"path":105,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":106,"sourceHtmlUrl":107},"references\u002Ffind_models_by_paper.sh",7348,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Ffind_models_by_paper.sh",{"path":109,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":110,"sourceHtmlUrl":111},"references\u002Fhf_enrich_models.sh",2646,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fhf_enrich_models.sh",{"path":113,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":114,"sourceHtmlUrl":115},"references\u002Fhf_model_card_frontmatter.sh",4346,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fhf_model_card_frontmatter.sh",{"path":117,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":118,"sourceHtmlUrl":119},"references\u002Fhf_model_papers_auth.sh",4933,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-huggingface-tool-builder\u002Freferences\u002Fhf_model_papers_auth.sh",[121,147,169,175,182,196],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":128,"publishedAt":51},"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",[127],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[129,130,131,44,132,133,134,135,136,137,48,138,139,140,141,142,143,144,145,146],"host","host hardening","hardening","re","recommendations","remediation","plan","port","verification","access","only","retention","audit","never","firewall","bind","secrets","request",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":157,"publishedAt":51},"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",[153,156],{"categoryNo":154,"categoryName":155,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[158,49,159,44,160,136,161,162,48,163,129,164,139,165,166,142,143,167,168,43],"exposure analysis","unknown","credentials","collection","ufw","ports","internet","local","scope","reconstruction","operator",{"skillNo":170,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":174,"publishedAt":51},"01M70P8QATMPKA78E4FT5D2TNA","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[173],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[131,129,130,138,44,146,134,133,141,135,136,137,48,145,139,140,132,142,143,144],{"skillNo":176,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":181,"publishedAt":51},"01M70NMPVJ5H0JH131P60FW4R8","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fforensics-complete\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[179,180],{"categoryNo":154,"categoryName":155,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[49,158,142,160,136,161,48,159,129,164,139,165,166,44,143,163,162,167,168,43],{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":189,"publishedAt":51},"01M6CB4DDR0B4NNCFK7ZK7449H","fixture-skill","Exercise rule delivery.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Frule-delivery\u002Fskills\u002Ffixture-skill\u002FSKILL.md",[188],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[190,191,192,193,194,195],"fixture skill","fixture","rule","delivery","true","exercise",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":203,"publishedAt":51},"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",[202],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[204,205,165,206,191],"pi","pi local","duplicate"]