# Init Deep

Initializes a hierarchical AGENTS.md knowledge base for a project.

- Repository: https://github.com/code-yeongyu/oh-my-openagent (70577 stars)
- Category: AI and agents
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add code-yeongyu/oh-my-openagent --skill init-deep -g -a claude-code -y`
Codex: `npx skills add code-yeongyu/oh-my-openagent --skill init-deep -g -a codex -y`
Cursor: `npx skills add code-yeongyu/oh-my-openagent --skill init-deep -g -a cursor -y`
Gemini CLI: `npx skills add code-yeongyu/oh-my-openagent --skill init-deep -g -a gemini-cli -y`

## Description

Initializes a hierarchical AGENTS.md knowledge base for a project. Use when a repo needs its structure, commands, and conventions documented for agents.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# /init-deep

Generate hierarchical AGENTS.md files: root + complexity-scored subdirectories, produced by a size-formula-driven dag map-reduce (`quick` scanners -> `unspecified-high` writers) so the main session's context stays flat at any repo size.

## Usage

```
/init-deep                      # Update mode: modify existing + create new where warranted
/init-deep --create-new         # Read existing → remove all → regenerate from scratch
/init-deep --max-depth=2        # Limit directory depth (default: 3)
```

---

## Workflow (High-Level)

1. **Size & route** (main session) - ONE eval cell measures the repo and computes the node formula.
2. **Map** (dag) - `quick` scanner nodes extract per-chunk facts into bounded file reports.
3. **Reduce** (dag) - `unspecified-high` writer nodes own disjoint subtrees: score, write AGENTS.md files, emit digests.
4. **Root & verify** (dag) - one node writes root AGENTS.md from digests only; one node verifies every file.
5. **Snapshot & mode** (main session) - snapshot contract unchanged.

<critical>
**THE ALWAYS-REDUCE RULE.** The main session NEVER reads chunk reports or raw node outputs - only the verify node's verdict and, when a repair needs it, one digest. Context protection is structural (bounded fan-in at every stage), never a runtime "how much context is left" guess.

`todo` init the five phases; `start`/`done` each transition in real time.
</critical>

---

## Phase 1: Size & Route

Measure and compute in ONE eval cell - code, not mental arithmetic:

```js
# Measure (tracked files minus vendored/generated: node_modules, .git, dist,
# build, out, vendor, target, coverage, lockfiles, minified and binary files)
S        = total source bytes after exclusions
per_dir  = source bytes per directory            # bin-packing input
depth    = max directory depth                   # respect --max-depth (default 3)
existing = every AGENTS.md / CLAUDE.md path      # read the ROOT one now

The rest: https://github.com/code-yeongyu/oh-my-openagent/blob/HEAD/packages/omo-senpi/skills/init-deep/SKILL.md
