{"slug":"init-deep-2","title":"init-deep","summary":"(builtin) Initialize hierarchical AGENTS.md knowledge base","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-23T08:58:17.371296Z","repo":{"url":"https://github.com/code-yeongyu/oh-my-openagent","stars":69391,"forks":5715,"license":null,"updatedAt":"2026-09-24T23:30:44Z"},"bodyHtml":"<hr>\n<h2>name: init-deep\ndescription: \"(builtin) Initialize hierarchical AGENTS.md knowledge base\"</h2>\n<h1>/init-deep</h1>\n<p>Generate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.</p>\n<h2>Usage</h2>\n<pre><code>/init-deep                      # Update mode: modify existing + create new where warranted\n/init-deep --create-new         # Read existing → remove all → regenerate from scratch\n/init-deep --max-depth=2        # Limit directory depth (default: 3)\n</code></pre>\n<hr>\n<h2>Workflow (High-Level)</h2>\n<ol>\n<li><strong>Discovery + Analysis</strong> (concurrent)\n<ul>\n<li>Fire background explore agents immediately</li>\n<li>Main session: bash structure + LSP/codegraph code map + read existing AGENTS.md</li>\n</ul>\n</li>\n<li><strong>Score &amp; Decide</strong> - Determine AGENTS.md locations from merged findings</li>\n<li><strong>Generate</strong> - Root first, then subdirs in parallel</li>\n<li><strong>Review</strong> - Deduplicate, trim, validate</li>\n</ol>\n\n<hr>\n<h2>Phase 1: Discovery + Analysis (Concurrent)</h2>\n<p><strong>Mark \"discovery\" as in_progress.</strong></p>\n<h3>Fire Background Explore Agents IMMEDIATELY</h3>\n<p>Don't wait-these run async while main session works. <strong>Equip every agent with the code graph</strong>: any task touching structure, entry points, dependencies, or hotspots MUST query <code>codegraph_*</code> (explore/search/callers/callees/impact) and <code>lsp_symbols</code> when present, and ground its claims in that data instead of guessing from conventions. Richer real-graph context per agent = a more accurate project map.</p>\n<pre><code>// Fire all at once, collect results later\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore project structure\", run_in_background=true, prompt=\"Project structure: map real layout via codegraph_explore/codegraph_files → REPORT deviations from standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find entry points\", run_in_background=true, prompt=\"Entry points: FIND main files, trace reach via codegraph_callees + lsp_symbols → REPORT non-standard organization\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find conventions\", run_in_background=true, prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) → REPORT project-specific rules\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find anti-patterns\", run_in_background=true, prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments → LIST forbidden patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore build/CI\", run_in_background=true, prompt=\"Build/CI: FIND .github/workflows, Makefile → REPORT non-standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find test patterns\", run_in_background=true, prompt=\"Test patterns: FIND test configs/structure; codegraph_callers on core modules to see what is covered → REPORT unique conventions\")\n</code></pre>\n\n<h3>Main Session: Concurrent Analysis</h3>\n<p><strong>While background agents run</strong>, main session does:</p>\n<h4>1. Bash Structural Analysis</h4>\n<pre><code># Directory depth + file counts\nfind . -type d -not -path '*/\\\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\\\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\\\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\\\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\\\) -not -path '*/node_modules/*' 2&gt;/dev/null\n</code></pre>\n<h4>2. Read Existing AGENTS.md</h4>\n<pre><code>For each existing file found:\n  Read(filePath=file)\n  Extract: key insights, conventions, anti-patterns\n  Store in EXISTING_AGENTS map\n</code></pre>\n<p>If <code>--create-new</code>: Read all existing first (preserve context) → then delete all → regenerate.</p>\n<h4>3. Code Map - drive LSP AND codegraph (do NOT skip)</h4>\n<p>Highest-signal source for the CODE MAP and the Symbol/Export/Reference scoring rows. Complementary, not alternatives - run BOTH when present, alongside the explore agents.</p>\n<p><strong>LSP</strong> - check <code>lsp_status</code>; model-facing names are <code>lsp_status</code>/<code>lsp_symbols</code>/<code>lsp_find_references</code>/<code>lsp_goto_definition</code> (some harnesses drop the <code>lsp_</code> prefix):</p>\n<ul>\n<li><code>lsp_symbols</code> scope=\"document\" on each entry point -&gt; file outline.</li>\n<li><code>lsp_symbols</code> scope=\"workspace\", query by kind (class/interface/function) -&gt; symbol inventory.</li>\n<li><code>lsp_find_references</code> on top exports (line/character from the symbols result) -&gt; reference centrality.</li>\n</ul>\n<p><strong>codegraph</strong> - when <code>codegraph_*</code> tools exist (check <code>codegraph_status</code>); a first-class peer to LSP, NOT a last resort:</p>\n<ul>\n<li><code>codegraph_explore</code> -&gt; overview; <code>codegraph_callers</code>/<code>codegraph_callees</code>/<code>codegraph_impact</code> -&gt; centrality + blast radius for the scoring matrix; <code>codegraph_search</code>/<code>codegraph_files</code> -&gt; symbol/file inventory.</li>\n</ul>\n<p>Only if NEITHER exists: explore agents + the ast-grep skill (<code>sg</code>), and mark centrality unmeasured in the CODE MAP.</p>\n<h3>Collect Background Results</h3>\n<pre><code>// After main session analysis done, collect all task results\nfor each background task ID (`bg_...`): background_output(task_id=\"bg_...\")\n</code></pre>\n<p><strong>Merge: bash + LSP/codegraph + existing + explore findings. Mark \"discovery\" as completed.</strong></p>\n<hr>\n<h2>Phase 2: Scoring &amp; Location Decision</h2>\n<p><strong>Mark \"scoring\" as in_progress.</strong></p>\n<h3>Scoring Matrix</h3>\n<table>\n<thead>\n<tr>\n<th>Factor</th>\n<th>Weight</th>\n<th>High Threshold</th>\n<th>Source</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>File count</td>\n<td>3x</td>\n<td>&gt;20</td>\n<td>bash</td>\n</tr>\n<tr>\n<td>Subdir count</td>\n<td>2x</td>\n<td>&gt;5</td>\n<td>bash</td>\n</tr>\n<tr>\n<td>Code ratio</td>\n<td>2x</td>\n<td>&gt;70%</td>\n<td>bash</td>\n</tr>\n<tr>\n<td>Unique patterns</td>\n<td>1x</td>\n<td>Has own config</td>\n<td>explore</td>\n</tr>\n<tr>\n<td>Module boundary</td>\n<td>2x</td>\n<td>Has index.ts/<strong>init</strong>.py</td>\n<td>bash</td>\n</tr>\n<tr>\n<td>Symbol density</td>\n<td>2x</td>\n<td>&gt;30 symbols</td>\n<td>LSP/cg</td>\n</tr>\n<tr>\n<td>Export count</td>\n<td>2x</td>\n<td>&gt;10 exports</td>\n<td>LSP/cg</td>\n</tr>\n<tr>\n<td>Reference centrality</td>\n<td>3x</td>\n<td>&gt;20 refs</td>\n<td>LSP/cg</td>\n</tr>\n</tbody>\n</table>\n<h3>Decision Rules</h3>\n<table>\n<thead>\n<tr>\n<th>Score</th>\n<th>Action</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>Root (.)</strong></td>\n<td>ALWAYS create</td>\n</tr>\n<tr>\n<td><strong>&gt;15</strong></td>\n<td>Create AGENTS.md</td>\n</tr>\n<tr>\n<td><strong>8-15</strong></td>\n<td>Create if distinct domain</td>\n</tr>\n<tr>\n<td><strong>&lt;8</strong></td>\n<td>Skip (parent covers)</td>\n</tr>\n</tbody>\n</table>\n<h3>Output</h3>\n<pre><code>AGENTS_LOCATIONS = [\n  { path: \".\", type: \"root\" },\n  { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n  { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n</code></pre>\n<p><strong>Mark \"scoring\" as completed.</strong></p>\n<hr>\n<h2>Phase 3: Generate AGENTS.md</h2>\n<p><strong>Mark \"generate\" as in_progress.</strong></p>\n\n<h3>Root AGENTS.md (Full Treatment)</h3>\n<pre><code># PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n</code></pre>\n<p dir=\"\">/\n├── /    # └── </p>\n<pre><code>\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP/codegraph - skip only if neither exists or project &lt;10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n```bash\n{dev/test/build}\n</code></pre>\n<h2>NOTES</h2>\n<pre><code>\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n</code></pre>\n<p>for loc in AGENTS_LOCATIONS (except root):\ntask(category=\"writing\", load_skills=[], run_in_background=false, description=\"Generate AGENTS.md\", prompt=<code>Generate AGENTS.md for: ${loc.path} - Reason: ${loc.reason} - 30-80 lines max - NEVER repeat parent content - Sections: OVERVIEW (1 line), STRUCTURE (if &gt;5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS</code>)</p>\n<pre><code>\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review &amp; Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n</code></pre>\n<p>=== init-deep Complete ===</p>\n<p>Mode: {update | create-new}</p>\n<p>Files:\n[OK] ./AGENTS.md (root,  lines)\n[OK] ./src/hooks/AGENTS.md ( lines)</p>\n<p>Dirs Analyzed: AGENTS.md Created: AGENTS.md Updated: </p>\n<p>Hierarchy:\n./AGENTS.md\n└── src/hooks/AGENTS.md</p>\n<pre><code>\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP + codegraph concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die\n</code></pre>\n","files":[{"path":"SKILL.md","sizeBytes":11419,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-25T07:38:34.681288Z","sha256":"5EA540B471EEF026ED772123978FE5D006779A3798C21AF751BBE046733671D1","sizeBytes":4595},"review":null,"source":{"repositoryUrl":"https://github.com/code-yeongyu/oh-my-openagent","path":"packages/shared-skills/skills/init-deep","license":null,"commit":"05dcba64b749e7666dcd0296c079d31cf3c298f1","subtreeSha":"72721A1CB3E21C49AE844AE28DBC63992324FCA291D8CDF55A2F97F6FD411CDD","lastSyncedAt":"2026-09-25T07:37:33.26442Z"},"reviewedAt":"2026-09-25T07:39:43.742693Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/code-yeongyu/oh-my-openagent/tree/dev/packages/shared-skills/skills/init-deep"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install code-yeongyu-oh-my-openagent@llmmart"},{"target":"git","command":"git clone https://github.com/code-yeongyu/oh-my-openagent.git"}]}